From 6093314d779b19e045eeeb4dfecec2306db5e1cb Mon Sep 17 00:00:00 2001 From: Sophie Chang <sophiechang@chromium.org> Date: Wed, 26 Mar 2025 10:08:28 -0700 Subject: [PATCH] Roll protobuf to v30.1 This includes rolling cast_core and chromeos/assistant/internal as well NO_IFTTT=upstream changes Binary-Size: Size increase is unavoidable. Andrew said the excess for the arm64 might be a false positive Compile-Size: Size increase is unavoidable. Nico said it was small enough to not block Bug: 397699183 Change-Id: I92895bebacb2bc64a23647f7092f4bbc187e6cc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6363254 Commit-Queue: Sophie Chang <sophiechang@chromium.org> Reviewed-by: Alex Ilin <alexilin@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Yuki Awano <yawano@google.com> Cr-Commit-Position: refs/heads/main@{#1438220} --- .vpython3 | 10 +- DEPS | 4 +- build/config/android/internal_rules.gni | 2 - build/config/android/system_image.gni | 2 - chromeos/assistant/internal | 2 +- google_apis/gcm/base/mcs_util.cc | 4 +- third_party/cast_core/README.chromium | 6 +- third_party/cast_core/public/src | 2 +- third_party/dom_distiller_js/BUILD.gn | 2 - third_party/protobuf/.bazelignore | 3 - third_party/protobuf/.bazelrc | 9 +- .../protobuf/.bcr/metadata.template.json | 2 +- third_party/protobuf/.bcr/presubmit.yml | 42 +- third_party/protobuf/.github/CODEOWNERS | 14 - .../protobuf/.github/scripts/validate_yaml.py | 18 +- .../.github/workflows/clear_caches.yml | 2 +- .../.github/workflows/staleness_check.yml | 9 +- .../protobuf/.github/workflows/test_bazel.yml | 36 +- .../protobuf/.github/workflows/test_cpp.yml | 298 +- .../.github/workflows/test_csharp.yml | 23 +- .../protobuf/.github/workflows/test_java.yml | 44 +- .../.github/workflows/test_objectivec.yml | 16 +- .../protobuf/.github/workflows/test_php.yml | 90 +- .../.github/workflows/test_php_ext.yml | 7 +- .../.github/workflows/test_python.yml | 49 +- .../workflows/test_release_branches.yml | 2 +- .../protobuf/.github/workflows/test_ruby.yml | 105 +- .../.github/workflows/test_runner.yml | 10 +- .../protobuf/.github/workflows/test_rust.yml | 41 +- .../protobuf/.github/workflows/test_upb.yml | 103 +- .../protobuf/.github/workflows/test_yaml.yml | 2 +- third_party/protobuf/.gitignore | 6 +- third_party/protobuf/.gitmodules | 11 - third_party/protobuf/BUILD.bazel | 66 +- third_party/protobuf/CMakeLists.txt | 57 +- third_party/protobuf/Cargo.bazel.lock | 69 +- third_party/protobuf/DIR_METADATA | 6 - third_party/protobuf/MODULE.bazel | 171 +- third_party/protobuf/OWNERS | 5 - third_party/protobuf/Protobuf-C++.podspec | 48 - third_party/protobuf/Protobuf.podspec | 20 +- third_party/protobuf/README.chromium | 15 +- third_party/protobuf/README.md | 51 + third_party/protobuf/WORKSPACE | 127 +- third_party/protobuf/WORKSPACE.bzlmod | 45 +- .../common/proto_lang_toolchain_info.bzl | 2 +- .../bazel/java_lite_proto_library.bzl | 2 +- .../protobuf/bazel/java_proto_library.bzl | 2 +- third_party/protobuf/bazel/private/BUILD | 12 +- .../private/bazel_java_proto_library_rule.bzl | 1 - .../bazel/private/cc_proto_aspect.bzl | 7 + .../bazel/private/java_lite_proto_library.bzl | 6 +- .../bazel/private/proto_bazel_features.bzl | 5 +- .../bazel/private/toolchains/BUILD.bazel | 1 - .../upb_proto_library_internal/aspect.bzl | 2 +- .../cc_library_func.bzl | 4 +- third_party/protobuf/bazel/proto_library.bzl | 2 +- .../protobuf/bazel/py_proto_library.bzl | 12 +- third_party/protobuf/bazel/system_python.bzl | 17 - .../tests/proto_common_compile_tests.bzl | 14 +- .../protobuf/bazel/tests/testdata/BUILD | 1 + .../bazel/tests/testdata/compile_rule.bzl | 1 + .../bazel/toolchains/proto_lang_toolchain.bzl | 2 +- third_party/protobuf/benchmarks/BUILD | 10 +- .../protobuf/benchmarks/build_defs.bzl | 2 +- .../protobuf/benchmarks/descriptor_sv.proto | 42 +- third_party/protobuf/build_defs/BUILD.bazel | 42 +- third_party/protobuf/build_defs/cpp_opts.bzl | 3 - third_party/protobuf/ci/Linux.bazelrc | 5 +- third_party/protobuf/ci/Windows.bazelrc | 8 +- third_party/protobuf/ci/common.bazelrc | 15 +- third_party/protobuf/ci/macOS.bazelrc | 11 +- third_party/protobuf/cmake/BUILD.bazel | 25 + third_party/protobuf/cmake/README.md | 40 +- third_party/protobuf/cmake/abseil-cpp.cmake | 51 +- third_party/protobuf/cmake/conformance.cmake | 53 +- third_party/protobuf/cmake/dependencies.cmake | 37 + .../protobuf/cmake/dependencies_generator.py | 149 + third_party/protobuf/cmake/gtest.cmake | 64 +- third_party/protobuf/cmake/install.cmake | 7 +- .../protobuf/cmake/installed_bin_golden.txt | 4 + .../cmake/installed_include_golden.txt | 221 + .../cmake/installed_lib_shared_golden.txt | 20 + .../cmake/installed_lib_static_golden.txt | 20 + .../protobuf/cmake/protobuf-generate.cmake | 4 +- third_party/protobuf/cmake/protobuf.pc.cmake | 2 +- third_party/protobuf/cmake/tests.cmake | 28 +- .../protobuf/cmake/upb_generators.cmake | 1 + third_party/protobuf/conformance/BUILD.bazel | 71 +- third_party/protobuf/conformance/README.md | 2 +- third_party/protobuf/conformance/autoload.php | 8 +- .../binary_json_conformance_suite.cc | 159 +- .../binary_json_conformance_suite.h | 1 + .../protobuf/conformance/conformance_php.php | 12 + .../conformance/conformance_python.py | 58 +- .../protobuf/conformance/conformance_rust.rs | 2 +- .../protobuf/conformance/conformance_test.cc | 2 +- .../protobuf/conformance/failure_list_cpp.txt | 2 - .../conformance/failure_list_csharp.txt | 4 + .../conformance/failure_list_jruby_ffi.txt | 2 + .../protobuf/conformance/failure_list_php.txt | 76 +- .../conformance/failure_list_php_c.txt | 2 + .../conformance/failure_list_ruby.txt | 2 + .../conformance/failure_list_trie_node.cc | 40 +- .../conformance/failure_list_trie_node.h | 11 +- .../failure_list_trie_node_test.cc | 27 +- .../conformance/test_protos/BUILD.bazel | 1 - .../text_format_failure_list_php.txt | 4 + .../text_format_failure_list_python.txt | 47 - .../text_format_failure_list_python_cpp.txt | 32 - .../text_format_failure_list_python_upb.txt | 32 - third_party/protobuf/csharp/BUILD.bazel | 33 + .../csharp/Google.Protobuf.Tools.nuspec | 2 +- .../TestMessagesProto2.pb.cs | 1298 +- .../TestMessagesProto2Editions.pb.cs | 1303 +- .../UnittestProto3Optional.pb.cs | 85 +- .../UnittestRetention.pb.cs | 85 +- .../UnittestWellKnownTypes.pb.cs | 271 +- .../CodedInputStreamTest.cs | 16 +- .../Collections/RepeatedFieldTest.cs | 38 + .../UnsafeCollectionOperationsTest.cs | 218 + .../GeneratedMessageTest.cs | 16 +- .../ParsingPrimitivesTest.cs | 11 +- .../Reflection/FeatureSetDescriptorTest.cs | 62 +- .../src/Google.Protobuf.Test/testprotos.pb | Bin 454905 -> 460890 bytes .../Google.Protobuf/Collections/MapField.cs | 2 +- .../Collections/RepeatedField.cs | 78 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- .../InvalidProtocolBufferException.cs | 6 + .../src/Google.Protobuf/JsonFormatter.cs | 6 +- .../csharp/src/Google.Protobuf/JsonParser.cs | 4 +- .../src/Google.Protobuf/JsonTokenizer.cs | 2 +- .../src/Google.Protobuf/ParsingPrimitives.cs | 35 +- .../Reflection/Descriptor.pb.cs | 182 +- .../Reflection/DescriptorPool.cs | 2 +- .../Reflection/FeatureSetDescriptor.cs | 83 +- .../Reflection/FeatureSetDescriptor.g.cs | 17 + .../FeatureSetDescriptor.g.cs.template | 17 + .../Reflection/FieldDescriptor.cs | 2 +- .../Reflection/FileDescriptor.cs | 6 +- .../RepeatedFieldExtensions.cs | 38 + .../UnsafeCollectionOperations.cs | 96 + .../WellKnownTypes/Wrappers.pb.cs | 27 + .../src/Google.Protobuf/WritingPrimitives.cs | 4 +- third_party/protobuf/docs/options.md | 24 +- third_party/protobuf/docs/third_party.md | 3 + third_party/protobuf/docs/upb/arena_fusion.md | 273 + third_party/protobuf/docs/upb/design.md | 14 +- third_party/protobuf/editions/BUILD | 35 +- .../protobuf/editions/codegen_tests/BUILD | 1 + .../proto2_multiline_comments.proto | 14 + third_party/protobuf/editions/defaults.bzl | 34 +- .../protobuf/editions/generated_files_test.cc | 1 + .../golden/compare_cpp_codegen_failure.txt | 28 +- .../golden/compare_cpp_codegen_failure.xml | 4 +- .../test_messages_proto2_editions.proto | 25 + .../editions/internal_defaults_escape.cc | 126 +- third_party/protobuf/examples/.bazelrc | 7 +- third_party/protobuf/examples/AddPerson.java | 5 +- third_party/protobuf/examples/BUILD.bazel | 25 +- third_party/protobuf/examples/MODULE.bazel | 27 +- third_party/protobuf/examples/Makefile | 4 +- third_party/protobuf/examples/WORKSPACE | 57 +- .../examples/examples_with_hyphen/BUILD.bazel | 14 + .../examples_with_hyphen/MODULE.bazel | 13 + .../examples/examples_with_hyphen/empty.proto | 5 + third_party/protobuf/examples/go/go.mod | 2 +- third_party/protobuf/go/BUILD.bazel | 4 +- .../go/google/protobuf/go_features.proto | 23 + third_party/protobuf/hpb/backend/upb/upb.h | 3 +- .../protobuf/hpb/bazel/hpb_proto_library.bzl | 202 +- third_party/protobuf/hpb/extension.cc | 32 + third_party/protobuf/hpb/extension.h | 317 +- third_party/protobuf/hpb/hpb.cc | 148 - third_party/protobuf/hpb/hpb.h | 293 +- third_party/protobuf/hpb/internal/internal.h | 18 + .../protobuf/hpb/internal/message_lock.cc | 85 + .../protobuf/hpb/internal/message_lock.h | 21 + .../hpb/internal/message_lock_test.cc | 31 +- .../protobuf/hpb/internal/template_help.h | 28 +- .../hpb/internal/template_help_test.cc | 40 + third_party/protobuf/hpb/ptr.h | 5 - third_party/protobuf/hpb/requires.h | 7 + third_party/protobuf/hpb/status.cc | 39 + third_party/protobuf/hpb/status.h | 41 + third_party/protobuf/hpb_generator/context.h | 149 + .../protobuf/hpb_generator/gen_accessors.cc | 370 +- .../protobuf/hpb_generator/gen_accessors.h | 13 +- .../protobuf/hpb_generator/gen_enums.cc | 36 +- .../protobuf/hpb_generator/gen_enums.h | 6 +- .../protobuf/hpb_generator/gen_extensions.cc | 81 +- .../protobuf/hpb_generator/gen_extensions.h | 10 +- .../protobuf/hpb_generator/gen_messages.cc | 282 +- .../protobuf/hpb_generator/gen_messages.h | 6 +- .../hpb_generator/gen_repeated_fields.cc | 119 +- .../hpb_generator/gen_repeated_fields.h | 12 +- .../protobuf/hpb_generator/gen_utils.cc | 33 + .../protobuf/hpb_generator/gen_utils.h | 2 + third_party/protobuf/hpb_generator/names.cc | 23 +- third_party/protobuf/hpb_generator/names.h | 6 +- third_party/protobuf/hpb_generator/output.cc | 59 - third_party/protobuf/hpb_generator/output.h | 150 - ...oc-gen-upb-protos.cc => protoc-gen-hpb.cc} | 177 +- .../tests/basic_test_editions.proto | 7 + .../hpb_generator/tests/child_model.proto | 15 +- .../hpb_generator/tests/extension_test.cc | 539 + .../hpb_generator/tests/legacy-name.proto | 4 +- .../hpb_generator/tests/naming_conflict.proto | 6 +- .../hpb_generator/tests/no_package.proto | 3 +- .../tests/no_package_enum_user.proto | 6 +- .../hpb_generator/tests/repeated_test.cc | 318 + .../hpb_generator/tests/set_alias.proto | 28 + .../hpb_generator/tests/test_enum.proto | 2 +- .../hpb_generator/tests/test_extension.proto | 20 +- .../hpb_generator/tests/test_generated.cc | 775 +- .../hpb_generator/tests/test_hpb_bzl_alias.cc | 22 + .../hpb_generator/tests/test_model.proto | 133 +- third_party/protobuf/java/README.md | 83 +- third_party/protobuf/java/bom/pom.xml | 2 +- third_party/protobuf/java/core/BUILD.bazel | 22 +- .../com/google/protobuf/AbstractMessage.java | 11 + .../google/protobuf/AbstractMessageLite.java | 3 +- .../google/protobuf/AbstractProtobufList.java | 3 +- .../com/google/protobuf/ArrayDecoders.java | 45 +- .../com/google/protobuf/BinaryWriter.java | 72 +- .../com/google/protobuf/BooleanArrayList.java | 3 +- .../java/com/google/protobuf/ByteString.java | 9 +- .../com/google/protobuf/CodedInputStream.java | 100 +- .../protobuf/CodedInputStreamReader.java | 8 +- .../google/protobuf/CodedOutputStream.java | 128 +- .../java/com/google/protobuf/DebugFormat.java | 23 +- .../java/com/google/protobuf/Descriptors.java | 97 +- .../com/google/protobuf/DoubleArrayList.java | 3 +- .../java/com/google/protobuf/FieldSet.java | 9 +- .../com/google/protobuf/FloatArrayList.java | 3 +- .../com/google/protobuf/GeneratedMessage.java | 27 +- .../google/protobuf/GeneratedMessageLite.java | 104 +- .../com/google/protobuf/IntArrayList.java | 3 +- .../java/com/google/protobuf/Internal.java | 3 +- .../google/protobuf/JavaEditionDefaults.java | 2 +- .../java/com/google/protobuf/LazyField.java | 3 +- .../com/google/protobuf/LazyFieldLite.java | 11 +- .../com/google/protobuf/LongArrayList.java | 3 +- .../java/com/google/protobuf/MapField.java | 15 +- .../com/google/protobuf/MapFieldBuilder.java | 3 +- .../com/google/protobuf/MapFieldLite.java | 7 +- .../java/com/google/protobuf/Message.java | 3 +- .../google/protobuf/MessageReflection.java | 2 + .../com/google/protobuf/MessageSchema.java | 2 +- .../com/google/protobuf/MessageSetSchema.java | 2 + .../protobuf/ProtobufToStringOutput.java | 18 +- .../protobuf/RepeatedFieldBuilderV3.java | 1 + .../com/google/protobuf/RopeByteString.java | 3 +- .../com/google/protobuf/RuntimeVersion.java | 22 +- .../google/protobuf/SingleFieldBuilder.java | 8 +- .../com/google/protobuf/SmallSortedMap.java | 10 +- .../java/com/google/protobuf/TextFormat.java | 557 +- .../protobuf/TextFormatParseLocation.java | 3 +- .../google/protobuf/UnknownFieldSchema.java | 3 + .../com/google/protobuf/UnknownFieldSet.java | 7 +- .../google/protobuf/UnknownFieldSetLite.java | 4 +- .../UnredactedDebugFormatForTest.java | 39 + .../google/protobuf/java_features.proto | 18 + .../google/protobuf/AbstractMessageTest.java | 18 +- .../java/com/google/protobuf/AnyTest.java | 2 +- .../google/protobuf/CachedFieldSizeTest.java | 4 +- .../google/protobuf/CodedInputStreamTest.java | 84 +- .../protobuf/CodedOutputStreamTest.java | 366 +- .../com/google/protobuf/DebugFormatTest.java | 10 +- .../google/protobuf/DeprecatedFieldTest.java | 2 +- .../com/google/protobuf/DescriptorsTest.java | 76 +- .../protobuf/DiscardUnknownFieldsTest.java | 2 +- .../google/protobuf/DynamicMessageTest.java | 14 +- .../java/com/google/protobuf/EnumTest.java | 4 +- .../ExtensionRegistryFactoryTest.java | 8 +- .../google/protobuf/FieldPresenceTest.java | 89 +- .../google/protobuf/GeneratedMessageTest.java | 54 +- .../protobuf/LazilyParsedMessageSetTest.java | 46 +- .../google/protobuf/LazyFieldLiteTest.java | 6 +- .../com/google/protobuf/LazyFieldTest.java | 4 +- .../google/protobuf/LazyMessageLiteTest.java | 8 +- .../protobuf/LazyStringEndToEndTest.java | 2 +- .../LegacyUnredactedTextFormatTest.java | 2 +- .../protobuf/LiteEqualsAndHashTest.java | 10 +- .../java/com/google/protobuf/MessageTest.java | 10 +- .../google/protobuf/NestedBuildersTest.java | 8 +- .../com/google/protobuf/ParserLiteTest.java | 4 +- .../java/com/google/protobuf/ParserTest.java | 20 +- .../protobuf/Proto2UnknownEnumValueTest.java | 6 +- .../protobuf/ProtobufToStringOutputTest.java | 4 +- .../protobuf/RepeatedFieldBuilderTest.java | 4 +- .../protobuf/SensitiveFieldReportingTest.java | 13 - .../java/com/google/protobuf/ServiceTest.java | 20 +- .../protobuf/SingleFieldBuilderTest.java | 4 +- .../java/com/google/protobuf/TestUtil.java | 410 +- .../protobuf/TextFormatParseInfoTreeTest.java | 2 +- .../com/google/protobuf/TextFormatTest.java | 209 +- .../com/google/protobuf/TypeRegistryTest.java | 2 +- .../google/protobuf/UnknownFieldSetTest.java | 28 +- .../UnredactedDebugFormatForTestTest.java | 132 + .../google/protobuf/WireFormatLiteTest.java | 24 +- .../com/google/protobuf/WireFormatTest.java | 24 +- .../protobuf/cached_field_size_test.proto | 4 +- .../google/protobuf/field_name_clashes.proto | 19 + .../google/protobuf/field_presence_test.proto | 12 +- .../google/protobuf/lazy_fields_lite.proto | 2 +- .../protobuf/lite_equals_and_hash.proto | 2 +- .../google/protobuf/multiple_files_test.proto | 2 +- .../protobuf/nested_builders_test.proto | 2 +- .../google/protobuf/nested_extension.proto | 2 +- .../protobuf/nested_extension_lite.proto | 2 +- .../protobuf/non_nested_extension.proto | 2 +- .../protobuf/non_nested_extension_lite.proto | 2 +- .../protobuf/outer_class_name_test.proto | 2 +- .../protobuf/outer_class_name_test2.proto | 2 +- .../protobuf/outer_class_name_test3.proto | 2 +- .../google/protobuf/test_custom_options.proto | 2 +- .../protobuf/java/internal/BUILD.bazel | 1 + .../protobuf/java/kotlin-lite/BUILD.bazel | 1 + .../com/google/protobuf/Proto2LiteTest.kt | 6 +- third_party/protobuf/java/kotlin/BUILD.bazel | 7 +- third_party/protobuf/java/kotlin/pom.xml | 2 +- .../kotlin/com/google/protobuf/AniesTest.kt | 6 +- .../kotlin/com/google/protobuf/Proto2Test.kt | 54 +- third_party/protobuf/java/lite/BUILD.bazel | 2 +- .../java/com/google/protobuf/LiteTest.java | 16 +- third_party/protobuf/java/pom.xml | 2 +- third_party/protobuf/java/protoc/pom.xml | 2 +- third_party/protobuf/java/util/BUILD.bazel | 12 +- .../com/google/protobuf/util/Durations.java | 22 +- .../com/google/protobuf/util/JsonFormat.java | 53 +- .../com/google/protobuf/util/Timestamps.java | 42 +- .../google/protobuf/util/DurationsTest.java | 20 + .../protobuf/util/FieldMaskTreeTest.java | 10 +- .../protobuf/util/FieldMaskUtilTest.java | 4 +- .../google/protobuf/util/TimestampsTest.java | 253 +- third_party/protobuf/lua/BUILD.bazel | 3 +- third_party/protobuf/lua/def.c | 6 +- third_party/protobuf/lua/upb.c | 2 + third_party/protobuf/lua/upbc.cc | 7 +- third_party/protobuf/maven_dev_install.json | 1364 ++ third_party/protobuf/maven_install.json | 1133 +- third_party/protobuf/objectivec/BUILD.bazel | 13 - .../objectivec/DevTools/full_mac_build.sh | 12 +- .../protobuf/objectivec/GPBBootstrap.h | 8 +- .../protobuf/objectivec/GPBCodedInputStream.m | 14 - .../GPBCodedInputStream_PackagePrivate.h | 10 - .../objectivec/GPBCodedOutputStream.h | 33 - .../objectivec/GPBCodedOutputStream.m | 40 - .../GPBCodedOutputStream_PackagePrivate.h | 9 - .../protobuf/objectivec/GPBDescriptor.h | 3 - .../protobuf/objectivec/GPBDescriptor.m | 322 +- .../objectivec/GPBDescriptor_PackagePrivate.h | 96 +- .../protobuf/objectivec/GPBDictionary.m | 2 +- third_party/protobuf/objectivec/GPBMessage.h | 24 - third_party/protobuf/objectivec/GPBMessage.m | 306 +- .../objectivec/GPBMessage_PackagePrivate.h | 6 - .../protobuf/objectivec/GPBProtocolBuffers.h | 1 - .../protobuf/objectivec/GPBProtocolBuffers.m | 1 - .../protobuf/objectivec/GPBRuntimeTypes.h | 21 - .../GPBUnknownField+Additions.swift | 4 - .../protobuf/objectivec/GPBUnknownField.h | 114 - .../protobuf/objectivec/GPBUnknownField.m | 304 - .../protobuf/objectivec/GPBUnknownFieldSet.h | 61 - .../protobuf/objectivec/GPBUnknownFieldSet.m | 348 - .../GPBUnknownFieldSet_PackagePrivate.h | 32 - .../GPBUnknownField_PackagePrivate.h | 22 - .../protobuf/objectivec/GPBUnknownFields.h | 2 - .../protobuf/objectivec/GPBUnknownFields.m | 16 - .../protobuf/objectivec/GPBUtilities.h | 15 - .../protobuf/objectivec/GPBUtilities.m | 84 +- .../objectivec/GPBUtilities_PackagePrivate.h | 22 +- .../protobuf/objectivec/GPBWellKnownTypes.h | 11 - .../protobuf/objectivec/GPBWellKnownTypes.m | 12 - .../protobuf/objectivec/GPBWireFormat.m | 2 +- .../protobuf/objectivec/GPBWrappers.pbobjc.h | 27 + .../Tests/GPBCodedInputStreamTests.m | 14 +- .../objectivec/Tests/GPBCompileTest10.m | 2 +- .../objectivec/Tests/GPBCompileTest25.m | 15 - .../Tests/GPBMessage30007FormatTest.m | 445 + .../Tests/GPBMessageTests+ClassNames.m | 145 - .../Tests/GPBMessageTests+Serialization.m | 32 - .../objectivec/Tests/GPBMessageTests.m | 136 +- .../objectivec/Tests/GPBTestUtilities.h | 2 +- .../objectivec/Tests/GPBUnknownFieldSetTest.m | 674 - .../objectivec/Tests/GPBUtilitiesTests.m | 45 - .../objectivec/Tests/GPBWireFormatTests.m | 31 +- .../objectivec/google/protobuf/Any.pbobjc.h | 2 - .../objectivec/google/protobuf/Api.pbobjc.h | 2 - .../google/protobuf/Duration.pbobjc.h | 2 - .../objectivec/google/protobuf/Empty.pbobjc.h | 2 - .../google/protobuf/FieldMask.pbobjc.h | 2 - .../google/protobuf/SourceContext.pbobjc.h | 2 - .../google/protobuf/Struct.pbobjc.h | 2 - .../google/protobuf/Timestamp.pbobjc.h | 2 - .../objectivec/google/protobuf/Type.pbobjc.h | 2 - .../google/protobuf/Wrappers.pbobjc.h | 2 - .../0029-make-initializers-optimizable.patch | 54 +- .../0030-workaround-windows-constinit.patch | 65 +- .../0031-workaround-cfi-unrelated-cast.patch | 20 + .../0039-generate-mediapipe-anylite.patch | 28 +- .../protobuf/patches/0046-absl-log.patch | 24 - ...-usage-if-absl-internal-if_constexpr.patch | 91 - third_party/protobuf/php/BUILD.bazel | 141 +- .../php/ext/google/protobuf/config.w32 | 9 +- .../google/protobuf/generate_package_xml.sh | 2 +- .../php/ext/google/protobuf/message.c | 14 +- .../php/ext/google/protobuf/php-upb.c | 2612 ++-- .../php/ext/google/protobuf/php-upb.h | 3434 +++-- .../php/ext/google/protobuf/protobuf.h | 2 +- .../protobuf/php/ext/google/protobuf/wkt.inc | 406 +- .../protobuf/php/internal_generated_files.bzl | 99 + .../src/GPBMetadata/Google/Protobuf/Any.php | 9 +- .../src/GPBMetadata/Google/Protobuf/Api.php | 25 +- .../GPBMetadata/Google/Protobuf/Duration.php | 9 +- .../GPBMetadata/Google/Protobuf/FieldMask.php | 8 +- .../GPBMetadata/Google/Protobuf/GPBEmpty.php | 8 +- .../Google/Protobuf/Internal/Descriptor.php | 155 +- .../Google/Protobuf/SourceContext.php | 8 +- .../GPBMetadata/Google/Protobuf/Struct.php | Bin 1162 -> 1600 bytes .../GPBMetadata/Google/Protobuf/Timestamp.php | 9 +- .../src/GPBMetadata/Google/Protobuf/Type.php | Bin 2205 -> 3575 bytes .../GPBMetadata/Google/Protobuf/Wrappers.php | 28 +- .../protobuf/php/src/Google/Protobuf/Any.php | 26 +- .../protobuf/php/src/Google/Protobuf/Api.php | 1 + .../php/src/Google/Protobuf/BoolValue.php | 3 + .../php/src/Google/Protobuf/BytesValue.php | 3 + .../php/src/Google/Protobuf/DoubleValue.php | 3 + .../php/src/Google/Protobuf/Duration.php | 1 + .../protobuf/php/src/Google/Protobuf/Enum.php | 35 + .../php/src/Google/Protobuf/EnumValue.php | 1 + .../php/src/Google/Protobuf/Field.php | 1 + .../src/Google/Protobuf/Field/Cardinality.php | 4 +- .../php/src/Google/Protobuf/Field/Kind.php | 4 +- .../php/src/Google/Protobuf/FieldMask.php | 1 + .../php/src/Google/Protobuf/FloatValue.php | 3 + .../php/src/Google/Protobuf/GPBEmpty.php | 1 + .../php/src/Google/Protobuf/Int32Value.php | 3 + .../php/src/Google/Protobuf/Int64Value.php | 3 + .../Protobuf/Internal/DescriptorPool.php | 5 +- .../Protobuf/Internal/DescriptorProto.php | 1 + .../DescriptorProto/ExtensionRange.php | 4 +- .../DescriptorProto/ReservedRange.php | 4 +- .../DescriptorProto_ExtensionRange.php | 16 - .../DescriptorProto_ReservedRange.php | 16 - .../src/Google/Protobuf/Internal/Edition.php | 122 + .../Protobuf/Internal/EnumDescriptorProto.php | 1 + .../EnumDescriptorProto/EnumReservedRange.php | 4 +- .../EnumDescriptorProto_EnumReservedRange.php | 16 - .../Google/Protobuf/Internal/EnumOptions.php | 65 +- .../Internal/EnumValueDescriptorProto.php | 1 + .../Protobuf/Internal/EnumValueOptions.php | 153 + .../Internal/ExtensionRangeOptions.php | 139 + .../ExtensionRangeOptions/Declaration.php | 278 + .../VerificationState.php | 53 + .../Google/Protobuf/Internal/FeatureSet.php | 300 + .../FeatureSet/EnforceNamingStyle.php | 54 + .../Protobuf/Internal/FeatureSet/EnumType.php | 54 + .../Internal/FeatureSet/FieldPresence.php | 59 + .../Internal/FeatureSet/JsonFormat.php | 54 + .../Internal/FeatureSet/MessageEncoding.php | 54 + .../FeatureSet/RepeatedFieldEncoding.php | 54 + .../Internal/FeatureSet/Utf8Validation.php | 54 + .../Protobuf/Internal/FeatureSetDefaults.php | 162 + .../FeatureSetEditionDefault.php | 164 + .../Internal/FieldDescriptorProto.php | 49 +- .../Internal/FieldDescriptorProto/Label.php | 18 +- .../Internal/FieldDescriptorProto/Type.php | 9 +- .../Internal/FieldDescriptorProto_Label.php | 16 - .../Internal/FieldDescriptorProto_Type.php | 16 - .../Google/Protobuf/Internal/FieldOptions.php | 351 +- .../Protobuf/Internal/FieldOptions/CType.php | 11 +- .../Internal/FieldOptions/EditionDefault.php | 115 + .../Internal/FieldOptions/FeatureSupport.php | 236 + .../Protobuf/Internal/FieldOptions/JSType.php | 4 +- .../Internal/FieldOptions/OptionRetention.php | 56 + .../FieldOptions/OptionTargetType.php | 93 + .../Protobuf/Internal/FieldOptions_CType.php | 16 - .../Protobuf/Internal/FieldOptions_JSType.php | 16 - .../Protobuf/Internal/FileDescriptorProto.php | 49 +- .../Protobuf/Internal/FileDescriptorSet.php | 1 + .../Google/Protobuf/Internal/FileOptions.php | 158 +- .../Internal/FileOptions/OptimizeMode.php | 4 +- .../Internal/FileOptions_OptimizeMode.php | 16 - .../Protobuf/Internal/GeneratedCodeInfo.php | 1 + .../Internal/GeneratedCodeInfo/Annotation.php | 4 +- .../GeneratedCodeInfo/Annotation/Semantic.php | 63 + .../Internal/GeneratedCodeInfo_Annotation.php | 16 - .../src/Google/Protobuf/Internal/Message.php | 22 + .../Protobuf/Internal/MessageOptions.php | 89 +- .../Internal/MethodDescriptorProto.php | 1 + .../Protobuf/Internal/MethodOptions.php | 57 + .../MethodOptions/IdempotencyLevel.php | 4 +- .../MethodOptions_IdempotencyLevel.php | 16 - .../Internal/OneofDescriptorProto.php | 1 + .../Google/Protobuf/Internal/OneofOptions.php | 57 + .../Internal/ServiceDescriptorProto.php | 1 + .../Protobuf/Internal/ServiceOptions.php | 57 + .../Protobuf/Internal/SourceCodeInfo.php | 1 + .../Internal/SourceCodeInfo/Location.php | 44 +- .../Internal/SourceCodeInfo_Location.php | 16 - .../Protobuf/Internal/UninterpretedOption.php | 1 + .../Internal/UninterpretedOption/NamePart.php | 4 +- .../Internal/UninterpretedOption_NamePart.php | 16 - .../php/src/Google/Protobuf/ListValue.php | 1 + .../php/src/Google/Protobuf/Method.php | 1 + .../php/src/Google/Protobuf/Mixin.php | 1 + .../php/src/Google/Protobuf/NullValue.php | 3 +- .../php/src/Google/Protobuf/Option.php | 1 + .../php/src/Google/Protobuf/SourceContext.php | 1 + .../php/src/Google/Protobuf/StringValue.php | 3 + .../php/src/Google/Protobuf/Struct.php | 1 + .../php/src/Google/Protobuf/Syntax.php | 8 + .../php/src/Google/Protobuf/Timestamp.php | 3 +- .../protobuf/php/src/Google/Protobuf/Type.php | 35 + .../php/src/Google/Protobuf/UInt32Value.php | 3 + .../php/src/Google/Protobuf/UInt64Value.php | 3 + .../php/src/Google/Protobuf/Value.php | 1 + .../protobuf/php/tests/EncodeDecodeTest.php | 62 + .../protobuf/php/tests/WellKnownTest.php | 40 + third_party/protobuf/pkg/BUILD.bazel | 21 + third_party/protobuf/proto_sources.gni | 2 - third_party/protobuf/protobuf.bzl | 42 +- third_party/protobuf/protobuf_deps.bzl | 83 +- third_party/protobuf/protobuf_version.bzl | 11 +- third_party/protobuf/protos/BUILD | 6 - third_party/protobuf/protos/protos.h | 9 - third_party/protobuf/python/BUILD.bazel | 34 +- third_party/protobuf/python/build_targets.bzl | 50 +- third_party/protobuf/python/convert.c | 11 +- third_party/protobuf/python/descriptor.c | 19 +- .../protobuf/python/descriptor_containers.c | 20 +- third_party/protobuf/python/descriptor_pool.c | 4 +- third_party/protobuf/python/dist/BUILD.bazel | 48 +- third_party/protobuf/python/dist/dist.bzl | 1 + third_party/protobuf/python/dist/setup.py | 9 +- .../protobuf/python/dist/system_python.bzl | 4 +- .../protobuf/python/docs/requirements.txt | 2 +- third_party/protobuf/python/extension_dict.c | 8 +- .../python/google/protobuf/__init__.py | 2 +- .../google/protobuf/compiler/plugin_pb2.py | 8 +- .../google/protobuf/descriptor_database.py | 26 +- .../python/google/protobuf/descriptor_pb2.py | 117 +- .../protobuf/internal/_parameterized.py | 420 - .../google/protobuf/internal/any_test.py | 2 +- .../google/protobuf/internal/builder.py | 7 +- .../google/protobuf/internal/containers.py | 13 + .../google/protobuf/internal/decoder.py | 177 +- .../google/protobuf/internal/decoder_test.py | 92 +- .../internal/descriptor_database_test.py | 35 +- .../protobuf/internal/descriptor_pool_test.py | 192 +- .../protobuf/internal/descriptor_test.py | 89 +- .../protobuf/internal/field_mask_test.py | 2 +- .../protobuf/internal/generator_test.py | 39 +- .../protobuf/internal/json_format_test.py | 87 +- .../protobuf/internal/message_factory_test.py | 42 +- .../internal/message_set_extensions.proto | 7 + .../google/protobuf/internal/message_test.py | 175 +- .../protobuf/internal/more_messages.proto | 4 - .../protobuf/internal/numpy/BUILD.bazel | 5 +- .../protobuf/internal/proto_builder_test.py | 23 +- .../google/protobuf/internal/proto_test.py | 48 +- .../protobuf/internal/proto_text_test.py | 36 + .../internal/python_edition_defaults.py | 2 +- .../protobuf/internal/python_message.py | 33 +- .../protobuf/internal/reflection_cpp_test.py | 4 +- .../protobuf/internal/reflection_test.py | 127 +- .../internal/service_reflection_test.py | 9 +- .../protobuf/internal/symbol_database_test.py | 39 +- .../protobuf/internal/test_proto2.proto | 11 + .../google/protobuf/internal/test_util.py | 2 +- .../protobuf/internal/testing_refleaks.py | 5 +- .../protobuf/internal/text_format_test.py | 566 +- .../google/protobuf/internal/type_checkers.py | 5 + .../protobuf/internal/unknown_fields_test.py | 17 +- .../protobuf/internal/well_known_types.py | 6 +- .../internal/well_known_types_test.py | 22 +- .../python/google/protobuf/json_format.py | 34 +- .../python/google/protobuf/message.py | 26 + .../python/google/protobuf/message_factory.py | 63 - .../protobuf/python/google/protobuf/proto.py | 39 +- .../python/google/protobuf/proto_api.cc | 142 + .../python/google/protobuf/proto_api.h | 92 +- .../python/google/protobuf/proto_text.py | 129 + .../google/protobuf/pyext/descriptor.cc | 30 +- .../google/protobuf/pyext/descriptor_pool.h | 5 +- .../google/protobuf/pyext/extension_dict.cc | 54 +- .../google/protobuf/pyext/extension_dict.h | 6 +- .../python/google/protobuf/pyext/field.h | 4 +- .../google/protobuf/pyext/map_container.cc | 104 +- .../python/google/protobuf/pyext/message.cc | 90 +- .../python/google/protobuf/pyext/message.h | 32 +- .../google/protobuf/pyext/message_module.cc | 250 +- .../google/protobuf/pyext/unknown_field_set.h | 8 +- .../python/google/protobuf/reflection.py | 49 - .../python/google/protobuf/runtime_version.py | 6 +- .../python/google/protobuf/service.py | 213 - .../python/google/protobuf/symbol_database.py | 18 - .../python/google/protobuf/text_format.py | 11 +- .../python/google/protobuf/unknown_fields.py | 7 +- third_party/protobuf/python/internal.bzl | 7 +- third_party/protobuf/python/map.c | 59 +- third_party/protobuf/python/message.c | 24 +- .../protobuf/python/pb_unit_tests/BUILD | 34 - .../protobuf/python/pb_unit_tests/README.md | 11 - .../descriptor_pool_test_wrapper.py | 37 - .../pb_unit_tests/descriptor_test_wrapper.py | 41 - .../pb_unit_tests/generator_test_wrapper.py | 35 - .../message_factory_test_wrapper.py | 37 - .../pb_unit_tests/message_test_wrapper.py | 48 - .../proto_builder_test_wrapper.py | 37 - .../pb_unit_tests/pyproto_test_wrapper.bzl | 24 - .../pb_unit_tests/reflection_test_wrapper.py | 53 - third_party/protobuf/python/protobuf.c | 6 +- .../python/protobuf_distutils/setup.py | 2 +- third_party/protobuf/python/py_extension.bzl | 6 +- .../protobuf/python/python_version_test.py | 4 +- third_party/protobuf/python/repeated.c | 37 +- third_party/protobuf/python/requirements.txt | 3 +- third_party/protobuf/python/unknown_fields.c | 43 +- .../protobuf/regenerate_stale_files.sh | 3 + third_party/protobuf/ruby/.gitignore | 2 + third_party/protobuf/ruby/Gemfile.lock | 48 + third_party/protobuf/ruby/README.md | 9 +- third_party/protobuf/ruby/Rakefile | 2 +- .../ruby/ext/google/protobuf_c/BUILD.bazel | 4 +- .../ruby/ext/google/protobuf_c/convert.c | 13 +- .../ruby/ext/google/protobuf_c/defs.c | 163 +- .../ruby/ext/google/protobuf_c/extconf.rb | 12 + .../ruby/ext/google/protobuf_c/glue.c | 63 + .../ruby/ext/google/protobuf_c/message.c | 6 +- .../ruby/ext/google/protobuf_c/protobuf.c | 3 +- .../ruby/ext/google/protobuf_c/ruby-upb.c | 3092 +++-- .../ruby/ext/google/protobuf_c/ruby-upb.h | 3469 +++-- .../protobuf/ruby/google-protobuf.gemspec | 2 +- .../protobuf/ruby/lib/google/BUILD.bazel | 1 + .../lib/google/protobuf/ffi/descriptor.rb | 10 + .../google/protobuf/ffi/enum_descriptor.rb | 10 + .../ruby/lib/google/protobuf/ffi/ffi.rb | 1 - .../google/protobuf/ffi/field_descriptor.rb | 10 + .../google/protobuf/ffi/file_descriptor.rb | 10 + .../google/protobuf/ffi/internal/convert.rb | 6 +- .../ruby/lib/google/protobuf/ffi/message.rb | 4 +- .../google/protobuf/ffi/method_descriptor.rb | 12 +- .../google/protobuf/ffi/oneof_descriptor.rb | 10 + .../google/protobuf/ffi/service_descriptor.rb | 12 +- .../protobuf/ruby/lib/google/protobuf_ffi.rb | 3 +- third_party/protobuf/ruby/pom.xml | 4 +- .../google/protobuf/jruby/RubyDescriptor.java | 21 + .../protobuf/jruby/RubyDescriptorPool.java | 4 +- .../protobuf/jruby/RubyEnumDescriptor.java | 21 + .../protobuf/jruby/RubyFieldDescriptor.java | 21 + .../protobuf/jruby/RubyFileDescriptor.java | 22 + .../google/protobuf/jruby/RubyMessage.java | 6 +- .../protobuf/jruby/RubyMethodDescriptor.java | 22 + .../protobuf/jruby/RubyOneofDescriptor.java | 21 + .../protobuf/jruby/RubyServiceDescriptor.java | 22 + .../java/com/google/protobuf/jruby/Utils.java | 17 +- third_party/protobuf/ruby/tests/BUILD.bazel | 20 + third_party/protobuf/ruby/tests/basic.rb | 31 + .../protobuf/ruby/tests/basic_proto2.rb | 9 + .../protobuf/ruby/tests/encode_decode_test.rb | 30 +- .../protobuf/ruby/tests/memory_test.rb | 2 + .../ruby/tests/repeated_field_test.rb | 8 +- .../protobuf/ruby/tests/service_test.rb | 10 +- third_party/protobuf/ruby/tests/utf8.rb | 14 +- third_party/protobuf/rust/BUILD | 106 +- third_party/protobuf/rust/aspects.bzl | 79 +- third_party/protobuf/rust/codegen_traits.rs | 8 +- third_party/protobuf/rust/cpp.rs | 566 +- third_party/protobuf/rust/cpp_kernel/BUILD | 8 +- third_party/protobuf/rust/cpp_kernel/map.cc | 279 +- third_party/protobuf/rust/cpp_kernel/map.h | 122 - .../protobuf/rust/cpp_kernel/repeated.cc | 47 + .../protobuf/rust/cpp_kernel/strings.cc | 15 +- .../protobuf/rust/cpp_kernel/strings.h | 16 + third_party/protobuf/rust/defs.bzl | 38 +- third_party/protobuf/rust/dist.bzl | 100 + third_party/protobuf/rust/gtest_matchers.rs | 30 +- .../protobuf/rust/gtest_matchers_impl.rs | 51 + third_party/protobuf/rust/internal.rs | 80 +- third_party/protobuf/rust/map.rs | 29 +- third_party/protobuf/rust/prelude.rs | 17 +- third_party/protobuf/rust/proto_macro.rs | 203 +- third_party/protobuf/rust/protobuf.rs | 25 +- .../protobuf/rust/protobuf_codegen/Cargo.toml | 9 - .../rust/protobuf_codegen/example/Cargo.toml | 10 - .../rust/protobuf_codegen/example/build.rs | 14 - .../protobuf/rust/protobuf_codegen/src/lib.rs | 154 - .../protobuf/rust/release_crates/BUILD | 31 + .../protobuf/rust/release_crates/README.md | 4 + .../rust/release_crates/cargo_test.sh | 90 + .../rust/release_crates/protobuf/BUILD | 40 + .../protobuf/Cargo-template.toml} | 11 +- .../protobuf/README-template.md | 48 + .../protobuf}/build.rs | 0 .../release_crates/protobuf_codegen/BUILD | 38 + .../protobuf_codegen/Cargo-template.toml | 15 + .../protobuf_codegen/README-template.md | 27 + .../protobuf_codegen/src/lib.rs | 226 + .../release_crates/protobuf_example/BUILD | 43 + .../protobuf_example/Cargo-template.toml | 12 + .../protobuf_example/README-template.md | 21 + .../release_crates/protobuf_example/build.rs | 9 + .../proto/proto_example}/bar/bar.proto | 0 .../proto/proto_example}/foo.proto | 2 +- .../protobuf_example}/src/main.rs | 10 +- .../protobuf_well_known_types/BUILD.bazel | 38 + .../Cargo-template.toml | 12 + .../protobuf_well_known_types/README.md | 2 + .../protobuf_well_known_types/build.rs | 20 + .../protobuf_well_known_types/src/lib.rs | 1 + .../release.sh} | 38 +- .../substitute_rust_release_version.bzl | 15 + third_party/protobuf/rust/repeated.rs | 14 +- third_party/protobuf/rust/shared.rs | 83 +- third_party/protobuf/rust/string.rs | 2 +- third_party/protobuf/rust/test/BUILD | 164 +- .../protobuf/rust/test/bad_names.proto | 2 + third_party/protobuf/rust/test/cpp/BUILD | 5 +- .../protobuf/rust/test/cpp/debug_test.rs | 3 - .../protobuf/rust/test/cpp/interop/BUILD | 29 +- .../rust/test/cpp/interop/interop_test.proto | 16 + .../protobuf/rust/test/cpp/interop/main.rs | 98 +- .../rust/test/cpp/interop/test_utils.cc | 38 +- .../test/fields_with_imported_types.proto | 8 +- .../protobuf/rust/test/import_public.proto | 2 +- .../protobuf/rust/test/import_public2.proto | 4 +- .../rust/test/import_public_primary_src.proto | 2 +- .../protobuf/rust/test/map_unittest.proto | 119 + .../protobuf/rust/test/no_package.proto | 2 +- third_party/protobuf/rust/test/package.proto | 2 +- .../rust/test/package_disabiguation2.proto | 2 +- .../rust_proto_library_unit_test.bzl | 20 +- third_party/protobuf/rust/test/shared/BUILD | 126 +- .../rust/test/shared/accessors_proto3_test.rs | 10 +- .../test/shared/accessors_repeated_test.rs | 24 +- .../rust/test/shared/accessors_test.rs | 8 +- .../rust/test/shared/bad_names_test.rs | 9 + .../rust/test/shared/ctype_cord_test.rs | 14 - .../protobuf/rust/test/shared/enum_test.rs | 49 + .../shared/fields_with_imported_types_test.rs | 14 +- .../rust/test/shared/gtest_matchers_test.rs | 39 +- .../test/shared/no_internal_access_test.rs | 10 + .../rust/test/shared/proto_macro_test.rs | 29 + .../rust/test/shared/serialization_test.rs | 17 +- .../protobuf/rust/test/shared/utf8/BUILD | 7 +- .../test/srcsless_library_test_child.proto | 7 + .../test/srcsless_library_test_parent.proto | 14 + third_party/protobuf/rust/test/unittest.proto | 1937 +++ .../protobuf/rust/test/unittest_import.proto | 36 + .../protobuf/rust/test/unittest_proto3.proto | 268 + .../rust/test/unittest_proto3_optional.proto | 90 + third_party/protobuf/rust/test/upb/BUILD | 5 +- third_party/protobuf/rust/upb.rs | 6 +- third_party/protobuf/rust/upb/BUILD | 14 +- third_party/protobuf/rust/upb/array.rs | 4 +- third_party/protobuf/rust/upb/map.rs | 2 +- third_party/protobuf/rust/upb/text.rs | 9 +- third_party/protobuf/src/README.md | 34 +- third_party/protobuf/src/file_lists.cmake | 480 +- .../protobuf/src/google/protobuf/BUILD.bazel | 613 +- .../protobuf/src/google/protobuf/any.pb.cc | 308 +- .../protobuf/src/google/protobuf/any.pb.h | 220 +- .../protobuf/src/google/protobuf/any_test.cc | 46 +- .../src/google/protobuf/any_test.proto | 2 +- .../protobuf/src/google/protobuf/api.pb.cc | 1334 +- .../protobuf/src/google/protobuf/api.pb.h | 716 +- .../protobuf/src/google/protobuf/arena.cc | 45 +- .../protobuf/src/google/protobuf/arena.h | 73 +- .../src/google/protobuf/arena_align.h | 14 +- .../src/google/protobuf/arena_cleanup.h | 3 +- .../src/google/protobuf/arena_unittest.cc | 53 +- .../src/google/protobuf/arenastring.cc | 4 +- .../src/google/protobuf/arenastring.h | 30 +- .../google/protobuf/arenastring_unittest.cc | 13 +- .../src/google/protobuf/arenaz_sampler.cc | 4 +- .../src/google/protobuf/arenaz_sampler.h | 8 +- .../google/protobuf/arenaz_sampler_test.cc | 11 + .../src/google/protobuf/compiler/BUILD.bazel | 181 +- .../protobuf/compiler/code_generator.cc | 15 +- .../google/protobuf/compiler/code_generator.h | 11 +- .../compiler/code_generator_unittest.cc | 39 +- .../compiler/command_line_interface.cc | 81 +- .../compiler/command_line_interface.h | 3 + .../compiler/command_line_interface_tester.cc | 25 +- .../compiler/command_line_interface_tester.h | 7 +- .../command_line_interface_unittest.cc | 255 +- .../google/protobuf/compiler/cpp/BUILD.bazel | 135 +- .../cpp/arena_ctor_visibility_test.cc | 10 +- .../compiler/cpp/bootstrap_unittest.cc | 6 - .../protobuf/compiler/cpp/copy_unittest.cc | 22 +- .../src/google/protobuf/compiler/cpp/enum.cc | 218 +- .../src/google/protobuf/compiler/cpp/enum.h | 4 + .../google/protobuf/compiler/cpp/extension.cc | 68 +- .../src/google/protobuf/compiler/cpp/field.cc | 6 + .../src/google/protobuf/compiler/cpp/field.h | 5 + .../cpp/field_generators/cord_field.cc | 24 +- .../cpp/field_generators/enum_field.cc | 24 +- .../cpp/field_generators/map_field.cc | 12 +- .../cpp/field_generators/message_field.cc | 481 +- .../cpp/field_generators/primitive_field.cc | 18 +- .../cpp/field_generators/string_field.cc | 284 +- .../cpp/field_generators/string_view_field.cc | 234 +- .../src/google/protobuf/compiler/cpp/file.cc | 120 +- .../protobuf/compiler/cpp/file_unittest.cc | 34 +- .../google/protobuf/compiler/cpp/generator.cc | 78 +- .../compiler/cpp/generator_unittest.cc | 14 +- .../google/protobuf/compiler/cpp/helpers.cc | 194 +- .../google/protobuf/compiler/cpp/helpers.h | 126 +- .../google/protobuf/compiler/cpp/message.cc | 1086 +- .../google/protobuf/compiler/cpp/message.h | 6 +- .../compiler/cpp/message_size_unittest.cc | 28 +- .../protobuf/compiler/cpp/move_unittest.cc | 30 +- .../google/protobuf/compiler/cpp/options.h | 8 +- .../compiler/cpp/parse_function_generator.cc | 569 +- .../google/protobuf/compiler/cpp/service.cc | 96 +- .../google/protobuf/compiler/cpp/service.h | 4 +- .../compiler/cpp/test_bad_identifiers.proto | 60 +- .../compiler/cpp/test_large_enum_value.proto | 2 +- .../cpp/tools/analyze_profile_proto.cc | 21 +- .../cpp/tools/analyze_profile_proto.h | 3 + .../cpp/tools/analyze_profile_proto_main.cc | 4 + .../cpp/tools/analyze_profile_proto_test.cc | 53 +- .../google/protobuf/compiler/cpp/tracker.cc | 1 - .../google/protobuf/compiler/cpp/unittest.cc | 67 +- .../google/protobuf/compiler/cpp/unittest.h | 6 +- .../google/protobuf/compiler/cpp/unittest.inc | 10 +- .../protobuf/compiler/csharp/BUILD.bazel | 22 +- .../compiler/csharp/csharp_field_base.cc | 2 +- .../compiler/csharp/csharp_message.cc | 2 +- .../protobuf/compiler/csharp/csharp_names.h | 2 +- .../src/google/protobuf/compiler/importer.cc | 25 +- .../google/protobuf/compiler/java/BUILD.bazel | 112 +- .../google/protobuf/compiler/java/context.cc | 94 +- .../protobuf/compiler/java/doc_comment.cc | 2 +- .../protobuf/compiler/java/field_common.cc | 5 +- .../src/google/protobuf/compiler/java/file.cc | 94 +- .../protobuf/compiler/java/full/BUILD.bazel | 35 +- .../protobuf/compiler/java/full/enum.cc | 37 +- .../protobuf/compiler/java/full/enum_field.cc | 176 +- .../protobuf/compiler/java/full/enum_field.h | 2 - .../protobuf/compiler/java/full/map_field.cc | 108 - .../protobuf/compiler/java/full/map_field.h | 1 - .../protobuf/compiler/java/full/message.cc | 22 +- .../compiler/java/full/message_builder.cc | 9 +- .../compiler/java/full/message_field.cc | 268 +- .../compiler/java/full/message_field.h | 5 - .../compiler/java/full/primitive_field.cc | 275 +- .../compiler/java/full/primitive_field.h | 15 +- .../compiler/java/full/string_field.cc | 152 +- .../compiler/java/full/string_field.h | 2 - .../protobuf/compiler/java/generator_common.h | 1 - .../compiler/java/generator_unittest.cc | 95 + .../google/protobuf/compiler/java/helpers.h | 5 +- .../compiler/java/java_features.pb.cc | 343 +- .../protobuf/compiler/java/java_features.pb.h | 232 +- .../protobuf/compiler/java/lite/BUILD.bazel | 20 +- .../protobuf/compiler/java/lite/enum.cc | 40 +- .../protobuf/compiler/java/lite/enum_field.cc | 190 +- .../protobuf/compiler/java/lite/enum_field.h | 2 - .../protobuf/compiler/java/lite/map_field.cc | 124 - .../protobuf/compiler/java/lite/map_field.h | 1 - .../protobuf/compiler/java/lite/message.cc | 26 +- .../compiler/java/lite/message_field.cc | 237 +- .../compiler/java/lite/message_field.h | 3 - .../compiler/java/lite/primitive_field.cc | 188 +- .../compiler/java/lite/primitive_field.h | 2 - .../compiler/java/lite/string_field.cc | 179 +- .../compiler/java/lite/string_field.h | 2 - .../java/message_serialization_unittest.proto | 2 +- .../protobuf/compiler/java/name_resolver.cc | 30 +- .../protobuf/compiler/java/name_resolver.h | 2 +- .../compiler/java/name_resolver_test.cc | 282 + .../google/protobuf/compiler/java/names.cc | 6 +- .../src/google/protobuf/compiler/java/names.h | 39 +- .../compiler/java/shared_code_generator.cc | 2 +- .../protobuf/compiler/kotlin/BUILD.bazel | 16 +- .../google/protobuf/compiler/kotlin/field.cc | 868 ++ .../google/protobuf/compiler/kotlin/field.h | 50 + .../protobuf/compiler/kotlin/message.cc | 39 +- .../google/protobuf/compiler/kotlin/message.h | 9 +- .../protobuf/compiler/mock_code_generator.h | 4 +- .../src/google/protobuf/compiler/notices.h | 242 + .../protobuf/compiler/objectivec/BUILD.bazel | 40 +- .../protobuf/compiler/objectivec/enum.cc | 2 +- .../compiler/objectivec/enum_field.cc | 33 +- .../protobuf/compiler/objectivec/field.cc | 148 +- .../protobuf/compiler/objectivec/field.h | 8 +- .../protobuf/compiler/objectivec/file.cc | 17 +- .../protobuf/compiler/objectivec/file.h | 9 +- .../protobuf/compiler/objectivec/generator.cc | 41 +- .../protobuf/compiler/objectivec/generator.h | 1 - .../protobuf/compiler/objectivec/helpers.cc | 12 +- .../protobuf/compiler/objectivec/helpers.h | 51 + .../compiler/objectivec/import_writer.cc | 5 +- .../compiler/objectivec/line_consumer.cc | 6 +- .../objectivec/line_consumer_unittest.cc | 8 +- .../protobuf/compiler/objectivec/map_field.cc | 19 +- .../protobuf/compiler/objectivec/message.cc | 31 +- .../protobuf/compiler/objectivec/message.h | 3 +- .../compiler/objectivec/message_field.cc | 15 +- .../protobuf/compiler/objectivec/oneof.cc | 53 +- .../protobuf/compiler/objectivec/oneof.h | 5 +- .../protobuf/compiler/objectivec/options.h | 9 + .../compiler/objectivec/primitive_field.cc | 8 +- .../compiler/objectivec/tf_decode_data.cc | 23 +- .../compiler/objectivec/tf_decode_data.h | 10 +- .../src/google/protobuf/compiler/parser.cc | 100 +- .../protobuf/compiler/parser_unittest.cc | 69 +- .../google/protobuf/compiler/php/BUILD.bazel | 14 +- .../protobuf/compiler/php/php_generator.cc | 4 +- .../src/google/protobuf/compiler/plugin.pb.cc | 1248 +- .../src/google/protobuf/compiler/plugin.pb.h | 703 +- .../protobuf/compiler/python/BUILD.bazel | 28 +- .../protobuf/compiler/python/generator.cc | 59 +- .../compiler/python/plugin_unittest.cc | 63 +- .../protobuf/compiler/python/pyi_generator.cc | 64 +- .../google/protobuf/compiler/ruby/BUILD.bazel | 10 +- .../protobuf/compiler/ruby/ruby_generator.cc | 2 +- .../google/protobuf/compiler/rust/BUILD.bazel | 125 +- .../compiler/rust/accessors/BUILD.bazel | 8 +- .../compiler/rust/accessors/accessors.cc | 36 +- .../compiler/rust/accessors/accessors.h | 5 + .../compiler/rust/accessors/generator.h | 4 - .../protobuf/compiler/rust/accessors/map.cc | 92 +- .../rust/accessors/unsupported_field.cc | 6 +- .../compiler/rust/accessors/with_presence.cc | 7 +- .../google/protobuf/compiler/rust/context.cc | 9 + .../google/protobuf/compiler/rust/context.h | 41 +- .../protobuf/compiler/rust/crate_mapping.cc | 28 +- .../src/google/protobuf/compiler/rust/enum.cc | 151 +- .../protobuf/compiler/rust/generator.cc | 145 +- .../google/protobuf/compiler/rust/message.cc | 464 +- .../google/protobuf/compiler/rust/naming.cc | 133 +- .../google/protobuf/compiler/rust/naming.h | 35 +- .../protobuf/compiler/rust/naming_test.cc | 19 +- .../google/protobuf/compiler/rust/oneof.cc | 81 +- .../protobuf/compiler/rust/relative_path.cc | 4 +- .../compiler/test_plugin_injection.bzl | 6 +- .../src/google/protobuf/compiler/versions.h | 7 +- .../google/protobuf/cpp_edition_defaults.h | 2 +- .../src/google/protobuf/cpp_features.pb.cc | 274 +- .../src/google/protobuf/cpp_features.pb.h | 153 +- .../src/google/protobuf/debug_counter_test.cc | 26 +- .../src/google/protobuf/descriptor.cc | 305 +- .../protobuf/src/google/protobuf/descriptor.h | 199 +- .../src/google/protobuf/descriptor.pb.cc | 11197 ++++++++-------- .../src/google/protobuf/descriptor.pb.h | 6397 ++++----- .../src/google/protobuf/descriptor.proto | 58 + .../google/protobuf/descriptor_database.cc | 2 + .../google/protobuf/descriptor_unittest.cc | 1065 +- .../protobuf/descriptor_visitor_test.cc | 40 +- .../src/google/protobuf/duration.pb.cc | 285 +- .../src/google/protobuf/duration.pb.h | 111 +- .../src/google/protobuf/dynamic_message.cc | 169 +- .../protobuf/dynamic_message_unittest.cc | 14 +- .../protobuf/edition_message_unittest.cc | 2 +- .../google/protobuf/edition_unittest.proto | 34 +- .../protobuf/src/google/protobuf/empty.pb.cc | 90 +- .../protobuf/src/google/protobuf/empty.pb.h | 77 +- .../google/protobuf/explicitly_constructed.h | 5 - .../src/google/protobuf/extension_set.cc | 455 +- .../src/google/protobuf/extension_set.h | 146 +- .../google/protobuf/extension_set_heavy.cc | 5 +- .../src/google/protobuf/extension_set_inl.h | 6 +- .../google/protobuf/extension_set_unittest.cc | 22 +- .../src/google/protobuf/feature_resolver.cc | 10 +- .../google/protobuf/feature_resolver_test.cc | 22 +- .../src/google/protobuf/field_mask.pb.cc | 200 +- .../src/google/protobuf/field_mask.pb.h | 130 +- .../src/google/protobuf/generated_enum_util.h | 8 +- .../protobuf/generated_message_bases.cc | 7 +- .../google/protobuf/generated_message_bases.h | 13 +- .../protobuf/generated_message_reflection.cc | 331 +- .../protobuf/generated_message_reflection.h | 11 +- .../generated_message_reflection_unittest.cc | 55 +- .../protobuf/generated_message_tctable_decl.h | 87 +- .../generated_message_tctable_full.cc | 3 +- .../protobuf/generated_message_tctable_impl.h | 57 +- .../generated_message_tctable_lite.cc | 715 +- .../generated_message_tctable_lite_test.cc | 62 +- .../google/protobuf/generated_message_util.cc | 6 +- .../google/protobuf/generated_message_util.h | 3 +- .../google/protobuf/implicit_weak_message.h | 12 +- .../google/protobuf/inlined_string_field.h | 16 +- .../src/google/protobuf/io/BUILD.bazel | 120 +- .../src/google/protobuf/io/coded_stream.cc | 39 +- .../src/google/protobuf/io/coded_stream.h | 62 +- .../src/google/protobuf/io/printer.cc | 24 + .../protobuf/src/google/protobuf/io/printer.h | 6 +- .../google/protobuf/io/printer_unittest.cc | 44 +- .../src/google/protobuf/io/tokenizer.cc | 46 +- .../protobuf/io/zero_copy_stream_unittest.cc | 14 +- .../src/google/protobuf/json/BUILD.bazel | 157 +- .../google/protobuf/json/internal/parser.cc | 263 +- .../google/protobuf/json/internal/unparser.cc | 7 + .../src/google/protobuf/json/json_test.cc | 149 +- .../google/protobuf/late_loaded_option.proto | 13 + .../protobuf/late_loaded_option_user.proto | 11 + .../google/protobuf/lite_arena_unittest.cc | 12 +- .../src/google/protobuf/lite_unittest.cc | 338 +- .../protobuf/src/google/protobuf/map.cc | 344 +- .../protobuf/src/google/protobuf/map.h | 1403 +- .../protobuf/src/google/protobuf/map_field.cc | 377 +- .../protobuf/src/google/protobuf/map_field.h | 374 +- .../src/google/protobuf/map_field_inl.h | 171 +- .../src/google/protobuf/map_field_test.cc | 12 + .../src/google/protobuf/map_lite_test_util.h | 18 +- .../google/protobuf/map_lite_unittest.proto | 2 +- .../google/protobuf/map_probe_benchmark.cc | 35 +- .../google/protobuf/map_proto2_unittest.proto | 6 +- .../google/protobuf/map_proto3_unittest.proto | 2 +- .../protobuf/src/google/protobuf/map_test.cc | 219 +- .../protobuf/src/google/protobuf/map_test.inc | 568 +- .../src/google/protobuf/map_test_util.h | 2 +- .../src/google/protobuf/map_test_util_impl.h | 4 +- .../src/google/protobuf/map_unittest.proto | 4 +- .../protobuf/src/google/protobuf/message.cc | 13 +- .../protobuf/src/google/protobuf/message.h | 59 +- .../src/google/protobuf/message_lite.cc | 71 +- .../src/google/protobuf/message_lite.h | 187 +- .../src/google/protobuf/message_unittest.cc | 6 +- .../src/google/protobuf/message_unittest.inc | 73 +- .../src/google/protobuf/metadata_lite.h | 7 +- .../protobuf/no_field_presence_map_test.cc | 38 +- .../google/protobuf/no_field_presence_test.cc | 460 +- .../google/protobuf/only_one_enum_test.proto | 14 + .../src/google/protobuf/parse_context.cc | 23 +- .../src/google/protobuf/parse_context.h | 309 +- .../protobuf/src/google/protobuf/port.cc | 32 +- .../protobuf/src/google/protobuf/port.h | 132 +- .../protobuf/src/google/protobuf/port_def.inc | 146 +- .../protobuf/src/google/protobuf/port_test.cc | 7 + .../src/google/protobuf/port_undef.inc | 20 +- .../protobuf/preserve_unknown_enum_test.cc | 6 +- .../google/protobuf/proto3_arena_unittest.cc | 96 +- .../google/protobuf/redaction_metric_test.cc | 2 +- .../protobuf/src/google/protobuf/reflection.h | 4 +- .../src/google/protobuf/reflection_internal.h | 146 +- .../src/google/protobuf/reflection_ops.cc | 18 +- .../protobuf/reflection_ops_unittest.cc | 27 +- .../src/google/protobuf/reflection_tester.cc | 18 +- .../src/google/protobuf/reflection_tester.h | 32 +- .../protobuf/reflection_visit_field_info.h | 24 +- .../google/protobuf/reflection_visit_fields.h | 44 +- .../protobuf/reflection_visit_fields_test.cc | 28 +- .../src/google/protobuf/repeated_field.cc | 11 + .../src/google/protobuf/repeated_field.h | 6 +- .../repeated_field_reflection_unittest.cc | 6 +- .../repeated_field_reflection_unittest.inc | 7 - .../protobuf/repeated_field_unittest.cc | 48 +- .../src/google/protobuf/repeated_ptr_field.cc | 24 +- .../src/google/protobuf/repeated_ptr_field.h | 181 +- .../protobuf/repeated_ptr_field_unittest.cc | 76 +- .../src/google/protobuf/retention_test.cc | 72 +- .../src/google/protobuf/runtime_version.h | 2 +- .../src/google/protobuf/serial_arena.h | 43 +- .../src/google/protobuf/source_context.pb.cc | 246 +- .../src/google/protobuf/source_context.pb.h | 149 +- .../src/google/protobuf/string_view_test.cc | 9 +- .../protobuf/src/google/protobuf/struct.pb.cc | 914 +- .../protobuf/src/google/protobuf/struct.pb.h | 477 +- .../src/google/protobuf/stubs/BUILD.bazel | 28 +- .../src/google/protobuf/stubs/common.h | 2 +- .../protobuf/src/google/protobuf/stubs/port.h | 7 + .../src/google/protobuf/stubs/status_macros.h | 9 +- .../protobuf/test_messages_proto2.proto | 15 + .../protobuf/src/google/protobuf/test_util.h | 8 +- .../src/google/protobuf/test_util_lite.h | 4 +- .../invalid/extdecl_field_options.txtpb | 11 - .../extdecl_field_options.textpb | 11 - .../text_format_unittest_extensions_data.txt | 204 +- ...format_unittest_extensions_data_pointy.txt | 204 +- .../src/google/protobuf/testing/BUILD.bazel | 25 +- .../src/google/protobuf/testing/file.cc | 4 +- .../src/google/protobuf/testing/file.h | 2 +- .../src/google/protobuf/text_format.cc | 195 +- .../src/google/protobuf/text_format.h | 16 +- .../google/protobuf/text_format_unittest.cc | 268 +- .../src/google/protobuf/thread_safe_arena.h | 13 +- .../src/google/protobuf/timestamp.pb.cc | 285 +- .../src/google/protobuf/timestamp.pb.h | 111 +- .../protobuf/src/google/protobuf/type.pb.cc | 2308 ++-- .../protobuf/src/google/protobuf/type.pb.h | 1298 +- .../src/google/protobuf/unittest.proto | 55 +- .../protobuf/unittest_custom_options.proto | 28 +- .../unittest_embed_optimize_for.proto | 2 +- .../unittest_enormous_descriptor.proto | 2 +- .../protobuf/unittest_extension_set.proto | 2 +- .../src/google/protobuf/unittest_import.proto | 4 +- .../protobuf/unittest_import_lite.proto | 2 +- .../protobuf/unittest_import_public.proto | 2 +- .../unittest_import_public_lite.proto | 2 +- .../protobuf/unittest_large_oneof.proto | 7010 ++++++++++ .../protobuf/unittest_lazy_dependencies.proto | 4 +- ...test_lazy_dependencies_custom_option.proto | 4 +- .../unittest_lazy_dependencies_enum.proto | 4 +- .../src/google/protobuf/unittest_lite.proto | 30 +- .../protobuf/unittest_lite_edition_2024.proto | 2 +- .../unittest_lite_imports_nonlite.proto | 2 +- .../src/google/protobuf/unittest_mset.proto | 2 +- .../protobuf/unittest_mset_wire_format.proto | 4 +- .../protobuf/unittest_no_field_presence.proto | 8 +- .../unittest_no_generic_services.proto | 2 +- .../protobuf/unittest_optimize_for.proto | 2 +- .../src/google/protobuf/unittest_proto3.proto | 12 +- .../protobuf/unittest_proto3_arena.proto | 12 +- .../protobuf/unittest_proto3_arena_lite.proto | 12 +- .../protobuf/unittest_proto3_lite.proto | 12 +- .../protobuf/unittest_proto3_optional.proto | 6 +- .../google/protobuf/unittest_redaction.proto | 72 + .../google/protobuf/unittest_retention.proto | 2 +- .../protobuf/unittest_string_type.proto | 2 +- .../protobuf/unittest_string_view.proto | 5 +- .../protobuf/unittest_well_known_types.proto | 46 +- .../src/google/protobuf/unknown_field_set.cc | 26 +- .../src/google/protobuf/unknown_field_set.h | 35 +- .../protobuf/unknown_field_set_unittest.cc | 2 +- .../unredacted_debug_format_for_test_test.cc | 24 +- .../src/google/protobuf/util/BUILD.bazel | 79 +- .../util/delimited_message_util_test.cc | 12 +- .../google/protobuf/util/field_comparator.h | 3 +- .../protobuf/util/field_comparator_test.cc | 2 +- .../protobuf/util/field_mask_util_test.cc | 8 +- .../google/protobuf/util/json_format.proto | 2 +- .../protobuf/util/json_format_proto3.proto | 5 +- .../src/google/protobuf/util/json_util.h | 3 - .../protobuf/util/message_differencer.cc | 18 +- .../protobuf/util/message_differencer.h | 5 +- .../util/message_differencer_unittest.cc | 358 +- .../util/message_differencer_unittest.proto | 2 +- .../protobuf/util/type_resolver_util.cc | 65 +- .../protobuf/util/type_resolver_util_test.cc | 230 +- .../src/google/protobuf/varint_shuffle.h | 44 +- .../protobuf/well_known_types_unittest.cc | 2 +- .../src/google/protobuf/wire_format.cc | 9 +- .../src/google/protobuf/wire_format_lite.h | 1 + .../google/protobuf/wire_format_unittest.cc | 6 +- .../src/google/protobuf/wrappers.pb.cc | 2001 +-- .../src/google/protobuf/wrappers.pb.h | 989 +- .../src/google/protobuf/wrappers.proto | 42 +- third_party/protobuf/third_party/BUILD.bazel | 1 + .../third_party/utf8_range/BUILD.bazel | 16 +- .../third_party/utf8_range/CMakeLists.txt | 11 +- .../third_party/utf8_range/utf8_range.c | 290 +- .../utf8_range/utf8_range_neon.inc | 117 + .../third_party/utf8_range/utf8_range_sse.inc | 272 + third_party/protobuf/toolchain/BUILD.bazel | 4 +- .../protobuf/toolchain/toolchains.bazelrc | 5 +- third_party/protobuf/upb/BUILD | 1 + third_party/protobuf/upb/base/BUILD | 10 + third_party/protobuf/upb/base/internal/log2.h | 4 +- third_party/protobuf/upb/base/string_view.h | 10 + .../protobuf/upb/base/string_view_test.cc | 69 + third_party/protobuf/upb/bazel/BUILD | 4 - third_party/protobuf/upb/bazel/build_defs.bzl | 5 +- third_party/protobuf/upb/cmake/BUILD.bazel | 60 - third_party/protobuf/upb/cmake/CMakeLists.txt | 96 - third_party/protobuf/upb/cmake/README.md | 23 - .../cmake/google/protobuf/descriptor.upb.h | 628 +- .../protobuf/descriptor.upb_minitable.c | 182 +- .../protobuf/descriptor.upb_minitable.h | 1 + .../protobuf/upb/cmake/make_cmakelists.py | 346 - .../protobuf/upb/cmake/push_auto_update.sh | 73 - .../protobuf/upb/cmake/staleness_test_lib.py | 2 +- .../conformance/conformance_upb_failures.txt | 2 + third_party/protobuf/upb/hash/BUILD | 6 +- third_party/protobuf/upb/hash/common.c | 6 +- third_party/protobuf/upb/io/BUILD | 16 +- third_party/protobuf/upb/json/BUILD | 9 +- third_party/protobuf/upb/json/decode.c | 4 +- third_party/protobuf/upb/json/decode.h | 1 - third_party/protobuf/upb/lex/BUILD | 10 +- third_party/protobuf/upb/mem/BUILD | 15 +- third_party/protobuf/upb/mem/alloc.h | 5 + third_party/protobuf/upb/mem/arena.c | 438 +- third_party/protobuf/upb/mem/arena.h | 54 +- third_party/protobuf/upb/mem/arena.hpp | 24 +- third_party/protobuf/upb/mem/arena_test.cc | 562 +- third_party/protobuf/upb/mem/internal/arena.h | 10 +- third_party/protobuf/upb/message/BUILD | 71 +- third_party/protobuf/upb/message/accessors.h | 41 + third_party/protobuf/upb/message/compare.c | 27 +- third_party/protobuf/upb/message/compat.c | 25 +- third_party/protobuf/upb/message/compat.h | 7 +- third_party/protobuf/upb/message/copy.c | 67 +- third_party/protobuf/upb/message/copy_test.cc | 103 +- .../protobuf/upb/message/internal/accessors.h | 149 +- .../upb/message/internal/compare_unknown.c | 116 +- .../upb/message/internal/compare_unknown.h | 4 +- .../message/internal/compare_unknown_test.cc | 16 +- .../protobuf/upb/message/internal/extension.c | 51 +- .../protobuf/upb/message/internal/extension.h | 26 +- .../protobuf/upb/message/internal/iterator.c | 20 - .../protobuf/upb/message/internal/iterator.h | 10 +- .../protobuf/upb/message/internal/map.h | 5 +- .../upb/message/internal/map_sorter.h | 5 +- .../protobuf/upb/message/internal/message.c | 77 +- .../protobuf/upb/message/internal/message.h | 180 +- third_party/protobuf/upb/message/map_sorter.c | 30 +- third_party/protobuf/upb/message/message.c | 132 +- third_party/protobuf/upb/message/message.h | 60 +- third_party/protobuf/upb/message/promote.c | 82 +- third_party/protobuf/upb/message/promote.h | 1 + .../protobuf/upb/message/promote_test.cc | 16 +- third_party/protobuf/upb/message/test.cc | 100 + third_party/protobuf/upb/message/value.h | 9 + .../protobuf/upb/mini_descriptor/BUILD | 8 +- .../protobuf/upb/mini_descriptor/build_enum.c | 2 +- .../protobuf/upb/mini_descriptor/decode.c | 231 +- .../protobuf/upb/mini_descriptor/decode.h | 7 +- .../upb/mini_descriptor/internal/encode.hpp | 2 +- third_party/protobuf/upb/mini_table/BUILD | 36 +- .../upb/mini_table/extension_registry.c | 36 +- .../upb/mini_table/extension_registry.h | 19 +- third_party/protobuf/upb/mini_table/message.c | 34 +- .../upb/mini_table/message_benchmark.cc | 35 + .../upb/mini_table/message_benchmark.proto | 562 + third_party/protobuf/upb/port/atomic.h | 141 +- third_party/protobuf/upb/port/def.inc | 178 +- third_party/protobuf/upb/port/undef.inc | 12 +- third_party/protobuf/upb/reflection/BUILD | 6 +- .../cmake/google/protobuf/descriptor.upb.h | 628 +- .../protobuf/descriptor.upb_minitable.c | 182 +- .../protobuf/descriptor.upb_minitable.h | 1 + third_party/protobuf/upb/reflection/def.hpp | 6 +- .../protobuf/upb/reflection/def_pool.c | 13 +- .../upb/reflection/descriptor_bootstrap.h | 2 +- .../protobuf/upb/reflection/file_def.c | 17 +- .../upb/reflection/internal/def_builder.c | 2 +- .../internal/upb_edition_defaults.h | 2 +- third_party/protobuf/upb/reflection/message.c | 35 +- third_party/protobuf/upb/reflection/message.h | 4 +- .../stage0/google/protobuf/descriptor.upb.c | 13 +- .../stage0/google/protobuf/descriptor.upb.h | 27 + third_party/protobuf/upb/test/BUILD | 33 +- third_party/protobuf/upb/test/test_cpp.cc | 5 - .../protobuf/upb/test/test_generated_code.cc | 95 +- third_party/protobuf/upb/text/BUILD | 7 +- third_party/protobuf/upb/text/debug_string.c | 21 +- third_party/protobuf/upb/text/debug_string.h | 2 +- third_party/protobuf/upb/text/encode.c | 14 +- .../protobuf/upb/text/encode_debug_test.cc | 56 +- .../protobuf/upb/text/internal/encode.c | 31 +- .../protobuf/upb/text/internal/encode.h | 4 + third_party/protobuf/upb/util/BUILD | 19 +- third_party/protobuf/upb/wire/BUILD | 9 +- third_party/protobuf/upb/wire/decode.c | 105 +- third_party/protobuf/upb/wire/decode.h | 6 +- third_party/protobuf/upb/wire/encode.c | 119 +- third_party/protobuf/upb/wire/encode.h | 2 + .../protobuf/upb/wire/eps_copy_input_stream.h | 38 +- .../protobuf/upb/wire/internal/decoder.h | 15 +- third_party/protobuf/upb_generator/BUILD | 21 +- third_party/protobuf/upb_generator/c/BUILD | 23 +- .../protobuf/upb_generator/c/generator.cc | 124 +- .../google/protobuf/compiler/plugin.upb.h | 22 +- .../protobuf/compiler/plugin.upb_minitable.c | 6 +- .../protobuf/upb_generator/common/BUILD | 24 +- .../upb_generator/common/cpp_to_upb_def.cc | 100 + .../upb_generator/common/cpp_to_upb_def.h | 58 + .../protobuf/upb_generator/file_layout.h | 4 + .../protobuf/upb_generator/minitable/BUILD | 33 +- .../upb_generator/minitable/generator.cc | 27 +- .../upb_generator/minitable/generator.h | 4 +- .../protobuf/upb_generator/minitable/main.cc | 98 +- third_party/protobuf/upb_generator/plugin.cc | 58 + third_party/protobuf/upb_generator/plugin.h | 139 +- .../protobuf/upb_generator/plugin_bootstrap.h | 2 +- .../protobuf/upb_generator/reflection/BUILD | 13 +- .../upb_generator/reflection/generator.cc | 81 +- third_party/protobuf/version.json | 23 +- 1273 files changed, 78628 insertions(+), 48146 deletions(-) delete mode 100644 third_party/protobuf/DIR_METADATA delete mode 100644 third_party/protobuf/OWNERS delete mode 100644 third_party/protobuf/Protobuf-C++.podspec create mode 100644 third_party/protobuf/bazel/private/cc_proto_aspect.bzl delete mode 100644 third_party/protobuf/bazel/system_python.bzl create mode 100644 third_party/protobuf/cmake/BUILD.bazel create mode 100644 third_party/protobuf/cmake/dependencies.cmake create mode 100644 third_party/protobuf/cmake/dependencies_generator.py create mode 100644 third_party/protobuf/cmake/installed_bin_golden.txt create mode 100644 third_party/protobuf/cmake/installed_include_golden.txt create mode 100644 third_party/protobuf/cmake/installed_lib_shared_golden.txt create mode 100644 third_party/protobuf/cmake/installed_lib_static_golden.txt create mode 100644 third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/UnsafeCollectionOperationsTest.cs create mode 100644 third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs create mode 100644 third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs.template create mode 100644 third_party/protobuf/csharp/src/Google.Protobuf/RepeatedFieldExtensions.cs create mode 100644 third_party/protobuf/csharp/src/Google.Protobuf/UnsafeCollectionOperations.cs create mode 100644 third_party/protobuf/docs/upb/arena_fusion.md create mode 100644 third_party/protobuf/examples/examples_with_hyphen/BUILD.bazel create mode 100644 third_party/protobuf/examples/examples_with_hyphen/MODULE.bazel create mode 100644 third_party/protobuf/examples/examples_with_hyphen/empty.proto delete mode 100644 third_party/protobuf/hpb/hpb.cc create mode 100644 third_party/protobuf/hpb/internal/template_help_test.cc create mode 100644 third_party/protobuf/hpb/status.cc create mode 100644 third_party/protobuf/hpb/status.h create mode 100644 third_party/protobuf/hpb_generator/context.h delete mode 100644 third_party/protobuf/hpb_generator/output.cc delete mode 100644 third_party/protobuf/hpb_generator/output.h rename third_party/protobuf/hpb_generator/{protoc-gen-upb-protos.cc => protoc-gen-hpb.cc} (63%) create mode 100644 third_party/protobuf/hpb_generator/tests/extension_test.cc create mode 100644 third_party/protobuf/hpb_generator/tests/repeated_test.cc create mode 100644 third_party/protobuf/hpb_generator/tests/set_alias.proto create mode 100644 third_party/protobuf/hpb_generator/tests/test_hpb_bzl_alias.cc create mode 100644 third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnredactedDebugFormatForTest.java delete mode 100644 third_party/protobuf/java/core/src/test/java/com/google/protobuf/SensitiveFieldReportingTest.java create mode 100644 third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java create mode 100644 third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto create mode 100644 third_party/protobuf/maven_dev_install.json delete mode 100644 third_party/protobuf/objectivec/GPBUnknownFieldSet.h delete mode 100644 third_party/protobuf/objectivec/GPBUnknownFieldSet.m delete mode 100644 third_party/protobuf/objectivec/GPBUnknownFieldSet_PackagePrivate.h delete mode 100644 third_party/protobuf/objectivec/Tests/GPBCompileTest25.m create mode 100644 third_party/protobuf/objectivec/Tests/GPBMessage30007FormatTest.m delete mode 100644 third_party/protobuf/objectivec/Tests/GPBMessageTests+ClassNames.m delete mode 100644 third_party/protobuf/objectivec/Tests/GPBUnknownFieldSetTest.m delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Any.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Api.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Duration.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Empty.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/FieldMask.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/SourceContext.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Struct.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Timestamp.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Type.pbobjc.h delete mode 100644 third_party/protobuf/objectivec/google/protobuf/Wrappers.pbobjc.h delete mode 100644 third_party/protobuf/patches/0046-absl-log.patch delete mode 100644 third_party/protobuf/patches/0054-remove-usage-if-absl-internal-if_constexpr.patch create mode 100644 third_party/protobuf/php/internal_generated_files.bzl delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/Edition.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/Declaration.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/VerificationState.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnforceNamingStyle.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnumType.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/FieldPresence.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/JsonFormat.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/MessageEncoding.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/RepeatedFieldEncoding.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/Utf8Validation.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults/FeatureSetEditionDefault.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/EditionDefault.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/FeatureSupport.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionRetention.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionTargetType.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_CType.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php create mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation/Semantic.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php delete mode 100644 third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php delete mode 100644 third_party/protobuf/protos/BUILD delete mode 100644 third_party/protobuf/protos/protos.h delete mode 100755 third_party/protobuf/python/google/protobuf/internal/_parameterized.py create mode 100644 third_party/protobuf/python/google/protobuf/internal/proto_text_test.py create mode 100644 third_party/protobuf/python/google/protobuf/proto_api.cc create mode 100644 third_party/protobuf/python/google/protobuf/proto_text.py delete mode 100644 third_party/protobuf/python/google/protobuf/service.py delete mode 100644 third_party/protobuf/python/pb_unit_tests/BUILD delete mode 100644 third_party/protobuf/python/pb_unit_tests/README.md delete mode 100644 third_party/protobuf/python/pb_unit_tests/descriptor_pool_test_wrapper.py delete mode 100644 third_party/protobuf/python/pb_unit_tests/descriptor_test_wrapper.py delete mode 100644 third_party/protobuf/python/pb_unit_tests/generator_test_wrapper.py delete mode 100644 third_party/protobuf/python/pb_unit_tests/message_factory_test_wrapper.py delete mode 100644 third_party/protobuf/python/pb_unit_tests/message_test_wrapper.py delete mode 100644 third_party/protobuf/python/pb_unit_tests/proto_builder_test_wrapper.py delete mode 100644 third_party/protobuf/python/pb_unit_tests/pyproto_test_wrapper.bzl delete mode 100644 third_party/protobuf/python/pb_unit_tests/reflection_test_wrapper.py create mode 100644 third_party/protobuf/ruby/Gemfile.lock delete mode 100644 third_party/protobuf/rust/cpp_kernel/map.h create mode 100644 third_party/protobuf/rust/dist.bzl create mode 100644 third_party/protobuf/rust/gtest_matchers_impl.rs delete mode 100644 third_party/protobuf/rust/protobuf_codegen/Cargo.toml delete mode 100644 third_party/protobuf/rust/protobuf_codegen/example/Cargo.toml delete mode 100644 third_party/protobuf/rust/protobuf_codegen/example/build.rs delete mode 100644 third_party/protobuf/rust/protobuf_codegen/src/lib.rs create mode 100644 third_party/protobuf/rust/release_crates/BUILD create mode 100644 third_party/protobuf/rust/release_crates/README.md create mode 100755 third_party/protobuf/rust/release_crates/cargo_test.sh create mode 100644 third_party/protobuf/rust/release_crates/protobuf/BUILD rename third_party/protobuf/rust/{cargo/Cargo.toml => release_crates/protobuf/Cargo-template.toml} (68%) create mode 100644 third_party/protobuf/rust/release_crates/protobuf/README-template.md rename third_party/protobuf/rust/{cargo => release_crates/protobuf}/build.rs (100%) create mode 100644 third_party/protobuf/rust/release_crates/protobuf_codegen/BUILD create mode 100644 third_party/protobuf/rust/release_crates/protobuf_codegen/Cargo-template.toml create mode 100644 third_party/protobuf/rust/release_crates/protobuf_codegen/README-template.md create mode 100644 third_party/protobuf/rust/release_crates/protobuf_codegen/src/lib.rs create mode 100644 third_party/protobuf/rust/release_crates/protobuf_example/BUILD create mode 100644 third_party/protobuf/rust/release_crates/protobuf_example/Cargo-template.toml create mode 100644 third_party/protobuf/rust/release_crates/protobuf_example/README-template.md create mode 100644 third_party/protobuf/rust/release_crates/protobuf_example/build.rs rename third_party/protobuf/rust/{protobuf_codegen/example/proto => release_crates/protobuf_example/proto/proto_example}/bar/bar.proto (100%) rename third_party/protobuf/rust/{protobuf_codegen/example/proto => release_crates/protobuf_example/proto/proto_example}/foo.proto (78%) rename third_party/protobuf/rust/{protobuf_codegen/example => release_crates/protobuf_example}/src/main.rs (78%) create mode 100644 third_party/protobuf/rust/release_crates/protobuf_well_known_types/BUILD.bazel create mode 100644 third_party/protobuf/rust/release_crates/protobuf_well_known_types/Cargo-template.toml create mode 100644 third_party/protobuf/rust/release_crates/protobuf_well_known_types/README.md create mode 100644 third_party/protobuf/rust/release_crates/protobuf_well_known_types/build.rs create mode 100644 third_party/protobuf/rust/release_crates/protobuf_well_known_types/src/lib.rs rename third_party/protobuf/rust/{cargo_test.sh => release_crates/release.sh} (54%) create mode 100644 third_party/protobuf/rust/release_crates/substitute_rust_release_version.bzl create mode 100644 third_party/protobuf/rust/test/cpp/interop/interop_test.proto create mode 100644 third_party/protobuf/rust/test/map_unittest.proto create mode 100644 third_party/protobuf/rust/test/shared/no_internal_access_test.rs create mode 100644 third_party/protobuf/rust/test/srcsless_library_test_child.proto create mode 100644 third_party/protobuf/rust/test/srcsless_library_test_parent.proto create mode 100644 third_party/protobuf/rust/test/unittest.proto create mode 100644 third_party/protobuf/rust/test/unittest_import.proto create mode 100644 third_party/protobuf/rust/test/unittest_proto3.proto create mode 100644 third_party/protobuf/rust/test/unittest_proto3_optional.proto create mode 100644 third_party/protobuf/src/google/protobuf/compiler/java/generator_unittest.cc create mode 100644 third_party/protobuf/src/google/protobuf/compiler/java/name_resolver_test.cc create mode 100644 third_party/protobuf/src/google/protobuf/compiler/kotlin/field.cc create mode 100644 third_party/protobuf/src/google/protobuf/compiler/kotlin/field.h create mode 100644 third_party/protobuf/src/google/protobuf/compiler/notices.h create mode 100644 third_party/protobuf/src/google/protobuf/late_loaded_option.proto create mode 100644 third_party/protobuf/src/google/protobuf/late_loaded_option_user.proto create mode 100644 third_party/protobuf/src/google/protobuf/only_one_enum_test.proto delete mode 100644 third_party/protobuf/src/google/protobuf/testdata/extdecl/invalid/extdecl_field_options.txtpb delete mode 100644 third_party/protobuf/src/google/protobuf/testdata/invalid_extdecl/extdecl_field_options.textpb create mode 100644 third_party/protobuf/src/google/protobuf/unittest_large_oneof.proto create mode 100644 third_party/protobuf/src/google/protobuf/unittest_redaction.proto create mode 100644 third_party/protobuf/third_party/utf8_range/utf8_range_neon.inc create mode 100644 third_party/protobuf/third_party/utf8_range/utf8_range_sse.inc create mode 100644 third_party/protobuf/upb/base/string_view_test.cc delete mode 100644 third_party/protobuf/upb/cmake/CMakeLists.txt delete mode 100644 third_party/protobuf/upb/cmake/README.md delete mode 100755 third_party/protobuf/upb/cmake/make_cmakelists.py delete mode 100755 third_party/protobuf/upb/cmake/push_auto_update.sh create mode 100644 third_party/protobuf/upb/mini_table/message_benchmark.cc create mode 100644 third_party/protobuf/upb/mini_table/message_benchmark.proto create mode 100644 third_party/protobuf/upb_generator/common/cpp_to_upb_def.cc create mode 100644 third_party/protobuf/upb_generator/common/cpp_to_upb_def.h create mode 100644 third_party/protobuf/upb_generator/plugin.cc diff --git a/.vpython3 b/.vpython3 index d911890d1508a..dd9166553ca9c 100644 --- a/.vpython3 +++ b/.vpython3 @@ -43,7 +43,7 @@ verify_pep425_tag: [ # //tools/perf/crossbench wheel: < name: "infra/python/wheels/protobuf-py3" - version: "version:5.29.3" + version: "version:6.30.1" > # TODO(https://crbug.com/898348): Add in necessary wheels as Python3 versions @@ -223,11 +223,11 @@ wheel: < > wheel: < name: "infra/python/wheels/googleapis-common-protos-py2_py3" - version: "version:1.66.0" + version: "version:1.69.2" > wheel: < name: "infra/python/wheels/google-api-core-py3" - version: "version:2.24.0" + version: "version:2.24.2" > wheel: < name: "infra/python/wheels/google-auth-httplib2-py2_py3" @@ -270,7 +270,7 @@ wheel: < wheel: < name: "infra/python/wheels/proto-plus-py3" - version: "version:1.26.0" + version: "version:1.26.1" > wheel: < @@ -657,7 +657,7 @@ wheel: < > wheel: < name: "infra/python/wheels/google-cloud-bigquery-storage-py3" - version: "version:2.27.0" + version: "version:2.29.1" > wheel: < name: "infra/python/wheels/google-crc32c/${vpython_platform}" diff --git a/DEPS b/DEPS index 6fe72110a2f89..15552be5b3445 100644 --- a/DEPS +++ b/DEPS @@ -1917,7 +1917,7 @@ deps = { Var('chromium_git') + '/breakpad/breakpad.git' + '@' + Var('breakpad_revision'), 'src/third_party/cast_core/public/src': - Var('chromium_git') + '/cast_core/public' + '@' + 'dcb3d2e87cebe20b6dda06d8b29abb9af27ca422', + Var('chromium_git') + '/cast_core/public' + '@' + 'f5ee589bdaea60418f670fa176be15ccb9a34942', 'src/third_party/catapult': Var('chromium_git') + '/catapult.git' + '@' + Var('catapult_revision'), @@ -4367,7 +4367,7 @@ deps = { 'src/chromeos/assistant/internal': { 'url': Var('chrome_git') + '/chrome/assistant.git' + '@' + - '202ca42ffe028067860400b174637ff004094a34', + '7333fc7271a9c673862fcc3b5fd5d054d2e2ab30', 'condition': 'checkout_src_internal and checkout_chromeos', }, diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index b290aae1241b1..17b0aff9beee7 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni @@ -2246,7 +2246,6 @@ if (enable_java_templates) { "//third_party/protobuf/python/google/protobuf/descriptor_pb2.py", "//third_party/protobuf/python/google/protobuf/descriptor_pool.py", "//third_party/protobuf/python/google/protobuf/internal/__init__.py", - "//third_party/protobuf/python/google/protobuf/internal/_parameterized.py", "//third_party/protobuf/python/google/protobuf/internal/api_implementation.py", "//third_party/protobuf/python/google/protobuf/internal/builder.py", "//third_party/protobuf/python/google/protobuf/internal/containers.py", @@ -2290,7 +2289,6 @@ if (enable_java_templates) { "//third_party/protobuf/python/google/protobuf/pyext/cpp_message.py", "//third_party/protobuf/python/google/protobuf/reflection.py", "//third_party/protobuf/python/google/protobuf/runtime_version.py", - "//third_party/protobuf/python/google/protobuf/service.py", "//third_party/protobuf/python/google/protobuf/service_reflection.py", "//third_party/protobuf/python/google/protobuf/symbol_database.py", "//third_party/protobuf/python/google/protobuf/text_encoding.py", diff --git a/build/config/android/system_image.gni b/build/config/android/system_image.gni index cd050c422b59a..56a235572ebae 100644 --- a/build/config/android/system_image.gni +++ b/build/config/android/system_image.gni @@ -90,7 +90,6 @@ template("system_image_stub_apk") { "//third_party/protobuf/python/google/protobuf/descriptor_pb2.py", "//third_party/protobuf/python/google/protobuf/descriptor_pool.py", "//third_party/protobuf/python/google/protobuf/internal/__init__.py", - "//third_party/protobuf/python/google/protobuf/internal/_parameterized.py", "//third_party/protobuf/python/google/protobuf/internal/api_implementation.py", "//third_party/protobuf/python/google/protobuf/internal/builder.py", "//third_party/protobuf/python/google/protobuf/internal/containers.py", @@ -134,7 +133,6 @@ template("system_image_stub_apk") { "//third_party/protobuf/python/google/protobuf/pyext/cpp_message.py", "//third_party/protobuf/python/google/protobuf/reflection.py", "//third_party/protobuf/python/google/protobuf/runtime_version.py", - "//third_party/protobuf/python/google/protobuf/service.py", "//third_party/protobuf/python/google/protobuf/service_reflection.py", "//third_party/protobuf/python/google/protobuf/symbol_database.py", "//third_party/protobuf/python/google/protobuf/text_encoding.py", diff --git a/chromeos/assistant/internal b/chromeos/assistant/internal index 202ca42ffe028..7333fc7271a9c 160000 --- a/chromeos/assistant/internal +++ b/chromeos/assistant/internal @@ -1 +1 @@ -Subproject commit 202ca42ffe028067860400b174637ff004094a34 +Subproject commit 7333fc7271a9c673862fcc3b5fd5d054d2e2ab30 diff --git a/google_apis/gcm/base/mcs_util.cc b/google_apis/gcm/base/mcs_util.cc index 2b6974ec88d3d..600287cf8ed59 100644 --- a/google_apis/gcm/base/mcs_util.cc +++ b/google_apis/gcm/base/mcs_util.cc @@ -11,6 +11,8 @@ #include <stddef.h> +#include <string_view> + #include "base/check_op.h" #include "base/format_macros.h" #include "base/notreached.h" @@ -150,7 +152,7 @@ std::unique_ptr<google::protobuf::MessageLite> BuildProtobufFromTag( // Utility method to extract a MCS tag from a google::protobuf::MessageLite // object. int GetMCSProtoTag(const google::protobuf::MessageLite& message) { - const std::string& type_name = message.GetTypeName(); + std::string_view type_name = message.GetTypeName(); if (type_name == kProtoNames[kHeartbeatPingTag]) { return kHeartbeatPingTag; } else if (type_name == kProtoNames[kHeartbeatAckTag]) { diff --git a/third_party/cast_core/README.chromium b/third_party/cast_core/README.chromium index 9a5c1d5c95266..b55a006584051 100644 --- a/third_party/cast_core/README.chromium +++ b/third_party/cast_core/README.chromium @@ -2,8 +2,8 @@ Name: CastCore Publics Short Name: cast_core/public URL: https://chromium.googlesource.com/cast_core/public Version: N/A -Date: 2021-09-14 -Revision: 21e7e00e13122d83507449578c6bfe356d7eb266 +Date: 2025-03-21 +Revision: f5ee589bdaea60418f670fa176be15ccb9a34942 License: Apache-2.0 License File: LICENSE Security Critical: yes @@ -13,4 +13,4 @@ Description: Public components, such as protos, used by gRPC-based CastCore services and clients. -Local Modifications: None \ No newline at end of file +Local Modifications: None diff --git a/third_party/cast_core/public/src b/third_party/cast_core/public/src index dcb3d2e87cebe..f5ee589bdaea6 160000 --- a/third_party/cast_core/public/src +++ b/third_party/cast_core/public/src @@ -1 +1 @@ -Subproject commit dcb3d2e87cebe20b6dda06d8b29abb9af27ca422 +Subproject commit f5ee589bdaea60418f670fa176be15ccb9a34942 diff --git a/third_party/dom_distiller_js/BUILD.gn b/third_party/dom_distiller_js/BUILD.gn index d349baf790790..0a5435f5bfeb0 100644 --- a/third_party/dom_distiller_js/BUILD.gn +++ b/third_party/dom_distiller_js/BUILD.gn @@ -20,7 +20,6 @@ protoc_plugin_files = [ "//third_party/protobuf/python/google/protobuf/descriptor_pool.py", "//third_party/protobuf/python/google/protobuf/duration.py", "//third_party/protobuf/python/google/protobuf/internal/__init__.py", - "//third_party/protobuf/python/google/protobuf/internal/_parameterized.py", "//third_party/protobuf/python/google/protobuf/internal/api_implementation.py", "//third_party/protobuf/python/google/protobuf/internal/builder.py", "//third_party/protobuf/python/google/protobuf/internal/containers.py", @@ -43,7 +42,6 @@ protoc_plugin_files = [ "//third_party/protobuf/python/google/protobuf/proto_json.py", "//third_party/protobuf/python/google/protobuf/reflection.py", "//third_party/protobuf/python/google/protobuf/runtime_version.py", - "//third_party/protobuf/python/google/protobuf/service.py", "//third_party/protobuf/python/google/protobuf/service_reflection.py", "//third_party/protobuf/python/google/protobuf/symbol_database.py", "//third_party/protobuf/python/google/protobuf/text_encoding.py", diff --git a/third_party/protobuf/.bazelignore b/third_party/protobuf/.bazelignore index dc5c30129978e..69fa449dd96e2 100644 --- a/third_party/protobuf/.bazelignore +++ b/third_party/protobuf/.bazelignore @@ -1,4 +1 @@ -# These are fetched as external repositories. -third_party/abseil-cpp -third_party/googletest _build/ diff --git a/third_party/protobuf/.bazelrc b/third_party/protobuf/.bazelrc index 9fffb304af2ff..9d51ce8c59e1b 100644 --- a/third_party/protobuf/.bazelrc +++ b/third_party/protobuf/.bazelrc @@ -28,12 +28,13 @@ build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr # Abseil passes nullptr to memcmp with 0 size build:ubsan --copt=-fno-sanitize=nonnull-attribute -# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel -# https://github.com/protocolbuffers/protobuf/issues/14313 -common --noenable_bzlmod - # Important: this flag ensures that we remain compliant with the C++ layering # check. build --features=layering_check common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 + +common --enable_platform_specific_config + +# Use clang-cl by default on Windows (see https://github.com/protocolbuffers/protobuf/issues/20085). +build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//build_defs:x64_windows-clang-cl --host_platform=//build_defs:x64_windows-clang-cl diff --git a/third_party/protobuf/.bcr/metadata.template.json b/third_party/protobuf/.bcr/metadata.template.json index fc9fb8f0bc941..6bf5763132af9 100644 --- a/third_party/protobuf/.bcr/metadata.template.json +++ b/third_party/protobuf/.bcr/metadata.template.json @@ -71,7 +71,7 @@ }, { "email": "sbenza@google.com", - "github": "sbenza", + "github": "sbenzaquen", "name": "Samuel Benzaquen", "do_not_notify": true }, diff --git a/third_party/protobuf/.bcr/presubmit.yml b/third_party/protobuf/.bcr/presubmit.yml index bdb24a1781d3a..74c744aa6d2d8 100644 --- a/third_party/protobuf/.bcr/presubmit.yml +++ b/third_party/protobuf/.bcr/presubmit.yml @@ -1,36 +1,20 @@ -matrix: - platform: ["debian10", "macos", "ubuntu2004", "windows"] - bazel: [7.x] - -tasks: - verify_targets: - name: "Verify build targets" - platform: ${{ platform }} - bazel: ${{ bazel }} - build_flags: - - '--host_cxxopt=-std=c++14' - - '--cxxopt=-std=c++14' - build_targets: - - '@protobuf//:protobuf' - - '@protobuf//:protobuf_lite' - - '@protobuf//:protobuf_python' - - '@protobuf//:protobuf_java' - - '@protobuf//:protoc' - - '@protobuf//:test_messages_proto2_cc_proto' - - '@protobuf//:test_messages_proto3_cc_proto' - bcr_test_module: - module_path: "examples" + module_path: examples matrix: platform: ["debian10", "macos", "ubuntu2004", "windows"] - bazel: [7.x] + bazel: [7.x, 8.x] + tasks: - run_test_module: - name: "Run test module" + verify_targets: + name: "Verify build targets" platform: ${{ platform }} bazel: ${{ bazel }} - build_flags: - - '--host_cxxopt=-std=c++14' - - '--cxxopt=-std=c++14' build_targets: - - "//..." + - '//...' + - '@com_google_protobuf//:protobuf' + - '@com_google_protobuf//:protobuf_lite' + - '@com_google_protobuf//:protobuf_python' + - '@com_google_protobuf//:protobuf_java' + - '@com_google_protobuf//:protoc' + - '@com_google_protobuf//:test_messages_proto2_cc_proto' + - '@com_google_protobuf//:test_messages_proto3_cc_proto' \ No newline at end of file diff --git a/third_party/protobuf/.github/CODEOWNERS b/third_party/protobuf/.github/CODEOWNERS index f3206a4f6256b..560efa9945999 100644 --- a/third_party/protobuf/.github/CODEOWNERS +++ b/third_party/protobuf/.github/CODEOWNERS @@ -1,7 +1,3 @@ -/src/ @protocolbuffers/protobuf-compiler - -/src/google/protobuf/compiler/cpp @protocolbuffers/protobuf-cpp - /csharp/ @protocolbuffers/protobuf-csharp /src/google/protobuf/compiler/csharp/ @protocolbuffers/protobuf-csharp @@ -25,13 +21,3 @@ /ruby/ @protocolbuffers/protobuf-ruby /src/google/protobuf/compiler/ruby/ @protocolbuffers/protobuf-ruby - -/build_defs/ @protocolbuffers/protobuf-btr -/cmake/ @protocolbuffers/protobuf-btr -/pkg/ @protocolbuffers/protobuf-btr -/toolchain/ @protocolbuffers/protobuf-btr -/conformance/ @protocolbuffers/protobuf-btr -/kokoro/ @protocolbuffers/protobuf-btr -/third_party/ @protocolbuffers/protobuf-btr -*.bazel @protocolbuffers/protobuf-btr -/.github/ @protocolbuffers/protobuf-btr diff --git a/third_party/protobuf/.github/scripts/validate_yaml.py b/third_party/protobuf/.github/scripts/validate_yaml.py index c6ebc33a60932..1cb7623249410 100644 --- a/third_party/protobuf/.github/scripts/validate_yaml.py +++ b/third_party/protobuf/.github/scripts/validate_yaml.py @@ -53,15 +53,23 @@ for file in yaml_files: continuous_condition = 'inputs.continuous-prefix' in jobs[job]['name'] steps = jobs[job]['steps'] for step in steps: + if 'name' in step: + name = step['name'] + elif 'with' in step and 'name' in step['with']: + name = step['with']['name'] + else: + raise ValueError( + 'Step in job %s from file %s does not have a name.' % (job, file) + ) if continuous_condition and 'continuous-run' not in step.get('if', ''): raise ValueError( - 'Step %s in job %s does not check the continuous-run condition' - % (step['name'], job) + 'Step %s in job %s from file %s does not check the continuous-run' + ' condition' % (name, job, file) ) if not continuous_condition and 'continuous-run' in step.get('if', ''): raise ValueError( - 'Step %s in job %s checks the continuous-run condition but ' - 'the job does not contain the continuous-prefix' - % (step['name'], job) + 'Step %s in job %s from file %s checks the continuous-run' + ' condition but the job does not contain the continuous-prefix' + % (name, job, file) ) print('PASSED: All steps in all jobs check the continuous-run condition.') diff --git a/third_party/protobuf/.github/workflows/clear_caches.yml b/third_party/protobuf/.github/workflows/clear_caches.yml index 5aadfac6b34ec..67a9107c96113 100644 --- a/third_party/protobuf/.github/workflows/clear_caches.yml +++ b/third_party/protobuf/.github/workflows/clear_caches.yml @@ -23,7 +23,7 @@ jobs: actions: write # permission is required to delete caches contents: read steps: - - uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4 + - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ${{ github.workspace }}/${{ steps.output.outputs.repository-cache }} key: repository-cache-${{ github.ref_name }}-${{ runner.os }}-reset-${{ github.sha }} diff --git a/third_party/protobuf/.github/workflows/staleness_check.yml b/third_party/protobuf/.github/workflows/staleness_check.yml index 5cb0fbe30c38d..f42e9e3d686ce 100644 --- a/third_party/protobuf/.github/workflows/staleness_check.yml +++ b/third_party/protobuf/.github/workflows/staleness_check.yml @@ -25,7 +25,7 @@ jobs: if: ${{ github.event.repository.full_name == 'protocolbuffers/protobuf' }} steps: - name: Checkout - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout || github.head_ref || github.ref }} @@ -48,16 +48,17 @@ jobs: # In branches where automatic updates work as post-submits, we don't want to run staleness # tests along with user changes. Any stale files will be automatically fixed in a follow-up # commit. - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: staleness + # TODO: Enable bzlmod once //python/dist is buildable. bash: > set -ex; echo "Please run ./regenerate_stale_files.sh to regenerate stale files"; if [[ -z $COMMIT_TRIGGERED_RUN || -z $MAIN_RUN ]]; then - bazel query 'attr(tags, "staleness_test", //...)' | xargs bazel test $BAZEL_FLAGS; + bazel query 'attr(tags, "staleness_test", //...)' --noenable_bzlmod | xargs bazel test $BAZEL_FLAGS; else - bazel query 'attr(tags, "staleness_test", //...)'; + bazel query 'attr(tags, "staleness_test", //...)' --noenable_bzlmod; fi diff --git a/third_party/protobuf/.github/workflows/test_bazel.yml b/third_party/protobuf/.github/workflows/test_bazel.yml index 0701ed7c616b1..c5643be566744 100644 --- a/third_party/protobuf/.github/workflows/test_bazel.yml +++ b/third_party/protobuf/.github/workflows/test_bazel.yml @@ -27,31 +27,29 @@ jobs: fail-fast: false matrix: runner: [ ubuntu, windows, macos ] - bazelversion: [ '7.1.2' ] + bazelversion: [ '7.1.2', '8.0.0' ] bzlmod: [ true, false ] - toolchain_resolution: [ "" ] - include: - - runner: ubuntu - bazelversion: '6.4.0' - # Not running Bazel 6 with bzlmod, because it doesn't support use_repo_rule in rules_jvm_external - bzlmod: false - - runner: ubuntu - bazelversion: '7.1.2' - bzlmod: false - toolchain_resolution: --incompatible_enable_proto_toolchain_resolution=true - - runner: ubuntu - bazelversion: '7.1.2' - bzlmod: true - toolchain_resolution: --incompatible_enable_proto_toolchain_resolution=true + toolchain_resolution: [ "", "--incompatible_enable_proto_toolchain_resolution=true" ] runs-on: ${{ matrix.runner }}-latest name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Examples ${{ matrix.runner }} ${{ matrix.bazelversion }}${{ matrix.bzlmod && ' (bzlmod)' || '' }} ${{ matrix.toolchain_resolution && ' (toolchain resolution)' || '' }} steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} + # rules_jvm_external doesn't support Java 8, which is the default version + # on some github runners. When this is selected, it results in some + # opaque errors about coursier (see + # https://github.com/bazel-contrib/rules_jvm_external/issues/1337). + - name: Pin to Java 11 + uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 + if: ${{ !matrix.continuous-only || inputs.continuous-run }} + with: + distribution: 'temurin' + java-version: '11' + - name: Windows startup flags if: ${{ runner.os == 'Windows' && (!matrix.continuous-only || inputs.continuous-run) }} working-directory: examples @@ -66,9 +64,11 @@ jobs: - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: examples version: ${{ matrix.bazelversion }} - bash: cd examples && bazel build //... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} ${{ matrix.toolchain_resolution }} + bash: > + cd examples; + bazel build //... @com_google_protobuf-examples-with-hyphen//... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} --enable_workspace=${{ !matrix.bzlmod }} ${{ matrix.toolchain_resolution }}; diff --git a/third_party/protobuf/.github/workflows/test_cpp.yml b/third_party/protobuf/.github/workflows/test_cpp.yml index fb18a521d50f2..f68b79fea4091 100644 --- a/third_party/protobuf/.github/workflows/test_cpp.yml +++ b/third_party/protobuf/.github/workflows/test_cpp.yml @@ -37,38 +37,36 @@ jobs: - { name: No-RTTI, flags: --cxxopt=-fno-rtti, continuous-only: true } include: # Set defaults - - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:6.4.0-27cf7b86212020d7e552bc13b1e084abb971da75 - - targets: //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/... //conformance:conformance_framework_tests - + - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:7.1.2-2c05f44c25a209933743ddf0296ef0c1e583d2c3 + - targets: //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests # Override cases with custom images - - config: { name: "Bazel7", flags: --noenable_bzlmod } - cache_key: Bazel7 - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e" - targets: "//src/... //third_party/utf8_range/..." - # TODO: remove -Wno-unreachable-code" when dropping C++14 - - config: { name: "Bazel7 with Bzlmod", flags: --enable_bzlmod --enable_workspace --per_file_copt=.*/absl/strings/string_view.h@-Wno-unreachable-code --cxxopt="-Wno-self-assign-overloaded" } + - config: { name: "Bazel7", flags: --cxxopt="-Wno-self-assign-overloaded" } cache_key: Bazel7bzlmod - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e" + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" + targets: "//src/... //third_party/utf8_range/..." + - config: { name: "Bazel7 Workspace", flags: --noenable_bzlmod } + cache_key: Bazel7nobzlmod + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" targets: "//src/... //third_party/utf8_range/..." - config: { name: "TCMalloc" } cache_key: TcMalloc - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:6.4.0-27cf7b86212020d7e552bc13b1e084abb971da75" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:7.1.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82" targets: "//src/... //third_party/utf8_range/..." - - config: { name: "aarch64" } - cache_key: TcMalloc + - config: { name: "aarch64", flags: "--platforms=//build_defs:aarch64_linux" } + cache_key: aarch64-bazel7 targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test //third_party/utf8_range/..." - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:6.4.0-aarch64-08714ed7a713068c8418003a2d95f423d4b1eac9" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8" name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.config.name }} runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }} steps: - name: Checkout pending changes if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: image: ${{ matrix.image }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -80,58 +78,57 @@ jobs: strategy: fail-fast: false # Don't cancel all jobs if one fails. matrix: - version: ['9.5', '13.1'] + version: ['7.5', '9.1', '9.5', '13.1'] name: Linux GCC ${{ matrix.version }} runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:6.4.0-${{ matrix.version }}-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-${{ matrix.version }}-e78301df86b3e4c46ec9ac4d98be00e19305d8f3 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: cpp_linux/gcc-${{ matrix.version }} - bazel: test //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/... //conformance:conformance_framework_tests + bazel: test //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests linux-release: strategy: fail-fast: false # Don't cancel all jobs if one fails. matrix: - arch: [x86_64, aarch64] - name: Linux Release ${{ matrix.arch}} + arch: [x86_64] + name: Linux Release ${{ matrix.arch }} runs-on: ubuntu-20-4core steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - submodules: recursive - name: Cross compile protoc for ${{ matrix.arch }} id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-${{ matrix.arch }} - name: Setup sccache - uses: protocolbuffers/protobuf-ci/sccache@v3 + uses: protocolbuffers/protobuf-ci/sccache@v4 with: cache-prefix: linux-release-${{ matrix.arch }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:6.4.0-${{ matrix.arch }}-08714ed7a713068c8418003a2d95f423d4b1eac9 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-${{ matrix.arch }}-2920199ab0090ed427413a8e422e62695c8392a8 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: bash command: > -c "set -ex; sccache -z; cmake . -DWITH_PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} - -Dprotobuf_BUILD_LIBUPB=OFF -Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=14 + -Dprotobuf_BUILD_LIBUPB=OFF -Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=17 -Dprotobuf_WITH_ZLIB=OFF ${{ env.SCCACHE_CMAKE_FLAGS }}; cmake --build . --parallel 20; ctest --parallel 20; @@ -142,78 +139,158 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: include: - - flags: -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=14 + - flags: -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=17 - name: Ninja - flags: -G Ninja -DCMAKE_CXX_STANDARD=14 + flags: -G Ninja -DCMAKE_CXX_STANDARD=17 continuous-only: true - name: Shared - flags: -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=14 + flags: -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=17 continuous-only: true - - name: C++17 - flags: -DCMAKE_CXX_STANDARD=17 - # TODO Re-enable this. - #- name: C++20 - # flags: -DCMAKE_CXX_STANDARD=20 + - name: C++20 + flags: -DCMAKE_CXX_STANDARD=20 + - name: Package + flags: -DCMAKE_CXX_STANDARD=17 -Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON + - name: Fetch + flags: -DCMAKE_CXX_STANDARD=17 -Dprotobuf_FORCE_FETCH_DEPENDENCIES=ON name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux CMake ${{ matrix.name}} runs-on: ubuntu-latest steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Setup sccache if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/sccache@v3 + uses: protocolbuffers/protobuf-ci/sccache@v4 with: cache-prefix: linux-cmake credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-384d5abe83a791c6b1ce04f5d7bc0b1f84a30d38 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.16.9-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: >- /test.sh ${{ matrix.flags}} ${{ env.SCCACHE_CMAKE_FLAGS }} - -Dprotobuf_BUILD_TESTS=ON -Dprotobuf_USE_EXTERNAL_GTEST=ON - -Dprotobuf_ABSL_PROVIDER=package + -Dprotobuf_BUILD_TESTS=ON ${{ matrix.package_flags }} linux-cmake-install: - name: Linux CMake Install + strategy: + fail-fast: false # Don't cancel all jobs if one fails. + matrix: + type: [package, static, fetch] + include: + # Set defaults + - type: package + name: Install + flags: -Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON -Dprotobuf_BUILD_SHARED_LIBS=ON + - type: static + name: Install (static) + flags: -Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON -Dprotobuf_BUILD_SHARED_LIBS=OFF + - type: fetch + name: Install (Fetch) + flags: -Dprotobuf_FORCE_FETCH_DEPENDENCIES=ON -Dprotobuf_BUILD_SHARED_LIBS=ON + continuous-only: true + name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }}Linux CMake ${{ matrix.name }} runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 + if: ${{ !matrix.continuous-only || inputs.continuous-run }} with: ref: ${{ inputs.safe-checkout }} - submodules: recursive - name: Setup sccache - uses: protocolbuffers/protobuf-ci/sccache@v3 + uses: protocolbuffers/protobuf-ci/sccache@v4 + if: ${{ !matrix.continuous-only || inputs.continuous-run }} with: cache-prefix: linux-cmake-install credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 + if: ${{ !matrix.continuous-only || inputs.continuous-run }} with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-384d5abe83a791c6b1ce04f5d7bc0b1f84a30d38 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.16.9-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: >- - /install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.SCCACHE_CMAKE_FLAGS }} - -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package - -Dprotobuf_BUILD_SHARED_LIBS=ON \&\& + /install.sh -DCMAKE_CXX_STANDARD=17 ${{ env.SCCACHE_CMAKE_FLAGS }} + ${{ matrix.flags }} + \&\& + cp build/install_manifest.txt . + \&\& /test.sh ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_REMOVE_INSTALLED_HEADERS=ON -Dprotobuf_BUILD_PROTOBUF_BINARIES=OFF -Dprotobuf_BUILD_CONFORMANCE=ON - -DCMAKE_CXX_STANDARD=14 - -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package + -DCMAKE_CXX_STANDARD=17 + ${{ matrix.flags }} + + - name: Clean up install manifest + if: ${{ !matrix.continuous-only || inputs.continuous-run }} + run: | + set -ex + mkdir manifest + cat install_manifest.txt | sort | sed 's:/usr/local/::g' > manifest/all.txt + cat manifest/all.txt | grep -E '^include/' | grep -vE 'internal' | sed 's:^include/::g' > manifest/include.txt + cat manifest/all.txt | grep -E '^bin/' | grep -vE '\-[0-9]+\.[0-9]+\.[0-9]+$' | sed 's:^bin/::g' > manifest/bin.txt + cat manifest/all.txt | grep -E '^lib/' | grep -vE '\.[0-9]+\.[0-9]+\.[0-9]+$' | sed 's:^lib/::g' > manifest/lib.txt + + - name: Upload install manifest + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + if: ${{ !matrix.continuous-only || inputs.continuous-run }} + with: + name: installed_files_${{ matrix.type }} + path: manifest/*.txt + + install-manifests: + strategy: + fail-fast: false # Don't cancel all jobs if one fails. + matrix: + type: [include, bin, lib] + build: [static, package] + include: + - type: lib + build: static + golden: 'lib_static' + - type: lib + build: package + golden: 'lib_shared' + name: Check Installed Files + needs: linux-cmake-install + runs-on: ubuntu-latest + steps: + - name: Checkout pending changes + uses: protocolbuffers/protobuf-ci/checkout@v4 + with: + ref: ${{ inputs.safe-checkout }} + + - name: Download manifest + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #4.1.8 + with: + name: installed_files_${{ matrix.build }} + path: ${{ matrix.build }} + + - name: Compare against golden + run: | + set +e + GOLDEN_FILE=cmake/installed_${{ matrix.golden || matrix.type }}_golden.txt + DIFF="$(diff -u ${GOLDEN_FILE} ${{ matrix.build }}/${{ matrix.type }}.txt)" + if [ -n "$DIFF" ]; then + echo "Installed files do not match goldens!" + echo "If this is expected, please update the golden file: ${GOLDEN_FILE}" + echo "The following diffs were found:" + echo "$DIFF" + exit 1 + else + echo "Installed files match goldens." + fi # This test should always be skipped on presubmit linux-cmake-examples: @@ -222,30 +299,30 @@ jobs: steps: - name: Checkout pending changes if: ${{ inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Setup sccache if: ${{ inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/sccache@v3 + uses: protocolbuffers/protobuf-ci/sccache@v4 with: cache-prefix: linux-cmake-examples credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - name: Run tests if: ${{ inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-384d5abe83a791c6b1ce04f5d7bc0b1f84a30d38 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.16.9-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: >- - /install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.SCCACHE_CMAKE_FLAGS }} - -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package + /install.sh -DCMAKE_CXX_STANDARD=17 ${{ env.SCCACHE_CMAKE_FLAGS }} + -Dprotobuf_LOCAL_DEPENDENCIES_ONLY=OFF -Dprotobuf_BUILD_EXAMPLES=OFF \&\& mkdir examples/build \&\& cd examples/build \&\& - cmake .. -DCMAKE_CXX_STANDARD=14 \&\& + cmake .. -DCMAKE_CXX_STANDARD=17 \&\& cmake --build . linux-cmake-gcc: @@ -253,8 +330,6 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: include: - - name: C++14 - flags: -DCMAKE_CXX_STANDARD=14 - name: C++17 flags: -DCMAKE_CXX_STANDARD=17 continuous-only: true @@ -266,23 +341,22 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - submodules: recursive - name: Setup sccache if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/sccache@v3 + uses: protocolbuffers/protobuf-ci/sccache@v4 with: cache-prefix: linux-cmake-gcc credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:6.4.0-12.2-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-12.2-e78301df86b3e4c46ec9ac4d98be00e19305d8f3 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: bash command: >- @@ -294,58 +368,32 @@ jobs: ctest --verbose --parallel 20; sccache -s' - linux-cmake-submodules: - name: Linux CMake Submodules - runs-on: ubuntu-latest - steps: - - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 - with: - ref: ${{ inputs.safe-checkout }} - submodules: recursive - - - name: Setup sccache - uses: protocolbuffers/protobuf-ci/sccache@v3 - with: - cache-prefix: linux-cmake-submodules - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - - - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 - with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-384d5abe83a791c6b1ce04f5d7bc0b1f84a30d38 - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - command: >- - /test.sh ${{ env.SCCACHE_CMAKE_FLAGS }} - -Dprotobuf_BUILD_CONFORMANCE=ON -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=14 - linux-cmake-32-bit: name: Linux CMake 32-bit runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - submodules: recursive - name: Setup sccache - uses: protocolbuffers/protobuf-ci/sccache@v3 + uses: protocolbuffers/protobuf-ci/sccache@v4 with: cache-prefix: linux-cmake-32-bit credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/32bit@sha256:429f924aec315704b4233adcbe4b29006116f27769db98acd176b9eb69c31299 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/32bit@sha256:d6028ab408c49932836cdc514116f06886d7f6868a4d430630aa52adc5aee2fc platform: linux/386 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: >- /bin/bash -cex ' cd /workspace; sccache -z; - cmake . -DCMAKE_CXX_STANDARD=14 ${{ env.SCCACHE_CMAKE_FLAGS }}; + cmake . -DCMAKE_CXX_STANDARD=17 ${{ env.SCCACHE_CMAKE_FLAGS }}; cmake --build . --parallel 20; ctest --verbose --parallel 20; sccache -s' @@ -356,15 +404,9 @@ jobs: matrix: include: - name: MacOS Bazel - os: macos-13 - cache_key: macos-13 - bazel: test //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests - - name: MacOS Bazel 7 os: macos-13 cache_key: macos-13-bazel7 bazel: test //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests - bazel_version: '7.1.2' - continuous-only: true - name: MacOS Apple Silicon (build only) Bazel os: macos-13 cache_key: macos-13-arm @@ -373,30 +415,28 @@ jobs: bazel: build --cpu=darwin_arm64 //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests - name: Windows Bazel os: windows-2022 - cache_key: windows-2022 - bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance - - name: Windows Bazel 7 + cache_key: windows-2022-msvc-cl + bazel: test //src/... --config=msvc-cl --test_tag_filters=-conformance --build_tag_filters=-conformance --define=protobuf_allow_msvc=true + - name: Windows Bazel clang-cl os: windows-2022 - cache_key: windows-2022-bazel7 - bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance - bazel_version: '7.1.2' - continuous-only: true + cache_key: windows-2022-clang-cl + bazel: test //src/... --test_tag_filters=-conformance --build_tag_filters=-conformance name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel: ${{ matrix.bazel }} bazel-cache: cpp_${{ matrix.cache_key }} - version: ${{ matrix.bazel_version || '6.4.0' }} + version: ${{ matrix.bazel_version || '7.1.2' }} non-linux-cmake: strategy: @@ -405,7 +445,6 @@ jobs: include: - name: MacOS CMake os: macos-13 - flags: -DCMAKE_CXX_STANDARD=14 cache-prefix: macos-cmake continuous-only: true - name: Windows CMake @@ -416,7 +455,6 @@ jobs: -Dprotobuf_BUILD_EXAMPLES=ON vsversion: '2022' cache-prefix: windows-2022-cmake - continuous-only: true - name: Windows CMake 2019 os: windows-2019 flags: >- @@ -445,7 +483,8 @@ jobs: cache-prefix: windows-2022-cmake - name: Windows CMake Install os: windows-2022 - install-flags: -G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF -Dprotobuf_BUILD_TESTS=OFF + install-flags: >- + -G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF flags: >- -G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF -Dprotobuf_REMOVE_INSTALLED_HEADERS=ON @@ -458,10 +497,9 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - submodules: recursive - name: Setup MSVC if: ${{ runner.os == 'Windows' && (!matrix.continuous-only || inputs.continuous-run) }} @@ -483,7 +521,7 @@ jobs: - name: Setup sccache if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/sccache@v3 + uses: protocolbuffers/protobuf-ci/sccache@v4 with: cache-prefix: ${{ matrix.cache-prefix }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -491,10 +529,13 @@ jobs: # Install phase. - name: Configure CMake for install if: ${{ matrix.install-flags && (!matrix.continuous-only || inputs.continuous-run) }} - uses: protocolbuffers/protobuf-ci/bash@v3 + uses: protocolbuffers/protobuf-ci/bash@v4 with: + bazel-version: 7.1.2 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - command: cmake . ${{ matrix.install-flags }} ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON + command: >- + cmake . -DCMAKE_CXX_STANDARD=17 ${{ matrix.install-flags }} + ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON - name: Build for install if: ${{ matrix.install-flags && (!matrix.continuous-only || inputs.continuous-run) }} shell: bash @@ -514,10 +555,13 @@ jobs: - name: Configure CMake if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bash@v3 + uses: protocolbuffers/protobuf-ci/bash@v4 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - command: cmake . ${{ matrix.flags }} ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON + bazel-version: 7.1.2 + command: >- + cmake . -DCMAKE_CXX_STANDARD=17 ${{ matrix.flags }} + ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON - name: Build if: ${{ !matrix.continuous-only || inputs.continuous-run }} diff --git a/third_party/protobuf/.github/workflows/test_csharp.yml b/third_party/protobuf/.github/workflows/test_csharp.yml index a573288d2d4c7..035601e60fc3a 100644 --- a/third_party/protobuf/.github/workflows/test_csharp.yml +++ b/third_party/protobuf/.github/workflows/test_csharp.yml @@ -19,19 +19,19 @@ jobs: runs-on: ubuntu-22-4core steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} # TODO Run this with Bazel once codegen is handled properly. - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:6.4.0-3.1.415-6.0.100-08714ed7a713068c8418003a2d95f423d4b1eac9 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:7.1.2-3.1.415-6.0.100-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: /bin/bash command: >- - -c " + -cex " cd csharp && dotnet restore src/Google.Protobuf.sln && dotnet build -c Release src/Google.Protobuf.sln && @@ -41,9 +41,9 @@ jobs: run: sudo rm -rf _build .repository-cache - name: Run conformance tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:6.4.0-3.1.415-6.0.100-08714ed7a713068c8418003a2d95f423d4b1eac9 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:7.1.2-3.1.415-6.0.100-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: csharp_linux bazel: test //csharp:conformance_test --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel @@ -53,7 +53,7 @@ jobs: runs-on: windows-2019 steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} @@ -72,8 +72,9 @@ jobs: shell: bash - name: Run tests - uses: protocolbuffers/protobuf-ci/bash@v3 + uses: protocolbuffers/protobuf-ci/bash@v4 with: + bazel-version: 7.1.2 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: | dotnet build csharp/src/Google.Protobuf.sln @@ -84,14 +85,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Build protobuf C# tests under x86_64 docker image # Tests are built "dotnet publish" because we want all the dependencies to the copied to the destination directory # (we want to avoid references to ~/.nuget that won't be available in the subsequent docker run) - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: image: mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -108,7 +109,7 @@ jobs: # running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user # otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity, # we just run map the user's home to a throwaway temporary directory - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: image: mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim-arm64v8 skip-staleness-check: true diff --git a/third_party/protobuf/.github/workflows/test_java.yml b/third_party/protobuf/.github/workflows/test_java.yml index 65e0cd3c5c5e0..94dff1471e035 100644 --- a/third_party/protobuf/.github/workflows/test_java.yml +++ b/third_party/protobuf/.github/workflows/test_java.yml @@ -30,44 +30,46 @@ jobs: include: - name: OpenJDK 8 cache_key: '8' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-8-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-8-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 # TODO: b/318555165 - enable the layering check. Currently it does # not work correctly with the toolchain in this Docker image. targets: //java/... //java/internal:java_version //compatibility/... --features=-layering_check + # TODO: b/393604460 - enable bzlmod once coursier error is fixed. + flags: --java_language_version=8 --noenable_bzlmod - name: OpenJDK 11 cache_key: '11' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-11-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-11-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 targets: //java/... //java/internal:java_version //compatibility/... continuous-only: true - name: OpenJDK 17 cache_key: '17' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-17-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-17-641278a52587c01f44525819b76499db35c2804d targets: //java/... //java/internal:java_version //compatibility/... - name: Bazel7 + cache_key: 'bazel7bzlmod' + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 + targets: //java/... //java/internal:java_version //compatibility/... + - name: Bazel7 Workspace cache_key: 'bazel7nobzlmod' - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 targets: //java/... //java/internal:java_version //compatibility/... flags: --noenable_bzlmod - - name: Bazel7 with Bzlmod - cache_key: 'bazel7bzlmod' - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e - targets: //java/... //java/internal:java_version //compatibility/... - flags: --enable_bzlmod --enable_workspace - - name: aarch64 - cache_key: 'aarch64' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:6.4.0-aarch64-08714ed7a713068c8418003a2d95f423d4b1eac9 - targets: //java/... //compatibility/... //src/google/protobuf/compiler:protoc_aarch64_test + # TODO: b/395623141 - restore this test once runtime uses / emulates aarch64. + # - name: aarch64 + # cache_key: 'aarch64' + # image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8 + # targets: //java/... //compatibility/... //src/google/protobuf/compiler:protoc_aarch64_test name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.name }} runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 if: ${{ !matrix.continuous-only || inputs.continuous-run }} with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 if: ${{ !matrix.continuous-only || inputs.continuous-run }} with: image: ${{ matrix.image }} @@ -81,11 +83,11 @@ jobs: # runs-on: ubuntu-latest # steps: # - name: Checkout pending changes - # uses: protocolbuffers/protobuf-ci/checkout@v3 + # uses: protocolbuffers/protobuf-ci/checkout@v4 # with: # ref: ${{ inputs.safe-checkout }} # - name: Run Linkage Monitor test - # uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + # uses: protocolbuffers/protobuf-ci/bazel-docker@v4 # with: # image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 # credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -99,18 +101,18 @@ jobs: runs-on: ubuntu-22-4core steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Generate maven artifacts with bazel and install using maven - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-11-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-11-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: java_linux/11 bash: | set -ex - bazel build //java:release + bazel build //java:release $BAZEL_FLAGS mvn install:install-file -Dfile=java/bom/pom.xml -DpomFile=java/bom/pom.xml mvn install:install-file -Dfile=java/pom.xml -DpomFile=java/pom.xml mvn install:install-file -Dfile=bazel-bin/java/core/core_mvn-project.jar -DpomFile=bazel-bin/java/core/core_mvn-pom.xml diff --git a/third_party/protobuf/.github/workflows/test_objectivec.yml b/third_party/protobuf/.github/workflows/test_objectivec.yml index 6be5bbed6525a..21f398ddbcc30 100644 --- a/third_party/protobuf/.github/workflows/test_objectivec.yml +++ b/third_party/protobuf/.github/workflows/test_objectivec.yml @@ -50,20 +50,20 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Setup ccache if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/ccache@v3 + uses: protocolbuffers/protobuf-ci/ccache@v4 with: cache-prefix: objectivec_${{ matrix.platform }}_${{ matrix.xc_config }} support-modules: true - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bash@v3 + uses: protocolbuffers/protobuf-ci/bash@v4 env: CC: ${{ github.workspace }}/ci/clang_wrapper CXX: ${{ github.workspace }}/ci/clang_wrapper++ @@ -101,7 +101,7 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Xcode version @@ -109,8 +109,9 @@ jobs: run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.XCODE }}.app - name: Pod lib lint if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: cocoapods/${{ matrix.XCODE }} bash: | @@ -151,13 +152,14 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: bazel ${{ matrix.config.bazel_action }} if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel: ${{ matrix.config.bazel_action }} ${{ matrix.config.flags }} ${{ matrix.bazel_targets }} bazel-cache: objc_${{ matrix.platform }}_${{ matrix.config.name }} diff --git a/third_party/protobuf/.github/workflows/test_php.yml b/third_party/protobuf/.github/workflows/test_php.yml index 2a8a1bbe61df1..57bdbe4552fb9 100644 --- a/third_party/protobuf/.github/workflows/test_php.yml +++ b/third_party/protobuf/.github/workflows/test_php.yml @@ -32,17 +32,17 @@ jobs: - name: 8.1 Optimized version: "8.1.14" version-short: "8.1" - command: composer test \&\& composer test_c + command: composer test && composer test_c - name: 8.1 Debug version: 8.1.14-dbg version-short: "8.1" - command: composer test \&\& composer test_c + command: composer test && composer test_c continuous-only: true - name: 8.1 Memory Leak version: 8.1.14-dbg version-short: "8.1" # Run specialized memory leak & multirequest tests. - command: composer test_c \&\& tests/multirequest.sh \&\& tests/memory_leak_test.sh + command: composer test_c && tests/multirequest.sh && tests/memory_leak_test.sh continuous-only: true - name: 8.1 Valgrind version: 8.1.14-dbg @@ -52,30 +52,39 @@ jobs: - name: 8.3 Optimized version: "8.3.1" version-short: "8.3" - command: composer test \&\& composer test_c + command: composer test && composer test_c name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.name}} runs-on: ubuntu-22-4core steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Setup composer if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/composer-setup@v3 + uses: protocolbuffers/protobuf-ci/composer-setup@v4 with: cache-prefix: php-${{ matrix.version-short }} directory: php - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:6.4.0-${{ matrix.version }}-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:7.1.2-${{ matrix.version }}-90d207f4e749b54c8792bbe974dfc70323b6566e credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - extra-flags: -e COMPOSER_HOME=/workspace/composer-cache - command: ${{ matrix.command }} + bazel-cache: php_linux/${{ matrix.version }} + bash: | + set -ex + COMPOSER_HOME=/workspace/composer-cache + export BAZEL_FLAGS='$BAZEL_FLAGS' + ./regenerate_stale_files.sh $BAZEL_FLAGS + pushd /workspace/php + composer update + ${{ matrix.command }} + popd + bazel test //php:conformance_test //php:conformance_test_c --action_env=PATH --test_env=PATH $BAZEL_FLAGS linux-32bit: strategy: @@ -104,29 +113,29 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Cross compile protoc for i386 if: ${{ !matrix.continuous-only || inputs.continuous-run }} id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-bec4e87effd62da1d4f9a13d377e37bcb80376c9 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-i386 - name: Setup composer if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/composer-setup@v3 + uses: protocolbuffers/protobuf-ci/composer-setup@v4 with: cache-prefix: php-${{ matrix.version }} directory: php - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: image: ${{ env.image }} platform: linux/386 @@ -139,50 +148,11 @@ jobs: composer update --ignore-platform-reqs; composer ${{ matrix.test }}' - linux-aarch64: - name: Linux aarch64 - runs-on: ubuntu-22-4core - steps: - - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 - with: - ref: ${{ inputs.safe-checkout }} - - - name: Cross compile protoc for aarch64 - id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 - with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - architecture: linux-aarch64 - - - name: Setup composer - uses: protocolbuffers/protobuf-ci/composer-setup@v3 - with: - cache-prefix: php-8.1 - directory: php - - - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 - with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php-aarch64@sha256:77ff9fdec867bbfb290ee0b10d8b7a3e5e434155daa5ec93de7341c7592b858d - platform: linux/arm64 - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - extra-flags: -e COMPOSER_HOME=/workspace/composer-cache -e PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} - command: >- - -c ' - cd php; - composer update --ignore-platform-reqs; - composer test; - composer test_c' - macos: strategy: fail-fast: false # Don't cancel all jobs if one fails. matrix: include: - - version: '8.2' - continuous-only: true - version: '8.3' name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} MacOS PHP ${{ matrix.version }} @@ -191,7 +161,7 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} @@ -205,7 +175,7 @@ jobs: - name: Pin PHP version if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: shivammathur/setup-php@8872c784b04a1420e81191df5d64fbd59d3d3033 # 2.30.2 + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1 with: php-version: ${{ matrix.version }} @@ -215,14 +185,14 @@ jobs: - name: Setup composer if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/composer-setup@v3 + uses: protocolbuffers/protobuf-ci/composer-setup@v4 with: cache-prefix: php-${{ matrix.version }} directory: php - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bash@v3 + uses: protocolbuffers/protobuf-ci/bash@v4 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: | @@ -235,8 +205,8 @@ jobs: - name: Run conformance tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: php_macos/${{ matrix.version }} - bazel: test //php:conformance_test_c --action_env=PATH --test_env=PATH + bazel: test //php:conformance_test //php:conformance_test_c --action_env=PATH --test_env=PATH diff --git a/third_party/protobuf/.github/workflows/test_php_ext.yml b/third_party/protobuf/.github/workflows/test_php_ext.yml index 5179c9f7baa66..df2abc6ff60ae 100644 --- a/third_party/protobuf/.github/workflows/test_php_ext.yml +++ b/third_party/protobuf/.github/workflows/test_php_ext.yml @@ -28,13 +28,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Package extension - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: php_ext/${{ matrix.version }} bash: > @@ -68,7 +69,7 @@ jobs: - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php-extension:${{ matrix.version }}-a48f26c08d9a803dd0177dda63563f6ea6f7b2d4 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} diff --git a/third_party/protobuf/.github/workflows/test_python.yml b/third_party/protobuf/.github/workflows/test_python.yml index 5ede687f3eed2..36d929a7c70be 100644 --- a/third_party/protobuf/.github/workflows/test_python.yml +++ b/third_party/protobuf/.github/workflows/test_python.yml @@ -28,7 +28,9 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: type: [ Pure, C++] - version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + # TODO: Enable bzlmod once python headers are supported for python dist. + bzlmod: [--noenable_bzlmod] include: - type: Pure targets: //python/... //python:python_version_test @@ -36,36 +38,38 @@ jobs: - type: C++ targets: //python/... //python:python_version_test flags: --define=use_fast_cpp_protos=true + - version: "3.9" + - version: "3.10" + continuous-only: true + - version: "3.11" + continuous-only: true + - version: "3.12" + continuous-only: true + - version: "3.13" - type: C++ version: aarch64 targets: //python/... //python:aarch64_test # TODO Enable this once conformance tests are fixed. flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-63dd26c0c7a808d92673a3e52e848189d4ab0f17 - - version: "3.8" - - version: "3.9" - continuous-only: true - - version: "3.10" - continuous-only: true - - version: "3.11" + bzlmod: --noenable_bzlmod + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8 name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.type }} ${{ matrix.version }} runs-on: ubuntu-latest steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:6.4.0-{0}-27cf7b86212020d7e552bc13b1e084abb971da75', matrix.version) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:7.1.2-{0}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82', matrix.version) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }} - bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION - exclude-targets: -//python/pb_unit_tests/... + bazel: test ${{ matrix.targets }} ${{ matrix.flags }} ${{ matrix.bzlmod }} --test_env=KOKORO_PYTHON_VERSION macos: @@ -73,25 +77,28 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: type: [ Pure, C++] - # TODO Consider expanding this set of versions. - version: [ "3.12" ] + version: [ "3.12", "3.13" ] + # TODO: Enable bzlmod once python headers are supported for python dist. + bzlmod: [--noenable_bzlmod] include: - type: Pure targets: //python/... //python:python_version_test - type: C++ targets: //python/... //python:python_version_test flags: --define=use_fast_cpp_protos=true + - version: "3.13" + continuous-only: true name: MacOS ${{ matrix.type }} ${{ matrix.version }} runs-on: macos-13 steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Pin Python version - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f #v5.1.1 with: python-version: ${{ matrix.version }} cache: pip @@ -106,14 +113,14 @@ jobs: source venv/bin/activate - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 env: KOKORO_PYTHON_VERSION: ${{ matrix.version }} with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: python_macos/${{ matrix.type }}_${{ matrix.version }} bazel: >- - test ${{ matrix.targets }} ${{ matrix.flags }} + test ${{ matrix.targets }} ${{ matrix.flags }} ${{ matrix.bzlmod }} --test_env=KOKORO_PYTHON_VERSION=${{ matrix.version }} - --macos_minimum_os=10.9 - exclude-targets: -//python/pb_unit_tests/... + --macos_minimum_os=11.0 diff --git a/third_party/protobuf/.github/workflows/test_release_branches.yml b/third_party/protobuf/.github/workflows/test_release_branches.yml index f40b59dfe33f5..88c6bb76077e1 100644 --- a/third_party/protobuf/.github/workflows/test_release_branches.yml +++ b/third_party/protobuf/.github/workflows/test_release_branches.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - branch: [25.x, 27.x, 28.x] + branch: [25.x, 29.x] runs-on: ubuntu-latest permissions: actions: write diff --git a/third_party/protobuf/.github/workflows/test_ruby.yml b/third_party/protobuf/.github/workflows/test_ruby.yml index 5d052ccd33189..bb4ccc3887e1f 100644 --- a/third_party/protobuf/.github/workflows/test_ruby.yml +++ b/third_party/protobuf/.github/workflows/test_ruby.yml @@ -29,31 +29,32 @@ jobs: matrix: include: # Test both FFI and Native implementations on the highest and lowest - # Ruby versions for CRuby and JRuby, but only on Bazel 5.x. - - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE } - - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, continuous-only: true } - - { name: Ruby 3.1, ruby: ruby-3.1.0, continuous-only: true } - - { name: Ruby 3.2, ruby: ruby-3.2.0, continuous-only: true } - - { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE } - - { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI } - - { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: NATIVE } - - { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: FFI } + # Ruby versions for CRuby and JRuby + - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82' } + - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, continuous-only: true, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82' } + - { name: Ruby 3.1, ruby: ruby-3.1.6, continuous-only: true } + - { name: Ruby 3.2, ruby: ruby-3.2.6, continuous-only: true } + - { name: Ruby 3.3, ruby: ruby-3.3.6, continuous-only: true } + - { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE } + - { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI } + - { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE } + - { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI } name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.name }} ${{ matrix.ffi == 'FFI' && ' FFI' || '' }} runs-on: ubuntu-latest steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:6.4.0-{0}-27cf7b86212020d7e552bc13b1e084abb971da75', matrix.ruby) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-90d207f4e749b54c8792bbe974dfc70323b6566e', matrix.ruby) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }} + bazel-cache: ruby_linux/${{ matrix.ruby }} bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} # Useful tool for troubleshooting, but the action introduces flakes as well, # e.g. https://github.com/actions/upload-artifact/issues/569 @@ -69,20 +70,20 @@ jobs: runs-on: ubuntu-20-4core steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Cross compile protoc for i386 id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-i386 - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 + uses: protocolbuffers/protobuf-ci/docker@v4 with: image: i386/ruby:3.0.2-buster credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -95,64 +96,34 @@ jobs: rake clobber_package gem; PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake test' - linux-aarch64: - name: Linux aarch64 - runs-on: ubuntu-20-4core - steps: - - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 - with: - ref: ${{ inputs.safe-checkout }} - - - name: Cross compile protoc for aarch64 - id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 - with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - architecture: linux-aarch64 - - - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v3 - with: - image: arm64v8/ruby:3.0.2-buster - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - command: >- - /bin/bash -cex ' - gem install bundler -v 2.5.13; - cd /workspace/ruby; - bundle; - PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake; - rake clobber_package gem; - PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake test' - macos: strategy: fail-fast: false # Don't cancel all jobs if one fails. matrix: include: # Test both FFI and Native implementations on the highest and lowest - # Ruby versions for CRuby, but only on Bazel 5.x. + # Ruby versions for CRuby. # Quote versions numbers otherwise 3.0 will render as 3 - { version: "3.0", ffi: NATIVE } - { version: "3.0", ffi: FFI, continuous-only: true } - { version: "3.1", continuous-only: true } - { version: "3.2", continuous-only: true } - - { version: "3.3", ffi: NATIVE } - - { version: "3.3", ffi: FFI } + - { version: "3.3", continuous-only: true } + - { version: "3.4", ffi: NATIVE } + - { version: "3.4", ffi: FFI } name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} MacOS Ruby ${{ matrix.version }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }} runs-on: macos-13 steps: - name: Checkout pending changes if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Pin Ruby version if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: ruby/setup-ruby@961f85197f92e4842e3cb92a4f97bd8e010cdbaf # v1.165.0 + uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0 with: ruby-version: ${{ matrix.version }} @@ -162,8 +133,9 @@ jobs: - name: Run tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_macos/${{ matrix.version }} bazel: test //ruby/... --test_env=KOKORO_RUBY_VERSION=${{ matrix.version }} --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} @@ -175,28 +147,29 @@ jobs: matrix: include: # Test both FFI and Native implementations on the highest and lowest - # Ruby versions for CRuby and JRuby, but only on Bazel 5.x. - - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE} - - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI} - - { name: Ruby 3.1, ruby: ruby-3.1.0} - - { name: Ruby 3.2, ruby: ruby-3.2.0} - - { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE } - - { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI } - - { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: NATIVE } - - { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: FFI } + # Ruby versions for CRuby and JRuby. + - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82'} + - { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82'} + - { name: Ruby 3.1, ruby: ruby-3.1.6} + - { name: Ruby 3.2, ruby: ruby-3.2.6} + - { name: Ruby 3.3, ruby: ruby-3.3.6} + - { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE } + - { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI } + - { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE } + - { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI } name: ${{ inputs.continuous-prefix }} Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }} runs-on: ubuntu-latest steps: - name: Checkout pending changes if: ${{ inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests if: ${{ inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:6.4.0-${{ matrix.ruby }}-27cf7b86212020d7e552bc13b1e084abb971da75 + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-90d207f4e749b54c8792bbe974dfc70323b6566e', matrix.ruby) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }} bash: > diff --git a/third_party/protobuf/.github/workflows/test_runner.yml b/third_party/protobuf/.github/workflows/test_runner.yml index d0c35735bc2fb..35218e4d69ca5 100644 --- a/third_party/protobuf/.github/workflows/test_runner.yml +++ b/third_party/protobuf/.github/workflows/test_runner.yml @@ -20,8 +20,6 @@ on: branches: - main - '[0-9]+.x' - # The 21.x and 22.x branches still use Kokoro - - '!2[12].x' # For testing purposes so we can stage this on the `gha` branch. - gha @@ -30,8 +28,6 @@ on: branches: - main - '[0-9]+.x' - # The 21.x and 22.x branches still use Kokoro - - '!2[12].x' # For testing purposes so we can stage this on the `gha` branch. - gha @@ -40,8 +36,6 @@ on: branches: - main - '[0-9]+.x' - # The 21.x branch still use Kokoro - - '!21.x' # For testing purposes so we can stage this on the `gha` branch. - gha types: [labeled, opened, reopened, synchronize] @@ -54,7 +48,7 @@ permissions: concurrency: group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: ${{ contains(fromJSON('["pull_request", "pull_request_target", "workflow_dispatch"]'), github.event_name) }} + cancel-in-progress: ${{ contains(fromJSON('["pull_request", "pull_request_target", "workflow_dispatch", "schedule"]'), github.event_name) }} jobs: set-vars: @@ -105,7 +99,7 @@ jobs: - name: Set Test Type Variables id: set-test-type-vars run: | - if ([ "${{ github.event_name }}" == 'pull_request' ] || [ "${{ github.event_name }}" == 'pull_request_target' ]) && ${{ !contains(toJson(github.event.pull_request.body), '\n#test-continuous') }}; then + if ([ "${{ github.event_name }}" == 'pull_request' ] || [ "${{ github.event_name }}" == 'pull_request_target' ]) && ${{ !contains(toJson(github.event.pull_request.body), '#test-continuous') }}; then echo "continuous-run=" >> "$GITHUB_OUTPUT" echo "continuous-prefix=[SKIPPED] (Continuous)" >> "$GITHUB_OUTPUT" else diff --git a/third_party/protobuf/.github/workflows/test_rust.yml b/third_party/protobuf/.github/workflows/test_rust.yml index c22b16398ac27..c6f65b7938283 100644 --- a/third_party/protobuf/.github/workflows/test_rust.yml +++ b/third_party/protobuf/.github/workflows/test_rust.yml @@ -14,29 +14,38 @@ permissions: jobs: # This job should be run on presubmit, if any continuous-only tests are added we will need to input test-type above linux: - name: Linux + strategy: + fail-fast: false # Don't cancel all jobs if one fails. + matrix: + config: + - { name: Fastbuild, flags: --noenable_bzlmod } + - { name: Optimized, flags: --noenable_bzlmod --config=opt } + - { name: ASAN, flags: --noenable_bzlmod --config=asan } + + include: + - targets: "//rust/... //src/google/protobuf/compiler/rust/..." + - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" + - bazel_cmd: "test" + + # Override cases with custom images + - config: { name: Cargo, flags: --noenable_bzlmod } + image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:7.1.2-1.74.0-d9624f2aa83cba3eaf906f751d75b36aacb9aa82" + bazel_cmd: "run" + targets: "//rust/release_crates:cargo_test" + name: Linux ${{ matrix.config.name }} runs-on: ubuntu-22-4core steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.1-97f82260fd504923d8af642d567afb2d83a1959d" + image: ${{ matrix.image }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: rust_linux bazel: >- - test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 - //rust:all - //rust/test/rust_proto_library_unit_test:rust_upb_aspect_test - //src/google/protobuf/compiler/rust/... - - name: Run Cargo tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 - with: - image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:6.3.0-1.74.0-8858126dd9480abf91e6ce8d6e41a5cd3c03882c" - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - bazel-cache: rust_linux - bazel: >- - run //rust:cargo_test + ${{ matrix.bazel_cmd }} --crosstool_top=//toolchain:clang_suite --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --@rules_rust//rust/settings:experimental_use_cc_common_link=True + ${{ matrix.targets }} ${{ matrix.config.flags }} + diff --git a/third_party/protobuf/.github/workflows/test_upb.yml b/third_party/protobuf/.github/workflows/test_upb.yml index 5d52429fabc10..22be4000f0d5a 100644 --- a/third_party/protobuf/.github/workflows/test_upb.yml +++ b/third_party/protobuf/.github/workflows/test_upb.yml @@ -28,7 +28,6 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: config: - - { name: "Bazel 7", bazel_version: "7.1.1", continuous-only: true } - { name: "Fastbuild" } - { name: "Optimized", flags: "-c opt", continuous-only: true } - { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/...", runner: ubuntu-22-4core } @@ -43,17 +42,18 @@ jobs: steps: - name: Checkout pending changes if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '6.4.0' }}-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '7.1.2' }}-2c05f44c25a209933743ddf0296ef0c1e583d2c3 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: upb-bazel - bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }} + # TODO: Enable bzlmod once python headers are supported for python dist. + bazel: test --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }} exclude-targets: ${{ matrix.config.exclude-targets }} linux-gcc: @@ -63,17 +63,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:6.4.0-12.2-27cf7b86212020d7e552bc13b1e084abb971da75" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-12.2-e78301df86b3e4c46ec9ac4d98be00e19305d8f3" credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-gcc" bazel: >- - test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt + test --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt --copt="-Wno-error=maybe-uninitialized" --copt="-Wno-error=attributes" //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... @@ -84,20 +84,16 @@ jobs: runs-on: windows-2022 steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - cache: pip - cache-dependency-path: 'python/requirements.txt' - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-windows" - bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/... - version: 6.4.0 + bazel: test --noenable_bzlmod --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/... + version: 7.1.2 exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test macos: @@ -111,21 +107,22 @@ jobs: runs-on: macos-13 steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + - name: Setup Python + uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: python-version: 3.12 cache: pip cache-dependency-path: 'python/requirements.txt' - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel@v3 + uses: protocolbuffers/protobuf-ci/bazel@v4 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-macos" - bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... - version: 6.4.0 + bazel: ${{ matrix.config.bazel-command }} --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... + version: 7.1.2 no-python: strategy: @@ -134,20 +131,20 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-no-python" bash: >- which python3 && mv `which python3` /tmp && ! which python3 && - bazel test $BAZEL_FLAGS --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //python/... -- -//python/dist:source_wheel + bazel test $BAZEL_FLAGS --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //python/... -- -//python/dist:source_wheel -//python:aarch64_test -//python:x86_64_test -//python:google/protobuf/pyext/_message.so -//python:proto_api build_wheels: name: Build Wheels @@ -155,16 +152,16 @@ jobs: if: ${{ github.event_name != 'pull_request_target' }} steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Build Wheels - uses: protocolbuffers/protobuf-ci/bazel-docker@v3 + uses: protocolbuffers/protobuf-ci/bazel-docker@v4 with: - image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:6.4.0-5be0f4fde927ca702ed4cebe096bfb632d6d9a36 + image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:7.1.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: upb-bazel-python - bazel: build --crosstool_top=//toolchain:clang_suite --//toolchain:release=true --symlink_prefix=/ -c dbg //python/dist //python/dist:test_wheel //python/dist:source_wheel + bazel: build --noenable_bzlmod --crosstool_top=//toolchain:clang_suite --//toolchain:release=true --symlink_prefix=/ -c dbg --incompatible_enable_cc_toolchain_resolution=false //python/dist //python/dist:test_wheel //python/dist:source_wheel - name: Move Wheels run: mkdir wheels && find _build/out \( -name 'protobuf*.whl' -o -name 'protobuf-*.tar.gz' \) -exec mv '{}' wheels ';' - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 @@ -186,26 +183,26 @@ jobs: # a single wheel. As a result we can just test the oldest and newest # supported Python versions and assume this gives us sufficient test # coverage. - - { os: ubuntu-latest, python-version: "3.8", architecture: x64, type: 'binary' } - - { os: macos-13, python-version: "3.8", architecture: x64, type: 'binary' } + - { os: ubuntu-latest, python-version: "3.9", architecture: x64, type: 'binary' } + - { os: macos-13, python-version: "3.9", architecture: x64, type: 'binary' } - { os: ubuntu-latest, python-version: "3.12", architecture: x64, type: 'binary' } - { os: macos-13, python-version: "3.12", architecture: x64, type: 'binary' } - - { os: ubuntu-latest, python-version: "3.8", architecture: x64, type: 'source', continuous-only: true } - - { os: macos-13, python-version: "3.8", architecture: x64, type: 'source', continuous-only: true } - { os: ubuntu-latest, python-version: "3.12", architecture: x64, type: 'source', continuous-only: true } - { os: macos-13, python-version: "3.12", architecture: x64, type: 'source', continuous-only: true } + - { os: ubuntu-latest, python-version: "3.13", architecture: x64, type: 'source', continuous-only: true } + - { os: macos-13, python-version: "3.13", architecture: x64, type: 'source', continuous-only: true } # Windows uses the full API up until Python 3.10. - - { os: windows-2019, python-version: "3.8", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.9", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.10", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.11", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.12", architecture: x86, type: 'binary', continuous-only: true } - - { os: windows-2019, python-version: "3.8", architecture: x64, type: 'binary' } - - { os: windows-2019, python-version: "3.9", architecture: x64, type: 'binary', continuous-only: true } + - { os: windows-2019, python-version: "3.13", architecture: x86, type: 'binary', continuous-only: true } + - { os: windows-2019, python-version: "3.9", architecture: x64, type: 'binary' } - { os: windows-2019, python-version: "3.10", architecture: x64, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.11", architecture: x64, type: 'binary', continuous-only: true } - - { os: windows-2019, python-version: "3.12", architecture: x64, type: 'binary' } + - { os: windows-2019, python-version: "3.12", architecture: x64, type: 'binary', continuous-only: true } + - { os: windows-2019, python-version: "3.13", architecture: x64, type: 'binary' } name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Test Wheels Python ${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.architecture }} ${{ matrix.type }} needs: build_wheels runs-on: ${{ matrix.os }} @@ -226,7 +223,8 @@ jobs: with: name: requirements path: requirements - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + - name: Setup Python + uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 if: ${{ !matrix.continuous-only || inputs.continuous-run }} with: python-version: ${{ matrix.python-version }} @@ -262,12 +260,17 @@ jobs: - name: Install Protobuf Test Wheel if: ${{ !matrix.continuous-only || inputs.continuous-run }} run: pip install -vvv --no-index --find-links wheels protobuftests - - name: Run the unit tests + - name: Run unit tests if: ${{ !matrix.continuous-only || inputs.continuous-run }} + # Newer upb tests are in the standard google.protobuf.internal path. + # We will eventually make this into a wildcard rule once all tests + # have been migrated to be compatible with upb. + # TODO: b/378725969 - Use wildcard expansion to ensure that we don't + # accidentally miss test coverage. run: | - TESTS=$(pip show -f protobuftests | grep pb_unit_tests.*py$ | sed 's,/,.,g' | sed 's,\\,.,g' | sed -E 's,.py$,,g') - for test in $TESTS; do - python -m unittest -v $test + TESTS=(message_test message_factory_test descriptor_test proto_builder_test descriptor_pool_test generator_test reflection_test reflection_cpp_test) + for test in ${TESTS[@]}; do + python -m unittest -v google.protobuf.internal.${test} done test_pure_python_wheels: @@ -276,7 +279,7 @@ jobs: strategy: fail-fast: false # Don't cancel all jobs if one fails. matrix: - python-version: ["3.8", "3.12"] + python-version: ["3.9", "3.13"] runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request_target' }} steps: @@ -287,7 +290,8 @@ jobs: path: wheels - name: Delete Binary Wheels run: find wheels -type f | grep -v none-any | xargs rm - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + - name: Setup Python + uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: python-version: ${{ matrix.python-version }} - name: Setup Python venv @@ -296,8 +300,13 @@ jobs: python -m venv env source env/bin/activate echo "VIRTUAL ENV:" $VIRTUAL_ENV - - name: Install numpy - run: pip install numpy + - name: Download Requirements + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #4.1.8 + with: + name: requirements + path: requirements + - name: Install requirements + run: pip install -r requirements/requirements.txt - name: Install Protobuf Wheels run: pip install -vvv --no-index --find-links wheels protobuf protobuftests - name: Run the unit tests diff --git a/third_party/protobuf/.github/workflows/test_yaml.yml b/third_party/protobuf/.github/workflows/test_yaml.yml index 602c0d736f8e7..d6bb89ebfad8b 100644 --- a/third_party/protobuf/.github/workflows/test_yaml.yml +++ b/third_party/protobuf/.github/workflows/test_yaml.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout pending changes - uses: protocolbuffers/protobuf-ci/checkout@v3 + uses: protocolbuffers/protobuf-ci/checkout@v4 with: ref: ${{ inputs.safe-checkout }} - name: Run python validation script diff --git a/third_party/protobuf/.gitignore b/third_party/protobuf/.gitignore index 5766401460e4c..3bd40f102cf07 100644 --- a/third_party/protobuf/.gitignore +++ b/third_party/protobuf/.gitignore @@ -176,10 +176,14 @@ ruby/tests/multi_level_nesting_test_pb.rb ruby/tests/service_test_pb.rb ruby/tests/test_import_proto2_pb.rb ruby/tests/test_ruby_package_proto2_pb.rb +ruby/tests/basic_test_features_pb.rb +ruby/tests/generated_code_editions_pb.rb +ruby/tests/repeated_field_test_pb.rb +ruby/tests/stress_pb.rb +ruby/tests/utf8_pb.rb ruby/compatibility_tests/v3.0.0/protoc ruby/compatibility_tests/v3.0.0/tests/generated_code_pb.rb ruby/compatibility_tests/v3.0.0/tests/test_import_pb.rb -ruby/Gemfile.lock # IntelliJ CLion Config files and build output cmake/.idea diff --git a/third_party/protobuf/.gitmodules b/third_party/protobuf/.gitmodules index 495082fb4727d..e69de29bb2d1d 100644 --- a/third_party/protobuf/.gitmodules +++ b/third_party/protobuf/.gitmodules @@ -1,11 +0,0 @@ -[submodule "third_party/googletest"] - path = third_party/googletest - url = https://github.com/google/googletest.git - ignore = dirty -[submodule "third_party/abseil-cpp"] - path = third_party/abseil-cpp - url = https://github.com/abseil/abseil-cpp.git - branch = lts_2023_08_02 -[submodule "third_party/jsoncpp"] - path = third_party/jsoncpp - url = https://github.com/open-source-parsers/jsoncpp.git diff --git a/third_party/protobuf/BUILD.bazel b/third_party/protobuf/BUILD.bazel index 32b26cbdc9c49..f91080cb0e108 100644 --- a/third_party/protobuf/BUILD.bazel +++ b/third_party/protobuf/BUILD.bazel @@ -2,7 +2,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("@rules_license//rules:license.bzl", "license") -load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("//bazel:cc_proto_library.bzl", "cc_proto_library") load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library") load("//bazel:java_proto_library.bzl", "java_proto_library") @@ -24,6 +23,11 @@ license( license_text = ":LICENSE", ) +exports_files( + ["MODULE.bazel"], + visibility = ["//cmake:__pkg__"], +) + ################################################################################ # Well Known Types Proto Library Rules # @@ -464,6 +468,16 @@ alias( visibility = ["//visibility:public"], ) +################################################################################ +# Go support +################################################################################ + +alias( + name = "go_features_proto", + actual = "//go:go_features_proto", # proto_library + visibility = ["//visibility:public"], +) + ################################################################################ # Test protos ################################################################################ @@ -642,53 +656,3 @@ filegroup( srcs = glob(["**/*.bzl"]), visibility = ["//visibility:public"], ) - -################################################################################ -# Packaging rules -################################################################################ - -# Files included in all source distributions -pkg_files( - name = "common_dist_files", - srcs = glob( - [ - "*.bzl", - "cmake/*.cmake", - "cmake/*.in", - "editors/*", - ], - allow_empty = True, - ) + [ - "BUILD.bazel", - "CMakeLists.txt", - "CONTRIBUTORS.txt", - "LICENSE", - "README.md", - "WORKSPACE", - "cmake/README.md", - "generate_descriptor_proto.sh", - "maven_install.json", - "//third_party:BUILD.bazel", - "//third_party:zlib.BUILD", - ], - strip_prefix = strip_prefix.from_root(""), - visibility = ["//pkg:__pkg__"], -) - -# Additional files for C# -pkg_files( - name = "csharp_dist_files", - srcs = [ - "global.json", - ], - visibility = ["//pkg:__pkg__"], -) - -# Additional files for ObjC -pkg_files( - name = "objectivec_dist_files", - srcs = [ - "Protobuf.podspec", - ], - visibility = ["//pkg:__pkg__"], -) diff --git a/third_party/protobuf/CMakeLists.txt b/third_party/protobuf/CMakeLists.txt index 878ef2e3d183f..3e10d12dd755a 100644 --- a/third_party/protobuf/CMakeLists.txt +++ b/third_party/protobuf/CMakeLists.txt @@ -1,6 +1,6 @@ # Minimum CMake required. If available, accept the policy-controlled behavior up # to 3.26. -cmake_minimum_required(VERSION 3.10...3.26) +cmake_minimum_required(VERSION 3.16...3.26) # Revert to old behavior for MSVC debug symbols. if(POLICY CMP0141) @@ -35,6 +35,8 @@ option(protobuf_BUILD_LIBUPB "Build libupb" ON) option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF) option(protobuf_TEST_XML_OUTDIR "Output directory for XML logs from tests." "") option(protobuf_ALLOW_CCACHE "Adjust build flags to allow for ccache support." OFF) +option(protobuf_FORCE_FETCH_DEPENDENCIES "Force all dependencies to be downloaded from GitHub. Local installations will be ignored." OFF) +option(protobuf_LOCAL_DEPENDENCIES_ONLY "Prevent downloading any dependencies from GitHub. If this option is set, the dependency must be available locally as an installed package." OFF) # We support Unity (Jumbo) builds best-effort. option(protobuf_USE_UNITY_BUILD "Enable Unity (Jumbo) build for" OFF) @@ -84,7 +86,7 @@ if (protobuf_BUILD_SHARED_LIBS) endif () # Version metadata -set(protobuf_VERSION_STRING "5.29.3") +set(protobuf_VERSION_STRING "6.30.1") set(protobuf_DESCRIPTION "Protocol Buffers") set(protobuf_CONTACT "protobuf@googlegroups.com") @@ -106,18 +108,21 @@ string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3" string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5" protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}") -message(STATUS "${protobuf_VERSION_PRERELEASE}") +if (protobuf_FORCE_FETCH_DEPENDENCIES AND protobuf_LOCAL_DEPENDENCIES_ONLY) + message(FATAL_ERROR "Conflicting options protobuf_FORCE_FETCH_DEPENDENCIES and protobuf_LOCAL_DEPENDENCIES_ONLY both set") +endif() # Package version set(protobuf_VERSION "${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}") if(protobuf_VERSION_PRERELEASE) + message(STATUS "${protobuf_VERSION_PRERELEASE}") set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}") else() set(protobuf_VERSION "${protobuf_VERSION}.0") endif() -message(STATUS "${protobuf_VERSION}") +message(STATUS "protobuf version: ${protobuf_VERSION}") if(protobuf_VERBOSE) message(STATUS "Configuration script parsing status [") @@ -153,14 +158,6 @@ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map) find_package(Threads REQUIRED) -# We can install dependencies from submodules if we're running -# CMake v3.13 or newer. -if(CMAKE_VERSION VERSION_LESS 3.13) - set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE OFF) -else() - set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE ON) -endif() - set(_protobuf_FIND_ZLIB) if (protobuf_WITH_ZLIB) find_package(ZLIB) @@ -189,7 +186,7 @@ set(protobuf_LINK_LIBATOMIC false) if (NOT MSVC) include(CheckCXXSourceCompiles) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++14) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++17) check_cxx_source_compiles(" #include <atomic> int main() { @@ -206,31 +203,11 @@ if (protobuf_BUILD_SHARED_LIBS) set(protobuf_SHARED_OR_STATIC "SHARED") else (protobuf_BUILD_SHARED_LIBS) set(protobuf_SHARED_OR_STATIC "STATIC") - # The CMAKE_<LANG>_FLAGS(_<BUILD_TYPE>)? is meant to be user controlled. - # Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags - # making programmatic control difficult. Prefer the functionality in newer - # CMake versions when available. - if(${CMAKE_VERSION} VERSION_GREATER 3.15 OR ${CMAKE_VERSION} VERSION_EQUAL 3.15) - if (protobuf_MSVC_STATIC_RUNTIME) - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>) - else() - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>DLL) - endif() + set(ABSL_MSVC_STATIC_RUNTIME ON) + if (protobuf_MSVC_STATIC_RUNTIME) + set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>) else() - # In case we are building static libraries, link also the runtime library statically - # so that MSVCR*.DLL is not required at runtime. - # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx - # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd - # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F - if (MSVC AND protobuf_MSVC_STATIC_RUNTIME) - foreach(flag_var - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME) + set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>DLL) endif() endif (protobuf_BUILD_SHARED_LIBS) @@ -289,12 +266,6 @@ include_directories( ${protobuf_BINARY_DIR}/src ${protobuf_SOURCE_DIR}/src) -set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library") -set_property(CACHE protobuf_ABSL_PROVIDER PROPERTY STRINGS "module" "package") - -set(protobuf_JSONCPP_PROVIDER "module" CACHE STRING "Provider of jsoncpp library") -set_property(CACHE protobuf_JSONCPP_PROVIDER PROPERTY STRINGS "module" "package") - if (protobuf_BUILD_TESTS) include(${protobuf_SOURCE_DIR}/cmake/gtest.cmake) endif (protobuf_BUILD_TESTS) diff --git a/third_party/protobuf/Cargo.bazel.lock b/third_party/protobuf/Cargo.bazel.lock index 23fe9e5ef7f43..912453272ab27 100644 --- a/third_party/protobuf/Cargo.bazel.lock +++ b/third_party/protobuf/Cargo.bazel.lock @@ -1,5 +1,5 @@ { - "checksum": "ca8913cc78d0ec771c537fae8d8e7b4505ab91bd61ddc886cc66dbeb264ff626", + "checksum": "422d164988d36886ae9aef8b60e233d67aac121356b66f1452c469f912cc0148", "crates": { "aho-corasick 1.1.2": { "name": "aho-corasick", @@ -17,7 +17,7 @@ "crate_name": "aho_corasick", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -73,7 +73,7 @@ "crate_name": "autocfg", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -107,7 +107,7 @@ "crate_name": "direct_cargo_bazel_deps", "crate_root": ".direct_cargo_bazel_deps.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -164,7 +164,7 @@ "crate_name": "googletest", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -231,7 +231,7 @@ "crate_name": "googletest_macro", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -282,7 +282,7 @@ "crate_name": "memchr", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -329,7 +329,7 @@ "crate_name": "num_traits", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -341,7 +341,7 @@ "crate_name": "build_script_build", "crate_root": "build.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -374,6 +374,9 @@ "version": "0.2.17" }, "build_script_attrs": { + "compile_data_glob": [ + "**" + ], "data_glob": [ "**" ], @@ -410,7 +413,7 @@ "crate_name": "paste", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -422,7 +425,7 @@ "crate_name": "build_script_build", "crate_root": "build.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -448,6 +451,9 @@ "version": "1.0.14" }, "build_script_attrs": { + "compile_data_glob": [ + "**" + ], "data_glob": [ "**" ] @@ -475,7 +481,7 @@ "crate_name": "proc_macro2", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -487,7 +493,7 @@ "crate_name": "build_script_build", "crate_root": "build.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -523,6 +529,9 @@ "version": "1.0.69" }, "build_script_attrs": { + "compile_data_glob": [ + "**" + ], "data_glob": [ "**" ] @@ -550,7 +559,7 @@ "crate_name": "quote", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -605,7 +614,7 @@ "crate_name": "regex", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -687,7 +696,7 @@ "crate_name": "regex_automata", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -770,7 +779,7 @@ "crate_name": "regex_syntax", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -824,7 +833,7 @@ "crate_name": "rustversion", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -836,7 +845,7 @@ "crate_name": "build_script_build", "crate_root": "build/build.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -862,6 +871,9 @@ "version": "1.0.14" }, "build_script_attrs": { + "compile_data_glob": [ + "**" + ], "data_glob": [ "**" ] @@ -889,7 +901,7 @@ "crate_name": "syn", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -958,7 +970,7 @@ "crate_name": "unicode_ident", "crate_root": "src/lib.rs", "srcs": { - "allow_empty": false, + "allow_empty": true, "include": [ "**/*.rs" ] @@ -997,15 +1009,15 @@ "aarch64-apple-ios-sim": [ "aarch64-apple-ios-sim" ], - "aarch64-fuchsia": [ - "aarch64-fuchsia" - ], "aarch64-linux-android": [ "aarch64-linux-android" ], "aarch64-pc-windows-msvc": [ "aarch64-pc-windows-msvc" ], + "aarch64-unknown-fuchsia": [ + "aarch64-unknown-fuchsia" + ], "aarch64-unknown-linux-gnu": [ "aarch64-unknown-linux-gnu" ], @@ -1063,15 +1075,15 @@ "wasm32-wasi": [ "wasm32-wasi" ], + "wasm32-wasip1": [ + "wasm32-wasip1" + ], "x86_64-apple-darwin": [ "x86_64-apple-darwin" ], "x86_64-apple-ios": [ "x86_64-apple-ios" ], - "x86_64-fuchsia": [ - "x86_64-fuchsia" - ], "x86_64-linux-android": [ "x86_64-linux-android" ], @@ -1081,6 +1093,9 @@ "x86_64-unknown-freebsd": [ "x86_64-unknown-freebsd" ], + "x86_64-unknown-fuchsia": [ + "x86_64-unknown-fuchsia" + ], "x86_64-unknown-linux-gnu": [ "x86_64-unknown-linux-gnu" ], diff --git a/third_party/protobuf/DIR_METADATA b/third_party/protobuf/DIR_METADATA deleted file mode 100644 index 744e51f4bb764..0000000000000 --- a/third_party/protobuf/DIR_METADATA +++ /dev/null @@ -1,6 +0,0 @@ -monorail: { - component: "Internals>Core" -} -buganizer_public: { - component_id: 1456128 -} diff --git a/third_party/protobuf/MODULE.bazel b/third_party/protobuf/MODULE.bazel index cbe66f8266a64..d90bd39463d2f 100644 --- a/third_party/protobuf/MODULE.bazel +++ b/third_party/protobuf/MODULE.bazel @@ -3,7 +3,7 @@ module( name = "protobuf", - version = "29.3", # Automatically updated on release + version = "30.1", # Automatically updated on release compatibility_level = 1, repo_name = "com_google_protobuf", ) @@ -12,98 +12,55 @@ module( # Bzlmod follows MVS: # https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution # Thus the highest version in their module graph is resolved. -bazel_dep( - name = "abseil-cpp", - version = "20230802.0.bcr.1", - repo_name = "com_google_absl", -) -bazel_dep( - name = "bazel_skylib", - version = "1.7.0", -) +# These dependencies must be declared before the other rules dependencies. +bazel_dep(name = "rules_apple", version = "3.13.0", repo_name = "build_bazel_rules_apple") +bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support") -bazel_dep( - name = "jsoncpp", - version = "1.9.5", -) +#ifndef PROTO2_OPENSOURCE +# LINT.IfChange +#endif // PROTO2_OPENSOURCE +# protoc dependencies +bazel_dep(name = "abseil-cpp", version = "20250127.0") +bazel_dep(name = "rules_cc", version = "0.0.17") +bazel_dep(name = "zlib", version = "1.3.1.bcr.5") +#ifndef PROTO2_OPENSOURCE +# LINT.ThenChange(//depot/google3/third_party/protobuf/compiler/notices.h) +#endif // PROTO2_OPENSOURCE -bazel_dep( - name = "rules_cc", - version = "0.0.16", -) - -bazel_dep( - name = "rules_fuzzing", - version = "0.5.2", -) - -bazel_dep( - name = "rules_java", - version = "7.12.2", -) - -bazel_dep( - name = "rules_jvm_external", - version = "6.3", -) - -bazel_dep( - name = "rules_kotlin", - version = "1.9.6", -) - -bazel_dep( - name = "rules_license", - version = "1.0.0", -) - -bazel_dep( - name = "rules_pkg", - version = "1.0.1", -) - -bazel_dep( - name = "rules_python", - version = "0.28.0", -) - -bazel_dep( - name = "platforms", - version = "0.0.8", -) - -bazel_dep( - name = "zlib", - version = "1.3.1", -) - -bazel_dep( - name = "bazel_features", - version = "1.17.0", - repo_name = "proto_bazel_features", -) - -bazel_dep( - name = "rules_shell", - version = "0.2.0" -) +# other dependencies +bazel_dep(name = "bazel_features", version = "1.23.0", repo_name = "proto_bazel_features") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "jsoncpp", version = "1.9.6") +bazel_dep(name = "rules_fuzzing", version = "0.5.2") +bazel_dep(name = "rules_java", version = "8.6.1") +bazel_dep(name = "rules_jvm_external", version = "6.3") +bazel_dep(name = "rules_kotlin", version = "1.9.6") +bazel_dep(name = "rules_license", version = "1.0.0") +bazel_dep(name = "rules_pkg", version = "1.0.1") +bazel_dep(name = "rules_python", version = "1.0.0") +bazel_dep(name = "rules_rust", version = "0.51.0") +bazel_dep(name = "rules_shell", version = "0.2.0") +bazel_dep(name = "platforms", version = "0.0.10") # Proto toolchains register_toolchains("//bazel/private/toolchains:all") SUPPORTED_PYTHON_VERSIONS = [ - "3.8", "3.9", "3.10", "3.11", "3.12", ] +# TODO: Support hermetic / system python in bzlmod. python = use_extension("@rules_python//python/extensions:python.bzl", "python") [ python.toolchain( + # Disable root warning for .pyc cache misses since CI runs as root. + # See https://github.com/bazelbuild/rules_python/pull/713 + ignore_root_user_error = True, is_default = python_version == SUPPORTED_PYTHON_VERSIONS[-1], python_version = python_version, ) @@ -115,31 +72,26 @@ use_repo( system_python = "python_{}".format(SUPPORTED_PYTHON_VERSIONS[-1].replace(".", "_")), ) -pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) [ pip.parse( - hub_name = "pip_deps", + hub_name = "protobuf_pip_deps", python_version = python_version, requirements_lock = "//python:requirements.txt", ) for python_version in SUPPORTED_PYTHON_VERSIONS ] -use_repo(pip, "pip_deps") +use_repo(pip, "protobuf_pip_deps") -maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") - -maven.install( +protobuf_maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True) +protobuf_maven.install( name = "protobuf_maven", artifacts = [ "com.google.caliper:caliper:1.0-beta-3", - "com.google.code.findbugs:jsr305:3.0.2", - "com.google.code.gson:gson:2.8.9", - "com.google.errorprone:error_prone_annotations:2.5.1", - "com.google.j2objc:j2objc-annotations:2.8", - "com.google.guava:guava:32.0.1-jre", "com.google.guava:guava-testlib:32.0.1-jre", + "com.google.testparameterinjector:test-parameter-injector:1.18", "com.google.truth:truth:1.1.2", "junit:junit:4.13.2", "org.mockito:mockito-core:4.3.1", @@ -151,32 +103,39 @@ maven.install( "https://repo.maven.apache.org/maven2", ], ) +use_repo(protobuf_maven, "protobuf_maven") -use_repo(maven, "protobuf_maven") +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +maven.install( + name = "maven", + artifacts = [ + "com.google.code.findbugs:jsr305:3.0.2", + "com.google.code.gson:gson:2.8.9", + "com.google.errorprone:error_prone_annotations:2.5.1", + "com.google.j2objc:j2objc-annotations:2.8", + "com.google.guava:guava:32.0.1-jre", + ], + repositories = [ + "https://repo1.maven.org/maven2", + "https://repo.maven.apache.org/maven2", + ], +) +use_repo(maven, "maven") # Development dependencies +bazel_dep(name = "googletest", version = "1.14.0", dev_dependency = True) +bazel_dep(name = "rules_buf", version = "0.3.0", dev_dependency = True) +bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True) bazel_dep( - name = "googletest", - version = "1.14.0", + name = "abseil-py", + version = "2.1.0", dev_dependency = True, - repo_name = "com_google_googletest", + repo_name = "com_google_absl_py", ) -bazel_dep( - name = "rules_buf", - version = "0.3.0", - dev_dependency = True, -) - -bazel_dep( - name = "rules_testing", - version = "0.6.0", - dev_dependency = True, -) +# For clang-cl configuration +cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension") +use_repo(cc_configure, "local_config_cc") # rules_proto are needed for @com_google_protobuf_v25.0 used in //compatibility/... tests -bazel_dep( - name = "rules_proto", - version = "4.0.0", - dev_dependency = True, -) +bazel_dep(name = "rules_proto", version = "4.0.0", dev_dependency = True) diff --git a/third_party/protobuf/OWNERS b/third_party/protobuf/OWNERS deleted file mode 100644 index 58e6ae0f7a68b..0000000000000 --- a/third_party/protobuf/OWNERS +++ /dev/null @@ -1,5 +0,0 @@ -holte@chromium.org -sophiechang@chromium.org -wittman@chromium.org - -evanstade@microsoft.com #{LAST_RESORT_SUGGESTION} diff --git a/third_party/protobuf/Protobuf-C++.podspec b/third_party/protobuf/Protobuf-C++.podspec deleted file mode 100644 index 3baf07bf4c837..0000000000000 --- a/third_party/protobuf/Protobuf-C++.podspec +++ /dev/null @@ -1,48 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'Protobuf-C++' - s.version = '5.29.3' - s.summary = 'Protocol Buffers v3 runtime library for C++.' - s.homepage = 'https://github.com/google/protobuf' - s.license = 'BSD-3-Clause' - s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } - - # Ensure developers won't hit CocoaPods/CocoaPods#11402 with the resource - # bundle for the privacy manifest. - s.cocoapods_version = '>= 1.12.0' - - s.source = { :git => 'https://github.com/google/protobuf.git', - :tag => "v#{s.version}" } - - s.source_files = 'src/google/protobuf/*.{h,cc,inc}', - 'src/google/protobuf/stubs/*.{h,cc}', - 'src/google/protobuf/io/*.{h,cc}', - 'src/google/protobuf/util/*.{h,cc}' - - # Excluding all the tests in the directories above - s.exclude_files = 'src/google/**/*_test.{h,cc,inc}', - 'src/google/**/*_unittest.{h,cc}', - 'src/google/protobuf/test_util*.{h,cc}', - 'src/google/protobuf/map_lite_test_util.{h,cc}', - 'src/google/protobuf/map_test_util*.{h,cc,inc}', - 'src/google/protobuf/reflection_tester.{h,cc}' - - s.resource_bundle = { - "Protobuf-C++_Privacy" => "PrivacyInfo.xcprivacy" - } - - s.header_mappings_dir = 'src' - - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.13' - s.tvos.deployment_target = '12.0' - s.watchos.deployment_target = '6.0' - s.visionos.deployment_target = '1.0' - - s.pod_target_xcconfig = { - # Do not let src/google/protobuf/stubs/time.h override system API - 'USE_HEADERMAP' => 'NO', - 'ALWAYS_SEARCH_USER_PATHS' => 'NO', - 'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/src"' - } - -end diff --git a/third_party/protobuf/Protobuf.podspec b/third_party/protobuf/Protobuf.podspec index 306794e140748..14e66e94b4c49 100644 --- a/third_party/protobuf/Protobuf.podspec +++ b/third_party/protobuf/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.29.3' + s.version = '4.30.1' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = 'BSD-3-Clause' @@ -18,17 +18,7 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/protocolbuffers/protobuf.git', :tag => "v#{s.version}" } - s.source_files = 'objectivec/*.{h,m,swift}', - 'objectivec/google/protobuf/Any.pbobjc.h', - 'objectivec/google/protobuf/Api.pbobjc.h', - 'objectivec/google/protobuf/Duration.pbobjc.h', - 'objectivec/google/protobuf/Empty.pbobjc.h', - 'objectivec/google/protobuf/FieldMask.pbobjc.h', - 'objectivec/google/protobuf/SourceContext.pbobjc.h', - 'objectivec/google/protobuf/Struct.pbobjc.h', - 'objectivec/google/protobuf/Timestamp.pbobjc.h', - 'objectivec/google/protobuf/Type.pbobjc.h', - 'objectivec/google/protobuf/Wrappers.pbobjc.h' + s.source_files = 'objectivec/*.{h,m,swift}' # The following would cause duplicate symbol definitions. GPBProtocolBuffers is expected to be # left out, as it's an umbrella implementation file. s.exclude_files = 'objectivec/GPBProtocolBuffers.m' @@ -44,8 +34,10 @@ Pod::Spec.new do |s| s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' } s.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' } - s.ios.deployment_target = '10.0' - s.osx.deployment_target = '10.13' + s.ios.deployment_target = '15.0' + s.osx.deployment_target = '11.0' + # The following are best-effort / community supported, and are not covered by + # our official support policies: https://protobuf.dev/support/version-support/ s.tvos.deployment_target = '12.0' s.watchos.deployment_target = '6.0' s.visionos.deployment_target = '1.0' diff --git a/third_party/protobuf/README.chromium b/third_party/protobuf/README.chromium index 3d0d88d353fa0..b3e505e81ecd7 100644 --- a/third_party/protobuf/README.chromium +++ b/third_party/protobuf/README.chromium @@ -3,9 +3,9 @@ Short Name: protobuf URL: https://github.com/google/protobuf License: BSD-3-Clause License File: LICENSE -Version: 29.3 -CPEPrefix: cpe:/a:google:protobuf:29.3 -Revision: b407e8416e3893036aee5af9a12bd9b6a0e2b2e6 +Version: 30.1 +CPEPrefix: cpe:/a:google:protobuf:30.1 +Revision: 0d815c5b74281f081c1ee4b431a4d5bbb1615c97 Security Critical: yes Shipped: yes @@ -203,11 +203,6 @@ Description of the patches: Replaces usage of absl internal string routines with std::string::resize(). -- 0046-absl-log.patch - - Remove unused includes of absl/log.h (usages have already been updated to - absl_log.h i.e. ABSL_LOG). Note this is already fixed on trunk protobuf. - - 0047-perfetto-backcompat.patch Undoes protobuf breaking change to support Perfetto's use of @@ -246,7 +241,3 @@ Description of the patches: Add the compatability dir to .gitignore as it's unnecessary and contains files that trip CheckForTooLargeFiles presubmit. -- 0054-remove-usage-if-absl-internal-if_constexpr.patch - - Remove usage of absl internal if_constexpr. This has been upstreamed in - 02/19/2025, so this patch can be removed on the roll in v31. diff --git a/third_party/protobuf/README.md b/third_party/protobuf/README.md index e54108f62eac2..6b3b48c4d9c98 100644 --- a/third_party/protobuf/README.md +++ b/third_party/protobuf/README.md @@ -33,6 +33,57 @@ of your project, you should pin to a release commit on a release branch. This is because even release branches can experience some instability in between release commits. +### Bazel with Bzlmod + +Protobuf supports +[Bzlmod](https://bazel.build/external/module) with Bazel 7 +. +Users should specify a dependency on protobuf in their MODULE.bazel file as +follows. + +``` +bazel_dep(name = "protobuf", version = <VERSION>) +``` + +Users can optionally override the repo name, such as for compatibility with +WORKSPACE. + +``` +bazel_dep(name = "protobuf", version = <VERSION>, repo_name = "com_google_protobuf") +``` + +### Bazel with WORKSPACE + +Users can also add the following to their legacy +[WORKSPACE](https://bazel.build/external/overview#workspace-system) file. + +Note that with the release of 30.x there are a few more load statements to +properly set up rules_java and rules_python. + +``` +http_archive( + name = "com_google_protobuf", + strip_prefix = "protobuf-VERSION", + sha256 = ..., + url = ..., +) + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies") + +rules_java_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_toolchains") + +rules_java_toolchains() + +load("@rules_python//python:repositories.bzl", "py_repositories") + +py_repositories() +``` + Protobuf Compiler Installation ------------------------------ diff --git a/third_party/protobuf/WORKSPACE b/third_party/protobuf/WORKSPACE index 1652c799fdf5a..e89c81cbba6c0 100644 --- a/third_party/protobuf/WORKSPACE +++ b/third_party/protobuf/WORKSPACE @@ -3,48 +3,54 @@ workspace(name = "com_google_protobuf") # An explicit self-reference to work around changes in Bazel 7.0 # See https://github.com/bazelbuild/bazel/issues/19973#issuecomment-1787814450 # buildifier: disable=duplicated-name -local_repository(name = "com_google_protobuf", path = ".") +local_repository( + name = "com_google_protobuf", + path = ".", +) load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -local_repository( - name = "com_google_protobuf_examples", - path = "examples", -) - # Load common dependencies first to ensure we use the correct version load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps") protobuf_deps() +load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies") + +rules_java_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_toolchains") + +rules_java_toolchains() + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() -load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies") - -pip_install_dependencies() - # Bazel platform rules. http_archive( name = "platforms", + sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz", - "https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", + "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", ], - sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51", ) http_archive( - name = "com_google_googletest", + name = "googletest", sha256 = "7315acb6bf10e99f332c8a43f00d5fbb1ee6ca48c52f6b936991b216c586aaad", strip_prefix = "googletest-1.15.0", urls = [ - "https://github.com/google/googletest/releases/download/v1.15.0/googletest-1.15.0.tar.gz" # 2024-07-15 + "https://github.com/google/googletest/releases/download/v1.15.0/googletest-1.15.0.tar.gz", # 2024-07-15 ], ) -load("@com_google_googletest//:googletest_deps.bzl", "googletest_deps") +load("@googletest//:googletest_deps.bzl", "googletest_deps") googletest_deps() @@ -59,7 +65,7 @@ rules_jvm_external_setup() load("@rules_jvm_external//:defs.bzl", "maven_install") maven_install( - name = "protobuf_maven", + name = "maven", artifacts = PROTOBUF_MAVEN_ARTIFACTS, # For updating instructions, see: # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson @@ -70,10 +76,34 @@ maven_install( ], ) -load("@protobuf_maven//:defs.bzl", "pinned_maven_install") - +load("@maven//:defs.bzl", "pinned_maven_install") pinned_maven_install() +maven_install( + name = "protobuf_maven", + artifacts = [ + "com.google.caliper:caliper:1.0-beta-3", + "com.google.guava:guava-testlib:32.0.1-jre", + "com.google.testparameterinjector:test-parameter-injector:1.18", + "com.google.truth:truth:1.1.2", + "junit:junit:4.13.2", + "org.mockito:mockito-core:4.3.1", + "biz.aQute.bnd:biz.aQute.bndlib:6.4.0", + "info.picocli:picocli:4.6.3", + ], + # For updating instructions, see: + # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson + maven_install_json = "//:maven_dev_install.json", + repositories = [ + "https://repo1.maven.org/maven2", + "https://repo.maven.apache.org/maven2", + ], +) + +load("@protobuf_maven//:defs.bzl", pinned_protobuf_maven_install = "pinned_maven_install") +pinned_protobuf_maven_install() + + # For `cc_proto_blacklist_test` and `build_test`. load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") @@ -91,16 +121,12 @@ load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependen apple_support_dependencies() -load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") - -rules_java_dependencies() - -rules_java_toolchains() - -load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") rules_cc_dependencies() +rules_cc_toolchains() + # For `kt_jvm_library` load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") @@ -112,11 +138,11 @@ kt_register_toolchains() http_archive( name = "rules_ruby", + integrity = "sha256-Lh/xxR6WsKJnS92sYkpJDBtdS6DNrCbi0kuUxBffG6E=", + strip_prefix = "rules_ruby-588d9dd40487277e2560ece09fe310d7c0ecb4a6", urls = [ - "https://github.com/protocolbuffers/rules_ruby/archive/b7f3e9756f3c45527be27bc38840d5a1ba690436.zip" + "https://github.com/protocolbuffers/rules_ruby/archive/588d9dd40487277e2560ece09fe310d7c0ecb4a6.zip", ], - strip_prefix = "rules_ruby-b7f3e9756f3c45527be27bc38840d5a1ba690436", - sha256 = "347927fd8de6132099fcdc58e8f7eab7bde4eb2fd424546b9cd4f1c6f8f8bad8", ) load("@rules_ruby//ruby:defs.bzl", "ruby_runtime") @@ -141,6 +167,7 @@ load("@system_ruby//:bundle.bzl", "ruby_bundle") ruby_bundle( name = "protobuf_bundle", srcs = ["//ruby:google-protobuf.gemspec"], + bundler_version = "2.4.22", gemfile = "//ruby:Gemfile", ) @@ -157,38 +184,47 @@ http_archive( http_archive( name = "com_github_google_benchmark", - urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"], - strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47", sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0", + strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47", + urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"], ) http_archive( name = "com_google_googleapis", - urls = ["https://github.com/googleapis/googleapis/archive/d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57.zip"], - strip_prefix = "googleapis-d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57", - sha256 = "d986023c3d8d2e1b161e9361366669cac9fb97c2a07e656c2548aca389248bb4", build_file = "//benchmarks:BUILD.googleapis", patch_cmds = ["find google -type f -name BUILD.bazel -delete"], + sha256 = "d986023c3d8d2e1b161e9361366669cac9fb97c2a07e656c2548aca389248bb4", + strip_prefix = "googleapis-d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57", + urls = ["https://github.com/googleapis/googleapis/archive/d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57.zip"], ) load("@system_python//:pip.bzl", "pip_parse") pip_parse( - name = "pip_deps", + name = "protobuf_pip_deps", requirements = "//python:requirements.txt", ) -load("@pip_deps//:requirements.bzl", "install_deps") +load("@protobuf_pip_deps//:requirements.bzl", "install_deps") install_deps() +http_archive( + name = "com_google_absl_py", + sha256 = "8a3d0830e4eb4f66c4fa907c06edf6ce1c719ced811a12e26d9d3162f8471758", + strip_prefix = "abseil-py-2.1.0", + urls = [ + "https://github.com/abseil/abseil-py/archive/refs/tags/v2.1.0.tar.gz", + ], +) + http_archive( name = "rules_fuzzing", + patch_args = ["-p1"], + patches = ["//third_party:rules_fuzzing.patch"], sha256 = "77206c54b71f4dd5335123a6ff2a8ea688eca5378d34b4838114dff71652cf26", strip_prefix = "rules_fuzzing-0.5.1", urls = ["https://github.com/bazelbuild/rules_fuzzing/releases/download/v0.5.1/rules_fuzzing-0.5.1.zip"], - patches = ["//third_party:rules_fuzzing.patch"], - patch_args = ["-p1"], ) load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies") @@ -205,8 +241,8 @@ fuzzing_py_deps_install_deps() http_archive( name = "rules_rust", - integrity = "sha256-F8U7+AC5MvMtPKGdLLnorVM84cDXKfDRgwd7/dq3rUY=", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.46.0/rules_rust-v0.46.0.tar.gz"], + integrity = "sha256-r09Wyq5QqZpov845sUG1Cd1oVIyCBLmKt6HK/JTVuwI=", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.54.1/rules_rust-v0.54.1.tar.gz"], ) load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") @@ -214,7 +250,9 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi rules_rust_dependencies() rust_register_toolchains(edition = "2021") + load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository") + # to repin, invoke `CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index` crates_repository( name = "crate_index", @@ -226,27 +264,28 @@ crates_repository( rev = "b407f3b5774defb8917d714bfb7af485e117d621", ), "paste": crate.spec( - version = ">=1", + version = ">=1", ), }, ) load("@crate_index//:defs.bzl", "crate_repositories") + crate_repositories() # For testing runtime against old gencode from a previous major version. http_archive( name = "com_google_protobuf_v25.0", + integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=", strip_prefix = "protobuf-25.0", url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz", ) # Needed as a dependency of @com_google_protobuf_v25.0 -load("@com_google_protobuf_v25.0//:protobuf_deps.bzl", protobuf_v25_deps="protobuf_deps") +load("@com_google_protobuf_v25.0//:protobuf_deps.bzl", protobuf_v25_deps = "protobuf_deps") + protobuf_v25_deps() -# Needed for testing only -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_testing", sha256 = "02c62574631876a4e3b02a1820cb51167bb9cdcdea2381b2fa9d9b8b11c407c4", diff --git a/third_party/protobuf/WORKSPACE.bzlmod b/third_party/protobuf/WORKSPACE.bzlmod index ce4d37fdd0cd2..dbc35c3deac10 100644 --- a/third_party/protobuf/WORKSPACE.bzlmod +++ b/third_party/protobuf/WORKSPACE.bzlmod @@ -9,10 +9,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_ruby", urls = [ - "https://github.com/protocolbuffers/rules_ruby/archive/b7f3e9756f3c45527be27bc38840d5a1ba690436.zip" + "https://github.com/protocolbuffers/rules_ruby/archive/588d9dd40487277e2560ece09fe310d7c0ecb4a6.zip" ], - strip_prefix = "rules_ruby-b7f3e9756f3c45527be27bc38840d5a1ba690436", - sha256 = "347927fd8de6132099fcdc58e8f7eab7bde4eb2fd424546b9cd4f1c6f8f8bad8", + strip_prefix = "rules_ruby-588d9dd40487277e2560ece09fe310d7c0ecb4a6", + integrity = "sha256-Lh/xxR6WsKJnS92sYkpJDBtdS6DNrCbi0kuUxBffG6E=", ) load("@rules_ruby//ruby:defs.bzl", "ruby_runtime") @@ -21,11 +21,49 @@ ruby_runtime("system_ruby") register_toolchains("@system_ruby//:toolchain") +load("@system_ruby//:bundle.bzl", "ruby_bundle") + +ruby_bundle( + name = "protobuf_bundle", + srcs = ["//ruby:google-protobuf.gemspec"], + bundler_version = "2.4.22", + gemfile = "//ruby:Gemfile", +) + +# For testing UPB. +http_archive( + name = "lua", + build_file = "//python/dist:lua.BUILD", + sha256 = "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b", + strip_prefix = "lua-5.2.4", + urls = [ + "https://mirror.bazel.build/www.lua.org/ftp/lua-5.2.4.tar.gz", + "https://www.lua.org/ftp/lua-5.2.4.tar.gz", + ], +) + +http_archive( + name = "com_github_google_benchmark", + sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0", + strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47", + urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"], +) + +http_archive( + name = "com_google_googleapis", + build_file = "//benchmarks:BUILD.googleapis", + patch_cmds = ["find google -type f -name BUILD.bazel -delete"], + sha256 = "d986023c3d8d2e1b161e9361366669cac9fb97c2a07e656c2548aca389248bb4", + strip_prefix = "googleapis-d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57", + urls = ["https://github.com/googleapis/googleapis/archive/d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57.zip"], +) + # Following are just needed to run conformance tests, not really needed to support them via MODULE.bazel # For testing runtime against old gencode from a previous major version. http_archive( name = "com_google_protobuf_v25.0", + integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=", strip_prefix = "protobuf-25.0", url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz", ) @@ -34,7 +72,6 @@ http_archive( load("@com_google_protobuf_v25.0//:protobuf_deps.bzl", protobuf_v25_deps="protobuf_deps") protobuf_v25_deps() - # Needed for checking breaking changes from the previous release version. load("//:protobuf_version.bzl", "PROTOBUF_PREVIOUS_RELEASE") diff --git a/third_party/protobuf/bazel/common/proto_lang_toolchain_info.bzl b/third_party/protobuf/bazel/common/proto_lang_toolchain_info.bzl index bc083468ad53e..0300a7c726a6c 100644 --- a/third_party/protobuf/bazel/common/proto_lang_toolchain_info.bzl +++ b/third_party/protobuf/bazel/common/proto_lang_toolchain_info.bzl @@ -1,6 +1,6 @@ """ProtoLangToolchainInfo""" -load("//bazel/private:native.bzl", "native_proto_common") # buildifier: disable=bzl-visibility +load("//bazel/private:native.bzl", "native_proto_common") # Use Starlark implementation only if native_proto_common.ProtoLangToolchainInfo doesn't exist ProtoLangToolchainInfo = getattr(native_proto_common, "ProtoLangToolchainInfo", provider( diff --git a/third_party/protobuf/bazel/java_lite_proto_library.bzl b/third_party/protobuf/bazel/java_lite_proto_library.bzl index f3ed40803aa0c..52a2e56471a02 100644 --- a/third_party/protobuf/bazel/java_lite_proto_library.bzl +++ b/third_party/protobuf/bazel/java_lite_proto_library.bzl @@ -13,4 +13,4 @@ def java_lite_proto_library(**kwattrs): if not hasattr(native, "java_lite_proto_library"): _java_lite_proto_library(**kwattrs) else: - native.java_lite_proto_library(**kwattrs) + native.java_lite_proto_library(**kwattrs) # buildifier: disable=native-java-lite-proto diff --git a/third_party/protobuf/bazel/java_proto_library.bzl b/third_party/protobuf/bazel/java_proto_library.bzl index 57af8c48f388a..31746e9808146 100644 --- a/third_party/protobuf/bazel/java_proto_library.bzl +++ b/third_party/protobuf/bazel/java_proto_library.bzl @@ -13,4 +13,4 @@ def java_proto_library(**kwattrs): if not hasattr(native, "java_proto_library"): _java_proto_library(**kwattrs) else: - native.java_proto_library(**kwattrs) + native.java_proto_library(**kwattrs) # buildifier: disable=native-java-proto diff --git a/third_party/protobuf/bazel/private/BUILD b/third_party/protobuf/bazel/private/BUILD index 9c24bb1d22c32..e05addd1b1e47 100644 --- a/third_party/protobuf/bazel/private/BUILD +++ b/third_party/protobuf/bazel/private/BUILD @@ -95,7 +95,9 @@ bzl_library( "java_lite_proto_library.bzl", "java_proto_support.bzl", ], - visibility = ["//bazel:__subpackages__"], + visibility = [ + "//bazel:__subpackages__", + ], deps = [ ":toolchain_helpers_bzl", "//bazel/common:proto_common_bzl", @@ -148,6 +150,14 @@ bzl_library( ], ) +bzl_library( + name = "cc_proto_aspect_bzl", + srcs = ["cc_proto_aspect.bzl"], + deps = [ + ":bazel_cc_proto_library_bzl", + ], +) + bzl_library( name = "toolchain_helpers_bzl", srcs = [ diff --git a/third_party/protobuf/bazel/private/bazel_java_proto_library_rule.bzl b/third_party/protobuf/bazel/private/bazel_java_proto_library_rule.bzl index 3f298c3aad934..7b950c4e1684f 100644 --- a/third_party/protobuf/bazel/private/bazel_java_proto_library_rule.bzl +++ b/third_party/protobuf/bazel/private/bazel_java_proto_library_rule.bzl @@ -154,7 +154,6 @@ rules to generate Java code for. ), # buildifier: disable=attr-license (calling attr.license()) "licenses": attr.license() if hasattr(attr, "license") else attr.string_list(), - "distribs": attr.string_list(), } | toolchains.if_legacy_toolchain({ "_aspect_java_proto_toolchain": attr.label( default = configuration_field(fragment = "proto", name = "proto_toolchain_for_java"), diff --git a/third_party/protobuf/bazel/private/cc_proto_aspect.bzl b/third_party/protobuf/bazel/private/cc_proto_aspect.bzl new file mode 100644 index 0000000000000..a05fbae6c776d --- /dev/null +++ b/third_party/protobuf/bazel/private/cc_proto_aspect.bzl @@ -0,0 +1,7 @@ +"""Exposes cc_proto_aspect to rules_rust""" + +load("@proto_bazel_features//:features.bzl", "bazel_features") +load("//bazel/private:bazel_cc_proto_library.bzl", _cc_proto_aspect = "cc_proto_aspect") # buildifier: disable=bzl-visibility + +# This resolves to Starlark cc_proto_aspect in Bazel 8 or with --incompatible_enable_autoload flag +cc_proto_aspect = getattr(bazel_features.globals, "cc_proto_aspect", None) or _cc_proto_aspect diff --git a/third_party/protobuf/bazel/private/java_lite_proto_library.bzl b/third_party/protobuf/bazel/private/java_lite_proto_library.bzl index d2b3821c5cd30..466253f70517b 100644 --- a/third_party/protobuf/bazel/private/java_lite_proto_library.bzl +++ b/third_party/protobuf/bazel/private/java_lite_proto_library.bzl @@ -95,7 +95,6 @@ def _rule_impl(ctx): Returns: ([JavaInfo, DefaultInfo, OutputGroupInfo, ProguardSpecInfo]) """ - proto_toolchain_info = toolchains.find_toolchain( ctx, "_aspect_proto_toolchain_for_javalite", @@ -109,7 +108,7 @@ def _rule_impl(ctx): if runtime: proguard_provider_specs = runtime[ProguardSpecInfo] else: - proguard_provider_specs = ProguardSpecInfo(specs = depset()) + proguard_provider_specs = ProguardSpecInfo(depset()) java_info = java_info_merge_for_protos([dep[JavaInfo] for dep in ctx.attr.deps], merge_java_outputs = False) @@ -176,3 +175,6 @@ rules to generate Java code for. provides = [JavaInfo], toolchains = toolchains.use_toolchain(_JAVA_LITE_PROTO_TOOLCHAIN), ) + +# public re-export, note that we can't rename the original symbol because that changes the aspect id +java_lite_proto_aspect = _java_lite_proto_aspect diff --git a/third_party/protobuf/bazel/private/proto_bazel_features.bzl b/third_party/protobuf/bazel/private/proto_bazel_features.bzl index f839a10c5fd4c..a295b8a348181 100644 --- a/third_party/protobuf/bazel/private/proto_bazel_features.bzl +++ b/third_party/protobuf/bazel/private/proto_bazel_features.bzl @@ -16,7 +16,8 @@ _PROTO_BAZEL_FEATURES = """bazel_features = struct( ), globals = struct( PackageSpecificationInfo = {PackageSpecificationInfo}, - ProtoInfo = getattr(getattr(native, 'legacy_globals', None), 'ProtoInfo', {ProtoInfo}) + ProtoInfo = getattr(getattr(native, 'legacy_globals', None), 'ProtoInfo', {ProtoInfo}), + cc_proto_aspect = getattr(getattr(native, 'legacy_globals', None), 'cc_proto_aspect', {cc_proto_aspect}), ), ) """ @@ -35,6 +36,7 @@ def _proto_bazel_features_impl(rctx): protobuf_on_allowlist = major_version_int > 7 ProtoInfo = "ProtoInfo" if major_version_int < 8 else "None" + cc_proto_aspect = "cc_proto_aspect" if major_version_int < 8 else "None" rctx.file("BUILD.bazel", """ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") @@ -50,6 +52,7 @@ exports_files(["features.bzl"]) PackageSpecificationInfo = "PackageSpecificationInfo" if PackageSpecificationInfo else "None", protobuf_on_allowlist = repr(protobuf_on_allowlist), ProtoInfo = ProtoInfo, + cc_proto_aspect = cc_proto_aspect, )) proto_bazel_features = repository_rule( diff --git a/third_party/protobuf/bazel/private/toolchains/BUILD.bazel b/third_party/protobuf/bazel/private/toolchains/BUILD.bazel index b21e4627671fe..1449b61d528ec 100644 --- a/third_party/protobuf/bazel/private/toolchains/BUILD.bazel +++ b/third_party/protobuf/bazel/private/toolchains/BUILD.bazel @@ -1,4 +1,3 @@ -load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain") load("//bazel/toolchains:proto_toolchain.bzl", "proto_toolchain") # Keep this file as small as possible and free of any unnecessary loads diff --git a/third_party/protobuf/bazel/private/upb_proto_library_internal/aspect.bzl b/third_party/protobuf/bazel/private/upb_proto_library_internal/aspect.bzl index 579eac5ec7f96..ec307d97851f8 100644 --- a/third_party/protobuf/bazel/private/upb_proto_library_internal/aspect.bzl +++ b/third_party/protobuf/bazel/private/upb_proto_library_internal/aspect.bzl @@ -228,7 +228,7 @@ def upb_proto_aspect_impl( if not getattr(ctx.rule.attr, "srcs", []): # This target doesn't declare any sources, reexport all its deps instead. # This is known as an "alias library": - # https://bazel.build/reference/be/protocol-buffer#proto_library.srcs + # https://bazel.build/versions/6.4.0/reference/be/protocol-buffer#proto_library.srcs files = _merge_generated_srcs([dep[file_provider].srcs for dep in ctx.rule.attr.deps]) wrapped_cc_info = cc_provider( cc_info = cc_common.merge_cc_infos(direct_cc_infos = dep_ccinfos), diff --git a/third_party/protobuf/bazel/private/upb_proto_library_internal/cc_library_func.bzl b/third_party/protobuf/bazel/private/upb_proto_library_internal/cc_library_func.bzl index 3f3692f226737..4753d18413754 100644 --- a/third_party/protobuf/bazel/private/upb_proto_library_internal/cc_library_func.bzl +++ b/third_party/protobuf/bazel/private/upb_proto_library_internal/cc_library_func.bzl @@ -5,7 +5,7 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_c def upb_use_cpp_toolchain(): return use_cpp_toolchain() -def cc_library_func(ctx, name, hdrs, srcs, copts, includes, dep_ccinfos): +def cc_library_func(ctx, name, hdrs, srcs, copts, dep_ccinfos, includes = []): """Like cc_library(), but callable from rules. Args: @@ -14,8 +14,8 @@ def cc_library_func(ctx, name, hdrs, srcs, copts, includes, dep_ccinfos): hdrs: Public headers that can be #included from other rules. srcs: C/C++ source files. copts: Additional options for cc compilation. - includes: Additional include paths. dep_ccinfos: CcInfo providers of dependencies we should build/link against. + includes: Additional include paths. Returns: CcInfo provider for this compilation. diff --git a/third_party/protobuf/bazel/proto_library.bzl b/third_party/protobuf/bazel/proto_library.bzl index 336623067d4e6..339fe16f14671 100644 --- a/third_party/protobuf/bazel/proto_library.bzl +++ b/third_party/protobuf/bazel/proto_library.bzl @@ -17,4 +17,4 @@ def proto_library(**kwattrs): _proto_library(**kwattrs) else: # On older Bazel versions keep using native rules, so that mismatch in ProtoInfo doesn't happen - native.proto_library(**kwattrs) + native.proto_library(**kwattrs) # buildifier: disable=native-proto diff --git a/third_party/protobuf/bazel/py_proto_library.bzl b/third_party/protobuf/bazel/py_proto_library.bzl index 1c40598422282..f84bf1b3d0fd1 100644 --- a/third_party/protobuf/bazel/py_proto_library.bzl +++ b/third_party/protobuf/bazel/py_proto_library.bzl @@ -44,8 +44,9 @@ def _py_proto_aspect_impl(target, ctx): # Check Proto file names for proto in target[ProtoInfo].direct_sources: - if proto.is_source and "-" in proto.dirname: - fail("Cannot generate Python code for a .proto whose path contains '-' ({}).".format( + import_path = proto_common.get_import_path(proto) + if proto.is_source and "-" in import_path: + fail("Cannot generate Python code for a .proto whose python import path contains '-' ({}).".format( proto.path, )) @@ -76,7 +77,12 @@ def _py_proto_aspect_impl(target, ctx): proto_root = proto_root[len(ctx.bin_dir.path) + 1:] plugin_output = ctx.bin_dir.path + "/" + proto_root - proto_root = ctx.workspace_name + "/" + proto_root + + # Import path within the runfiles tree + if proto_root.startswith("external/"): + proto_root = proto_root[len("external") + 1:] + else: + proto_root = ctx.workspace_name + "/" + proto_root proto_common.compile( actions = ctx.actions, diff --git a/third_party/protobuf/bazel/system_python.bzl b/third_party/protobuf/bazel/system_python.bzl deleted file mode 100644 index 5126b9bce0f46..0000000000000 --- a/third_party/protobuf/bazel/system_python.bzl +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2009-2021, Google LLC -# All rights reserved. -# -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file or at -# https://developers.google.com/open-source/licenses/bsd - -"""Temporary alias to repository rule for using Python 3.x headers from the system.""" - -load( - "//python/dist:system_python.bzl", - _system_python = "system_python", -) - -# TODO: Temporary alias. This is deprecated and to be removed in a future -# release. Users should now get system_python from protobuf_deps.bzl. -system_python = _system_python diff --git a/third_party/protobuf/bazel/tests/proto_common_compile_tests.bzl b/third_party/protobuf/bazel/tests/proto_common_compile_tests.bzl index f0d0110f1b1bc..93a29538816f0 100644 --- a/third_party/protobuf/bazel/tests/proto_common_compile_tests.bzl +++ b/third_party/protobuf/bazel/tests/proto_common_compile_tests.bzl @@ -58,7 +58,7 @@ def _test_compile_basic_impl(env, target): action.argv().contains_exactly_predicates( [ matching.str_endswith(protocol_compiler), - matching.str_matches("--plugin=b*-out/*-exec-*/bin/*/testdata/plugin"), + matching.str_matches("--plugin=b*-out/*-exec*/bin/*/testdata/plugin"), matching.equals_wrapper("-I."), matching.str_endswith("/A.proto"), ], @@ -111,7 +111,7 @@ def _test_compile_with_plugin_output_impl(env, target): [ matching.str_endswith(protocol_compiler), matching.str_matches("--java_out=param1,param2:b*-out/*/test_compile_with_plugin_output_compile"), - matching.str_matches("--plugin=b*-out/*-exec-*/bin/*/testdata/plugin"), + matching.str_matches("--plugin=b*-out/*-exec*/bin/*/testdata/plugin"), matching.equals_wrapper("-I."), matching.str_endswith("/A.proto"), ], @@ -138,7 +138,7 @@ def _test_compile_with_directory_plugin_output_impl(env, target): [ matching.str_endswith(protocol_compiler), matching.str_matches("--java_out=param1,param2:b*-out/*/bin"), - matching.str_matches("--plugin=b*-out/*-exec-*/bin/*/testdata/plugin"), + matching.str_matches("--plugin=b*-out/*-exec*/bin/*/testdata/plugin"), matching.equals_wrapper("-I."), matching.str_endswith("/A.proto"), ], @@ -166,7 +166,7 @@ def _test_compile_additional_args_impl(env, target): matching.str_endswith(protocol_compiler), matching.equals_wrapper("--a"), matching.equals_wrapper("--b"), - matching.str_matches("--plugin=b*-out/*-exec-*/bin/*/testdata/plugin"), + matching.str_matches("--plugin=b*-out/*-exec*/bin/*/testdata/plugin"), matching.equals_wrapper("-I."), matching.str_endswith("/A.proto"), ], @@ -294,7 +294,7 @@ def _test_compile_protoc_opts_impl(env, target): matching.str_endswith(protocol_compiler), matching.equals_wrapper("--foo"), matching.equals_wrapper("--bar"), - matching.str_matches("--plugin=b*-out/*-exec-*/bin/*/testdata/plugin"), + matching.str_matches("--plugin=b*-out/*-exec*/bin/*/testdata/plugin"), matching.equals_wrapper("-I."), matching.str_endswith("/A.proto"), ], @@ -325,7 +325,7 @@ def _test_compile_direct_generated_protos_impl(env, target): action.argv().contains_exactly_predicates( [ matching.str_endswith(protocol_compiler), - matching.str_matches("--plugin=b*-out/*-exec-*/bin/*/testdata/plugin"), + matching.str_matches("--plugin=b*-out/*-exec*/bin/*/testdata/plugin"), matching.str_matches("-Ib*-out/*/*"), matching.equals_wrapper("-I."), matching.str_endswith("/A.proto"), @@ -360,7 +360,7 @@ def _test_compile_indirect_generated_protos_impl(env, target): action.argv().contains_exactly_predicates( [ matching.str_endswith(protocol_compiler), - matching.str_matches("--plugin=b*-out/*-exec-*/bin/*/testdata/plugin"), + matching.str_matches("--plugin=b*-out/*-exec*/bin/*/testdata/plugin"), matching.str_matches("-Ib*-out/*/*"), matching.equals_wrapper("-I."), matching.str_endswith("/A.proto"), diff --git a/third_party/protobuf/bazel/tests/testdata/BUILD b/third_party/protobuf/bazel/tests/testdata/BUILD index a49aa84393c65..47a3a90ac5320 100644 --- a/third_party/protobuf/bazel/tests/testdata/BUILD +++ b/third_party/protobuf/bazel/tests/testdata/BUILD @@ -1,3 +1,4 @@ +load("//bazel:proto_library.bzl", "proto_library") load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain") package( diff --git a/third_party/protobuf/bazel/tests/testdata/compile_rule.bzl b/third_party/protobuf/bazel/tests/testdata/compile_rule.bzl index 8aec0a8209c3f..fe8683815de31 100644 --- a/third_party/protobuf/bazel/tests/testdata/compile_rule.bzl +++ b/third_party/protobuf/bazel/tests/testdata/compile_rule.bzl @@ -8,6 +8,7 @@ """Testing function for proto_common module""" load("//bazel/common:proto_common.bzl", "proto_common") +load("//bazel/common:proto_info.bzl", "ProtoInfo") def _resource_set_callback(_os, inputs_size): return {"memory": 25 + 0.15 * inputs_size, "cpu": 1} diff --git a/third_party/protobuf/bazel/toolchains/proto_lang_toolchain.bzl b/third_party/protobuf/bazel/toolchains/proto_lang_toolchain.bzl index 4c1666530ebbd..7332af86be5e6 100644 --- a/third_party/protobuf/bazel/toolchains/proto_lang_toolchain.bzl +++ b/third_party/protobuf/bazel/toolchains/proto_lang_toolchain.bzl @@ -35,7 +35,7 @@ def proto_lang_toolchain(*, name, toolchain_type = None, exec_compatible_with = _proto_lang_toolchain_rule(name = name, **attrs) else: # On older Bazel versions keep using native rules, so that mismatch in ProtoInfo doesn't happen - native.proto_lang_toolchain(name = name, **attrs) + native.proto_lang_toolchain(name = name, **attrs) # buildifier: disable=native-proto-lang-toolchain if toolchain_type: native.toolchain( diff --git a/third_party/protobuf/benchmarks/BUILD b/third_party/protobuf/benchmarks/BUILD index c92d844f73805..3fbffb5379653 100644 --- a/third_party/protobuf/benchmarks/BUILD +++ b/third_party/protobuf/benchmarks/BUILD @@ -69,18 +69,18 @@ cc_test( ":benchmark_descriptor_sv_cc_proto", ":benchmark_descriptor_upb_proto", ":benchmark_descriptor_upb_proto_reflection", - "//:protobuf", + "//src/google/protobuf", "//src/google/protobuf/json", "//upb:base", "//upb:json", "//upb:mem", "//upb:reflection", "//upb:wire", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", "@com_github_google_benchmark//:benchmark_main", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/benchmarks/build_defs.bzl b/third_party/protobuf/benchmarks/build_defs.bzl index 5f9731d5ff939..e3b41256920d9 100644 --- a/third_party/protobuf/benchmarks/build_defs.bzl +++ b/third_party/protobuf/benchmarks/build_defs.bzl @@ -20,7 +20,7 @@ def tmpl_cc_binary(name, gen, args, replacements = [], **kwargs): ) if _is_google3: - kwargs["malloc"] = "//base:system_malloc" + kwargs["malloc"] = "@bazel_tools//tools/cpp:malloc" kwargs["features"] = ["-static_linking_mode"] native.cc_binary( name = name, diff --git a/third_party/protobuf/benchmarks/descriptor_sv.proto b/third_party/protobuf/benchmarks/descriptor_sv.proto index 434971ecd24e1..539ed744203c1 100644 --- a/third_party/protobuf/benchmarks/descriptor_sv.proto +++ b/third_party/protobuf/benchmarks/descriptor_sv.proto @@ -22,7 +22,6 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; option csharp_namespace = "Google.Protobuf.Reflection"; option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; // The protocol compiler can output a FileDescriptorSet containing the .proto // files it parses. @@ -34,13 +33,16 @@ message FileDescriptorSet { message FileDescriptorProto { optional string name = 1 [ctype = STRING_PIECE]; // file name, relative to root of source tree + optional string package = 2 [ctype = STRING_PIECE]; // e.g. "foo", "foo.bar", etc. // Names of files imported by this file. repeated string dependency = 3 [ctype = STRING_PIECE]; + // Indexes of the public imported files in the dependency list above. repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. // For Google-internal migration only. Do not use. repeated int32 weak_dependency = 11; @@ -50,7 +52,6 @@ message FileDescriptorProto { repeated EnumDescriptorProto enum_type = 5; repeated ServiceDescriptorProto service = 6; repeated FieldDescriptorProto extension = 7; - optional FileOptions options = 8; // This field contains optional information about the original source code. @@ -70,20 +71,17 @@ message DescriptorProto { repeated FieldDescriptorProto field = 2; repeated FieldDescriptorProto extension = 6; - repeated DescriptorProto nested_type = 3; repeated EnumDescriptorProto enum_type = 4; message ExtensionRange { optional int32 start = 1; // Inclusive. optional int32 end = 2; // Exclusive. - optional ExtensionRangeOptions options = 3; } + repeated ExtensionRange extension_range = 5; - repeated OneofDescriptorProto oneof_decl = 8; - optional MessageOptions options = 7; // Range of reserved tag numbers. Reserved tag numbers may not be used by @@ -93,7 +91,9 @@ message DescriptorProto { optional int32 start = 1; // Inclusive. optional int32 end = 2; // Exclusive. } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. // A given name may only be reserved once. repeated string reserved_name = 10 [ctype = STRING_PIECE]; @@ -114,10 +114,12 @@ message FieldDescriptorProto { // Order is weird for historical reasons. TYPE_DOUBLE = 1; TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if // negative values are likely. TYPE_INT64 = 3; TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if // negative values are likely. TYPE_INT32 = 5; @@ -125,6 +127,7 @@ message FieldDescriptorProto { TYPE_FIXED32 = 7; TYPE_BOOL = 8; TYPE_STRING = 9; + // Tag-delimited aggregate. // Group type is deprecated and not supported in proto3. However, Proto3 // implementations should still be able to parse the group wire format and @@ -150,6 +153,7 @@ message FieldDescriptorProto { } optional string name = 1 [ctype = STRING_PIECE]; + optional int32 number = 3; optional Label label = 4; @@ -214,6 +218,7 @@ message FieldDescriptorProto { // Describes a oneof. message OneofDescriptorProto { optional string name = 1 [ctype = STRING_PIECE]; + optional OneofOptions options = 2; } @@ -222,7 +227,6 @@ message EnumDescriptorProto { optional string name = 1 [ctype = STRING_PIECE]; repeated EnumValueDescriptorProto value = 2; - optional EnumOptions options = 3; // Range of reserved numeric values. Reserved values may not be used by @@ -249,16 +253,16 @@ message EnumDescriptorProto { // Describes a value within an enum. message EnumValueDescriptorProto { optional string name = 1 [ctype = STRING_PIECE]; - optional int32 number = 2; + optional int32 number = 2; optional EnumValueOptions options = 3; } // Describes a service. message ServiceDescriptorProto { optional string name = 1 [ctype = STRING_PIECE]; - repeated MethodDescriptorProto method = 2; + repeated MethodDescriptorProto method = 2; optional ServiceOptions options = 3; } @@ -269,12 +273,14 @@ message MethodDescriptorProto { // Input and output type names. These are resolved in the same way as // FieldDescriptorProto.type_name, but must refer to a message type. optional string input_type = 2 [ctype = STRING_PIECE]; + optional string output_type = 3 [ctype = STRING_PIECE]; optional MethodOptions options = 4; // Identifies if client streams multiple client messages optional bool client_streaming = 5 [default = false]; + // Identifies if server streams multiple server messages optional bool server_streaming = 6 [default = false]; } @@ -351,6 +357,7 @@ message FileOptions { CODE_SIZE = 2; // Use ReflectionOps to implement these methods. LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. } + optional OptimizeMode optimize_for = 9 [default = SPEED]; // Sets the Go package where structs generated from this .proto will be @@ -371,8 +378,11 @@ message FileOptions { // these default to false. Old code which depends on generic services should // explicitly set them to true. optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool php_generic_services = 42 [default = false]; // Is this file deprecated? @@ -499,14 +509,14 @@ message FieldOptions { // options below. This option is not yet implemented in the open source // release -- sorry, we'll try to include it in a future version! optional CType ctype = 1 [default = STRING]; + enum CType { // Default mode. STRING = 0; - CORD = 1; - STRING_PIECE = 2; } + // The packed option can be enabled for repeated primitive fields to enable // a more efficient representation on the wire. Rather than repeatedly // writing the tag and type for each element, the entire array is encoded as @@ -526,6 +536,7 @@ message FieldOptions { // This option is an enum to permit additional types to be added, e.g. // goog.math.Integer. optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { // Use the default type. JS_NORMAL = 0; @@ -554,7 +565,6 @@ message FieldOptions { // call from multiple threads concurrently, while non-const methods continue // to require exclusive access. // - // // Note that implementations may choose not to check required fields within // a lazy sub-message. That is, calling IsInitialized() on the outer message // may return true even if the inner message has missing required fields. @@ -666,6 +676,7 @@ message MethodOptions { NO_SIDE_EFFECTS = 1; // implies idempotent IDEMPOTENT = 2; // idempotent, but may have side effects } + optional IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; @@ -690,13 +701,16 @@ message UninterpretedOption { // "foo.(bar.baz).qux". message NamePart { optional string name_part = 1 [ctype = STRING_PIECE]; + optional bool is_extension = 2; } + repeated NamePart name = 2; // The value of the uninterpreted option, in whatever type the tokenizer // identified it as during parsing. Exactly one of these should be set. optional string identifier_value = 3 [ctype = STRING_PIECE]; + optional uint64 positive_int_value = 4; optional int64 negative_int_value = 5; optional double double_value = 6; @@ -754,6 +768,7 @@ message SourceCodeInfo { // ignore those that it doesn't understand, as more types of locations could // be recorded in the future. repeated Location location = 1; + message Location { // Identifies which part of the FileDescriptorProto was defined at this // location. @@ -835,7 +850,9 @@ message SourceCodeInfo { // // // ignored detached comments. optional string leading_comments = 3 [ctype = STRING_PIECE]; + optional string trailing_comments = 4 [ctype = STRING_PIECE]; + repeated string leading_detached_comments = 6 [ctype = STRING_PIECE]; } } @@ -847,6 +864,7 @@ message GeneratedCodeInfo { // An Annotation connects some span of text in generated code to an element // of its generating .proto file. repeated Annotation annotation = 1; + message Annotation { // Identifies the element in the original source .proto file. This field // is formatted the same as SourceCodeInfo.Location.path. diff --git a/third_party/protobuf/build_defs/BUILD.bazel b/third_party/protobuf/build_defs/BUILD.bazel index 8745e1d6188a8..128c5575c39cc 100644 --- a/third_party/protobuf/build_defs/BUILD.bazel +++ b/third_party/protobuf/build_defs/BUILD.bazel @@ -18,12 +18,44 @@ create_compiler_config_setting( value = "msvc-cl", ) -# Caveat: clang-cl support in protobuf is only best-effort / untested for now. create_compiler_config_setting( name = "config_clang_cl", value = "clang-cl", ) +platform( + name = "x64_windows-clang-cl", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:windows", + # This is necessary for Bazel 7 compatibility with a MODULE.bazel file that still works in + # Bazel 8. Using cc_configure_extension from rules_cc produces a @local_config_cc + # repository that's not compatible with @bazel_tools//tools/cpp:clang-cl from before + # Bazel 8. See https://github.com/bazelbuild/rules_cc/issues/330. + "@rules_cc//cc/private/toolchain:clang-cl", + ], +) + +platform( + name = "x64_windows-msvc-cl", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:windows", + # This may be necessary in case cc_configure_extension from rules_cc produces a + # @local_config_cc repository that's not compatible with @bazel_tools//tools/cpp:msvc from + # before Bazel 8, as with clang-cl above, to avoid silently falling back to clang-cl. + # See https://github.com/bazelbuild/rules_cc/issues/330. + "@rules_cc//cc/private/toolchain:msvc", + ], +) + +config_setting( + name = "protobuf_allow_msvc", + values = { + "define": "protobuf_allow_msvc=true", + }, +) + selects.config_setting_group( name = "config_msvc", match_any = [ @@ -32,6 +64,14 @@ selects.config_setting_group( ], ) +platform( + name = "aarch64_linux", + constraint_values = [ + "@platforms//cpu:aarch64", + "@platforms//os:linux", + ], +) + config_setting( name = "aarch64", values = {"cpu": "linux-aarch_64"}, diff --git a/third_party/protobuf/build_defs/cpp_opts.bzl b/third_party/protobuf/build_defs/cpp_opts.bzl index d8646d1681fe6..f46b7dcc0a65c 100644 --- a/third_party/protobuf/build_defs/cpp_opts.bzl +++ b/third_party/protobuf/build_defs/cpp_opts.bzl @@ -17,10 +17,7 @@ COPTS = select({ "/wd4996", # The compiler encountered a deprecated declaration. ], "//conditions:default": [ - "-DHAVE_ZLIB", - "-Woverloaded-virtual", "-Wno-sign-compare", - "-Wno-nonnull", ], }) diff --git a/third_party/protobuf/ci/Linux.bazelrc b/third_party/protobuf/ci/Linux.bazelrc index b4ec98f8c7965..354a7582c31c2 100644 --- a/third_party/protobuf/ci/Linux.bazelrc +++ b/third_party/protobuf/ci/Linux.bazelrc @@ -1,4 +1,7 @@ import common.bazelrc -build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 +build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 +build --cxxopt="-Woverloaded-virtual" +build --copt="-Wpointer-arith" build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" --copt="-Wno-deprecated-declarations" + diff --git a/third_party/protobuf/ci/Windows.bazelrc b/third_party/protobuf/ci/Windows.bazelrc index dd3bb48b101a8..9341c0be10784 100644 --- a/third_party/protobuf/ci/Windows.bazelrc +++ b/third_party/protobuf/ci/Windows.bazelrc @@ -1,5 +1,11 @@ import common.bazelrc # Workaround for maximum path length issues +build --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 startup --output_user_root=C:/tmp --windows_enable_symlinks -common --enable_runfiles \ No newline at end of file +common --enable_runfiles + +build --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl +build:clang-cl --extra_execution_platforms=//build_defs:x64_windows-clang-cl --host_platform=//build_defs:x64_windows-clang-cl +build:msvc-cl --extra_execution_platforms=//build_defs:x64_windows-msvc-cl --host_platform=//build_defs:x64_windows-msvc-cl +build --config=clang-cl diff --git a/third_party/protobuf/ci/common.bazelrc b/third_party/protobuf/ci/common.bazelrc index 04f68fcbfaa50..88caa9394ff7b 100644 --- a/third_party/protobuf/ci/common.bazelrc +++ b/third_party/protobuf/ci/common.bazelrc @@ -5,11 +5,12 @@ build:dbg --compilation_mode=dbg build:opt --compilation_mode=opt -build:san-common --config=dbg --strip=never --copt=-O0 --copt=-fno-omit-frame-pointer +build:san-common --config=dbg --strip=never --copt=-O1 --copt=-fno-omit-frame-pointer +# TODO ASAN hits ODR violations with shared linkage due to +# cc_proto_library cyclic dependency. +build:san-common --dynamic_mode=off build:asan --config=san-common --copt=-fsanitize=address --linkopt=-fsanitize=address -# ASAN hits ODR violations with shared linkage due to rules_proto. -build:asan --dynamic_mode=off build:msan --config=san-common --copt=-fsanitize=memory --linkopt=-fsanitize=memory build:msan --copt=-fsanitize-memory-track-origins @@ -76,10 +77,12 @@ build --incompatible_use_host_features # --incompatible_fail_on_unknown_attributes # --incompatible_merge_fixed_and_default_shell_env -# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel -# https://github.com/protocolbuffers/protobuf/issues/14313 -common --noenable_bzlmod +# For easier debugging of build failures. +common --announce_rc +build --verbose_failures # Important: this flag ensures that we remain compliant with the C++ layering # check. build --features=layering_check + +build --enable_platform_specific_config \ No newline at end of file diff --git a/third_party/protobuf/ci/macOS.bazelrc b/third_party/protobuf/ci/macOS.bazelrc index e426b59f5799b..370a039d74325 100644 --- a/third_party/protobuf/ci/macOS.bazelrc +++ b/third_party/protobuf/ci/macOS.bazelrc @@ -1,6 +1,11 @@ import common.bazelrc -build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 +build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 +build --cxxopt="-Woverloaded-virtual" +build --copt="-Wpointer-arith" build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" --copt="-Wno-deprecated-declarations" -common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 -common --xcode_version_config=@com_google_protobuf//.github:host_xcodes \ No newline at end of file +common --xcode_version_config=@com_google_protobuf//.github:host_xcodes + +build --apple_crosstool_top=@local_config_apple_cc//:toolchain +build --crosstool_top=@local_config_apple_cc//:toolchain +build --host_crosstool_top=@local_config_apple_cc//:toolchain \ No newline at end of file diff --git a/third_party/protobuf/cmake/BUILD.bazel b/third_party/protobuf/cmake/BUILD.bazel new file mode 100644 index 0000000000000..375d7ac43321b --- /dev/null +++ b/third_party/protobuf/cmake/BUILD.bazel @@ -0,0 +1,25 @@ +load("@rules_python//python:defs.bzl", "py_binary") +load("//upb/cmake:build_defs.bzl", "staleness_test") + +py_binary( + name = "dependencies_generator", + srcs = ["dependencies_generator.py"], +) + +genrule( + name = "generate_dependencies", + srcs = ["//:MODULE.bazel"], + outs = ["generated-in/dependencies.cmake"], + cmd = "$(location :dependencies_generator) " + + "$(location //:MODULE.bazel) $@", + tools = [":dependencies_generator"], +) + +staleness_test( + name = "test_dependencies_staleness", + outs = [ + "dependencies.cmake", + ], + generated_pattern = "generated-in/%s", + tags = ["manual"], +) diff --git a/third_party/protobuf/cmake/README.md b/third_party/protobuf/cmake/README.md index 00532ec683798..bbf64364055d4 100644 --- a/third_party/protobuf/cmake/README.md +++ b/third_party/protobuf/cmake/README.md @@ -12,16 +12,18 @@ the same actions can be performed using appropriate GUI tools. ## C++ Version -By default, CMake will use whatever C++ version is the system default. Since -protobuf requires C++14 or newer, sometimes you will need to explicitly override -this. For example, the following: +By default, CMake will use whatever C++ version is the system default. Since +protobuf requires C++17 or newer, sometimes you will need to explicitly override +this. For example, the following: ``` -cmake . -DCMAKE_CXX_STANDARD=14 +cmake . -DCMAKE_CXX_STANDARD=17 cmake --build . ``` -will build protobuf using C++14 (see [CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD){.external} for all available options). +will build protobuf using C++17 (see +[CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD){.external} +for all available options). # Windows Builds @@ -82,13 +84,6 @@ Go to the project folder: C:\Path\to\src> cd protobuf C:\Path\to\src\protobuf> -Remember to update any submodules if you are using git clone (you can skip this -step if you are using a release .tar.gz or .zip package): - -```console -C:\Path\to\src\protobuf> git submodule update --init --recursive -``` - Good. Now you are ready for *CMake* configuration. ## CMake Configuration @@ -117,19 +112,23 @@ Create a temporary *build* folder and change your working directory to it: C:\Path\to\build\protobuf> During configuration you will also be specifying where CMake should expect to -find your Abseil installation. To do so, first set `-Dprotobuf_ABSL_PROVIDER=package` -and then set `-DCMAKE_PREFIX_PATH` to the path where you installed Abseil. +find your Abseil installation. To do so, set `-DCMAKE_PREFIX_PATH` to the path +where you installed Abseil. For example: ```console C:\Path\to\build\protobuf> cmake -S. -Bcmake-out \ -DCMAKE_INSTALL_PREFIX=/tmp/protobuf \ - -DCMAKE_CXX_STANDARD=14 \ - -Dprotobuf_ABSL_PROVIDER=package \ + -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_PREFIX_PATH=/tmp/absl # Path to where I installed Abseil ``` +If the installation of a dependency can't be found, CMake will default to +downloading and building a copy from GitHub. To prevent this and make it an +error condition, you can optionally set +`-Dprotobuf_LOCAL_DEPENDENCIES_ONLY=ON`. + The *Makefile* and *Ninja* generators can build the project in only one configuration, so you need to build a separate folder for each configuration. @@ -156,15 +155,14 @@ It will generate *Visual Studio* solution file *protobuf.sln* in current directo Unit tests are being built along with the rest of protobuf. The unit tests require Google Mock (now a part of Google Test). -A copy of [Google Test](https://github.com/google/googletest) is included as a Git submodule in the `third-party/googletest` folder. -(You do need to initialize the Git submodules as explained above.) +By default, a local copy of [Google Test](https://github.com/google/googletest) +will be downloaded during CMake configuration. Alternately, you may want to use protobuf in a larger set-up, you may want to use that standard CMake approach where you build and install a shared copy of Google Test. -After you've built and installed your Google Test copy, you need add the following definition to your *cmake* command line -during the configuration step: `-Dprotobuf_USE_EXTERNAL_GTEST=ON`. -This will cause the standard CMake `find_package(GTest REQUIRED)` to be used. +After you've built and installed your Google Test copy, the standard CMake +`find_package(GTest)` will use it. [find_package](https://cmake.org/cmake/help/latest/command/find_package.html) will search in a default location, which on Windows is *C:\Program Files*. This is most likely not what you want. You will want instead to search for diff --git a/third_party/protobuf/cmake/abseil-cpp.cmake b/third_party/protobuf/cmake/abseil-cpp.cmake index 1b64affa50caf..29d5044a77b6e 100644 --- a/third_party/protobuf/cmake/abseil-cpp.cmake +++ b/third_party/protobuf/cmake/abseil-cpp.cmake @@ -10,31 +10,36 @@ if(protobuf_BUILD_TESTS) set(ABSL_FIND_GOOGLETEST OFF) endif() -if(TARGET absl::strings) - # If Abseil is included already, skip including it. - # (https://github.com/protocolbuffers/protobuf/issues/10435) -elseif(protobuf_ABSL_PROVIDER STREQUAL "module") - if(NOT ABSL_ROOT_DIR) - set(ABSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp) +if (NOT TARGET absl::strings) + if (NOT protobuf_FORCE_FETCH_DEPENDENCIES) + # Use "CONFIG" as there is no built-in cmake module for absl. + find_package(absl CONFIG) endif() - if(EXISTS "${ABSL_ROOT_DIR}/CMakeLists.txt") - if(protobuf_INSTALL) + + # Fallback to fetching Abseil from github if it's not found locally. + if (NOT absl_FOUND AND NOT protobuf_LOCAL_DEPENDENCIES_ONLY) + include(${protobuf_SOURCE_DIR}/cmake/dependencies.cmake) + message(STATUS "Fallback to downloading Abseil ${abseil-cpp-version} from GitHub") + + include(FetchContent) + FetchContent_Declare( + absl + GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git" + GIT_TAG "${abseil-cpp-version}" + ) + if (protobuf_INSTALL) # When protobuf_INSTALL is enabled and Abseil will be built as a module, # Abseil will be installed along with protobuf for convenience. set(ABSL_ENABLE_INSTALL ON) endif() - add_subdirectory(${ABSL_ROOT_DIR} third_party/abseil-cpp) - else() - message(WARNING "protobuf_ABSL_PROVIDER is \"module\" but ABSL_ROOT_DIR is wrong") + FetchContent_MakeAvailable(absl) endif() - if(protobuf_INSTALL AND NOT _protobuf_INSTALL_SUPPORTED_FROM_MODULE) - message(WARNING "protobuf_INSTALL will be forced to FALSE because protobuf_ABSL_PROVIDER is \"module\" and CMake version (${CMAKE_VERSION}) is less than 3.13.") - set(protobuf_INSTALL FALSE) - endif() -elseif(protobuf_ABSL_PROVIDER STREQUAL "package") - # Use "CONFIG" as there is no built-in cmake module for absl. - find_package(absl REQUIRED CONFIG) endif() + +if (NOT TARGET absl::strings) + message(FATAL_ERROR "Cannot find abseil-cpp dependency that's needed to build protobuf.\n") +endif() + set(_protobuf_FIND_ABSL "if(NOT TARGET absl::strings)\n find_package(absl CONFIG)\nendif()") if (BUILD_SHARED_LIBS AND MSVC) @@ -45,13 +50,8 @@ if (BUILD_SHARED_LIBS AND MSVC) # Once https://github.com/abseil/abseil-cpp/pull/1466 is merged and released # in the minimum version of abseil required by protobuf, it is possible to # always link absl::abseil_dll and absl::abseil_test_dll and remove the if - if(protobuf_ABSL_PROVIDER STREQUAL "package") - set(protobuf_ABSL_USED_TARGETS absl::abseil_dll) - set(protobuf_ABSL_USED_TEST_TARGETS absl::abseil_test_dll) - else() - set(protobuf_ABSL_USED_TARGETS abseil_dll) - set(protobuf_ABSL_USED_TEST_TARGETS abseil_test_dll) - endif() + set(protobuf_ABSL_USED_TARGETS absl::abseil_dll) + set(protobuf_ABSL_USED_TEST_TARGETS absl::abseil_test_dll) else() set(protobuf_ABSL_USED_TARGETS absl::absl_check @@ -72,7 +72,6 @@ else() absl::flat_hash_set absl::function_ref absl::hash - absl::if_constexpr absl::layout absl::log_initialize absl::log_globals diff --git a/third_party/protobuf/cmake/conformance.cmake b/third_party/protobuf/cmake/conformance.cmake index 37fe71559aecf..7377841dd19ad 100644 --- a/third_party/protobuf/cmake/conformance.cmake +++ b/third_party/protobuf/cmake/conformance.cmake @@ -1,15 +1,31 @@ -if (protobuf_JSONCPP_PROVIDER STREQUAL "module") - if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/jsoncpp/CMakeLists.txt") - message(FATAL_ERROR - "Cannot find third_party/jsoncpp directory that's needed to " - "build conformance tests. If you use git, make sure you have cloned " - "submodules:\n" - " git submodule update --init --recursive\n" - "If instead you want to skip them, run cmake with:\n" - " cmake -Dprotobuf_BUILD_CONFORMANCE=OFF\n") +# Don't run jsoncpp tests. +set(JSONCPP_WITH_TESTS OFF) + +if (NOT TARGET jsoncpp_lib) + if (NOT protobuf_FORCE_FETCH_DEPENDENCIES) + find_package(jsoncpp) endif() -elseif(protobuf_JSONCPP_PROVIDER STREQUAL "package") - find_package(jsoncpp REQUIRED) + + # Fallback to fetching Googletest from github if it's not found locally. + if (NOT jsoncpp_FOUND AND NOT protobuf_LOCAL_DEPENDENCIES_ONLY) + include(${protobuf_SOURCE_DIR}/cmake/dependencies.cmake) + message(STATUS "Fallback to downloading jsoncpp ${jsoncpp-version} from GitHub") + + include(FetchContent) + FetchContent_Declare( + jsoncpp + GIT_REPOSITORY "https://github.com/open-source-parsers/jsoncpp.git" + GIT_TAG "${jsoncpp-version}" + ) + FetchContent_MakeAvailable(jsoncpp) + endif() +endif() + +if (NOT TARGET jsoncpp_lib) + message(FATAL_ERROR + "Cannot find jsoncpp dependency that's needed to build conformance tests.\n" + "If instead you want to skip these tests, run cmake with:\n" + " cmake -Dprotobuf_BUILD_CONFORMANCE=OFF\n") endif() file(MAKE_DIRECTORY ${protobuf_BINARY_DIR}/conformance) @@ -129,18 +145,13 @@ add_test(NAME conformance_cpp_test --text_format_failure_list ${protobuf_SOURCE_DIR}/conformance/text_format_failure_list_cpp.txt --output_dir ${protobuf_TEST_XML_OUTDIR} --maximum_edition 2023 - ${CMAKE_CURRENT_BINARY_DIR}/conformance_cpp + $<TARGET_FILE:conformance_cpp> DEPENDS conformance_test_runner conformance_cpp) set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Disable tests") -if(protobuf_JSONCPP_PROVIDER STREQUAL "module") - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp third_party/jsoncpp) - target_include_directories(conformance_test_runner PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp/include) - if(BUILD_SHARED_LIBS) - target_link_libraries(conformance_test_runner jsoncpp_lib) - else() - target_link_libraries(conformance_test_runner jsoncpp_static) - endif() + +if(BUILD_SHARED_LIBS) + target_link_libraries(conformance_test_runner jsoncpp_lib) else() - target_link_libraries(conformance_test_runner jsoncpp) + target_link_libraries(conformance_test_runner jsoncpp_static) endif() diff --git a/third_party/protobuf/cmake/dependencies.cmake b/third_party/protobuf/cmake/dependencies.cmake new file mode 100644 index 0000000000000..6681c7a38d14f --- /dev/null +++ b/third_party/protobuf/cmake/dependencies.cmake @@ -0,0 +1,37 @@ +# Auto-generated by @//cmake:make_dependencies +# +# This file contains lists of external dependencies based on our Bazel +# config. It should be included from a hand-written CMake file that uses +# them. +# +# Changes to this file will be overwritten based on Bazel definitions. + +if(${CMAKE_VERSION} VERSION_GREATER 3.16 OR ${CMAKE_VERSION} VERSION_EQUAL 3.16) + include_guard() +endif() + +set(rules_apple-version "3.13.0") +set(apple_support-version "1.15.1") +set(abseil-cpp-version "20250127.0") +set(rules_cc-version "0.0.17") +set(zlib-version "1.3.1.bcr.5") +set(bazel_features-version "1.23.0") +set(bazel_skylib-version "1.7.1") +set(jsoncpp-version "1.9.6") +set(rules_fuzzing-version "0.5.2") +set(rules_java-version "8.6.1") +set(rules_jvm_external-version "6.3") +set(rules_kotlin-version "1.9.6") +set(rules_license-version "1.0.0") +set(rules_pkg-version "1.0.1") +set(rules_python-version "1.0.0") +set(rules_rust-version "0.51.0") +set(rules_shell-version "0.2.0") +set(platforms-version "0.0.10") +set(googletest-version "1.14.0") +set(rules_buf-version "0.3.0") +set(rules_testing-version "0.6.0") +set(abseil-py-version "2.1.0") +set(rules_proto-version "4.0.0") + + diff --git a/third_party/protobuf/cmake/dependencies_generator.py b/third_party/protobuf/cmake/dependencies_generator.py new file mode 100644 index 0000000000000..4cca0b74ad64d --- /dev/null +++ b/third_party/protobuf/cmake/dependencies_generator.py @@ -0,0 +1,149 @@ +#!/usr/bin/python +# +# Protocol Buffers - Google's data interchange format +# Copyright 2023 Google LLC. 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 LLC 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. + +"""A tool to convert MODULE.bazel -> CMakeLists.txt. + +This tool is very protobuf-specific at the moment, and should not be seen as a +generic Bazel -> CMake converter. +""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import os +import sys +import textwrap + + +class ExtensionFunctions(object): + """A fake extension that we can use to get the functions we need.""" + + def toolchain(self, *args, **kwargs): + pass + + def parse(self, *args, **kwargs): + pass + + def spec(self, *args, **kwargs): + pass + + def from_specs(self, *args, **kwargs): + pass + + def install(self, *args, **kwargs): + pass + + +class ModuleFileFunctions(object): + """A fake MODULE file that we can exec() to get the functions we need.""" + + def __init__(self, converter): + self.converter = converter + + def module(self, *args, **kwargs): + pass + + def bazel_dep(self, name, version, **kwargs): + self.converter.toplevel += textwrap.dedent( + """\ + set(%(name)s-version "%(version)s") + """ + % { + "name": name, + "version": version, + } + ) + + def register_toolchains(self, *args): + pass + + def use_repo(self, *args, **kwargs): + pass + + def use_extension(self, *args, **kwargs): + return ExtensionFunctions() + + def local_path_override(self, *args, **kwargs): + pass + + def git_override(self, *args, **kwargs): + pass + + +class Converter(object): + + def __init__(self): + self.toplevel = "" + self.if_lua = "" + + def convert(self): + return self.template % { + "toplevel": converter.toplevel, + } + + template = textwrap.dedent("""\ + # Auto-generated by @//cmake:make_dependencies + # + # This file contains lists of external dependencies based on our Bazel + # config. It should be included from a hand-written CMake file that uses + # them. + # + # Changes to this file will be overwritten based on Bazel definitions. + + if(${CMAKE_VERSION} VERSION_GREATER 3.16 OR ${CMAKE_VERSION} VERSION_EQUAL 3.16) + include_guard() + endif() + + %(toplevel)s + + """) + + +data = {} +converter = Converter() + + +def GetDict(obj): + ret = {} + for k in dir(obj): + if not k.startswith("_"): + ret[k] = getattr(obj, k) + return ret + + +# We take the MODULE path as a command-line argument to ensure that we can find +# it regardless of how exactly Bazel was invoked. +exec(open(sys.argv[1]).read(), GetDict(ModuleFileFunctions(converter))) + +with open(sys.argv[2], "w") as f: + f.write(converter.convert()) diff --git a/third_party/protobuf/cmake/gtest.cmake b/third_party/protobuf/cmake/gtest.cmake index b891db9fe3c75..9a31734dd2523 100644 --- a/third_party/protobuf/cmake/gtest.cmake +++ b/third_party/protobuf/cmake/gtest.cmake @@ -1,48 +1,28 @@ -option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF) - -if (protobuf_USE_EXTERNAL_GTEST) - find_package(GTest REQUIRED CONFIG) -else() - if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt") - message(FATAL_ERROR - "Cannot find third_party/googletest directory that's needed to " - "build tests. If you use git, make sure you have cloned submodules:\n" - " git submodule update --init --recursive\n" - "If instead you want to skip tests, run cmake with:\n" - " cmake -Dprotobuf_BUILD_TESTS=OFF\n") +if (NOT TARGET GTest::gmock) + if (NOT protobuf_FORCE_FETCH_DEPENDENCIES) + find_package(GTest CONFIG) endif() - set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock") - set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest") - include_directories( - ${googlemock_source_dir} - ${googletest_source_dir} - ${googletest_source_dir}/include - ${googlemock_source_dir}/include - ) + # Fallback to fetching Googletest from github if it's not found locally. + if (NOT GTest_FOUND AND NOT protobuf_LOCAL_DEPENDENCIES_ONLY) + include(${protobuf_SOURCE_DIR}/cmake/dependencies.cmake) + message(STATUS "Fallback to downloading GTest ${googletest-version} from GitHub") - add_library(gmock ${protobuf_SHARED_OR_STATIC} - "${googlemock_source_dir}/src/gmock-all.cc" - "${googletest_source_dir}/src/gtest-all.cc" - ) - if (protobuf_BUILD_SHARED_LIBS) - set_target_properties(gmock - PROPERTIES - COMPILE_DEFINITIONS - "GTEST_CREATE_SHARED_LIBRARY=1" + include(FetchContent) + FetchContent_Declare( + googletest + GIT_REPOSITORY "https://github.com/google/googletest.git" + GIT_TAG "v${googletest-version}" ) - + # Due to https://github.com/google/googletest/issues/4384, we can't name this + # GTest for use with find_package until 1.15.0. + FetchContent_MakeAvailable(googletest) endif() - if (protobuf_INSTALL) - set(protobuf_INSTALL_TESTS ON) - endif() - - target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) - add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc") - target_link_libraries(gmock_main gmock) - - add_library(GTest::gmock ALIAS gmock) - add_library(GTest::gmock_main ALIAS gmock_main) - add_library(GTest::gtest ALIAS gmock) - add_library(GTest::gtest_main ALIAS gmock_main) +endif() + +if (NOT TARGET GTest::gmock) + message(FATAL_ERROR + "Cannot find googletest dependency that's needed to build tests.\n" + "If instead you want to skip tests, run cmake with:\n" + " cmake -Dprotobuf_BUILD_TESTS=OFF\n") endif() diff --git a/third_party/protobuf/cmake/install.cmake b/third_party/protobuf/cmake/install.cmake index b383a98c50fe3..076d45f5e3b98 100644 --- a/third_party/protobuf/cmake/install.cmake +++ b/third_party/protobuf/cmake/install.cmake @@ -20,6 +20,10 @@ if (protobuf_BUILD_SHARED_LIBS) set(_protobuf_PC_CFLAGS -DPROTOBUF_USE_DLLS) endif () +if(CMAKE_BUILD_TYPE STREQUAL Debug) + # attach debug postfix only in debug mode + set(protobuf_LIBRARY_POSTFIX ${protobuf_DEBUG_POSTFIX}) +endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake @@ -83,7 +87,7 @@ endif () include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) set(protobuf_HEADERS ${libprotobuf_hdrs} - ${libprotoc_hdrs} + ${libprotoc_public_hdrs} ${wkt_protos_files} ${cpp_features_proto_proto_srcs} ${descriptor_proto_proto_srcs} @@ -116,7 +120,6 @@ foreach(_header ${protobuf_HEADERS}) break() endif() endforeach() - message(${_from_dir} "-" ${_header}) # Escape _from_dir for regex special characters in the directory name. string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" _from_dir_regexp "${_from_dir}") diff --git a/third_party/protobuf/cmake/installed_bin_golden.txt b/third_party/protobuf/cmake/installed_bin_golden.txt new file mode 100644 index 0000000000000..a6e9d58cc66a5 --- /dev/null +++ b/third_party/protobuf/cmake/installed_bin_golden.txt @@ -0,0 +1,4 @@ +protoc +protoc-gen-upb +protoc-gen-upb_minitable +protoc-gen-upbdefs diff --git a/third_party/protobuf/cmake/installed_include_golden.txt b/third_party/protobuf/cmake/installed_include_golden.txt new file mode 100644 index 0000000000000..20ad3219b6006 --- /dev/null +++ b/third_party/protobuf/cmake/installed_include_golden.txt @@ -0,0 +1,221 @@ +google/protobuf/any.h +google/protobuf/any.pb.h +google/protobuf/any.proto +google/protobuf/api.pb.h +google/protobuf/api.proto +google/protobuf/arena.h +google/protobuf/arena_align.h +google/protobuf/arena_allocation_policy.h +google/protobuf/arena_cleanup.h +google/protobuf/arenastring.h +google/protobuf/arenaz_sampler.h +google/protobuf/compiler/code_generator.h +google/protobuf/compiler/code_generator_lite.h +google/protobuf/compiler/command_line_interface.h +google/protobuf/compiler/cpp/helpers.h +google/protobuf/compiler/cpp/names.h +google/protobuf/compiler/cpp/options.h +google/protobuf/compiler/csharp/names.h +google/protobuf/compiler/importer.h +google/protobuf/compiler/java/context.h +google/protobuf/compiler/java/doc_comment.h +google/protobuf/compiler/java/generator.h +google/protobuf/compiler/java/helpers.h +google/protobuf/compiler/java/java_features.pb.h +google/protobuf/compiler/java/name_resolver.h +google/protobuf/compiler/java/names.h +google/protobuf/compiler/java/options.h +google/protobuf/compiler/notices.h +google/protobuf/compiler/objectivec/line_consumer.h +google/protobuf/compiler/objectivec/names.h +google/protobuf/compiler/objectivec/nsobject_methods.h +google/protobuf/compiler/parser.h +google/protobuf/compiler/php/names.h +google/protobuf/compiler/php/php_generator.h +google/protobuf/compiler/plugin.h +google/protobuf/compiler/plugin.pb.h +google/protobuf/compiler/plugin.proto +google/protobuf/compiler/retention.h +google/protobuf/compiler/scc.h +google/protobuf/compiler/subprocess.h +google/protobuf/compiler/versions.h +google/protobuf/compiler/zip_writer.h +google/protobuf/cpp_edition_defaults.h +google/protobuf/cpp_features.pb.h +google/protobuf/cpp_features.proto +google/protobuf/descriptor.h +google/protobuf/descriptor.pb.h +google/protobuf/descriptor.proto +google/protobuf/descriptor.upb.h +google/protobuf/descriptor.upb_minitable.h +google/protobuf/descriptor_database.h +google/protobuf/descriptor_legacy.h +google/protobuf/descriptor_lite.h +google/protobuf/descriptor_visitor.h +google/protobuf/duration.pb.h +google/protobuf/duration.proto +google/protobuf/dynamic_message.h +google/protobuf/empty.pb.h +google/protobuf/empty.proto +google/protobuf/endian.h +google/protobuf/explicitly_constructed.h +google/protobuf/extension_set.h +google/protobuf/extension_set_inl.h +google/protobuf/feature_resolver.h +google/protobuf/field_access_listener.h +google/protobuf/field_mask.pb.h +google/protobuf/field_mask.proto +google/protobuf/generated_enum_reflection.h +google/protobuf/generated_enum_util.h +google/protobuf/generated_message_bases.h +google/protobuf/generated_message_reflection.h +google/protobuf/generated_message_tctable_decl.h +google/protobuf/generated_message_tctable_gen.h +google/protobuf/generated_message_tctable_impl.h +google/protobuf/generated_message_util.h +google/protobuf/go_features.proto +google/protobuf/has_bits.h +google/protobuf/implicit_weak_message.h +google/protobuf/inlined_string_field.h +google/protobuf/io/coded_stream.h +google/protobuf/io/gzip_stream.h +google/protobuf/io/io_win32.h +google/protobuf/io/printer.h +google/protobuf/io/strtod.h +google/protobuf/io/tokenizer.h +google/protobuf/io/zero_copy_sink.h +google/protobuf/io/zero_copy_stream.h +google/protobuf/io/zero_copy_stream_impl.h +google/protobuf/io/zero_copy_stream_impl_lite.h +google/protobuf/java_features.proto +google/protobuf/json/json.h +google/protobuf/map.h +google/protobuf/map_entry.h +google/protobuf/map_field.h +google/protobuf/map_field_inl.h +google/protobuf/map_field_lite.h +google/protobuf/map_type_handler.h +google/protobuf/message.h +google/protobuf/message_lite.h +google/protobuf/metadata.h +google/protobuf/metadata_lite.h +google/protobuf/parse_context.h +google/protobuf/port.h +google/protobuf/port_def.inc +google/protobuf/port_undef.inc +google/protobuf/raw_ptr.h +google/protobuf/reflection.h +google/protobuf/reflection_mode.h +google/protobuf/reflection_ops.h +google/protobuf/reflection_visit_field_info.h +google/protobuf/reflection_visit_fields.h +google/protobuf/repeated_field.h +google/protobuf/repeated_ptr_field.h +google/protobuf/runtime_version.h +google/protobuf/serial_arena.h +google/protobuf/service.h +google/protobuf/source_context.pb.h +google/protobuf/source_context.proto +google/protobuf/string_block.h +google/protobuf/struct.pb.h +google/protobuf/struct.proto +google/protobuf/stubs/callback.h +google/protobuf/stubs/common.h +google/protobuf/stubs/platform_macros.h +google/protobuf/stubs/port.h +google/protobuf/stubs/status_macros.h +google/protobuf/text_format.h +google/protobuf/thread_safe_arena.h +google/protobuf/timestamp.pb.h +google/protobuf/timestamp.proto +google/protobuf/type.pb.h +google/protobuf/type.proto +google/protobuf/unknown_field_set.h +google/protobuf/util/delimited_message_util.h +google/protobuf/util/field_comparator.h +google/protobuf/util/field_mask_util.h +google/protobuf/util/json_util.h +google/protobuf/util/message_differencer.h +google/protobuf/util/time_util.h +google/protobuf/util/type_resolver.h +google/protobuf/util/type_resolver_util.h +google/protobuf/varint_shuffle.h +google/protobuf/wire_format.h +google/protobuf/wire_format_lite.h +google/protobuf/wrappers.pb.h +google/protobuf/wrappers.proto +upb/base/descriptor_constants.h +upb/base/status.h +upb/base/status.hpp +upb/base/string_view.h +upb/base/upcast.h +upb/generated_code_support.h +upb/hash/common.h +upb/hash/int_table.h +upb/hash/str_table.h +upb/json/decode.h +upb/json/encode.h +upb/lex/atoi.h +upb/lex/round_trip.h +upb/lex/strtod.h +upb/lex/unicode.h +upb/mem/alloc.h +upb/mem/arena.h +upb/mem/arena.hpp +upb/message/accessors.h +upb/message/array.h +upb/message/compare.h +upb/message/compat.h +upb/message/copy.h +upb/message/map.h +upb/message/map_gencode_util.h +upb/message/merge.h +upb/message/message.h +upb/message/tagged_ptr.h +upb/message/value.h +upb/mini_descriptor/build_enum.h +upb/mini_descriptor/decode.h +upb/mini_descriptor/link.h +upb/mini_table/enum.h +upb/mini_table/extension.h +upb/mini_table/extension_registry.h +upb/mini_table/field.h +upb/mini_table/file.h +upb/mini_table/message.h +upb/mini_table/sub.h +upb/port/atomic.h +upb/port/def.inc +upb/port/undef.inc +upb/port/vsnprintf_compat.h +upb/reflection/common.h +upb/reflection/def.h +upb/reflection/def.hpp +upb/reflection/def_pool.h +upb/reflection/def_type.h +upb/reflection/descriptor_bootstrap.h +upb/reflection/enum_def.h +upb/reflection/enum_reserved_range.h +upb/reflection/enum_value_def.h +upb/reflection/extension_range.h +upb/reflection/field_def.h +upb/reflection/file_def.h +upb/reflection/message.h +upb/reflection/message.hpp +upb/reflection/message_def.h +upb/reflection/message_reserved_range.h +upb/reflection/method_def.h +upb/reflection/oneof_def.h +upb/reflection/service_def.h +upb/text/debug_string.h +upb/text/encode.h +upb/text/options.h +upb/util/def_to_proto.h +upb/util/required_fields.h +upb/wire/byte_size.h +upb/wire/decode.h +upb/wire/encode.h +upb/wire/eps_copy_input_stream.h +upb/wire/reader.h +upb/wire/types.h +utf8_range.h +utf8_validity.h diff --git a/third_party/protobuf/cmake/installed_lib_shared_golden.txt b/third_party/protobuf/cmake/installed_lib_shared_golden.txt new file mode 100644 index 0000000000000..e394f08f2c037 --- /dev/null +++ b/third_party/protobuf/cmake/installed_lib_shared_golden.txt @@ -0,0 +1,20 @@ +cmake/protobuf/protobuf-config-version.cmake +cmake/protobuf/protobuf-config.cmake +cmake/protobuf/protobuf-generate.cmake +cmake/protobuf/protobuf-module.cmake +cmake/protobuf/protobuf-options.cmake +cmake/protobuf/protobuf-targets-noconfig.cmake +cmake/protobuf/protobuf-targets.cmake +cmake/utf8_range/utf8_range-config.cmake +cmake/utf8_range/utf8_range-targets-noconfig.cmake +cmake/utf8_range/utf8_range-targets.cmake +libprotobuf-lite.so +libprotobuf.so +libprotoc.so +libupb.a +libutf8_range.so +libutf8_validity.so +pkgconfig/protobuf-lite.pc +pkgconfig/protobuf.pc +pkgconfig/upb.pc +pkgconfig/utf8_range.pc diff --git a/third_party/protobuf/cmake/installed_lib_static_golden.txt b/third_party/protobuf/cmake/installed_lib_static_golden.txt new file mode 100644 index 0000000000000..9057a16b3fba4 --- /dev/null +++ b/third_party/protobuf/cmake/installed_lib_static_golden.txt @@ -0,0 +1,20 @@ +cmake/protobuf/protobuf-config-version.cmake +cmake/protobuf/protobuf-config.cmake +cmake/protobuf/protobuf-generate.cmake +cmake/protobuf/protobuf-module.cmake +cmake/protobuf/protobuf-options.cmake +cmake/protobuf/protobuf-targets-noconfig.cmake +cmake/protobuf/protobuf-targets.cmake +cmake/utf8_range/utf8_range-config.cmake +cmake/utf8_range/utf8_range-targets-noconfig.cmake +cmake/utf8_range/utf8_range-targets.cmake +libprotobuf-lite.a +libprotobuf.a +libprotoc.a +libupb.a +libutf8_range.a +libutf8_validity.a +pkgconfig/protobuf-lite.pc +pkgconfig/protobuf.pc +pkgconfig/upb.pc +pkgconfig/utf8_range.pc diff --git a/third_party/protobuf/cmake/protobuf-generate.cmake b/third_party/protobuf/cmake/protobuf-generate.cmake index 244407ee2f061..a1a1a5374d56c 100644 --- a/third_party/protobuf/cmake/protobuf-generate.cmake +++ b/third_party/protobuf/cmake/protobuf-generate.cmake @@ -2,11 +2,11 @@ function(protobuf_generate) include(CMakeParseArguments) set(_options APPEND_PATH) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES PROTOC_EXE) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS PROTOC_EXE) if(COMMAND target_sources) list(APPEND _singleargs TARGET) endif() - set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS) + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS DEPENDENCIES) cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") diff --git a/third_party/protobuf/cmake/protobuf.pc.cmake b/third_party/protobuf/cmake/protobuf.pc.cmake index 81d87c1f7019a..f1407116eb6f4 100644 --- a/third_party/protobuf/cmake/protobuf.pc.cmake +++ b/third_party/protobuf/cmake/protobuf.pc.cmake @@ -7,6 +7,6 @@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @protobuf_VERSION@ Requires: @_protobuf_PC_REQUIRES@ -Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ +Libs: -L${libdir} -lprotobuf@protobuf_LIBRARY_POSTFIX@ @CMAKE_THREAD_LIBS_INIT@ Cflags: -I${includedir} @_protobuf_PC_CFLAGS@ Conflicts: protobuf-lite diff --git a/third_party/protobuf/cmake/tests.cmake b/third_party/protobuf/cmake/tests.cmake index c8ae1140a96df..2aaedb5d9a965 100644 --- a/third_party/protobuf/cmake/tests.cmake +++ b/third_party/protobuf/cmake/tests.cmake @@ -220,19 +220,26 @@ add_custom_target(restore-installed-headers) file(GLOB_RECURSE _local_hdrs "${PROJECT_SOURCE_DIR}/src/*.h" "${PROJECT_SOURCE_DIR}/src/*.inc" +) +file(GLOB_RECURSE _local_upb_hdrs "${PROJECT_SOURCE_DIR}/upb/*.h" ) +# Exclude test library headers. +list(APPEND _exclude_hdrs ${test_util_hdrs} ${lite_test_util_hdrs} ${common_test_hdrs} + ${compiler_test_utils_hdrs} ${upb_test_util_files} ${libprotoc_hdrs}) +foreach(_hdr ${_exclude_hdrs}) + list(REMOVE_ITEM _local_hdrs ${_hdr}) + list(REMOVE_ITEM _local_upb_hdrs ${_hdr}) +endforeach() +list(APPEND _local_hdrs ${libprotoc_public_hdrs}) + # Exclude the bootstrapping that are directly used by tests. set(_exclude_hdrs "${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.h" "${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h" "${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h" "${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_features.pb.h") - -# Exclude test library headers. -list(APPEND _exclude_hdrs ${test_util_hdrs} ${lite_test_util_hdrs} ${common_test_hdrs} - ${compiler_test_utils_hdrs} ${upb_test_util_files}) foreach(_hdr ${_exclude_hdrs}) list(REMOVE_ITEM _local_hdrs ${_hdr}) endforeach() @@ -250,6 +257,19 @@ foreach(_hdr ${_local_hdrs}) copy "${_tmp_file}" "${_hdr}") endforeach() +foreach(_hdr ${_local_upb_hdrs}) + string(REPLACE "${protobuf_SOURCE_DIR}/upb" "" _file ${_hdr}) + set(_tmp_file "${CMAKE_BINARY_DIR}/tmp-install-test/${_file}") + add_custom_command(TARGET remove-installed-headers PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E remove -f "${_hdr}") + add_custom_command(TARGET save-installed-headers PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E + copy "${_hdr}" "${_tmp_file}" || true) + add_custom_command(TARGET restore-installed-headers PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E + copy "${_tmp_file}" "${_hdr}") +endforeach() + add_dependencies(remove-installed-headers save-installed-headers) if(protobuf_REMOVE_INSTALLED_HEADERS) # Make sure we remove all the headers *before* any codegen occurs. diff --git a/third_party/protobuf/cmake/upb_generators.cmake b/third_party/protobuf/cmake/upb_generators.cmake index 807236bf59eef..81a7a452a3d11 100644 --- a/third_party/protobuf/cmake/upb_generators.cmake +++ b/third_party/protobuf/cmake/upb_generators.cmake @@ -16,6 +16,7 @@ foreach(generator upb upbdefs upb_minitable) ) target_include_directories(protoc-gen-${generator} PRIVATE ${bootstrap_cmake_dir}) target_link_libraries(protoc-gen-${generator} + utf8_validity ${protobuf_LIB_UPB} ${protobuf_ABSL_USED_TARGETS} ) diff --git a/third_party/protobuf/conformance/BUILD.bazel b/third_party/protobuf/conformance/BUILD.bazel index 9d7938d75db9f..85773fa217323 100644 --- a/third_party/protobuf/conformance/BUILD.bazel +++ b/third_party/protobuf/conformance/BUILD.bazel @@ -1,6 +1,14 @@ +# Copyright (c) 2024, Google LLC +# All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd + # Conformance testing for Protobuf. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "objc_library") +load("@rules_java//java:java_binary.bzl", "java_binary") load( "@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", @@ -153,14 +161,14 @@ cc_library( "//src/google/protobuf/util:differencer", "//src/google/protobuf/util:json_util", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:optional", ], ) @@ -169,12 +177,12 @@ cc_test( srcs = ["failure_list_trie_node_test.cc"], deps = [ ":conformance_test", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -201,12 +209,12 @@ cc_library( "//src/google/protobuf:protobuf_lite", "//src/google/protobuf/json", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", "@jsoncpp", ], ) @@ -224,10 +232,10 @@ cc_library( "//editions:test_messages_proto2_editions_cc_proto", "//editions:test_messages_proto3_editions_cc_proto", "//src/google/protobuf", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -240,7 +248,7 @@ cc_binary( ":binary_json_conformance_suite", ":conformance_test", ":text_format_conformance_suite", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -264,11 +272,11 @@ cc_binary( "//src/google/protobuf/stubs", "//src/google/protobuf/util:json_util", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", ], ) @@ -346,7 +354,7 @@ inline_sh_binary( "conformance_php.php", ], cmd = """ - php -d include_path=conformance:src/google/protobuf \\ + php -d include_path=php/generated:conformance:src/google/protobuf:editions/golden \\ -d auto_prepend_file=$(rootpath autoload.php) \\ $(rootpath conformance_php.php) """, @@ -354,6 +362,7 @@ inline_sh_binary( deps = [ ":conformance_php_proto", "//:test_messages_proto3_php_proto", + "//editions:test_messages_proto3_editions_php_proto", "//php:source_files", ], ) diff --git a/third_party/protobuf/conformance/README.md b/third_party/protobuf/conformance/README.md index 24f1cbe757ec5..aea173fdb2411 100644 --- a/third_party/protobuf/conformance/README.md +++ b/third_party/protobuf/conformance/README.md @@ -70,7 +70,7 @@ C#: Objective-C (Mac only): - $ `bazel test //objectivec:conformance_test --macos_minimum_os=10.9 + $ `bazel test //objectivec:conformance_test --macos_minimum_os=11.0` Ruby: diff --git a/third_party/protobuf/conformance/autoload.php b/third_party/protobuf/conformance/autoload.php index 7f04cc008c379..6a115e7d02454 100644 --- a/third_party/protobuf/conformance/autoload.php +++ b/third_party/protobuf/conformance/autoload.php @@ -7,8 +7,12 @@ define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\"); function protobuf_autoloader_impl($class, $prefix) { $length = strlen($prefix); if ((substr($class, 0, $length) === $prefix)) { - $path = 'php/src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php'; - include_once $path; + $path = 'src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php'; + if (file_exists('php/' . $path)) { + include_once 'php/' . $path; + } else { + include_once 'php/generated/' . $path; + } } } diff --git a/third_party/protobuf/conformance/binary_json_conformance_suite.cc b/third_party/protobuf/conformance/binary_json_conformance_suite.cc index ede4710cc65e3..1229aabc430dd 100644 --- a/third_party/protobuf/conformance/binary_json_conformance_suite.cc +++ b/third_party/protobuf/conformance/binary_json_conformance_suite.cc @@ -1366,13 +1366,61 @@ void BinaryAndJsonConformanceSuiteImpl<MessageType>::TestIllegalTags() { } } +template <typename MessageType> +void BinaryAndJsonConformanceSuiteImpl<MessageType>::TestUnmatchedGroup() { + ExpectParseFailureForProto(tag(201, WireFormatLite::WIRETYPE_END_GROUP), + "UnmatchedEndGroup", REQUIRED); + ExpectParseFailureForProto(tag(1234, WireFormatLite::WIRETYPE_END_GROUP), + "UnmatchedEndGroupUnknown", REQUIRED); + ExpectParseFailureForProto(tag(1, WireFormatLite::WIRETYPE_END_GROUP), + "UnmatchedEndGroupWrongType", REQUIRED); + ExpectParseFailureForProto( + len(18, tag(1234, WireFormatLite::WIRETYPE_END_GROUP)), + "UnmatchedEndGroupNestedLen", REQUIRED); + ExpectParseFailureForProto( + group(201, tag(202, WireFormatLite::WIRETYPE_END_GROUP)), + "UnmatchedEndGroupNested", REQUIRED); + ExpectParseFailureForProto( + absl::StrCat(tag(1, WireFormatLite::WIRETYPE_END_GROUP), + len(2, "hello world")), + "UnmatchedEndGroupWithData", REQUIRED); + + ExpectParseFailureForProto(tag(201, WireFormatLite::WIRETYPE_START_GROUP), + "UnmatchedStartGroup", REQUIRED); + ExpectParseFailureForProto(tag(1234, WireFormatLite::WIRETYPE_START_GROUP), + "UnmatchedStartGroupUnknown", REQUIRED); + ExpectParseFailureForProto(tag(1, WireFormatLite::WIRETYPE_START_GROUP), + "UnmatchedStartGroupWrongType", REQUIRED); + ExpectParseFailureForProto( + len(18, tag(1234, WireFormatLite::WIRETYPE_START_GROUP)), + "UnmatchedStartGroupNestedLen", REQUIRED); + ExpectParseFailureForProto( + group(201, tag(202, WireFormatLite::WIRETYPE_START_GROUP)), + "UnmatchedStartGroupNested", REQUIRED); + ExpectParseFailureForProto( + absl::StrCat(tag(1, WireFormatLite::WIRETYPE_START_GROUP), + len(2, "hello world")), + "UnmatchedStartGroupWithData", REQUIRED); + + ExpectParseFailureForProto( + absl::StrCat(tag(201, WireFormatLite::WIRETYPE_START_GROUP), + len(2, "hello world"), + tag(202, WireFormatLite::WIRETYPE_END_GROUP)), + "MismatchedGroupTags", REQUIRED); + ExpectParseFailureForProto( + group(201, absl::StrCat(tag(202, WireFormatLite::WIRETYPE_START_GROUP), + len(2, "hello world"), + tag(203, WireFormatLite::WIRETYPE_END_GROUP))), + "MismatchedNestedGroupTags", REQUIRED); +} + template <typename MessageType> void BinaryAndJsonConformanceSuiteImpl<MessageType>::TestUnknownWireType() { for (uint8_t type : {0x6, 0x7}) { for (uint8_t field = 0; field < 4; ++field) { for (uint8_t value = 0; value < 4; ++value) { - std::string name = absl::StrFormat("UnknownWireType%d_Field%d_Verion%d", - type, field, value); + std::string name = absl::StrFormat( + "UnknownWireType%d_Field%d_Version%d", type, field, value); char data[2]; data[0] = (field << 3) | type; // unknown wire type. @@ -1553,7 +1601,7 @@ void BinaryAndJsonConformanceSuiteImpl<MessageType>::RunAllTests() { } TestIllegalTags(); - + TestUnmatchedGroup(); TestUnknownWireType(); int64_t kInt64Min = -9223372036854775808ULL; @@ -2289,6 +2337,10 @@ void BinaryAndJsonConformanceSuiteImpl< RunValidJsonTest("Int32FieldStringValueEscaped", REQUIRED, R"({"optionalInt32": "2\u003147483647"})", "optional_int32: 2147483647"); + RunValidJsonTest("Int32FieldStringValueZero", REQUIRED, + R"({"optionalInt32": "0"})", "optional_int32: 0"); + RunValidJsonTest("Int32FieldQuotedExponentialValue", REQUIRED, + R"({"optionalInt32": "1e5"})", "optional_int32: 100000"); // Parsers reject out-of-bound integer values. ExpectParseFailureForJson("Int32FieldTooLarge", REQUIRED, @@ -2303,7 +2355,8 @@ void BinaryAndJsonConformanceSuiteImpl< R"({"optionalInt64": "-9223372036854775809"})"); ExpectParseFailureForJson("Uint64FieldTooLarge", REQUIRED, R"({"optionalUint64": "18446744073709551616"})"); - // Parser reject non-integer numeric values as well. + + // Parser reject non-integer numeric values. ExpectParseFailureForJson("Int32FieldNotInteger", REQUIRED, R"({"optionalInt32": 0.5})"); ExpectParseFailureForJson("Uint32FieldNotInteger", REQUIRED, @@ -2313,6 +2366,22 @@ void BinaryAndJsonConformanceSuiteImpl< ExpectParseFailureForJson("Uint64FieldNotInteger", REQUIRED, R"({"optionalUint64": "0.5"})"); + // Parser reject non-numeric string values. + ExpectParseFailureForJson("Int32FieldStringValuePartiallyNumeric", REQUIRED, + R"({"optionalInt32": "12abc"})"); + ExpectParseFailureForJson("Int32FieldStringValueNonNumeric", REQUIRED, + R"({"optionalInt32": "abc"})"); + + // Parser reject empty string values. + ExpectParseFailureForJson("Int32FieldEmptyString", REQUIRED, + R"({"optionalInt32": ""})"); + ExpectParseFailureForJson("Uint32FieldEmptyString", REQUIRED, + R"({"optionalUint32": ""})"); + ExpectParseFailureForJson("Int64FieldEmptyString", REQUIRED, + R"({"optionalInt64": ""})"); + ExpectParseFailureForJson("Uint64FieldEmptyString", REQUIRED, + R"({"optionalUint64": ""})"); + // Integers but represented as float values are accepted. RunValidJsonTest("Int32FieldFloatTrailingZero", REQUIRED, R"({"optionalInt32": 100000.000})", @@ -2407,6 +2476,9 @@ void BinaryAndJsonConformanceSuiteImpl< // Values can be quoted. RunValidJsonTest("FloatFieldQuotedValue", REQUIRED, R"({"optionalFloat": "1"})", "optional_float: 1"); + RunValidJsonTest("FloatFieldQuotedExponentialValue", REQUIRED, + R"({"optionalFloat": "1.175494e-38"})", + "optional_float: 1.175494e-38"); // Special values. RunValidJsonTest("FloatFieldNan", REQUIRED, R"({"optionalFloat": "NaN"})", "optional_float: nan"); @@ -2436,12 +2508,23 @@ void BinaryAndJsonConformanceSuiteImpl< R"({"optionalFloat": Infinity})"); ExpectParseFailureForJson("FloatFieldNegativeInfinityNotQuoted", RECOMMENDED, R"({"optionalFloat": -Infinity})"); + // Parsers should reject out-of-bound values. ExpectParseFailureForJson("FloatFieldTooSmall", REQUIRED, R"({"optionalFloat": -3.502823e+38})"); ExpectParseFailureForJson("FloatFieldTooLarge", REQUIRED, R"({"optionalFloat": 3.502823e+38})"); + // Parsers should reject empty string values. + ExpectParseFailureForJson("FloatFieldEmptyString", REQUIRED, + R"({"optionalFloat": ""})"); + + // Parser reject non-numeric string values. + ExpectParseFailureForJson("FloatFieldStringValuePartiallyNumeric", REQUIRED, + R"({"optionalFloat": "12abc"})"); + ExpectParseFailureForJson("FloatFieldStringValueNonNumeric", REQUIRED, + R"({"optionalFloat": "abc"})"); + // Double fields. RunValidJsonTest("DoubleFieldMinPositiveValue", REQUIRED, R"({"optionalDouble": 2.22507e-308})", @@ -2458,6 +2541,9 @@ void BinaryAndJsonConformanceSuiteImpl< // Values can be quoted. RunValidJsonTest("DoubleFieldQuotedValue", REQUIRED, R"({"optionalDouble": "1"})", "optional_double: 1"); + RunValidJsonTest("DoubleFieldQuotedExponentialValue", REQUIRED, + R"({"optionalDouble": "2.22507e-308"})", + "optional_double: 2.22507e-308"); // Special values. RunValidJsonTest("DoubleFieldNan", REQUIRED, R"({"optionalDouble": "NaN"})", "optional_double: nan"); @@ -2494,6 +2580,16 @@ void BinaryAndJsonConformanceSuiteImpl< ExpectParseFailureForJson("DoubleFieldTooLarge", REQUIRED, R"({"optionalDouble": +1.89769e+308})"); + // Parsers should reject empty string values. + ExpectParseFailureForJson("DoubleFieldEmptyString", REQUIRED, + R"({"optionalDouble": ""})"); + + // Parser reject non-numeric string values. + ExpectParseFailureForJson("DoubleFieldStringValuePartiallyNumeric", REQUIRED, + R"({"optionalDouble": "12abc"})"); + ExpectParseFailureForJson("DoubleFieldStringValueNonNumeric", REQUIRED, + R"({"optionalDouble": "abc"})"); + // Enum fields. RunValidJsonTest("EnumField", REQUIRED, R"({"optionalNestedEnum": "FOO"})", "optional_nested_enum: FOO"); @@ -2997,6 +3093,27 @@ void BinaryAndJsonConformanceSuiteImpl< })", "repeated_timestamp: {seconds: -62135596800}" "repeated_timestamp: {seconds: 253402300799 nanos: 999999999}"); + RunValidJsonTest("TimestampEpochValue", REQUIRED, + R"({"optionalTimestamp": "1970-01-01T00:00:00.000Z"})", + "optional_timestamp: {seconds: 0}"); + RunValidJsonTest("TimestampNanoAfterEpochlValue", REQUIRED, + R"({"optionalTimestamp": "1970-01-01T00:00:00.000000001Z"})", + "optional_timestamp: {seconds: 0 nanos: 1}"); + RunValidJsonTest("TimestampNanoBeforeEpochValue", REQUIRED, + R"({"optionalTimestamp": "1969-12-31T23:59:59.999999999Z"})", + "optional_timestamp: {seconds: -1 nanos: 999999999}"); + RunValidJsonTest("TimestampLittleAfterEpochlValue", REQUIRED, + R"({"optionalTimestamp": "1970-01-01T00:00:01.000000001Z"})", + "optional_timestamp: {seconds: 1 nanos: 1}"); + RunValidJsonTest("TimestampLittleBeforeEpochValue", REQUIRED, + R"({"optionalTimestamp": "1969-12-31T23:59:58.999999999Z"})", + "optional_timestamp: {seconds: -2 nanos: 999999999}"); + RunValidJsonTest("TimestampTenAndHalfSecondsAfterEpochValue", REQUIRED, + R"({"optionalTimestamp": "1970-01-01T00:00:10.500Z"})", + "optional_timestamp: {seconds: 10 nanos: 500000000}"); + RunValidJsonTest("TimestampTenAndHalfSecondsBeforeEpochValue", REQUIRED, + R"({"optionalTimestamp": "1969-12-31T23:59:49.500Z"})", + "optional_timestamp: {seconds: -11 nanos: 500000000}"); RunValidJsonTest("TimestampLeap", REQUIRED, R"({"optionalTimestamp": "1993-02-10T00:00:00.000Z"})", "optional_timestamp: {seconds: 729302400}"); @@ -3428,6 +3545,40 @@ void BinaryAndJsonConformanceSuiteImpl<MessageType>::RunJsonTestsForAny() { } } )"); + // When the Any is in WKT form (with "@type"), the type_url must be present + // and URL shaped, otherwise it should be a parse error (because it can't be + // parsed into the Any schema). + ExpectParseFailureForJson("AnyWktRepresentationWithEmptyTypeAndValue", + REQUIRED, + R"({ + "optionalAny": { + "@type": "", + "value": "" + } + })"); + ExpectParseFailureForJson("AnyWktRepresentationWithBadType", REQUIRED, + R"({ + "optionalAny": { + "@type": "not_a_url", + "value": "" + } + })"); + // When the Any can be parsed as non-WKT form, the type_url could be missing + // or invalid, since that can still be parsed into the Any schema. + RunValidJsonTest("AnyWithNoType", REQUIRED, + R"({ + "optionalAny": {} + })", + R"( + optional_any: {} + )"); + // `null` where an Any exists should just result in the field being unset. + RunValidJsonTest("AnyNull", REQUIRED, + R"({ + "optionalAny": null + })", + R"( + )"); } template <typename MessageType> diff --git a/third_party/protobuf/conformance/binary_json_conformance_suite.h b/third_party/protobuf/conformance/binary_json_conformance_suite.h index 325a76e3bac48..9c990557d7021 100644 --- a/third_party/protobuf/conformance/binary_json_conformance_suite.h +++ b/third_party/protobuf/conformance/binary_json_conformance_suite.h @@ -143,6 +143,7 @@ class BinaryAndJsonConformanceSuiteImpl { ConformanceLevel level); void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type); void TestIllegalTags(); + void TestUnmatchedGroup(); void TestUnknownWireType(); void TestOneofMessage(); void TestUnknownMessage(); diff --git a/third_party/protobuf/conformance/conformance_php.php b/third_party/protobuf/conformance/conformance_php.php index a753761147568..66af4731e44d0 100644 --- a/third_party/protobuf/conformance/conformance_php.php +++ b/third_party/protobuf/conformance/conformance_php.php @@ -36,6 +36,8 @@ if (!ini_get('date.timezone')) { ini_set('date.timezone', 'UTC'); } +error_reporting(0); + $test_count = 0; function doTest($request) @@ -78,6 +80,9 @@ function doTest($request) } catch (Exception $e) { $response->setParseError($e->getMessage()); return $response; + } catch (Error $e) { + $response->setParseError($e->getMessage()); + return $response; } break; @@ -86,6 +91,7 @@ function doTest($request) case 'protobuf_test_messages.editions.proto3.TestAllTypesProto3': $test_message = new TestAllTypesProto3Editions(); break; + case 'protobuf_test_messages.proto2.TestAllTypesProto2': case 'protobuf_test_messages.editions.proto2.TestAllTypesProto2': $response->setSkipped('PHP doesn\'t support proto2'); return $response; @@ -103,6 +109,9 @@ function doTest($request) } catch (Exception $e) { $response->setParseError($e->getMessage()); return $response; + } catch (Error $e) { + $response->setParseError($e->getMessage()); + return $response; } break; @@ -128,6 +137,9 @@ function doTest($request) } catch (Exception $e) { $response->setSerializeError($e->getMessage()); return $response; + } catch (Error $e) { + $response->setSerializeError($e->getMessage()); + return $response; } } diff --git a/third_party/protobuf/conformance/conformance_python.py b/third_party/protobuf/conformance/conformance_python.py index 77076bd885bfd..29df365c31385 100755 --- a/third_party/protobuf/conformance/conformance_python.py +++ b/third_party/protobuf/conformance/conformance_python.py @@ -48,64 +48,10 @@ def _create_test_message(type): def do_test(request): response = conformance_pb2.ConformanceResponse() - if request.message_type == "conformance.FailureSet": - failure_set = conformance_pb2.FailureSet() - failures = [] - # TODO: Remove, this is a hack to detect if the old vs new - # parser is used by the cpp code. Relying on a bug in the old parser. - hack_proto = test_messages_proto2_pb2.TestAllTypesProto2() - old_parser = True - try: - hack_proto.ParseFromString(b"\322\002\001") - except message.DecodeError as e: - old_parser = False - if old_parser: - # the string above is one of the failing conformance test strings of the - # old parser. If we succeed the c++ implementation is using the old - # parser so we add the list of failing conformance tests. - failures = [ - "Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE", - "Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.DOUBLE", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FLOAT", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32", - "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64", - "Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE", - "Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32", - "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64", - ] - for x in failures: - failure_set.test.append(conformance_pb2.TestStatus(name=x)) - response.protobuf_payload = failure_set.SerializeToString() - return response - - isJson = request.WhichOneof("payload") == "json_payload" + is_json = request.WhichOneof("payload") == "json_payload" test_message = _create_test_message(request.message_type) - if (not isJson) and (test_message is None): + if (not is_json) and (test_message is None): raise ProtocolError("Protobuf request doesn't have specific payload type") try: diff --git a/third_party/protobuf/conformance/conformance_rust.rs b/third_party/protobuf/conformance/conformance_rust.rs index 5b794c4a3c7b0..820d67cff7f12 100644 --- a/third_party/protobuf/conformance/conformance_rust.rs +++ b/third_party/protobuf/conformance/conformance_rust.rs @@ -8,7 +8,7 @@ use conformance_rust_proto::{ConformanceRequest, ConformanceResponse, WireFormat use protobuf::prelude::*; use protobuf::Optional::{Set, Unset}; -use protobuf::ParseError; +use protobuf::{Message, ParseError}; use std::io::{self, ErrorKind, Read, Write}; use test_messages_edition2023_rust_proto::TestAllTypesEdition2023; diff --git a/third_party/protobuf/conformance/conformance_test.cc b/third_party/protobuf/conformance/conformance_test.cc index c3d299865e7e9..23ec38850c06b 100644 --- a/third_party/protobuf/conformance/conformance_test.cc +++ b/third_party/protobuf/conformance/conformance_test.cc @@ -182,7 +182,7 @@ bool CheckSetEmpty(const absl::btree_map<std::string, TestStatus>& set_to_check, namespace google { namespace protobuf { -constexpr int kMaximumWildcardExpansions = 5; +constexpr int kMaximumWildcardExpansions = 10; ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting( ConformanceLevel level, conformance::WireFormat input_format, diff --git a/third_party/protobuf/conformance/failure_list_cpp.txt b/third_party/protobuf/conformance/failure_list_cpp.txt index 7c52e23d96c8d..99fd552e9d7b5 100644 --- a/third_party/protobuf/conformance/failure_list_cpp.txt +++ b/third_party/protobuf/conformance/failure_list_cpp.txt @@ -14,8 +14,6 @@ Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing1 Recommended.*.JsonInput.FieldNameDuplicateDifferentCasing2 # Should have failed to parse, but didn't. Recommended.*.JsonInput.FieldNameExtension.Validator # Expected JSON payload but got type 1 Recommended.*.JsonInput.FieldNameNotQuoted # Should have failed to parse, but didn't. -Recommended.*.JsonInput.IgnoreUnknownEnumStringValueInMapPart.ProtobufOutput # Output was not equivalent to reference message: added: map_string_nested_enum[key2]: FOO -Recommended.*.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput # Output was not equivalent to reference message: added: map_string_nested_enum[key]: FOO Recommended.*.JsonInput.MapFieldValueIsNull # Should have failed to parse, but didn't. Recommended.*.JsonInput.RepeatedFieldMessageElementIsNull # Should have failed to parse, but didn't. Recommended.*.JsonInput.RepeatedFieldPrimitiveElementIsNull # Should have failed to parse, but didn't. diff --git a/third_party/protobuf/conformance/failure_list_csharp.txt b/third_party/protobuf/conformance/failure_list_csharp.txt index e16578c329d96..27560100fee77 100644 --- a/third_party/protobuf/conformance/failure_list_csharp.txt +++ b/third_party/protobuf/conformance/failure_list_csharp.txt @@ -33,3 +33,7 @@ Recommended.Editions_Proto3.ValueRejectInfNumberValue.JsonOutput Recommended.Editions_Proto3.ValueRejectNanNumberValue.JsonOutput Required.Editions_Proto2.ProtobufInput.UnknownOrdering.ProtobufOutput Required.Editions_Proto3.ProtobufInput.UnknownOrdering.ProtobufOutput +Required.*.JsonInput.AnyWithNoType.* # Failed to parse input or produce output. +Required.*.JsonInput.AnyWktRepresentationWithEmptyTypeAndValue # Should have failed to parse, but didn't. +Required.*.JsonInput.AnyWktRepresentationWithBadType # Should have failed to parse, but didn't. + diff --git a/third_party/protobuf/conformance/failure_list_jruby_ffi.txt b/third_party/protobuf/conformance/failure_list_jruby_ffi.txt index e69de29bb2d1d..d22be3bf1dd92 100644 --- a/third_party/protobuf/conformance/failure_list_jruby_ffi.txt +++ b/third_party/protobuf/conformance/failure_list_jruby_ffi.txt @@ -0,0 +1,2 @@ +Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output. +Required.*.JsonInput.AnyWithNoType.* # Failed to parse input or produce output. diff --git a/third_party/protobuf/conformance/failure_list_php.txt b/third_party/protobuf/conformance/failure_list_php.txt index 5c09f3fc2f3e2..ce4e24ac565f1 100644 --- a/third_party/protobuf/conformance/failure_list_php.txt +++ b/third_party/protobuf/conformance/failure_list_php.txt @@ -1,42 +1,34 @@ -Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput -Recommended.FieldMaskPathsDontRoundTrip.JsonOutput -Recommended.FieldMaskTooManyUnderscore.JsonOutput -Recommended.Proto2.JsonInput.FieldNameExtension.Validator -Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput -Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput -Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter -Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput -Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput -Recommended.Editions_Proto2.JsonInput.IgnoreUnknownEnumStringValueInRepeatedPart.ProtobufOutput -Recommended.Editions_Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedPart.ProtobufOutput -Recommended.Proto2.JsonInput.IgnoreUnknownEnumStringValueInRepeatedPart.ProtobufOutput -Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedPart.ProtobufOutput -Recommended.Editions_Proto2.JsonInput.IgnoreUnknownEnumStringValueInMapPart.ProtobufOutput -Recommended.Editions_Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapPart.ProtobufOutput -Recommended.Proto2.JsonInput.IgnoreUnknownEnumStringValueInMapPart.ProtobufOutput -Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapPart.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput -Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator -Required.Proto3.JsonInput.DoubleFieldTooSmall -Required.Proto3.JsonInput.DurationNegativeNanos.JsonOutput -Required.Proto3.JsonInput.DurationNegativeNanos.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldTooLarge -Required.Proto3.JsonInput.FloatFieldTooSmall -Required.Proto3.JsonInput.Int32FieldNotInteger -Required.Proto3.JsonInput.Int64FieldNotInteger -Required.Proto3.JsonInput.OneofFieldDuplicate -Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput -Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput -Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt -Required.Proto3.JsonInput.RepeatedListValue.JsonOutput -Required.Proto3.JsonInput.RepeatedListValue.ProtobufOutput -Required.Proto3.JsonInput.StringFieldNotAString -Required.Proto3.JsonInput.Uint32FieldNotInteger -Required.Proto3.JsonInput.Uint64FieldNotInteger -Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.JsonOutput -Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.Merge.JsonOutput -Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.Merge.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].JsonOutput +Recommended.*.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.*.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.*.FieldMaskTooManyUnderscore.JsonOutput +Recommended.*.JsonInput.BytesFieldBase64Url.JsonOutput +Recommended.*.JsonInput.BytesFieldBase64Url.ProtobufOutput +Recommended.*.JsonInput.FieldMaskInvalidCharacter +Recommended.*.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput +Recommended.*.ValueRejectInfNumberValue.JsonOutput # Should have failed to serialize, but didn't. +Recommended.*.ValueRejectNanNumberValue.JsonOutput # Should have failed to serialize, but didn't. +Required.*.JsonInput.DoubleFieldTooSmall +Required.*.JsonInput.DurationNegativeNanos.JsonOutput +Required.*.JsonInput.DurationNegativeNanos.ProtobufOutput +Required.*.JsonInput.FloatFieldTooLarge +Required.*.JsonInput.FloatFieldTooSmall +Required.*.JsonInput.Int32FieldNotInteger +Required.*.JsonInput.Int64FieldNotInteger +Required.*.JsonInput.OneofFieldDuplicate +Required.*.JsonInput.OneofFieldNullSecond.JsonOutput +Required.*.JsonInput.OneofFieldNullSecond.ProtobufOutput +Required.*.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.*.JsonInput.RepeatedListValue.JsonOutput +Required.*.JsonInput.RepeatedListValue.ProtobufOutput +Required.*.JsonInput.StringFieldNotAString +Required.*.JsonInput.Uint32FieldNotInteger +Required.*.JsonInput.Uint64FieldNotInteger +Required.*.ProtobufInput.RepeatedScalarMessageMerge.JsonOutput +Required.*.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput +Required.*.ProtobufInput.ValidDataOneof.MESSAGE.Merge.JsonOutput +Required.*.ProtobufInput.ValidDataOneof.MESSAGE.Merge.ProtobufOutput +Required.*.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.JsonOutput +Required.*.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.JsonOutput +Required.*.ProtobufInput.ValidDataScalar.FLOAT[2].JsonOutput +Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output. +Required.*.JsonInput.AnyWithNoType.* diff --git a/third_party/protobuf/conformance/failure_list_php_c.txt b/third_party/protobuf/conformance/failure_list_php_c.txt index df662c320ac76..f00f746e87769 100644 --- a/third_party/protobuf/conformance/failure_list_php_c.txt +++ b/third_party/protobuf/conformance/failure_list_php_c.txt @@ -1,4 +1,5 @@ Recommended.Proto2.JsonInput.FieldNameExtension.Validator +Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output. Required.Proto2.JsonInput.BoolFieldFalse.JsonOutput Required.Proto2.JsonInput.BoolFieldFalse.ProtobufOutput Required.Proto2.JsonInput.EnumField.JsonOutput @@ -6,3 +7,4 @@ Required.Proto2.JsonInput.EnumField.ProtobufOutput Required.Proto2.JsonInput.EnumFieldNumericValueZero.JsonOutput Required.Proto2.JsonInput.EnumFieldNumericValueZero.ProtobufOutput Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator +Required.*.JsonInput.AnyWithNoType.* diff --git a/third_party/protobuf/conformance/failure_list_ruby.txt b/third_party/protobuf/conformance/failure_list_ruby.txt index e69de29bb2d1d..882ab1dc74707 100644 --- a/third_party/protobuf/conformance/failure_list_ruby.txt +++ b/third_party/protobuf/conformance/failure_list_ruby.txt @@ -0,0 +1,2 @@ +Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output. +Required.*.JsonInput.AnyWithNoType.* \ No newline at end of file diff --git a/third_party/protobuf/conformance/failure_list_trie_node.cc b/third_party/protobuf/conformance/failure_list_trie_node.cc index 95e27d6b5e6b8..3b712985866b2 100644 --- a/third_party/protobuf/conformance/failure_list_trie_node.cc +++ b/third_party/protobuf/conformance/failure_list_trie_node.cc @@ -1,3 +1,10 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + #include "failure_list_trie_node.h" #include <memory> @@ -38,27 +45,37 @@ absl::Status FailureListTrieNode::Insert(absl::string_view test_name) { void FailureListTrieNode::InsertImpl(absl::string_view test_name) { absl::string_view section = test_name.substr(0, test_name.find('.')); - // Extracted last section -> no more '.' -> test_name_copy will be equal to - // section - if (test_name == section) { - children_.push_back(std::make_unique<FailureListTrieNode>(section)); - return; - } - test_name = test_name.substr(section.length() + 1); + bool is_last_section = test_name == section; + + // test_name cannot be overwritten + absl::string_view test_name_rest = + is_last_section ? "" : test_name.substr(section.length() + 1); for (auto& child : children_) { if (child->data_ == section) { - return child->InsertImpl(test_name); + if (is_last_section) { + // Extracted last section -> no more '.' -> test_name will be equal to + // section + child->is_test_name_ = true; + } else { + child->InsertImpl(test_name_rest); + } + return; } } + // No match children_.push_back(std::make_unique<FailureListTrieNode>(section)); - children_.back()->InsertImpl(test_name); + if (is_last_section) { + children_.back()->is_test_name_ = true; + return; + } + children_.back()->InsertImpl(test_name_rest); } absl::optional<std::string> FailureListTrieNode::WalkDownMatch( absl::string_view test_name) { absl::string_view section = test_name.substr(0, test_name.find('.')); - // test_name cannot be overridden + // test_name cannot be overwritten absl::string_view to_match; if (section != test_name) { to_match = test_name.substr(section.length() + 1); @@ -70,8 +87,7 @@ absl::optional<std::string> FailureListTrieNode::WalkDownMatch( // Extracted last section -> no more '.' -> test_name will be // equal to section if (test_name == section) { - // Must match all the way to the bottom of the tree - if (child->children_.empty()) { + if (child->is_test_name_) { return std::string(appended); } } else { diff --git a/third_party/protobuf/conformance/failure_list_trie_node.h b/third_party/protobuf/conformance/failure_list_trie_node.h index 2c7409d04e7dd..d1f84c61aa9cf 100644 --- a/third_party/protobuf/conformance/failure_list_trie_node.h +++ b/third_party/protobuf/conformance/failure_list_trie_node.h @@ -1,3 +1,10 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + #ifndef GOOGLE_PROTOBUF_CONFORMANCE_FAILURE_LIST_TRIE_NODE_H__ #define GOOGLE_PROTOBUF_CONFORMANCE_FAILURE_LIST_TRIE_NODE_H__ @@ -35,7 +42,8 @@ namespace protobuf { class FailureListTrieNode { public: FailureListTrieNode() : data_("") {} - explicit FailureListTrieNode(absl::string_view data) : data_(data) {} + explicit FailureListTrieNode(absl::string_view data) + : data_(data), is_test_name_(false) {} // Will attempt to insert a test name into the trie returning // absl::StatusCode::kAlreadyExists if the test name already exists or @@ -50,6 +58,7 @@ class FailureListTrieNode { private: absl::string_view data_; std::vector<std::unique_ptr<FailureListTrieNode>> children_; + bool is_test_name_; void InsertImpl(absl::string_view test_name); }; } // namespace protobuf diff --git a/third_party/protobuf/conformance/failure_list_trie_node_test.cc b/third_party/protobuf/conformance/failure_list_trie_node_test.cc index 2dedaa48122c5..2dc9dedd936db 100644 --- a/third_party/protobuf/conformance/failure_list_trie_node_test.cc +++ b/third_party/protobuf/conformance/failure_list_trie_node_test.cc @@ -1,6 +1,11 @@ -#include "failure_list_trie_node.h" +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd -#include <memory> +#include "failure_list_trie_node.h" #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -121,5 +126,23 @@ TEST(FailureListTrieTest, InsertInvalidWildcardFails) { StatusIs(absl::StatusCode::kInvalidArgument, HasSubstr("invalid wildcard"))); } + +TEST(FailureListTrieTest, PrefixMarkedAsTestNameRecognizedWithoutWildcards) { + auto root_ = std::make_unique<FailureListTrieNode>("dummy"); + ASSERT_OK(root_->Insert("Recommended.Proto2.ProtobufInput.World")); + + ASSERT_OK(root_->Insert("Recommended.Proto2")); + EXPECT_THAT(root_->WalkDownMatch("Recommended.Proto2"), + Optional(Eq("Recommended.Proto2"))); +} + +TEST(FailureListTrieTest, PrefixMarkedAsTestNameRecognizedWithWildcards) { + auto root_ = std::make_unique<FailureListTrieNode>("dummy"); + ASSERT_OK(root_->Insert("Recommended.*.*.*")); + + ASSERT_OK(root_->Insert("Recommended.*.*")); + EXPECT_THAT(root_->WalkDownMatch("Recommended.*.Hello"), + Optional(Eq("Recommended.*.*"))); +} } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/conformance/test_protos/BUILD.bazel b/third_party/protobuf/conformance/test_protos/BUILD.bazel index c3033bda1fd61..27cbda49405ac 100644 --- a/third_party/protobuf/conformance/test_protos/BUILD.bazel +++ b/third_party/protobuf/conformance/test_protos/BUILD.bazel @@ -1,4 +1,3 @@ -load("@rules_cc//cc:defs.bzl", "objc_library") load("//:protobuf.bzl", "internal_csharp_proto_library", "internal_objc_proto_library", "internal_py_proto_library") load("//bazel:cc_proto_library.bzl", "cc_proto_library") load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library") diff --git a/third_party/protobuf/conformance/text_format_failure_list_php.txt b/third_party/protobuf/conformance/text_format_failure_list_php.txt index e69de29bb2d1d..7cc5260cca00c 100644 --- a/third_party/protobuf/conformance/text_format_failure_list_php.txt +++ b/third_party/protobuf/conformance/text_format_failure_list_php.txt @@ -0,0 +1,4 @@ +Recommended.*.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput # Failed to parse input or produce output. +Recommended.*.ProtobufInput.GroupUnknownFields_Print.TextFormatOutput # Failed to parse input or produce output. +Recommended.*.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput # Failed to parse input or produce output. +Recommended.*.ProtobufInput.RepeatedUnknownFields_Print.TextFormatOutput # Failed to parse input or produce output. diff --git a/third_party/protobuf/conformance/text_format_failure_list_python.txt b/third_party/protobuf/conformance/text_format_failure_list_python.txt index ee59c58890da6..fbfcbc31267e9 100644 --- a/third_party/protobuf/conformance/text_format_failure_list_python.txt +++ b/third_party/protobuf/conformance/text_format_failure_list_python.txt @@ -1,54 +1,7 @@ # This is the list of text format conformance tests that are known to fail right # now. # TODO: These should be fixed. -Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMaxValue_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMaxValue_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMinValue_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMinValue_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeZero.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_float: -0 -Required.*.TextFormatInput.FloatFieldNegativeZero.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_float: -0 -Required.*.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeZero_f.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_float: -0 -Required.*.TextFormatInput.FloatFieldNegativeZero_f.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_float: -0 -Required.*.TextFormatInput.FloatFieldNegative_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegative_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoNegativeOctal # Should have failed to parse, but didn't. -Required.*.TextFormatInput.FloatFieldNoOctal # Should have failed to parse, but didn't. -Required.*.TextFormatInput.FloatFieldTooLarge_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooLarge_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooSmall_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooSmall_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithInt32Max_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithInt32Max_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatField_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatField_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.NegDoubleFieldLargeNegativeExponentParsesAsNegZero.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_double: -0 -Required.*.TextFormatInput.NegDoubleFieldLargeNegativeExponentParsesAsNegZero.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_double: -0 -Required.*.TextFormatInput.NegFloatFieldLargeNegativeExponentParsesAsNegZero.ProtobufOutput # Output was not equivalent to reference message: deleted: optional_float: -0 -Required.*.TextFormatInput.NegFloatFieldLargeNegativeExponentParsesAsNegZero.TextFormatOutput # Output was not equivalent to reference message: deleted: optional_float: -0 Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t Required.*.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput # Output was not equivalent to reference message: modified: optional_string: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\ Required.*.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput # Output was not equivalent to reference message: modified: optional_string: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\ - -# Optional float interpreted as `inf` -Required.*.TextFormatInput.FloatFieldMaxValue.ProtobufOutput # Output was not equivalent to reference message -Required.*.TextFormatInput.FloatFieldMaxValue.TextFormatOutput # Output was not equivalent to reference message -Required.*.TextFormatInput.FloatFieldMaxValue_f.ProtobufOutput # Output was not equivalent to reference message -Required.*.TextFormatInput.FloatFieldMaxValue_f.TextFormatOutput # Output was not equivalent to reference message - diff --git a/third_party/protobuf/conformance/text_format_failure_list_python_cpp.txt b/third_party/protobuf/conformance/text_format_failure_list_python_cpp.txt index e1db5d0152487..c853d9d6c5604 100644 --- a/third_party/protobuf/conformance/text_format_failure_list_python_cpp.txt +++ b/third_party/protobuf/conformance/text_format_failure_list_python_cpp.txt @@ -1,35 +1,3 @@ -Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMaxValue_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMaxValue_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMinValue_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMinValue_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegative_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegative_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoNegativeOctal # Should have failed to parse, but didn't. -Required.*.TextFormatInput.FloatFieldNoOctal # Should have failed to parse, but didn't. -Required.*.TextFormatInput.FloatFieldTooLarge_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooLarge_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooSmall_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooSmall_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithInt32Max_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithInt32Max_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatField_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatField_F.TextFormatOutput # Failed to parse input or produce output. Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t Required.*.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput # Output was not equivalent to reference message: modified: optional_string: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\ diff --git a/third_party/protobuf/conformance/text_format_failure_list_python_upb.txt b/third_party/protobuf/conformance/text_format_failure_list_python_upb.txt index ba8301b7f38eb..fbfcbc31267e9 100644 --- a/third_party/protobuf/conformance/text_format_failure_list_python_upb.txt +++ b/third_party/protobuf/conformance/text_format_failure_list_python_upb.txt @@ -1,38 +1,6 @@ # This is the list of text format conformance tests that are known to fail right # now. # TODO: These should be fixed. -Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanInt64_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldLargerThanUint64_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMaxValue_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMaxValue_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMinValue_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldMinValue_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegativeZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegative_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNegative_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZeroWithExponent_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoLeadingZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldNoNegativeOctal # Should have failed to parse, but didn't. -Required.*.TextFormatInput.FloatFieldNoOctal # Should have failed to parse, but didn't. -Required.*.TextFormatInput.FloatFieldTooLarge_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooLarge_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooSmall_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldTooSmall_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithInt32Max_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithInt32Max_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldWithVeryPreciseNumber_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldZero_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatFieldZero_F.TextFormatOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatField_F.ProtobufOutput # Failed to parse input or produce output. -Required.*.TextFormatInput.FloatField_F.TextFormatOutput # Failed to parse input or produce output. Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t Required.*.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput # Output was not equivalent to reference message: modified: optional_bytes: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\t Required.*.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput # Output was not equivalent to reference message: modified: optional_string: "\007\010\014\n\r\t\013?\\\'\"" -> "\007\010\014\n\r\ diff --git a/third_party/protobuf/csharp/BUILD.bazel b/third_party/protobuf/csharp/BUILD.bazel index 1ef004f9ca456..7ab2fc77f70b2 100644 --- a/third_party/protobuf/csharp/BUILD.bazel +++ b/third_party/protobuf/csharp/BUILD.bazel @@ -5,6 +5,8 @@ load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("//build_defs:internal_shell.bzl", "inline_sh_test") load("//conformance:defs.bzl", "conformance_test") +load("//editions:defaults.bzl", "compile_edition_defaults", "embed_edition_defaults") +load("//upb/cmake:build_defs.bzl", "staleness_test") ################################################################################ # Tests @@ -114,3 +116,34 @@ sh_binary( srcs = ["build_release.sh"], args = ["$(location build_release.sh)"], ) + +################################################################################ +# Generated edition defaults (and staleness test) +################################################################################ + +compile_edition_defaults( + name = "csharp_edition_defaults", + srcs = [ + "//:descriptor_proto", + ], + maximum_edition = "2023", + minimum_edition = "PROTO2", +) + +# TODO Make bazel tests use this output instead of the checked-in one +embed_edition_defaults( + name = "embedded_csharp_edition_defaults_generate", + defaults = "csharp_edition_defaults", + encoding = "base64", + output = "generated/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs", + placeholder = "DEFAULTS_VALUE", + template = "src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs.template", +) + +staleness_test( + name = "generated_csharp_defaults_staleness_test", + outs = ["src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs"], + generated_pattern = "generated/%s", + tags = ["manual"], + target_files = ["src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs"], +) diff --git a/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec b/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec index c17fd631b9caa..d629c5628dbc3 100644 --- a/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec +++ b/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ <title>Google Protocol Buffers tools</title> <summary>Tools for Protocol Buffers - Google's data interchange format.</summary> <description>See project site for more info.</description> - <version>3.29.3</version> + <version>3.30.1</version> <authors>Google Inc.</authors> <owners>protobuf-packages</owners> <licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl> diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs index 2fe21b5e7bc16..001cb772cff13 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs @@ -276,14 +276,23 @@ namespace ProtobufTestMessages.Proto2 { "kLP8ASABKAsyVS5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMi5UZXN0", "QWxsUmVxdWlyZWRUeXBlc1Byb3RvMi5NZXNzYWdlU2V0Q29ycmVjdEV4dGVu", "c2lvbjIiOQoKTmVzdGVkRW51bRIHCgNGT08QABIHCgNCQVIQARIHCgNCQVoQ", - "AhIQCgNORUcQ////////////ASoFCHgQyQFKBgjoBxCQTipGChFGb3JlaWdu", - "RW51bVByb3RvMhIPCgtGT1JFSUdOX0ZPTxAAEg8KC0ZPUkVJR05fQkFSEAES", - "DwoLRk9SRUlHTl9CQVoQAjpKCg9leHRlbnNpb25faW50MzISMS5wcm90b2J1", - "Zl90ZXN0X21lc3NhZ2VzLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIYeCAB", - "KAU6cAoKZ3JvdXBmaWVsZBIxLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJv", - "dG8yLlRlc3RBbGxUeXBlc1Byb3RvMhh5IAEoCjIpLnByb3RvYnVmX3Rlc3Rf", - "bWVzc2FnZXMucHJvdG8yLkdyb3VwRmllbGRCOAooY29tLmdvb2dsZS5wcm90", - "b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMkgB+AEBogIGUHJvdG8y")); + "AhIQCgNORUcQ////////////ASoFCHgQyQFKBgjoBxCQTiL9AgoOVGVzdExh", + "cmdlT25lb2YSPgoCYTEYASABKAsyMC5wcm90b2J1Zl90ZXN0X21lc3NhZ2Vz", + "LnByb3RvMi5UZXN0TGFyZ2VPbmVvZi5BMUgAEj4KAmEyGAIgASgLMjAucHJv", + "dG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzIuVGVzdExhcmdlT25lb2YuQTJI", + "ABI+CgJhMxgDIAEoCzIwLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8y", + "LlRlc3RMYXJnZU9uZW9mLkEzSAASPgoCYTQYBCABKAsyMC5wcm90b2J1Zl90", + "ZXN0X21lc3NhZ2VzLnByb3RvMi5UZXN0TGFyZ2VPbmVvZi5BNEgAEj4KAmE1", + "GAUgASgLMjAucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzIuVGVzdExh", + "cmdlT25lb2YuQTVIABoECgJBMRoECgJBMhoECgJBMxoECgJBNBoECgJBNUIN", + "CgtsYXJnZV9vbmVvZipGChFGb3JlaWduRW51bVByb3RvMhIPCgtGT1JFSUdO", + "X0ZPTxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAjpKCg9l", + "eHRlbnNpb25faW50MzISMS5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3Rv", + "Mi5UZXN0QWxsVHlwZXNQcm90bzIYeCABKAU6cAoKZ3JvdXBmaWVsZBIxLnBy", + "b3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yLlRlc3RBbGxUeXBlc1Byb3Rv", + "Mhh5IAEoCjIpLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yLkdyb3Vw", + "RmllbGRCOAooY29tLmdvb2dsZS5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnBy", + "b3RvMkgB+AEBogIGUHJvdG8y")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto2.ForeignEnumProto2), }, new pb::Extension[] { TestMessagesProto2Extensions.ExtensionInt32, TestMessagesProto2Extensions.GroupField }, new pbr::GeneratedClrTypeInfo[] { @@ -304,7 +313,12 @@ namespace ProtobufTestMessages.Proto2 { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.Data), global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.Data.Parser, new[]{ "GroupInt32", "GroupUint32" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrect), global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrect.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension1), global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension1.Parser, new[]{ "Str" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension1.Extensions.MessageSetExtension }, null), - new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2), global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Parser, new[]{ "I" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Extensions.MessageSetExtension }, null)}) + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2), global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Parser, new[]{ "I" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Extensions.MessageSetExtension }, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestLargeOneof), global::ProtobufTestMessages.Proto2.TestLargeOneof.Parser, new[]{ "A1", "A2", "A3", "A4", "A5" }, new[]{ "LargeOneof" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1), global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2), global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3), global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4), global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5), global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5.Parser, null, null, null, null, null)}) })); } #endregion @@ -12832,6 +12846,1272 @@ namespace ProtobufTestMessages.Proto2 { } + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TestLargeOneof : pb::IMessage<TestLargeOneof> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<TestLargeOneof> _parser = new pb::MessageParser<TestLargeOneof>(() => new TestLargeOneof()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<TestLargeOneof> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto2.TestMessagesProto2Reflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TestLargeOneof() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TestLargeOneof(TestLargeOneof other) : this() { + switch (other.LargeOneofCase) { + case LargeOneofOneofCase.A1: + A1 = other.A1.Clone(); + break; + case LargeOneofOneofCase.A2: + A2 = other.A2.Clone(); + break; + case LargeOneofOneofCase.A3: + A3 = other.A3.Clone(); + break; + case LargeOneofOneofCase.A4: + A4 = other.A4.Clone(); + break; + case LargeOneofOneofCase.A5: + A5 = other.A5.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TestLargeOneof Clone() { + return new TestLargeOneof(this); + } + + /// <summary>Field number for the "a1" field.</summary> + public const int A1FieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1 A1 { + get { return largeOneofCase_ == LargeOneofOneofCase.A1 ? (global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A1; + } + } + + /// <summary>Field number for the "a2" field.</summary> + public const int A2FieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2 A2 { + get { return largeOneofCase_ == LargeOneofOneofCase.A2 ? (global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A2; + } + } + + /// <summary>Field number for the "a3" field.</summary> + public const int A3FieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3 A3 { + get { return largeOneofCase_ == LargeOneofOneofCase.A3 ? (global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A3; + } + } + + /// <summary>Field number for the "a4" field.</summary> + public const int A4FieldNumber = 4; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4 A4 { + get { return largeOneofCase_ == LargeOneofOneofCase.A4 ? (global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A4; + } + } + + /// <summary>Field number for the "a5" field.</summary> + public const int A5FieldNumber = 5; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5 A5 { + get { return largeOneofCase_ == LargeOneofOneofCase.A5 ? (global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A5; + } + } + + private object largeOneof_; + /// <summary>Enum of possible cases for the "large_oneof" oneof.</summary> + public enum LargeOneofOneofCase { + None = 0, + A1 = 1, + A2 = 2, + A3 = 3, + A4 = 4, + A5 = 5, + } + private LargeOneofOneofCase largeOneofCase_ = LargeOneofOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LargeOneofOneofCase LargeOneofCase { + get { return largeOneofCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearLargeOneof() { + largeOneofCase_ = LargeOneofOneofCase.None; + largeOneof_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TestLargeOneof); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TestLargeOneof other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(A1, other.A1)) return false; + if (!object.Equals(A2, other.A2)) return false; + if (!object.Equals(A3, other.A3)) return false; + if (!object.Equals(A4, other.A4)) return false; + if (!object.Equals(A5, other.A5)) return false; + if (LargeOneofCase != other.LargeOneofCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (largeOneofCase_ == LargeOneofOneofCase.A1) hash ^= A1.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A2) hash ^= A2.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A3) hash ^= A3.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A4) hash ^= A4.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A5) hash ^= A5.GetHashCode(); + hash ^= (int) largeOneofCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + output.WriteRawTag(10); + output.WriteMessage(A1); + } + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + output.WriteRawTag(18); + output.WriteMessage(A2); + } + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + output.WriteRawTag(26); + output.WriteMessage(A3); + } + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + output.WriteRawTag(34); + output.WriteMessage(A4); + } + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + output.WriteRawTag(42); + output.WriteMessage(A5); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + output.WriteRawTag(10); + output.WriteMessage(A1); + } + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + output.WriteRawTag(18); + output.WriteMessage(A2); + } + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + output.WriteRawTag(26); + output.WriteMessage(A3); + } + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + output.WriteRawTag(34); + output.WriteMessage(A4); + } + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + output.WriteRawTag(42); + output.WriteMessage(A5); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A1); + } + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A2); + } + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A3); + } + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A4); + } + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A5); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TestLargeOneof other) { + if (other == null) { + return; + } + switch (other.LargeOneofCase) { + case LargeOneofOneofCase.A1: + if (A1 == null) { + A1 = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1(); + } + A1.MergeFrom(other.A1); + break; + case LargeOneofOneofCase.A2: + if (A2 == null) { + A2 = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2(); + } + A2.MergeFrom(other.A2); + break; + case LargeOneofOneofCase.A3: + if (A3 == null) { + A3 = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3(); + } + A3.MergeFrom(other.A3); + break; + case LargeOneofOneofCase.A4: + if (A4 == null) { + A4 = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4(); + } + A4.MergeFrom(other.A4); + break; + case LargeOneofOneofCase.A5: + if (A5 == null) { + A5 = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5(); + } + A5.MergeFrom(other.A5); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1(); + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + subBuilder.MergeFrom(A1); + } + input.ReadMessage(subBuilder); + A1 = subBuilder; + break; + } + case 18: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2(); + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + subBuilder.MergeFrom(A2); + } + input.ReadMessage(subBuilder); + A2 = subBuilder; + break; + } + case 26: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3(); + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + subBuilder.MergeFrom(A3); + } + input.ReadMessage(subBuilder); + A3 = subBuilder; + break; + } + case 34: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4(); + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + subBuilder.MergeFrom(A4); + } + input.ReadMessage(subBuilder); + A4 = subBuilder; + break; + } + case 42: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5(); + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + subBuilder.MergeFrom(A5); + } + input.ReadMessage(subBuilder); + A5 = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A1(); + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + subBuilder.MergeFrom(A1); + } + input.ReadMessage(subBuilder); + A1 = subBuilder; + break; + } + case 18: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A2(); + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + subBuilder.MergeFrom(A2); + } + input.ReadMessage(subBuilder); + A2 = subBuilder; + break; + } + case 26: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A3(); + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + subBuilder.MergeFrom(A3); + } + input.ReadMessage(subBuilder); + A3 = subBuilder; + break; + } + case 34: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A4(); + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + subBuilder.MergeFrom(A4); + } + input.ReadMessage(subBuilder); + A4 = subBuilder; + break; + } + case 42: { + global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5 subBuilder = new global::ProtobufTestMessages.Proto2.TestLargeOneof.Types.A5(); + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + subBuilder.MergeFrom(A5); + } + input.ReadMessage(subBuilder); + A5 = subBuilder; + break; + } + } + } + } + #endif + + #region Nested types + /// <summary>Container for nested types declared in the TestLargeOneof message type.</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A1 : pb::IMessage<A1> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A1> _parser = new pb::MessageParser<A1>(() => new A1()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A1> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto2.TestLargeOneof.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A1() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A1(A1 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A1 Clone() { + return new A1(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A1); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A1 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A1 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A2 : pb::IMessage<A2> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A2> _parser = new pb::MessageParser<A2>(() => new A2()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A2> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto2.TestLargeOneof.Descriptor.NestedTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A2() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A2(A2 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A2 Clone() { + return new A2(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A2); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A2 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A2 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A3 : pb::IMessage<A3> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A3> _parser = new pb::MessageParser<A3>(() => new A3()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A3> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto2.TestLargeOneof.Descriptor.NestedTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A3() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A3(A3 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A3 Clone() { + return new A3(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A3); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A3 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A3 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A4 : pb::IMessage<A4> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A4> _parser = new pb::MessageParser<A4>(() => new A4()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A4> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto2.TestLargeOneof.Descriptor.NestedTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A4() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A4(A4 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A4 Clone() { + return new A4(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A4); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A4 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A4 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A5 : pb::IMessage<A5> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A5> _parser = new pb::MessageParser<A5>(() => new A5()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A5> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto2.TestLargeOneof.Descriptor.NestedTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A5() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A5(A5 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A5 Clone() { + return new A5(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A5); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A5 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A5 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + } + #endregion + + } + #endregion } diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs index 447357b526790..2a5015be4658d 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs @@ -295,16 +295,26 @@ namespace ProtobufTestMessages.Editions.Proto2 { "Xi5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLmVkaXRpb25zLnByb3RvMi5UZXN0", "QWxsUmVxdWlyZWRUeXBlc1Byb3RvMi5NZXNzYWdlU2V0Q29ycmVjdEV4dGVu", "c2lvbjIiOQoKTmVzdGVkRW51bRIHCgNGT08QABIHCgNCQVIQARIHCgNCQVoQ", - "AhIQCgNORUcQ////////////ASoFCHgQyQFKBgjoBxCQTipGChFGb3JlaWdu", - "RW51bVByb3RvMhIPCgtGT1JFSUdOX0ZPTxAAEg8KC0ZPUkVJR05fQkFSEAES", - "DwoLRk9SRUlHTl9CQVoQAjpTCg9leHRlbnNpb25faW50MzISOi5wcm90b2J1", - "Zl90ZXN0X21lc3NhZ2VzLmVkaXRpb25zLnByb3RvMi5UZXN0QWxsVHlwZXNQ", - "cm90bzIYeCABKAU6iQEKCmdyb3VwZmllbGQSOi5wcm90b2J1Zl90ZXN0X21l", - "c3NhZ2VzLmVkaXRpb25zLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIYeSAB", - "KAsyMi5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLmVkaXRpb25zLnByb3RvMi5H", - "cm91cEZpZWxkQgWqAQIoAkJSCjFjb20uZ29vZ2xlLnByb3RvYnVmX3Rlc3Rf", - "bWVzc2FnZXMuZWRpdGlvbnMucHJvdG8ySAH4AQGiAg5FZGl0aW9uc1Byb3Rv", - "MpIDBhACGAIgA2IIZWRpdGlvbnNw6Ac=")); + "AhIQCgNORUcQ////////////ASoFCHgQyQFKBgjoBxCQTiKqAwoOVGVzdExh", + "cmdlT25lb2YSRwoCYTEYASABKAsyOS5wcm90b2J1Zl90ZXN0X21lc3NhZ2Vz", + "LmVkaXRpb25zLnByb3RvMi5UZXN0TGFyZ2VPbmVvZi5BMUgAEkcKAmEyGAIg", + "ASgLMjkucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5lZGl0aW9ucy5wcm90bzIu", + "VGVzdExhcmdlT25lb2YuQTJIABJHCgJhMxgDIAEoCzI5LnByb3RvYnVmX3Rl", + "c3RfbWVzc2FnZXMuZWRpdGlvbnMucHJvdG8yLlRlc3RMYXJnZU9uZW9mLkEz", + "SAASRwoCYTQYBCABKAsyOS5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLmVkaXRp", + "b25zLnByb3RvMi5UZXN0TGFyZ2VPbmVvZi5BNEgAEkcKAmE1GAUgASgLMjku", + "cHJvdG9idWZfdGVzdF9tZXNzYWdlcy5lZGl0aW9ucy5wcm90bzIuVGVzdExh", + "cmdlT25lb2YuQTVIABoECgJBMRoECgJBMhoECgJBMxoECgJBNBoECgJBNUIN", + "CgtsYXJnZV9vbmVvZipGChFGb3JlaWduRW51bVByb3RvMhIPCgtGT1JFSUdO", + "X0ZPTxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAjpTCg9l", + "eHRlbnNpb25faW50MzISOi5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLmVkaXRp", + "b25zLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIYeCABKAU6iQEKCmdyb3Vw", + "ZmllbGQSOi5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLmVkaXRpb25zLnByb3Rv", + "Mi5UZXN0QWxsVHlwZXNQcm90bzIYeSABKAsyMi5wcm90b2J1Zl90ZXN0X21l", + "c3NhZ2VzLmVkaXRpb25zLnByb3RvMi5Hcm91cEZpZWxkQgWqAQIoAkJSCjFj", + "b20uZ29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMuZWRpdGlvbnMucHJv", + "dG8ySAH4AQGiAg5FZGl0aW9uc1Byb3RvMpIDBhACGAIgA2IIZWRpdGlvbnNw", + "6Ac=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Editions.Proto2.ForeignEnumProto2), }, new pb::Extension[] { TestMessagesProto2EditionsExtensions.ExtensionInt32, TestMessagesProto2EditionsExtensions.GroupField }, new pbr::GeneratedClrTypeInfo[] { @@ -325,7 +335,12 @@ namespace ProtobufTestMessages.Editions.Proto2 { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.Data), global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.Data.Parser, new[]{ "GroupInt32", "GroupUint32" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrect), global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrect.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension1), global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension1.Parser, new[]{ "Str" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension1.Extensions.MessageSetExtension }, null), - new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2), global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Parser, new[]{ "I" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Extensions.MessageSetExtension }, null)}) + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2), global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Parser, new[]{ "I" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Editions.Proto2.TestAllRequiredTypesProto2.Types.MessageSetCorrectExtension2.Extensions.MessageSetExtension }, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof), global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Parser, new[]{ "A1", "A2", "A3", "A4", "A5" }, new[]{ "LargeOneof" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1), global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2), global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3), global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4), global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5), global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5.Parser, null, null, null, null, null)}) })); } #endregion @@ -12853,6 +12868,1272 @@ namespace ProtobufTestMessages.Editions.Proto2 { } + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class TestLargeOneof : pb::IMessage<TestLargeOneof> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<TestLargeOneof> _parser = new pb::MessageParser<TestLargeOneof>(() => new TestLargeOneof()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<TestLargeOneof> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Editions.Proto2.TestMessagesProto2EditionsReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TestLargeOneof() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TestLargeOneof(TestLargeOneof other) : this() { + switch (other.LargeOneofCase) { + case LargeOneofOneofCase.A1: + A1 = other.A1.Clone(); + break; + case LargeOneofOneofCase.A2: + A2 = other.A2.Clone(); + break; + case LargeOneofOneofCase.A3: + A3 = other.A3.Clone(); + break; + case LargeOneofOneofCase.A4: + A4 = other.A4.Clone(); + break; + case LargeOneofOneofCase.A5: + A5 = other.A5.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TestLargeOneof Clone() { + return new TestLargeOneof(this); + } + + /// <summary>Field number for the "a1" field.</summary> + public const int A1FieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1 A1 { + get { return largeOneofCase_ == LargeOneofOneofCase.A1 ? (global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A1; + } + } + + /// <summary>Field number for the "a2" field.</summary> + public const int A2FieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2 A2 { + get { return largeOneofCase_ == LargeOneofOneofCase.A2 ? (global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A2; + } + } + + /// <summary>Field number for the "a3" field.</summary> + public const int A3FieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3 A3 { + get { return largeOneofCase_ == LargeOneofOneofCase.A3 ? (global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A3; + } + } + + /// <summary>Field number for the "a4" field.</summary> + public const int A4FieldNumber = 4; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4 A4 { + get { return largeOneofCase_ == LargeOneofOneofCase.A4 ? (global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A4; + } + } + + /// <summary>Field number for the "a5" field.</summary> + public const int A5FieldNumber = 5; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5 A5 { + get { return largeOneofCase_ == LargeOneofOneofCase.A5 ? (global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5) largeOneof_ : null; } + set { + largeOneof_ = value; + largeOneofCase_ = value == null ? LargeOneofOneofCase.None : LargeOneofOneofCase.A5; + } + } + + private object largeOneof_; + /// <summary>Enum of possible cases for the "large_oneof" oneof.</summary> + public enum LargeOneofOneofCase { + None = 0, + A1 = 1, + A2 = 2, + A3 = 3, + A4 = 4, + A5 = 5, + } + private LargeOneofOneofCase largeOneofCase_ = LargeOneofOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LargeOneofOneofCase LargeOneofCase { + get { return largeOneofCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearLargeOneof() { + largeOneofCase_ = LargeOneofOneofCase.None; + largeOneof_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TestLargeOneof); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TestLargeOneof other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(A1, other.A1)) return false; + if (!object.Equals(A2, other.A2)) return false; + if (!object.Equals(A3, other.A3)) return false; + if (!object.Equals(A4, other.A4)) return false; + if (!object.Equals(A5, other.A5)) return false; + if (LargeOneofCase != other.LargeOneofCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (largeOneofCase_ == LargeOneofOneofCase.A1) hash ^= A1.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A2) hash ^= A2.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A3) hash ^= A3.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A4) hash ^= A4.GetHashCode(); + if (largeOneofCase_ == LargeOneofOneofCase.A5) hash ^= A5.GetHashCode(); + hash ^= (int) largeOneofCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + output.WriteRawTag(10); + output.WriteMessage(A1); + } + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + output.WriteRawTag(18); + output.WriteMessage(A2); + } + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + output.WriteRawTag(26); + output.WriteMessage(A3); + } + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + output.WriteRawTag(34); + output.WriteMessage(A4); + } + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + output.WriteRawTag(42); + output.WriteMessage(A5); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + output.WriteRawTag(10); + output.WriteMessage(A1); + } + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + output.WriteRawTag(18); + output.WriteMessage(A2); + } + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + output.WriteRawTag(26); + output.WriteMessage(A3); + } + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + output.WriteRawTag(34); + output.WriteMessage(A4); + } + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + output.WriteRawTag(42); + output.WriteMessage(A5); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A1); + } + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A2); + } + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A3); + } + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A4); + } + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(A5); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TestLargeOneof other) { + if (other == null) { + return; + } + switch (other.LargeOneofCase) { + case LargeOneofOneofCase.A1: + if (A1 == null) { + A1 = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1(); + } + A1.MergeFrom(other.A1); + break; + case LargeOneofOneofCase.A2: + if (A2 == null) { + A2 = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2(); + } + A2.MergeFrom(other.A2); + break; + case LargeOneofOneofCase.A3: + if (A3 == null) { + A3 = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3(); + } + A3.MergeFrom(other.A3); + break; + case LargeOneofOneofCase.A4: + if (A4 == null) { + A4 = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4(); + } + A4.MergeFrom(other.A4); + break; + case LargeOneofOneofCase.A5: + if (A5 == null) { + A5 = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5(); + } + A5.MergeFrom(other.A5); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1(); + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + subBuilder.MergeFrom(A1); + } + input.ReadMessage(subBuilder); + A1 = subBuilder; + break; + } + case 18: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2(); + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + subBuilder.MergeFrom(A2); + } + input.ReadMessage(subBuilder); + A2 = subBuilder; + break; + } + case 26: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3(); + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + subBuilder.MergeFrom(A3); + } + input.ReadMessage(subBuilder); + A3 = subBuilder; + break; + } + case 34: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4(); + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + subBuilder.MergeFrom(A4); + } + input.ReadMessage(subBuilder); + A4 = subBuilder; + break; + } + case 42: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5(); + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + subBuilder.MergeFrom(A5); + } + input.ReadMessage(subBuilder); + A5 = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A1(); + if (largeOneofCase_ == LargeOneofOneofCase.A1) { + subBuilder.MergeFrom(A1); + } + input.ReadMessage(subBuilder); + A1 = subBuilder; + break; + } + case 18: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A2(); + if (largeOneofCase_ == LargeOneofOneofCase.A2) { + subBuilder.MergeFrom(A2); + } + input.ReadMessage(subBuilder); + A2 = subBuilder; + break; + } + case 26: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A3(); + if (largeOneofCase_ == LargeOneofOneofCase.A3) { + subBuilder.MergeFrom(A3); + } + input.ReadMessage(subBuilder); + A3 = subBuilder; + break; + } + case 34: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A4(); + if (largeOneofCase_ == LargeOneofOneofCase.A4) { + subBuilder.MergeFrom(A4); + } + input.ReadMessage(subBuilder); + A4 = subBuilder; + break; + } + case 42: { + global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5 subBuilder = new global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Types.A5(); + if (largeOneofCase_ == LargeOneofOneofCase.A5) { + subBuilder.MergeFrom(A5); + } + input.ReadMessage(subBuilder); + A5 = subBuilder; + break; + } + } + } + } + #endif + + #region Nested types + /// <summary>Container for nested types declared in the TestLargeOneof message type.</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A1 : pb::IMessage<A1> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A1> _parser = new pb::MessageParser<A1>(() => new A1()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A1> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A1() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A1(A1 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A1 Clone() { + return new A1(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A1); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A1 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A1 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A2 : pb::IMessage<A2> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A2> _parser = new pb::MessageParser<A2>(() => new A2()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A2> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Descriptor.NestedTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A2() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A2(A2 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A2 Clone() { + return new A2(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A2); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A2 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A2 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A3 : pb::IMessage<A3> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A3> _parser = new pb::MessageParser<A3>(() => new A3()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A3> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Descriptor.NestedTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A3() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A3(A3 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A3 Clone() { + return new A3(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A3); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A3 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A3 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A4 : pb::IMessage<A4> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A4> _parser = new pb::MessageParser<A4>(() => new A4()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A4> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Descriptor.NestedTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A4() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A4(A4 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A4 Clone() { + return new A4(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A4); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A4 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A4 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class A5 : pb::IMessage<A5> + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser<A5> _parser = new pb::MessageParser<A5>(() => new A5()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser<A5> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Editions.Proto2.TestLargeOneof.Descriptor.NestedTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A5() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A5(A5 other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public A5 Clone() { + return new A5(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as A5); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(A5 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(A5 other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + if ((tag & 7) == 4) { + // Abort on any end group tag. + return; + } + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + } + #endregion + + } + #endregion } diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs index e3c4fc7bbd634..318454c01d00c 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs @@ -25,49 +25,48 @@ namespace ProtobufUnittest { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ci5nb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcHJvdG8zX29wdGlvbmFsLnBy", - "b3RvEhFwcm90b2J1Zl91bml0dGVzdBogZ29vZ2xlL3Byb3RvYnVmL2Rlc2Ny", - "aXB0b3IucHJvdG8isQoKElRlc3RQcm90bzNPcHRpb25hbBIbCg5vcHRpb25h", - "bF9pbnQzMhgBIAEoBUgAiAEBEhsKDm9wdGlvbmFsX2ludDY0GAIgASgDSAGI", - "AQESHAoPb3B0aW9uYWxfdWludDMyGAMgASgNSAKIAQESHAoPb3B0aW9uYWxf", - "dWludDY0GAQgASgESAOIAQESHAoPb3B0aW9uYWxfc2ludDMyGAUgASgRSASI", - "AQESHAoPb3B0aW9uYWxfc2ludDY0GAYgASgSSAWIAQESHQoQb3B0aW9uYWxf", - "Zml4ZWQzMhgHIAEoB0gGiAEBEh0KEG9wdGlvbmFsX2ZpeGVkNjQYCCABKAZI", - "B4gBARIeChFvcHRpb25hbF9zZml4ZWQzMhgJIAEoD0gIiAEBEh4KEW9wdGlv", - "bmFsX3NmaXhlZDY0GAogASgQSAmIAQESGwoOb3B0aW9uYWxfZmxvYXQYCyAB", - "KAJICogBARIcCg9vcHRpb25hbF9kb3VibGUYDCABKAFIC4gBARIaCg1vcHRp", - "b25hbF9ib29sGA0gASgISAyIAQESHAoPb3B0aW9uYWxfc3RyaW5nGA4gASgJ", - "SA2IAQESGwoOb3B0aW9uYWxfYnl0ZXMYDyABKAxIDogBARIeCg1vcHRpb25h", - "bF9jb3JkGBAgASgJQgIIAUgPiAEBElkKF29wdGlvbmFsX25lc3RlZF9tZXNz", - "YWdlGBIgASgLMjMucHJvdG9idWZfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlv", - "bmFsLk5lc3RlZE1lc3NhZ2VIEIgBARJZChNsYXp5X25lc3RlZF9tZXNzYWdl", - "GBMgASgLMjMucHJvdG9idWZfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlvbmFs", - "Lk5lc3RlZE1lc3NhZ2VCAigBSBGIAQESUwoUb3B0aW9uYWxfbmVzdGVkX2Vu", - "dW0YFSABKA4yMC5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9u", - "YWwuTmVzdGVkRW51bUgSiAEBEhYKDnNpbmd1bGFyX2ludDMyGBYgASgFEhYK", - "DnNpbmd1bGFyX2ludDY0GBcgASgDGicKDU5lc3RlZE1lc3NhZ2USDwoCYmIY", - "ASABKAVIAIgBAUIFCgNfYmIiSgoKTmVzdGVkRW51bRIPCgtVTlNQRUNJRklF", - "RBAAEgcKA0ZPTxABEgcKA0JBUhACEgcKA0JBWhADEhAKA05FRxD/////////", - "//8BQhEKD19vcHRpb25hbF9pbnQzMkIRCg9fb3B0aW9uYWxfaW50NjRCEgoQ", - "X29wdGlvbmFsX3VpbnQzMkISChBfb3B0aW9uYWxfdWludDY0QhIKEF9vcHRp", - "b25hbF9zaW50MzJCEgoQX29wdGlvbmFsX3NpbnQ2NEITChFfb3B0aW9uYWxf", - "Zml4ZWQzMkITChFfb3B0aW9uYWxfZml4ZWQ2NEIUChJfb3B0aW9uYWxfc2Zp", - "eGVkMzJCFAoSX29wdGlvbmFsX3NmaXhlZDY0QhEKD19vcHRpb25hbF9mbG9h", - "dEISChBfb3B0aW9uYWxfZG91YmxlQhAKDl9vcHRpb25hbF9ib29sQhIKEF9v", - "cHRpb25hbF9zdHJpbmdCEQoPX29wdGlvbmFsX2J5dGVzQhAKDl9vcHRpb25h", - "bF9jb3JkQhoKGF9vcHRpb25hbF9uZXN0ZWRfbWVzc2FnZUIWChRfbGF6eV9u", - "ZXN0ZWRfbWVzc2FnZUIXChVfb3B0aW9uYWxfbmVzdGVkX2VudW0iiQIKGVRl", - "c3RQcm90bzNPcHRpb25hbE1lc3NhZ2USUgoObmVzdGVkX21lc3NhZ2UYASAB", - "KAsyOi5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWxNZXNz", - "YWdlLk5lc3RlZE1lc3NhZ2USYAoXb3B0aW9uYWxfbmVzdGVkX21lc3NhZ2UY", - "AiABKAsyOi5wcm90b2J1Zl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWxN", - "ZXNzYWdlLk5lc3RlZE1lc3NhZ2VIAIgBARoaCg1OZXN0ZWRNZXNzYWdlEgkK", - "AXMYASABKAlCGgoYX29wdGlvbmFsX25lc3RlZF9tZXNzYWdlIqkBChhQcm90", - "bzNPcHRpb25hbEV4dGVuc2lvbnMyPAoPZXh0X25vX29wdGlvbmFsEh8uZ29v", - "Z2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGIjN2akBIAEoBTJBChFleHRf", - "d2l0aF9vcHRpb25hbBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9u", - "cxiJzdmpASABKAWIAQE6DMDozM0KCMjozM0KEEI4CiFjb20uZ29vZ2xlLnBy", - "b3RvYnVmLnRlc3RpbmcucHJvdG9QAaoCEFByb3RvYnVmVW5pdHRlc3RiBnBy", - "b3RvMw==")); + "b3RvEg9wcm90bzJfdW5pdHRlc3QaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlw", + "dG9yLnByb3RvIqsKChJUZXN0UHJvdG8zT3B0aW9uYWwSGwoOb3B0aW9uYWxf", + "aW50MzIYASABKAVIAIgBARIbCg5vcHRpb25hbF9pbnQ2NBgCIAEoA0gBiAEB", + "EhwKD29wdGlvbmFsX3VpbnQzMhgDIAEoDUgCiAEBEhwKD29wdGlvbmFsX3Vp", + "bnQ2NBgEIAEoBEgDiAEBEhwKD29wdGlvbmFsX3NpbnQzMhgFIAEoEUgEiAEB", + "EhwKD29wdGlvbmFsX3NpbnQ2NBgGIAEoEkgFiAEBEh0KEG9wdGlvbmFsX2Zp", + "eGVkMzIYByABKAdIBogBARIdChBvcHRpb25hbF9maXhlZDY0GAggASgGSAeI", + "AQESHgoRb3B0aW9uYWxfc2ZpeGVkMzIYCSABKA9ICIgBARIeChFvcHRpb25h", + "bF9zZml4ZWQ2NBgKIAEoEEgJiAEBEhsKDm9wdGlvbmFsX2Zsb2F0GAsgASgC", + "SAqIAQESHAoPb3B0aW9uYWxfZG91YmxlGAwgASgBSAuIAQESGgoNb3B0aW9u", + "YWxfYm9vbBgNIAEoCEgMiAEBEhwKD29wdGlvbmFsX3N0cmluZxgOIAEoCUgN", + "iAEBEhsKDm9wdGlvbmFsX2J5dGVzGA8gASgMSA6IAQESHgoNb3B0aW9uYWxf", + "Y29yZBgQIAEoCUICCAFID4gBARJXChdvcHRpb25hbF9uZXN0ZWRfbWVzc2Fn", + "ZRgSIAEoCzIxLnByb3RvMl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWwu", + "TmVzdGVkTWVzc2FnZUgQiAEBElcKE2xhenlfbmVzdGVkX21lc3NhZ2UYEyAB", + "KAsyMS5wcm90bzJfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlvbmFsLk5lc3Rl", + "ZE1lc3NhZ2VCAigBSBGIAQESUQoUb3B0aW9uYWxfbmVzdGVkX2VudW0YFSAB", + "KA4yLi5wcm90bzJfdW5pdHRlc3QuVGVzdFByb3RvM09wdGlvbmFsLk5lc3Rl", + "ZEVudW1IEogBARIWCg5zaW5ndWxhcl9pbnQzMhgWIAEoBRIWCg5zaW5ndWxh", + "cl9pbnQ2NBgXIAEoAxonCg1OZXN0ZWRNZXNzYWdlEg8KAmJiGAEgASgFSACI", + "AQFCBQoDX2JiIkoKCk5lc3RlZEVudW0SDwoLVU5TUEVDSUZJRUQQABIHCgNG", + "T08QARIHCgNCQVIQAhIHCgNCQVoQAxIQCgNORUcQ////////////AUIRCg9f", + "b3B0aW9uYWxfaW50MzJCEQoPX29wdGlvbmFsX2ludDY0QhIKEF9vcHRpb25h", + "bF91aW50MzJCEgoQX29wdGlvbmFsX3VpbnQ2NEISChBfb3B0aW9uYWxfc2lu", + "dDMyQhIKEF9vcHRpb25hbF9zaW50NjRCEwoRX29wdGlvbmFsX2ZpeGVkMzJC", + "EwoRX29wdGlvbmFsX2ZpeGVkNjRCFAoSX29wdGlvbmFsX3NmaXhlZDMyQhQK", + "El9vcHRpb25hbF9zZml4ZWQ2NEIRCg9fb3B0aW9uYWxfZmxvYXRCEgoQX29w", + "dGlvbmFsX2RvdWJsZUIQCg5fb3B0aW9uYWxfYm9vbEISChBfb3B0aW9uYWxf", + "c3RyaW5nQhEKD19vcHRpb25hbF9ieXRlc0IQCg5fb3B0aW9uYWxfY29yZEIa", + "Chhfb3B0aW9uYWxfbmVzdGVkX21lc3NhZ2VCFgoUX2xhenlfbmVzdGVkX21l", + "c3NhZ2VCFwoVX29wdGlvbmFsX25lc3RlZF9lbnVtIoUCChlUZXN0UHJvdG8z", + "T3B0aW9uYWxNZXNzYWdlElAKDm5lc3RlZF9tZXNzYWdlGAEgASgLMjgucHJv", + "dG8yX3VuaXR0ZXN0LlRlc3RQcm90bzNPcHRpb25hbE1lc3NhZ2UuTmVzdGVk", + "TWVzc2FnZRJeChdvcHRpb25hbF9uZXN0ZWRfbWVzc2FnZRgCIAEoCzI4LnBy", + "b3RvMl91bml0dGVzdC5UZXN0UHJvdG8zT3B0aW9uYWxNZXNzYWdlLk5lc3Rl", + "ZE1lc3NhZ2VIAIgBARoaCg1OZXN0ZWRNZXNzYWdlEgkKAXMYASABKAlCGgoY", + "X29wdGlvbmFsX25lc3RlZF9tZXNzYWdlIqkBChhQcm90bzNPcHRpb25hbEV4", + "dGVuc2lvbnMyPAoPZXh0X25vX29wdGlvbmFsEh8uZ29vZ2xlLnByb3RvYnVm", + "Lk1lc3NhZ2VPcHRpb25zGIjN2akBIAEoBTJBChFleHRfd2l0aF9vcHRpb25h", + "bBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxiJzdmpASABKAWI", + "AQE6DMDozM0KCMjozM0KEEI4CiFjb20uZ29vZ2xlLnByb3RvYnVmLnRlc3Rp", + "bmcucHJvdG9QAaoCEFByb3RvYnVmVW5pdHRlc3RiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs index af7157a171da9..c2d24652cbfd8 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestRetention.pb.cs @@ -24,49 +24,48 @@ namespace ProtobufUnittest { static UnittestRetentionReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cihnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcmV0ZW50aW9uLnByb3RvEhFw", - "cm90b2J1Zl91bml0dGVzdBogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3Iu", - "cHJvdG8icAoOT3B0aW9uc01lc3NhZ2USEwoLcGxhaW5fZmllbGQYASABKAUS", - "JAoXcnVudGltZV9yZXRlbnRpb25fZmllbGQYAiABKAVCA4gBARIjChZzb3Vy", - "Y2VfcmV0ZW50aW9uX2ZpZWxkGAMgASgFQgOIAQIiFgoIRXh0ZW5kZWUqBAgB", - "EAIqBAgCEAMi4wEKD1RvcExldmVsTWVzc2FnZRIVCgFmGAEgASgCQgqauu2E", - "DwQIARACEgsKAWkYAiABKANIABobCg1OZXN0ZWRNZXNzYWdlOgqaxd6FDwQI", - "ARACIiwKCk5lc3RlZEVudW0SEgoOTkVTVEVEX1VOS05PV04QABoK+p6qhA8E", - "CAEQAioQCAoQZRoKopjfhQ8ECAEQAjIyCgFzEhsucHJvdG9idWZfdW5pdHRl", - "c3QuRXh0ZW5kZWUYAiABKAlCCpq67YQPBAgBEAI6CprF3oUPBAgBEAJCDwoB", - "bxIKitu3hA8ECAEQAio9CgxUb3BMZXZlbEVudW0SIQoRVE9QX0xFVkVMX1VO", - "S05PV04QABoK0t2phA8ECAEQAhoK+p6qhA8ECAEQAjJ0CgdTZXJ2aWNlEl0K", - "B0RvU3R1ZmYSIi5wcm90b2J1Zl91bml0dGVzdC5Ub3BMZXZlbE1lc3NhZ2Ua", - "Ii5wcm90b2J1Zl91bml0dGVzdC5Ub3BMZXZlbE1lc3NhZ2UiCuKu+IMPBAgB", - "EAIaCuqHi4QPBAgBEAI6NgoMcGxhaW5fb3B0aW9uEhwuZ29vZ2xlLnByb3Rv", - "YnVmLkZpbGVPcHRpb25zGMa17PABIAEoBTpHChhydW50aW1lX3JldGVudGlv", - "bl9vcHRpb24SHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMYnJLp8AEg", - "ASgFQgOIAQE6RgoXc291cmNlX3JldGVudGlvbl9vcHRpb24SHC5nb29nbGUu", - "cHJvdG9idWYuRmlsZU9wdGlvbnMY1Kzf8AEgASgFQgOIAQI6WAoLZmlsZV9v", - "cHRpb24SHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMYgPLe8AEgASgL", - "MiEucHJvdG9idWZfdW5pdHRlc3QuT3B0aW9uc01lc3NhZ2U6XQoQcmVwZWF0", - "ZWRfb3B0aW9ucxIcLmdvb2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucxiS/tvw", - "ASADKAsyIS5wcm90b2J1Zl91bml0dGVzdC5PcHRpb25zTWVzc2FnZTptChZl", - "eHRlbnNpb25fcmFuZ2Vfb3B0aW9uEiYuZ29vZ2xlLnByb3RvYnVmLkV4dGVu", - "c2lvblJhbmdlT3B0aW9ucxiE89vwASABKAsyIS5wcm90b2J1Zl91bml0dGVz", - "dC5PcHRpb25zTWVzc2FnZTpeCg5tZXNzYWdlX29wdGlvbhIfLmdvb2dsZS5w", - "cm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjT6NvwASABKAsyIS5wcm90b2J1Zl91", - "bml0dGVzdC5PcHRpb25zTWVzc2FnZTpaCgxmaWVsZF9vcHRpb24SHS5nb29n", - "bGUucHJvdG9idWYuRmllbGRPcHRpb25zGKPXzfABIAEoCzIhLnByb3RvYnVm", - "X3VuaXR0ZXN0Lk9wdGlvbnNNZXNzYWdlOloKDG9uZW9mX29wdGlvbhIdLmdv", - "b2dsZS5wcm90b2J1Zi5PbmVvZk9wdGlvbnMYsfvG8AEgASgLMiEucHJvdG9i", - "dWZfdW5pdHRlc3QuT3B0aW9uc01lc3NhZ2U6WAoLZW51bV9vcHRpb24SHC5n", - "b29nbGUucHJvdG9idWYuRW51bU9wdGlvbnMY76PF8AEgASgLMiEucHJvdG9i", - "dWZfdW5pdHRlc3QuT3B0aW9uc01lc3NhZ2U6YwoRZW51bV9lbnRyeV9vcHRp", - "b24SIS5nb29nbGUucHJvdG9idWYuRW51bVZhbHVlT3B0aW9ucxjam8XwASAB", - "KAsyIS5wcm90b2J1Zl91bml0dGVzdC5PcHRpb25zTWVzc2FnZTpeCg5zZXJ2", - "aWNlX29wdGlvbhIfLmdvb2dsZS5wcm90b2J1Zi5TZXJ2aWNlT3B0aW9ucxj9", - "sMHwASABKAsyIS5wcm90b2J1Zl91bml0dGVzdC5PcHRpb25zTWVzc2FnZTpc", - "Cg1tZXRob2Rfb3B0aW9uEh4uZ29vZ2xlLnByb3RvYnVmLk1ldGhvZE9wdGlv", - "bnMY7IW/8AEgASgLMiEucHJvdG9idWZfdW5pdHRlc3QuT3B0aW9uc01lc3Nh", - "Z2U6MgoBaRIbLnByb3RvYnVmX3VuaXR0ZXN0LkV4dGVuZGVlGAEgASgFQgqa", - "uu2EDwQIARACQjOqAhBQcm90b2J1ZlVuaXR0ZXN0kvHfhQ8ECAEQAoKQ94UP", - "BAgBEALgkcmGDwKwrOOGDwE=")); + "Cihnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcmV0ZW50aW9uLnByb3RvEg9w", + "cm90bzJfdW5pdHRlc3QaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlwdG9yLnBy", + "b3RvInAKDk9wdGlvbnNNZXNzYWdlEhMKC3BsYWluX2ZpZWxkGAEgASgFEiQK", + "F3J1bnRpbWVfcmV0ZW50aW9uX2ZpZWxkGAIgASgFQgOIAQESIwoWc291cmNl", + "X3JldGVudGlvbl9maWVsZBgDIAEoBUIDiAECIhYKCEV4dGVuZGVlKgQIARAC", + "KgQIAhADIuEBCg9Ub3BMZXZlbE1lc3NhZ2USFQoBZhgBIAEoAkIKmrrthA8E", + "CAEQAhILCgFpGAIgASgDSAAaGwoNTmVzdGVkTWVzc2FnZToKmsXehQ8ECAEQ", + "AiIsCgpOZXN0ZWRFbnVtEhIKDk5FU1RFRF9VTktOT1dOEAAaCvqeqoQPBAgB", + "EAIqEAgKEGUaCqKY34UPBAgBEAIyMAoBcxIZLnByb3RvMl91bml0dGVzdC5F", + "eHRlbmRlZRgCIAEoCUIKmrrthA8ECAEQAjoKmsXehQ8ECAEQAkIPCgFvEgqK", + "27eEDwQIARACKj0KDFRvcExldmVsRW51bRIhChFUT1BfTEVWRUxfVU5LTk9X", + "ThAAGgrS3amEDwQIARACGgr6nqqEDwQIARACMnAKB1NlcnZpY2USWQoHRG9T", + "dHVmZhIgLnByb3RvMl91bml0dGVzdC5Ub3BMZXZlbE1lc3NhZ2UaIC5wcm90", + "bzJfdW5pdHRlc3QuVG9wTGV2ZWxNZXNzYWdlIgrirviDDwQIARACGgrqh4uE", + "DwQIARACOjYKDHBsYWluX29wdGlvbhIcLmdvb2dsZS5wcm90b2J1Zi5GaWxl", + "T3B0aW9ucxjGtezwASABKAU6RwoYcnVudGltZV9yZXRlbnRpb25fb3B0aW9u", + "EhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGJyS6fABIAEoBUIDiAEB", + "OkYKF3NvdXJjZV9yZXRlbnRpb25fb3B0aW9uEhwuZ29vZ2xlLnByb3RvYnVm", + "LkZpbGVPcHRpb25zGNSs3/ABIAEoBUIDiAECOlYKC2ZpbGVfb3B0aW9uEhwu", + "Z29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGIDy3vABIAEoCzIfLnByb3Rv", + "Ml91bml0dGVzdC5PcHRpb25zTWVzc2FnZTpbChByZXBlYXRlZF9vcHRpb25z", + "EhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGJL+2/ABIAMoCzIfLnBy", + "b3RvMl91bml0dGVzdC5PcHRpb25zTWVzc2FnZTprChZleHRlbnNpb25fcmFu", + "Z2Vfb3B0aW9uEiYuZ29vZ2xlLnByb3RvYnVmLkV4dGVuc2lvblJhbmdlT3B0", + "aW9ucxiE89vwASABKAsyHy5wcm90bzJfdW5pdHRlc3QuT3B0aW9uc01lc3Nh", + "Z2U6XAoObWVzc2FnZV9vcHRpb24SHy5nb29nbGUucHJvdG9idWYuTWVzc2Fn", + "ZU9wdGlvbnMY0+jb8AEgASgLMh8ucHJvdG8yX3VuaXR0ZXN0Lk9wdGlvbnNN", + "ZXNzYWdlOlgKDGZpZWxkX29wdGlvbhIdLmdvb2dsZS5wcm90b2J1Zi5GaWVs", + "ZE9wdGlvbnMYo9fN8AEgASgLMh8ucHJvdG8yX3VuaXR0ZXN0Lk9wdGlvbnNN", + "ZXNzYWdlOlgKDG9uZW9mX29wdGlvbhIdLmdvb2dsZS5wcm90b2J1Zi5PbmVv", + "Zk9wdGlvbnMYsfvG8AEgASgLMh8ucHJvdG8yX3VuaXR0ZXN0Lk9wdGlvbnNN", + "ZXNzYWdlOlYKC2VudW1fb3B0aW9uEhwuZ29vZ2xlLnByb3RvYnVmLkVudW1P", + "cHRpb25zGO+jxfABIAEoCzIfLnByb3RvMl91bml0dGVzdC5PcHRpb25zTWVz", + "c2FnZTphChFlbnVtX2VudHJ5X29wdGlvbhIhLmdvb2dsZS5wcm90b2J1Zi5F", + "bnVtVmFsdWVPcHRpb25zGNqbxfABIAEoCzIfLnByb3RvMl91bml0dGVzdC5P", + "cHRpb25zTWVzc2FnZTpcCg5zZXJ2aWNlX29wdGlvbhIfLmdvb2dsZS5wcm90", + "b2J1Zi5TZXJ2aWNlT3B0aW9ucxj9sMHwASABKAsyHy5wcm90bzJfdW5pdHRl", + "c3QuT3B0aW9uc01lc3NhZ2U6WgoNbWV0aG9kX29wdGlvbhIeLmdvb2dsZS5w", + "cm90b2J1Zi5NZXRob2RPcHRpb25zGOyFv/ABIAEoCzIfLnByb3RvMl91bml0", + "dGVzdC5PcHRpb25zTWVzc2FnZTowCgFpEhkucHJvdG8yX3VuaXR0ZXN0LkV4", + "dGVuZGVlGAEgASgFQgqauu2EDwQIARACQjOqAhBQcm90b2J1ZlVuaXR0ZXN0", + "kvHfhQ8ECAEQAoKQ94UPBAgBEALgkcmGDwKwrOOGDwE=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufUnittest.TopLevelEnum), }, new pb::Extension[] { UnittestRetentionExtensions.PlainOption, UnittestRetentionExtensions.RuntimeRetentionOption, UnittestRetentionExtensions.SourceRetentionOption, UnittestRetentionExtensions.FileOption, UnittestRetentionExtensions.RepeatedOptions, UnittestRetentionExtensions.ExtensionRangeOption, UnittestRetentionExtensions.MessageOption, UnittestRetentionExtensions.FieldOption, UnittestRetentionExtensions.OneofOption, UnittestRetentionExtensions.EnumOption, UnittestRetentionExtensions.EnumEntryOption, UnittestRetentionExtensions.ServiceOption, UnittestRetentionExtensions.MethodOption, UnittestRetentionExtensions.I }, new pbr::GeneratedClrTypeInfo[] { diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs index 6fd9bde477eca..fc0bb9bf82665 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs @@ -25,142 +25,141 @@ namespace Google.Protobuf.TestProtos { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ci9nb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfd2VsbF9rbm93bl90eXBlcy5w", - "cm90bxIRcHJvdG9idWZfdW5pdHRlc3QaGWdvb2dsZS9wcm90b2J1Zi9hbnku", - "cHJvdG8aGWdvb2dsZS9wcm90b2J1Zi9hcGkucHJvdG8aHmdvb2dsZS9wcm90", - "b2J1Zi9kdXJhdGlvbi5wcm90bxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnBy", - "b3RvGiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxokZ29vZ2xl", - "L3Byb3RvYnVmL3NvdXJjZV9jb250ZXh0LnByb3RvGhxnb29nbGUvcHJvdG9i", - "dWYvc3RydWN0LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnBy", - "b3RvGhpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxoeZ29vZ2xlL3Byb3Rv", - "YnVmL3dyYXBwZXJzLnByb3RvIr4HChJUZXN0V2VsbEtub3duVHlwZXMSJwoJ", - "YW55X2ZpZWxkGAEgASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFueRInCglhcGlf", - "ZmllbGQYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQXBpEjEKDmR1cmF0aW9u", - "X2ZpZWxkGAMgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uEisKC2Vt", - "cHR5X2ZpZWxkGAQgASgLMhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5EjQKEGZp", - "ZWxkX21hc2tfZmllbGQYBSABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRN", - "YXNrEjwKFHNvdXJjZV9jb250ZXh0X2ZpZWxkGAYgASgLMh4uZ29vZ2xlLnBy", - "b3RvYnVmLlNvdXJjZUNvbnRleHQSLQoMc3RydWN0X2ZpZWxkGAcgASgLMhcu", - "Z29vZ2xlLnByb3RvYnVmLlN0cnVjdBIzCg90aW1lc3RhbXBfZmllbGQYCCAB", - "KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEikKCnR5cGVfZmllbGQY", - "CSABKAsyFS5nb29nbGUucHJvdG9idWYuVHlwZRIyCgxkb3VibGVfZmllbGQY", - "CiABKAsyHC5nb29nbGUucHJvdG9idWYuRG91YmxlVmFsdWUSMAoLZmxvYXRf", - "ZmllbGQYCyABKAsyGy5nb29nbGUucHJvdG9idWYuRmxvYXRWYWx1ZRIwCgtp", - "bnQ2NF9maWVsZBgMIAEoCzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVl", - "EjIKDHVpbnQ2NF9maWVsZBgNIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50", - "NjRWYWx1ZRIwCgtpbnQzMl9maWVsZBgOIAEoCzIbLmdvb2dsZS5wcm90b2J1", - "Zi5JbnQzMlZhbHVlEjIKDHVpbnQzMl9maWVsZBgPIAEoCzIcLmdvb2dsZS5w", - "cm90b2J1Zi5VSW50MzJWYWx1ZRIuCgpib29sX2ZpZWxkGBAgASgLMhouZ29v", - "Z2xlLnByb3RvYnVmLkJvb2xWYWx1ZRIyCgxzdHJpbmdfZmllbGQYESABKAsy", - "HC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUSMAoLYnl0ZXNfZmllbGQY", - "EiABKAsyGy5nb29nbGUucHJvdG9idWYuQnl0ZXNWYWx1ZRIrCgt2YWx1ZV9m", - "aWVsZBgTIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSKVBwoWUmVwZWF0", - "ZWRXZWxsS25vd25UeXBlcxInCglhbnlfZmllbGQYASADKAsyFC5nb29nbGUu", - "cHJvdG9idWYuQW55EicKCWFwaV9maWVsZBgCIAMoCzIULmdvb2dsZS5wcm90", - "b2J1Zi5BcGkSMQoOZHVyYXRpb25fZmllbGQYAyADKAsyGS5nb29nbGUucHJv", - "dG9idWYuRHVyYXRpb24SKwoLZW1wdHlfZmllbGQYBCADKAsyFi5nb29nbGUu", - "cHJvdG9idWYuRW1wdHkSNAoQZmllbGRfbWFza19maWVsZBgFIAMoCzIaLmdv", - "b2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sSPAoUc291cmNlX2NvbnRleHRfZmll", - "bGQYBiADKAsyHi5nb29nbGUucHJvdG9idWYuU291cmNlQ29udGV4dBItCgxz", - "dHJ1Y3RfZmllbGQYByADKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0EjMK", - "D3RpbWVzdGFtcF9maWVsZBgIIAMoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1l", - "c3RhbXASKQoKdHlwZV9maWVsZBgJIAMoCzIVLmdvb2dsZS5wcm90b2J1Zi5U", - "eXBlEjIKDGRvdWJsZV9maWVsZBgKIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5E", - "b3VibGVWYWx1ZRIwCgtmbG9hdF9maWVsZBgLIAMoCzIbLmdvb2dsZS5wcm90", - "b2J1Zi5GbG9hdFZhbHVlEjAKC2ludDY0X2ZpZWxkGAwgAygLMhsuZ29vZ2xl", - "LnByb3RvYnVmLkludDY0VmFsdWUSMgoMdWludDY0X2ZpZWxkGA0gAygLMhwu", - "Z29vZ2xlLnByb3RvYnVmLlVJbnQ2NFZhbHVlEjAKC2ludDMyX2ZpZWxkGA4g", - "AygLMhsuZ29vZ2xlLnByb3RvYnVmLkludDMyVmFsdWUSMgoMdWludDMyX2Zp", - "ZWxkGA8gAygLMhwuZ29vZ2xlLnByb3RvYnVmLlVJbnQzMlZhbHVlEi4KCmJv", - "b2xfZmllbGQYECADKAsyGi5nb29nbGUucHJvdG9idWYuQm9vbFZhbHVlEjIK", - "DHN0cmluZ19maWVsZBgRIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdW", - "YWx1ZRIwCgtieXRlc19maWVsZBgSIAMoCzIbLmdvb2dsZS5wcm90b2J1Zi5C", - "eXRlc1ZhbHVlIsUHChNPbmVvZldlbGxLbm93blR5cGVzEikKCWFueV9maWVs", - "ZBgBIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnlIABIpCglhcGlfZmllbGQY", - "AiABKAsyFC5nb29nbGUucHJvdG9idWYuQXBpSAASMwoOZHVyYXRpb25fZmll", - "bGQYAyABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb25IABItCgtlbXB0", - "eV9maWVsZBgEIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eUgAEjYKEGZp", - "ZWxkX21hc2tfZmllbGQYBSABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRN", - "YXNrSAASPgoUc291cmNlX2NvbnRleHRfZmllbGQYBiABKAsyHi5nb29nbGUu", - "cHJvdG9idWYuU291cmNlQ29udGV4dEgAEi8KDHN0cnVjdF9maWVsZBgHIAEo", - "CzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIABI1Cg90aW1lc3RhbXBfZmll", - "bGQYCCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSAASKwoKdHlw", - "ZV9maWVsZBgJIAEoCzIVLmdvb2dsZS5wcm90b2J1Zi5UeXBlSAASNAoMZG91", - "YmxlX2ZpZWxkGAogASgLMhwuZ29vZ2xlLnByb3RvYnVmLkRvdWJsZVZhbHVl", - "SAASMgoLZmxvYXRfZmllbGQYCyABKAsyGy5nb29nbGUucHJvdG9idWYuRmxv", - "YXRWYWx1ZUgAEjIKC2ludDY0X2ZpZWxkGAwgASgLMhsuZ29vZ2xlLnByb3Rv", - "YnVmLkludDY0VmFsdWVIABI0Cgx1aW50NjRfZmllbGQYDSABKAsyHC5nb29n", - "bGUucHJvdG9idWYuVUludDY0VmFsdWVIABIyCgtpbnQzMl9maWVsZBgOIAEo", - "CzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVlSAASNAoMdWludDMyX2Zp", - "ZWxkGA8gASgLMhwuZ29vZ2xlLnByb3RvYnVmLlVJbnQzMlZhbHVlSAASMAoK", - "Ym9vbF9maWVsZBgQIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5Cb29sVmFsdWVI", - "ABI0CgxzdHJpbmdfZmllbGQYESABKAsyHC5nb29nbGUucHJvdG9idWYuU3Ry", - "aW5nVmFsdWVIABIyCgtieXRlc19maWVsZBgSIAEoCzIbLmdvb2dsZS5wcm90", - "b2J1Zi5CeXRlc1ZhbHVlSABCDQoLb25lb2ZfZmllbGQilhYKEU1hcFdlbGxL", - "bm93blR5cGVzEkUKCWFueV9maWVsZBgBIAMoCzIyLnByb3RvYnVmX3VuaXR0", - "ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkFueUZpZWxkRW50cnkSRQoJYXBpX2Zp", - "ZWxkGAIgAygLMjIucHJvdG9idWZfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlw", - "ZXMuQXBpRmllbGRFbnRyeRJPCg5kdXJhdGlvbl9maWVsZBgDIAMoCzI3LnBy", - "b3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkR1cmF0aW9uRmll", - "bGRFbnRyeRJJCgtlbXB0eV9maWVsZBgEIAMoCzI0LnByb3RvYnVmX3VuaXR0", - "ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkVtcHR5RmllbGRFbnRyeRJSChBmaWVs", - "ZF9tYXNrX2ZpZWxkGAUgAygLMjgucHJvdG9idWZfdW5pdHRlc3QuTWFwV2Vs", - "bEtub3duVHlwZXMuRmllbGRNYXNrRmllbGRFbnRyeRJaChRzb3VyY2VfY29u", - "dGV4dF9maWVsZBgGIAMoCzI8LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxL", - "bm93blR5cGVzLlNvdXJjZUNvbnRleHRGaWVsZEVudHJ5EksKDHN0cnVjdF9m", - "aWVsZBgHIAMoCzI1LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5", - "cGVzLlN0cnVjdEZpZWxkRW50cnkSUQoPdGltZXN0YW1wX2ZpZWxkGAggAygL", - "MjgucHJvdG9idWZfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuVGltZXN0", - "YW1wRmllbGRFbnRyeRJHCgp0eXBlX2ZpZWxkGAkgAygLMjMucHJvdG9idWZf", - "dW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuVHlwZUZpZWxkRW50cnkSSwoM", - "ZG91YmxlX2ZpZWxkGAogAygLMjUucHJvdG9idWZfdW5pdHRlc3QuTWFwV2Vs", - "bEtub3duVHlwZXMuRG91YmxlRmllbGRFbnRyeRJJCgtmbG9hdF9maWVsZBgL", - "IAMoCzI0LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkZs", - "b2F0RmllbGRFbnRyeRJJCgtpbnQ2NF9maWVsZBgMIAMoCzI0LnByb3RvYnVm", - "X3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLkludDY0RmllbGRFbnRyeRJL", - "Cgx1aW50NjRfZmllbGQYDSADKAsyNS5wcm90b2J1Zl91bml0dGVzdC5NYXBX", - "ZWxsS25vd25UeXBlcy5VaW50NjRGaWVsZEVudHJ5EkkKC2ludDMyX2ZpZWxk", - "GA4gAygLMjQucHJvdG9idWZfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMu", - "SW50MzJGaWVsZEVudHJ5EksKDHVpbnQzMl9maWVsZBgPIAMoCzI1LnByb3Rv", - "YnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLlVpbnQzMkZpZWxkRW50", - "cnkSRwoKYm9vbF9maWVsZBgQIAMoCzIzLnByb3RvYnVmX3VuaXR0ZXN0Lk1h", - "cFdlbGxLbm93blR5cGVzLkJvb2xGaWVsZEVudHJ5EksKDHN0cmluZ19maWVs", - "ZBgRIAMoCzI1LnByb3RvYnVmX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVz", - "LlN0cmluZ0ZpZWxkRW50cnkSSQoLYnl0ZXNfZmllbGQYEiADKAsyNC5wcm90", - "b2J1Zl91bml0dGVzdC5NYXBXZWxsS25vd25UeXBlcy5CeXRlc0ZpZWxkRW50", - "cnkaRQoNQW55RmllbGRFbnRyeRILCgNrZXkYASABKAUSIwoFdmFsdWUYAiAB", - "KAsyFC5nb29nbGUucHJvdG9idWYuQW55OgI4ARpFCg1BcGlGaWVsZEVudHJ5", - "EgsKA2tleRgBIAEoBRIjCgV2YWx1ZRgCIAEoCzIULmdvb2dsZS5wcm90b2J1", - "Zi5BcGk6AjgBGk8KEkR1cmF0aW9uRmllbGRFbnRyeRILCgNrZXkYASABKAUS", - "KAoFdmFsdWUYAiABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRpb246AjgB", - "GkkKD0VtcHR5RmllbGRFbnRyeRILCgNrZXkYASABKAUSJQoFdmFsdWUYAiAB", - "KAsyFi5nb29nbGUucHJvdG9idWYuRW1wdHk6AjgBGlEKE0ZpZWxkTWFza0Zp", - "ZWxkRW50cnkSCwoDa2V5GAEgASgFEikKBXZhbHVlGAIgASgLMhouZ29vZ2xl", - "LnByb3RvYnVmLkZpZWxkTWFzazoCOAEaWQoXU291cmNlQ29udGV4dEZpZWxk", - "RW50cnkSCwoDa2V5GAEgASgFEi0KBXZhbHVlGAIgASgLMh4uZ29vZ2xlLnBy", - "b3RvYnVmLlNvdXJjZUNvbnRleHQ6AjgBGksKEFN0cnVjdEZpZWxkRW50cnkS", - "CwoDa2V5GAEgASgFEiYKBXZhbHVlGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVm", - "LlN0cnVjdDoCOAEaUQoTVGltZXN0YW1wRmllbGRFbnRyeRILCgNrZXkYASAB", - "KAUSKQoFdmFsdWUYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1w", - "OgI4ARpHCg5UeXBlRmllbGRFbnRyeRILCgNrZXkYASABKAUSJAoFdmFsdWUY", - "AiABKAsyFS5nb29nbGUucHJvdG9idWYuVHlwZToCOAEaUAoQRG91YmxlRmll", - "bGRFbnRyeRILCgNrZXkYASABKAUSKwoFdmFsdWUYAiABKAsyHC5nb29nbGUu", - "cHJvdG9idWYuRG91YmxlVmFsdWU6AjgBGk4KD0Zsb2F0RmllbGRFbnRyeRIL", - "CgNrZXkYASABKAUSKgoFdmFsdWUYAiABKAsyGy5nb29nbGUucHJvdG9idWYu", - "RmxvYXRWYWx1ZToCOAEaTgoPSW50NjRGaWVsZEVudHJ5EgsKA2tleRgBIAEo", - "BRIqCgV2YWx1ZRgCIAEoCzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVl", - "OgI4ARpQChBVaW50NjRGaWVsZEVudHJ5EgsKA2tleRgBIAEoBRIrCgV2YWx1", - "ZRgCIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50NjRWYWx1ZToCOAEaTgoP", - "SW50MzJGaWVsZEVudHJ5EgsKA2tleRgBIAEoBRIqCgV2YWx1ZRgCIAEoCzIb", - "Lmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVlOgI4ARpQChBVaW50MzJGaWVs", - "ZEVudHJ5EgsKA2tleRgBIAEoBRIrCgV2YWx1ZRgCIAEoCzIcLmdvb2dsZS5w", - "cm90b2J1Zi5VSW50MzJWYWx1ZToCOAEaTAoOQm9vbEZpZWxkRW50cnkSCwoD", - "a2V5GAEgASgFEikKBXZhbHVlGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkJv", - "b2xWYWx1ZToCOAEaUAoQU3RyaW5nRmllbGRFbnRyeRILCgNrZXkYASABKAUS", - "KwoFdmFsdWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWU6", - "AjgBGk4KD0J5dGVzRmllbGRFbnRyeRILCgNrZXkYASABKAUSKgoFdmFsdWUY", - "AiABKAsyGy5nb29nbGUucHJvdG9idWYuQnl0ZXNWYWx1ZToCOAFCOQoYY29t", - "Lmdvb2dsZS5wcm90b2J1Zi50ZXN0UAGqAhpHb29nbGUuUHJvdG9idWYuVGVz", - "dFByb3Rvc2IGcHJvdG8z")); + "cm90bxIPcHJvdG8yX3VuaXR0ZXN0Ghlnb29nbGUvcHJvdG9idWYvYW55LnBy", + "b3RvGhlnb29nbGUvcHJvdG9idWYvYXBpLnByb3RvGh5nb29nbGUvcHJvdG9i", + "dWYvZHVyYXRpb24ucHJvdG8aG2dvb2dsZS9wcm90b2J1Zi9lbXB0eS5wcm90", + "bxogZ29vZ2xlL3Byb3RvYnVmL2ZpZWxkX21hc2sucHJvdG8aJGdvb2dsZS9w", + "cm90b2J1Zi9zb3VyY2VfY29udGV4dC5wcm90bxocZ29vZ2xlL3Byb3RvYnVm", + "L3N0cnVjdC5wcm90bxofZ29vZ2xlL3Byb3RvYnVmL3RpbWVzdGFtcC5wcm90", + "bxoaZ29vZ2xlL3Byb3RvYnVmL3R5cGUucHJvdG8aHmdvb2dsZS9wcm90b2J1", + "Zi93cmFwcGVycy5wcm90byK+BwoSVGVzdFdlbGxLbm93blR5cGVzEicKCWFu", + "eV9maWVsZBgBIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnkSJwoJYXBpX2Zp", + "ZWxkGAIgASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFwaRIxCg5kdXJhdGlvbl9m", + "aWVsZBgDIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIrCgtlbXB0", + "eV9maWVsZBgEIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRI0ChBmaWVs", + "ZF9tYXNrX2ZpZWxkGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFz", + "axI8ChRzb3VyY2VfY29udGV4dF9maWVsZBgGIAEoCzIeLmdvb2dsZS5wcm90", + "b2J1Zi5Tb3VyY2VDb250ZXh0Ei0KDHN0cnVjdF9maWVsZBgHIAEoCzIXLmdv", + "b2dsZS5wcm90b2J1Zi5TdHJ1Y3QSMwoPdGltZXN0YW1wX2ZpZWxkGAggASgL", + "MhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIpCgp0eXBlX2ZpZWxkGAkg", + "ASgLMhUuZ29vZ2xlLnByb3RvYnVmLlR5cGUSMgoMZG91YmxlX2ZpZWxkGAog", + "ASgLMhwuZ29vZ2xlLnByb3RvYnVmLkRvdWJsZVZhbHVlEjAKC2Zsb2F0X2Zp", + "ZWxkGAsgASgLMhsuZ29vZ2xlLnByb3RvYnVmLkZsb2F0VmFsdWUSMAoLaW50", + "NjRfZmllbGQYDCABKAsyGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1ZRIy", + "Cgx1aW50NjRfZmllbGQYDSABKAsyHC5nb29nbGUucHJvdG9idWYuVUludDY0", + "VmFsdWUSMAoLaW50MzJfZmllbGQYDiABKAsyGy5nb29nbGUucHJvdG9idWYu", + "SW50MzJWYWx1ZRIyCgx1aW50MzJfZmllbGQYDyABKAsyHC5nb29nbGUucHJv", + "dG9idWYuVUludDMyVmFsdWUSLgoKYm9vbF9maWVsZBgQIAEoCzIaLmdvb2ds", + "ZS5wcm90b2J1Zi5Cb29sVmFsdWUSMgoMc3RyaW5nX2ZpZWxkGBEgASgLMhwu", + "Z29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjAKC2J5dGVzX2ZpZWxkGBIg", + "ASgLMhsuZ29vZ2xlLnByb3RvYnVmLkJ5dGVzVmFsdWUSKwoLdmFsdWVfZmll", + "bGQYEyABKAsyFi5nb29nbGUucHJvdG9idWYuVmFsdWUilQcKFlJlcGVhdGVk", + "V2VsbEtub3duVHlwZXMSJwoJYW55X2ZpZWxkGAEgAygLMhQuZ29vZ2xlLnBy", + "b3RvYnVmLkFueRInCglhcGlfZmllbGQYAiADKAsyFC5nb29nbGUucHJvdG9i", + "dWYuQXBpEjEKDmR1cmF0aW9uX2ZpZWxkGAMgAygLMhkuZ29vZ2xlLnByb3Rv", + "YnVmLkR1cmF0aW9uEisKC2VtcHR5X2ZpZWxkGAQgAygLMhYuZ29vZ2xlLnBy", + "b3RvYnVmLkVtcHR5EjQKEGZpZWxkX21hc2tfZmllbGQYBSADKAsyGi5nb29n", + "bGUucHJvdG9idWYuRmllbGRNYXNrEjwKFHNvdXJjZV9jb250ZXh0X2ZpZWxk", + "GAYgAygLMh4uZ29vZ2xlLnByb3RvYnVmLlNvdXJjZUNvbnRleHQSLQoMc3Ry", + "dWN0X2ZpZWxkGAcgAygLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdBIzCg90", + "aW1lc3RhbXBfZmllbGQYCCADKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0", + "YW1wEikKCnR5cGVfZmllbGQYCSADKAsyFS5nb29nbGUucHJvdG9idWYuVHlw", + "ZRIyCgxkb3VibGVfZmllbGQYCiADKAsyHC5nb29nbGUucHJvdG9idWYuRG91", + "YmxlVmFsdWUSMAoLZmxvYXRfZmllbGQYCyADKAsyGy5nb29nbGUucHJvdG9i", + "dWYuRmxvYXRWYWx1ZRIwCgtpbnQ2NF9maWVsZBgMIAMoCzIbLmdvb2dsZS5w", + "cm90b2J1Zi5JbnQ2NFZhbHVlEjIKDHVpbnQ2NF9maWVsZBgNIAMoCzIcLmdv", + "b2dsZS5wcm90b2J1Zi5VSW50NjRWYWx1ZRIwCgtpbnQzMl9maWVsZBgOIAMo", + "CzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVlEjIKDHVpbnQzMl9maWVs", + "ZBgPIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50MzJWYWx1ZRIuCgpib29s", + "X2ZpZWxkGBAgAygLMhouZ29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZRIyCgxz", + "dHJpbmdfZmllbGQYESADKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFs", + "dWUSMAoLYnl0ZXNfZmllbGQYEiADKAsyGy5nb29nbGUucHJvdG9idWYuQnl0", + "ZXNWYWx1ZSLFBwoTT25lb2ZXZWxsS25vd25UeXBlcxIpCglhbnlfZmllbGQY", + "ASABKAsyFC5nb29nbGUucHJvdG9idWYuQW55SAASKQoJYXBpX2ZpZWxkGAIg", + "ASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFwaUgAEjMKDmR1cmF0aW9uX2ZpZWxk", + "GAMgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uSAASLQoLZW1wdHlf", + "ZmllbGQYBCABKAsyFi5nb29nbGUucHJvdG9idWYuRW1wdHlIABI2ChBmaWVs", + "ZF9tYXNrX2ZpZWxkGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFz", + "a0gAEj4KFHNvdXJjZV9jb250ZXh0X2ZpZWxkGAYgASgLMh4uZ29vZ2xlLnBy", + "b3RvYnVmLlNvdXJjZUNvbnRleHRIABIvCgxzdHJ1Y3RfZmllbGQYByABKAsy", + "Fy5nb29nbGUucHJvdG9idWYuU3RydWN0SAASNQoPdGltZXN0YW1wX2ZpZWxk", + "GAggASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEgAEisKCnR5cGVf", + "ZmllbGQYCSABKAsyFS5nb29nbGUucHJvdG9idWYuVHlwZUgAEjQKDGRvdWJs", + "ZV9maWVsZBgKIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5Eb3VibGVWYWx1ZUgA", + "EjIKC2Zsb2F0X2ZpZWxkGAsgASgLMhsuZ29vZ2xlLnByb3RvYnVmLkZsb2F0", + "VmFsdWVIABIyCgtpbnQ2NF9maWVsZBgMIAEoCzIbLmdvb2dsZS5wcm90b2J1", + "Zi5JbnQ2NFZhbHVlSAASNAoMdWludDY0X2ZpZWxkGA0gASgLMhwuZ29vZ2xl", + "LnByb3RvYnVmLlVJbnQ2NFZhbHVlSAASMgoLaW50MzJfZmllbGQYDiABKAsy", + "Gy5nb29nbGUucHJvdG9idWYuSW50MzJWYWx1ZUgAEjQKDHVpbnQzMl9maWVs", + "ZBgPIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50MzJWYWx1ZUgAEjAKCmJv", + "b2xfZmllbGQYECABKAsyGi5nb29nbGUucHJvdG9idWYuQm9vbFZhbHVlSAAS", + "NAoMc3RyaW5nX2ZpZWxkGBEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmlu", + "Z1ZhbHVlSAASMgoLYnl0ZXNfZmllbGQYEiABKAsyGy5nb29nbGUucHJvdG9i", + "dWYuQnl0ZXNWYWx1ZUgAQg0KC29uZW9mX2ZpZWxkIvIVChFNYXBXZWxsS25v", + "d25UeXBlcxJDCglhbnlfZmllbGQYASADKAsyMC5wcm90bzJfdW5pdHRlc3Qu", + "TWFwV2VsbEtub3duVHlwZXMuQW55RmllbGRFbnRyeRJDCglhcGlfZmllbGQY", + "AiADKAsyMC5wcm90bzJfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuQXBp", + "RmllbGRFbnRyeRJNCg5kdXJhdGlvbl9maWVsZBgDIAMoCzI1LnByb3RvMl91", + "bml0dGVzdC5NYXBXZWxsS25vd25UeXBlcy5EdXJhdGlvbkZpZWxkRW50cnkS", + "RwoLZW1wdHlfZmllbGQYBCADKAsyMi5wcm90bzJfdW5pdHRlc3QuTWFwV2Vs", + "bEtub3duVHlwZXMuRW1wdHlGaWVsZEVudHJ5ElAKEGZpZWxkX21hc2tfZmll", + "bGQYBSADKAsyNi5wcm90bzJfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMu", + "RmllbGRNYXNrRmllbGRFbnRyeRJYChRzb3VyY2VfY29udGV4dF9maWVsZBgG", + "IAMoCzI6LnByb3RvMl91bml0dGVzdC5NYXBXZWxsS25vd25UeXBlcy5Tb3Vy", + "Y2VDb250ZXh0RmllbGRFbnRyeRJJCgxzdHJ1Y3RfZmllbGQYByADKAsyMy5w", + "cm90bzJfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuU3RydWN0RmllbGRF", + "bnRyeRJPCg90aW1lc3RhbXBfZmllbGQYCCADKAsyNi5wcm90bzJfdW5pdHRl", + "c3QuTWFwV2VsbEtub3duVHlwZXMuVGltZXN0YW1wRmllbGRFbnRyeRJFCgp0", + "eXBlX2ZpZWxkGAkgAygLMjEucHJvdG8yX3VuaXR0ZXN0Lk1hcFdlbGxLbm93", + "blR5cGVzLlR5cGVGaWVsZEVudHJ5EkkKDGRvdWJsZV9maWVsZBgKIAMoCzIz", + "LnByb3RvMl91bml0dGVzdC5NYXBXZWxsS25vd25UeXBlcy5Eb3VibGVGaWVs", + "ZEVudHJ5EkcKC2Zsb2F0X2ZpZWxkGAsgAygLMjIucHJvdG8yX3VuaXR0ZXN0", + "Lk1hcFdlbGxLbm93blR5cGVzLkZsb2F0RmllbGRFbnRyeRJHCgtpbnQ2NF9m", + "aWVsZBgMIAMoCzIyLnByb3RvMl91bml0dGVzdC5NYXBXZWxsS25vd25UeXBl", + "cy5JbnQ2NEZpZWxkRW50cnkSSQoMdWludDY0X2ZpZWxkGA0gAygLMjMucHJv", + "dG8yX3VuaXR0ZXN0Lk1hcFdlbGxLbm93blR5cGVzLlVpbnQ2NEZpZWxkRW50", + "cnkSRwoLaW50MzJfZmllbGQYDiADKAsyMi5wcm90bzJfdW5pdHRlc3QuTWFw", + "V2VsbEtub3duVHlwZXMuSW50MzJGaWVsZEVudHJ5EkkKDHVpbnQzMl9maWVs", + "ZBgPIAMoCzIzLnByb3RvMl91bml0dGVzdC5NYXBXZWxsS25vd25UeXBlcy5V", + "aW50MzJGaWVsZEVudHJ5EkUKCmJvb2xfZmllbGQYECADKAsyMS5wcm90bzJf", + "dW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuQm9vbEZpZWxkRW50cnkSSQoM", + "c3RyaW5nX2ZpZWxkGBEgAygLMjMucHJvdG8yX3VuaXR0ZXN0Lk1hcFdlbGxL", + "bm93blR5cGVzLlN0cmluZ0ZpZWxkRW50cnkSRwoLYnl0ZXNfZmllbGQYEiAD", + "KAsyMi5wcm90bzJfdW5pdHRlc3QuTWFwV2VsbEtub3duVHlwZXMuQnl0ZXNG", + "aWVsZEVudHJ5GkUKDUFueUZpZWxkRW50cnkSCwoDa2V5GAEgASgFEiMKBXZh", + "bHVlGAIgASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFueToCOAEaRQoNQXBpRmll", + "bGRFbnRyeRILCgNrZXkYASABKAUSIwoFdmFsdWUYAiABKAsyFC5nb29nbGUu", + "cHJvdG9idWYuQXBpOgI4ARpPChJEdXJhdGlvbkZpZWxkRW50cnkSCwoDa2V5", + "GAEgASgFEigKBXZhbHVlGAIgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0", + "aW9uOgI4ARpJCg9FbXB0eUZpZWxkRW50cnkSCwoDa2V5GAEgASgFEiUKBXZh", + "bHVlGAIgASgLMhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5OgI4ARpRChNGaWVs", + "ZE1hc2tGaWVsZEVudHJ5EgsKA2tleRgBIAEoBRIpCgV2YWx1ZRgCIAEoCzIa", + "Lmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2s6AjgBGlkKF1NvdXJjZUNvbnRl", + "eHRGaWVsZEVudHJ5EgsKA2tleRgBIAEoBRItCgV2YWx1ZRgCIAEoCzIeLmdv", + "b2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0OgI4ARpLChBTdHJ1Y3RGaWVs", + "ZEVudHJ5EgsKA2tleRgBIAEoBRImCgV2YWx1ZRgCIAEoCzIXLmdvb2dsZS5w", + "cm90b2J1Zi5TdHJ1Y3Q6AjgBGlEKE1RpbWVzdGFtcEZpZWxkRW50cnkSCwoD", + "a2V5GAEgASgFEikKBXZhbHVlGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRp", + "bWVzdGFtcDoCOAEaRwoOVHlwZUZpZWxkRW50cnkSCwoDa2V5GAEgASgFEiQK", + "BXZhbHVlGAIgASgLMhUuZ29vZ2xlLnByb3RvYnVmLlR5cGU6AjgBGlAKEERv", + "dWJsZUZpZWxkRW50cnkSCwoDa2V5GAEgASgFEisKBXZhbHVlGAIgASgLMhwu", + "Z29vZ2xlLnByb3RvYnVmLkRvdWJsZVZhbHVlOgI4ARpOCg9GbG9hdEZpZWxk", + "RW50cnkSCwoDa2V5GAEgASgFEioKBXZhbHVlGAIgASgLMhsuZ29vZ2xlLnBy", + "b3RvYnVmLkZsb2F0VmFsdWU6AjgBGk4KD0ludDY0RmllbGRFbnRyeRILCgNr", + "ZXkYASABKAUSKgoFdmFsdWUYAiABKAsyGy5nb29nbGUucHJvdG9idWYuSW50", + "NjRWYWx1ZToCOAEaUAoQVWludDY0RmllbGRFbnRyeRILCgNrZXkYASABKAUS", + "KwoFdmFsdWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuVUludDY0VmFsdWU6", + "AjgBGk4KD0ludDMyRmllbGRFbnRyeRILCgNrZXkYASABKAUSKgoFdmFsdWUY", + "AiABKAsyGy5nb29nbGUucHJvdG9idWYuSW50MzJWYWx1ZToCOAEaUAoQVWlu", + "dDMyRmllbGRFbnRyeRILCgNrZXkYASABKAUSKwoFdmFsdWUYAiABKAsyHC5n", + "b29nbGUucHJvdG9idWYuVUludDMyVmFsdWU6AjgBGkwKDkJvb2xGaWVsZEVu", + "dHJ5EgsKA2tleRgBIAEoBRIpCgV2YWx1ZRgCIAEoCzIaLmdvb2dsZS5wcm90", + "b2J1Zi5Cb29sVmFsdWU6AjgBGlAKEFN0cmluZ0ZpZWxkRW50cnkSCwoDa2V5", + "GAEgASgFEisKBXZhbHVlGAIgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmlu", + "Z1ZhbHVlOgI4ARpOCg9CeXRlc0ZpZWxkRW50cnkSCwoDa2V5GAEgASgFEioK", + "BXZhbHVlGAIgASgLMhsuZ29vZ2xlLnByb3RvYnVmLkJ5dGVzVmFsdWU6AjgB", + "QjkKGGNvbS5nb29nbGUucHJvdG9idWYudGVzdFABqgIaR29vZ2xlLlByb3Rv", + "YnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs index 2020de5da3a5a..e76af650f65aa 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs @@ -7,12 +7,12 @@ // https://developers.google.com/open-source/licenses/bsd #endregion -using System; -using System.Buffers; -using System.IO; using Google.Protobuf.TestProtos; using Proto2 = Google.Protobuf.TestProtos.Proto2; using NUnit.Framework; +using System; +using System.Buffers; +using System.IO; namespace Google.Protobuf { @@ -577,12 +577,11 @@ namespace Google.Protobuf } /// <summary> - /// Tests that if we read an string that contains invalid UTF-8, no exception - /// is thrown. Instead, the invalid bytes are replaced with the Unicode - /// "replacement character" U+FFFD. + /// Tests that if we read a string that contains invalid UTF-8, an exception + /// is thrown. /// </summary> [Test] - public void ReadInvalidUtf8() + public void ReadInvalidUtf8ThrowsInvalidProtocolBufferException() { MemoryStream ms = new MemoryStream(); CodedOutputStream output = new CodedOutputStream(ms); @@ -597,8 +596,7 @@ namespace Google.Protobuf CodedInputStream input = new CodedInputStream(ms); Assert.AreEqual(tag, input.ReadTag()); - string text = input.ReadString(); - Assert.AreEqual('\ufffd', text[0]); + Assert.Throws<InvalidProtocolBufferException>(() => input.ReadString()); } [Test] diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs index 6d0911ff13c35..49d2bd7d11a01 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs @@ -127,6 +127,44 @@ namespace Google.Protobuf.Collections Assert.Catch<ArgumentException>(() => list.AddRange(new List<int?> { 20, null })); } + [Test] + public void AddRange_ReadOnlySpanPath() + { + var list = new RepeatedField<string>(); + list.AddRange(new[] { "foo", "bar" }.AsSpan()); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_ReadOnlySpan_NullsProhibited_ReferenceType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField<string>(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch<ArgumentException>(() => list.AddRange(new string[] { "foo", null }.AsSpan())); + } + + [Test] + public void AddRange_ReadOnlySpan_NullsProhibited_NullableValueType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField<int?>(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch<ArgumentException>(() => list.AddRange(new int?[] { 20, null }.AsSpan())); + } + + [Test] + public void AddRange_ReadOnlySpan_AlreadyNotEmpty() + { + var list = new RepeatedField<int> { 1, 2, 3 }; + list.AddRange(new int[] { 4, 5, 6 }.AsSpan()); + CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, list); + } + [Test] public void AddRange_AlreadyNotEmpty() { diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/UnsafeCollectionOperationsTest.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/UnsafeCollectionOperationsTest.cs new file mode 100644 index 0000000000000..00efabff0b61b --- /dev/null +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/UnsafeCollectionOperationsTest.cs @@ -0,0 +1,218 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#endregion + +using System; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using NUnit.Framework; + +namespace Google.Protobuf.Collections; + +public class UnsafeCollectionOperationsTest +{ + [Test] + public void NullFieldAsSpanValueType() + { + RepeatedField<int> field = null; + Assert.Throws<ArgumentNullException>(() => UnsafeCollectionOperations.AsSpan(field)); + } + + [Test] + public void NullFieldAsSpanClass() + { + RepeatedField<object> field = null; + Assert.Throws<ArgumentNullException>(() => UnsafeCollectionOperations.AsSpan(field)); + } + + [Test] + public void FieldAsSpanValueType() + { + var field = new RepeatedField<int>(); + foreach (var length in Enumerable.Range(0, 36)) + { + field.Clear(); + ValidateContentEquality(field, UnsafeCollectionOperations.AsSpan(field)); + + for (var i = 0; i < length; i++) + { + field.Add(i); + } + + ValidateContentEquality(field, UnsafeCollectionOperations.AsSpan(field)); + + field.Add(length + 1); + ValidateContentEquality(field, UnsafeCollectionOperations.AsSpan(field)); + } + + static void ValidateContentEquality(RepeatedField<int> field, Span<int> span) + { + Assert.AreEqual(field.Count, span.Length); + + for (var i = 0; i < span.Length; i++) + { + Assert.AreEqual(field[i], span[i]); + } + } + } + + [Test] + public void FieldAsSpanClass() + { + var field = new RepeatedField<IntAsObject>(); + foreach (var length in Enumerable.Range(0, 36)) + { + field.Clear(); + ValidateContentEquality(field, UnsafeCollectionOperations.AsSpan(field)); + + for (var i = 0; i < length; i++) + { + field.Add(new IntAsObject { Value = i }); + } + + ValidateContentEquality(field, UnsafeCollectionOperations.AsSpan(field)); + + field.Add(new IntAsObject { Value = length + 1 }); + ValidateContentEquality(field, UnsafeCollectionOperations.AsSpan(field)); + } + + static void ValidateContentEquality( + RepeatedField<IntAsObject> field, + Span<IntAsObject> span) + { + Assert.AreEqual(field.Count, span.Length); + + for (var i = 0; i < span.Length; i++) + { + Assert.AreEqual(field[i].Value, span[i].Value); + } + } + } + + [Test] + public void FieldAsSpanLinkBreaksOnResize() + { + var field = new RepeatedField<int>(); + + for (var i = 0; i < 8; i++) + { + field.Add(i); + } + + var span = UnsafeCollectionOperations.AsSpan(field); + + var startCapacity = field.Capacity; + var startCount = field.Count; + Assert.AreEqual(startCount, startCapacity); + Assert.AreEqual(startCount, span.Length); + + for (var i = 0; i < span.Length; i++) + { + span[i]++; + Assert.AreEqual(field[i], span[i]); + + field[i]++; + Assert.AreEqual(field[i], span[i]); + } + + // Resize to break link between Span and RepeatedField + field.Add(11); + + Assert.AreNotEqual(startCapacity, field.Capacity); + Assert.AreNotEqual(startCount, field.Count); + Assert.AreEqual(startCount, span.Length); + + for (var i = 0; i < span.Length; i++) + { + span[i] += 2; + Assert.AreNotEqual(field[i], span[i]); + + field[i] += 3; + Assert.AreNotEqual(field[i], span[i]); + } + } + + [Test] + public void FieldSetCount() + { + RepeatedField<int> field = null; + Assert.Throws<ArgumentNullException>(() => UnsafeCollectionOperations.SetCount(field, 3)); + + field = new RepeatedField<int>(); + Assert.Throws<ArgumentOutOfRangeException>(() + => UnsafeCollectionOperations.SetCount(field, -1)); + + UnsafeCollectionOperations.SetCount(field, 5); + Assert.AreEqual(5, field.Count); + + field = new RepeatedField<int> { 1, 2, 3, 4, 5 }; + ref var intRef = ref MemoryMarshal.GetReference(UnsafeCollectionOperations.AsSpan(field)); + + // make sure that size decrease preserves content + UnsafeCollectionOperations.SetCount(field, 3); + Assert.AreEqual(3, field.Count); + Assert.Throws<ArgumentOutOfRangeException>(() => field[3] = 42); + var span = UnsafeCollectionOperations.AsSpan(field); + SequenceEqual(span, new[] { 1, 2, 3 }); + Assert.True(Unsafe.AreSame(ref intRef, ref MemoryMarshal.GetReference(span))); + + // make sure that size increase preserves content and doesn't clear + UnsafeCollectionOperations.SetCount(field, 5); + span = UnsafeCollectionOperations.AsSpan(field); + // .NET Framework always clears values. .NET 6+ only clears references. + var expected = +#if NET5_0_OR_GREATER + new[] { 1, 2, 3, 4, 5 }; +#else + new[] { 1, 2, 3, 0, 0 }; +#endif + SequenceEqual(span, expected); + Assert.True(Unsafe.AreSame(ref intRef, ref MemoryMarshal.GetReference(span))); + + // make sure that reallocations preserve content + var newCount = field.Capacity * 2; + UnsafeCollectionOperations.SetCount(field, newCount); + Assert.AreEqual(newCount, field.Count); + span = UnsafeCollectionOperations.AsSpan(field); + SequenceEqual(span.Slice(0, 3), new[] { 1, 2, 3 }); + Assert.True(!Unsafe.AreSame(ref intRef, ref MemoryMarshal.GetReference(span))); + + RepeatedField<string> listReference = new() { "a", "b", "c", "d", "e" }; + var listSpan = UnsafeCollectionOperations.AsSpan(listReference); + ref var stringRef = ref MemoryMarshal.GetReference(listSpan); + UnsafeCollectionOperations.SetCount(listReference, 3); + + // verify that reference types aren't cleared + listSpan = UnsafeCollectionOperations.AsSpan(listReference); + SequenceEqual(listSpan, new[] { "a", "b", "c" }); + Assert.True(Unsafe.AreSame(ref stringRef, ref MemoryMarshal.GetReference(listSpan))); + UnsafeCollectionOperations.SetCount(listReference, 5); + + // verify that removed reference types are cleared + listSpan = UnsafeCollectionOperations.AsSpan(listReference); + SequenceEqual(listSpan, new[] { "a", "b", "c", null, null }); + Assert.True(Unsafe.AreSame(ref stringRef, ref MemoryMarshal.GetReference(listSpan))); + } + + private static void SequenceEqual<T>(Span<T> span, Span<T> expected) + { + Assert.AreEqual(expected.Length, span.Length); + for (var i = 0; i < expected.Length; i++) + { + Assert.AreEqual(expected[i], span[i]); + } + } + + private class IntAsObject + { + public int Value; + } +} diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs index e10d136a17dee..734c1d0555c8a 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -7,13 +7,13 @@ // https://developers.google.com/open-source/licenses/bsd #endregion +using Google.Protobuf.Collections; +using Google.Protobuf.TestProtos; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; using System; using System.IO; -using Google.Protobuf.TestProtos; -using NUnit.Framework; using System.Linq; -using Google.Protobuf.WellKnownTypes; -using Google.Protobuf.Collections; namespace Google.Protobuf { @@ -112,14 +112,10 @@ namespace Google.Protobuf } [Test] - public void InvalidUtf8ParsesAsReplacementChars() + public void ParseInvalidUtf8Rejected() { var payload = new byte[] { 0x72, 1, 0x80 }; - - // We would prefer to have this parse operation fail, but at the moment it substitutes - // the replacement character. - var message = TestAllTypes.Parser.ParseFrom(payload); - Assert.AreEqual("\ufffd", message.SingleString); + Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(payload)); } [Test] diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/ParsingPrimitivesTest.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test/ParsingPrimitivesTest.cs index c1ca6b58f6a1a..408e9ac73693a 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/ParsingPrimitivesTest.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test/ParsingPrimitivesTest.cs @@ -1,4 +1,4 @@ -#region Copyright notice and license +#region Copyright notice and license // Protocol Buffers - Google's data interchange format // Copyright 2022 Google Inc. All rights reserved. // @@ -24,11 +24,12 @@ internal class ParsingPrimitivesTest [TestCase("A\ufffd\ufffdB", 65, 255, 255, 66)] // Overlong form of "space" [TestCase("\ufffd\ufffd", 0xc0, 0xa0)] - public void ReadRawString_NonUtf8(string expectedText, params int[] bytes) + public void ReadRawString_NonUtf8ThrowsInvalidProtocolBufferException(string expectedText, params int[] bytes) { - var context = CreateContext(bytes); - string text = ParsingPrimitives.ReadRawString(ref context.buffer, ref context.state, bytes.Length); - Assert.AreEqual(expectedText, text); + Assert.Throws<InvalidProtocolBufferException>(() => { + var context = CreateContext(bytes); + ParsingPrimitives.ReadRawString(ref context.buffer, ref context.state, bytes.Length); + }); } private static ParseContext CreateContext(int[] bytes) diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs b/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs index 50d29c6c7f84c..ad35ecad6782d 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs @@ -10,33 +10,57 @@ using Google.Protobuf.Reflection; using NUnit.Framework; using System; -using System.Linq; +using static Google.Protobuf.Reflection.FeatureSet.Types; namespace Google.Protobuf.Test.Reflection; public class FeatureSetDescriptorTest { - // Canonical serialized form of the edition defaults, generated by embed_edition_defaults. - // TODO: Update this automatically. - private const string DefaultsBase64 = - "ChMY5gciDAgBEAIYAiADKAEwAioAChMY5wciDAgCEAEYASACKAEwASoAChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH"; + // Just selectively test a couple of hard-coded examples. This isn't meant to be exhaustive, + // and we don't expect to add new tests for later editions unless there's a production code change. [Test] - [TestCase(Edition.Proto2)] - [TestCase(Edition.Proto3)] - [TestCase(Edition._2023)] - public void DefaultsMatchCanonicalSerializedForm(Edition edition) + public void Proto2Defaults() { - var canonicalDefaults = FeatureSetDefaults.Parser - .WithDiscardUnknownFields(true) // Discard language-specific extensions. - .ParseFrom(Convert.FromBase64String(DefaultsBase64)); - var canonicalEditionDefaults = new FeatureSet(); - canonicalEditionDefaults.MergeFrom( - canonicalDefaults.Defaults.Single(def => def.Edition == edition).FixedFeatures); - canonicalEditionDefaults.MergeFrom( - canonicalDefaults.Defaults.Single(def => def.Edition == edition).OverridableFeatures); - var candidateEditionDefaults = FeatureSetDescriptor.GetEditionDefaults(edition).Proto; + // Note: additional fixed features may be added in future Editions (features which + // have a value set to match preexisting proto2 behavior), so this is not an exhaustive + // list of all proto2 defaults. + var actualDefaults = FeatureSetDescriptor.GetEditionDefaults(Edition.Proto2).Proto; + Assert.AreEqual(EnumType.Closed, actualDefaults.EnumType); + Assert.AreEqual(FieldPresence.Explicit, actualDefaults.FieldPresence); + Assert.AreEqual(JsonFormat.LegacyBestEffort, actualDefaults.JsonFormat); + Assert.AreEqual(MessageEncoding.LengthPrefixed, actualDefaults.MessageEncoding); + Assert.AreEqual(RepeatedFieldEncoding.Expanded, actualDefaults.RepeatedFieldEncoding); + Assert.AreEqual(Utf8Validation.None, actualDefaults.Utf8Validation); + } - Assert.AreEqual(canonicalEditionDefaults, candidateEditionDefaults); + [Test] + public void Proto3Defaults() + { + // Note: additional fixed features may be added in future Editions (features which + // have a value set to match preexisting proto2 behavior), so this is not an exhaustive + // list of all proto2 defaults. + var actualDefaults = FeatureSetDescriptor.GetEditionDefaults(Edition.Proto3).Proto; + Assert.AreEqual(EnumType.Open, actualDefaults.EnumType); + Assert.AreEqual(FieldPresence.Implicit, actualDefaults.FieldPresence); + Assert.AreEqual(JsonFormat.Allow, actualDefaults.JsonFormat); + Assert.AreEqual(MessageEncoding.LengthPrefixed, actualDefaults.MessageEncoding); + Assert.AreEqual(RepeatedFieldEncoding.Packed, actualDefaults.RepeatedFieldEncoding); + Assert.AreEqual(Utf8Validation.Verify, actualDefaults.Utf8Validation); + } + + [Test] + public void MaxSupportedEdition() + { + // This should be the last piece of code to be changed when updating the C# runtime to support + // a new edition. It should only be changed when you're sure that all the features in the new + // edition are supported. Just changing the configuration for feature set default generation + // will *advertise* that we support the new edition, but that isn't sufficient. + Edition maxSupportedEdition = Edition._2023; + + // These lines should not need to be changed. + FeatureSetDescriptor.GetEditionDefaults(maxSupportedEdition); + Edition invalidEdition = (Edition) (maxSupportedEdition + 1); + Assert.Throws<ArgumentOutOfRangeException>(() => FeatureSetDescriptor.GetEditionDefaults(invalidEdition)); } } diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/testprotos.pb b/third_party/protobuf/csharp/src/Google.Protobuf.Test/testprotos.pb index bce2bf39d4bae9ca0e1b40186a8b994bd8e1b6f8..b27cd3b49ddbf2d4686a894550c61a1f2bf1943e 100644 GIT binary patch delta 29502 zcmd^oX_!^Twf3pn<JqUj-3>O)bZF*5W>h8(0*;7dG!9W4I6!ODO?nXV=H@VC12zzW z-5?^UT!RYQA~}k)L=7q+Xu=?<h+=}`5F8jB?z?I@`}9qo`~CQy#~(L8#Ish_dTZ6H zRaL8|-6syV+_$LJv?tkbZT`g5so&Y`=?;8DR%&2(*3)S1Kf=7iM8){Zs<DZiDoQ7n zRZO_4x@Ky5qR5G};EOh_`LZ4?D=E@Pi{vXQ_1p{ZWW0f~2Kv`%U}gie8kpU{oCfAL zu;~3P-_N@8s%uA$ylK?P^M?(;wrG}fKg;o>g4efq-~L5^cb;H|`*-IGUlpGLUvh(& zeO_6jeB5PKiRwhf*wmDsY%9B_<QmT(DRs@r?8m)UBS)Wi=@r9A-ZXmHB^Qo9|0Y@T zFGpWI`qFDg=SBQ%FDy8Z`FUOw-BM@wW*6Db?%Qp6j&F5}?C_ZPaIVL)e52FG%ilTA zP8}M;x<}c<RPK4~RxAGm_e_)Vm~X-eZHkZZVE)A{NXD-jcExCvJ}7?G#Iox6c+x*! zJ+ZPD|EsJhpBf*Nh}Tvp#>K}>jZdzstf?GRJ3c<SymmraMRmNgDqcM~F}AF<+>4Jb ztxi<O%gb&}#A_xdWZwAL%1M*U$`e&R<ClV2MM%~0(yBy!Tv_$l%G#>Z<OD#MR*duF z;}W+e$}1-)s;YJIRS6VdSrNijCB~O0#@57#U3MWfMd83KtBQ{;FH2O^#LG)7Ce)Tr zNc8l)Y|o;qnxd|0(jqdJuTvS3?foK68$`Ek?ah#e%JR*6#^c4uSWq#F#s4oGDhq}} zUA3XIY$9X6GE5c>RnJ-%6l)rW0^Qc@>T#3%_U~EbiQuoJSeNAQnR}X-1vle7;+uCf z-cpEwLIEIU0U*&5ck7k_i309sesi4}_;<4w#R>_DOBwH`5*d&{Y9t0#m$Fz}k=mJa zCUVC+>fC@@%DQw_P~10{G2Syc`)aFoQp#}15I5dciExN4V?9n+BA_r@bXSQ6N(ZS+ zH&A*5i%G+9ZUCu)wd|xb3)!yS6cR+2Gk&^CG;fx)hB5)QoW<JcWI!!vZM$d^P|I2O z9$pR^*NFJ`J&dnrhD<idfcG%3$ZO@<luXuN8LS@7+9X#pGt0~M9La{=SF&tBWI%8w zD<}#XC}<^X*(!~M4EHj#Wl2_i<n3e2Ypcs{qyD7<sWp%smcUTLy%{AWMT^|a3Yv#9 zDB@mf-W;VYTID`w_DW~q00koi<*?0tEW0Gk0j=(1?Yo5xVBW`0@2N};CDx#wVV$G} zU$g)STASJe+!_{Zp=@gbYz-^c?Qa2UP1yd(`vBv;R9+iMAT^RLQkC~{ZUgB77VoAr z1L@ZfgjzYixt4M59S)#CYA6R#YeS_RK&@rP?G%&)sI{y^NAFQ49Dw=u!;G&F8ZKjx z<Uh>3(^PvgYWYW~<%=%DZxr!JXh<+%m`B3a0RzQ661G1WDCm)}{TX$RM}t3J4o`YC z6N%dS(M%-jc#nq73_&108unt>H#aceL)FKHW*~LtT~vMpi^-9ga~D_}Sc}d&Gmtj0 zoNnE{nWFYQ>YI&0=@o4DuNp&)C^Tve$CM~A8kw&<c@!9ptfT`RgqwzMKglA0W6X<r zhDp8lN#?fpE`@0gGT<LsaM@ON(O3}B^N+d=kkIpwx|4#0<R4kvenL->DC3XpjDez) z8q`UjVtj|{q@a=eDdsivE{5NOq>?rVpI*r>8L?TLR<Kc#&Dykr0m03zpoQ>u!9YQq zS*zCG9SR8<o)3O|75nYT=QEM0k)CJS1!+NQq~}>->yQDY=UKd+w}vSwbjB^g&|k6# zF5Z#}#R0V?6N(&T3oDc(2PsA4<`(jt?HUS<KQps!@pCLV=Ni^JxZrBGek3@uW0Q;l z)IYQA{IovQ7Jp`bamWxLt=o9>G%8x;&0x?qY{Bq1GoegCy_pGR0_x37C^S15fa-wY z0Hwo=wg=H)u}*!rv+NvQVw9SxDFY@Ej7IW4gDU<`Q2Hyj@%nc{&!Bne9Tt;Q81hgi zc3O$@4C)K-u#U3pBNd(D9oBiI7y*gQC%VfBZ>T5$<?RkCuVv?)vpXz+#=zYy)=VLi z7Q0z<Ib9gS_`6xV_TDcD!G!DWWBk3~C_wV}F{j8IPR(lypW7b{y^f8%Za*_~Wu=LY zGWRpTKxzaA;14iUc@EK%q0B@KNE|@8?A1%FpidoQ{3ABF_;<lq*Rr<3sq5G+WnjrZ zZg83_53yJ)RRL=0L#(wNb&(1S9imZ}A~%q*&_~Q3q)7~&AF=$F%3uZ=>?78Cpm!bh zU$p!u!S?If4Lv_$*>VgqENVuOGS~wNbw6RvioAa4|E6z$$|7$Ezq*0-?fofpTZtZP zlG#3Ed;yo!DrjJQ#+;aUC9DUMdh8d$<{Q{Aulhn;Pp|?0g|;3sAor!Vo}eW|T2C+_ z@g-Srib4i`Ea-hByD)h4*R1zd$Cw#r=9Ea8X~HCF*y?L$7K+vrG~mII%_$g=_?i^b z@aQz(5&YETcbUkD-pubZkzvZ?%xsoMrnwP}ypREj<E)@CtqWT9M5YAIfnbCZHY84@ zC6Z7djd>D*LmHFjIxw<B21HJ>y!><_@P<>F6{ZOSjIhEkBu-I<U**b1=-tz~Sy;S@ z$FC}#aQe7JdD*10nndcMo7e!>9!a5nqY$3X^9#Jwm8|ERGkEaR&8%np89bvZ9x~40 z1<kznDkIiXvw3h?DeI7&orxGj#@U3ZTMTQ7IXuIz6jFl`Rv-%!bGRScHQP7ma@7H; zNwXmVMrfpLNX+GV$}4U~mK>~KxOrOIj5!biLyoS5kpq!Cd13RkTDiVimno482{1y5 zTu9WBL}yjwJl~ub+&G4HEt!|8ejf78BlUGYbkO;fuj57ez?`3%Hy?TD%c{bgF-+U_ zoG(jvIvQ!}xs&B}6Gb8<@y$h0vbZ>S;Re<sDT7a1$x`=3igqM0fV_w|)AbX<%i^$p zpdkT9C_$sxVv=~1rWXPQV=0yP48wXj5wA-8rnamKOVskxF^TecS#|LESoTB`Swavg z0}xvIn51t5S1TV-=z1XKC<qcgtbwaFC`c&Oz}3nJBzkrOS1TWrhLPo*%MlY4kU$a= zqFT^^TFzs6VvGbSa_66>NkA><#VwUmsMd;5DT=T`YNcpySrH;pxhr_SoXZeC18D^* zwUS19tRsArtqMvLY}L?JAqEZat9UF|6;H$aDxO!UNeHdtrxkfAT3ee`{@T=#@oXR) zvNpt^Iecws9Gbz`a$l|?Ap?xHyiHs0cLD-=*9DCe*tDVRLIjJrAp#9w>o~#*npI3r zq5V3J2w<_)0xCb2s+h<M*wDv93>z4ag%~uTJ;qfaX>uDFkMWZB-YjVi3}zdH=gZif zp&LU82M`-WgVF%Ek>~4%q+os{ZyWbcN(hW@PY2U)Vc#d84k27XJRNF5Bi_@YEnGl6 z&D+FP>te8bhVu@pno(F6q;B0Ps`(6$X~&?z_!(X#17nj@VEhc#=kciLQqy4Y+m$lQ z*%Ri_T_K1Eb#{f#>j7jJ&(k0tKz4CN*Cm);E#LktkL(SOO=j(qf9056sb5&sFLrAe z1O+8QN+m%8f48nKNZ{|*{Q@NLck6y(k$>*d)ddA4kQ#|1u|2xF9g!?@tNMZj)E=sD zXQ*oX_I@7uHhAhctW$D7cV%y}N!0^dRZu7Zq$~g=R6U?o1qu8ET2+w1KcH2$N!9nc zSczIDC?J8<NTllfJl0;cTN244cLy00fdth1T<t{IG|C+0TxJFZD3BV8y6{1+;!mUk z=^#H%hKC@5bda|z@g5_`w`pnecg{cKM)4{hzXIE4iFjpde-&%T{J(RrrC3ZN7uf;Z zglk5#W}^g&GLLW-zY7LTafGY=1i?VLN4VNg5Db)jgsc4oVj#n(!Q>j&X85O>NHmyz znu$cV_>`+{10e{cPsy-Y?xGG<rLTgWHSEzLUxj9%QRpkKf=uKA$XC3z+`R!wGQ4Lm zuUsIYHs1tK*RqPC--HM>27ME@E{#Fo=-zLOG3Xoeo<8s%$G1=L$dAFe+gR`93GT|? z=#bS;YVQGsVnE7<0tx(+8XqL^PipT02@Owb?{Uajr}P8>3P>O|5}E9j9%Pb87P-{~ z01{BA^aS9L_x!-Q+)n}pD3BV8yypiVlOrusf%F4!C0z|9kbdBuI%DC)P1m=l8<9B% zD{dYik*FS9RW^opbc5edVFk(QhTBH;c9)DW!%(vzD3k|MmIo55&oI<12omMZFw`sv z66MV>)GX+dGBXXea{vlRAT<(op_xW3F1rwtMecTT>i{I6W*XQzpdrX5Bg{6`4h$$j zfz(iBgxQAL7D6hJW*ce;1|*PX8`y#A4I@N-yUvINFhWTaBRp_BYkOUtfxQGOFG@z3 zr;Pv#<$;vtfrJs}X(NC{dGoXpK%%^PWQ2g+Jxbct2d$>E<;nUGf?S|JgrLgT8@`-p zAOeVb1M`ej29;lEaJeLnipqo3%Fz0LVTeS<Ej0Yr!mP*)q=g2y34nAtlmWTe;Bu1{ z6zT<1Ls1`GY^co~qylQO(L%NmNFm$4gEvxC3!+Pc*>|w>uUir#P#;`ks8}M(sShqO z@-za)0ZR-Z(4>x3OrJ}Pj%R2R6Y>(H_W*?tq-8;;|6u3eye!10C}CNMPf^0M5TBxi zWg)%={AD4&1^i`%|5y$j!Sn5>jmT3b>pMCac9M-swfHT2&(3?=a0|Szso^~GffoX2 zCi`~i3t9s(p}`B<+#sRB3x+R;Ymm_31p~wNS2SFE)EKX(2F+sCZ0M^Y1~vYxAqF-6 ztA;Q47$5_TR}E}F|Cb>!(E8g`M`p7>u<N#m7}V_BwIw{^^V^L)+3`UFW4qBw4jLd~ ziS0&LxhMw-OKdm#55zG5DT%y0gU{x&?l<fV@o8<oGsGuf*lFa+RX#*W#^~KwG#yCb z?=<?25X%!HMRNb)-VRv>_{xD)^_^@d`}Kja2y&JKVG-mk2aG&z26C1IMprolh~W!l zkD;nW4B;Tp9O8|lD$x4>1A~7YteM9y&i}x03cL|m6@X8Tcrf^39y_n(pkYSE3QMqI z)q_S>ws*eDhr$m9iTUipl0$}Ct5H5$W*joGpw;<6e-ylhe94atwZNo&G(df1V0BGB z)}zKbZ1BNKS=z-0DZ3dG(ajDUDy##Eq7NHIvR8may$>6mb<>d(9}b(2ocJ&`-G`p^ zFkl@`-M@g1V?&RIMNlMsH1sfvgpcas#S@Y6QKM};?;V&3+5+=LYIr@nnkP?$7!(Sh z2%CpO;S-^UQ7C*O^e_i%o(R=+2$Iy4=0M^}gX^}VEo6||9275~ROKY04F$|6jXXI< zfkZ(kjV|4kEnR`teTXJe&`INr!KxsH)2BkaQ#cJ$7exEar@{(RIDIOt5QWpHx`#E2 zqM%b@jiM;%6xFCZHm*FB^L_C0Vs`pP-y5-Psf*Zu%p~Cwf~2i#55f5lG=>X<c<{;} zj95GGm>g-4IMWOU{+@k(-Au&ss%{jy&otFwispvCGtE4?BmxP2XPP+6qrns;)SYR@ z`)CsC&NRFC_L8E7vE4B@n0q&ye*N4KKL-4{A$|<_b4@i^dprjGxn_Ia3^Cx(H9N_{ z8mYjaYxWu7{a)4p+a&XYu}j#JA@jomvQWT$Qw0kir>&Furmx4SEEF)`#29s<P!ZcE z^+CU-?Bb#IAwo6~>O%zDN~t$}ITLz38wmAg$Ifz9=+QRHlGHOxu__$0B*e%8#*z?& z_Ewgd=@B~z7)wm-ztY;&<Jebe2rzR`8`=;e<N~1~M4-KvhER)KAT*E`&r4HaqvhV< zwSc{N?!6&I9w6=wA#f)Eq*|JKJP#1}nplOsE+Mc7bHB-Z7C#fb8L+_t4iFa%1w%VV zKEUn|!Dyf6e$&?@Mn1sqH@lziy)40e-+U<8ww(QG_(LIt4~U0C2p<p+g+}oK@emnB zEVn&g;G64B-k}(KYis_*di~!$P)AiUW}vRx)CCw{*PCkd9;vX?db6F{y$20Lfo|{p zR(MY#j;c&PsJJ3{{0%lBm~jsqF$@e1RtT_0Q=JrhybxfGraFWI39LpFhfs4F4H#&k zO(qr;cLX17Wy69CR<hyAO{Ur<_rxwaNV!W65`)bq6T9SMu)*+@GI@?1Y-pTIndwoA zqK!-vf`X*uwU}>jHY0ag@_3B~gw3Yg+}mTJb}<p$Y)fU|%l7f>x9M7e4NbS{VFV<k zwwZY{j#ok^;&>XSKw=o#W~yl%B!-b~CZ_RE$yZ|(FYOA>UCoYOzbh<&!lhkd0aSrq zW}ZCQg$T^H%j_$U@<5`1U1tB0syv1QcA4jl@IIFXaO@!j^VYC0lY7DfXu94L7C>6; z(F1Kv#8P`q>^;dEP%O2_Y};FtC}5A-t(P!-42Iul@&aM_SQMlDJ~NgjbBgI9B$H8U zGC|Xn5TjPwXXeOVI8gtC6nT*<^9l;b3PK~X!q{hqq)uIJ3!B0|UzxZzwAhYcGch6V z^5CD;?GLa#V=z*rcgDn#-dCX�uQZlV|Nn6)-rt>;UJadL9e5{1@wV`mwNrB#}u% z4?(t75?`CaGuv6qfiaqwzYgUn@XI72C&&X7JjQ6PH_hUg6>m3!+#T$2aM>T&u`%Fi zy(x^GW~pfs*?~6A%99fnNa#Jy8Yn|CkZ8SW){sj@q)Mbn9y(f%bTRUTIo7|!NQbJz zu&ApxBSociEH%<06=s}cwN@h?Xc%gag^`ZV+GDihuCv5h`?(;1R2L%A-HJL(4Rc5Z zQk|uSIgkLVvoOrj2_S_a3#?$r_3Y}=F$?`=fu%+`P>=&DM>vphiv<=&I2x$3e0!l4 z*<{OsiUNy;mRsn(OdgX(F@KP{=n?iOmJGC7;6kmyQoHUTArx3@uN)-Q3M{PJsZW7~ zp9EIR5t>9V53HfX;Wj9MmKzNgUuzjMSsXVuSUCA;i`4{@NrM%ZnOhv(wVt(ZkDv1F zLnNUdD=ZvaFEdnTC~|*l+j`t>yz+j_bj2Ela?;x4ehcFVokbA?^n;c<ixM;>!H_3* zf+2EX74o(;1k%^1o_dV^g$-RF8iK~t^}54kiH(=_R-QaG00~2^Cqt~DQ9p|c-JE*8 zk*(y(%^?Okz-CK@cF2U1He2dK9!Owpwy<|7jY&i1W~;SaEg}`h+-!B}ql}4Tq-QMt zr?fF?=zGR;vc-v17M&LP=5uh?;^5;aS;rFmlt*bI3EDkpVR_b7m`I!(y%_Y^#JZQf zn3<1E`C?{1&|8A3$k%R5W<ILz7RtBW6O~6j_NQLi#9CU{?++_aYvcW)0cqUZZ>bZL zEHP5<w{T)2D^F|V{Z@-^nndOITi7Xnj3%Tk8r=>CgP&oI*B=ZEpdsyGSO5)a2Q9T{ z4-sf}&_c8*3!owGpry7^kct8hTG;0Jn=AlOp9JSW%Z^<4Nmu~wqkIw;K%M;)OD!$3 zL|^~JQZpV%6!3|qW;~E6;1dfo-Z`QIaD*el{O8!P>yL!^wEjF2;?odtB(x9>0Y|LU z<kXVIZQviVie-oZ68J}~j@{(`Sr&QA=RxP^+45h19u`20)6c^KXmR?vm8Tt!7N?(E zSl~(v(c<)Tt3-wf03<}~^uFG;Q~|mN`IW`L30l9vewF;na^xW-_~dy1uuOTSMbIb( z40*^d7;u+=SVb*V4;9_uSf&K|G8mx*IpVQQ3D93#ro17PWhUjNMsVaE0V;%i@@w)Z zn)|b;FMVgJOO>GDKOp5G4ic^Lou#fdf<*D(SuM4v&}8?W)w!#;MYsn1$o}5qb8Vye z2|6>y9pa$+MV3l_Z#k!_D&cMvma3N7N{veL>J%9AusVybT|vJeESy)$VM<)H`7x}L zyix;(t`QiJ_>pR)B|!gVnH^LaN!*Ho;^4GRmr6$X$-?%%7C}{}*%@k4Cj=u@%Yei* zJ3}p4YPy|nO+y3<VCc310}|8iA{<ofLf~XGGDWDLfDwvV5Samyv;^!w(@r<1AtpaC z!n)I?ikWss-QkS0?2MW^EGanJ?F{ZfWR{KYsMUfC%+9PkH8U7t-RV-r?993&UYlc^ zEz{<tXcG*1wUZi=Zc@y#<<5N)UIu|Wo6GYoP&C2YX)mL5$vRsdIv^Ebb+$Tm0Ewol zv$3uhb0wWv&9`~It>#K`nQp#~8?T}^@~CQoZMKuT5q&;N14mvq%OVcSTVQ7^BN788 zF0h*^rz8f-Twr6vyoBZfFp%M{;Il2b-f>qZ5>0(~+3H@M$VVCNLe>9B5J-2~h;wCc z!_Le?o6BH73p;Lt)V<AvUJGq??toNaEwqdENKYFy3+=+wd&$@`i|+3)wf`MrOH>tx zLS40?VldQFTg8@0g`t+(ZB=Xu8kSmWBeontBOH3N-C*;FgW^}%aKC|E<sG`?fdm?i zRtA-?u)mI288$1}z+V|U2pA|~rQNKvaw;%T#7Y~>P`Xz|NXW1{sC$)79kDtSiB6?f zXCl!EzB&_$9Aq^i-KLPxa~=%NdyU<G@q?L2w3K)-bT!;h0n&qZVW<;DNe>bdHjboH zV63yvuEpzFQ2#0`4%+{jtxkfYy8;t;@z!PPN8{c)yO|n0Q88Mmt+TOzEFBmdbC1~S z7IYS;=K>&gyU=riM?wdtIQkJ=-KR!oAU$Gd_vk5N{w$pFnj3;kx3bHJYzQH;0kOeW z!9MZ;VuP)MeUO0IV5?xCwgVe&5$q?kDA;ebRj>~Vav)`}4-!Ugv=QvL!XhCHgV9Et zXP4ySQqQEy+i<7nmYS)P6P~OhEweY;YMGrSmf4vkkOVnUAw6mHoRXmNb#~^ZPugl% zBulKfGf7AZk`^1;zMZloThwBMYM8RI*bsYT+2oSX+PwY${k<_%72booO78)QrhiuV zYLGC@vvw=ht3jjfpS5uoMk~f_^8OdddoDf~zX9|@2t=Lk1?@vfrL5YAKmz9l?L)L7 z{Ic|+OR~v_Ue-PY3UVN&4}nA*zDzzuZJ6WRuh@~pstsum_!S!`eK$k39BRU?!Mks= zF+;a%rNBf<TWz(i01_fw?L2wV4iZXjwQ;5CV+y5msCGMoJGQY;uH6wr&}_3KgrIuu zuvL@|5kTyqX`O;pkeJnX*ec2fiMU{gjVPOTPjb)$b_ScbvvxgqYERD*o}NjfzJmNS zoebqr#I!dR-N7zmWA=tR(Xg~P)QJ?|YpdN7$UvvP_CR@12ogH&wFi$Db2X77dB`Qw z_j4%s`~McckE+6DQCI2vAmOs_Yu^V6GrphpebB-(%J*|<k@unWef%aO1fthNA8Ox6 zDu6!Jz7G;OA8OyHgN%=*?~l$Q-~U+qJ}Ah6l)euVjsLOs{aoMvn;n_q$juTuz4)8$ z7J1*1=jM|09}TYC#ZHtS)mnjxqK;}W0STF-+H*ldtE1X;LBdOpYR?4;&pk?>D+b71 z@~~t77EXeyqHR%E=_DZ0w#T%SfE1R{TWX+T#$z-<Zjdd3Hai}4eTO}M)A104`s?wq zCCHk`ZMD$N75()%#l19!fJ93ix7*2$7LaI(<93fe-UXtiQQRq;4=x@Qw0VW~4Q}}h zD;NTX)|OoQlpT}j@43RIPuZR2J}O8djgf&y^IY=iAEig*HxVHYdGwFkqmc@Yf7Big z5;#9<kEVmQ>5hm9uF55kp6;lK02JgvN{<E!>r8jlXrAZWvz*9E<<WGQHp{^|g>bk$ z^5}WazeAjjs>1ZBt87A$F#SA7#n~WXn0ZbcH6w$D?dLg&v-i^WU>^C>QYSTjH`~Xq zUmBv&w6)YxGaqt^Y--v936Q0ZI(G&Mms{$nb7zonxup)yoykq|Xbx&{<Tfz~DBBPg zLtBUqj*1+SieefZ6*+=LF%6E29O?A*9_c5e^T<!`(S8C7av-IjfJBk^Xg|sK?Nv_X zCFLh{PP)o*n|Xhw>gSW6tV_MIkL_VMuG4CPi?Y_~+Jl79I!DzWB-C1`YY!5&U#Dvi z6187Pwf~ZObUy79Z*ce%0Xx9H7{0+#yDH#Q*^fDD`$Ett1`N4`7Yx+nF$dch9k4ba z1~NPz^m~tWDtX*duL}el`5t$gpXQyZ@_}v){^LD1Fxlv+rxKKpnxfGWPf@7uSYvH; z_>+$8?V!;%U`R&-iMHA3s1-g)6u!}EC2#+Lgb_A6>h=#v7~x6BmNx}J!U#_~`5k=O zAM>f?&Hont5mkj5QCDq7u}iM|BT`|;&5oV`K*NrksXtO@$tUVL)mcCQ>A4Vz2IuE= zXF)2Ep3|KLq!3k|g>DDDC_794eCjMO>dpcRav)`A0g0x0kvhwK12MAi+gqK;fz(?c zuz9RttAk6`Z%`=d(;m(ahwn;F`Vi4%a);x|w<|~>M}EsO<pW<qLvJwTid8V6&RdS! zauE#Z@Rp;VG71K?f6KugMcNS}1~Tk)%=TjOE@)tap)iw_1E4#p9`u}9WDzpB)sbcZ zbf<&Km6pLisrk0U<*i6i00b$U2_%gBwi7E5vnWVlz3t$EBu%Oyf%LY6!wm6?!WR?T z?%?T<*sA325Q8+@?WhA0U-X#Wj=HG=5*WK3JR_9a!0dY*wY%mErva(8p&5Tqh(y-d z<M?t97ny;y$C1nXB(wv$*HO2FL7`$GH546G>~++U7g7PW*U6U`a6k%K+zysXL3E#^ zZmFY|lGI3aBC#)2iYE1aPEy^XL2f|p3$2aJ?>e~bBn?OhjUY7?ojtr8Dn)y$?>hOq zY3Q8sU2+Dg6k2A#qwf9s;-C?vM(Rh$4EsZ^=$K)@<I8P-<ObA!2N!?eCGRdk6zoJ! zrkqbO-6j8qGXb$dSwMsI-yQzBBR42P1Lg0IBOi2uB;PsWs2y5CBLf(6gH|xmo<|(D zK}!r|_|#F4u>>s{(t(MQq%H7Io!mU(^TYxDS*8eKfDwww92pX*-BHJs&v*%eS{DrY z@>4K?d6cFG+K4ScHS8}Oe!?-)EO>?l2HFK2X-$x@^%su1{R<LsUpVS1H%Jusg@eti zTyzSMxJ~|r)8hoJM!l98xU}@8qxNx$E`Z&>O52SXK>UYew(;`3q!elH+s7R98^;pe zmV^o+^sQr#3>gsmt_cIRI_{YAD7FBOXrFTUPwCd9sp^#D<SN68EyM4_#*$lu-zOcl zi4OpAfbqSfHt~r8h#wqv$|z{bkSDW(0UdsD)X6L{K>z5dM}dNd1Q_zvS1?2lochYP zNJ8ytF0XT`G02`Y|AL|0g67|8t{Rb$3b<)5hD?<iZ86P7ACYZ=`4?a%b*^p;@ho|| zn{Epx+G2(a)6?(>yrgK1nZ(Hx&Bt7{#VpsH<Lb6xqAljSu(T3#>B7>Tt~pFrf)38+ zyL=&v6>5oBZ}VM;-sGZr<@wnH*X$zYiH1BF7}%4f2614P1uljlErJ|(xoJaU#*_?g zNH8FAmn#e@3jtm4ru&*aKLbN|9C?0L?~0B?-2hrIa+7>{+VnJMFA7ahbM_)vy-PrL zD6q(Fca}0ejkk;3!9$ekvETyQ(B)~<bLs|*L(_9%`ro^H_`nj4x<T^p(Da;4zr;0{ zrA^O;=>s?24Zwg<1GR<lA3C|a$K|Wjrl-DtkLxs3b`+;}D_t|LOfOIEz>p_E1tyNz z$n+~+>|jaLi(|WcL(|J+J215A<+0tpq3Ll-hj`je_Y-+)2Zrt^V2B)QYqkK-*zv6o zDk3K-JcORRgMr2r9)@)CkfsbE2!`x8sP`I|Kb&qmLIgv18;X+FxavTrK#YiMT(zGK z5^cA}#jC7bIsV~f9%wxuPB)%-oqm7Vcz6o{1s@0-4-6>yVAysBwcT3Rd??*^hG@G# zP%n|)1`Noo3)>EF*dI;0{PA?-(Pa9ltInMZ@Q@FMu1{-0G%|o8kGn($SY^G7Wxs4Y z(epOA>A65YDFs8%1z<p8gDd6&>NZLAJ*+QqdaO(j8ijx%?^aMDGKYA}P5lOHH@f`k zwCO2807ILeR{f2xI(bHJpf$QJ<(WQ6n7+})`z<+QnMs(w(e3?o+Vm#%n<vth#>Ff$ z{l?JrU;y&T(Db;N=-ZoIGnF>IDNO&AYmQRA1n(K2arp~rLsO{njO*Zay7WIhPsA2= zXju7r5e&HuE1;*3Fw?WHIz=W1Af9v8x=PTJAzu~<1|*(y@v=a+jYVdBKJ0m*A&~?} z9=?)@%!0#L>EuxRMVG&xwlu|0U}#IzMXeWIwa70J7qwn=o6DdFBrN@+i=anZ8h1AU z*6H=Mp)E4>OUcmEmaz28O&HK{3t3uvFmj*{e+o@+k?CJ?&DYYV$K@-S^3Se$X<CN7 zeyeMqtJ(q&Hs5slTdFOR1ttY+Z@P{=ItNK@vCTC}ahe<C^Gq=G7zPHk*yiH-khH9L zqPabEVfhLZ4DG^TKw`TqT$sFGyu{q$V(L%oLZ~sokyofh4v6e<#b*-8>!J2emmf^G z1zmLmL$?K8b=&F2^u$bc+Ud5D`)?3NTkLcPoT1tR_gnyW=0VsXDXM^*FKCQi={kZY zuYWr<Js5y|$2GeuyMh4){}Q$q7%1hhVMhT2I__@5K$yIz31|{}?{(FU3n=OqV9~y> z2`U!#?~-ORKCr3D_q*nM=_bb!7<7H#H7`u7Mos>KYmN|iVGD3(ameNJ%4z`}(j9VR zIdU3}-atcI22D+?NW&~Z2l&|K-@@p$2q>U6?8k1lye<R^q9ElO79>PJcAK@pryYbS z_E1y*U>$oL4<#sw0I4O&D~^-IASH1kaF4Mey-&D!4=X|$(akeSNC@&#j+I0q!mVgz zMKo1&jCEs$)1q#%_c$$-3u&P|JIWVDQ%`)&da_$)M{yy6ni?tO-*ciWCKEK82@Dyi z2nHHuPE=iU5De%&C#tSF2nL#ZP88$*XoZOkby2fV@!7$9-?BEr#BbT@Bf$tUDUhs- zX3GJMAjlSV(V`xr(F6mSb<tkEy~`9P>bf8r?E98oo?MU#MS;<ROepF*3!+7x(ohr} zEr{af8W|DT@PK+;9nlsbAE=M2*`AWAC7Uu(wqQt`B_njTq&|ucO#PKaNd2Y^A%YyL zOuDcU#Z0KIPA_d1lG5Z!h13R%qr8vIEEYf@WoJerD!4eR9(99cB}8|SU%mp3+AStS z&7jS_LaP1JXmIgyHuLPIAqW|KX;giI51B-+0=X0h35=yt>;ue^7*KwBG{`!^=AN@W z#2`yA4>72u<<T?-S$R2O>|=1oW{6>;k#%0M>jc}Aw<d~h@EQ5gubCK6Q=3n+S?-P7 zG&Z=v-WF9W3y{Fx7A=$)=Rg8`8#x%wM9s*Zw@3LJPe%Blk$Za-yFc?BI16Yh<Zx=G z!50`44{K);d<;2<qw0ORU_kV6v_LwdV4$eOQOvB=w1R;V=Ww)DcZ@g~q6wR>F&&P! z?&j^HZ^IA^AV*V+9DWrmJDOP>?Y<n%ERO7cG_yFe{L#$fXxH*+W^s&)J4(f^%~HjI zvC2zb66Kxj<SI{fE7F7ZXjXY@Q%f*V-YTz9Uc(R!l()*mJ`Fh{F+ktvncdRW6~S;O zCT-T-mx)P1{e51coDnMoh5*4w5j7}=kky{qHw{Wb85pwvlLYPCtj+|bz-+ZwNI|eP zJB4Pez21GiE*K4)Vd#C(<A3mioAY?5UJrWN@>*~+G3sWLFpVJbu7aDG8#Z{69l@qN zel%}`=eF=}hyOGu?`ZUbC-V8!8yoRNO>{eO;ew5x3SdA&qeic}Ji`JBeHuM6%L9U3 z@ClD^S1t$|xu5X7LT@2mngLCPYzpdpzIehWU30-k%{O_<0|f(;n>^)#f`O7YdCCI? z11_=2QywT8sOBaQE^(<U3>Z%Z(+l|JBc94EjQsB@ZDx`r|9i?SlouEU1BE^1;Q}LF zKq3Z^pADK9@~I=A%|s&4dNxyS^7&^y^<f4f2&88{>_@(<Eda(#!8?Wg!1*s_LXktg zlnF%+^^&K)%s^1IB6`U~;CYKwiuS@@@$i+l<IQ+k!7E-g-#ZVT5m~Xn1UtVL)HLT8 zbb8IRJulyj>I78fH4o$ZkaS)Yv^Ds!IX}D8R?m)R<fXZHtB2_LtaM&*-U!Y+jSot` z;n}f_ykw#`JUn_KZzpx(+}k|0FDz)uklrpBG`M-$@_wdZK#^@84#3FU1p_tS=3!g- z)Nj1LW2+~YR!#0DzKvVmt2Vg#O76~eia7o=QcjWiT66x*>8ZDRnm@4?pLL~g_4bOa zWXx+U5Z~(U74iH2S3$7mLvuoEbRV<OPEJWwCE^u{#JB{$ic4R)El*4+9Xl1*mP)HD z@zLGV3Vbn_vQ*Z9hcE0-N>m`P$cpdl#>*-oJw<#Z7oX~kUr<(EQ(09uwzM2y)5V(| z<d{-bI$3;ZR}=-A@wMggn#%aZ(%Ta8<Yf8vVtf;%LVm@!AO1&Q&%(Dqp%8r_xVlGt zOl^%$t)5y@Q+hk3tK(x5iHdmb<Z-1nPzZ?CwUZ}TR@I14_}*MOxu&eLqO|<x_^pYl zQ!1;*_4MMutj4#Skz87%nMr(Q33ZzyWU6bbDk~;HaVRxDQAJ;3no^2tRK`okjUy&~ zXBi(HuJp7rX;qb`WP)MwYS^h_Txr!*`T{Y1sTeTT1e2IF2AFA~>Uddj=b2{9q!*{l zVT0mjHCmlaQwx2kR@N$U{HluIR$5*wj4!ClDHYnxUVKubx*8uQj!&6bHg;lsY-t7T zBtM)yUbV}(%CWU*Mp%vXy=r3c;8|w(VANUWm&rbnBG2_O(HQ+AZM`VoGPjjKC9{9z z0>O;=2K|)G0g)bp$$W!;O6D1no`MM^`YD-bMoI+J^9}kbnP)}X31$c1IIA;$OYXqP zV8QL^8}#!n8ne-zhebxP;w>y#GstWnd^^xQFBu>G|MpDjK-D#6<>k~Q<bWBjE<W%K zKlg-FRaD}G(=ZyE3wBet_h2Uva}7pvV;JsW#W7XT=wb}#!Igu|cD;sk7vY*kOk^1z zrFV>iGC<)3b33Vzjy)=JDJy<SsDIthsyPOCV-(I0+Cp>MU^Yhcz#nYJdyVFf&{ga* z8>8K9O+oX~h*5>+7}c(cT&Fc}9@GvtNBpenV@5HqQR>qp2jf~EyhZ9?tJD`ewZ^qd zeNa&UTBtAl1_S7rNFwx`enWm{zrieKj8T3=8=b~D9xNIHzZs|eM(lPP<CNckg8JjM z-(bp^6qy`a|LY+?v-RP*#w2BZ+UheZd2s1aSie$PU+ni8mCE{{pnj#cKBn~BBmWUv z|B0bLv-PouX56l<Py1)a9X!ZA+ich84rP6@iDulPtPcw6-vR53)e5##X0pf}#){ui z!%p?t=IEcz`{{8s?a|D{35n>vV%KT*FB#7-&KF+|98+0YF6RS`QnaK*4%mD)<F+Ot zKbzsLpGrl4n9Xpyu!}||d|0ZUMHZuedRQHF&d=CDR6lwORgV)NuN_7we3uI671uCc zP+TDDhgq3sZ877i8X^yBxQL<ss7fG#u!x}n6^R-yqEC&A?vFjJ<&2^rHS#tOPMz~J z_8_VuJ$G4-Syjv&_~;alKF&p4S?tReoLYm=T4h#HezgjpU3Wx{<X5ZiVd!8~LHX6H zdsyo3Uzj(H<=?MNef5C({g9R=&*M1lszi0osM4wliAyUImE--3Jzm<Uhy~NGu-h#A zgIU-zOzSzU&jpbykSsFwE#m1+EiyCp6`A^qO#Oo2U17)n38$aP(obaRUu33nniSSw zWa=+64JfkGnSPO3*Z`4fKry~+F|3dHx3BoOpZK@G_;<j$*<P%is(4c+)iHJS19JuQ zmf^Ak;@#}Xiqzr{&4N)$%w*#0Su?H33QOK3rOla{*b5e$1yNe5&9eAxOKui`M)E8R za<rEa#i(u1wfLRsWLhE34U=&!H_zhp)5)~#nHMG}aq@GQ#p~1Qw3fLmOvmZOB8x9h zCsTZ|D4py=x4SLATqnDv+uhjLhIZ;}UrTTYTlfP$;DuELNZH}#=e?FBEhnmz(I1vr zSi(qIAT14L#r97qOO;$2ii+)@P!y5CvQU(EeL(7B$pFjJqIejHVwZ)opn_1A4!%HY zSu#$LmKDpqAQZ(E*bs`+!3{_)N`}KzW?fm@9cX}P>cO7Y(O;R{$9TPh#&_)&!G^ik zX-=+KI`vI$pKEo`?ek;{FaMI#$=4*x%P+<%pyDco;nn^nUbM7g>P=$tQN-d#mssE4 zJ*8aGyTNJ|To71AEh*RJGL?(}i(Jc*D}IBQGY)@wgw`S|t0A%uXae{}V3oAK(u*Y~ zO|H=en<8J|jC^O6-0bBEt!|oBT79d+vqZi#GV-+w{?K4`VCBK$yR8;kr2e2Lsd>w- z9&N7nvM{pNj;&EJj)3XcB;)PNtv2m$@^Wj+u&AghoithHb^k??e_3vIXmy$A(Mm>T zi;8T0nn3njVHLBhgZxESGq-7Bbt|kkWP|bLm8Dv#m_W$1L95`y6;>;DWw2<GRp>TN z8F-J?it1HcR#9_Cf2BnBzo^&Zd#pBqc>JD!f;f@^(XX$9$o&@(=dJ|AWkKmmtH5nq z!xby7Vr5<WOF`0$^8W?Imw=!OkD=jT<@5i!!l?`IwZ3$cMYJ5kh-Jhg?Zr<-HCgH> z_l@jG7r{m7k`w7De&Uu{Zls&|Y57K;T#%vL8TpY;g6sH(AL%N7VwqMD=^%baeWMUy zav9b<awaj|j=g+?eoO9Y;X00fN@h`{kH`wW@H6$vTI;;rWN!>P^o?~4P{w#pSEK}m zJmX8~Ly3Zd&f{^=8pFUwXZpqjyk3+^7@I(8F<Qh-NQ+@)GA5+OV1kK!kP^eV1PWKz zlA-{@oY;AQPK4aVvj(c-K$P+RDv69!hWli)aEjW?I`q;M<-|8zq?WMlE%-W^%!u&_ z6kSTA>QJ<NOP8|*g-Z(<j*MGy`$Ed0A#UX(RZbj>g3@N7F!k0RztCwAyLC97OOa8K zv7Dcwl5m0tivGF;6^G!^DDT)uQxGffKR}7$x|=bH4^e6Os~@1Wnh3g#NnOs=X^@*V zXt0ulH&pPxDhUs?LD8*5Dh`p1QPH0MV2z+4R)LLJsU<w8GF=*8+!~ch+!&NOG4mRg z-E<Z3;MS<b7fz%cwgV=o+YT>OLD5@4DgX~ujmceg``~@5G5Jj0bl8OWO<D}^H9=`H zJl8aS1F@t;!D~(9H)%Qi&8n)jns`qLN^6Pdgho|bOS~pDs?u6!`$l!TIJ_YQrHjJ@ zJEJ<SC0-C3)v~lCs*vLwHR<AVAXk$v4v)Hwnsjmau9s1hE-u$MYPs|xgXco5Hr;f1 z4`bAJ(d~nec^S0>&Q!L{^NrimrR7}<x!cmk;njh0Te>)W!OOTUU0l9zOi9-+A7WF| zwZkQJV@kSq_*R!O<;;PppPsT}V|l}hR8}i{#lW^Di~l+HJXgk^an>akEIQY27fkMt zXXBaSo(@1MCj!v_C8v%;DQCYT<A2GigHg(fVDx{<sUuR#iHNjm&j0VQG(cE-Vd{%t z+J(%UzedESIg!Pw>}%}1N5d~gXgbS?EH=W>bQUh>!0{>e#1a9Yi<RG2l7Z=L14%Lw z0neN;ks`J^VIo4bxnUy3WOKtr#71`_F)0H>gQBiG!&HP>b)hK5RdtjoqG1Y1@j=-| zh6<KNKst}UJ(><k=i}L*jyMsbfz%-y1+Vjsbchx~Yz#UxAYBm3Qa}n)%To0ggt8Qn zE(k?Y+q*(h3P?d}QL6l1p(w?pcL`DY#Gv@HY<(z80Vzl=OQxw0W$E0ZJ}efNS{RB_ zKnhZelHnGHq7;xWB+*9)dz~j#R!%5Sq#j;te-P(Ox&@bSv0DZYy=phtk!jGQi1%Q1 zsbjC&-*Q$FteL@!gK2*;?J&&v>UFz)aOUfF2X;$v!|Qgd|B<qmQW62Xk+*hxs^BXH znY+2UfqN~2?c3}Yrhk){6U2YVo4IG{_zYQE1s`m)JF;3?YJ9tG|8sJ)ROxp6PR@!_ zN8YjzM|)j>lM2`5&Yj!#uER)i9=|~BmEt9raX!CTCDzGAFoK`<*&EoS!G?G39!=^T z<nFis#Et~-?6+5B_w!h_-$HBlp9kz&Z6<rpm5Hj`%El)AYdvQ~<&`zH<H!4Pou}P< zcCnjDwMgCgp52DAF~NVnZ=d0|)fw9!v|D6*<MD?AFBL}wgUW+L@7sf$X7F>X5|a~j zupl#451Jla`GGyEX|CYq5A5db)?n`k_K+qiU10wU4%%lmVYbMLiC|C_n+O{JDMyg? zp`8tli}8Z8scg2FsHmN!M5}^nAKJs3W(Yp|(9VzE>g7}mBLxRPfMea;1D}Wd;qjNg zWHh+-&9p&raP=WOhfNF;hwMR3p;~55!bjICRn-TfEy~huk$V4-eJ5i@0UEzus_tWZ Ha_qkW!!p+6 delta 23393 zcmZ8pdw`AA+TUxv*ZuCf?0IJ}#%&w-Yv`&teT9VLICV}%H!(7W5hF)mUwb5_XmZPP zE1?_}B08JSQGFd>_d+*HNkU1bLLzf~zh_<cyE}iR{d?A0zxAx=dDeZs^XaU{C%<e| zvyt8H^6!>s?s3`Xmi%u)rh5n0*~-*Ai+#c}eY>*D-C*ylR^WwB>)4{q!t>ePh3vsh z{l4sWr)VV$Y@6{!XisCjX_;VR&J|2t5#$FBiESwl40H%4iVS1~!%_n+f{mI4oh4;n zXisN6RhAO{2eQ=VI#V7PAvTP8F2O`-Qo%T#6_*(Z#_6m{v!GqTZ63NaS!}hKHi)%N z&t!gsAP@C$9t-V<8E+(u0D&J+@dHBRhmFR7;D4Bf^-X5*Kg=4IX(l8-!gza~$iM_> zm>4vDge98E)HLTz=1#RTxk2>^Yuip!@z9>dcxRo+K?P{2IH+bBDh?`wsdgqam}aq# zoir2B9L787L<>xSX+vd!Y7R>%gK=(wY7T4E+T@mn+qKtJC_9(&PCC(6&@kCxn#&SR zO)8k?vSw`!1k+sBp<_@$Hn&>ELibU|7convTV&WrSx_1@4qT+i$Sd>3puwzZ@A=Hm z3km~IiQ$j=EI*6{C^(-Lmqr5AG@mtUoMl1=A=ZN_EpnL{m_#lUIYhAH`dKChCPCgU z&^o~>3z>aZHUqf@f=D}Z%tDr59_0Y%Le`?a6r`zL9Ha|br_S1>P-1c9X9t9U#-tAD z7PCY{Z9@lSi&>fRvje8Zk)M(GF~-l*d0j988YY)g(^1H{pn8m@+MC><dMr}P3+<(h zn;`H&1!$-|P%Vv=^1!r|l{ME)9+;N0maT%-G%ip)xlc0wH)fSB#;9-=TUqoZ3mRzO zF!J(K<mJ--_>Fp=imV9%jPq3FAqY^{Q<1MBKy6P&zGl=DR+6tv)A$X(mAQQ6@s+uJ z<nfh}$58})E2IAGhxRJQJL;zS-~%*v@L`8lETIN3&V6vLVh!8q%q2dkR<ZUSf~nFF zJRaK5isYZ!v}>P@IO5Rg*=Tf$gX38isv&~&I4GWF<t-5^+_pk@EsO1AEJy^FP5pE& z^P2>NU}cNUxQ>aUL#+RB0O+~S)By-R*O`6^h?47Av$Lh1fT&{~JFmO!mzITY`8?xq z>TU^)+|RS1UN8V%0FY|hC>H&NUD<o1F|8D%AsdZpr2qvtvf_p^@TCA1ZDfs`1b1mB zWY{D+T*L0}vniK}oV1DM7iSBSlQyxECXoP4n^>xOu#9Oc^vf;cyKC5r0b6pZIH<Pd zQc-wpVI^v;Af>1?ZlU;j&rm_|DzlrFZDHbv>sS+U;##(*4<xFOQyB}aud@82tUlz6 zS6NsV2_#9Arolso6&`s_9J-Fp?DbkMl?|%ba;a=ky_QP_w?hD`mY7aaJEG_fv1tfv z-R%vQUtnsClbe1ofJvlaJw=~I4S!E0hq4Vr--{xHW~BF6LQQ7KLz!5Eavd4e7v5v7 z)F^;dbcXj>n?7<dBv?eaZSSC`tN``x5KXUV7hk+1s(^;W9V}5#Gm;iNSba4^Skm}A zSo0Rae-VR?(EE__U1AAHiaumsY0!(@Ys;AXSbTRq>oeqIW*4ePlNfb=%)(-&5d@&$ z$!r}tgq1*>i3BLIlNE(Qt+ERG)aQ)vVHcI%Bc8aPH51R=z;3$@BGtz&PP60ZEYVmu zfIR&<YoZ2Vq{2d<(*R6s9Y9!U4|6Xx5TocGR@6uv%p!yBVNJRRL#Y44^ItM?W-a^6 z*_MM&^(D(!BMA^{0aS}5Kq&nst5+JFjZwf3-2*K4uJCSR-MSoLeq-5hZ8F|L#_#89 zIt2#DLFOfbt6)Pw>bHkP<xT9*S06Gqlwyz{GBzXu%6)5WD6tYK8%hC6d`mW*q?v)g z7hl}W`iY@8vo2SE&+I5Or$ow3GbojY#eQIRiS(hwpoc&?RSHnz2U5t;qwD-c^pn#+ z<uYS6XaAJT41@m6?0Q*dnk*qmMgo-hnH860b%Ae>=9Zv25rU|MixNk(CDKqIE<J{6 zCCf>Z9|ZZ407Z_mWKp&f#KiI32GcYFLDXO$C5}^rU*p<F=;ObkNZAWKb@i}YJB_Fq zT{)(*x+3$JTiCg*1(G8B#!>h;R#Y5x(q)6tKF!41;jD9u)45FvknuDtt{1e>8L?hJ zgZLZHTBgtBGA5Am3^5vyVHIA(bL^Uj20#!sAP*&Kco^9=KeVTC-3`g5`6vNFWTbqQ zn8K4fDsD%Xg3!K~+YPd2EI<(m)EG+~1t@YaFR7nZt1z^u=9VZ#2?(MRg(xwVO0>}} zPKNe<BEN#QE59#S{Uq|;N9vn==%&*sU#tE_;GCA5w+MNssiq>DF<86PIiHp7bTr;f z=U!gWURH_aNoYR=CCkdh*qc~GvA2R1{22lhKga;Whj=~HEV+J}5j6`Kln_KEXb77@ zCElUAg?3&LJR*9HWbdUP$;~L`l#w<$HmNd)>rD<2dKI7=<^a)o=5W0&14N~BxZdOd zqSMaddXr<*2r-v)H6#Lo36Pl54(g%ldoE8T<sb+sa~Cx*5L9z{StG3!RG$|qMXPB* zqZCaZ^CBjycOEZNlNEMtV46otEuo<t3(e4G3q*1hd%Wj@h=a!O1w2uxtEcgM0Z*0~ zh(Zf^gVG?wB?szXnmIg*b!R=6MjSLrFO7^tQ}j|Es_mjp>oUNm&4PO*1@f*CH{Zr; zdaj5V9Fj&1G%~H=STE4DVRKr>ui%*CXDcnB^3$0nx3gl_^XZ7g1;^772aQ!vbG=fu zxeJb`d3lTAK4lGzQ)|SS(d_=7Ya$8{6l)@b(%7|z7a2#=!hH>ImI_WO3JhEuM3*t_ zbb3QX;e%pBqy-IT8zNiKl6M1dn$q6IIQ9bPEp;>Fur8qSZXC^gfhSC0(8~7(UaD5U zwp{tXK<!x<4}5Yj#<h1c8^*Hd?eselNdR@;iQF52<Q<+gBmvZUhhzC%j)~I=-R(T~ z0cT|;sooV6hL5kjrD8&ASgLAlMb*g8fm~FRW43e5snlg0>M}b_bOJ$tz#uK#1B|+N z7*hbE><-gs08#f2(`Out-S>?tfItPPOaTZ}yl+eaC^KtQ0D|d#GDRD-!VO*fV;=ia z+*-|Ar$6St>Par?y3^<igbDyv1%Oa>r%@FU73?&s0-}PQMpc(o{e<g-2Ouy38YWWp z6P{=xZIDK?%-vEghyX$L3D+kNE{#CDIais1Km};1sC)0`dhv-=Fzx0I)Y=dbOuKpW z^58k@6fW&czT*5Kx5^&psXq-Hduv6iDl=muYtF*2c+g1hCy|Tnu%C-R4rcYPkPvn5 z=X&uj1u(^au8$9-0QK(Y`uIQ!Q1gDSj}J(I3<pHBNvvtF1G!8z&>hHSB3m5b`uIQ= z1k(XB>@(D(Tx!x`Q8S6H?r}IW1C3CJxn5x+4@eI4ChD{Xkjn7RX9c4r16p%LjQT4Z z+w(}oK;zSq$h$N?9Wf(=E61lJ6h2)MK3?b^<*{Ey@nqH|eU$sEr+Q?yV<vilPz|7R z6d?GI8Gb<UA2ZPd2n~;!=<&!{$Iavb1SUYkL?%0K2B0b=%iMZ$00h->GdXw^JtsI< z=SM)G0yI<<JtufVjlxI;(+S>Kg&H83PVm-kuxsMBAG*KsSdHj<7i*FJjr&by_x7pL zr%j`Qzz?YS0io(?(`Z2OpEivK1pjH%XrC&t<NBBY2uy&6iMmW3Poz|rL9)!<T%8jD zf~t<=n1IF{pBjCJ>ysBCPyre$YV;YdkAsj3rZZfhya0mf49Ce!7c@E^x>K##Y>SnZ z=MHz`PyfxD4Vh};;DG9jlM(K-^s)d5^#Q8-0AYmtEWIoMM1A*JdRYL7`tGw3-h#qA zPTEWtZ~r%2n4TU{kjtk>6x8_XR;cD26amF_3v-TA291Bv;%fgHmyHKB%Ft&1!H9{f zd(aA-NV6g{m>#rnCIF_vPzG>@#nss=5ZVQ3sHo4)u=L3dQb9GtYN$K}D9g5J8T66O zLeW}r&i}B!Luw-i>T|W0URT69^|@LrX&7itP-}sKCU~S`Dy_9zoo65>=US`FxtbqL zv&2W>zj;=~Pb-F55kE~#vm$<4G0cki9q`YJ_#N=iBL3$J5C}o&Zm?p{*{s_@vG*r- zS?1My*nT&;!SaiPW8}DiVqmlQ`!x1T&&@^y2%*7dV{Slbu-OXL@C*nIHd`2;f1=?z zAZNUiIdngpz<RzCagg(0i8#pluUMfvP(T@Qykg;Od8H*e;Qco;3#YSHY{(lC2f6(X zV~Ie<{2NwMb#y>*ykWIgg9IQf@rKn-?Z5$Hi8risy5sbpltkXQ#o~uphwI;t_-P~l zcEnGy@V1pyTY40sGFF#v(sh8~f7?2{x7>vgl*#Ax3bv^xAXau}%4e`0?1r6D6%;Hx zqbev^c3Mee1`3v)Ry#G~%i#*JV^3WphHSv|djwZd6KI?Nsl~q#e|(q?DEid$ii6(R z1wc+t+$~l=%q}b6ZP{_Tk&<Fqb+?t5AN1AvQ2FPgq?Yw7|J>4BGRjBWiq9?VTTMRT zJtB>K={=U-5>q}Jp!QhUL{pCq$T@p0evwv|POkw~H$x)2*<MR8@c>cvUaM5~3P7}b zuhqu5j)Hh^<T?uCz2v%mfr>D2eVrNn2phqAejQaotKzSt2%}Z;*JgML<f`~<t6B5l zLzoEKg7awR=UMD8Jbg6cpk?vV$UU?yJ{m<BEsKvv5#~Y7qmh~(QIeX<97sH7apOBW zF9tN`ptbWcT~8X?(Bk=+l~iLCASya$wQa9$=}WE-Jq$!e$E@=%(iLH8eLS)|Ev*4f zMRcfqJZcavt&c|yqC@559ikS+QPJ_JMR8PgoLbZYr&Iyz`9<6@k9F$*i<QV%y2!)E zT!@g6kj|w8EYwfX7%mMGASzE-iRQskHPRrl&Jy3uW5<TnMf%bzzAn<2R`GRKQf-gm zedt?f;R=riQ$VO&XQjFt2zBeM4qdP;ClBLPV~RL$KASRh3ib>-PXhc?Y&}>b5BR6p zdawor{}j80aYF+9Q|#7iutqBQr`TQ34d$p8;51~K2nCzhV_H-}9x9k->v=NZbV4%C z4$T;qhYF_I7^C`06>&N;UF;KVK+owBLp~U$M+|ggGTjc<Oc?NdFif{wwNX37fKE$l zGq)|k4zWjV#8Ci_+K7XWP-^Y$h+P1VS{sM0v`-B<j!))@%?nx0rE?;NLNLsU80bi4 zPNYR480L@`FDX;tJVn^NRoQc5$`Y0mix;uQmqK8yo&=eQ$dVuvw%)J?JP9&kV{i7B zBEzA}5}S7}`$v|nk=U@9&Fl%OVJrgUl8BK`XO`HZ89<7_xWw+zDR@;ehM~Po+`WWt z?YS(X2tlzdq6k5;EV5Auie+RYI?@h!acDnji)Poe3oZpfAA2$)D#m#9q^(c3kqV+G zZGEy02%;y6=x#|=f}0@m&g1N!OIAe;C16-(>+8~hmw;iFt*>PO!LZ84waf#IdKJ`O zZDYZCmsoa)T_WCD%6g?&+xo;fkSE4~>ckijJ#w{;6JyyU(TCUCyg>Cx8VuIj*{)1e zaxO$c3F*Qq5xVQ`*c3-yI8m=zZ~OIwT@KomkSl<#nb}XUPx;WTrd1F_)2*hj0ix7a zJE<1Cx{!^<F7;(V^tG+Fp6dY7*S6Z2>kg9#6SSy!Q@pl<eLwWgr~+D3yctzM4S3T| zs#{MKf!W@)yQ#}9KveLieNG=;A43Ii+86f@eoz&lwcA9&Q|!m|wx|M{)3!wwkQUo) zJsKtCf@7PF!y45BT5xQ$n{_b|6>PKHpCt{SfZ=!8yjU7O5yw!t!%pO>oN^3}U^-4N zlbFWM1bJzPU7(Jwfc^u@yhv4fCBhNA)JQJFci0g$sZY4lrm)X9HlAtBc2n1ks;C}S zF+PQVGN)Ivq;(NeR9{QTORjGsE6}p&8#}2kqLC_TaF^E-!Ab4>R`h*_weIw7)Ichc z3!#UE&2)*wws`47*65rBO<sqia<n?ig(xTC=d{8~$X%eFIrI$M!>&IOsY^?&6Op<^ za>7okK^%pk?g_iQTBZQPX(#L+gXAiXpiJ&LP<HzS`Tvya_Pqe0-KnS^TGE^{-5#l^ z=alL8fFL?W-JULG6SP~av*o4iB>*6*i-_nxzRvW1q=Kl<^nO4P)lu)Kt0J1dYQ(?S zvg`ZRIJ(OxWS0k2T^<m2s&UZespsZl^XJ4?x~k{WbTrlRO9H&$vF$usDbC2Oc#dsl z=^2i8IHXW$hNI7I0a0j%qfc7_q0kHmdp!y=Kv-~w)2O$B2>TgM&t5PnDxgK`OouOY zER`(pqGmcc7H@_%D3VEoTE{Ld`>#UmO-Bx!IJ!DDrfNh5PT}a4hs=TMktIif_SHJL z@tkjI66BblY5hD~z^<C_*nYMstz_pr=xB6-L0rHK9DRWyF-k(9u6d+D=D?cv17#qj zFUu5dWFN7f%OV5Oz_ZNJtB5?gjbG*@)p0Z+477|4w1|esJgRhUrp4dc5}sZgaZpIC zb@W03nNZVOM?Zf81jkwjCr`@AG`6gDny9@8Qeot^PTQ{9$hdoW&f%M~My4_1ImgSF z*BE)Y7J!l0BYMlkA2zdA<@l-YUt|)rTkl}8-%grH-a2d)(>AjX<r{PJktsLk<^#@% z_mQu8CO03oHbeOq2D0&J$M#Iq7g-}`==P}bwA0!i8IT5u?T$W+&yz#Sb_Zwis`0eb z+U_)LZy*}K-N8BIb2M`2(J=6lnD;VUKlG!h0vZH9iYlN%;3G$$2BQeH`pChGLsdY7 zz(<bWlp_@teB@x${EeyrRJ+9!udr{2?2am+UHR^)0_y#{9X&PV$=<))(NhB;D%kDl zsR0lb>~=6UTr3-aK-eSp|1Y~_=$?q5b~Ae-ei{_^L>8h!VUN>5jlp@`1^*tWOwFZ$ z;NRo4YOhXX@+eyNiJDj0!W;HQ70^~^UsM5Yb@n+)6L7TE+2>%pq%1^RoqbNZnoB`Q zj83O+!FALCdQ5k~;fKVX|6<ps4>+E>!h)Ov@1SF=*ANn;76{bMtP~(z4mza`bq|%@ z;OpEH6w44qB`6TT&Mg7_jbp3FC3!X;(@|G~L|rUXB@~n2P(0BjnMZx;u%ln*0nwZj znT1~R9Cq{@IHZE>u+zvy3QZ4(oi^=)f63559JxO_{5Qucd!D7P9#uIZCEnS}GU*>3 zuYqn7p4H%X+OZq!QAxeJfk54G=Hamb4cI?9xCv9klzgG_bJQgD8Uq5;A_!38XKIlt z0esZ4Tk1N}cu)bwA!(Mam5gxI!Qrndf~FkHRf{?y1d&=6N*v2o3zj+_`Non*T@V=G zK!6g*;hS`}5(L>Vxkad-KoAviP~?}$ofZv?Cvw|Pkq<%CcDji_k=u3z<FC0b^;lX; zOxRi6Ly=#pJDRp51Wx9*o!ksT)ONawKbhNhENo6WcB8C0X;}t=dLT$nr0e%nH0mSB z(ugt?sB^fw4FRGlKZ-KC@v3w5ku_35R_Ev=Ye2ZB&cQBG&Y^VQamL~Ix_S<k@377| zcpfQRqb@pXT)Vl_jc{Mo28nv7lt&WOSL5buBa#3$*0}X_P?7+3*0?x+EvI<^0%VvX z`n-WR0aJ3BXzH8d>L*z;A7yk)bpNA*V4C7$L8y8g_W4s?u2#i)IKPolEiD0|*Hl-Z zVgrI}s#|78dfM(!bqhM3C0Ap4w4=Y@m7A~u0ARY`&8}GzV7lMcn=qt;>3&yl!T`Z^ zzl+saZyEs*>F$FrU+h|C=cM|HDFawNar!gXNZj)lo~=FT!n7aKjXE+?=Y3c__7?lN z_rsAHAVzf$M+Sue6+Z0NYonb20jhl1#r}pKuMiV5%odrq+2ku`=Q7cq!0cQm8u4c5 zGLb=N6VsiV36b`wYj-Rgi6KV}`aie6nDY)B(g!l*al8b8pB|0;1OaFtbxR@zX^HVD z(P9s;G=yN0==v^uCA}z@ijK$^<!VSH#Ui(!9&OMx+5;?daek*<j)RdUu6})*$LWza zpm8}p(q0m|oK~buT>Xv}nZdNg&F|P*uAB34r)Dn|Y!@4FDSm@!X+)F{qNT3hG$R#6 zOI^Kb1_aSkS1+6CP-eL+Us#Eow=t*Va#t^&^W@?gP%WMTVcg{|7SD~b+|ENMep1Zd z#+r6~($)L5Jh@-Xg(x9mcU|Hsv3nc4Xuwmh-dg9$O<OKR2?=R|o*%la+}L`(K&Mu$ za<M?CV~2c-zGqzCLNvdgop&i9EC8%b2?z^3V`3f<WuGxI4+sl9<KkSNb|CrW{x!;y z_zj*l5f6pn8e>VMQdVP0K=7<FmZZa}b;^=g=F?lXb;goFC<mx435Zs%BTG^%3qp5; z8{45<N#{`;T--X`4Aly#l^L<;eRfOFj8O_g)Rb}c8XFKrGHy~`@&Q7rjEkoh2WTQL zpw?{>|MLO+`noL<1&vi(A_{8P7FVy)Py`fPT)jpE#GJ6j)oV0B%qm-4tkGzbT7Wos zS#0@`HShegiGu<e2e}aKmGBKZr7ocP_VrBON31`)@%2b2>X)xaI+5b9yLxwuGSKOD zx4XKu0EAAjyB7_VBRxTx+~Z0a9R-y6t!#7v!mGe4IsoC-w@h>ZqNcY@bO6f2Iywqy z5&bSj$KW3CMhx_d|6LOo$ODFVO<Vwi;aw9Kbl|vM#l^q^ii_<gE`U%DP{jox471(D zMPcZE;KshyaY3hyAGm&LaDu#ANP)3Sbo+#zykVEo3PM!1%UBQ)Wp){_0z#`@#;bs^ z;4b4;KzMZ*d6l|XAsK(SF<>u1SOHiW5D?AZZ43w~bL%Mu5EbpF?zL9widO9vAMa-C zhU|?f$lH4(U8%you3lspN^kF_IhPjMfY5cX+gxq(0HNz%w`14fa;Yn-`%3KnjP>vF zRm4v|{>n|L`=dhX<FDK{>Z}8h%1|`X2vA5qKBz_j{3a0bkf#qCPa_q29yFc?1kXX^ zX*w7_q&;0oo<3we4TN%l%F}?b$syzEWaxh9#-@1cAcBs7zjJYfNRCL7qmQVWy*B`K zJ7RPLgl<QS8vs%Ah>2rB=yrr=_D^WTo+JyOax>q2!9Ha}PDLa%6r3`SKrWe04+VfA zIpykm1wc6Bl&kL*0O5#JF76e`j7jR(b;^wR4OQ!+TI4a0F(Xn@OPw(zAZn>IW~3wW z8c$70XZA6tUyY}yq@*+>pfV#MYOL|}Kw5<J951#)n~~1Fr+R+9;A3ii5!taebLCg) z$T!w{I*=hnUA3MbN&!)**3*p#gj%(pZag3wU+d|{1ETS@9vc56g?SMj=*;!F5K|AZ zBfaK&dYc0|)jiMC+Z>5e4FqaUEd^-DJP+HPmRN6)02v+?FC1j8%OCah8&N4nzDK?K z4TAG^KH&MH?jY-)p6}@guau8GG2fF9imB~b)GhG%LQi!DVE6_C)tdnkMhiT><OW3L z3%thaau*OrSm5c)T|gLNq35cLAV3&lp;y#0Pljs|RlLMgw*dgCXGv5K#lR9zFGP`w zdX{*4)Br?1OFVrnSVU;4NFKtlyEI~;PQBFA3mfDC!%|N#Yyhc@rx!MK4YFKC(K$ub z8JC+V0zx@J6-9thdO1bW3=8vd7`o4Tv6nM#zGV-w;%7ZP9($Xnt&nyb>pi|Pv-L1$ zuJn2@P)~D_KpuYHv(*Pp5~Jl1s70p~K%M73y*ZEq=<vL!zt@lgX#c#2w;8l|AptUM z@az_H*(@<QA<&#@$^p_1)DAijlv!jM+-7A3Al=|$D5m9SNNT>|arGJm2!wzt3;<!= z7raEV9CHD|^@4}5KxhaC1k(#1j@{%-(ohbBn?>>m_IP@8#6cQu_Vm$RC_`zpr*G&0 z!LixHw-QPlnEgdh?*l^_EPzHEnjc<_n8+G0dZ9XPKxQz#=&5CO8rlK=!_%*zfY2~N zLq$hw|M2voEmA@C53fjFJOawHcm<`DLeYPE`ZXR}si0w^v$KCjO3`HSPcN-+50M*G z|BS4S%v(HM@+t$;89AV#qEoUhky5n#-{KV+*U%aH777NX6g=~ir{6n;@{k<RFr7^Y zVlPEn(XqfwUZ@VJkQ-Dld3f-&o1(iobl>t~|ChP(M@$3hw{UtTx6;KldcE!O?Vj37 z1B2yl&r|Q!0V#Ig@${*Q#K-`FI!cfN`12i4A0?0g8Q%5uTXTt(Km{-f@bwvGDNM?k zCkgO-xkZQrf~bhfky8S#+veHoTP0#3??RwHZ;=9UZlf`ijtq*?40ngecY8M6f~VLJ zz%P&}YXZX7J3RgB2@rHUJpH{IAgbHpVP{x~P63Elb343_yJ0ozwIsk5?fafSaUfg_ zyM2(g8wtSpp=UP@l0jM(sUNx@dG=1vk=>RGm7vfr&+ZcmQ0SB23DBxfJzHHS6eAGb z&prNS)_XLDf9`pO+OTr7z9({)+LZ4}d-}Ku1oEhDkEhQYNdSs3JbfN6u@a~|1Sx<H zUwHZsfds&NJ^jst#3%uQx}T5&nFIF|$`@&<z0c!^r8CH$G%-P7d_fb_J~JXA6?FS( z$fOPh2w&`@KB9bqi3w!ohqJzr-(Gzc`GQGb>?hOH@CbsmbjAVY4Dto@;fsTw{Y};v zO#0#wSy~tJ=??l^&%Q)8f{u8<_xMj))05r4_dNRK2$bri_Xp2ztI88b1_&^)r%4Tx zz$`y_7=la@<Tw%;5;LU|7(+sU5=T5~NL2~&k5R`_C%q7uj-yU`e^gzKx&gHQ*-P`^ zvZklG`sc{>G*|!Z>Gzn(4h4SpnqQzzPvh;+-bFpM>9ITqThHIJrsvcRjz*^E()7oo zZU6xo)5jyzb29xep8adq^jw<$WEAxfpwOu(>T$+g=ka@eGiFiWuk*Zm+K%#k`QM(M z(xzAE%Mhru%3>Rb!DRY>d)O^2)5`<qGm+`l0W$=~^y+~5Ok{eTCu0rjXZwjdUxvW+ z69{AueMnM_Z}o5r=%bqyq-BKAH+>MmnKHuYTRybo_X03Tf$BGC_f((H^l1#Eo<NKc zm~KO>q^Z6>Iz%eiruzCE2@t-U>f`l!p&I{ihXl6HGhszFhRILx?(?%_7~Via!D+r3 z`|+TUoOi!3$1v(P7WwW0-+s_HLzpFf_mGcXqPh(PC^N&)j#&6auQu)TIa%k?WLoR% z8<Jvt%z#QC$!b9u86Z#xvoZs$@`#U3qVk>m=4O_koeR`wH4vD&00NYl<;%H%x=k8= z4+n_2=g_7HMkNraTR^Hr<&dAMQNMxObA7%zYkFEBKwwNSzwY<-9SL%SZLZ%)-97=r z^mBc@Q&%IFordY>`dt=hO>a}bnU`%eF5SuWk4C140F?71)8nm4=nCInm^HmEO~1&u zuYg^kGS)2aV?JM&H8d?X9`ikXe5c|MpJ9ad<B?(2R~itg{Rs$UFL~V8*Dxdi#Zq5y zI3!jA^`cS=VA!QTUQ{aIIAq2r{A|wyMu{{e>Y9Lxs4Tc9P(cp0m-~Em*3z_og1}gs z-WV+R^=6`2zA;$t*H?=kKv;UYk42BNG;SF|)_Qf;&<+`TMLM#yBQ5>p?*!2BDYCSR zVB|m>Rz{|G$n<~n?WeP*$MXT0@)_SAlr2M1|EzCcD&M*k<FIV4&()KZ;&`l*V4^_v zVtHtm3sIYfmR$^Mtn>N*!Wy(9ESBese!jZp1VSzAe7&IoMA3DAy@vRVQ5LoTCF<%} ztB(JQO3;h~sJ1}G4t0!wQHcw6iLGMbzgdqiTYY>4A_p1i^IV7$60YW0R+eD(=*JHD znHT@f+Ov|keZMSNN4usH+BI$W`EEb+>lxOWjoj|z9)*GeDHM1+jL9X2k0DUAmK4Ct zJA8dRBL&cVhp%sEqyV1YL4&|R&4~;j`eG*IgZg}!OGS%`5B+=<)Krp8@S$JYQTj>> zK=q-2R+r$9nhH(a>5CNSgVQ^6sc3TCnM*~%ywfjjou#4)a;J}1+hjX%!||WcFrynz z&zwFnBR(aQ1Ai|--BO@Rq+@gu_KA;ih@z2-kovzD$Rfz0>%{far!*SsI_Z_^r=&Cm zPzjm-GoN==ndKrFP<1XOqJf|J`U56FR!+F3`V$YpXx(RIsC((;ql8+&*B7%bKJ^cK zBN8(BUSI#s8Dx^Viq&=q5FC4b>;>;v98iA0FaBin2QJ<page3=M;uhsem~1WR^Cq> zpEAT?JshL?v14&j>hN93?|dAg-CG3x>QP%4{N3gE`8O_z>o!6N>IHGV-30{of_RC# z<p%`yg1DSpz(7H~FwVb=tCa>YaxaYI0N^1Hu>wqWtk3K#;4`iC`nZl@DaYn)eO!M^ zB?TzDK3=TiPzq4h`Zxwx@~jl#h-H1eaR=-Wd@X==*2kN)58mgxI*@FN<D%<-dFqnU zlZH*6kQy~?LaO4g!-iL9z7Kg%mPWGbM?^{c@=du~kT*8vYC-<kl&b|D^lZx2g3-<I zCeq@mJgo%;hvIg-vUz!_ek1Wj4!8VQRZSc}yrNfC=IIiibkj(Vw4goxp}0N-A+^Y# zhvFsbx=ae7#i2O%^%S%u0RA>^x6j&!mO2nboV2<BHkXr@JKx4jXz2IswB(Q^_?tn7 z6dZ@+cDF1kP2vzlq_odJoJ&d*`Qdm8Et-^%XevJ(@6t7BivhD9M&~1Oel+fsHB9yS zYjwrg36)i2C!|JJiA*D2@2n&7eDwmVo*b!jAuK2%-db`S^U2A0Y?1h_5&u4UGVV7F z{)+gmPqB46E`DvyC*OG51Tdrs;L~wE0|G+D)A9Q1$Q%#~o{r<|8k$Y(Qvlb+`NBX2 zFfel0#e<UI5e7>GQzbQGTN6GzT@z?iNHI)N6X^Jr0+g%?bo@#IYN`oz{7L~LrzX(x zs|09fO@PQ5q$>l*)WB|8c5$lTh>Ee*l_M+hnJJ!Frbbqd7GE^w-FqWh`GW{3e5VFF zaHK#Il&CixQUE2U26)3kcgiF{jSq<HoAJqg9>`^)5PTrFITV5q1p3QHSrAMQ1UTs0 zZ7c)9Oi`BNpZA@aOGS}4Gna}YZ)TuBZ6qpMYR?R?qPa~eMTac20{oe!KQ!l+#j}EV zQE(Z$II`m40`{LHUTn@UZ#^e)gP<sgn*=mvPJrz}k8EC4G*7fG=YMEDFL2{Id1)S> z7hu_SK{hWW^To_^e&MM3ft$$5OD38h;DIc43sM)oU_qb{93@tQ$PKi*T@d7}Cn_=r z6j>192$#Br6rjZm9_ZYH<3B6YxrKeOzWr{CpsDCu<uuKlccJ|SE8U6*j-lN)b{7ji zNd_!0wA#kPZto>C!^-VTT`}%byL-c7<111VCsd4_I66Qt8lS2db4$gD5tU<a6%Bja zZPTgh$>S<g!^Vz~iQ`5O8(uLXNKL{!-HOztiqzPOiV>;ms?><e3Dqbwv2wzw)GZa& zlPW64${-td%Y=%t!|`qGNPOBnZan?nh{`)F0?7)>%8Jn=Bza}^gwzQA^zzPOqbJha z%hc7QDn#!-c6)KSxBX+feXKO_1B{hc$5^u<jt^9tsh>*NDR#LOCPIsTDq-hXM=4~X zML(7BtXO9$1QY#K!Y;9LDGWl3ekx(tSaT_C8CqRi;kS}@i(Mq8twM`_-iqM_5p{m- zLRL0ZOu5XyzJ7p_3f<m1AGgaX3<?x-R(CP9uU+1$JNL0Ja7cz6-Q)BQULp$!_XriB zgRd`+UCPR?Bf9$H)xLIb$%(1Nx)|q(&A>?qP1YsizRT_Aoi5>?WRZtW)+K(vLEyXu z%M{{72=<Nj&vJfyx#mQ#wEAjJdMju36RZ1yv!CXarzloG%?Sj~e&D2LBLoM<{-m2- zUxfYb%cP#@p4K4Ub~+lc28)mTqwRxr+vV|qHCVSD2%Lj;+tCxQi4Do>*>ix_6GpMF z(R$L3)w)ic82~-6(|XEXt96~$69}BwX+1G~+!VVdt7pX(T2JiHtedo+v^TSciFQ{) z&tY0mxj(apX+43!IShJMq3!5cx5jQ`Wy6(^=3HqHlx@eEuyw0n6f}j8@GX02Rf?Mj z+V#&TFUv3AtxE1n|Hu#DtxCK@)@fj`#Ca=O7I!^WvGG}r-x{bj#tTWSN^6X7okQym zF>8=rD%s_i(bgSWcllwob%)kneiv=sp>2#=V-f}h6JMtXX&d7Onl(w=7#|gf)@1R@ zAMFNhNI&@rvNc&-TYiCTP1e?yA0S(kGi<PZ{c!&BqnVpF+NXPni*I-PWh#!^gITa> z0i(axm>-*xdF7a0d_`v4rOx-)vSVV)V(095(YWzd)m67l9GN+>*y&JMzN=wSbmg#d z*HnxiJz#9rq_J0H44M!Q3gW}YPQFPF8lvk`UM7aDc8W#SvrcJ}(#BP)v{Ih3MCZl4 zzDj=y>Fh=^Zn@K7Zr8sTD`B|WDNp`6NK}j&SFI^a?YZmLlv46p>=x1Gai`w=6^<=x z+VK)GbhQ(T*H=3&*;vtah0|p2v@OM=Y>jhq(X~O|gzE7Vhga*my}4aCmr_!Rn777h z!iI^LS2(3PEI+JqS{D8(2xwf@W#V(IHpz;MMgO%<8F7xNnt01-lO9M;+1SU|I!#IM zk)x}InJN=T?_zO$t<#v2E5}x!caCPyi<0|4=QJkviMi?dlKsMUP6P4eb55Bqes(uq zydWxmBByvZz0efzO0Bx3s%o?@n2cJrVx4LgEQLuzrx!(*`gNVtgzCLza&^T7og8NC z%?w=c{OG02^zfUAoo|L;`l-g`ylD8QpGue?>nd|1s`XDS&aA>%3zE_pmDE3ZXcfiU zN-6qa7;7be;-0TK)?WT}FjbVOX#+=oR=rqjDfU9EeypARiOHlvtfl-J53SNz+st>H zoy!W-XUWcuAr8exa{92G{xTO0{Ue*xU$K-3m5#(8U`$}hz^Nz354>AbN!Zx|nPN2l z-<mCkeS~#uwiwzliqm(W#E8utP^%y>tsu&cYJHALM7dGtU!bc4sN`qsBx+ox{8&={ z{V)`(Y(ak*QX<OPwVN&m<J`u3=p+n=Ky=wi8EK@xt<Cuo;oKLqgmv467wK}a<n6q- z&WV#HAY%p^jc@O8u}MR*+b`{<iy`A^ey&c!w<<s_3_`KdExQ<mVx!MKM;F75p*04d z11rVwha!QDnlzM-!7~+|hH_)@N=5kq-W-b^yGp`qY#_QIq}I_GIkvo`K`1sB+jCV6 zp0CQ*hUc|bRT?*?svJ%gtg3dV33y#=Rb61J!=htc)^}L40nsHXRfpH8*0{FDKX{C4 zjXTe{4ojUovc>TB6v!0A(^KmX6iX`>JUzAU$d<!8aC}xxJcR@@TH+<7H9o5)9zt5< zvs&hd)`V<zc=!lps>6#xYeH5_JbSbzsM^wKLP2O%XR9kfx$10nc!OtEXRE^}p;mRa zy28+!$W;_syb#4EW?hFTTGqri#y|KD)S7tCdD;ib(7H2QTk<-TyE9uI9{gB$W~;*| zpVpn(>WVP+Wm{K-Vw1A1!vhy<Qnq#YuG5-y-US)^T_-V|&zYMk>f$cyp21{y0}B>D zCg-_=*u9yRqusd!?bR0rZNw{!oramqx47@7>?hg>oh26C_TbHIWea{Tdn9xB9`_f{ z#)&^<?9|-qO~qo<0k>Gp+UI)Wr7zu<Wut@Q(ZlYVeAC#93Dp%NZW>cDVZyLmD@uz~ zZ0;SK>i<5sC%W!)o3LBOApCFc9nUJV49F&N`*|KT6oU@94a>q|LBW5}u@q~Y=ysu) z(vBC4%?I2z;?4tZl1(DD$~>NvnnCJw_|rw1%5U6*@w574SK`~;oBr-6Ps3K1@%{lV zf$@0E>dUXxi4Uqo2*f=<yKC87qSH~gqqKmSdDPv?z7vCwxr^L$12!RSq?F*t-Mbo8 z2i{c`<L|5-UJ>39c)hExs-8G<WLU0pyms6z<YfwE06H;m1g6Kz(G_CGNw-WSe{u6f z>VzAx=BmK6r`$p@;Dnopsr=d#?nS?oZ#>}^v8m#<6Ydqilb`*oTc3>){eN|P<j9j^ z)vs;=ES>q)y&y+kD3T}Le8`)g{15pgl8+G6PP*s)F8^mIp-;6qbke=#ck%(JpwAd_ z!>QlZ+mziV-a6%8n47gEZw$VktQs+BTs00vE`$*)wGlJ@e{=6)@YS2A-Pwu%2WxwP AVgLXD diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs index 722cc92322ef9..e9a106e1068e7 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs @@ -590,7 +590,7 @@ namespace Google.Protobuf.Collections IEnumerable<TValue> IReadOnlyDictionary<TKey, TValue>.Values => Values; #endregion - private class DictionaryEnumerator : IDictionaryEnumerator + private sealed class DictionaryEnumerator : IDictionaryEnumerator { private readonly IEnumerator<KeyValuePair<TKey, TValue>> enumerator; diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs index 8bf410aa85c7c..cee5a3825ccf1 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs @@ -14,6 +14,9 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Security; +#if NET5_0_OR_GREATER +using System.Runtime.CompilerServices; +#endif namespace Google.Protobuf.Collections { @@ -355,7 +358,7 @@ namespace Google.Protobuf.Collections if (index == -1) { return false; - } + } Array.Copy(array, index + 1, array, index, count - index - 1); count--; array[count] = default; @@ -429,6 +432,38 @@ namespace Google.Protobuf.Collections } } + /// <summary> + /// Adds the elements of the specified span to the end of the collection. + /// </summary> + /// <param name="source">The span whose elements should be added to the end of the collection.</param> + [SecuritySafeCritical] + internal void AddRangeSpan(ReadOnlySpan<T> source) + { + if (source.IsEmpty) + { + return; + } + + // For reference types and nullable value types, we need to check that there are no nulls + // present. (This isn't a thread-safe approach, but we don't advertise this is thread-safe.) + // We expect the JITter to optimize this test to true/false, so it's effectively conditional + // specialization. + if (default(T) == null) + { + for (int i = 0; i < source.Length; i++) + { + if (source[i] == null) + { + throw new ArgumentException("ReadOnlySpan contained null element", nameof(source)); + } + } + } + + EnsureSize(count + source.Length); + source.CopyTo(array.AsSpan(count)); + count += source.Length; + } + /// <summary> /// Adds all of the specified values into this collection. This method is present to /// allow repeated fields to be constructed from queries within collection initializers. @@ -463,7 +498,7 @@ namespace Google.Protobuf.Collections /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) => Equals(obj as RepeatedField<T>); - + /// <summary> /// Returns an enumerator that iterates through a collection. /// </summary> @@ -476,7 +511,7 @@ namespace Google.Protobuf.Collections /// Returns a hash code for this instance. /// </summary> /// <returns> - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { @@ -611,6 +646,39 @@ namespace Google.Protobuf.Collections } } + [SecuritySafeCritical] + internal Span<T> AsSpan() => array.AsSpan(0, count); + + internal void SetCount(int targetCount) + { + if (targetCount < 0) + { + throw new ArgumentOutOfRangeException( + nameof(targetCount), + targetCount, + "Non-negative number required."); + } + + if (targetCount > Capacity) + { + EnsureSize(targetCount); + } +#if NET5_0_OR_GREATER + else if (targetCount < count && RuntimeHelpers.IsReferenceOrContainsReferences<T>()) + { + // Only reference types need to be cleared to allow GC to collect them. + Array.Clear(array, targetCount, count - targetCount); + } +#else + else if (targetCount < count) + { + Array.Clear(array, targetCount, count - targetCount); + } +#endif + + count = targetCount; + } + #region Explicit interface implementation for IList and ICollection. bool IList.IsFixedSize => false; @@ -645,7 +713,7 @@ namespace Google.Protobuf.Collections Remove(t); } } - #endregion + #endregion private sealed class RepeatedFieldDebugView { @@ -660,4 +728,4 @@ namespace Google.Protobuf.Collections public T[] Items => list.ToArray(); } } -} +} \ No newline at end of file diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj index 79dffe9bb553a..f02f615c3154f 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -5,7 +5,7 @@ <Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description> <Copyright>Copyright 2015, Google Inc.</Copyright> <AssemblyTitle>Google Protocol Buffers</AssemblyTitle> - <VersionPrefix>3.29.3</VersionPrefix> + <VersionPrefix>3.30.1</VersionPrefix> <LangVersion>10.0</LangVersion> <Authors>Google Inc.</Authors> <TargetFrameworks>netstandard1.1;netstandard2.0;net45;net50</TargetFrameworks> diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs b/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs index b023d8a15c41b..ea39624a593c0 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs @@ -76,6 +76,12 @@ namespace Google.Protobuf return new InvalidProtocolBufferException("Invalid base64 data", innerException); } + internal static InvalidProtocolBufferException InvalidUtf8(Exception innerException) + { + return new InvalidProtocolBufferException( + "String is invalid UTF-8.", innerException); + } + internal static InvalidProtocolBufferException InvalidEndTag() { return new InvalidProtocolBufferException( diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs b/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs index fbcc839707209..b420ae6151934 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs @@ -85,7 +85,7 @@ namespace Google.Protobuf { static JsonFormatter() { for (int i = 0; i < CommonRepresentations.Length; i++) { - if (CommonRepresentations[i] == "") { + if (CommonRepresentations[i].Length == 0) { CommonRepresentations[i] = ((char)i).ToString(); } } @@ -291,7 +291,7 @@ namespace Google.Protobuf { return descriptor.FieldType switch { FieldType.Bool => (bool)value == false, FieldType.Bytes => (ByteString)value == ByteString.Empty, - FieldType.String => (string)value == "", + FieldType.String => ((string)value).Length == 0, FieldType.Double => (double)value == 0.0, FieldType.SInt32 or FieldType.Int32 or FieldType.SFixed32 or FieldType.Enum => (int)value == 0, @@ -497,7 +497,7 @@ namespace Google.Protobuf { WriteBracketClose(writer, ObjectCloseBracket, true, indentationLevel); } - private void WriteDiagnosticOnlyAny(TextWriter writer, IMessage value) { + private static void WriteDiagnosticOnlyAny(TextWriter writer, IMessage value) { string typeUrl = (string)value.Descriptor.Fields[Any.TypeUrlFieldNumber].Accessor.GetValue(value); ByteString data = diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs b/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs index fcf859daba096..095875cab326e 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs @@ -830,7 +830,7 @@ namespace Google.Protobuf // TODO: It would be nice not to have to create all these objects... easy to optimize later though. Timestamp timestamp = Timestamp.FromDateTime(parsed); int nanosToAdd = 0; - if (subseconds != "") + if (subseconds.Length != 0) { // This should always work, as we've got 1-9 digits. int parsedFraction = int.Parse(subseconds.Substring(1), CultureInfo.InvariantCulture); @@ -906,7 +906,7 @@ namespace Google.Protobuf { long seconds = long.Parse(secondsText, CultureInfo.InvariantCulture) * multiplier; int nanos = 0; - if (subseconds != "") + if (subseconds.Length != 0) { // This should always work, as we've got 1-9 digits. int parsedFraction = int.Parse(subseconds.Substring(1)); diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/JsonTokenizer.cs b/third_party/protobuf/csharp/src/Google.Protobuf/JsonTokenizer.cs index f89e36adf4dfb..d12d427d4f9e4 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/JsonTokenizer.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/JsonTokenizer.cs @@ -413,7 +413,7 @@ namespace Google.Protobuf var builder = StringBuilderCache.Acquire(); if (initialCharacter == '-') { - builder.Append("-"); + builder.Append('-'); } else { diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/ParsingPrimitives.cs b/third_party/protobuf/csharp/src/Google.Protobuf/ParsingPrimitives.cs index 0c3420492f82f..1615ec832f3ca 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/ParsingPrimitives.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/ParsingPrimitives.cs @@ -1,4 +1,4 @@ -#region Copyright notice and license +#region Copyright notice and license // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // @@ -15,6 +15,7 @@ using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; +using System.Text; namespace Google.Protobuf { @@ -24,6 +25,9 @@ namespace Google.Protobuf [SecuritySafeCritical] internal static class ParsingPrimitives { + internal static readonly Encoding Utf8Encoding = + new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); + private const int StackallocThreshold = 256; /// <summary> @@ -576,7 +580,14 @@ namespace Google.Protobuf { fixed (byte* sourceBytes = &MemoryMarshal.GetReference(data)) { - value = WritingPrimitives.Utf8Encoding.GetString(sourceBytes, length); + try + { + value = Utf8Encoding.GetString(sourceBytes, length); + } + catch (DecoderFallbackException e) + { + throw InvalidProtocolBufferException.InvalidUtf8(e); + } } } @@ -618,8 +629,14 @@ namespace Google.Protobuf // Make compiler happy by passing a new span created from pointer. var tempSpan = new Span<byte>(pByteSpan, byteSpan.Length); ReadRawBytesIntoSpan(ref buffer, ref state, length, tempSpan); - - return WritingPrimitives.Utf8Encoding.GetString(pByteSpan, length); + try + { + return Utf8Encoding.GetString(pByteSpan, length); + } + catch (DecoderFallbackException e) + { + throw InvalidProtocolBufferException.InvalidUtf8(e); + } } } } @@ -637,7 +654,15 @@ namespace Google.Protobuf // This will be called when reading from a Stream because we don't know the length of the stream, // or there is not enough data in the sequence. If there is not enough data then ReadRawBytes will // throw an exception. - return WritingPrimitives.Utf8Encoding.GetString(ReadRawBytes(ref buffer, ref state, length), 0, length); + byte[] bytes = ReadRawBytes(ref buffer, ref state, length); + try + { + return Utf8Encoding.GetString(bytes, 0, length); + } + catch (DecoderFallbackException e) + { + throw InvalidProtocolBufferException.InvalidUtf8(e); + } } /// <summary> diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs index c7ea7e166300a..01f647a3d5904 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs @@ -191,7 +191,7 @@ namespace Google.Protobuf.Reflection { "ChJuZWdhdGl2ZV9pbnRfdmFsdWUYBSABKAMSFAoMZG91YmxlX3ZhbHVlGAYg", "ASgBEhQKDHN0cmluZ192YWx1ZRgHIAEoDBIXCg9hZ2dyZWdhdGVfdmFsdWUY", "CCABKAkaMwoITmFtZVBhcnQSEQoJbmFtZV9wYXJ0GAEgAigJEhQKDGlzX2V4", - "dGVuc2lvbhgCIAIoCCLJCQoKRmVhdHVyZVNldBKCAQoOZmllbGRfcHJlc2Vu", + "dGVuc2lvbhgCIAIoCCK8CwoKRmVhdHVyZVNldBKCAQoOZmllbGRfcHJlc2Vu", "Y2UYASABKA4yKS5nb29nbGUucHJvdG9idWYuRmVhdHVyZVNldC5GaWVsZFBy", "ZXNlbmNlQj+IAQGYAQSYAQGiAQ0SCEVYUExJQ0lUGIQHogENEghJTVBMSUNJ", "VBjnB6IBDRIIRVhQTElDSVQY6AeyAQMI6AcSYgoJZW51bV90eXBlGAIgASgO", @@ -207,48 +207,54 @@ namespace Google.Protobuf.Reflection { "AQGiARQSD0xFTkdUSF9QUkVGSVhFRBiEB7IBAwjoBxJ2Cgtqc29uX2Zvcm1h", "dBgGIAEoDjImLmdvb2dsZS5wcm90b2J1Zi5GZWF0dXJlU2V0Lkpzb25Gb3Jt", "YXRCOYgBAZgBA5gBBpgBAaIBFxISTEVHQUNZX0JFU1RfRUZGT1JUGIQHogEK", - "EgVBTExPVxjnB7IBAwjoByJcCg1GaWVsZFByZXNlbmNlEhoKFkZJRUxEX1BS", - "RVNFTkNFX1VOS05PV04QABIMCghFWFBMSUNJVBABEgwKCElNUExJQ0lUEAIS", - "EwoPTEVHQUNZX1JFUVVJUkVEEAMiNwoIRW51bVR5cGUSFQoRRU5VTV9UWVBF", - "X1VOS05PV04QABIICgRPUEVOEAESCgoGQ0xPU0VEEAIiVgoVUmVwZWF0ZWRG", - "aWVsZEVuY29kaW5nEiMKH1JFUEVBVEVEX0ZJRUxEX0VOQ09ESU5HX1VOS05P", - "V04QABIKCgZQQUNLRUQQARIMCghFWFBBTkRFRBACIkkKDlV0ZjhWYWxpZGF0", - "aW9uEhsKF1VURjhfVkFMSURBVElPTl9VTktOT1dOEAASCgoGVkVSSUZZEAIS", - "CAoETk9ORRADIgQIARABIlMKD01lc3NhZ2VFbmNvZGluZxIcChhNRVNTQUdF", - "X0VOQ09ESU5HX1VOS05PV04QABITCg9MRU5HVEhfUFJFRklYRUQQARINCglE", - "RUxJTUlURUQQAiJICgpKc29uRm9ybWF0EhcKE0pTT05fRk9STUFUX1VOS05P", - "V04QABIJCgVBTExPVxABEhYKEkxFR0FDWV9CRVNUX0VGRk9SVBACKgYI6AcQ", - "i04qBgiLThCQTioGCJBOEJFOSgYI5wcQ6AcimAMKEkZlYXR1cmVTZXREZWZh", - "dWx0cxJOCghkZWZhdWx0cxgBIAMoCzI8Lmdvb2dsZS5wcm90b2J1Zi5GZWF0", - "dXJlU2V0RGVmYXVsdHMuRmVhdHVyZVNldEVkaXRpb25EZWZhdWx0EjEKD21p", - "bmltdW1fZWRpdGlvbhgEIAEoDjIYLmdvb2dsZS5wcm90b2J1Zi5FZGl0aW9u", - "EjEKD21heGltdW1fZWRpdGlvbhgFIAEoDjIYLmdvb2dsZS5wcm90b2J1Zi5F", - "ZGl0aW9uGssBChhGZWF0dXJlU2V0RWRpdGlvbkRlZmF1bHQSKQoHZWRpdGlv", - "bhgDIAEoDjIYLmdvb2dsZS5wcm90b2J1Zi5FZGl0aW9uEjkKFG92ZXJyaWRh", - "YmxlX2ZlYXR1cmVzGAQgASgLMhsuZ29vZ2xlLnByb3RvYnVmLkZlYXR1cmVT", - "ZXQSMwoOZml4ZWRfZmVhdHVyZXMYBSABKAsyGy5nb29nbGUucHJvdG9idWYu", - "RmVhdHVyZVNldEoECAEQAkoECAIQA1IIZmVhdHVyZXMi4wEKDlNvdXJjZUNv", - "ZGVJbmZvEjoKCGxvY2F0aW9uGAEgAygLMiguZ29vZ2xlLnByb3RvYnVmLlNv", - "dXJjZUNvZGVJbmZvLkxvY2F0aW9uGoYBCghMb2NhdGlvbhIQCgRwYXRoGAEg", - "AygFQgIQARIQCgRzcGFuGAIgAygFQgIQARIYChBsZWFkaW5nX2NvbW1lbnRz", - "GAMgASgJEhkKEXRyYWlsaW5nX2NvbW1lbnRzGAQgASgJEiEKGWxlYWRpbmdf", - "ZGV0YWNoZWRfY29tbWVudHMYBiADKAkqDAiA7Mr/ARCB7Mr/ASKcAgoRR2Vu", - "ZXJhdGVkQ29kZUluZm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5w", - "cm90b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGsMBCgpBbm5v", - "dGF0aW9uEhAKBHBhdGgYASADKAVCAhABEhMKC3NvdXJjZV9maWxlGAIgASgJ", - "Eg0KBWJlZ2luGAMgASgFEgsKA2VuZBgEIAEoBRJICghzZW1hbnRpYxgFIAEo", - "DjI2Lmdvb2dsZS5wcm90b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0", - "aW9uLlNlbWFudGljIigKCFNlbWFudGljEggKBE5PTkUQABIHCgNTRVQQARIJ", - "CgVBTElBUxACKqcCCgdFZGl0aW9uEhMKD0VESVRJT05fVU5LTk9XThAAEhMK", - "DkVESVRJT05fTEVHQUNZEIQHEhMKDkVESVRJT05fUFJPVE8yEOYHEhMKDkVE", - "SVRJT05fUFJPVE8zEOcHEhEKDEVESVRJT05fMjAyMxDoBxIRCgxFRElUSU9O", - "XzIwMjQQ6QcSFwoTRURJVElPTl8xX1RFU1RfT05MWRABEhcKE0VESVRJT05f", - "Ml9URVNUX09OTFkQAhIdChdFRElUSU9OXzk5OTk3X1RFU1RfT05MWRCdjQYS", - "HQoXRURJVElPTl85OTk5OF9URVNUX09OTFkQno0GEh0KF0VESVRJT05fOTk5", - "OTlfVEVTVF9PTkxZEJ+NBhITCgtFRElUSU9OX01BWBD/////B0J+ChNjb20u", - "Z29vZ2xlLnByb3RvYnVmQhBEZXNjcmlwdG9yUHJvdG9zSAFaLWdvb2dsZS5n", - "b2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2Rlc2NyaXB0b3JwYvgBAaICA0dQ", - "QqoCGkdvb2dsZS5Qcm90b2J1Zi5SZWZsZWN0aW9u")); + "EgVBTExPVxjnB7IBAwjoBxKXAQoUZW5mb3JjZV9uYW1pbmdfc3R5bGUYByAB", + "KA4yLi5nb29nbGUucHJvdG9idWYuRmVhdHVyZVNldC5FbmZvcmNlTmFtaW5n", + "U3R5bGVCSYgBApgBAZgBApgBA5gBBJgBBZgBBpgBB5gBCJgBCaIBERIMU1RZ", + "TEVfTEVHQUNZGIQHogEOEglTVFlMRTIwMjQY6QeyAQMI6QciXAoNRmllbGRQ", + "cmVzZW5jZRIaChZGSUVMRF9QUkVTRU5DRV9VTktOT1dOEAASDAoIRVhQTElD", + "SVQQARIMCghJTVBMSUNJVBACEhMKD0xFR0FDWV9SRVFVSVJFRBADIjcKCEVu", + "dW1UeXBlEhUKEUVOVU1fVFlQRV9VTktOT1dOEAASCAoET1BFThABEgoKBkNM", + "T1NFRBACIlYKFVJlcGVhdGVkRmllbGRFbmNvZGluZxIjCh9SRVBFQVRFRF9G", + "SUVMRF9FTkNPRElOR19VTktOT1dOEAASCgoGUEFDS0VEEAESDAoIRVhQQU5E", + "RUQQAiJJCg5VdGY4VmFsaWRhdGlvbhIbChdVVEY4X1ZBTElEQVRJT05fVU5L", + "Tk9XThAAEgoKBlZFUklGWRACEggKBE5PTkUQAyIECAEQASJTCg9NZXNzYWdl", + "RW5jb2RpbmcSHAoYTUVTU0FHRV9FTkNPRElOR19VTktOT1dOEAASEwoPTEVO", + "R1RIX1BSRUZJWEVEEAESDQoJREVMSU1JVEVEEAIiSAoKSnNvbkZvcm1hdBIX", + "ChNKU09OX0ZPUk1BVF9VTktOT1dOEAASCQoFQUxMT1cQARIWChJMRUdBQ1lf", + "QkVTVF9FRkZPUlQQAiJXChJFbmZvcmNlTmFtaW5nU3R5bGUSIAocRU5GT1JD", + "RV9OQU1JTkdfU1RZTEVfVU5LTk9XThAAEg0KCVNUWUxFMjAyNBABEhAKDFNU", + "WUxFX0xFR0FDWRACKgYI6AcQi04qBgiLThCQTioGCJBOEJFOSgYI5wcQ6Aci", + "mAMKEkZlYXR1cmVTZXREZWZhdWx0cxJOCghkZWZhdWx0cxgBIAMoCzI8Lmdv", + "b2dsZS5wcm90b2J1Zi5GZWF0dXJlU2V0RGVmYXVsdHMuRmVhdHVyZVNldEVk", + "aXRpb25EZWZhdWx0EjEKD21pbmltdW1fZWRpdGlvbhgEIAEoDjIYLmdvb2ds", + "ZS5wcm90b2J1Zi5FZGl0aW9uEjEKD21heGltdW1fZWRpdGlvbhgFIAEoDjIY", + "Lmdvb2dsZS5wcm90b2J1Zi5FZGl0aW9uGssBChhGZWF0dXJlU2V0RWRpdGlv", + "bkRlZmF1bHQSKQoHZWRpdGlvbhgDIAEoDjIYLmdvb2dsZS5wcm90b2J1Zi5F", + "ZGl0aW9uEjkKFG92ZXJyaWRhYmxlX2ZlYXR1cmVzGAQgASgLMhsuZ29vZ2xl", + "LnByb3RvYnVmLkZlYXR1cmVTZXQSMwoOZml4ZWRfZmVhdHVyZXMYBSABKAsy", + "Gy5nb29nbGUucHJvdG9idWYuRmVhdHVyZVNldEoECAEQAkoECAIQA1IIZmVh", + "dHVyZXMi4wEKDlNvdXJjZUNvZGVJbmZvEjoKCGxvY2F0aW9uGAEgAygLMigu", + "Z29vZ2xlLnByb3RvYnVmLlNvdXJjZUNvZGVJbmZvLkxvY2F0aW9uGoYBCghM", + "b2NhdGlvbhIQCgRwYXRoGAEgAygFQgIQARIQCgRzcGFuGAIgAygFQgIQARIY", + "ChBsZWFkaW5nX2NvbW1lbnRzGAMgASgJEhkKEXRyYWlsaW5nX2NvbW1lbnRz", + "GAQgASgJEiEKGWxlYWRpbmdfZGV0YWNoZWRfY29tbWVudHMYBiADKAkqDAiA", + "7Mr/ARCB7Mr/ASKcAgoRR2VuZXJhdGVkQ29kZUluZm8SQQoKYW5ub3RhdGlv", + "bhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5B", + "bm5vdGF0aW9uGsMBCgpBbm5vdGF0aW9uEhAKBHBhdGgYASADKAVCAhABEhMK", + "C3NvdXJjZV9maWxlGAIgASgJEg0KBWJlZ2luGAMgASgFEgsKA2VuZBgEIAEo", + "BRJICghzZW1hbnRpYxgFIAEoDjI2Lmdvb2dsZS5wcm90b2J1Zi5HZW5lcmF0", + "ZWRDb2RlSW5mby5Bbm5vdGF0aW9uLlNlbWFudGljIigKCFNlbWFudGljEggK", + "BE5PTkUQABIHCgNTRVQQARIJCgVBTElBUxACKqcCCgdFZGl0aW9uEhMKD0VE", + "SVRJT05fVU5LTk9XThAAEhMKDkVESVRJT05fTEVHQUNZEIQHEhMKDkVESVRJ", + "T05fUFJPVE8yEOYHEhMKDkVESVRJT05fUFJPVE8zEOcHEhEKDEVESVRJT05f", + "MjAyMxDoBxIRCgxFRElUSU9OXzIwMjQQ6QcSFwoTRURJVElPTl8xX1RFU1Rf", + "T05MWRABEhcKE0VESVRJT05fMl9URVNUX09OTFkQAhIdChdFRElUSU9OXzk5", + "OTk3X1RFU1RfT05MWRCdjQYSHQoXRURJVElPTl85OTk5OF9URVNUX09OTFkQ", + "no0GEh0KF0VESVRJT05fOTk5OTlfVEVTVF9PTkxZEJ+NBhITCgtFRElUSU9O", + "X01BWBD/////B0J+ChNjb20uZ29vZ2xlLnByb3RvYnVmQhBEZXNjcmlwdG9y", + "UHJvdG9zSAFaLWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2Rl", + "c2NyaXB0b3JwYvgBAaICA0dQQqoCGkdvb2dsZS5Qcm90b2J1Zi5SZWZsZWN0", + "aW9u")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.Reflection.Edition), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -273,7 +279,7 @@ namespace Google.Protobuf.Reflection { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Features", "Deprecated", "UninterpretedOption" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "IdempotencyLevel", "Features", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FeatureSet), global::Google.Protobuf.Reflection.FeatureSet.Parser, new[]{ "FieldPresence", "EnumType", "RepeatedFieldEncoding", "Utf8Validation", "MessageEncoding", "JsonFormat" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.FieldPresence), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.EnumType), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.RepeatedFieldEncoding), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.Utf8Validation), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.MessageEncoding), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.JsonFormat) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FeatureSet), global::Google.Protobuf.Reflection.FeatureSet.Parser, new[]{ "FieldPresence", "EnumType", "RepeatedFieldEncoding", "Utf8Validation", "MessageEncoding", "JsonFormat", "EnforceNamingStyle" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.FieldPresence), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.EnumType), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.RepeatedFieldEncoding), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.Utf8Validation), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.MessageEncoding), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.JsonFormat), typeof(global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FeatureSetDefaults), global::Google.Protobuf.Reflection.FeatureSetDefaults.Parser, new[]{ "Defaults", "MinimumEdition", "MaximumEdition" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FeatureSetDefaults.Types.FeatureSetEditionDefault), global::Google.Protobuf.Reflection.FeatureSetDefaults.Types.FeatureSetEditionDefault.Parser, new[]{ "Edition", "OverridableFeatures", "FixedFeatures" }, null, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End", "Semantic" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Types.Semantic) }, null, null)}) @@ -817,6 +823,9 @@ namespace Google.Protobuf.Reflection { /// The supported values are "proto2", "proto3", and "editions". /// /// If `edition` is present, this value must be "editions". + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -846,6 +855,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.Edition edition_; /// <summary> /// The edition of the proto file. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -6675,6 +6687,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -7653,6 +7668,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -8409,6 +8427,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -9711,6 +9732,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -10102,6 +10126,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -10496,6 +10523,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -10911,6 +10941,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -11316,6 +11349,9 @@ namespace Google.Protobuf.Reflection { private global::Google.Protobuf.Reflection.FeatureSet features_; /// <summary> /// Any features defined in the specific edition. + /// WARNING: This field should only be used by protobuf plugins or special + /// cases like the proto compiler. Other uses are discouraged and + /// developers should rely on the protoreflect APIs for their client language. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -12463,6 +12499,7 @@ namespace Google.Protobuf.Reflection { utf8Validation_ = other.utf8Validation_; messageEncoding_ = other.messageEncoding_; jsonFormat_ = other.jsonFormat_; + enforceNamingStyle_ = other.enforceNamingStyle_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _extensions = pb::ExtensionSet.Clone(other._extensions); } @@ -12635,6 +12672,33 @@ namespace Google.Protobuf.Reflection { _hasBits0 &= ~32; } + /// <summary>Field number for the "enforce_naming_style" field.</summary> + public const int EnforceNamingStyleFieldNumber = 7; + private readonly static global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle EnforceNamingStyleDefaultValue = global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle.Unknown; + + private global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle enforceNamingStyle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle EnforceNamingStyle { + get { if ((_hasBits0 & 64) != 0) { return enforceNamingStyle_; } else { return EnforceNamingStyleDefaultValue; } } + set { + _hasBits0 |= 64; + enforceNamingStyle_ = value; + } + } + /// <summary>Gets whether the "enforce_naming_style" field is set</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasEnforceNamingStyle { + get { return (_hasBits0 & 64) != 0; } + } + /// <summary>Clears the value of the "enforce_naming_style" field</summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearEnforceNamingStyle() { + _hasBits0 &= ~64; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -12656,6 +12720,7 @@ namespace Google.Protobuf.Reflection { if (Utf8Validation != other.Utf8Validation) return false; if (MessageEncoding != other.MessageEncoding) return false; if (JsonFormat != other.JsonFormat) return false; + if (EnforceNamingStyle != other.EnforceNamingStyle) return false; if (!Equals(_extensions, other._extensions)) { return false; } @@ -12672,6 +12737,7 @@ namespace Google.Protobuf.Reflection { if (HasUtf8Validation) hash ^= Utf8Validation.GetHashCode(); if (HasMessageEncoding) hash ^= MessageEncoding.GetHashCode(); if (HasJsonFormat) hash ^= JsonFormat.GetHashCode(); + if (HasEnforceNamingStyle) hash ^= EnforceNamingStyle.GetHashCode(); if (_extensions != null) { hash ^= _extensions.GetHashCode(); } @@ -12717,6 +12783,10 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(48); output.WriteEnum((int) JsonFormat); } + if (HasEnforceNamingStyle) { + output.WriteRawTag(56); + output.WriteEnum((int) EnforceNamingStyle); + } if (_extensions != null) { _extensions.WriteTo(output); } @@ -12754,6 +12824,10 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(48); output.WriteEnum((int) JsonFormat); } + if (HasEnforceNamingStyle) { + output.WriteRawTag(56); + output.WriteEnum((int) EnforceNamingStyle); + } if (_extensions != null) { _extensions.WriteTo(ref output); } @@ -12785,6 +12859,9 @@ namespace Google.Protobuf.Reflection { if (HasJsonFormat) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) JsonFormat); } + if (HasEnforceNamingStyle) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) EnforceNamingStyle); + } if (_extensions != null) { size += _extensions.CalculateSize(); } @@ -12818,6 +12895,9 @@ namespace Google.Protobuf.Reflection { if (other.HasJsonFormat) { JsonFormat = other.JsonFormat; } + if (other.HasEnforceNamingStyle) { + EnforceNamingStyle = other.EnforceNamingStyle; + } pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -12864,6 +12944,10 @@ namespace Google.Protobuf.Reflection { JsonFormat = (global::Google.Protobuf.Reflection.FeatureSet.Types.JsonFormat) input.ReadEnum(); break; } + case 56: { + EnforceNamingStyle = (global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle) input.ReadEnum(); + break; + } } } #endif @@ -12909,6 +12993,10 @@ namespace Google.Protobuf.Reflection { JsonFormat = (global::Google.Protobuf.Reflection.FeatureSet.Types.JsonFormat) input.ReadEnum(); break; } + case 56: { + EnforceNamingStyle = (global::Google.Protobuf.Reflection.FeatureSet.Types.EnforceNamingStyle) input.ReadEnum(); + break; + } } } } @@ -12978,6 +13066,12 @@ namespace Google.Protobuf.Reflection { [pbr::OriginalName("LEGACY_BEST_EFFORT")] LegacyBestEffort = 2, } + public enum EnforceNamingStyle { + [pbr::OriginalName("ENFORCE_NAMING_STYLE_UNKNOWN")] Unknown = 0, + [pbr::OriginalName("STYLE2024")] Style2024 = 1, + [pbr::OriginalName("STYLE_LEGACY")] StyleLegacy = 2, + } + } #endregion diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs index 7289e44a0f569..1fe9465751e32 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs @@ -279,7 +279,7 @@ namespace Google.Protobuf.Reflection { // Chop off the last component of the scope. - int dotpos = scopeToTry.ToString().LastIndexOf("."); + int dotpos = scopeToTry.ToString().LastIndexOf('.'); if (dotpos == -1) { result = FindSymbol<IDescriptor>(name); diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.cs index 13e922336ff10..0b55005c82a84 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.cs @@ -9,6 +9,8 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; using static Google.Protobuf.Reflection.FeatureSet.Types; namespace Google.Protobuf.Reflection; @@ -22,52 +24,55 @@ namespace Google.Protobuf.Reflection; /// If either of those features are ever implemented in this runtime, /// the feature settings will be exposed as properties in this class. /// </remarks> -internal sealed class FeatureSetDescriptor +internal sealed partial class FeatureSetDescriptor { private static readonly ConcurrentDictionary<FeatureSet, FeatureSetDescriptor> cache = new(); - // Note: this approach is deliberately chosen to circumvent bootstrapping issues. - // This can still be tested using the binary representation. - // TODO: Generate this code (as a partial class) from the binary representation. - private static readonly FeatureSetDescriptor edition2023Defaults = new FeatureSetDescriptor( - new FeatureSet + private static readonly IReadOnlyDictionary<Edition, FeatureSetDescriptor> descriptorsByEdition = BuildEditionDefaults(); + + // Note: if the debugger is set to break within this code, various type initializers will fail + // as the debugger will try to call ToString() on messages, requiring descriptors to be accessed etc. + // There's a possible workaround of using a hard-coded bootstrapping FeatureSetDescriptor to be returned + // by GetEditionDefaults if descriptorsByEdition is null, but it's ugly and likely just pushes the problem + // elsewhere. Normal debugging sessions (where the initial bootstrapping code doesn't hit any breakpoints) + // do not cause any problems. + private static IReadOnlyDictionary<Edition, FeatureSetDescriptor> BuildEditionDefaults() + { + var featureSetDefaults = FeatureSetDefaults.Parser.ParseFrom(Convert.FromBase64String(DefaultsBase64)); + var ret = new Dictionary<Edition, FeatureSetDescriptor>(); + + // Note: Enum.GetValues<TEnum> isn't available until .NET 5. It's not worth making this conditional + // based on that. + var supportedEditions = ((Edition[]) Enum.GetValues(typeof(Edition))) + .OrderBy(x => x) + .Where(e => e >= featureSetDefaults.MinimumEdition && e <= featureSetDefaults.MaximumEdition); + + // We assume the embedded defaults will always contain "legacy". + var currentDescriptor = MaybeCreateDescriptor(Edition.Legacy); + foreach (var edition in supportedEditions) { - EnumType = EnumType.Open, - FieldPresence = FieldPresence.Explicit, - JsonFormat = JsonFormat.Allow, - MessageEncoding = MessageEncoding.LengthPrefixed, - RepeatedFieldEncoding = RepeatedFieldEncoding.Packed, - Utf8Validation = Utf8Validation.Verify, - }); - private static readonly FeatureSetDescriptor proto2Defaults = new FeatureSetDescriptor( - new FeatureSet + currentDescriptor = MaybeCreateDescriptor(edition) ?? currentDescriptor; + ret[edition] = currentDescriptor; + } + return ret; + + FeatureSetDescriptor MaybeCreateDescriptor(Edition edition) { - EnumType = EnumType.Closed, - FieldPresence = FieldPresence.Explicit, - JsonFormat = JsonFormat.LegacyBestEffort, - MessageEncoding = MessageEncoding.LengthPrefixed, - RepeatedFieldEncoding = RepeatedFieldEncoding.Expanded, - Utf8Validation = Utf8Validation.None, - }); - private static readonly FeatureSetDescriptor proto3Defaults = new FeatureSetDescriptor( - new FeatureSet - { - EnumType = EnumType.Open, - FieldPresence = FieldPresence.Implicit, - JsonFormat = JsonFormat.Allow, - MessageEncoding = MessageEncoding.LengthPrefixed, - RepeatedFieldEncoding = RepeatedFieldEncoding.Packed, - Utf8Validation = Utf8Validation.Verify, - }); + var editionDefaults = featureSetDefaults.Defaults.SingleOrDefault(d => d.Edition == edition); + if (editionDefaults is null) + { + return null; + } + var proto = new FeatureSet(); + proto.MergeFrom(editionDefaults.FixedFeatures); + proto.MergeFrom(editionDefaults.OverridableFeatures); + return new FeatureSetDescriptor(proto); + } + } internal static FeatureSetDescriptor GetEditionDefaults(Edition edition) => - edition switch - { - Edition.Proto2 => proto2Defaults, - Edition.Proto3 => proto3Defaults, - Edition._2023 => edition2023Defaults, - _ => throw new ArgumentOutOfRangeException($"Unsupported edition: {edition}") - }; + descriptorsByEdition.TryGetValue(edition, out var defaults) ? defaults + : throw new ArgumentOutOfRangeException($"Unsupported edition: {edition}"); // Visible for testing. The underlying feature set proto, usually derived during // feature resolution. diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs new file mode 100644 index 0000000000000..fcaed0734e9cd --- /dev/null +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs @@ -0,0 +1,17 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd +#endregion + +namespace Google.Protobuf.Reflection; + +internal sealed partial class FeatureSetDescriptor +{ + // Canonical serialized form of the edition defaults, generated by embed_edition_defaults. + private const string DefaultsBase64 = + "ChUYhAciACoOCAEQAhgCIAMoATACOAIKFRjnByIAKg4IAhABGAEgAigBMAE4AgoVGOgHIgwIARABGAEgAigBMAEqAjgCIOYHKOgH"; +} diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs.template b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs.template new file mode 100644 index 0000000000000..a287b02cadbbe --- /dev/null +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs.template @@ -0,0 +1,17 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd +#endregion + +namespace Google.Protobuf.Reflection; + +internal sealed partial class FeatureSetDescriptor +{ + // Canonical serialized form of the edition defaults, generated by embed_edition_defaults. + private const string DefaultsBase64 = + "DEFAULTS_VALUE"; +} diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs index 0654a25f5b28d..648b37ad30aaf 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs @@ -120,7 +120,7 @@ namespace Google.Protobuf.Reflection // a MapField, but that feels a tad nasty. PropertyName = propertyName; Extension = extension; - JsonName = Proto.JsonName == "" ? JsonFormatter.ToJsonName(Proto.Name) : Proto.JsonName; + JsonName = Proto.JsonName.Length == 0 ? JsonFormatter.ToJsonName(Proto.Name) : Proto.JsonName; } /// <summary> diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs index c7b307b1c85d4..773d5c2a87188 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs @@ -63,7 +63,7 @@ namespace Google.Protobuf.Reflection private readonly Lazy<Dictionary<IDescriptor, DescriptorDeclaration>> declarations; - private FileDescriptor(ByteString descriptorData, FileDescriptorProto proto, IEnumerable<FileDescriptor> dependencies, DescriptorPool pool, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo) + private FileDescriptor(ByteString descriptorData, FileDescriptorProto proto, IList<FileDescriptor> dependencies, DescriptorPool pool, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo) { SerializedData = descriptorData; DescriptorPool = pool; @@ -128,7 +128,7 @@ namespace Google.Protobuf.Reflection return current; } - private DescriptorBase GetDescriptorFromList(IReadOnlyList<DescriptorBase> list, int index) + private static DescriptorBase GetDescriptorFromList(IReadOnlyList<DescriptorBase> list, int index) { // This is fine: it may be a newer version of protobuf than we understand, with a new descriptor // field. @@ -419,7 +419,7 @@ namespace Google.Protobuf.Reflection { ExtensionRegistry registry = new ExtensionRegistry(); registry.AddRange(GetAllExtensions(dependencies, generatedCodeInfo)); - + FileDescriptorProto proto; try { diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/RepeatedFieldExtensions.cs b/third_party/protobuf/csharp/src/Google.Protobuf/RepeatedFieldExtensions.cs new file mode 100644 index 0000000000000..83ae21b35b997 --- /dev/null +++ b/third_party/protobuf/csharp/src/Google.Protobuf/RepeatedFieldExtensions.cs @@ -0,0 +1,38 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd +#endregion + +using System; +using System.Security; +using Google.Protobuf.Collections; + +// Note: The choice of the namespace here is important because it's rare that people will directly reference Google.Protobuf.Collections +// in their app as they're typically using collections created by generated code. We are keeping the extension method in the Google.Protobuf +// namespace so that it is discoverable by most users. + +namespace Google.Protobuf +{ + /// <summary> + /// A set of extension methods on <see cref="RepeatedField{T}"/> + /// </summary> + public static class RepeatedFieldExtensions + { + // Note: This method is an extension method to avoid ambiguous overload conflict with existing AddRange(IEnumerable<T>) when the source is an array. + /// <summary>Adds the elements of the specified span to the end of the <see cref="RepeatedField{T}"/>.</summary> + /// <typeparam name="T">The type of elements in the <see cref="RepeatedField{T}"/>.</typeparam> + /// <param name="repeatedField">The list to which the elements should be added.</param> + /// <param name="source">The span whose elements should be added to the end of the <see cref="RepeatedField{T}"/>.</param> + /// <exception cref="ArgumentNullException">The <paramref name="repeatedField"/> is null.</exception> + [SecuritySafeCritical] + public static void AddRange<T>(this RepeatedField<T> repeatedField, ReadOnlySpan<T> source) + { + ProtoPreconditions.CheckNotNull(repeatedField, nameof(repeatedField)); + repeatedField.AddRangeSpan(source); + } + } +} \ No newline at end of file diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/UnsafeCollectionOperations.cs b/third_party/protobuf/csharp/src/Google.Protobuf/UnsafeCollectionOperations.cs new file mode 100644 index 0000000000000..02391465721dc --- /dev/null +++ b/third_party/protobuf/csharp/src/Google.Protobuf/UnsafeCollectionOperations.cs @@ -0,0 +1,96 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#endregion + +using System; +using System.Security; +using Google.Protobuf.Collections; + +namespace Google.Protobuf; + +/// <summary> +/// An unsafe class that provides a set of methods to access the underlying data representations of +/// collections. +/// </summary> +[SecuritySafeCritical] +public static class UnsafeCollectionOperations +{ + /// <summary> + /// <para> + /// Returns a <see cref="Span{T}"/> that wraps the current backing array of the given + /// <see cref="RepeatedField{T}"/>. + /// </para> + /// <para> + /// Values in the <see cref="Span{T}"/> should not be set to null. Use + /// <see cref="RepeatedField{T}.Remove(T)"/> or <see cref="RepeatedField{T}.RemoveAt(int)"/> to + /// remove items instead. + /// </para> + /// <para> + /// The returned <see cref="Span{T}"/> is only valid until the size of the + /// <see cref="RepeatedField{T}"/> is modified, after which its state becomes undefined. + /// Modifying existing elements without changing the size is safe as long as the modifications + /// do not set null values. + /// </para> + /// </summary> + /// <typeparam name="T"> + /// The type of elements in the <see cref="RepeatedField{T}"/>. + /// </typeparam> + /// <param name="field"> + /// The <see cref="RepeatedField{T}"/> for which to wrap the current backing array. Must not be + /// null. + /// </param> + /// <returns> + /// A <see cref="Span{T}"/> that wraps the current backing array of the + /// <see cref="RepeatedField{T}"/>. + /// </returns> + /// <exception cref="ArgumentNullException"> + /// Thrown if <paramref name="field"/> is <see langword="null"/>. + /// </exception> + public static Span<T> AsSpan<T>(RepeatedField<T> field) + { + ProtoPreconditions.CheckNotNull(field, nameof(field)); + return field.AsSpan(); + } + + /// <summary> + /// <para> + /// Sets the count of the specified <see cref="RepeatedField{T}"/> to the given value. + /// </para> + /// <para> + /// This method should only be called if the subsequent code guarantees to populate + /// the field with the specified number of items. + /// </para> + /// <para> + /// If count is less than <see cref="RepeatedField{T}.Count"/>, the collection is effectively + /// trimmed down to the first count elements. <see cref="RepeatedField{T}.Capacity"/> + /// is unchanged, meaning the underlying array remains allocated. + /// </para> + /// </summary> + /// <typeparam name="T"> + /// The type of elements in the <see cref="RepeatedField{T}"/>. + /// </typeparam> + /// <param name="field"> + /// The field to set the count of. Must not be null. + /// </param> + /// <param name="count"> + /// The value to set the field's count to. Must be non-negative. + /// </param> + /// <exception cref="ArgumentNullException"> + /// Thrown if <paramref name="field"/> is <see langword="null"/>. + /// </exception> + /// <exception cref="ArgumentOutOfRangeException"> + /// Thrown if <paramref name="count"/> is negative. + /// </exception> + public static void SetCount<T>(RepeatedField<T> field, int count) + { + ProtoPreconditions.CheckNotNull(field, nameof(field)); + field.SetCount(count); + } +} \ No newline at end of file diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs b/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs index 2abd118cbf62e..fc2e8647ba902 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs @@ -57,6 +57,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `double`. /// /// The JSON representation for `DoubleValue` is JSON number. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class DoubleValue : pb::IMessage<DoubleValue> @@ -263,6 +266,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `float`. /// /// The JSON representation for `FloatValue` is JSON number. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class FloatValue : pb::IMessage<FloatValue> @@ -469,6 +475,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `int64`. /// /// The JSON representation for `Int64Value` is JSON string. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class Int64Value : pb::IMessage<Int64Value> @@ -675,6 +684,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `uint64`. /// /// The JSON representation for `UInt64Value` is JSON string. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class UInt64Value : pb::IMessage<UInt64Value> @@ -881,6 +893,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `int32`. /// /// The JSON representation for `Int32Value` is JSON number. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class Int32Value : pb::IMessage<Int32Value> @@ -1087,6 +1102,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `uint32`. /// /// The JSON representation for `UInt32Value` is JSON number. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class UInt32Value : pb::IMessage<UInt32Value> @@ -1293,6 +1311,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `bool`. /// /// The JSON representation for `BoolValue` is JSON `true` and `false`. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class BoolValue : pb::IMessage<BoolValue> @@ -1499,6 +1520,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `string`. /// /// The JSON representation for `StringValue` is JSON string. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class StringValue : pb::IMessage<StringValue> @@ -1705,6 +1729,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Wrapper message for `bytes`. /// /// The JSON representation for `BytesValue` is JSON string. + /// + /// Not recommended for use in new APIs, but still useful for legacy APIs and + /// has no plan to be removed. /// </summary> [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] public sealed partial class BytesValue : pb::IMessage<BytesValue> diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/WritingPrimitives.cs b/third_party/protobuf/csharp/src/Google.Protobuf/WritingPrimitives.cs index 7e77321404aa0..372c03ef4fac1 100644 --- a/third_party/protobuf/csharp/src/Google.Protobuf/WritingPrimitives.cs +++ b/third_party/protobuf/csharp/src/Google.Protobuf/WritingPrimitives.cs @@ -27,6 +27,8 @@ namespace Google.Protobuf [SecuritySafeCritical] internal static class WritingPrimitives { + // Ideally we would use the same UTF8Encoding as parse, but we should be able to serialize + // invalid UTF-8 that make it in via unvalidated setters without throwing an exception. #if NET5_0_OR_GREATER internal static Encoding Utf8Encoding => Encoding.UTF8; // allows JIT to devirtualize #else @@ -35,7 +37,7 @@ namespace Google.Protobuf // difference.) #endif - #region Writing of values (not including tags) +#region Writing of values (not including tags) /// <summary> /// Writes a double field value, without a tag, to the stream. diff --git a/third_party/protobuf/docs/options.md b/third_party/protobuf/docs/options.md index 86bb8499eb8af..ddc80d733994a 100644 --- a/third_party/protobuf/docs/options.md +++ b/third_party/protobuf/docs/options.md @@ -447,9 +447,9 @@ with info about your project (name and website) so we can add an entry for you. * Website: http://buf.build/ * Extension: 1157-1166 -1. Connect +1. Connect RPC - * Website: http://connect.build/ + * Website: http://connectrpc.com/ * Extension: 1167-1176 1. protocel @@ -511,3 +511,23 @@ with info about your project (name and website) so we can add an entry for you. * Website: https://nebius.ai * Extensions: 1191-1199 + +1. Buf + + * Website: http://buf.build/ + * Extension: 1200-1239 + +1. userver + + * Website: https://userver.tech/ + * Extensions: 1240-1249 + +1. protoc-gen-default / protoc-gen-env (confpb) + + * Website: https://github.com/MarnixBouhuis/confpb + * Extensions: 1250-1251 + +1. JaiaBot + + * Website: https://github.com/jaiarobotics/jaiabot + * Extensions: 1252 diff --git a/third_party/protobuf/docs/third_party.md b/third_party/protobuf/docs/third_party.md index 6f9a4f3a29a8b..c96719d57ec40 100644 --- a/third_party/protobuf/docs/third_party.md +++ b/third_party/protobuf/docs/third_party.md @@ -22,6 +22,7 @@ These are projects we know about implementing Protocol Buffers for other program * C: https://github.com/eerimoq/pbtools * C++: https://github.com/protocolbuffers/protobuf (Google-official implementation) +* C++: https://github.com/tonda-kriz/simple-protobuf * C++: https://EmbeddedProto.com * C++: https://github.com/yksten/struct2x * C/C++: http://spbc.sf.net/ @@ -256,3 +257,5 @@ There are miscellaneous other things you may find useful as a Protocol Buffers d `clojurescript` * [gRPC Federation - generates a gRPC server by writing a custom option in Protocol Buffers](https://github.com/mercari/grpc-federation) +* [Proto Boiler - A plugin to generate boilerplate code from .proto files + using templates](https://github.com/in4lio/protoboiler) diff --git a/third_party/protobuf/docs/upb/arena_fusion.md b/third_party/protobuf/docs/upb/arena_fusion.md new file mode 100644 index 0000000000000..4d363c7b82217 --- /dev/null +++ b/third_party/protobuf/docs/upb/arena_fusion.md @@ -0,0 +1,273 @@ +<!--- +This document contains embedded graphviz diagrams inside ```dot blocks. + +To convert it to rendered form using render.py: + $ ./render.py wrapping-upb.in.md + +You can also live-preview this document with all diagrams using Markdown Preview Enhanced +in Visual Studio Code: + https://marketplace.visualstudio.com/items?itemName=shd101wyy.markdown-preview-enhanced +---> + +# μpb Arena Fusion + +μpb generally follows a thread-compatibility model where only operations on a +`const` pointer may occur concurrently from multiple threads; non-const +operations must not race with each other or operations on `const` pointers. + +Fusion, via `upb_Arena_Fuse`, binds the lifetime of two arenas together, such +that none are freed until all of the transitively fused arenas reach refcount 0. +This is useful to avoid dangling pointers when a message in one arena references +a message in another - such as when a child message is constructed in isolation +then set onto a parent message - by fusing the parent's arena with the child's, +the child's lifetime is tied to the parent's without needing to copy it. + +Both modifying the refcount and fusing are thread safe; if you want to +conceptually perform allocations concurrently from multiple threads with the +same arena lifetime, one way to achieve that would be to share a `const +upb_Arena* parent` plus a dedicated arena per thread, and fuse the +thread-specific arena with the `parent` arena. By contrast, reference counting +cannot help to achieve concurrent allocations on multiple threads, it only helps +in synchronizing lifetimes from multiple things observing the same arena (which +may be a non-`const` pointer for multiple writers in a single threaded context, +or a `const` pointer for multiple readers in a multithreaded context). + +To be usable everywhere, it has a lock-free implementation, documented below. + +## Data Structure + +Each arena has three pointer sized members used to track the relationship +between arenas. Together, they implement a hybrid disjoint set forest and +doubly-linked list. + +```c +// Tagged pointer - tracked as black arrows in diagrams +UPB_ATOMIC(uintptr_t) parent_or_count; +// Linked list - tracked as red arrows in diagrams +UPB_ATOMIC(struct upb_ArenaInternal*) next; +// Linked list - previous tracked as blue arrows in diagrams, tail as dashed +UPB_ATOMIC(uintptr_t) previous_or_tail; +``` + +The disjoint set is used to check whether two arenas are already fused and to +provide agreement on a single reference count across all fused arenas. The +linked list is used to implement freeing arenas once the refcount reaches 0, and +to implement `upb_Arena_SpaceAllocated`. + +Two arenas are considered fused when the disjoint set says they are; the linked +list is guaranteed to converge before the refcount reaches 0, but may only track +a subset of fused arenas while racing with fuse calls. + +## Finding the root + +Each set of fused arenas is uniqiuely identified by the root node of its tree. +To find the root for a given arena, traverse the `parent_or_count` pointer until +you reach a node with a count instead of a parent pointer - that's the root. To +avoid expensive lookups if frequently repeated, this data structure uses path +splitting to halve the distance from the root for every node traversed. +Repeatedly finding the root for a series of nodes that are part of the same +fused set will converge to O(1) quickly. Let's find the root of D, starting +with: + +```dot +digraph { +C [label="C (next)"] +D [label="D (current)"] +A -> B [dir=back] +B -> C [dir=back] +C -> D [dir=back] +} +``` + +We traverse our parents; each time we pass one we link it to its grandparent, so +that future lookups are faster. + +```dot +digraph { +B [label="B (next)"] +C [label="C (current)"] +A -> B [dir=back] +B -> C [dir=back] +B -> D [dir=back] +} +``` + +Then: + +```dot +digraph { +A [label="A (next)"] +B [label="B (current)"] +A -> B [dir=back] +A -> C [dir=back] +B -> D [dir=back] +} +``` + +D and C's paths got shorter; if we query D's root again, all subsequent lookups +will only require one step. + +## Fusing + +Fusing starts by identifying the roots of each arena to fuse - if they already +share a root, there's nothing to be done. We'll work through the example of +fusing C and D - which is the same as fusing A and B, as they're the roots. + +```dot +digraph { +A [label="A (refs=2)"] +B [label="B (refs=3)"] +A -> C [dir=back] +A -> C [weight=0.001, color="red"] +C -> A [weight=0.001, color="blue"] +A -> C [style=dashed] +B -> D [dir=back] +B -> D [weight=0.001, color="red"] +D -> B [weight=0.001, color="blue"] +B -> D [style=dashed] +} +``` + +A and B are roots, so they store a refcount in their `parent_or_count` and the +start of the linked list in their `next` pointers; C and D are not, so they +store pointers to their parent node in `parent_or_count`. C and D store `NULL` +in `next` as they happen to be the last nodes in their set. + +### Pass refcount + +As soon as the parent changes, all future refcount operations will switch to the +new root. To avoid decrementing to 0 while the old root still has active +references, we add the lower-addressed node's refcount to the new root. + +```dot +digraph { +A [label="A (refs=5)"] +B [label="B (refs=3)"] +A -> C [dir=back] +A -> C [weight=0.001, color="red"] +C -> A [weight=0.001, color="blue"] +A -> C [style=dashed] +B -> D [dir=back] +B -> D [weight=0.001, color="red"] +D -> B [weight=0.001, color="blue"] +B -> D [style=dashed] +} +``` + +The total transferred refcount is tracked throughout the operation so it can be +fixed up at the end if retries resulted in over-transfer. + +### Union + +Now the arena with a lower address becomes the new root (A in this case), by +compare-and-exchange the higher address arena's `parent_or_count` pointer. + +```dot +digraph { +A [label="A (refs=5)"] +A -> C [dir=back] +A -> C [weight=0.001, color="red"] +C -> A [weight=0.001, color="blue"] +A -> C [style=dashed] +B -> D [dir=back] +B -> D [weight=0.001, color="red"] +D -> B [weight=0.001, color="blue"] +B -> D [style=dashed] +A -> B [dir=back] +} +``` + +This atomically eliminates B's refcount and makes it one of A's children. Any +change to B's refcount (or fusing it to a different arena with a lower address) +will make the swap fail, and the process starts again from the beginning. + +### Refcount fixups + +If B's refcount changed while performing the union, we increase or decrease A's +refcount by the difference between the initial refcount we added and B's final +refcount, observed as part of the compare-and-exchange of B's `parent_or_count`. + +### Fuse linked lists + +To fuse the linked lists, we need to make A's tail point to B. The root node is +always the start of the linked list, so that the list can't contain cycles. From +A's tail pointer, we traverse until we hit the end (C in this case), and CAS its +`next` to B. + +```dot +digraph { +A [label="A (refs=5)"] +A -> C [dir=back] +A -> C [weight=0.001, color="red"] +C -> A [weight=0.001, color="blue"] +A -> C [style=dashed] +B -> D [dir=back] +B -> D [weight=0.001, color="red"] +D -> B [weight=0.001, color="blue"] +B -> D [style=dashed] +A -> B [dir=back] +C -> B [weight=0.001, color="red"] +} +``` + +With this, B is now reachable from the root and the final free operation will be +able to see it, traversing A->C->B->D. + +### Update tail pointer + +If we stopped at the previous step, it's easy to see how fusing many arenas +could result in O(n^2) behavior, as we'd spend all of our time traversing the +linked list from the root to find the tail. To avoid this, we update A's tail +pointer to point to B's tail - so the next fuse operation will not have to +traverse C or B. + +```dot +digraph { +A [label="A (refs=5)"] +A -> C [dir=back] +A -> C [weight=0.001, color="red"] +C -> A [weight=0.001, color="blue"] +A -> D [style=dashed] +B -> D [dir=back] +B -> D [weight=0.001, color="red"] +D -> B [weight=0.001, color="blue"] +B -> D [style=dashed] +A -> B [dir=back] +C -> B [weight=0.001, color="red"] +} +``` + +### Update back links + +To make it possible to always traverse the list in both directions for +`upb_Arena_SpaceAllocated`, we need to make the matching back link for our +doubly-linked list. Since we linked C to B, we need to link B to C via B's +`previous_or_tail` pointer. + +```dot +digraph { +A [label="A (refs=5)"] +A -> C [dir=back] +A -> C [weight=0.001, color="red"] +C -> A [weight=0.001, color="blue"] +A -> D [style=dashed] +B -> D [dir=back] +B -> D [weight=0.001, color="red"] +D -> B [weight=0.001, color="blue"] +B -> C [weight=0.001, color="blue"] +A -> B [dir=back] +C -> B [weight=0.001, color="red"] +} +``` + +## Counting allocated space + +Traversing the linked list while the arenas are still live can be tricky, as we +can't necessarily reach our own node via the linked list from the root. Instead, +we scan the linked list in both directions starting from the caller-specified +node. This makes space counting weakly consistent - it's possible to see that A +and B are fused, but not see A's space reflected in `SpaceAllocated(B)` if the +fuse operation that joined them is still in progress. But counting allocated +space is always consistent with itself and any fully complete fuses - nodes are +only appended or prepended to the list, so starting the traversal at the same +point each time guarantees that future scans see a superset of previous ones. diff --git a/third_party/protobuf/docs/upb/design.md b/third_party/protobuf/docs/upb/design.md index 1192e6ccabb17..a2252df82da8f 100644 --- a/third_party/protobuf/docs/upb/design.md +++ b/third_party/protobuf/docs/upb/design.md @@ -117,7 +117,7 @@ To help with the multiple arena case, upb provides a primitive called "fuse". ```c // Fuses the lifetimes of `a` and `b`. None of the blocks from `a` or `b` // will be freed until both arenas are freed. -UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); +UPB_API bool upb_Arena_Fuse(const upb_Arena* a, const upb_Arena* b); ``` When two arenas are fused together, their lifetimes are irreversibly joined, @@ -237,12 +237,12 @@ because both the code size and the runtime memory overhead will be less than There are three main ways of loading a MiniTable: -1. **From C generated code:** The upb code generator can emit `.upb.c` files that - contain the MiniTables as global constant variables. When the main program - links against these, the MiniTable will be placed into `.rodata` (or - `.data.rel.ro`) in the binary. The MiniTable can then be obtained from a - generated function. In Blaze/Bazel these files can be generated and linked - using the `upb_proto_library()` rule. +1. **From C generated code:** The upb code generator can emit + `.upb_minitable.c` files that contain the MiniTables as global constant + variables. When the main program links against these, the MiniTable will be + placed into `.rodata` (or `.data.rel.ro`) in the binary. The MiniTable can + then be obtained from a generated function. In Blaze/Bazel these files can + be generated and linked using the `upb_minitable_proto_library()` rule. 2. **From MiniDescriptors:** The user can build MiniDescriptors into MiniTables at runtime. MiniDescriptors are a compact upb-specific wire format designed specially for this purpose. The user can call `upb_MiniTable_Build()` at diff --git a/third_party/protobuf/editions/BUILD b/third_party/protobuf/editions/BUILD index 21aba6657da87..be76db2835453 100644 --- a/third_party/protobuf/editions/BUILD +++ b/third_party/protobuf/editions/BUILD @@ -4,7 +4,6 @@ load("//bazel:cc_proto_library.bzl", "cc_proto_library") load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library") load("//bazel:java_proto_library.bzl", "java_proto_library") load("//bazel:proto_library.bzl", "proto_library") -load("//bazel:py_proto_library.bzl", "py_proto_library") load("//bazel:upb_proto_library.bzl", "upb_c_proto_library", "upb_proto_reflection_library") load(":defaults.bzl", "compile_edition_defaults", "embed_edition_defaults") @@ -73,14 +72,15 @@ embed_edition_defaults( cc_binary( name = "internal_defaults_escape", srcs = ["internal_defaults_escape.cc"], + malloc = "@bazel_tools//tools/cpp:malloc", # This needs to be public for users of embed_edition_defaults. visibility = ["//visibility:public"], deps = [ "//src/google/protobuf", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/flags:parse", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/flags:parse", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -103,7 +103,6 @@ cc_test( ], deps = [ ":defaults_test_embedded", - "//:protobuf", "//java/core:java_features_cc_proto", "//src/google/protobuf", "//src/google/protobuf:cpp_features_cc_proto", @@ -114,14 +113,14 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", "@bazel_tools//tools/cpp/runfiles", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -309,10 +308,10 @@ cc_test( ":test_editions_default_features_cc_proto", ":test_messages_proto2_editions_cc_proto", ":test_messages_proto3_editions_cc_proto", - "//:protobuf", + "//src/google/protobuf", "//src/google/protobuf:test_textproto", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -321,8 +320,8 @@ cc_test( srcs = ["generated_reflection_test.cc"], deps = [ ":test_messages_proto2_editions_cc_proto", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/editions/codegen_tests/BUILD b/third_party/protobuf/editions/codegen_tests/BUILD index 1ee0a9ef508c4..589ee5583d4a2 100644 --- a/third_party/protobuf/editions/codegen_tests/BUILD +++ b/third_party/protobuf/editions/codegen_tests/BUILD @@ -1,4 +1,5 @@ load("//bazel:cc_proto_library.bzl", "cc_proto_library") +load("//bazel:proto_library.bzl", "proto_library") package( default_applicable_licenses = ["//:license"], diff --git a/third_party/protobuf/editions/codegen_tests/proto2_multiline_comments.proto b/third_party/protobuf/editions/codegen_tests/proto2_multiline_comments.proto index e8e106c84bc44..52f22013da4ad 100644 --- a/third_party/protobuf/editions/codegen_tests/proto2_multiline_comments.proto +++ b/third_party/protobuf/editions/codegen_tests/proto2_multiline_comments.proto @@ -1,3 +1,7 @@ +// +// Extra empty file comments. +// + syntax = "proto2"; package protobuf_editions_test.proto2; @@ -31,3 +35,13 @@ message Message3 { */ optional string field = 1; } + +// +// Extra empty message comments. +// +message Message4 { + // + // Extra empty field comments. + // + optional string field = 1; +} diff --git a/third_party/protobuf/editions/defaults.bzl b/third_party/protobuf/editions/defaults.bzl index b1c3f8d894d30..7d83865b9a5f0 100644 --- a/third_party/protobuf/editions/defaults.bzl +++ b/third_party/protobuf/editions/defaults.bzl @@ -64,32 +64,18 @@ compile_edition_defaults = rule( ) def _embed_edition_defaults_impl(ctx): - if ctx.attr.encoding == "base64": - args = "--encoding=base64" - elif ctx.attr.encoding == "octal": - args = "--encoding=octal" - else: - fail("Unknown encoding %s" % ctx.attr.encoding) - ctx.actions.run_shell( + args = ctx.actions.args() + args.add(ctx.attr.encoding, format = "--encoding=%s") + args.add(ctx.file.defaults, format = "--defaults_path=%s") + args.add(ctx.file.template, format = "--template_path=%s") + args.add(ctx.outputs.output, format = "--output_path=%s") + args.add(ctx.attr.placeholder, format = "--placeholder=%s") + + ctx.actions.run( + executable = ctx.executable._escape, + arguments = [args], outputs = [ctx.outputs.output], inputs = [ctx.file.defaults, ctx.file.template], - tools = [ctx.executable._escape], - command = """ - DEFAULTS_RAW=$({escape} {args} < {defaults}) - # Windows requires extra escaping. - DEFAULTS_ESCAPED=$(echo $DEFAULTS_RAW | sed 's/\\\\/\\\\\\\\/g' || - echo $DEFAULTS_RAW | sed 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g') - cp -f {template} {output} - # MacOS requires a backup file. - sed -i.bak \"s|{placeholder}|$DEFAULTS_ESCAPED|g\" {output} - """.format( - escape = ctx.executable._escape.path, - args = args, - defaults = ctx.file.defaults.path, - template = ctx.file.template.path, - output = ctx.outputs.output.path, - placeholder = ctx.attr.placeholder, - ), ) embed_edition_defaults = rule( diff --git a/third_party/protobuf/editions/generated_files_test.cc b/third_party/protobuf/editions/generated_files_test.cc index 22aaa18f8ccc2..d39ed129d7c0c 100644 --- a/third_party/protobuf/editions/generated_files_test.cc +++ b/third_party/protobuf/editions/generated_files_test.cc @@ -146,6 +146,7 @@ TEST(Generated, EditionDefaults2023InternalFeatures) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING diff --git a/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.txt b/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.txt index ab0bad33f1766..4c4403d9ca5df 100644 --- a/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.txt +++ b/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.txt @@ -16,23 +16,23 @@ (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, }}, @@ @@ - (void)cached_has_bits; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; -- // optional int32 int32_field = 1; -+ // int32 int32_field = 1; - if (cached_has_bits & 0x00000001u) { - target = ::proto2::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( + cached_has_bits = this_._impl_._has_bits_[0]; +- // optional int32 int32_field = 1; ++ // int32 int32_field = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + target = + ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( @@ @@ - (void)cached_has_bits; + (void)cached_has_bits; - { -- // optional int32 int32_field = 1; -+ // int32 int32_field = 1; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + { +- // optional int32 int32_field = 1; ++ // int32 int32_field = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( [ FAILED ] third_party/protobuf/editions/golden/simple_proto3.pb.cc [ RUN ] third_party/protobuf/editions/golden/simple_proto3.pb.h @@ @@ diff --git a/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.xml b/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.xml index b1fe745250204..5c14825cbf189 100644 --- a/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.xml +++ b/third_party/protobuf/editions/golden/compare_cpp_codegen_failure.xml @@ -2,10 +2,10 @@ <testsuites tests="1" name="AllTests"> <testsuite name="EditionsCodegenTests"> <testcase name="third_party/protobuf/editions/golden/simple_proto3.pb.cc" status="run" result="completed" classname="DiffTest"> -<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto
// Protobuf C++ Version: 0.20240924.0

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
, with the difference:
@@ @@
 ::_pbi::TcParser::GetTable<::protobuf_editions_test::golden::SimpleProto3>(), // to_prefetch
 #endif // PROTOBUF_PREFETCH_PARSE_TABLE
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0, PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0,
 (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if (cached_has_bits & 0x00000001u) {
 target = ::proto2::internal::WireFormatLite::
 WriteInt32ToArrayWithField<1>(
@@ @@
 (void)cached_has_bits;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if (cached_has_bits & 0x00000001u) {
 total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(" type=""></failure> +<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
, with the difference:
@@ @@
 ::_pbi::TcParser::GetTable<::protobuf_editions_test::golden::SimpleProto3>(), // to_prefetch
 #endif // PROTOBUF_PREFETCH_PARSE_TABLE
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0, PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0,
 (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if ((cached_has_bits & 0x00000001u) != 0) {
 target =
 ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>(
@@ @@
 (void)cached_has_bits;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if ((cached_has_bits & 0x00000001u) != 0) {
 total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(" type=""></failure> </testcase> <testcase name="third_party/protobuf/editions/golden/simple_proto3.pb.h" status="run" result="completed" classname="DiffTest"> -<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.h
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto
// Protobuf C++ Version: 0.20240924.0

#ifndef third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
#define third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh

#include <limits>
#include <string>
#include <type_traits>
#include <utility>

#include "third_party/protobuf/runtime_version.h"
#if PROTOBUF_VERSION != 20240924
#error "Protobuf C++ gencode is built with an incompatible version of"
#error "Protobuf C++ headers/runtime. See"
#error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp"
#endif
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/arena.h"
#include "third_party/protobuf/arenastring.h"
#include "third_party/protobuf/generated_message_tctable_decl.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/metadata_lite.h"
#include "third_party/protobuf/message_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.

#endif // third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
, with the difference:
@@ @@
 enum : int {
 kInt32FieldFieldNumber = 1,
 };
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 bool has_int32_field() const;
 void clear_int32_field() ;
 ::int32_t int32_field() const;
@@ @@
 
 // SimpleProto3
 
-// optional int32 int32_field = 1;
+// int32 int32_field = 1;
 inline bool SimpleProto3::has_int32_field() const {
 bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
 return value;" type=""></failure> +<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.h
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#ifndef third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
#define third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh

#include <limits>
#include <string>
#include <type_traits>
#include <utility>

#include "third_party/protobuf/runtime_version.h"
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/arena.h"
#include "third_party/protobuf/arenastring.h"
#include "third_party/protobuf/generated_message_tctable_decl.h"
#include "third_party/protobuf/v2/generated_message_table.h"
#include "third_party/protobuf/v2/generated_message_table_impl.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/metadata_lite.h"
#include "third_party/protobuf/message_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.

#endif // third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
, with the difference:
@@ @@
 enum : int {
 kInt32FieldFieldNumber = 1,
 };
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 bool has_int32_field() const;
 void clear_int32_field() ;
 ::int32_t int32_field() const;
@@ @@
 
 // SimpleProto3
 
-// optional int32 int32_field = 1;
+// int32 int32_field = 1;
 inline bool SimpleProto3::has_int32_field() const {
 bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
 return value;" type=""></failure> </testcase> <testcase name="third_party/protobuf/editions/golden/simple_proto3.proto.static_reflection.h" status="run" result="completed" classname="DiffTest"> </testcase> diff --git a/third_party/protobuf/editions/golden/test_messages_proto2_editions.proto b/third_party/protobuf/editions/golden/test_messages_proto2_editions.proto index 23988c624f1b9..ba1c79177d1f1 100644 --- a/third_party/protobuf/editions/golden/test_messages_proto2_editions.proto +++ b/third_party/protobuf/editions/golden/test_messages_proto2_editions.proto @@ -640,3 +640,28 @@ message TestAllRequiredTypesProto2 { ]; } } + +message TestLargeOneof { + message A1 { + } + + message A2 { + } + + message A3 { + } + + message A4 { + } + + message A5 { + } + + oneof large_oneof { + A1 a1 = 1; + A2 a2 = 2; + A3 a3 = 3; + A4 a4 = 4; + A5 a5 = 5; + } +} diff --git a/third_party/protobuf/editions/internal_defaults_escape.cc b/third_party/protobuf/editions/internal_defaults_escape.cc index 0919ceabd7e01..ec46a86491b77 100644 --- a/third_party/protobuf/editions/internal_defaults_escape.cc +++ b/third_party/protobuf/editions/internal_defaults_escape.cc @@ -1,4 +1,7 @@ +#include <cstddef> +#include <fstream> #include <iostream> +#include <sstream> #include <string> #ifdef _WIN32 @@ -16,34 +19,125 @@ #if defined(_WIN32) #include "google/protobuf/io/io_win32.h" -// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import -// them like we do below. +// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and +// import them like we do below. using google::protobuf::io::win32::setmode; #endif ABSL_FLAG(std::string, encoding, "octal", "The encoding to use for the output."); +ABSL_FLAG(std::string, defaults_path, "defaults_path", + "The path to the compile_edition_defaults file to embed."); +ABSL_FLAG(std::string, template_path, "template_path", + "The template to use for generating the output file."); +ABSL_FLAG(std::string, output_path, "output_path", + "The path to the the output file."); +ABSL_FLAG( + std::string, placeholder, "placeholder", + "The placeholder to replace with a serialized string in the template."); -int main(int argc, char *argv[]) { - absl::ParseCommandLine(argc, argv); -#ifdef _WIN32 - setmode(STDIN_FILENO, _O_BINARY); - setmode(STDOUT_FILENO, _O_BINARY); -#endif - google::protobuf::FeatureSetDefaults defaults; - if (!defaults.ParseFromFileDescriptor(STDIN_FILENO)) { - std::cerr << argv[0] << ": unable to parse edition defaults." << std::endl; +int defaults_escape(const std::string& defaults_path, + const std::string& encoding, std::string& out_content) { + std::ifstream defaults_file(defaults_path); + if (!defaults_file.is_open()) { + std::cerr << "Could not open defaults file " << defaults_path << std::endl; return 1; } - std::string output; - defaults.SerializeToString(&output); - std::string encoding = absl::GetFlag(FLAGS_encoding); + + google::protobuf::FeatureSetDefaults defaults; + if (!defaults.ParseFromIstream(&defaults_file)) { + std::cerr << "Unable to parse edition defaults " << defaults_path + << std::endl; + defaults_file.close(); + return 1; + } + + defaults_file.close(); + + std::string content = {}; + defaults.SerializeToString(&content); if (encoding == "base64") { - std::cout << absl::Base64Escape(output); + content = absl::Base64Escape(content); } else if (encoding == "octal") { - std::cout << absl::CEscape(output); + content = absl::CEscape(content); } else { ABSL_LOG(FATAL) << "Unknown encoding: " << encoding; + return 1; } + + out_content = content; + return 0; +} + +int read_to_string(const std::string& path, std::string& out_content) { + std::ifstream input_file(path); + if (!input_file.is_open()) { + std::cerr << "Could not open file " << path << std::endl; + return 1; + } + + std::ostringstream buffer; + buffer << input_file.rdbuf(); + out_content = buffer.str(); + input_file.close(); + + return 0; +} + +int replace_placeholder(std::string& out_content, + const std::string& placeholder, + const std::string& replacement) { + size_t pos = 0; + + while ((pos = out_content.find(placeholder, pos)) != std::string::npos) { + out_content.replace(pos, placeholder.length(), replacement); + pos += replacement.length(); + } + + return 0; +} + +int write(const std::string& path, const std::string& content) { + std::ofstream output_file(path); + if (!output_file.is_open()) { + std::cerr << "Could not write to file " << path << std::endl; + return 1; + } + + output_file << content; + output_file.close(); + + return 0; +} + +int main(int argc, char* argv[]) { + absl::ParseCommandLine(argc, argv); +#ifdef _WIN32 + setmode(STDOUT_FILENO, _O_BINARY); +#endif + std::string encoding = absl::GetFlag(FLAGS_encoding); + std::string defaults_path = absl::GetFlag(FLAGS_defaults_path); + std::string template_path = absl::GetFlag(FLAGS_template_path); + std::string output_path = absl::GetFlag(FLAGS_output_path); + std::string placeholder = absl::GetFlag(FLAGS_placeholder); + + std::string replacement = {}; + if (defaults_escape(defaults_path, encoding, replacement)) { + return 1; + } + + std::string content = {}; + if (read_to_string(template_path, content)) { + return 1; + } + + if (replace_placeholder(content, placeholder, replacement)) { + return 1; + } + + if (write(output_path, content)) { + return 1; + } + return 0; } diff --git a/third_party/protobuf/examples/.bazelrc b/third_party/protobuf/examples/.bazelrc index f37d75bc21126..8c49fd990bf8b 100644 --- a/third_party/protobuf/examples/.bazelrc +++ b/third_party/protobuf/examples/.bazelrc @@ -1,9 +1,10 @@ common --enable_platform_specific_config -build:linux --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 -build:macos --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 +build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 +build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -common:windows --enable_runfiles +build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:x64_windows-clang-cl +common:windows --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --enable_runfiles build --experimental_remote_cache_eviction_retries=5 build --remote_download_outputs=all diff --git a/third_party/protobuf/examples/AddPerson.java b/third_party/protobuf/examples/AddPerson.java index 83971ab49ffef..a03e083a85565 100644 --- a/third_party/protobuf/examples/AddPerson.java +++ b/third_party/protobuf/examples/AddPerson.java @@ -1,13 +1,13 @@ // See README.md for information and build instructions. - import com.example.tutorial.protos.AddressBook; import com.example.tutorial.protos.Person; +import com.google.protobuf.util.Timestamps; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.InputStreamReader; import java.io.IOException; +import java.io.InputStreamReader; import java.io.PrintStream; class AddPerson { @@ -51,6 +51,7 @@ class AddPerson { } person.addPhones(phoneNumber); + person.setLastUpdated(Timestamps.now()); } return person.build(); diff --git a/third_party/protobuf/examples/BUILD.bazel b/third_party/protobuf/examples/BUILD.bazel index 4b701c40389e0..7c8276ad0b244 100644 --- a/third_party/protobuf/examples/BUILD.bazel +++ b/third_party/protobuf/examples/BUILD.bazel @@ -5,11 +5,13 @@ # example. load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library") load("@com_google_protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library") load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library") load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") load("@rules_cc//cc:defs.bzl", "cc_binary") +load("@rules_java//java:java_binary.bzl", "java_binary") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_python//python:py_binary.bzl", "py_binary") @@ -72,7 +74,10 @@ java_binary( name = "add_person_java", srcs = ["AddPerson.java"], main_class = "AddPerson", - deps = [":addressbook_java_proto"], + deps = [ + ":addressbook_java_proto", + "@com_google_protobuf//java/util", + ], ) java_binary( @@ -110,7 +115,10 @@ java_binary( name = "add_person_java_lite", srcs = ["AddPerson.java"], main_class = "AddPerson", - deps = [":addressbook_java_lite_proto"], + deps = [ + ":addressbook_java_lite_proto", + "@com_google_protobuf//java/util", + ], ) java_binary( @@ -185,3 +193,16 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//visibility:public"], ) + +platform( + name = "x64_windows-clang-cl", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:windows", + # This is necessary for Bazel 7 compatibility with a MODULE.bazel file that still works in + # Bazel 8. Using cc_configure_extension from rules_cc produces a @local_config_cc + # repository that's not compatible with @bazel_tools//tools/cpp:clang-cl from before + # Bazel 8. See https://github.com/bazelbuild/rules_cc/issues/330. + "@rules_cc//cc/private/toolchain:clang-cl", + ], +) diff --git a/third_party/protobuf/examples/MODULE.bazel b/third_party/protobuf/examples/MODULE.bazel index fff0fb403ccff..137987c7942a4 100644 --- a/third_party/protobuf/examples/MODULE.bazel +++ b/third_party/protobuf/examples/MODULE.bazel @@ -1,13 +1,30 @@ """Bazel module dependencies""" +module( + name = "com_google_protobuf_examples", + version = "0.0.0", + compatibility_level = 1, +) + bazel_dep(name = "protobuf", version = "0.0.0", repo_name = "com_google_protobuf") local_path_override( module_name = "protobuf", path = "..", ) -bazel_dep(name = "bazel_skylib", version = "1.0.3") -bazel_dep(name = "rules_cc", version = "0.0.16") -bazel_dep(name = "rules_java", version = "7.12.2") -bazel_dep(name = "rules_pkg", version = "0.7.0") -bazel_dep(name = "rules_python", version = "0.25.0") +bazel_dep(name = "com_google_protobuf-examples-with-hyphen", version = "0.0.0", dev_dependency = True) +local_path_override( + module_name = "com_google_protobuf-examples-with-hyphen", + path = "examples_with_hyphen", +) + +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "rules_cc", version = "0.0.17") +bazel_dep(name = "rules_java", version = "8.6.1") +bazel_dep(name = "rules_pkg", version = "1.0.1") +bazel_dep(name = "rules_python", version = "1.0.0") + +# For clang-cl configuration +cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension") +use_repo(cc_configure, "local_config_cc") diff --git a/third_party/protobuf/examples/Makefile b/third_party/protobuf/examples/Makefile index f7ee9b116decc..5290fdb03fd33 100644 --- a/third_party/protobuf/examples/Makefile +++ b/third_party/protobuf/examples/Makefile @@ -46,11 +46,11 @@ protoc_middleman_ruby: addressbook.proto add_person_cpp: add_person.cc protoc_middleman pkg-config --cflags protobuf # fails if protobuf is not installed - c++ -std=c++14 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf` + c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf` list_people_cpp: list_people.cc protoc_middleman pkg-config --cflags protobuf # fails if protobuf is not installed - c++ -std=c++14 list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf` + c++ list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf` add_person_dart: add_person.dart protoc_middleman_dart diff --git a/third_party/protobuf/examples/WORKSPACE b/third_party/protobuf/examples/WORKSPACE index c1f7e0db4b3cf..7cf8b5aef9d34 100644 --- a/third_party/protobuf/examples/WORKSPACE +++ b/third_party/protobuf/examples/WORKSPACE @@ -20,6 +20,11 @@ local_repository( path = "..", ) +local_repository( + name = "com_google_protobuf-examples-with-hyphen", + path = "examples_with_hyphen", +) + # Similar to com_google_protobuf but for Java lite. If you are building # for Android, the lite version should be preferred because it has a much # smaller code size. @@ -28,15 +33,53 @@ local_repository( path = "..", ) -# Needed because protobuf_deps brings rules_python 0.26.0 which is broken: -# https://github.com/bazelbuild/rules_python/issues/1543 +# Bazel platform rules, for clang-cl. http_archive( - name = "rules_python", - sha256 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036", - strip_prefix = "rules_python-0.25.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz", + name = "platforms", + sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", + "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", + ], ) -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@com_google_protobuf//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps") protobuf_deps() + +load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies") + +rules_java_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_toolchains") + +rules_java_toolchains() + +load("@rules_python//python:repositories.bzl", "py_repositories") + +py_repositories() + +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") + +rules_cc_dependencies() + +rules_cc_toolchains() + +load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") + +rules_jvm_external_deps() + +load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") + +rules_jvm_external_setup() + +load("@rules_jvm_external//:defs.bzl", "maven_install") + +maven_install( + name = "maven", + artifacts = PROTOBUF_MAVEN_ARTIFACTS, + repositories = [ + "https://repo1.maven.org/maven2", + "https://repo.maven.apache.org/maven2", + ], +) diff --git a/third_party/protobuf/examples/examples_with_hyphen/BUILD.bazel b/third_party/protobuf/examples/examples_with_hyphen/BUILD.bazel new file mode 100644 index 0000000000000..15c4af96d2f7b --- /dev/null +++ b/third_party/protobuf/examples/examples_with_hyphen/BUILD.bazel @@ -0,0 +1,14 @@ +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") + +proto_library( + name = "empty_proto", + srcs = ["empty.proto"], +) + +# py_proto_library rule with hyphen in @com_google_protobuf-examples-with-hyphen module name. +py_proto_library( + name = "empty_py_pb2", + visibility = ["//visibility:public"], + deps = [":empty_proto"], +) diff --git a/third_party/protobuf/examples/examples_with_hyphen/MODULE.bazel b/third_party/protobuf/examples/examples_with_hyphen/MODULE.bazel new file mode 100644 index 0000000000000..7a99cc06b9c6e --- /dev/null +++ b/third_party/protobuf/examples/examples_with_hyphen/MODULE.bazel @@ -0,0 +1,13 @@ +"""Bazel module dependencies""" + +module( + name = "com_google_protobuf-examples-with-hyphen", + version = "0.0.0", + compatibility_level = 1, +) + +bazel_dep(name = "protobuf", version = "0.0.0", repo_name = "com_google_protobuf") +local_path_override( + module_name = "protobuf", + path = "..", +) diff --git a/third_party/protobuf/examples/examples_with_hyphen/empty.proto b/third_party/protobuf/examples/examples_with_hyphen/empty.proto new file mode 100644 index 0000000000000..b07834c6a9793 --- /dev/null +++ b/third_party/protobuf/examples/examples_with_hyphen/empty.proto @@ -0,0 +1,5 @@ +edition = "2023"; + +package examples.with.hyphen; + +message EmptyMessage {} diff --git a/third_party/protobuf/examples/go/go.mod b/third_party/protobuf/examples/go/go.mod index ed43328d78f0d..9cf0cc4b3a51b 100644 --- a/third_party/protobuf/examples/go/go.mod +++ b/third_party/protobuf/examples/go/go.mod @@ -1,5 +1,5 @@ module github.com/protocolbuffers/protobuf/examples/go -go 1.14 +go 1.18 require google.golang.org/protobuf v1.27.1 diff --git a/third_party/protobuf/go/BUILD.bazel b/third_party/protobuf/go/BUILD.bazel index d773b29499d04..3dfdd21c1d1b7 100644 --- a/third_party/protobuf/go/BUILD.bazel +++ b/third_party/protobuf/go/BUILD.bazel @@ -10,8 +10,6 @@ proto_library( name = "go_features_proto", srcs = ["google/protobuf/go_features.proto"], strip_import_prefix = "/go", - visibility = [ - "//pkg:__pkg__", - ], + visibility = ["//:__subpackages__"], deps = ["//:descriptor_proto"], ) diff --git a/third_party/protobuf/go/google/protobuf/go_features.proto b/third_party/protobuf/go/google/protobuf/go_features.proto index ceb3a13d0f2da..a9cc7923c34a4 100644 --- a/third_party/protobuf/go/google/protobuf/go_features.proto +++ b/third_party/protobuf/go/google/protobuf/go_features.proto @@ -19,6 +19,7 @@ extend google.protobuf.FeatureSet { message GoFeatures { // Whether or not to generate the deprecated UnmarshalJSON method for enums. + // Can only be true for proto using the Open Struct api. optional bool legacy_unmarshal_json_enum = 1 [ retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, @@ -54,4 +55,26 @@ message GoFeatures { edition_defaults = { edition: EDITION_LEGACY, value: "API_LEVEL_UNSPECIFIED" }, edition_defaults = { edition: EDITION_2024, value: "API_OPAQUE" } ]; + + enum StripEnumPrefix { + STRIP_ENUM_PREFIX_UNSPECIFIED = 0; + STRIP_ENUM_PREFIX_KEEP = 1; + STRIP_ENUM_PREFIX_GENERATE_BOTH = 2; + STRIP_ENUM_PREFIX_STRIP = 3; + } + + optional StripEnumPrefix strip_enum_prefix = 3 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_ENUM_ENTRY, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2024, + }, + // TODO: change the default to STRIP_ENUM_PREFIX_STRIP for edition 2025. + edition_defaults = { + edition: EDITION_LEGACY, + value: "STRIP_ENUM_PREFIX_KEEP" + } + ]; } diff --git a/third_party/protobuf/hpb/backend/upb/upb.h b/third_party/protobuf/hpb/backend/upb/upb.h index 3e35f0dd2b302..95ae7c2056215 100644 --- a/third_party/protobuf/hpb/backend/upb/upb.h +++ b/third_party/protobuf/hpb/backend/upb/upb.h @@ -9,14 +9,13 @@ #define GOOGLE_PROTOBUF_HPB_BACKEND_UPB_UPB_H__ #include "google/protobuf/hpb/backend/upb/interop.h" -#include "google/protobuf/hpb/internal/internal.h" #include "google/protobuf/hpb/internal/template_help.h" #include "google/protobuf/hpb/ptr.h" namespace hpb::internal::backend::upb { template <typename T> -void ClearMessage(hpb::internal::PtrOrRaw<T> message) { +void ClearMessage(hpb::internal::PtrOrRawMutable<T> message) { auto ptr = Ptr(message); auto minitable = hpb::interop::upb::GetMiniTable(ptr); upb_Message_Clear(hpb::interop::upb::GetMessage(ptr), minitable); diff --git a/third_party/protobuf/hpb/bazel/hpb_proto_library.bzl b/third_party/protobuf/hpb/bazel/hpb_proto_library.bzl index 56b1a99a6edc0..f123950452ba6 100644 --- a/third_party/protobuf/hpb/bazel/hpb_proto_library.bzl +++ b/third_party/protobuf/hpb/bazel/hpb_proto_library.bzl @@ -9,97 +9,18 @@ - hpb_proto_library() """ -load("@bazel_skylib//lib:paths.bzl", "paths") -load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") +load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "use_cpp_toolchain") load("//bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "upb_proto_library_aspect") +load("//bazel/common:proto_common.bzl", "proto_common") +load("//bazel/common:proto_info.bzl", "ProtoInfo") +load("//bazel/private:upb_proto_library_internal/cc_library_func.bzl", "cc_library_func") # buildifier: disable=bzl-visibility def upb_use_cpp_toolchain(): return use_cpp_toolchain() -# Generic support code ######################################################### - -def _get_real_short_path(file): - # For some reason, files from other archives have short paths that look like: - # ../com_google_protobuf/google/protobuf/descriptor.proto - short_path = file.short_path - if short_path.startswith("../"): - second_slash = short_path.index("/", 3) - short_path = short_path[second_slash + 1:] - - # Sometimes it has another few prefixes like: - # _virtual_imports/any_proto/google/protobuf/any.proto - # benchmarks/_virtual_imports/100_msgs_proto/benchmarks/100_msgs.proto - # We want just google/protobuf/any.proto. - virtual_imports = "_virtual_imports/" - if virtual_imports in short_path: - short_path = short_path.split(virtual_imports)[1].split("/", 1)[1] - return short_path - -def _get_real_root(file): - real_short_path = _get_real_short_path(file) - return file.path[:-len(real_short_path) - 1] - -def _generate_output_file(ctx, src, extension): - real_short_path = _get_real_short_path(src) - real_short_path = paths.relativize(real_short_path, ctx.label.package) - output_filename = paths.replace_extension(real_short_path, extension) - ret = ctx.actions.declare_file(output_filename) - return ret - def _filter_none(elems): return [e for e in elems if e] -def _cc_library_func(ctx, name, hdrs, srcs, copts, dep_ccinfos): - """Like cc_library(), but callable from rules. - - Args: - ctx: Rule context. - name: Unique name used to generate output files. - hdrs: Public headers that can be #included from other rules. - srcs: C/C++ source files. - copts: Additional options for cc compilation. - dep_ccinfos: CcInfo providers of dependencies we should build/link against. - - Returns: - CcInfo provider for this compilation. - """ - - compilation_contexts = [info.compilation_context for info in dep_ccinfos] - linking_contexts = [info.linking_context for info in dep_ccinfos] - toolchain = find_cpp_toolchain(ctx) - feature_configuration = cc_common.configure_features( - ctx = ctx, - cc_toolchain = toolchain, - requested_features = ctx.features, - unsupported_features = ctx.disabled_features, - ) - - (compilation_context, compilation_outputs) = cc_common.compile( - actions = ctx.actions, - feature_configuration = feature_configuration, - cc_toolchain = toolchain, - name = name, - srcs = srcs, - public_hdrs = hdrs, - user_compile_flags = copts, - compilation_contexts = compilation_contexts, - ) - - # buildifier: disable=unused-variable - (linking_context, linking_outputs) = cc_common.create_linking_context_from_compilation_outputs( - actions = ctx.actions, - name = name, - feature_configuration = feature_configuration, - cc_toolchain = toolchain, - compilation_outputs = compilation_outputs, - linking_contexts = linking_contexts, - ) - - return CcInfo( - compilation_context = compilation_context, - linking_context = linking_context, - ) - # Dummy rule to expose select() copts to aspects ############################## HpbProtoLibraryCoptsInfo = provider( @@ -117,39 +38,43 @@ hpb_proto_library_copts = rule( attrs = {"copts": attr.string_list(default = [])}, ) -_UpbCcWrappedCcInfo = provider("Provider for cc_info for protos", fields = ["cc_info"]) +_UpbCcWrappedCcInfo = provider("Provider for cc_info for hpb", fields = ["cc_info"]) _WrappedCcGeneratedSrcsInfo = provider("Provider for generated sources", fields = ["srcs"]) -def _compile_upb_cc_protos(ctx, generator, proto_info, proto_sources): +def _get_lang_toolchain(ctx): + return ctx.attr._hpb_lang_toolchain[proto_common.ProtoLangToolchainInfo] + +def _compile_upb_cc_protos(ctx, proto_info, proto_sources): if len(proto_sources) == 0: return GeneratedSrcsInfo(srcs = [], hdrs = []) - tool = getattr(ctx.executable, "_gen_" + generator) - srcs = [_generate_output_file(ctx, name, ".upb.proto.cc") for name in proto_sources] - hdrs = [_generate_output_file(ctx, name, ".upb.proto.h") for name in proto_sources] - hdrs += [_generate_output_file(ctx, name, ".upb.fwd.h") for name in proto_sources] - transitive_sets = proto_info.transitive_descriptor_sets.to_list() - - args = ctx.actions.args() - args.use_param_file(param_file_arg = "@%s") - args.set_param_file_format("multiline") - - args.add("--" + generator + "_out=" + _get_real_root(srcs[0])) - args.add("--plugin=protoc-gen-" + generator + "=" + tool.path) - args.add("--descriptor_set_in=" + ctx.configuration.host_path_separator.join([f.path for f in transitive_sets])) - args.add_all(proto_sources, map_each = _get_real_short_path) - - ctx.actions.run( - inputs = depset( - direct = [proto_info.direct_descriptor_set], - transitive = [proto_info.transitive_descriptor_sets], - ), - tools = [tool], - outputs = srcs + hdrs, - executable = ctx.executable._protoc, - arguments = [args], - progress_message = "Generating upb cc protos for :" + ctx.label.name, + srcs = [] + srcs += proto_common.declare_generated_files( + ctx.actions, + extension = ".upb.proto.cc", + proto_info = proto_info, ) + + hdrs = [] + hdrs += proto_common.declare_generated_files( + ctx.actions, + extension = ".upb.proto.h", + proto_info = proto_info, + ) + hdrs += proto_common.declare_generated_files( + ctx.actions, + extension = ".upb.fwd.h", + proto_info = proto_info, + ) + + proto_common.compile( + actions = ctx.actions, + proto_info = proto_info, + proto_lang_toolchain_info = _get_lang_toolchain(ctx), + generated_files = srcs + hdrs, + experimental_exec_group = "proto_compiler", + ) + return GeneratedSrcsInfo(srcs = srcs, hdrs = hdrs) def _upb_cc_proto_rule_impl(ctx): @@ -183,43 +108,45 @@ def _upb_cc_proto_rule_impl(ctx): cc_info, ] -def _upb_cc_proto_aspect_impl(target, ctx, generator, cc_provider, file_provider): - proto_info = target[ProtoInfo] - files = _compile_upb_cc_protos(ctx, generator, proto_info, proto_info.direct_sources) - deps = ctx.rule.attr.deps + getattr(ctx.attr, "_" + generator) +def _upb_cc_proto_aspect_impl(target, ctx, cc_provider, file_provider): + deps = ctx.rule.attr.deps + ctx.attr._upbprotos dep_ccinfos = [dep[CcInfo] for dep in deps if CcInfo in dep] dep_ccinfos += [dep[UpbWrappedCcInfo].cc_info for dep in deps if UpbWrappedCcInfo in dep] dep_ccinfos += [dep[_UpbCcWrappedCcInfo].cc_info for dep in deps if _UpbCcWrappedCcInfo in dep] if UpbWrappedCcInfo not in target: fail("Target should have UpbWrappedCcInfo provider") dep_ccinfos.append(target[UpbWrappedCcInfo].cc_info) - cc_info = _cc_library_func( - ctx = ctx, - name = ctx.rule.attr.name + "." + generator, - hdrs = files.hdrs, - srcs = files.srcs, - copts = ctx.attr._ccopts[HpbProtoLibraryCoptsInfo].copts, - dep_ccinfos = dep_ccinfos, - ) - return [cc_provider(cc_info = cc_info), file_provider(srcs = files)] + proto_info = target[ProtoInfo] + + if not getattr(ctx.rule.attr, "srcs", []): + # This target doesn't declare any sources, reexport all its deps instead. + # This is known as an "alias library": + # https://bazel.build/versions/6.4.0/reference/be/protocol-buffer#proto_library.srcs + return [cc_provider( + cc_info = cc_common.merge_cc_infos(direct_cc_infos = dep_ccinfos), + ), file_provider(srcs = GeneratedSrcsInfo(srcs = [], hdrs = []))] + else: + files = _compile_upb_cc_protos(ctx, proto_info, proto_info.direct_sources) + cc_info = cc_library_func( + ctx = ctx, + name = ctx.rule.attr.name + ".upbprotos", + hdrs = files.hdrs, + srcs = files.srcs, + copts = ctx.attr._ccopts[HpbProtoLibraryCoptsInfo].copts, + dep_ccinfos = dep_ccinfos, + ) + return [cc_provider(cc_info = cc_info), file_provider(srcs = files)] def _upb_cc_proto_library_aspect_impl(target, ctx): - return _upb_cc_proto_aspect_impl(target, ctx, "upbprotos", _UpbCcWrappedCcInfo, _WrappedCcGeneratedSrcsInfo) + return _upb_cc_proto_aspect_impl(target, ctx, _UpbCcWrappedCcInfo, _WrappedCcGeneratedSrcsInfo) _upb_cc_proto_library_aspect = aspect( attrs = { "_ccopts": attr.label( default = "//hpb:hpb_proto_library_copts", ), - "_gen_upbprotos": attr.label( - executable = True, - cfg = "exec", - default = "//src/google/protobuf/compiler/hpb:protoc-gen-upb-protos", - ), - "_protoc": attr.label( - executable = True, - cfg = "exec", - default = "//net/proto2/compiler/public:protocol_compiler", + "_hpb_lang_toolchain": attr.label( + default = "//src/google/protobuf/compiler/hpb:toolchain", ), "_cc_toolchain": attr.label( default = "@bazel_tools//tools/cpp:current_cc_toolchain", @@ -229,13 +156,16 @@ _upb_cc_proto_library_aspect = aspect( # TODO: Add dependencies for cc runtime (absl/string etc..) "//upb:generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", "//hpb:generated_hpb_support", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/status:statusor", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/status:statusor", "//hpb:repeated_field", - "//protos", ], ), }, + exec_groups = { + "proto_compiler": exec_group(), + }, implementation = _upb_cc_proto_library_aspect_impl, provides = [ _UpbCcWrappedCcInfo, diff --git a/third_party/protobuf/hpb/extension.cc b/third_party/protobuf/hpb/extension.cc index 8938062718615..54d350f6b3f6f 100644 --- a/third_party/protobuf/hpb/extension.cc +++ b/third_party/protobuf/hpb/extension.cc @@ -7,6 +7,13 @@ #include "google/protobuf/hpb/extension.h" +#include "absl/status/status.h" +#include "google/protobuf/hpb/internal/message_lock.h" +#include "google/protobuf/hpb/status.h" +#include "upb/mem/arena.h" +#include "upb/message/accessors.h" +#include "upb/message/message.h" +#include "upb/mini_table/extension.h" #include "upb/mini_table/extension_registry.h" namespace hpb { @@ -16,5 +23,30 @@ upb_ExtensionRegistry* GetUpbExtensions( return extension_registry.registry_; } +absl::Status MoveExtension(upb_Message* message, upb_Arena* message_arena, + const upb_MiniTableExtension* ext, + upb_Message* extension, upb_Arena* extension_arena) { + if (message_arena != extension_arena && + // Try fuse, if fusing is not allowed or fails, create copy of extension. + !upb_Arena_Fuse(message_arena, extension_arena)) { + extension = DeepClone(extension, upb_MiniTableExtension_GetSubMessage(ext), + message_arena); + } + return upb_Message_SetExtension(message, ext, &extension, message_arena) + ? absl::OkStatus() + : MessageAllocationError(); +} + +absl::Status SetExtension(upb_Message* message, upb_Arena* message_arena, + const upb_MiniTableExtension* ext, + const upb_Message* extension) { + // Clone extension into target message arena. + extension = DeepClone(extension, upb_MiniTableExtension_GetSubMessage(ext), + message_arena); + return upb_Message_SetExtension(message, ext, &extension, message_arena) + ? absl::OkStatus() + : MessageAllocationError(); +} + } // namespace internal } // namespace hpb diff --git a/third_party/protobuf/hpb/extension.h b/third_party/protobuf/hpb/extension.h index eb9e79f14dd8d..2eb0ba2a42776 100644 --- a/third_party/protobuf/hpb/extension.h +++ b/third_party/protobuf/hpb/extension.h @@ -9,28 +9,113 @@ #define GOOGLE_PROTOBUF_HPB_EXTENSION_H__ #include <cstdint> +#include <type_traits> #include <vector> +#include "absl/base/attributes.h" +#include "absl/log/absl_log.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "google/protobuf/hpb/backend/upb/interop.h" +#include "google/protobuf/hpb/internal/message_lock.h" +#include "google/protobuf/hpb/internal/template_help.h" +#include "google/protobuf/hpb/ptr.h" +#include "google/protobuf/hpb/status.h" +#include "upb/mem/arena.h" #include "upb/mem/arena.hpp" +#include "upb/message/accessors.h" +#include "upb/message/array.h" #include "upb/mini_table/extension.h" #include "upb/mini_table/extension_registry.h" namespace hpb { class ExtensionRegistry; +template <typename T> +class RepeatedField; + namespace internal { +template <typename Extendee, typename Extension> +class ExtensionIdentifier; -class ExtensionMiniTableProvider { - public: - constexpr explicit ExtensionMiniTableProvider( - const upb_MiniTableExtension* mini_table_ext) - : mini_table_ext_(mini_table_ext) {} - const upb_MiniTableExtension* mini_table_ext() const { - return mini_table_ext_; +absl::Status MoveExtension(upb_Message* message, upb_Arena* message_arena, + const upb_MiniTableExtension* ext, + upb_Message* extension, upb_Arena* extension_arena); + +absl::Status SetExtension(upb_Message* message, upb_Arena* message_arena, + const upb_MiniTableExtension* ext, + const upb_Message* extension); + +/** + * Trait that maps upb extension types to the corresponding + * return value: ubp_MessageValue. + * + * All partial specializations must have: + * - DefaultType: the type of the default value. + * - ReturnType: the type of the return value. + * - kGetter: the corresponding upb_MessageValue upb_Message_GetExtension* func + */ +template <typename T, typename = void> +struct UpbExtensionTrait; + +template <typename T> +struct UpbExtensionTrait<hpb::RepeatedField<T>> { + using ReturnType = typename RepeatedField<T>::CProxy; + using DefaultType = std::false_type; + + template <typename Msg, typename Id> + static constexpr ReturnType Get(Msg message, const Id& id) { + auto upb_arr = upb_Message_GetExtensionArray( + hpb::interop::upb::GetMessage(message), id.mini_table_ext()); + return ReturnType(upb_arr, hpb::interop::upb::GetArena(message)); } +}; - private: - const upb_MiniTableExtension* mini_table_ext_; +#define UPB_EXT_PRIMITIVE(CppType, UpbFunc) \ + template <> \ + struct UpbExtensionTrait<CppType> { \ + using DefaultType = CppType; \ + using ReturnType = CppType; \ + static constexpr auto kSetter = upb_Message_SetExtension##UpbFunc; \ + \ + template <typename Msg, typename Id> \ + static constexpr ReturnType Get(Msg message, const Id& id) { \ + auto default_val = hpb::internal::PrivateAccess::GetDefaultValue(id); \ + return upb_Message_GetExtension##UpbFunc( \ + hpb::interop::upb::GetMessage(message), id.mini_table_ext(), \ + default_val); \ + } \ + }; + +UPB_EXT_PRIMITIVE(bool, Bool); +UPB_EXT_PRIMITIVE(int32_t, Int32); +UPB_EXT_PRIMITIVE(int64_t, Int64); +UPB_EXT_PRIMITIVE(uint32_t, UInt32); +UPB_EXT_PRIMITIVE(uint64_t, UInt64); +UPB_EXT_PRIMITIVE(float, Float); +UPB_EXT_PRIMITIVE(double, Double); + +#undef UPB_EXT_PRIMITIVE + +// TODO: b/375460289 - flesh out non-promotional msg support that does +// not return an error if missing but the default msg +template <typename T> +struct UpbExtensionTrait<T> { + using DefaultType = std::false_type; + using ReturnType = Ptr<const T>; + template <typename Msg, typename Id> + static constexpr absl::StatusOr<ReturnType> Get(Msg message, const Id& id) { + upb_MessageValue value; + const bool ok = ::hpb::internal::GetOrPromoteExtension( + hpb::interop::upb::GetMessage(message), id.mini_table_ext(), + hpb::interop::upb::GetArena(message), &value); + if (!ok) { + return ExtensionNotFoundError( + upb_MiniTableExtension_Number(id.mini_table_ext())); + } + return Ptr<const T>(::hpb::interop::upb::MakeCHandle<T>( + value.msg_val, hpb::interop::upb::GetArena(message))); + } }; // ------------------------------------------------------------------- @@ -42,19 +127,38 @@ class ExtensionMiniTableProvider { // then "bar" will be defined in C++ as: // ExtensionIdentifier<Foo, MyExtension> bar(&namespace_bar_ext); template <typename ExtendeeType, typename ExtensionType> -class ExtensionIdentifier : public ExtensionMiniTableProvider { +class ExtensionIdentifier { public: using Extension = ExtensionType; using Extendee = ExtendeeType; - constexpr explicit ExtensionIdentifier( - const upb_MiniTableExtension* mini_table_ext) - : ExtensionMiniTableProvider(mini_table_ext) {} + // Placeholder for extant legacy callers, avoid use if possible + const upb_MiniTableExtension* mini_table_ext() const { + return mini_table_ext_; + } private: + constexpr explicit ExtensionIdentifier( + const upb_MiniTableExtension* mte, + typename UpbExtensionTrait<ExtensionType>::DefaultType val) + : mini_table_ext_(mte), default_val_(val) {} + constexpr uint32_t number() const { - return upb_MiniTableExtension_Number(mini_table_ext()); + return upb_MiniTableExtension_Number(mini_table_ext_); } + + const upb_MiniTableExtension* mini_table_ext_; + + typename UpbExtensionTrait<ExtensionType>::ReturnType default_value() const { + if constexpr (IsHpbClass<ExtensionType>) { + return ExtensionType::default_instance(); + } else { + return default_val_; + } + } + + typename UpbExtensionTrait<ExtensionType>::DefaultType default_val_; + friend struct PrivateAccess; }; @@ -65,28 +169,189 @@ upb_ExtensionRegistry* GetUpbExtensions( class ExtensionRegistry { public: - ExtensionRegistry( - const std::vector<const internal::ExtensionMiniTableProvider*>& - extensions, - const upb::Arena& arena) - : registry_(upb_ExtensionRegistry_New(arena.ptr())) { + explicit ExtensionRegistry(const upb::Arena& arena) + : registry_(upb_ExtensionRegistry_New(arena.ptr())) {} + + template <typename ExtensionIdentifier> + void AddExtension(const ExtensionIdentifier& id) { if (registry_) { - for (const auto& ext_provider : extensions) { - const auto* ext = ext_provider->mini_table_ext(); - bool success = upb_ExtensionRegistry_AddArray(registry_, &ext, 1); - if (!success) { - registry_ = nullptr; - break; - } + auto* extension = id.mini_table_ext(); + upb_ExtensionRegistryStatus status = + upb_ExtensionRegistry_AddArray(registry_, &extension, 1); + if (status != kUpb_ExtensionRegistryStatus_Ok) { + registry_ = nullptr; } } } + static const ExtensionRegistry& generated_registry() { + static const ExtensionRegistry* r = NewGeneratedRegistry(); + return *r; + } + + static const ExtensionRegistry& EmptyRegistry() { + static const ExtensionRegistry* r = new ExtensionRegistry(); + return *r; + } + private: friend upb_ExtensionRegistry* ::hpb::internal::GetUpbExtensions( const ExtensionRegistry& extension_registry); upb_ExtensionRegistry* registry_; + + // TODO: b/379100963 - Introduce ShutdownHpbLibrary + static const ExtensionRegistry* NewGeneratedRegistry() { + static upb::Arena* global_arena = new upb::Arena(); + ExtensionRegistry* registry = new ExtensionRegistry(*global_arena); + upb_ExtensionRegistry_AddAllLinkedExtensions(registry->registry_); + return registry; + } + + explicit ExtensionRegistry() = default; }; + +template <typename T, typename Extendee, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +ABSL_MUST_USE_RESULT bool HasExtension( + Ptr<T> message, + const ::hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { + return ::hpb::internal::HasExtensionOrUnknown( + hpb::interop::upb::GetMessage(message), id.mini_table_ext()); +} + +template <typename T, typename Extendee, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +ABSL_MUST_USE_RESULT bool HasExtension( + const T* message, + const ::hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { + return HasExtension(Ptr(message), id); +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>, + typename = hpb::internal::EnableIfMutableProto<T>> +void ClearExtension( + Ptr<T> message, + const ::hpb::internal::ExtensionIdentifier<T, Extension>& id) { + static_assert(!std::is_const_v<T>, ""); + upb_Message_ClearExtension(hpb::interop::upb::GetMessage(message), + id.mini_table_ext()); +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +void ClearExtension( + T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id) { + ClearExtension(Ptr(message), id); +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>, + typename = hpb::internal::EnableIfMutableProto<T>> +absl::Status SetExtension( + Ptr<T> message, + const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, + const Extension& value) { + if constexpr (std::is_arithmetic_v<Extension>) { + bool res = hpb::internal::UpbExtensionTrait<Extension>::kSetter( + hpb::interop::upb::GetMessage(message), id.mini_table_ext(), value, + hpb::interop::upb::GetArena(message)); + return res ? absl::OkStatus() : MessageAllocationError(); + } else { + static_assert(!std::is_const_v<T>); + auto* message_arena = hpb::interop::upb::GetArena(message); + return ::hpb::internal::SetExtension(hpb::interop::upb::GetMessage(message), + message_arena, id.mini_table_ext(), + hpb::interop::upb::GetMessage(&value)); + } +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>, + typename = hpb::internal::EnableIfMutableProto<T>> +absl::Status SetExtension( + Ptr<T> message, + const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, + Ptr<Extension> value) { + static_assert(!std::is_const_v<T>); + auto* message_arena = hpb::interop::upb::GetArena(message); + return ::hpb::internal::SetExtension(hpb::interop::upb::GetMessage(message), + message_arena, id.mini_table_ext(), + hpb::interop::upb::GetMessage(value)); +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>, + typename = hpb::internal::EnableIfMutableProto<T>> +absl::Status SetExtension( + Ptr<T> message, + const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, + Extension&& value) { + if constexpr (std::is_integral_v<Extension>) { + bool res = hpb::internal::UpbExtensionTrait<Extension>::kSetter( + hpb::interop::upb::GetMessage(message), id.mini_table_ext(), value, + hpb::interop::upb::GetArena(message)); + return res ? absl::OkStatus() : MessageAllocationError(); + } else { + Extension ext = std::forward<Extension>(value); + static_assert(!std::is_const_v<T>); + auto* message_arena = hpb::interop::upb::GetArena(message); + auto* extension_arena = hpb::interop::upb::GetArena(&ext); + return ::hpb::internal::MoveExtension( + hpb::interop::upb::GetMessage(message), message_arena, + id.mini_table_ext(), hpb::interop::upb::GetMessage(&ext), + extension_arena); + } +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +absl::Status SetExtension( + T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, + const Extension& value) { + return ::hpb::SetExtension(Ptr(message), id, value); +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +absl::Status SetExtension( + T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, + Extension&& value) { + return ::hpb::SetExtension(Ptr(message), id, std::forward<Extension>(value)); +} + +template <typename T, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +absl::Status SetExtension( + T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, + Ptr<Extension> value) { + return ::hpb::SetExtension(Ptr(message), id, value); +} + +template <typename T, typename Extendee, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +absl::StatusOr<typename internal::UpbExtensionTrait<Extension>::ReturnType> +GetExtension( + Ptr<T> message, + const ::hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { + return hpb::internal::UpbExtensionTrait<Extension>::Get(message, id); +} + +template <typename T, typename Extendee, typename Extension, + typename = hpb::internal::EnableIfHpbClassThatHasExtensions<T>> +absl::StatusOr<typename internal::UpbExtensionTrait<Extension>::ReturnType> +GetExtension( + const T* message, + const hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { + return GetExtension(Ptr(message), id); +} + +template <typename T, typename Extension> +constexpr uint32_t ExtensionNumber( + const internal::ExtensionIdentifier<T, Extension>& id) { + return internal::PrivateAccess::GetExtensionNumber(id); +} + } // namespace hpb #endif // GOOGLE_PROTOBUF_HPB_EXTENSION_H__ diff --git a/third_party/protobuf/hpb/hpb.cc b/third_party/protobuf/hpb/hpb.cc deleted file mode 100644 index 21eada8acb615..0000000000000 --- a/third_party/protobuf/hpb/hpb.cc +++ /dev/null @@ -1,148 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2023 Google LLC. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#include "google/protobuf/hpb/hpb.h" - -#include <atomic> -#include <cstddef> - -#include "absl/status/status.h" -#include "absl/status/statusor.h" -#include "absl/strings/str_format.h" -#include "absl/strings/string_view.h" -#include "google/protobuf/hpb/internal/message_lock.h" -#include "upb/mem/arena.h" -#include "upb/message/accessors.h" -#include "upb/message/copy.h" -#include "upb/message/message.h" -#include "upb/message/promote.h" -#include "upb/message/value.h" -#include "upb/mini_table/extension.h" -#include "upb/mini_table/extension_registry.h" -#include "upb/mini_table/message.h" -#include "upb/wire/decode.h" -#include "upb/wire/encode.h" - -namespace hpb { - -absl::Status MessageAllocationError(SourceLocation loc) { - return absl::Status(absl::StatusCode::kUnknown, - "Upb message allocation error"); -} - -absl::Status ExtensionNotFoundError(int ext_number, SourceLocation loc) { - return absl::Status(absl::StatusCode::kUnknown, - absl::StrFormat("Extension %d not found", ext_number)); -} - -absl::Status MessageEncodeError(upb_EncodeStatus s, SourceLocation loc) { - return absl::Status(absl::StatusCode::kUnknown, "Encoding error"); -} - -absl::Status MessageDecodeError(upb_DecodeStatus status, SourceLocation loc - -) { - return absl::Status(absl::StatusCode::kUnknown, "Upb message parse error"); -} - -namespace internal { - -/** - * MessageLock(msg) acquires lock on msg when constructed and releases it when - * destroyed. - */ -class MessageLock { - public: - explicit MessageLock(const upb_Message* msg) : msg_(msg) { - UpbExtensionLocker locker = - upb_extension_locker_global.load(std::memory_order_acquire); - unlocker_ = (locker != nullptr) ? locker(msg) : nullptr; - } - MessageLock(const MessageLock&) = delete; - void operator=(const MessageLock&) = delete; - ~MessageLock() { - if (unlocker_ != nullptr) { - unlocker_(msg_); - } - } - - private: - const upb_Message* msg_; - UpbExtensionUnlocker unlocker_; -}; - -bool HasExtensionOrUnknown(const upb_Message* msg, - const upb_MiniTableExtension* eid) { - MessageLock msg_lock(msg); - if (upb_Message_HasExtension(msg, eid)) return true; - - const int number = upb_MiniTableExtension_Number(eid); - return upb_Message_FindUnknown(msg, number, 0).status == kUpb_FindUnknown_Ok; -} - -bool GetOrPromoteExtension(upb_Message* msg, const upb_MiniTableExtension* eid, - upb_Arena* arena, upb_MessageValue* value) { - MessageLock msg_lock(msg); - upb_GetExtension_Status ext_status = upb_Message_GetOrPromoteExtension( - (upb_Message*)msg, eid, 0, arena, value); - return ext_status == kUpb_GetExtension_Ok; -} - -absl::StatusOr<absl::string_view> Serialize(const upb_Message* message, - const upb_MiniTable* mini_table, - upb_Arena* arena, int options) { - MessageLock msg_lock(message); - size_t len; - char* ptr; - upb_EncodeStatus status = - upb_Encode(message, mini_table, options, arena, &ptr, &len); - if (status == kUpb_EncodeStatus_Ok) { - return absl::string_view(ptr, len); - } - return MessageEncodeError(status); -} - -void DeepCopy(upb_Message* target, const upb_Message* source, - const upb_MiniTable* mini_table, upb_Arena* arena) { - MessageLock msg_lock(source); - upb_Message_DeepCopy(target, source, mini_table, arena); -} - -upb_Message* DeepClone(const upb_Message* source, - const upb_MiniTable* mini_table, upb_Arena* arena) { - MessageLock msg_lock(source); - return upb_Message_DeepClone(source, mini_table, arena); -} - -absl::Status MoveExtension(upb_Message* message, upb_Arena* message_arena, - const upb_MiniTableExtension* ext, - upb_Message* extension, upb_Arena* extension_arena) { - if (message_arena != extension_arena && - // Try fuse, if fusing is not allowed or fails, create copy of extension. - !upb_Arena_Fuse(message_arena, extension_arena)) { - extension = DeepClone(extension, upb_MiniTableExtension_GetSubMessage(ext), - message_arena); - } - return upb_Message_SetExtension(message, ext, &extension, message_arena) - ? absl::OkStatus() - : MessageAllocationError(); -} - -absl::Status SetExtension(upb_Message* message, upb_Arena* message_arena, - const upb_MiniTableExtension* ext, - const upb_Message* extension) { - // Clone extension into target message arena. - extension = DeepClone(extension, upb_MiniTableExtension_GetSubMessage(ext), - message_arena); - return upb_Message_SetExtension(message, ext, &extension, message_arena) - ? absl::OkStatus() - : MessageAllocationError(); -} - -} // namespace internal - -} // namespace hpb diff --git a/third_party/protobuf/hpb/hpb.h b/third_party/protobuf/hpb/hpb.h index b84b0534ab526..c9ade06ea7654 100644 --- a/third_party/protobuf/hpb/hpb.h +++ b/third_party/protobuf/hpb/hpb.h @@ -8,25 +8,20 @@ #ifndef PROTOBUF_HPB_HPB_H_ #define PROTOBUF_HPB_HPB_H_ -#include <cstdint> #include <type_traits> -#include <vector> -#include "absl/status/status.h" +#include "absl/base/attributes.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "google/protobuf/hpb/arena.h" #include "google/protobuf/hpb/backend/upb/interop.h" #include "google/protobuf/hpb/extension.h" #include "google/protobuf/hpb/internal/internal.h" +#include "google/protobuf/hpb/internal/message_lock.h" #include "google/protobuf/hpb/internal/template_help.h" #include "google/protobuf/hpb/ptr.h" -#include "upb/base/status.hpp" -#include "upb/mem/arena.hpp" -#include "upb/message/copy.h" -#include "upb/mini_table/extension.h" +#include "google/protobuf/hpb/status.h" #include "upb/wire/decode.h" -#include "upb/wire/encode.h" #ifdef HPB_BACKEND_UPB #include "google/protobuf/hpb/backend/upb/upb.h" @@ -35,203 +30,29 @@ #endif namespace hpb { -class ExtensionRegistry; - -// This type exists to work around an absl type that has not yet been -// released. -struct SourceLocation { - static SourceLocation current() { return {}; } - absl::string_view file_name() { return "<unknown>"; } - int line() { return 0; } -}; - -absl::Status MessageAllocationError( - SourceLocation loc = SourceLocation::current()); - -absl::Status ExtensionNotFoundError( - int extension_number, SourceLocation loc = SourceLocation::current()); - -absl::Status MessageDecodeError(upb_DecodeStatus status, - SourceLocation loc = SourceLocation::current()); - -absl::Status MessageEncodeError(upb_EncodeStatus status, - SourceLocation loc = SourceLocation::current()); - -namespace internal { - -absl::StatusOr<absl::string_view> Serialize(const upb_Message* message, - const upb_MiniTable* mini_table, - upb_Arena* arena, int options); - -bool HasExtensionOrUnknown(const upb_Message* msg, - const upb_MiniTableExtension* eid); - -bool GetOrPromoteExtension(upb_Message* msg, const upb_MiniTableExtension* eid, - upb_Arena* arena, upb_MessageValue* value); - -void DeepCopy(upb_Message* target, const upb_Message* source, - const upb_MiniTable* mini_table, upb_Arena* arena); - -upb_Message* DeepClone(const upb_Message* source, - const upb_MiniTable* mini_table, upb_Arena* arena); - -absl::Status MoveExtension(upb_Message* message, upb_Arena* message_arena, - const upb_MiniTableExtension* ext, - upb_Message* extension, upb_Arena* extension_arena); - -absl::Status SetExtension(upb_Message* message, upb_Arena* message_arena, - const upb_MiniTableExtension* ext, - const upb_Message* extension); - -} // namespace internal #ifdef HPB_BACKEND_UPB namespace backend = ::hpb::internal::backend::upb; #endif -template <typename T, typename Extendee, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -ABSL_MUST_USE_RESULT bool HasExtension( - Ptr<T> message, - const ::hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { - return ::hpb::internal::HasExtensionOrUnknown( - hpb::interop::upb::GetMessage(message), id.mini_table_ext()); -} - -template <typename T, typename Extendee, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -ABSL_MUST_USE_RESULT bool HasExtension( - const T* message, - const ::hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { - return HasExtension(Ptr(message), id); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>, - typename = hpb::internal::EnableIfMutableProto<T>> -void ClearExtension( - Ptr<T> message, - const ::hpb::internal::ExtensionIdentifier<T, Extension>& id) { - static_assert(!std::is_const_v<T>, ""); - upb_Message_ClearExtension(hpb::interop::upb::GetMessage(message), - id.mini_table_ext()); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -void ClearExtension( - T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id) { - ClearExtension(Ptr(message), id); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>, - typename = hpb::internal::EnableIfMutableProto<T>> -absl::Status SetExtension( - Ptr<T> message, - const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, - const Extension& value) { - static_assert(!std::is_const_v<T>); - auto* message_arena = hpb::interop::upb::GetArena(message); - return ::hpb::internal::SetExtension(hpb::interop::upb::GetMessage(message), - message_arena, id.mini_table_ext(), - hpb::interop::upb::GetMessage(&value)); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>, - typename = hpb::internal::EnableIfMutableProto<T>> -absl::Status SetExtension( - Ptr<T> message, - const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, - Ptr<Extension> value) { - static_assert(!std::is_const_v<T>); - auto* message_arena = hpb::interop::upb::GetArena(message); - return ::hpb::internal::SetExtension(hpb::interop::upb::GetMessage(message), - message_arena, id.mini_table_ext(), - hpb::interop::upb::GetMessage(value)); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>, - typename = hpb::internal::EnableIfMutableProto<T>> -absl::Status SetExtension( - Ptr<T> message, - const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, - Extension&& value) { - Extension ext = std::move(value); - static_assert(!std::is_const_v<T>); - auto* message_arena = hpb::interop::upb::GetArena(message); - auto* extension_arena = hpb::interop::upb::GetArena(&ext); - return ::hpb::internal::MoveExtension(hpb::interop::upb::GetMessage(message), - message_arena, id.mini_table_ext(), - hpb::interop::upb::GetMessage(&ext), - extension_arena); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -absl::Status SetExtension( - T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, - const Extension& value) { - return ::hpb::SetExtension(Ptr(message), id, value); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -absl::Status SetExtension( - T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, - Extension&& value) { - return ::hpb::SetExtension(Ptr(message), id, std::forward<Extension>(value)); -} - -template <typename T, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -absl::Status SetExtension( - T* message, const ::hpb::internal::ExtensionIdentifier<T, Extension>& id, - Ptr<Extension> value) { - return ::hpb::SetExtension(Ptr(message), id, value); -} - -template <typename T, typename Extendee, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -absl::StatusOr<Ptr<const Extension>> GetExtension( - Ptr<T> message, - const ::hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { - // TODO: Fix const correctness issues. - upb_MessageValue value; - const bool ok = ::hpb::internal::GetOrPromoteExtension( - const_cast<upb_Message*>(hpb::interop::upb::GetMessage(message)), - id.mini_table_ext(), hpb::interop::upb::GetArena(message), &value); - if (!ok) { - return ExtensionNotFoundError( - upb_MiniTableExtension_Number(id.mini_table_ext())); - } - return Ptr<const Extension>(::hpb::interop::upb::MakeCHandle<Extension>( - (upb_Message*)value.msg_val, hpb::interop::upb::GetArena(message))); -} - -template <typename T, typename Extendee, typename Extension, - typename = hpb::internal::EnableIfHpbClass<T>> -absl::StatusOr<Ptr<const Extension>> GetExtension( - const T* message, - const ::hpb::internal::ExtensionIdentifier<Extendee, Extension>& id) { - return GetExtension(Ptr(message), id); -} - -template <typename T, typename Extension> -constexpr uint32_t ExtensionNumber( - ::hpb::internal::ExtensionIdentifier<T, Extension> id) { - return ::hpb::internal::PrivateAccess::GetExtensionNumber(id); -} - template <typename T> -typename T::Proxy CreateMessage(::hpb::Arena& arena) { +typename T::Proxy CreateMessage(hpb::Arena& arena) { return typename T::Proxy(upb_Message_New(T::minitable(), arena.ptr()), arena.ptr()); } template <typename T> +typename T::Proxy CloneMessage(Ptr<T> message, hpb::Arena& arena) { + return hpb::internal::PrivateAccess::Proxy<T>( + hpb::internal::DeepClone(hpb::interop::upb::GetMessage(message), + T::minitable(), arena.ptr()), + arena.ptr()); +} + +// Deprecated; do not use. There is one extant caller which we plan to migrate. +// Tracking deletion TODO: b/385138477 +template <typename T> +[[deprecated("Use CloneMessage(Ptr<T>, hpb::Arena&) instead.")]] typename T::Proxy CloneMessage(Ptr<T> message, upb_Arena* arena) { return ::hpb::internal::PrivateAccess::Proxy<T>( ::hpb::internal::DeepClone(hpb::interop::upb::GetMessage(message), @@ -254,12 +75,6 @@ void DeepCopy(Ptr<const T> source_message, T* target_message) { DeepCopy(source_message, Ptr(target_message)); } -template <typename T> -void DeepCopy(const T* source_message, Ptr<T> target_message) { - static_assert(!std::is_const_v<T>); - DeepCopy(Ptr(source_message), target_message); -} - template <typename T> void DeepCopy(const T* source_message, T* target_message) { static_assert(!std::is_const_v<T>); @@ -267,27 +82,15 @@ void DeepCopy(const T* source_message, T* target_message) { } template <typename T> -void ClearMessage(hpb::internal::PtrOrRaw<T> message) { +void ClearMessage(hpb::internal::PtrOrRawMutable<T> message) { backend::ClearMessage(message); } -template <typename T> -ABSL_MUST_USE_RESULT bool Parse(Ptr<T> message, absl::string_view bytes) { - static_assert(!std::is_const_v<T>); - upb_Message_Clear(hpb::interop::upb::GetMessage(message), - ::hpb::interop::upb::GetMiniTable(message)); - auto* arena = hpb::interop::upb::GetArena(message); - return upb_Decode(bytes.data(), bytes.size(), - hpb::interop::upb::GetMessage(message), - ::hpb::interop::upb::GetMiniTable(message), - /* extreg= */ nullptr, /* options= */ 0, - arena) == kUpb_DecodeStatus_Ok; -} - template <typename T> ABSL_MUST_USE_RESULT bool Parse( - Ptr<T> message, absl::string_view bytes, - const ::hpb::ExtensionRegistry& extension_registry) { + internal::PtrOrRaw<T> message, absl::string_view bytes, + const ::hpb::ExtensionRegistry& extension_registry = + hpb::ExtensionRegistry::EmptyRegistry()) { static_assert(!std::is_const_v<T>); upb_Message_Clear(hpb::interop::upb::GetMessage(message), ::hpb::interop::upb::GetMiniTable(message)); @@ -295,56 +98,20 @@ ABSL_MUST_USE_RESULT bool Parse( return upb_Decode(bytes.data(), bytes.size(), hpb::interop::upb::GetMessage(message), ::hpb::interop::upb::GetMiniTable(message), - /* extreg= */ - ::hpb::internal::GetUpbExtensions(extension_registry), + hpb::internal::GetUpbExtensions(extension_registry), /* options= */ 0, arena) == kUpb_DecodeStatus_Ok; } -template <typename T> -ABSL_MUST_USE_RESULT bool Parse( - T* message, absl::string_view bytes, - const ::hpb::ExtensionRegistry& extension_registry) { - static_assert(!std::is_const_v<T>); - return Parse(Ptr(message, bytes, extension_registry)); -} - -template <typename T> -ABSL_MUST_USE_RESULT bool Parse(T* message, absl::string_view bytes) { - static_assert(!std::is_const_v<T>); - upb_Message_Clear(hpb::interop::upb::GetMessage(message), - ::hpb::interop::upb::GetMiniTable(message)); - auto* arena = hpb::interop::upb::GetArena(message); - return upb_Decode(bytes.data(), bytes.size(), - hpb::interop::upb::GetMessage(message), - ::hpb::interop::upb::GetMiniTable(message), - /* extreg= */ nullptr, /* options= */ 0, - arena) == kUpb_DecodeStatus_Ok; -} - -template <typename T> -absl::StatusOr<T> Parse(absl::string_view bytes, int options = 0) { - T message; - auto* arena = hpb::interop::upb::GetArena(&message); - upb_DecodeStatus status = - upb_Decode(bytes.data(), bytes.size(), message.msg(), - ::hpb::interop::upb::GetMiniTable(&message), - /* extreg= */ nullptr, /* options= */ 0, arena); - if (status == kUpb_DecodeStatus_Ok) { - return message; - } - return MessageDecodeError(status); -} - template <typename T> absl::StatusOr<T> Parse(absl::string_view bytes, - const ::hpb::ExtensionRegistry& extension_registry, - int options = 0) { + const ::hpb::ExtensionRegistry& extension_registry = + hpb::ExtensionRegistry::EmptyRegistry()) { T message; auto* arena = hpb::interop::upb::GetArena(&message); upb_DecodeStatus status = upb_Decode(bytes.data(), bytes.size(), message.msg(), ::hpb::interop::upb::GetMiniTable(&message), - ::hpb::internal::GetUpbExtensions(extension_registry), + hpb::internal::GetUpbExtensions(extension_registry), /* options= */ 0, arena); if (status == kUpb_DecodeStatus_Ok) { return message; @@ -353,19 +120,11 @@ absl::StatusOr<T> Parse(absl::string_view bytes, } template <typename T> -absl::StatusOr<absl::string_view> Serialize(const T* message, upb::Arena& arena, - int options = 0) { +absl::StatusOr<absl::string_view> Serialize(internal::PtrOrRaw<T> message, + hpb::Arena& arena) { return ::hpb::internal::Serialize(hpb::interop::upb::GetMessage(message), ::hpb::interop::upb::GetMiniTable(message), - arena.ptr(), options); -} - -template <typename T> -absl::StatusOr<absl::string_view> Serialize(Ptr<T> message, upb::Arena& arena, - int options = 0) { - return ::hpb::internal::Serialize(hpb::interop::upb::GetMessage(message), - ::hpb::interop::upb::GetMiniTable(message), - arena.ptr(), options); + arena.ptr(), 0); } } // namespace hpb diff --git a/third_party/protobuf/hpb/internal/internal.h b/third_party/protobuf/hpb/internal/internal.h index 420071c4a89cb..2634c3cf48cc2 100644 --- a/third_party/protobuf/hpb/internal/internal.h +++ b/third_party/protobuf/hpb/internal/internal.h @@ -1,7 +1,15 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + #ifndef GOOGLE_PROTOBUF_HPB_INTERNAL_INTERNAL_H__ #define GOOGLE_PROTOBUF_HPB_INTERNAL_INTERNAL_H__ #include <cstdint> +#include <utility> #include "upb/mem/arena.h" #include "upb/message/message.h" @@ -30,10 +38,20 @@ struct PrivateAccess { return typename T::Proxy(upb_Message_New(T::minitable(), arena), arena); } + template <typename T, typename... Args> + static constexpr auto InvokeConstructor(Args&&... args) { + return T(std::forward<Args>(args)...); + } + template <typename ExtensionId> static constexpr uint32_t GetExtensionNumber(const ExtensionId& id) { return id.number(); } + + template <typename ExtensionId> + static decltype(auto) GetDefaultValue(const ExtensionId& id) { + return id.default_value(); + } }; } // namespace hpb::internal diff --git a/third_party/protobuf/hpb/internal/message_lock.cc b/third_party/protobuf/hpb/internal/message_lock.cc index 62f69ce157d36..bb5a10d451eb7 100644 --- a/third_party/protobuf/hpb/internal/message_lock.cc +++ b/third_party/protobuf/hpb/internal/message_lock.cc @@ -8,9 +8,94 @@ #include "google/protobuf/hpb/internal/message_lock.h" #include <atomic> +#include <cstddef> +#include <cstdint> + +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "google/protobuf/hpb/status.h" +#include "upb/mem/arena.h" +#include "upb/message/accessors.h" +#include "upb/message/array.h" +#include "upb/message/copy.h" +#include "upb/message/message.h" +#include "upb/message/promote.h" +#include "upb/mini_table/extension.h" +#include "upb/mini_table/message.h" +#include "upb/wire/encode.h" namespace hpb::internal { std::atomic<UpbExtensionLocker> upb_extension_locker_global; +/** + * MessageLock(msg) acquires lock on msg when constructed and releases it when + * destroyed. + */ +class MessageLock { + public: + explicit MessageLock(const upb_Message* msg) : msg_(msg) { + UpbExtensionLocker locker = + upb_extension_locker_global.load(std::memory_order_acquire); + unlocker_ = (locker != nullptr) ? locker(msg) : nullptr; + } + MessageLock(const MessageLock&) = delete; + void operator=(const MessageLock&) = delete; + ~MessageLock() { + if (unlocker_ != nullptr) { + unlocker_(msg_); + } + } + + private: + const upb_Message* msg_; + UpbExtensionUnlocker unlocker_; +}; + +bool HasExtensionOrUnknown(const upb_Message* msg, + const upb_MiniTableExtension* eid) { + MessageLock msg_lock(msg); + if (upb_Message_HasExtension(msg, eid)) return true; + + const uint32_t number = upb_MiniTableExtension_Number(eid); + return upb_Message_FindUnknown(msg, number, 0).status == kUpb_FindUnknown_Ok; +} + +bool GetOrPromoteExtension(const upb_Message* msg, + const upb_MiniTableExtension* eid, upb_Arena* arena, + upb_MessageValue* value) { + // TODO: Fix const correctness issues. + auto mutable_msg = const_cast<upb_Message*>(msg); + MessageLock msg_lock(mutable_msg); + upb_GetExtension_Status ext_status = + upb_Message_GetOrPromoteExtension(mutable_msg, eid, 0, arena, value); + return ext_status == kUpb_GetExtension_Ok; +} + +absl::StatusOr<absl::string_view> Serialize(const upb_Message* message, + const upb_MiniTable* mini_table, + upb_Arena* arena, int options) { + MessageLock msg_lock(message); + size_t len; + char* ptr; + upb_EncodeStatus status = + upb_Encode(message, mini_table, options, arena, &ptr, &len); + if (status == kUpb_EncodeStatus_Ok) { + return absl::string_view(ptr, len); + } + return MessageEncodeError(status); +} + +void DeepCopy(upb_Message* target, const upb_Message* source, + const upb_MiniTable* mini_table, upb_Arena* arena) { + MessageLock msg_lock(source); + upb_Message_DeepCopy(target, source, mini_table, arena); +} + +upb_Message* DeepClone(const upb_Message* source, + const upb_MiniTable* mini_table, upb_Arena* arena) { + MessageLock msg_lock(source); + return upb_Message_DeepClone(source, mini_table, arena); +} + } // namespace hpb::internal diff --git a/third_party/protobuf/hpb/internal/message_lock.h b/third_party/protobuf/hpb/internal/message_lock.h index 430d24bb79eb8..8e86c6bc99c99 100644 --- a/third_party/protobuf/hpb/internal/message_lock.h +++ b/third_party/protobuf/hpb/internal/message_lock.h @@ -10,6 +10,10 @@ #include <atomic> +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "upb/message/message.h" + namespace hpb::internal { // TODO: Temporary locking api for cross-language @@ -26,6 +30,23 @@ using UpbExtensionLocker = UpbExtensionUnlocker (*)(const void*); // TODO: Expose as function instead of global. extern std::atomic<UpbExtensionLocker> upb_extension_locker_global; +absl::StatusOr<absl::string_view> Serialize(const upb_Message* message, + const upb_MiniTable* mini_table, + upb_Arena* arena, int options); + +bool HasExtensionOrUnknown(const upb_Message* msg, + const upb_MiniTableExtension* eid); + +bool GetOrPromoteExtension(const upb_Message* msg, + const upb_MiniTableExtension* eid, upb_Arena* arena, + upb_MessageValue* value); + +void DeepCopy(upb_Message* target, const upb_Message* source, + const upb_MiniTable* mini_table, upb_Arena* arena); + +upb_Message* DeepClone(const upb_Message* source, + const upb_MiniTable* mini_table, upb_Arena* arena); + } // namespace hpb::internal #endif // PROTOBUF_HPB_EXTENSION_LOCK_H_ diff --git a/third_party/protobuf/hpb/internal/message_lock_test.cc b/third_party/protobuf/hpb/internal/message_lock_test.cc index 5f44231f660f3..e28c79a9fbfba 100644 --- a/third_party/protobuf/hpb/internal/message_lock_test.cc +++ b/third_party/protobuf/hpb/internal/message_lock_test.cc @@ -11,14 +11,17 @@ #include <mutex> #include <string> #include <thread> +#include <vector> #include <gmock/gmock.h> #include <gtest/gtest.h> #include "absl/hash/hash.h" #include "absl/log/absl_check.h" #include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h" +#include "google/protobuf/hpb/extension.h" #include "google/protobuf/hpb/hpb.h" #include "upb/mem/arena.hpp" +#include "upb/mini_table/extension.h" #ifndef ASSERT_OK #define ASSERT_OK(x) ASSERT_TRUE(x.ok()) @@ -103,20 +106,32 @@ void TestConcurrentExtensionAccess(::hpb::ExtensionRegistry registry) { } TEST(CppGeneratedCode, ConcurrentAccessDoesNotRaceBothLazy) { - ::upb::Arena arena; - TestConcurrentExtensionAccess({{}, arena}); + upb::Arena arena; + hpb::ExtensionRegistry registry(arena); + TestConcurrentExtensionAccess(registry); } TEST(CppGeneratedCode, ConcurrentAccessDoesNotRaceOneLazyOneEager) { - ::upb::Arena arena; - TestConcurrentExtensionAccess({{&theme}, arena}); - TestConcurrentExtensionAccess({{&ThemeExtension::theme_extension}, arena}); + upb::Arena arena; + hpb::ExtensionRegistry r1(arena); + r1.AddExtension(theme); + TestConcurrentExtensionAccess(r1); + hpb::ExtensionRegistry r2(arena); + r2.AddExtension(ThemeExtension::theme_extension); + TestConcurrentExtensionAccess(r2); } TEST(CppGeneratedCode, ConcurrentAccessDoesNotRaceBothEager) { - ::upb::Arena arena; - TestConcurrentExtensionAccess( - {{&theme, &ThemeExtension::theme_extension}, arena}); + upb::Arena arena; + hpb::ExtensionRegistry registry(arena); + registry.AddExtension(theme); + registry.AddExtension(ThemeExtension::theme_extension); + TestConcurrentExtensionAccess(registry); +} + +TEST(CppGeneratedCode, ConcurrentAccessDoesNotRaceGlobalInstance) { + upb::Arena arena; + TestConcurrentExtensionAccess(hpb::ExtensionRegistry::generated_registry()); } } // namespace diff --git a/third_party/protobuf/hpb/internal/template_help.h b/third_party/protobuf/hpb/internal/template_help.h index 4757d80b8bb2f..f6f8757692547 100644 --- a/third_party/protobuf/hpb/internal/template_help.h +++ b/third_party/protobuf/hpb/internal/template_help.h @@ -33,12 +33,34 @@ using RemovePtrT = typename RemovePtr<T>::type; template <typename T, typename U = RemovePtrT<T>, typename = std::enable_if_t<!std::is_const_v<U>>> +using PtrOrRawMutable = T; + +template <typename T, typename U = RemovePtrT<T>> using PtrOrRaw = T; +template <typename T, typename = void> +inline constexpr bool IsHpbClass = false; + template <typename T> -using EnableIfHpbClass = std::enable_if_t< - std::is_base_of<typename T::Access, T>::value && - std::is_base_of<typename T::Access, typename T::ExtendableType>::value>; +inline constexpr bool + IsHpbClass<T, std::enable_if_t<std::is_base_of_v<typename T::Access, T>>> = + true; + +template <typename T> +using EnableIfHpbClass = std::enable_if_t<IsHpbClass<T>>; + +template <typename T, typename = void> +inline constexpr bool IsHpbClassThatHasExtensions = false; + +template <typename T> +inline constexpr bool IsHpbClassThatHasExtensions< + T, std::enable_if_t<std::is_base_of_v<typename T::Access, T> && + std::is_base_of_v<typename T::ExtendableType, T>>> = + true; + +template <typename T> +using EnableIfHpbClassThatHasExtensions = + std::enable_if_t<IsHpbClassThatHasExtensions<T>>; template <typename T> using EnableIfMutableProto = std::enable_if_t<!std::is_const<T>::value>; diff --git a/third_party/protobuf/hpb/internal/template_help_test.cc b/third_party/protobuf/hpb/internal/template_help_test.cc new file mode 100644 index 0000000000000..6ff3a4e4af00d --- /dev/null +++ b/third_party/protobuf/hpb/internal/template_help_test.cc @@ -0,0 +1,40 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include "google/protobuf/hpb/internal/template_help.h" + +#include <gtest/gtest.h> +#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h" + +namespace hpb_unittest::protos { + +class NonHpbClass {}; + +TEST(TemplateHelp, TestIsHpbClass) { + static_assert(hpb::internal::IsHpbClass<TestModel>, + "TestModel must be an hpb class"); + static_assert(hpb::internal::IsHpbClass<ThemeExtension>, + "ThemeExtension must be an hpb class"); + static_assert(!hpb::internal::IsHpbClass<NonHpbClass>, + "NonHpbClass must not be an hpb class"); + static_assert(!hpb::internal::IsHpbClass<int>, + "primitives like int must not be an hpb class"); +} + +TEST(TemplateHelp, TestIsHpbExtendedClass) { + static_assert( + hpb::internal::IsHpbClassThatHasExtensions<TestModel>, + "TestModel must be an hpb extension class, for it has extensions"); + static_assert(!hpb::internal::IsHpbClassThatHasExtensions<ThemeExtension>, + "ThemeExtension must not have extensions"); + static_assert(!hpb::internal::IsHpbClassThatHasExtensions<NonHpbClass>, + "NonHpbClass must not be an hpb extension class"); + static_assert(!hpb::internal::IsHpbClassThatHasExtensions<int>, + "primitives like int must not be an hpb extension class"); +} + +} // namespace hpb_unittest::protos diff --git a/third_party/protobuf/hpb/ptr.h b/third_party/protobuf/hpb/ptr.h index 43fd0f6b50282..cafc49d85caa4 100644 --- a/third_party/protobuf/hpb/ptr.h +++ b/third_party/protobuf/hpb/ptr.h @@ -11,9 +11,6 @@ #include <memory> #include <type_traits> -class upb_Message; -class upb_Arena; - namespace hpb { template <typename T> @@ -61,8 +58,6 @@ class Ptr final { #endif private: - Ptr(upb_Message* msg, upb_Arena* arena) : p_(msg, arena) {} // NOLINT - friend class Ptr<const T>; friend typename T::Access; diff --git a/third_party/protobuf/hpb/requires.h b/third_party/protobuf/hpb/requires.h index 42c4a00b8cea0..a5de8c24dce18 100644 --- a/third_party/protobuf/hpb/requires.h +++ b/third_party/protobuf/hpb/requires.h @@ -1,3 +1,10 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + #ifndef PROTOBUF_HPB_REQUIRES_H_ #define PROTOBUF_HPB_REQUIRES_H_ diff --git a/third_party/protobuf/hpb/status.cc b/third_party/protobuf/hpb/status.cc new file mode 100644 index 0000000000000..4d5c3946dd8da --- /dev/null +++ b/third_party/protobuf/hpb/status.cc @@ -0,0 +1,39 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include "google/protobuf/hpb/status.h" + +#include <cstdint> + +#include "absl/status/status.h" +#include "absl/strings/str_format.h" +#include "absl/types/source_location.h" +#include "upb/wire/decode.h" +#include "upb/wire/encode.h" + +namespace hpb { +absl::Status MessageAllocationError(SourceLocation loc) { + return absl::Status(absl::StatusCode::kUnknown, + "Upb message allocation error"); +} + +absl::Status ExtensionNotFoundError(int ext_number, SourceLocation loc) { + return absl::Status(absl::StatusCode::kUnknown, + absl::StrFormat("Extension %d not found", ext_number)); +} + +absl::Status MessageEncodeError(upb_EncodeStatus s, SourceLocation loc) { + return absl::Status(absl::StatusCode::kUnknown, "Encoding error"); +} + +absl::Status MessageDecodeError(upb_DecodeStatus status, SourceLocation loc + +) { + return absl::Status(absl::StatusCode::kUnknown, "Upb message parse error"); +} + +} // namespace hpb diff --git a/third_party/protobuf/hpb/status.h b/third_party/protobuf/hpb/status.h new file mode 100644 index 0000000000000..8abe29e97d3c0 --- /dev/null +++ b/third_party/protobuf/hpb/status.h @@ -0,0 +1,41 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#ifndef GOOGLE_PROTOBUF_HPB_STATUS_H__ +#define GOOGLE_PROTOBUF_HPB_STATUS_H__ + +#include <cstdint> + +#include "absl/status/status.h" +#include "absl/types/source_location.h" +#include "upb/wire/decode.h" +#include "upb/wire/encode.h" + +namespace hpb { + +// This type exists to work around an absl type that has not yet been +// released. +struct SourceLocation { + static SourceLocation current() { return {}; } + absl::string_view file_name() { return "<unknown>"; } + int line() { return 0; } +}; + +absl::Status MessageEncodeError(upb_EncodeStatus status, + SourceLocation loc = SourceLocation::current()); + +absl::Status MessageAllocationError( + SourceLocation loc = SourceLocation::current()); + +absl::Status ExtensionNotFoundError( + uint32_t extension_number, SourceLocation loc = SourceLocation::current()); + +absl::Status MessageDecodeError(upb_DecodeStatus status, + SourceLocation loc = SourceLocation::current()); +} // namespace hpb + +#endif // GOOGLE_PROTOBUF_HPB_STATUS_H__ diff --git a/third_party/protobuf/hpb_generator/context.h b/third_party/protobuf/hpb_generator/context.h new file mode 100644 index 0000000000000..f1e989fb62043 --- /dev/null +++ b/third_party/protobuf/hpb_generator/context.h @@ -0,0 +1,149 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#ifndef GOOGLE_PROTOBUF_COMPILER_HPB_CONTEXT_H__ +#define GOOGLE_PROTOBUF_COMPILER_HPB_CONTEXT_H__ + +#include <string> + +#include "absl/strings/ascii.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_replace.h" +#include "absl/strings/string_view.h" +#include "absl/strings/substitute.h" +#include "absl/types/source_location.h" +#include "absl/types/span.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/io/printer.h" +#include "google/protobuf/io/zero_copy_stream.h" +#include "upb/reflection/def.hpp" +#include "upb_generator/common/cpp_to_upb_def.h" + +namespace google::protobuf::hpb_generator { + +enum class Backend { UPB, CPP }; + +struct Options { + Backend backend = Backend::UPB; +}; + +/** + * This Context object will be used throughout hpb generation. + * It is a thin wrapper around an io::Printer and can be easily extended + * to support more options. + * + * Expected usage is: + * SomeGenerationFunc(..., Context& context) { + * context.Emit({{"some_key", some_computed_val}}, R"cc( + * // hpb gencode ... + * )cc); + * } + */ +class Context final { + public: + Context(const FileDescriptor* file, io::ZeroCopyOutputStream* stream, + const Options& options) + : stream_(stream), printer_(stream_), options_(options) { + BuildDefPool(file); + } + + void Emit(absl::Span<const io::Printer::Sub> vars, absl::string_view format, + absl::SourceLocation loc = absl::SourceLocation::current()) { + printer_.Emit(vars, format, loc); + } + + void Emit(absl::string_view format, + absl::SourceLocation loc = absl::SourceLocation::current()) { + printer_.Emit(format, loc); + } + + // TODO: b/373438292 - Remove EmitLegacy in favor of Emit. + // This is an interim solution while we migrate from Output to io::Printer + template <class... Arg> + void EmitLegacy(absl::string_view format, const Arg&... arg) { + auto res = absl::Substitute(format, arg...); + printer_.Emit(res, absl::SourceLocation::current()); + } + + const Options& options() { return options_; } + io::Printer& printer() { return printer_; } + + inline std::string GetLayoutIndex(const FieldDescriptor* field) { + return absl::StrCat( + upb::generator::FindBaseFieldDef(pool_, field).layout_index()); + } + + Context(const Context&) = delete; + Context& operator=(const Context&) = delete; + Context(Context&&) = delete; + Context& operator=(Context&&) = delete; + + private: + inline void BuildDefPool(const FileDescriptor* file) { + upb::generator::AddFile(file, &pool_); + } + + io::ZeroCopyOutputStream* stream_; + io::Printer printer_; + const Options& options_; + upb::DefPool pool_; +}; + +// TODO: b/373438292 - re-house these 4 legacy funcs post io::Printer move +inline std::string ToCIdent(absl::string_view str) { + return absl::StrReplaceAll(str, {{".", "_"}, {"/", "_"}, {"-", "_"}}); +} + +inline std::string ToPreproc(absl::string_view str) { + return absl::AsciiStrToUpper(ToCIdent(str)); +} + +inline void EmitFileWarning(const google::protobuf::FileDescriptor* file, Context& ctx) { + ctx.EmitLegacy( + R"cc( + /* This file was generated by hpb_generator (Handle Protobuf) " + from the input + * file: + * + * $0 + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + )cc", + file->name()); + ctx.Emit("\n"); +} + +// TODO: b/346865271 append ::hpb instead of ::protos after namespace swap +inline std::string NamespaceFromPackageName(absl::string_view package_name) { + return absl::StrCat(absl::StrReplaceAll(package_name, {{".", "::"}}), + "::protos"); +} + +template <typename T> +void WrapNamespace(const google::protobuf::FileDescriptor* file, Context& ctx, T&& body) { + if (file->package().empty()) { + body(); + } else { + ctx.Emit( + { + {"body", body}, + {"namespace", NamespaceFromPackageName(file->package())}, + }, + R"cc( + namespace $namespace$ { + + $body$ + + } // namespace $namespace$ + )cc"); + } +} +} // namespace protobuf +} // namespace google::hpb_generator + +#endif // GOOGLE_PROTOBUF_COMPILER_HPB_CONTEXT_H__ diff --git a/third_party/protobuf/hpb_generator/gen_accessors.cc b/third_party/protobuf/hpb_generator/gen_accessors.cc index 9422df8104ab9..d480c8526582f 100644 --- a/third_party/protobuf/hpb_generator/gen_accessors.cc +++ b/third_party/protobuf/hpb_generator/gen_accessors.cc @@ -10,14 +10,15 @@ #include <string> #include "absl/container/flat_hash_set.h" +#include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/gen_repeated_fields.h" #include "google/protobuf/compiler/hpb/gen_utils.h" #include "google/protobuf/compiler/hpb/keywords.h" #include "google/protobuf/compiler/hpb/names.h" -#include "google/protobuf/compiler/hpb/output.h" #include "google/protobuf/descriptor.h" #include "upb_generator/c/names.h" #include "upb_generator/minitable/names.h" @@ -33,22 +34,21 @@ void WriteFieldAccessorHazzer(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, absl::string_view resolved_upbc_name, - Output& output); + Context& ctx); void WriteFieldAccessorClear(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, absl::string_view resolved_upbc_name, - Output& output); + Context& ctx); void WriteMapFieldAccessors(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, - absl::string_view resolved_upbc_name, - Output& output); + absl::string_view resolved_upbc_name, Context& ctx); void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, - absl::string_view class_name, Output& output); + absl::string_view class_name, Context& ctx); // Returns C++ class member name by resolving naming conflicts across // proto field names (such as clear_ prefixes) and keyword collisions. @@ -75,53 +75,62 @@ NameToFieldDescriptorMap CreateFieldNameMap( } void WriteFieldAccessorsInHeader(const protobuf::Descriptor* desc, - Output& output) { + Context& ctx) { // Generate const methods. - OutputIndenter i(output); - auto field_names = CreateFieldNameMap(desc); auto mangler = CreateNameMangler(desc); + auto indent = ctx.printer().WithIndent(); + for (const auto* field : FieldNumberOrder(desc)) { std::string resolved_field_name = ResolveFieldName(field, field_names); std::string resolved_upbc_name = mangler.ResolveFieldName(field->name()); WriteFieldAccessorHazzer(desc, field, resolved_field_name, - resolved_upbc_name, output); + resolved_upbc_name, ctx); WriteFieldAccessorClear(desc, field, resolved_field_name, - resolved_upbc_name, output); + resolved_upbc_name, ctx); if (field->is_map()) { WriteMapFieldAccessors(desc, field, resolved_field_name, - resolved_upbc_name, output); + resolved_upbc_name, ctx); } else if (desc->options().map_entry()) { // TODO Implement map entry } else if (field->is_repeated()) { WriteRepeatedFieldsInMessageHeader(desc, field, resolved_field_name, - resolved_upbc_name, output); + resolved_upbc_name, ctx); } else { // non-repeated. if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_STRING) { - output(R"cc( - $0 $1() const; - void set_$1($0 value); - )cc", - CppConstType(field), resolved_field_name); + ctx.EmitLegacy(R"cc( + $0 $1() const; + void set_$1($0 value); + )cc", + CppConstType(field), resolved_field_name); } else if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - output(R"cc( - $1 $2() const; - $0 mutable_$2(); - )cc", - MessagePtrConstType(field, /* const */ false), - MessagePtrConstType(field, /* const */ true), - resolved_field_name); + ctx.EmitLegacy(R"cc( + $1 $2() const; + $0 mutable_$2(); + /** + * Re-points submessage to the given target. + * + * REQUIRES: + * - both messages must be in the same arena, or in two + * fused arenas. + */ + void set_alias_$2($0 target); + )cc", + MessagePtrConstType(field, /* const */ false), + MessagePtrConstType(field, /* const */ true), + resolved_field_name); } else { - output( + ctx.EmitLegacy( R"cc( inline $0 $1() const { return $2_$3(msg_); } inline void set_$1($0 value) { return $2_set_$3(msg_, value); } )cc", - CppConstType(field), resolved_field_name, MessageName(desc), + CppConstType(field), resolved_field_name, + upb::generator::CApiMessageType(desc->full_name()), resolved_upbc_name); } } @@ -132,12 +141,14 @@ void WriteFieldAccessorHazzer(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, const absl::string_view resolved_field_name, const absl::string_view resolved_upbc_name, - Output& output) { + Context& ctx) { // Generate hazzer (if any). if (field->has_presence()) { // Has presence. - output("inline bool has_$0() const { return $1_has_$2(msg_); }\n", - resolved_field_name, MessageName(desc), resolved_upbc_name); + ctx.EmitLegacy("inline bool has_$0() const { return $1_has_$2(msg_); }\n", + resolved_field_name, + upb::generator::CApiMessageType(desc->full_name()), + resolved_upbc_name); } } @@ -145,10 +156,11 @@ void WriteFieldAccessorClear(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, const absl::string_view resolved_field_name, const absl::string_view resolved_upbc_name, - Output& output) { + Context& ctx) { if (field->has_presence()) { - output("void clear_$0() { $2_clear_$1(msg_); }\n", resolved_field_name, - resolved_upbc_name, MessageName(desc)); + ctx.EmitLegacy("void clear_$0() { $2_clear_$1(msg_); }\n", + resolved_field_name, resolved_upbc_name, + upb::generator::CApiMessageType(desc->full_name())); } } @@ -156,31 +168,35 @@ void WriteMapFieldAccessors(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, const absl::string_view resolved_field_name, const absl::string_view resolved_upbc_name, - Output& output) { + Context& ctx) { const protobuf::Descriptor* entry = field->message_type(); const protobuf::FieldDescriptor* key = entry->FindFieldByNumber(1); const protobuf::FieldDescriptor* val = entry->FindFieldByNumber(2); - output( + ctx.EmitLegacy( R"cc( inline size_t $0_size() const { return $1_$3_size(msg_); } inline void clear_$0() { $1_clear_$3(msg_); } void delete_$0($2 key); )cc", - resolved_field_name, MessageName(desc), CppConstType(key), - resolved_upbc_name); + resolved_field_name, upb::generator::CApiMessageType(desc->full_name()), + CppConstType(key), resolved_upbc_name); if (val->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - output( - R"cc( - bool set_$0($1 key, $3 value); - bool set_$0($1 key, $4 value); - absl::StatusOr<$3> get_$0($1 key); - )cc", - resolved_field_name, CppConstType(key), CppConstType(val), - MessagePtrConstType(val, /* is_const */ true), - MessagePtrConstType(val, /* is_const */ false)); + ctx.Emit({{"field_name", resolved_field_name}, + {"const_key", CppConstType(key)}, + {"const_val", CppConstType(val)}, + {"ConstPtr", MessagePtrConstType(val, true)}, + {"MutPtr", MessagePtrConstType(val, false)}}, + R"cc( + bool set_$field_name$($const_key$ key, $ConstPtr$ value); + bool set_$field_name$($const_key$ key, $MutPtr$ value); + bool set_alias_$field_name$($const_key$ key, $ConstPtr$ value); + bool set_alias_$field_name$($const_key$ key, $MutPtr$ value); + absl::StatusOr<$ConstPtr$> get_$field_name$($const_key$ key); + absl::StatusOr<$MutPtr$> get_mutable_$field_name$($const_key$ key); + )cc"); } else { - output( + ctx.EmitLegacy( R"cc( bool set_$0($1 key, $2 value); absl::StatusOr<$2> get_$0($1 key); @@ -189,59 +205,62 @@ void WriteMapFieldAccessors(const protobuf::Descriptor* desc, } } -void WriteAccessorsInSource(const protobuf::Descriptor* desc, Output& output) { +void WriteAccessorsInSource(const protobuf::Descriptor* desc, Context& ctx) { std::string class_name = ClassName(desc); absl::StrAppend(&class_name, "Access"); - output("namespace internal {\n"); + ctx.Emit("namespace internal {\n"); const char arena_expression[] = "arena_"; auto field_names = CreateFieldNameMap(desc); auto mangler = CreateNameMangler(desc); // Generate const methods. - OutputIndenter i(output); + auto indent = ctx.printer().WithIndent(); for (const auto* field : FieldNumberOrder(desc)) { std::string resolved_field_name = ResolveFieldName(field, field_names); std::string resolved_upbc_name = mangler.ResolveFieldName(field->name()); if (field->is_map()) { WriteMapAccessorDefinitions(desc, field, resolved_field_name, class_name, - output); + ctx); } else if (desc->options().map_entry()) { // TODO Implement map entry } else if (field->is_repeated()) { if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { WriteRepeatedMessageAccessor(desc, field, resolved_field_name, - class_name, output); + class_name, ctx); } else if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_STRING) { WriteRepeatedStringAccessor(desc, field, resolved_field_name, - class_name, output); + class_name, ctx); } else { WriteRepeatedScalarAccessor(desc, field, resolved_field_name, - class_name, output); + class_name, ctx); } } else { // non-repeated field. if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_STRING) { - output( + ctx.EmitLegacy( R"cc( $1 $0::$2() const { return hpb::interop::upb::FromUpbStringView($3_$4(msg_)); } )cc", class_name, CppConstType(field), resolved_field_name, - MessageName(desc), resolved_upbc_name); + upb::generator::CApiMessageType(desc->full_name()), + resolved_upbc_name); // Set string. - output( + ctx.EmitLegacy( R"cc( void $0::set_$2($1 value) { $4_set_$3(msg_, hpb::interop::upb::CopyToUpbStringView(value, $5)); } )cc", class_name, CppConstType(field), resolved_field_name, - resolved_upbc_name, MessageName(desc), arena_expression); + resolved_upbc_name, + upb::generator::CApiMessageType(desc->full_name()), + arena_expression); } else if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - output( + ctx.EmitLegacy( R"cc( $1 $0::$2() const { if (!has_$2()) { @@ -252,33 +271,42 @@ void WriteAccessorsInSource(const protobuf::Descriptor* desc, Output& output) { } )cc", class_name, MessagePtrConstType(field, /* is_const */ true), - resolved_field_name, MessageName(desc), + resolved_field_name, + upb::generator::CApiMessageType(desc->full_name()), MessageBaseType(field, /* maybe_const */ false), resolved_upbc_name); - output( + ctx.EmitLegacy( R"cc( $1 $0::mutable_$2() { return hpb::interop::upb::MakeHandle<$4>( (upb_Message*)($3_mutable_$5(msg_, $6)), $6); } + void $0::set_alias_$2($1 target) { + ABSL_CHECK(upb_Arena_IsFused(arena_, hpb::interop::upb::GetArena(target))); + upb_Message_SetBaseFieldMessage( + UPB_UPCAST(msg_), + upb_MiniTable_GetFieldByIndex($7::minitable(), $8), + hpb::interop::upb::GetMessage(target)); + } )cc", class_name, MessagePtrConstType(field, /* is_const */ false), - resolved_field_name, MessageName(desc), + resolved_field_name, + upb::generator::CApiMessageType(desc->full_name()), MessageBaseType(field, /* maybe_const */ false), resolved_upbc_name, - arena_expression); + arena_expression, ClassName(desc), ctx.GetLayoutIndex(field)); } } } - output("\n"); - output("} // namespace internal\n\n"); + ctx.Emit("\n"); + ctx.Emit("} // namespace internal\n\n"); } -void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, +void WriteMapAccessorDefinitions(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, const absl::string_view resolved_field_name, const absl::string_view class_name, - Output& output) { + Context& ctx) { const protobuf::Descriptor* entry = field->message_type(); const protobuf::FieldDescriptor* key = entry->FindFieldByNumber(1); const protobuf::FieldDescriptor* val = entry->FindFieldByNumber(2); @@ -294,7 +322,7 @@ void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, "upb_StringView upb_key = {key.data(), key.size()};\n"; } if (val->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - output( + ctx.EmitLegacy( R"cc( bool $0::set_$1($2 key, $3 value) { upb_Message* clone = upb_Message_DeepClone( @@ -304,12 +332,13 @@ void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, } )cc", class_name, resolved_field_name, CppConstType(key), - MessagePtrConstType(val, /* is_const */ true), MessageName(message), - MessageName(val->message_type()), optional_conversion_code, - converted_key_name, upbc_name, + MessagePtrConstType(val, /* is_const */ true), + upb::generator::CApiMessageType(desc->full_name()), + upb::generator::CApiMessageType(val->message_type()->full_name()), + optional_conversion_code, converted_key_name, upbc_name, ::upb::generator::MiniTableMessageVarName( val->message_type()->full_name())); - output( + ctx.EmitLegacy( R"cc( bool $0::set_$1($2 key, $3 value) { upb_Message* clone = upb_Message_DeepClone( @@ -319,12 +348,37 @@ void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, } )cc", class_name, resolved_field_name, CppConstType(key), - MessagePtrConstType(val, /* is_const */ false), MessageName(message), - MessageName(val->message_type()), optional_conversion_code, - converted_key_name, upbc_name, + MessagePtrConstType(val, /* is_const */ false), + upb::generator::CApiMessageType(desc->full_name()), + upb::generator::CApiMessageType(val->message_type()->full_name()), + optional_conversion_code, converted_key_name, upbc_name, ::upb::generator::MiniTableMessageVarName( val->message_type()->full_name())); - output( + ctx.EmitLegacy( + R"cc( + bool $0::set_alias_$1($2 key, $3 value) { + $6return $4_$8_set( + msg_, $7, ($5*)hpb::interop::upb::GetMessage(value), arena_); + } + )cc", + class_name, resolved_field_name, CppConstType(key), + MessagePtrConstType(val, /* is_const */ true), + upb::generator::CApiMessageType(desc->full_name()), + upb::generator::CApiMessageType(val->message_type()->full_name()), + optional_conversion_code, converted_key_name, upbc_name); + ctx.EmitLegacy( + R"cc( + bool $0::set_alias_$1($2 key, $3 value) { + $6return $4_$8_set( + msg_, $7, ($5*)hpb::interop::upb::GetMessage(value), arena_); + } + )cc", + class_name, resolved_field_name, CppConstType(key), + MessagePtrConstType(val, /* is_const */ false), + upb::generator::CApiMessageType(desc->full_name()), + upb::generator::CApiMessageType(val->message_type()->full_name()), + optional_conversion_code, converted_key_name, upbc_name); + ctx.EmitLegacy( R"cc( absl::StatusOr<$3> $0::get_$1($2 key) { $5* msg_value; @@ -336,20 +390,48 @@ void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, } )cc", class_name, resolved_field_name, CppConstType(key), - MessagePtrConstType(val, /* is_const */ true), MessageName(message), - MessageName(val->message_type()), + MessagePtrConstType(val, /* is_const */ true), + upb::generator::CApiMessageType(desc->full_name()), + upb::generator::CApiMessageType(val->message_type()->full_name()), QualifiedClassName(val->message_type()), optional_conversion_code, converted_key_name, upbc_name); - output( + ctx.Emit( + {{"class_name", class_name}, + {"hpb_field_name", resolved_field_name}, + {"const_key", CppConstType(key)}, + {"PtrMut", MessagePtrConstType(val, false)}, + {"upb_msg_name", upb::generator::CApiMessageType(desc->full_name())}, + {"return_type", + upb::generator::CApiMessageType(val->message_type()->full_name())}, + {"proto_class", QualifiedClassName(val->message_type())}, + {"optional_conversion_code", optional_conversion_code}, + {"converted_key_name", converted_key_name}, + {"upb_field_name", upbc_name}}, + R"cc( + absl::StatusOr<$PtrMut$> $class_name$::get_mutable_$hpb_field_name$( + $const_key$ key) { + $return_type$* msg_value; + $optional_conversion_code$bool success = + $upb_msg_name$_$upb_field_name$_get(msg_, $converted_key_name$, + &msg_value); + if (success) { + return ::hpb::interop::upb::MakeHandle<$proto_class$>( + UPB_UPCAST(msg_value), arena_); + } + return absl::NotFoundError(""); + } + )cc"); + ctx.EmitLegacy( R"cc( void $0::delete_$1($2 key) { $6$4_$8_delete(msg_, $7); } )cc", class_name, resolved_field_name, CppConstType(key), - MessagePtrConstType(val, /* is_const */ false), MessageName(message), - MessageName(val->message_type()), optional_conversion_code, - converted_key_name, upbc_name); + MessagePtrConstType(val, /* is_const */ false), + upb::generator::CApiMessageType(desc->full_name()), + upb::generator::CApiMessageType(val->message_type()->full_name()), + optional_conversion_code, converted_key_name, upbc_name); } else if (val->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_STRING) { - output( + ctx.EmitLegacy( R"cc( bool $0::set_$1($2 key, $3 value) { $5return $4_$7_set( @@ -358,9 +440,9 @@ void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, } )cc", class_name, resolved_field_name, CppConstType(key), CppConstType(val), - MessageName(message), optional_conversion_code, converted_key_name, - upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), + optional_conversion_code, converted_key_name, upbc_name); + ctx.EmitLegacy( R"cc( absl::StatusOr<$3> $0::get_$1($2 key) { upb_StringView value; @@ -372,26 +454,26 @@ void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, } )cc", class_name, resolved_field_name, CppConstType(key), CppConstType(val), - MessageName(message), optional_conversion_code, converted_key_name, - upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), + optional_conversion_code, converted_key_name, upbc_name); + ctx.EmitLegacy( R"cc( void $0::delete_$1($2 key) { $5$4_$7_delete(msg_, $6); } )cc", class_name, resolved_field_name, CppConstType(key), CppConstType(val), - MessageName(message), optional_conversion_code, converted_key_name, - upbc_name); + upb::generator::CApiMessageType(desc->full_name()), + optional_conversion_code, converted_key_name, upbc_name); } else { - output( + ctx.EmitLegacy( R"cc( bool $0::set_$1($2 key, $3 value) { $5return $4_$7_set(msg_, $6, value, arena_); } )cc", class_name, resolved_field_name, CppConstType(key), CppConstType(val), - MessageName(message), optional_conversion_code, converted_key_name, - upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), + optional_conversion_code, converted_key_name, upbc_name); + ctx.EmitLegacy( R"cc( absl::StatusOr<$3> $0::get_$1($2 key) { $3 value; @@ -403,24 +485,24 @@ void WriteMapAccessorDefinitions(const protobuf::Descriptor* message, } )cc", class_name, resolved_field_name, CppConstType(key), CppConstType(val), - MessageName(message), optional_conversion_code, converted_key_name, - upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), + optional_conversion_code, converted_key_name, upbc_name); + ctx.EmitLegacy( R"cc( void $0::delete_$1($2 key) { $5$4_$7_delete(msg_, $6); } )cc", class_name, resolved_field_name, CppConstType(key), CppConstType(val), - MessageName(message), optional_conversion_code, converted_key_name, - upbc_name); + upb::generator::CApiMessageType(desc->full_name()), + optional_conversion_code, converted_key_name, upbc_name); } } void WriteUsingAccessorsInHeader(const protobuf::Descriptor* desc, - MessageClassType handle_type, Output& output) { + MessageClassType handle_type, Context& ctx) { bool read_only = handle_type == MessageClassType::kMessageCProxy; // Generate const methods. - OutputIndenter i(output); + auto indent = ctx.printer().WithIndent(); std::string class_name = ClassName(desc); auto field_names = CreateFieldNameMap(desc); @@ -428,90 +510,110 @@ void WriteUsingAccessorsInHeader(const protobuf::Descriptor* desc, std::string resolved_field_name = ResolveFieldName(field, field_names); // Generate hazzer (if any). if (field->has_presence()) { - output("using $0Access::has_$1;\n", class_name, resolved_field_name); + ctx.EmitLegacy("using $0Access::has_$1;\n", class_name, + resolved_field_name); if (!read_only) { - output("using $0Access::clear_$1;\n", class_name, resolved_field_name); + ctx.EmitLegacy("using $0Access::clear_$1;\n", class_name, + resolved_field_name); } } if (field->is_map()) { - output( + ctx.EmitLegacy( R"cc( using $0Access::$1_size; using $0Access::get_$1; )cc", class_name, resolved_field_name); if (!read_only) { - output( + ctx.EmitLegacy( R"cc( using $0Access::clear_$1; using $0Access::delete_$1; using $0Access::set_$1; )cc", class_name, resolved_field_name); + // only emit set_alias and get_mutable for maps when value is a message + if (field->message_type()->FindFieldByNumber(2)->cpp_type() == + protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { + ctx.Emit( + {{"class_name", class_name}, {"field_name", resolved_field_name}}, + R"cc( + using $class_name$Access::get_mutable_$field_name$; + using $class_name$Access::set_alias_$field_name$; + )cc"); + } } } else if (desc->options().map_entry()) { // TODO Implement map entry } else if (field->is_repeated()) { WriteRepeatedFieldUsingAccessors(field, class_name, resolved_field_name, - output, read_only); + ctx, read_only); } else { if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - output("using $0Access::$1;\n", ClassName(desc), resolved_field_name); + ctx.EmitLegacy("using $0Access::$1;\n", ClassName(desc), + resolved_field_name); if (!read_only) { - output("using $0Access::mutable_$1;\n", class_name, - resolved_field_name); + ctx.EmitLegacy("using $0Access::mutable_$1;\n", class_name, + resolved_field_name); + ctx.EmitLegacy("using $0Access::set_alias_$1;\n", class_name, + resolved_field_name); } } else { - output("using $0Access::$1;\n", class_name, resolved_field_name); + ctx.EmitLegacy("using $0Access::$1;\n", class_name, + resolved_field_name); if (!read_only) { - output("using $0Access::set_$1;\n", class_name, resolved_field_name); + ctx.EmitLegacy("using $0Access::set_$1;\n", class_name, + resolved_field_name); } } } } for (int i = 0; i < desc->real_oneof_decl_count(); ++i) { const protobuf::OneofDescriptor* oneof = desc->oneof_decl(i); - output("using $0Access::$1_case;\n", class_name, oneof->name()); - output("using $0Access::$1Case;\n", class_name, - ToCamelCase(oneof->name(), /*lower_first=*/false)); + ctx.EmitLegacy("using $0Access::$1_case;\n", class_name, oneof->name()); + ctx.EmitLegacy("using $0Access::$1Case;\n", class_name, + ToCamelCase(oneof->name(), /*lower_first=*/false)); for (int j = 0; j < oneof->field_count(); ++j) { const protobuf::FieldDescriptor* field = oneof->field(j); - output("using $0Access::k$1;\n", class_name, - ToCamelCase(field->name(), /*lower_first=*/false), - field->number()); + ctx.EmitLegacy("using $0Access::k$1;\n", class_name, + ToCamelCase(field->name(), /*lower_first=*/false), + field->number()); } - output("using $0Access::$1_NOT_SET;\n", class_name, - absl::AsciiStrToUpper(oneof->name())); + ctx.EmitLegacy("using $0Access::$1_NOT_SET;\n", class_name, + absl::AsciiStrToUpper(oneof->name())); } } void WriteOneofAccessorsInHeader(const protobuf::Descriptor* desc, - Output& output) { + Context& ctx) { // Generate const methods. - OutputIndenter i(output); + auto indent = ctx.printer().WithIndent(); std::string class_name = ClassName(desc); auto field_names = CreateFieldNameMap(desc); for (int i = 0; i < desc->real_oneof_decl_count(); ++i) { const protobuf::OneofDescriptor* oneof = desc->oneof_decl(i); - output("enum $0Case {\n", - ToCamelCase(oneof->name(), /*lower_first=*/false)); + ctx.EmitLegacy("enum $0Case {\n", + ToCamelCase(oneof->name(), /*lower_first=*/false)); for (int j = 0; j < oneof->field_count(); ++j) { const protobuf::FieldDescriptor* field = oneof->field(j); - output(" k$0 = $1,\n", ToCamelCase(field->name(), /*lower_first=*/false), - field->number()); + ctx.EmitLegacy(" k$0 = $1,\n", + ToCamelCase(field->name(), /*lower_first=*/false), + field->number()); } - output(" $0_NOT_SET = 0,\n", absl::AsciiStrToUpper(oneof->name())); - output("};\n\n"); - output("$0Case $1_case() const {\n", - ToCamelCase(oneof->name(), /*lower_first=*/false), oneof->name()); + ctx.EmitLegacy(" $0_NOT_SET = 0,\n", absl::AsciiStrToUpper(oneof->name())); + ctx.Emit("};\n\n"); + ctx.EmitLegacy("$0Case $1_case() const {\n", + ToCamelCase(oneof->name(), /*lower_first=*/false), + oneof->name()); for (int j = 0; j < oneof->field_count(); ++j) { const protobuf::FieldDescriptor* field = oneof->field(j); std::string resolved_field_name = ResolveFieldName(field, field_names); - output(" if (has_$0()) { return k$1; }\n", resolved_field_name, - ToCamelCase(field->name(), /*lower_first=*/false)); + ctx.EmitLegacy(" if (has_$0()) { return k$1; }\n", resolved_field_name, + ToCamelCase(field->name(), /*lower_first=*/false)); } - output(" return $0_NOT_SET;\n", absl::AsciiStrToUpper(oneof->name())); - output("}\n;"); + ctx.EmitLegacy(" return $0_NOT_SET;\n", + absl::AsciiStrToUpper(oneof->name())); + ctx.Emit("}\n;"); } } diff --git a/third_party/protobuf/hpb_generator/gen_accessors.h b/third_party/protobuf/hpb_generator/gen_accessors.h index 61729bb8db3a7..7b9e7bda1732b 100644 --- a/third_party/protobuf/hpb_generator/gen_accessors.h +++ b/third_party/protobuf/hpb_generator/gen_accessors.h @@ -8,21 +8,22 @@ #ifndef PROTOBUF_COMPILER_HBP_GEN_ACCESSORS_H_ #define PROTOBUF_COMPILER_HBP_GEN_ACCESSORS_H_ -#include "google/protobuf/descriptor.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/gen_utils.h" -#include "google/protobuf/compiler/hpb/output.h" +#include "google/protobuf/descriptor.h" namespace google::protobuf::hpb_generator { namespace protobuf = ::proto2; void WriteFieldAccessorsInHeader(const protobuf::Descriptor* desc, - Output& output); -void WriteAccessorsInSource(const protobuf::Descriptor* desc, Output& output); + Context& ctx); +void WriteAccessorsInSource(const protobuf::Descriptor* desc, Context& ctx); + void WriteUsingAccessorsInHeader(const protobuf::Descriptor* desc, - MessageClassType handle_type, Output& output); + MessageClassType handle_type, Context& ctx); void WriteOneofAccessorsInHeader(const protobuf::Descriptor* desc, - Output& output); + Context& ctx); } // namespace protobuf } // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/gen_enums.cc b/third_party/protobuf/hpb_generator/gen_enums.cc index 8c3f5c2807605..ffa3f5ff5ccc2 100644 --- a/third_party/protobuf/hpb_generator/gen_enums.cc +++ b/third_party/protobuf/hpb_generator/gen_enums.cc @@ -13,6 +13,7 @@ #include <vector> #include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/gen_utils.h" #include "google/protobuf/compiler/hpb/names.h" #include "google/protobuf/descriptor.h" @@ -20,6 +21,7 @@ namespace google::protobuf::hpb_generator { namespace protobuf = ::proto2; +using Sub = protobuf::io::Printer::Sub; // Convert enum value to C++ literal. // @@ -78,7 +80,7 @@ std::string EnumValueSymbolInNameSpace( } } -void WriteEnumValues(const protobuf::EnumDescriptor* desc, Output& output) { +void WriteEnumValues(const protobuf::EnumDescriptor* desc, Context& ctx) { std::vector<const protobuf::EnumValueDescriptor*> values; auto value_count = desc->value_count(); values.reserve(value_count); @@ -93,28 +95,26 @@ void WriteEnumValues(const protobuf::EnumDescriptor* desc, Output& output) { for (size_t i = 0; i < values.size(); i++) { auto value = values[i]; - output(" $0", EnumValueSymbolInNameSpace(desc, value)); - output(" = $0", EnumInt32ToString(value->number())); - if (i != values.size() - 1) { - output(","); - } - output("\n"); + ctx.Emit({{"name", EnumValueSymbolInNameSpace(desc, value)}, + {"number", EnumInt32ToString(value->number())}, + {"sep", i == values.size() - 1 ? "" : ","}}, + R"cc( + $name$ = $number$$sep$ + )cc"); } } void WriteEnumDeclarations( - const std::vector<const protobuf::EnumDescriptor*>& enums, Output& output) { + const std::vector<const protobuf::EnumDescriptor*>& enums, Context& ctx) { for (auto enumdesc : enums) { - output("enum $0 : int {\n", EnumTypeName(enumdesc)); - WriteEnumValues(enumdesc, output); - output("};\n\n"); - } -} - -void WriteHeaderEnumForwardDecls( - std::vector<const protobuf::EnumDescriptor*>& enums, Output& output) { - for (const auto* enumdesc : enums) { - output("enum $0 : int;\n", EnumTypeName(enumdesc)); + ctx.Emit({{"type", EnumTypeName(enumdesc)}, + Sub("enum_vals", [&] { WriteEnumValues(enumdesc, ctx); }) + .WithSuffix(",")}, + R"cc( + enum $type$ : int { + $enum_vals$, + }; + )cc"); } } diff --git a/third_party/protobuf/hpb_generator/gen_enums.h b/third_party/protobuf/hpb_generator/gen_enums.h index 63455833950fe..c59b613982fce 100644 --- a/third_party/protobuf/hpb_generator/gen_enums.h +++ b/third_party/protobuf/hpb_generator/gen_enums.h @@ -8,8 +8,8 @@ #ifndef PROTOBUF_COMPILER_HBP_GEN_ENUMS_H_ #define PROTOBUF_COMPILER_HBP_GEN_ENUMS_H_ +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/descriptor.h" -#include "google/protobuf/compiler/hpb/output.h" namespace google::protobuf::hpb_generator { @@ -19,10 +19,8 @@ std::string EnumTypeName(const protobuf::EnumDescriptor* enum_descriptor); std::string EnumValueSymbolInNameSpace( const protobuf::EnumDescriptor* desc, const protobuf::EnumValueDescriptor* value); -void WriteHeaderEnumForwardDecls( - std::vector<const protobuf::EnumDescriptor*>& enums, Output& output); void WriteEnumDeclarations( - const std::vector<const protobuf::EnumDescriptor*>& enums, Output& output); + const std::vector<const protobuf::EnumDescriptor*>& enums, Context& ctx); } // namespace protobuf } // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/gen_extensions.cc b/third_party/protobuf/hpb_generator/gen_extensions.cc index de241c95ac4ba..070351b8e26aa 100644 --- a/third_party/protobuf/hpb_generator/gen_extensions.cc +++ b/third_party/protobuf/hpb_generator/gen_extensions.cc @@ -7,9 +7,15 @@ #include "google/protobuf/compiler/hpb/gen_extensions.h" +#include <string> +#include <vector> + #include "absl/strings/str_cat.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/gen_utils.h" #include "google/protobuf/compiler/hpb/names.h" +#include "google/protobuf/descriptor.h" +#include "upb_generator/c/names.h" namespace google::protobuf::hpb_generator { @@ -19,7 +25,7 @@ std::string ExtensionIdentifierBase(const protobuf::FieldDescriptor* ext) { assert(ext->is_extension()); std::string ext_scope; if (ext->extension_scope()) { - return MessageName(ext->extension_scope()); + return upb::generator::CApiMessageType(ext->extension_scope()->full_name()); } else { return ToCIdent(ext->file()->package()); } @@ -32,61 +38,70 @@ std::string ContainingTypeName(const protobuf::FieldDescriptor* ext) { } void WriteExtensionIdentifierHeader(const protobuf::FieldDescriptor* ext, - Output& output) { + Context& ctx) { std::string mini_table_name = absl::StrCat(ExtensionIdentifierBase(ext), "_", ext->name(), "_ext"); - if (ext->extension_scope()) { - output( - R"cc( - static const ::hpb::internal::ExtensionIdentifier<$0, $1> $2; - )cc", - ContainingTypeName(ext), CppTypeParameterName(ext), ext->name()); - } else { - output( - R"cc( - extern const ::hpb::internal::ExtensionIdentifier<$0, $1> $2; - )cc", - ContainingTypeName(ext), CppTypeParameterName(ext), ext->name()); + std::string linkage = ext->extension_scope() ? "static" : "extern"; + std::string ext_type = CppTypeParameterName(ext); + if (ext->is_repeated()) { + ext_type = absl::StrCat("::hpb::RepeatedField<", ext_type, ">"); } + ctx.Emit( + {{"linkage", linkage}, + {"extendee_type", ContainingTypeName(ext)}, + {"extension_type", ext_type}, + {"extension_name", ext->name()}}, + R"cc( + $linkage$ const ::hpb::internal::ExtensionIdentifier<$extendee_type$, + $extension_type$> + $extension_name$; + )cc"); } void WriteExtensionIdentifiersHeader( const std::vector<const protobuf::FieldDescriptor*>& extensions, - Output& output) { + Context& ctx) { for (const auto* ext : extensions) { if (!ext->extension_scope()) { - WriteExtensionIdentifierHeader(ext, output); + WriteExtensionIdentifierHeader(ext, ctx); } } } void WriteExtensionIdentifier(const protobuf::FieldDescriptor* ext, - Output& output) { + Context& ctx) { std::string mini_table_name = absl::StrCat(ExtensionIdentifierBase(ext), "_", ext->name(), "_ext"); - if (ext->extension_scope()) { - output( - R"cc( - const hpb::internal::ExtensionIdentifier<$0, $3> $4::$2(&$1); - )cc", - ContainingTypeName(ext), mini_table_name, ext->name(), - CppTypeParameterName(ext), ClassName(ext->extension_scope())); - } else { - output( - R"cc( - const hpb::internal::ExtensionIdentifier<$0, $3> $2(&$1); - )cc", - ContainingTypeName(ext), mini_table_name, ext->name(), - CppTypeParameterName(ext)); + std::string class_prefix = + ext->extension_scope() ? ClassName(ext->extension_scope()) + "::" : ""; + std::string ext_type = CppTypeParameterName(ext); + if (ext->is_repeated()) { + ext_type = absl::StrCat("::hpb::RepeatedField<", ext_type, ">"); } + ctx.Emit( + {{"containing_type_name", ContainingTypeName(ext)}, + {"mini_table_name", mini_table_name}, + {"ext_name", ext->name()}, + {"default_value", DefaultValue(ext)}, + {"ext_type", ext_type}, + {"class_prefix", class_prefix}}, + R"cc( + constexpr ::hpb::internal::ExtensionIdentifier<$containing_type_name$, + $ext_type$> + $class_prefix$$ext_name$ = + ::hpb::internal::PrivateAccess::InvokeConstructor< + ::hpb::internal::ExtensionIdentifier<$containing_type_name$, + $ext_type$>>( + &$mini_table_name$, $default_value$); + )cc"); } void WriteExtensionIdentifiers( const std::vector<const protobuf::FieldDescriptor*>& extensions, - Output& output) { + Context& ctx) { for (const auto* ext : extensions) { if (!ext->extension_scope()) { - WriteExtensionIdentifier(ext, output); + WriteExtensionIdentifier(ext, ctx); } } } diff --git a/third_party/protobuf/hpb_generator/gen_extensions.h b/third_party/protobuf/hpb_generator/gen_extensions.h index e48f657e8d5ba..5b06a1dace92c 100644 --- a/third_party/protobuf/hpb_generator/gen_extensions.h +++ b/third_party/protobuf/hpb_generator/gen_extensions.h @@ -8,8 +8,8 @@ #ifndef PROTOBUF_COMPILER_HBP_GEN_EXTENSIONS_H_ #define PROTOBUF_COMPILER_HBP_GEN_EXTENSIONS_H_ +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/descriptor.h" -#include "google/protobuf/compiler/hpb/output.h" namespace google::protobuf::hpb_generator { @@ -17,14 +17,14 @@ namespace protobuf = ::proto2; void WriteExtensionIdentifiersHeader( const std::vector<const protobuf::FieldDescriptor*>& extensions, - Output& output); + Context& ctx); void WriteExtensionIdentifierHeader(const protobuf::FieldDescriptor* ext, - Output& output); + Context& ctx); void WriteExtensionIdentifiers( const std::vector<const protobuf::FieldDescriptor*>& extensions, - Output& output); + Context& ctx); void WriteExtensionIdentifier(const protobuf::FieldDescriptor* ext, - Output& output); + Context& ctx); } // namespace protobuf } // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/gen_messages.cc b/third_party/protobuf/hpb_generator/gen_messages.cc index ca6932a80e2f5..e260734a1670a 100644 --- a/third_party/protobuf/hpb_generator/gen_messages.cc +++ b/third_party/protobuf/hpb_generator/gen_messages.cc @@ -15,46 +15,48 @@ #include "absl/strings/ascii.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/gen_accessors.h" #include "google/protobuf/compiler/hpb/gen_enums.h" #include "google/protobuf/compiler/hpb/gen_extensions.h" #include "google/protobuf/compiler/hpb/gen_utils.h" #include "google/protobuf/compiler/hpb/names.h" -#include "google/protobuf/compiler/hpb/output.h" #include "google/protobuf/descriptor.h" +#include "upb_generator/c/names.h" #include "upb_generator/minitable/names.h" namespace google::protobuf::hpb_generator { namespace protobuf = ::proto2; +using Sub = protobuf::io::Printer::Sub; void WriteModelAccessDeclaration(const protobuf::Descriptor* descriptor, - Output& output); + Context& ctx); void WriteModelPublicDeclaration( const protobuf::Descriptor* descriptor, const std::vector<const protobuf::FieldDescriptor*>& file_exts, const std::vector<const protobuf::EnumDescriptor*>& file_enums, - Output& output); + Context& ctx); void WriteExtensionIdentifiersInClassHeader( const protobuf::Descriptor* message, const std::vector<const protobuf::FieldDescriptor*>& file_exts, - Output& output); + Context& ctx); void WriteModelProxyDeclaration(const protobuf::Descriptor* descriptor, - Output& output); + Context& ctx); void WriteModelCProxyDeclaration(const protobuf::Descriptor* descriptor, - Output& output); + Context& ctx); void WriteInternalForwardDeclarationsInHeader( - const protobuf::Descriptor* message, Output& output); + const protobuf::Descriptor* message, Context& ctx); void WriteDefaultInstanceHeader(const protobuf::Descriptor* message, - Output& output); + Context& ctx); void WriteExtensionIdentifiersImplementation( const protobuf::Descriptor* message, const std::vector<const protobuf::FieldDescriptor*>& file_exts, - Output& output); + Context& ctx); void WriteUsingEnumsInHeader( const protobuf::Descriptor* message, const std::vector<const protobuf::EnumDescriptor*>& file_enums, - Output& output); + Context& ctx); // Writes message class declarations into .upb.proto.h. // @@ -64,7 +66,7 @@ void WriteMessageClassDeclarations( const protobuf::Descriptor* descriptor, const std::vector<const protobuf::FieldDescriptor*>& file_exts, const std::vector<const protobuf::EnumDescriptor*>& file_enums, - Output& output) { + Context& ctx) { if (IsMapEntryMessage(descriptor)) { // Skip map entry generation. Low level accessors for maps are // generated that don't require a separate map type. @@ -72,53 +74,77 @@ void WriteMessageClassDeclarations( } // Forward declaration of Proto Class for GCC handling of free friend method. - output("class $0;\n", ClassName(descriptor)); - output("namespace internal {\n\n"); - WriteModelAccessDeclaration(descriptor, output); - output("\n"); - WriteInternalForwardDeclarationsInHeader(descriptor, output); - output("\n"); - output("} // namespace internal\n\n"); - WriteModelPublicDeclaration(descriptor, file_exts, file_enums, output); - output("namespace internal {\n"); - WriteModelCProxyDeclaration(descriptor, output); - WriteModelProxyDeclaration(descriptor, output); - output("} // namespace internal\n\n"); + ctx.Emit( + {Sub("class_name", ClassName(descriptor)), + Sub("model_access", + [&] { WriteModelAccessDeclaration(descriptor, ctx); }) + .WithSuffix(";"), + Sub("fwd_decl", + [&] { WriteInternalForwardDeclarationsInHeader(descriptor, ctx); }) + .WithSuffix(";"), + Sub("public_decl", + [&] { + WriteModelPublicDeclaration(descriptor, file_exts, file_enums, + ctx); + }) + .WithSuffix(";"), + Sub("cproxy_decl", [&] { WriteModelCProxyDeclaration(descriptor, ctx); }) + .WithSuffix(";"), + Sub("proxy_decl", [&] { WriteModelProxyDeclaration(descriptor, ctx); }) + .WithSuffix(";")}, + R"cc( + class $class_name$; + namespace internal { + $model_access$; + + $fwd_decl$; + } // namespace internal + + $public_decl$; + namespace internal { + $cproxy_decl$; + $proxy_decl$; + } // namespace internal + )cc"); } void WriteModelAccessDeclaration(const protobuf::Descriptor* descriptor, - Output& output) { - output( - R"cc( - class $0Access { - public: - $0Access() {} - $0Access($1* msg, upb_Arena* arena) : msg_(msg), arena_(arena) { - assert(arena != nullptr); - } // NOLINT - $0Access(const $1* msg, upb_Arena* arena) - : msg_(const_cast<$1*>(msg)), arena_(arena) { - assert(arena != nullptr); - } // NOLINT - )cc", - ClassName(descriptor), MessageName(descriptor)); - WriteFieldAccessorsInHeader(descriptor, output); - WriteOneofAccessorsInHeader(descriptor, output); - output.Indent(); - output( - R"cc( - private: - friend class $2; - friend class $0Proxy; - friend class $0CProxy; - friend struct ::hpb::internal::PrivateAccess; - $1* msg_; - upb_Arena* arena_; - )cc", - ClassName(descriptor), MessageName(descriptor), - QualifiedClassName(descriptor)); - output.Outdent(); - output("};\n"); + Context& ctx) { + ctx.Emit({Sub("class_name", ClassName(descriptor)), + Sub("qualified_class_name", QualifiedClassName(descriptor)), + Sub("upb_msg_name", + upb::generator::CApiMessageType(descriptor->full_name())), + Sub("field_accessors", + [&] { WriteFieldAccessorsInHeader(descriptor, ctx); }) + .WithSuffix(";"), + Sub("oneof_accessors", + [&] { WriteOneofAccessorsInHeader(descriptor, ctx); }) + .WithSuffix(";")}, + R"cc( + class $class_name$Access { + public: + $class_name$Access() {} + $class_name$Access($upb_msg_name$* msg, upb_Arena* arena) + : msg_(msg), arena_(arena) { + assert(arena != nullptr); + } // NOLINT + $class_name$Access(const $upb_msg_name$* msg, upb_Arena* arena) + : msg_(const_cast<$upb_msg_name$*>(msg)), arena_(arena) { + assert(arena != nullptr); + } // NOLINT + + $field_accessors$; + $oneof_accessors$; + + private: + friend class $qualified_class_name$; + friend class $class_name$Proxy; + friend class $class_name$CProxy; + friend struct ::hpb::internal::PrivateAccess; + $upb_msg_name$* msg_; + upb_Arena* arena_; + }; + )cc"); } std::string UnderscoresToCamelCase(absl::string_view input, @@ -161,21 +187,21 @@ std::string FieldConstantName(const protobuf::FieldDescriptor* field) { return result; } -void WriteConstFieldNumbers(Output& output, +void WriteConstFieldNumbers(Context& ctx, const protobuf::Descriptor* descriptor) { for (auto field : FieldRange(descriptor)) { - output("static constexpr ::uint32_t $0 = $1;\n", FieldConstantName(field), - field->number()); + ctx.EmitLegacy("static constexpr ::uint32_t $0 = $1;\n", + FieldConstantName(field), field->number()); } - output("\n\n"); + ctx.Emit("\n\n"); } void WriteModelPublicDeclaration( const protobuf::Descriptor* descriptor, const std::vector<const protobuf::FieldDescriptor*>& file_exts, const std::vector<const protobuf::EnumDescriptor*>& file_enums, - Output& output) { - output( + Context& ctx) { + ctx.EmitLegacy( R"cc( class $0 final : private internal::$0Access { public: @@ -205,30 +231,30 @@ void WriteModelPublicDeclaration( )cc", ClassName(descriptor), ::upb::generator::MiniTableMessageVarName(descriptor->full_name()), - MessageName(descriptor), QualifiedClassName(descriptor)); + upb::generator::CApiMessageType(descriptor->full_name()), + QualifiedClassName(descriptor)); - WriteUsingAccessorsInHeader(descriptor, MessageClassType::kMessage, output); - WriteUsingEnumsInHeader(descriptor, file_enums, output); - WriteDefaultInstanceHeader(descriptor, output); - WriteExtensionIdentifiersInClassHeader(descriptor, file_exts, output); + WriteUsingAccessorsInHeader(descriptor, MessageClassType::kMessage, ctx); + WriteUsingEnumsInHeader(descriptor, file_enums, ctx); + WriteDefaultInstanceHeader(descriptor, ctx); + WriteExtensionIdentifiersInClassHeader(descriptor, file_exts, ctx); if (descriptor->extension_range_count()) { // for typetrait checking - output("using ExtendableType = $0;\n", ClassName(descriptor)); + ctx.EmitLegacy("using ExtendableType = $0;\n", ClassName(descriptor)); } // Note: free function friends that are templates such as ::hpb::Parse // require explicit <$2> type parameter in declaration to be able to compile // with gcc otherwise the compiler will fail with // "has not been declared within namespace" error. Even though there is a // namespace qualifier, cross namespace matching fails. - output.Indent(); - output( + ctx.EmitLegacy( R"cc( static const upb_MiniTable* minitable(); )cc", ClassName(descriptor)); - output("\n"); - WriteConstFieldNumbers(output, descriptor); - output( + ctx.Emit("\n"); + WriteConstFieldNumbers(ctx, descriptor); + ctx.EmitLegacy( R"cc( private: const upb_Message* msg() const { return UPB_UPCAST(msg_); } @@ -245,26 +271,24 @@ void WriteModelPublicDeclaration( friend struct ::hpb::internal::PrivateAccess; friend Proxy; friend CProxy; - friend absl::StatusOr<$2>(::hpb::Parse<$2>(absl::string_view bytes, - int options)); friend absl::StatusOr<$2>(::hpb::Parse<$2>( absl::string_view bytes, - const ::hpb::ExtensionRegistry& extension_registry, int options)); + const ::hpb::ExtensionRegistry& extension_registry)); friend upb_Arena* hpb::interop::upb::GetArena<$0>($0* message); friend upb_Arena* hpb::interop::upb::GetArena<$0>(::hpb::Ptr<$0> message); friend $0(hpb::interop::upb::MoveMessage<$0>(upb_Message* msg, upb_Arena* arena)); )cc", - ClassName(descriptor), MessageName(descriptor), + ClassName(descriptor), + upb::generator::CApiMessageType(descriptor->full_name()), QualifiedClassName(descriptor)); - output.Outdent(); - output("};\n\n"); + ctx.Emit("};\n\n"); } void WriteModelProxyDeclaration(const protobuf::Descriptor* descriptor, - Output& output) { + Context& ctx) { // Foo::Proxy. - output( + ctx.EmitLegacy( R"cc( class $0Proxy final : private internal::$0Access { public: @@ -285,11 +309,9 @@ void WriteModelProxyDeclaration(const protobuf::Descriptor* descriptor, )cc", ClassName(descriptor)); - WriteUsingAccessorsInHeader(descriptor, MessageClassType::kMessageProxy, - output); - output("\n"); - output.Indent(1); - output( + WriteUsingAccessorsInHeader(descriptor, MessageClassType::kMessageProxy, ctx); + ctx.Emit("\n"); + ctx.EmitLegacy( R"cc( private: upb_Message* msg() const { return UPB_UPCAST(msg_); } @@ -318,16 +340,16 @@ void WriteModelProxyDeclaration(const protobuf::Descriptor* descriptor, lhs.arena_ = rhs.arena_; } )cc", - ClassName(descriptor), MessageName(descriptor), + ClassName(descriptor), + upb::generator::CApiMessageType(descriptor->full_name()), QualifiedClassName(descriptor)); - output.Outdent(1); - output("};\n\n"); + ctx.Emit("};\n\n"); } void WriteModelCProxyDeclaration(const protobuf::Descriptor* descriptor, - Output& output) { + Context& ctx) { // Foo::CProxy. - output( + ctx.EmitLegacy( R"cc( class $0CProxy final : private internal::$0Access { public: @@ -336,13 +358,13 @@ void WriteModelCProxyDeclaration(const protobuf::Descriptor* descriptor, : internal::$0Access(m->msg_, hpb::interop::upb::GetArena(m)) {} $0CProxy($0Proxy m); )cc", - ClassName(descriptor), MessageName(descriptor)); + ClassName(descriptor), + upb::generator::CApiMessageType(descriptor->full_name())); WriteUsingAccessorsInHeader(descriptor, MessageClassType::kMessageCProxy, - output); + ctx); - output.Indent(1); - output( + ctx.EmitLegacy( R"cc( private: using AsNonConst = $0Proxy; @@ -366,25 +388,25 @@ void WriteModelCProxyDeclaration(const protobuf::Descriptor* descriptor, lhs.arena_ = rhs.arena_; } )cc", - ClassName(descriptor), MessageName(descriptor)); - output.Outdent(1); - output("};\n\n"); + ClassName(descriptor), + upb::generator::CApiMessageType(descriptor->full_name())); + ctx.Emit("};\n\n"); } void WriteDefaultInstanceHeader(const protobuf::Descriptor* message, - Output& output) { - output(" static ::hpb::Ptr<const $0> default_instance();\n", - ClassName(message)); + Context& ctx) { + ctx.EmitLegacy(" static ::hpb::Ptr<const $0> default_instance();\n", + ClassName(message)); } void WriteMessageImplementation( const protobuf::Descriptor* descriptor, const std::vector<const protobuf::FieldDescriptor*>& file_exts, - Output& output) { + Context& ctx) { bool message_is_map_entry = descriptor->options().map_entry(); if (!message_is_map_entry) { // Constructor. - output( + ctx.EmitLegacy( R"cc( $0::$0() : $0Access() { arena_ = owned_arena_.ptr(); @@ -416,24 +438,25 @@ void WriteMessageImplementation( return *this; } )cc", - ClassName(descriptor), MessageName(descriptor), + ClassName(descriptor), + upb::generator::CApiMessageType(descriptor->full_name()), ::upb::generator::MiniTableMessageVarName(descriptor->full_name()), QualifiedClassName(descriptor)); - output("\n"); + ctx.Emit("\n"); // Minitable - output( + ctx.EmitLegacy( R"cc( const upb_MiniTable* $0::minitable() { return &$1; } )cc", ClassName(descriptor), ::upb::generator::MiniTableMessageVarName(descriptor->full_name())); - output("\n"); + ctx.Emit("\n"); } - WriteAccessorsInSource(descriptor, output); + WriteAccessorsInSource(descriptor, ctx); if (!message_is_map_entry) { - output( + ctx.EmitLegacy( R"cc( struct $0DefaultTypeInternal { $1* msg; @@ -445,9 +468,10 @@ void WriteMessageImplementation( } $0DefaultTypeInternal _$0_default_instance_ = _$0DefaultTypeBuilder(); )cc", - ClassName(descriptor), MessageName(descriptor)); + ClassName(descriptor), + upb::generator::CApiMessageType(descriptor->full_name())); - output( + ctx.EmitLegacy( R"cc( ::hpb::Ptr<const $0> $0::default_instance() { return ::hpb::interop::upb::MakeCHandle<$0>( @@ -457,15 +481,15 @@ void WriteMessageImplementation( )cc", ClassName(descriptor)); - WriteExtensionIdentifiersImplementation(descriptor, file_exts, output); + WriteExtensionIdentifiersImplementation(descriptor, file_exts, ctx); } } void WriteInternalForwardDeclarationsInHeader( - const protobuf::Descriptor* message, Output& output) { + const protobuf::Descriptor* message, Context& ctx) { // Write declaration for internal re-usable default_instance without // leaking implementation. - output( + ctx.EmitLegacy( R"cc( struct $0DefaultTypeInternal; extern $0DefaultTypeInternal _$0_default_instance_; @@ -476,11 +500,11 @@ void WriteInternalForwardDeclarationsInHeader( void WriteExtensionIdentifiersInClassHeader( const protobuf::Descriptor* message, const std::vector<const protobuf::FieldDescriptor*>& file_exts, - Output& output) { + Context& ctx) { for (auto* ext : file_exts) { if (ext->extension_scope() && ext->extension_scope()->full_name() == message->full_name()) { - WriteExtensionIdentifierHeader(ext, output); + WriteExtensionIdentifierHeader(ext, ctx); } } } @@ -488,11 +512,11 @@ void WriteExtensionIdentifiersInClassHeader( void WriteExtensionIdentifiersImplementation( const protobuf::Descriptor* message, const std::vector<const protobuf::FieldDescriptor*>& file_exts, - Output& output) { + Context& ctx) { for (auto* ext : file_exts) { if (ext->extension_scope() && ext->extension_scope()->full_name() == message->full_name()) { - WriteExtensionIdentifier(ext, output); + WriteExtensionIdentifier(ext, ctx); } } } @@ -500,7 +524,7 @@ void WriteExtensionIdentifiersImplementation( void WriteUsingEnumsInHeader( const protobuf::Descriptor* message, const std::vector<const protobuf::EnumDescriptor*>& file_enums, - Output& output) { + Context& ctx) { for (auto* enum_descriptor : file_enums) { std::string enum_type_name = EnumTypeName(enum_descriptor); std::string enum_resolved_type_name = @@ -514,23 +538,25 @@ void WriteUsingEnumsInHeader( message->full_name()) { continue; } - output("using $0", enum_descriptor->name()); + ctx.EmitLegacy("using $0", enum_descriptor->name()); if (enum_descriptor->options().deprecated()) { - output(" ABSL_DEPRECATED(\"Proto enum $0\")", enum_descriptor->name()); + ctx.EmitLegacy(" ABSL_DEPRECATED(\"Proto enum $0\")", + enum_descriptor->name()); } - output(" = $0;", enum_resolved_type_name); - output("\n"); + ctx.EmitLegacy(" = $0;", enum_resolved_type_name); + ctx.Emit("\n"); int value_count = enum_descriptor->value_count(); for (int i = 0; i < value_count; i++) { - output("static constexpr $0 $1", enum_descriptor->name(), - enum_descriptor->value(i)->name()); + ctx.EmitLegacy("static constexpr $0 $1", enum_descriptor->name(), + enum_descriptor->value(i)->name()); if (enum_descriptor->options().deprecated() || enum_descriptor->value(i)->options().deprecated()) { - output(" ABSL_DEPRECATED(\"Proto enum value $0\") ", - enum_descriptor->value(i)->name()); + ctx.EmitLegacy(" ABSL_DEPRECATED(\"Proto enum value $0\") ", + enum_descriptor->value(i)->name()); } - output(" = $0;\n", EnumValueSymbolInNameSpace(enum_descriptor, - enum_descriptor->value(i))); + ctx.EmitLegacy(" = $0;\n", + EnumValueSymbolInNameSpace(enum_descriptor, + enum_descriptor->value(i))); } } } diff --git a/third_party/protobuf/hpb_generator/gen_messages.h b/third_party/protobuf/hpb_generator/gen_messages.h index 4552a4995040c..c1096e1029849 100644 --- a/third_party/protobuf/hpb_generator/gen_messages.h +++ b/third_party/protobuf/hpb_generator/gen_messages.h @@ -8,8 +8,8 @@ #ifndef PROTOBUF_COMPILER_HBP_GEN_MESSAGES_H_ #define PROTOBUF_COMPILER_HBP_GEN_MESSAGES_H_ +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/descriptor.h" -#include "google/protobuf/compiler/hpb/output.h" namespace google::protobuf::hpb_generator { namespace protobuf = ::proto2; @@ -18,11 +18,11 @@ void WriteMessageClassDeclarations( const protobuf::Descriptor* descriptor, const std::vector<const protobuf::FieldDescriptor*>& file_exts, const std::vector<const protobuf::EnumDescriptor*>& file_enums, - Output& output); + Context& ctx); void WriteMessageImplementation( const protobuf::Descriptor* descriptor, const std::vector<const protobuf::FieldDescriptor*>& file_exts, - Output& output); + Context& ctx); } // namespace protobuf } // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/gen_repeated_fields.cc b/third_party/protobuf/hpb_generator/gen_repeated_fields.cc index bf67fe7838f61..bbc6fa4537860 100644 --- a/third_party/protobuf/hpb_generator/gen_repeated_fields.cc +++ b/third_party/protobuf/hpb_generator/gen_repeated_fields.cc @@ -12,12 +12,12 @@ #include "google/protobuf/descriptor.pb.h" #include "absl/strings/string_view.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/gen_accessors.h" #include "google/protobuf/compiler/hpb/gen_enums.h" #include "google/protobuf/compiler/hpb/gen_extensions.h" #include "google/protobuf/compiler/hpb/gen_utils.h" #include "google/protobuf/compiler/hpb/names.h" -#include "google/protobuf/compiler/hpb/output.h" #include "google/protobuf/descriptor.h" #include "upb_generator/c/names.h" #include "upb_generator/common.h" @@ -31,31 +31,32 @@ namespace protobuf = ::proto2; void WriteRepeatedFieldUsingAccessors(const protobuf::FieldDescriptor* field, absl::string_view class_name, absl::string_view resolved_field_name, - Output& output, bool read_only) { + Context& ctx, bool read_only) { if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - output( + ctx.EmitLegacy( R"cc( using $0Access::$1; using $0Access::$1_size; )cc", class_name, resolved_field_name); if (!read_only) { - output( + ctx.EmitLegacy( R"cc( using $0Access::add_$1; + using $0Access::add_alias_$1; using $0Access::mutable_$1; )cc", class_name, resolved_field_name); } } else { - output( + ctx.EmitLegacy( R"cc( using $0Access::$1; using $0Access::$1_size; )cc", class_name, resolved_field_name); if (!read_only) { - output( + ctx.EmitLegacy( R"cc( using $0Access::add_$1; using $0Access::mutable_$1; @@ -71,8 +72,8 @@ void WriteRepeatedFieldsInMessageHeader(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, absl::string_view resolved_upbc_name, - Output& output) { - output( + Context& ctx) { + ctx.EmitLegacy( R"cc( inline size_t $1_size() const { size_t len; @@ -80,15 +81,22 @@ void WriteRepeatedFieldsInMessageHeader(const protobuf::Descriptor* desc, return len; } )cc", - MessageName(desc), resolved_field_name, resolved_upbc_name); + upb::generator::CApiMessageType(desc->full_name()), resolved_field_name, + resolved_upbc_name); if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - output( + ctx.EmitLegacy( R"cc( $1 $2(size_t index) const; const ::hpb::RepeatedField<const $4>::CProxy $2() const; ::hpb::Ptr<::hpb::RepeatedField<$4>> mutable_$2(); absl::StatusOr<$0> add_$2(); + /** + * Re-points submsg of repeated field to given target. + * + * REQUIRES: both messages must be in the same arena. + */ + bool add_alias_$2($0 target); $0 mutable_$2(size_t index) const; )cc", MessagePtrConstType(field, /* const */ false), // $0 @@ -98,7 +106,7 @@ void WriteRepeatedFieldsInMessageHeader(const protobuf::Descriptor* desc, MessageBaseType(field, /* maybe_const */ false) // $4 ); } else if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_STRING) { - output( + ctx.EmitLegacy( R"cc( $0 $1(size_t index) const; const ::hpb::RepeatedField<$0>::CProxy $1() const; @@ -109,7 +117,7 @@ void WriteRepeatedFieldsInMessageHeader(const protobuf::Descriptor* desc, )cc", CppConstType(field), resolved_field_name); } else { - output( + ctx.EmitLegacy( R"cc( $0 $1(size_t index) const; const ::hpb::RepeatedField<$0>::CProxy $1() const; @@ -122,14 +130,14 @@ void WriteRepeatedFieldsInMessageHeader(const protobuf::Descriptor* desc, } } -void WriteRepeatedMessageAccessor(const protobuf::Descriptor* message, +void WriteRepeatedMessageAccessor(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, const absl::string_view resolved_field_name, const absl::string_view class_name, - Output& output) { + Context& ctx) { const char arena_expression[] = "arena_"; absl::string_view upbc_name = field->name(); - output( + ctx.EmitLegacy( R"cc( $1 $0::$2(size_t index) const { size_t len; @@ -140,23 +148,36 @@ void WriteRepeatedMessageAccessor(const protobuf::Descriptor* message, } )cc", class_name, MessagePtrConstType(field, /* is_const */ true), - resolved_field_name, MessageName(message), + resolved_field_name, upb::generator::CApiMessageType(desc->full_name()), MessageBaseType(field, /* maybe_const */ false), upbc_name); - output( + ctx.EmitLegacy( R"cc( absl::StatusOr<$1> $0::add_$2() { auto new_msg = $3_add_$6(msg_, $5); if (!new_msg) { return ::hpb::MessageAllocationError(); } - return hpb::interop::upb::MakeHandle<$4>((upb_Message*)new_msg, $5); + return hpb::interop::upb::MakeHandle<$4>((upb_Message *)new_msg, $5); + } + + bool $0::add_alias_$2($1 target) { + ABSL_CHECK(upb_Arena_IsFused(arena_, hpb::interop::upb::GetArena(target))); + size_t size = 0; + $3_$2(msg_, &size); + auto elements = $3_resize_$2(msg_, size + 1, arena_); + if (!elements) { + return false; + } + elements[size] = ($9 *)hpb::interop::upb::GetMessage(target); + return true; } )cc", class_name, MessagePtrConstType(field, /* const */ false), - resolved_field_name, MessageName(message), + resolved_field_name, upb::generator::CApiMessageType(desc->full_name()), MessageBaseType(field, /* maybe_const */ false), arena_expression, - upbc_name); - output( + upbc_name, ClassName(desc), field->index(), + upb::generator::CApiMessageType(field->message_type()->full_name())); + ctx.EmitLegacy( R"cc( $1 $0::mutable_$2(size_t index) const { size_t len; @@ -166,10 +187,10 @@ void WriteRepeatedMessageAccessor(const protobuf::Descriptor* message, } )cc", class_name, MessagePtrConstType(field, /* is_const */ false), - resolved_field_name, MessageName(message), + resolved_field_name, upb::generator::CApiMessageType(desc->full_name()), MessageBaseType(field, /* maybe_const */ false), arena_expression, upbc_name); - output( + ctx.EmitLegacy( R"cc( const ::hpb::RepeatedField<const $1>::CProxy $0::$2() const { size_t size; @@ -185,20 +206,20 @@ void WriteRepeatedMessageAccessor(const protobuf::Descriptor* message, class_name, // $0 MessageBaseType(field, /* maybe_const */ false), // $1 resolved_field_name, // $2 - MessageName(message), // $3 + upb::generator::CApiMessageType(desc->full_name()), // $3 upbc_name, // $4 upb::generator::kRepeatedFieldArrayGetterPostfix, // $5 upb::generator::kRepeatedFieldMutableArrayGetterPostfix // $6 ); } -void WriteRepeatedStringAccessor(const protobuf::Descriptor* message, +void WriteRepeatedStringAccessor(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, const absl::string_view resolved_field_name, const absl::string_view class_name, - Output& output) { + Context& ctx) { absl::string_view upbc_name = field->name(); - output( + ctx.EmitLegacy( R"cc( $1 $0::$2(size_t index) const { size_t len; @@ -208,15 +229,16 @@ void WriteRepeatedStringAccessor(const protobuf::Descriptor* message, } )cc", class_name, CppConstType(field), resolved_field_name, - MessageName(message), upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( bool $0::resize_$1(size_t len) { return $2_resize_$3(msg_, len, arena_); } )cc", - class_name, resolved_field_name, MessageName(message), upbc_name); - output( + class_name, resolved_field_name, + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( bool $0::add_$2($1 val) { return $3_add_$4(msg_, @@ -225,8 +247,8 @@ void WriteRepeatedStringAccessor(const protobuf::Descriptor* message, } )cc", class_name, CppConstType(field), resolved_field_name, - MessageName(message), upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( void $0::set_$2(size_t index, $1 val) { size_t len; @@ -236,8 +258,8 @@ void WriteRepeatedStringAccessor(const protobuf::Descriptor* message, } )cc", class_name, CppConstType(field), resolved_field_name, - MessageName(message), upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( const ::hpb::RepeatedField<$1>::CProxy $0::$2() const { size_t size; @@ -253,20 +275,20 @@ void WriteRepeatedStringAccessor(const protobuf::Descriptor* message, class_name, // $0 CppConstType(field), // $1 resolved_field_name, // $2 - MessageName(message), // $3 + upb::generator::CApiMessageType(desc->full_name()), // $3 upbc_name, // $4 upb::generator::kRepeatedFieldArrayGetterPostfix, // $5 upb::generator::kRepeatedFieldMutableArrayGetterPostfix // $6 ); } -void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message, +void WriteRepeatedScalarAccessor(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, const absl::string_view resolved_field_name, const absl::string_view class_name, - Output& output) { + Context& ctx) { absl::string_view upbc_name = field->name(); - output( + ctx.EmitLegacy( R"cc( $1 $0::$2(size_t index) const { size_t len; @@ -276,21 +298,22 @@ void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message, } )cc", class_name, CppConstType(field), resolved_field_name, - MessageName(message), upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( bool $0::resize_$1(size_t len) { return $2_resize_$3(msg_, len, arena_); } )cc", - class_name, resolved_field_name, MessageName(message), upbc_name); - output( + class_name, resolved_field_name, + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( bool $0::add_$2($1 val) { return $3_add_$4(msg_, val, arena_); } )cc", class_name, CppConstType(field), resolved_field_name, - MessageName(message), upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( void $0::set_$2(size_t index, $1 val) { size_t len; @@ -300,8 +323,8 @@ void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message, } )cc", class_name, CppConstType(field), resolved_field_name, - MessageName(message), upbc_name); - output( + upb::generator::CApiMessageType(desc->full_name()), upbc_name); + ctx.EmitLegacy( R"cc( const ::hpb::RepeatedField<$1>::CProxy $0::$2() const { size_t size; @@ -317,7 +340,7 @@ void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message, class_name, // $0 CppConstType(field), // $1 resolved_field_name, // $2 - MessageName(message), // $3 + upb::generator::CApiMessageType(desc->full_name()), // $3 upbc_name, // $4 upb::generator::kRepeatedFieldArrayGetterPostfix, // $5 upb::generator::kRepeatedFieldMutableArrayGetterPostfix // $6 diff --git a/third_party/protobuf/hpb_generator/gen_repeated_fields.h b/third_party/protobuf/hpb_generator/gen_repeated_fields.h index a041dd0aa8a88..1537b4e8a897b 100644 --- a/third_party/protobuf/hpb_generator/gen_repeated_fields.h +++ b/third_party/protobuf/hpb_generator/gen_repeated_fields.h @@ -9,8 +9,8 @@ #define PROTOBUF_COMPILER_HBP_GEN_REPEATED_FIELDS_H_ #include "absl/strings/string_view.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/descriptor.h" -#include "google/protobuf/compiler/hpb/output.h" namespace google::protobuf::hpb_generator { @@ -19,28 +19,28 @@ namespace protobuf = ::proto2; void WriteRepeatedFieldUsingAccessors(const protobuf::FieldDescriptor* field, absl::string_view class_name, absl::string_view resolved_field_name, - Output& output, bool read_only); + Context& ctx, bool read_only); void WriteRepeatedFieldsInMessageHeader(const protobuf::Descriptor* desc, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, absl::string_view resolved_upbc_name, - Output& output); + Context& ctx); void WriteRepeatedMessageAccessor(const protobuf::Descriptor* message, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, - absl::string_view class_name, Output& output); + absl::string_view class_name, Context& ctx); void WriteRepeatedStringAccessor(const protobuf::Descriptor* message, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, - absl::string_view class_name, Output& output); + absl::string_view class_name, Context& ctx); void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message, const protobuf::FieldDescriptor* field, absl::string_view resolved_field_name, - absl::string_view class_name, Output& output); + absl::string_view class_name, Context& ctx); } // namespace protobuf } // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/gen_utils.cc b/third_party/protobuf/hpb_generator/gen_utils.cc index f89afc99e29af..46341638eba35 100644 --- a/third_party/protobuf/hpb_generator/gen_utils.cc +++ b/third_party/protobuf/hpb_generator/gen_utils.cc @@ -11,8 +11,11 @@ #include <string> #include <vector> +#include "absl/log/absl_log.h" #include "absl/strings/ascii.h" +#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "google/protobuf/descriptor.h" namespace google::protobuf::hpb_generator { @@ -127,5 +130,35 @@ std::string ToCamelCase(const absl::string_view input, bool lower_first) { return result; } +std::string DefaultValue(const FieldDescriptor* field) { + if (field->is_repeated()) { + return "::std::false_type()"; + } + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32: + return absl::StrCat(field->default_value_int32()); + case FieldDescriptor::CPPTYPE_INT64: + return absl::StrCat(field->default_value_int64()); + case FieldDescriptor::CPPTYPE_UINT32: + return absl::StrCat(field->default_value_uint32()); + case FieldDescriptor::CPPTYPE_UINT64: + return absl::StrCat(field->default_value_uint64()); + case FieldDescriptor::CPPTYPE_FLOAT: + return absl::StrCat(field->default_value_float()); + case FieldDescriptor::CPPTYPE_DOUBLE: + return absl::StrCat(field->default_value_double()); + case FieldDescriptor::CPPTYPE_BOOL: + return field->default_value_bool() ? "true" : "false"; + case FieldDescriptor::CPPTYPE_MESSAGE: + return "::std::false_type()"; + default: + // TODO: b/375460289 - implement rest of scalars + ABSL_LOG(WARNING) << "Unsupported default value type (in-progress): <" + << field->cpp_type_name() + << "> For field: " << field->full_name(); + return "::std::false_type()"; + } +} + } // namespace protobuf } // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/gen_utils.h b/third_party/protobuf/hpb_generator/gen_utils.h index a83500c7198f0..154824776eefa 100644 --- a/third_party/protobuf/hpb_generator/gen_utils.h +++ b/third_party/protobuf/hpb_generator/gen_utils.h @@ -41,6 +41,8 @@ std::vector<const protobuf::FieldDescriptor*> FieldNumberOrder( std::string ToCamelCase(absl::string_view input, bool lower_first); +std::string DefaultValue(const FieldDescriptor* field); + } // namespace protobuf } // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/names.cc b/third_party/protobuf/hpb_generator/names.cc index 166f4af7c2960..617062ace0dce 100644 --- a/third_party/protobuf/hpb_generator/names.cc +++ b/third_party/protobuf/hpb_generator/names.cc @@ -11,6 +11,7 @@ #include "absl/strings/string_view.h" #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/keywords.h" namespace google::protobuf::hpb_generator { @@ -18,12 +19,6 @@ namespace protobuf = ::proto2; namespace { -// TODO: b/346865271 append ::hpb instead of ::protos after namespace swap -std::string NamespaceFromPackageName(absl::string_view package_name) { - return absl::StrCat(absl::StrReplaceAll(package_name, {{".", "::"}}), - "::protos"); -} - std::string DotsToColons(const absl::string_view name) { return absl::StrReplaceAll(name, {{".", "::"}}); } @@ -120,22 +115,6 @@ std::string CppHeaderFilename(const google::protobuf::FileDescriptor* file) { return compiler::StripProto(file->name()) + ".upb.proto.h"; } -void WriteStartNamespace(const protobuf::FileDescriptor* file, Output& output) { - // Skip namespace generation if package name is not specified. - if (file->package().empty()) { - return; - } - - output("namespace $0 {\n\n", NamespaceFromPackageName(file->package())); -} - -void WriteEndNamespace(const protobuf::FileDescriptor* file, Output& output) { - if (file->package().empty()) { - return; - } - output("} // namespace $0\n\n", NamespaceFromPackageName(file->package())); -} - std::string CppConstType(const protobuf::FieldDescriptor* field) { return CppTypeInternal(field, /* is_const= */ true, /* is_type_parameter= */ false); diff --git a/third_party/protobuf/hpb_generator/names.h b/third_party/protobuf/hpb_generator/names.h index 32d9b3de5a999..7ba55c3cc814e 100644 --- a/third_party/protobuf/hpb_generator/names.h +++ b/third_party/protobuf/hpb_generator/names.h @@ -11,7 +11,7 @@ #include <string> #include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/compiler/hpb/output.h" +#include "google/protobuf/compiler/hpb/context.h" namespace google::protobuf::hpb_generator { @@ -28,8 +28,8 @@ std::string ForwardingHeaderFilename(const google::protobuf::FileDescriptor* fil std::string UpbCFilename(const google::protobuf::FileDescriptor* file); std::string CppHeaderFilename(const google::protobuf::FileDescriptor* file); -void WriteStartNamespace(const protobuf::FileDescriptor* file, Output& output); -void WriteEndNamespace(const protobuf::FileDescriptor* file, Output& output); +void WriteStartNamespace(const protobuf::FileDescriptor* file, Context& ctx); +void WriteEndNamespace(const protobuf::FileDescriptor* file, Context& ctx); std::string CppConstType(const protobuf::FieldDescriptor* field); std::string CppTypeParameterName(const protobuf::FieldDescriptor* field); diff --git a/third_party/protobuf/hpb_generator/output.cc b/third_party/protobuf/hpb_generator/output.cc deleted file mode 100644 index ca7f59f74d602..0000000000000 --- a/third_party/protobuf/hpb_generator/output.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2023 Google LLC. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#include "google/protobuf/compiler/hpb/output.h" - -#include <string> - -#include "upb_generator/c/names.h" -#include "upb_generator/minitable/names.h" - -namespace google::protobuf::hpb_generator { -namespace { - -namespace protobuf = ::proto2; - -} // namespace - -std::string ToCIdent(absl::string_view str) { - return absl::StrReplaceAll(str, {{".", "_"}, {"/", "_"}, {"-", "_"}}); -} - -std::string ToPreproc(absl::string_view str) { - return absl::AsciiStrToUpper(ToCIdent(str)); -} - -void EmitFileWarning(const protobuf::FileDescriptor* file, Output& output) { - output( - R"cc( - /* This file was generated by hpb_generator (Handle Protobuf) " - from the input - * file: - * - * $0 - * - * Do not edit -- your changes will be discarded when the file is - * regenerated. */ - )cc", - file->name()); - output("\n"); -} - -std::string MessageName(const protobuf::Descriptor* descriptor) { - return upb::generator::CApiMessageType(descriptor->full_name()); -} - -std::string FileLayoutName(const google::protobuf::FileDescriptor* file) { - return upb::generator::MiniTableFileVarName(file->name()); -} - -std::string CHeaderFilename(const google::protobuf::FileDescriptor* file) { - return upb::generator::CApiHeaderFilename(file->name()); -} - -} // namespace protobuf -} // namespace google::hpb_generator diff --git a/third_party/protobuf/hpb_generator/output.h b/third_party/protobuf/hpb_generator/output.h deleted file mode 100644 index a06ced92ba1cc..0000000000000 --- a/third_party/protobuf/hpb_generator/output.h +++ /dev/null @@ -1,150 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2023 Google LLC. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#ifndef PROTOBUF_COMPILER_HBP_OUTPUT_H_ -#define PROTOBUF_COMPILER_HBP_OUTPUT_H_ - -#include <vector> - -#include "absl/log/absl_log.h" -#include "absl/strings/str_replace.h" -#include "absl/strings/substitute.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/io/zero_copy_stream.h" - -namespace google::protobuf::hpb_generator { - -class Output { - public: - Output(google::protobuf::io::ZeroCopyOutputStream* stream) : stream_(stream) {} - ~Output() { stream_->BackUp((int)buffer_size_); } - - template <class... Arg> - void operator()(absl::string_view format, const Arg&... arg) { - Write(absl::Substitute(format, arg...)); - } - - // Indentation size in characters. - static constexpr size_t kIndentationSize = 2; - - void Indent() { Indent(kIndentationSize); } - void Indent(size_t size) { indent_ += size; } - - void Outdent() { Outdent(kIndentationSize); } - void Outdent(size_t size) { - if (indent_ < size) { - ABSL_LOG(FATAL) << "mismatched Output indent/unindent calls"; - } - indent_ -= size; - } - - private: - void Write(absl::string_view data) { - std::string stripped; - if (absl::StartsWith(data, "\n ")) { - size_t indent = data.substr(1).find_first_not_of(' '); - if (indent > indent_) { - indent -= indent_; - } - if (indent != absl::string_view::npos) { - // Remove indentation from all lines. - auto line_prefix = data.substr(0, indent + 1); - // The final line has an extra newline and is indented two less, eg. - // R"cc( - // UPB_INLINE $0 $1_$2(const $1 *msg) { - // return $1_has_$2(msg) ? *UPB_PTR_AT(msg, $3, $0) : $4; - // } - // )cc", - std::string last_line_prefix = std::string(line_prefix); - last_line_prefix.resize(last_line_prefix.size() - 2); - data.remove_prefix(line_prefix.size()); - stripped = absl::StrReplaceAll( - data, {{line_prefix, "\n"}, {last_line_prefix, "\n"}}); - data = stripped; - } - } else { - WriteIndent(); - } - WriteRaw(data); - } - - void WriteRaw(absl::string_view data) { - while (!data.empty()) { - RefreshOutput(); - size_t to_write = std::min(data.size(), buffer_size_); - memcpy(output_buffer_, data.data(), to_write); - data.remove_prefix(to_write); - output_buffer_ += to_write; - buffer_size_ -= to_write; - } - } - - void WriteIndent() { - if (indent_ == 0) { - return; - } - size_t size = indent_; - while (size > buffer_size_) { - if (buffer_size_ > 0) { - memset(output_buffer_, ' ', buffer_size_); - } - size -= buffer_size_; - buffer_size_ = 0; - RefreshOutput(); - } - memset(output_buffer_, ' ', size); - output_buffer_ += size; - buffer_size_ -= size; - } - - void RefreshOutput() { - while (buffer_size_ == 0) { - void* void_buffer; - int size; - if (!stream_->Next(&void_buffer, &size)) { - fprintf(stderr, "upb_generator: Failed to write to to output\n"); - abort(); - } - output_buffer_ = static_cast<char*>(void_buffer); - buffer_size_ = size; - } - } - - google::protobuf::io::ZeroCopyOutputStream* stream_; - char* output_buffer_ = nullptr; - size_t buffer_size_ = 0; - // Current indentation size in characters. - size_t indent_ = 0; - friend class OutputIndenter; -}; - -class OutputIndenter { - public: - OutputIndenter(Output& output) - : OutputIndenter(output, Output::kIndentationSize) {} - OutputIndenter(Output& output, size_t indent_size) - : indent_size_(indent_size), output_(output) { - output.Indent(indent_size); - } - ~OutputIndenter() { output_.Outdent(indent_size_); } - - private: - size_t indent_size_; - Output& output_; -}; - -std::string ToCIdent(absl::string_view str); -std::string ToPreproc(absl::string_view str); -void EmitFileWarning(const google::protobuf::FileDescriptor* file, Output& output); -std::string MessageName(const google::protobuf::Descriptor* descriptor); -std::string FileLayoutName(const google::protobuf::FileDescriptor* file); -std::string CHeaderFilename(const google::protobuf::FileDescriptor* file); - -} // namespace protobuf -} // namespace google::hpb_generator - -#endif // PROTOBUF_COMPILER_HBP_OUTPUT_H_ diff --git a/third_party/protobuf/hpb_generator/protoc-gen-upb-protos.cc b/third_party/protobuf/hpb_generator/protoc-gen-hpb.cc similarity index 63% rename from third_party/protobuf/hpb_generator/protoc-gen-upb-protos.cc rename to third_party/protobuf/hpb_generator/protoc-gen-hpb.cc index 1f0642aeb0770..e7cb0f0a6e077 100644 --- a/third_party/protobuf/hpb_generator/protoc-gen-upb-protos.cc +++ b/third_party/protobuf/hpb_generator/protoc-gen-hpb.cc @@ -13,12 +13,12 @@ #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/compiler/hpb/context.h" #include "google/protobuf/compiler/hpb/gen_enums.h" #include "google/protobuf/compiler/hpb/gen_extensions.h" #include "google/protobuf/compiler/hpb/gen_messages.h" #include "google/protobuf/compiler/hpb/gen_utils.h" #include "google/protobuf/compiler/hpb/names.h" -#include "google/protobuf/compiler/hpb/output.h" #include "google/protobuf/compiler/plugin.h" #include "google/protobuf/descriptor.h" @@ -30,21 +30,19 @@ namespace protobuf = ::proto2; using FileDescriptor = ::google::protobuf::FileDescriptor; using google::protobuf::Edition; -void WriteSource(const protobuf::FileDescriptor* file, Output& output, +void WriteSource(const protobuf::FileDescriptor* file, Context& ctx, bool fasttable_enabled, bool strip_feature_includes); -void WriteHeader(const protobuf::FileDescriptor* file, Output& output, +void WriteHeader(const protobuf::FileDescriptor* file, Context& ctx, bool strip_feature_includes); -void WriteForwardingHeader(const protobuf::FileDescriptor* file, - Output& output); +void WriteForwardingHeader(const protobuf::FileDescriptor* file, Context& ctx); void WriteMessageImplementations(const protobuf::FileDescriptor* file, - Output& output); + Context& ctx); void WriteTypedefForwardingHeader( const protobuf::FileDescriptor* file, const std::vector<const protobuf::Descriptor*>& file_messages, - Output& output); + Context& ctx); void WriteHeaderMessageForwardDecls(const protobuf::FileDescriptor* file, - Output& output, - bool strip_feature_includes); + Context& ctx, bool strip_feature_includes); class Generator : public protoc::CodeGenerator { public: @@ -83,76 +81,79 @@ bool Generator::Generate(const protobuf::FileDescriptor* file, // Write model.upb.fwd.h std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output_stream( context->Open(ForwardingHeaderFilename(file))); - Output forwarding_header_output(output_stream.get()); - WriteForwardingHeader(file, forwarding_header_output); + Context fwd_ctx = + Context(file, output_stream.get(), Options{.backend = Backend::UPB}); + WriteForwardingHeader(file, fwd_ctx); // Write model.upb.proto.h std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> header_output_stream( context->Open(CppHeaderFilename(file))); - Output header_output(header_output_stream.get()); - WriteHeader(file, header_output, strip_nonfunctional_codegen); + Context hdr_ctx(file, header_output_stream.get(), + Options{.backend = Backend::UPB}); + WriteHeader(file, hdr_ctx, strip_nonfunctional_codegen); // Write model.upb.proto.cc std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> cc_output_stream( context->Open(CppSourceFilename(file))); - Output cc_output(cc_output_stream.get()); - WriteSource(file, cc_output, fasttable_enabled, strip_nonfunctional_codegen); + auto cc_ctx = + Context(file, cc_output_stream.get(), Options{.backend = Backend::UPB}); + WriteSource(file, cc_ctx, fasttable_enabled, strip_nonfunctional_codegen); return true; } // The forwarding header defines Access/Proxy/CProxy for message classes // used to include when referencing dependencies to prevent transitive // dependency headers from being included. -void WriteForwardingHeader(const protobuf::FileDescriptor* file, - Output& output) { - EmitFileWarning(file, output); - output( +void WriteForwardingHeader(const protobuf::FileDescriptor* file, Context& ctx) { + EmitFileWarning(file, ctx); + ctx.EmitLegacy( R"cc( #ifndef $0_UPB_FWD_H_ #define $0_UPB_FWD_H_ )cc", ToPreproc(file->name())); - output("\n"); + ctx.Emit("\n"); for (int i = 0; i < file->public_dependency_count(); ++i) { - output("#include \"$0\"\n", - ForwardingHeaderFilename(file->public_dependency(i))); + ctx.EmitLegacy("#include \"$0\"\n", + ForwardingHeaderFilename(file->public_dependency(i))); } if (file->public_dependency_count() > 0) { - output("\n"); + ctx.Emit("\n"); } const std::vector<const protobuf::Descriptor*> this_file_messages = SortedMessages(file); - WriteTypedefForwardingHeader(file, this_file_messages, output); - output("#endif /* $0_UPB_FWD_H_ */\n", ToPreproc(file->name())); + WriteTypedefForwardingHeader(file, this_file_messages, ctx); + ctx.EmitLegacy("#endif /* $0_UPB_FWD_H_ */\n", ToPreproc(file->name())); } -void WriteHeader(const protobuf::FileDescriptor* file, Output& output, +void WriteHeader(const protobuf::FileDescriptor* file, Context& ctx, bool strip_feature_includes) { - EmitFileWarning(file, output); - output( + EmitFileWarning(file, ctx); + ctx.EmitLegacy( R"cc( #ifndef $0_HPB_PROTO_H_ #define $0_HPB_PROTO_H_ +#include "google/protobuf/hpb/repeated_field.h" + #include "absl/status/statusor.h" #include "absl/strings/string_view.h" - -#include "google/protobuf/hpb/repeated_field.h" )cc", ToPreproc(file->name())); // Import headers for proto public dependencies. for (int i = 0; i < file->public_dependency_count(); i++) { if (i == 0) { - output("// Public Imports.\n"); + ctx.Emit("// Public Imports.\n"); } - output("#include \"$0\"\n", CppHeaderFilename(file->public_dependency(i))); + ctx.EmitLegacy("#include \"$0\"\n", + CppHeaderFilename(file->public_dependency(i))); if (i == file->public_dependency_count() - 1) { - output("\n"); + ctx.Emit("\n"); } } - output("#include \"upb/port/def.inc\"\n"); + ctx.Emit("#include \"upb/port/def.inc\"\n"); const std::vector<const protobuf::Descriptor*> this_file_messages = SortedMessages(file); @@ -160,44 +161,44 @@ void WriteHeader(const protobuf::FileDescriptor* file, Output& output, SortedExtensions(file); if (!this_file_messages.empty()) { - output("\n"); + ctx.Emit("\n"); } - WriteHeaderMessageForwardDecls(file, output, strip_feature_includes); - WriteStartNamespace(file, output); + WriteHeaderMessageForwardDecls(file, ctx, strip_feature_includes); std::vector<const protobuf::EnumDescriptor*> this_file_enums = SortedEnums(file); - // Write Class and Enums. - WriteEnumDeclarations(this_file_enums, output); - output("\n"); + WrapNamespace(file, ctx, [&]() { + // Write Class and Enums. + WriteEnumDeclarations(this_file_enums, ctx); + ctx.Emit("\n"); - for (auto message : this_file_messages) { - WriteMessageClassDeclarations(message, this_file_exts, this_file_enums, - output); - } - output("\n"); + for (auto message : this_file_messages) { + WriteMessageClassDeclarations(message, this_file_exts, this_file_enums, + ctx); + } + ctx.Emit("\n"); - WriteExtensionIdentifiersHeader(this_file_exts, output); - output("\n"); + WriteExtensionIdentifiersHeader(this_file_exts, ctx); + ctx.Emit("\n"); + }); - WriteEndNamespace(file, output); - - output("\n#include \"upb/port/undef.inc\"\n\n"); + ctx.Emit("\n#include \"upb/port/undef.inc\"\n\n"); // End of "C" section. - output("#endif /* $0_HPB_PROTO_H_ */\n", ToPreproc(file->name())); + ctx.EmitLegacy("#endif /* $0_HPB_PROTO_H_ */\n", ToPreproc(file->name())); } // Writes a .upb.cc source file. -void WriteSource(const protobuf::FileDescriptor* file, Output& output, +void WriteSource(const protobuf::FileDescriptor* file, Context& ctx, bool fasttable_enabled, bool strip_feature_includes) { - EmitFileWarning(file, output); + EmitFileWarning(file, ctx); - output( + ctx.EmitLegacy( R"cc( #include <stddef.h> +#include "absl/log/absl_check.h" #include "absl/strings/string_view.h" #include "$0" )cc", @@ -209,61 +210,58 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output, // Strip feature imports for editions codegen tests. continue; } - output("#include \"$0\"\n", CppHeaderFilename(file->dependency(i))); + ctx.EmitLegacy("#include \"$0\"\n", CppHeaderFilename(file->dependency(i))); } - output("#include \"upb/port/def.inc\"\n"); + ctx.EmitLegacy("#include \"upb/port/def.inc\"\n"); - WriteStartNamespace(file, output); - WriteMessageImplementations(file, output); - const std::vector<const protobuf::FieldDescriptor*> this_file_exts = - SortedExtensions(file); - WriteExtensionIdentifiers(this_file_exts, output); - WriteEndNamespace(file, output); + WrapNamespace(file, ctx, [&]() { + WriteMessageImplementations(file, ctx); + const std::vector<const protobuf::FieldDescriptor*> this_file_exts = + SortedExtensions(file); + WriteExtensionIdentifiers(this_file_exts, ctx); + }); - output("#include \"upb/port/undef.inc\"\n\n"); + ctx.Emit("#include \"upb/port/undef.inc\"\n\n"); } void WriteMessageImplementations(const protobuf::FileDescriptor* file, - Output& output) { + Context& ctx) { const std::vector<const protobuf::FieldDescriptor*> file_exts = SortedExtensions(file); const std::vector<const protobuf::Descriptor*> this_file_messages = SortedMessages(file); for (auto message : this_file_messages) { - WriteMessageImplementation(message, file_exts, output); + WriteMessageImplementation(message, file_exts, ctx); } } void WriteTypedefForwardingHeader( const protobuf::FileDescriptor* file, const std::vector<const protobuf::Descriptor*>& file_messages, - Output& output) { - WriteStartNamespace(file, output); - - // Forward-declare types defined in this file. - for (auto message : file_messages) { - output( - R"cc( - class $0; - namespace internal { - class $0Access; - class $0Proxy; - class $0CProxy; - } // namespace internal - )cc", - ClassName(message)); - } - output("\n"); - WriteEndNamespace(file, output); + Context& ctx) { + WrapNamespace(file, ctx, [&]() { + // Forward-declare types defined in this file. + for (auto message : file_messages) { + ctx.Emit({{"class_name", ClassName(message)}}, + R"cc( + class $class_name$; + namespace internal { + class $class_name$Access; + class $class_name$Proxy; + class $class_name$CProxy; + } // namespace internal + )cc"); + } + }); + ctx.Emit("\n"); } /// Writes includes for upb C minitables and fwd.h for transitive typedefs. void WriteHeaderMessageForwardDecls(const protobuf::FileDescriptor* file, - Output& output, - bool strip_feature_includes) { + Context& ctx, bool strip_feature_includes) { // Import forward-declaration of types defined in this file. - output("#include \"$0\"\n", UpbCFilename(file)); - output("#include \"$0\"\n", ForwardingHeaderFilename(file)); + ctx.EmitLegacy("#include \"$0\"\n", UpbCFilename(file)); + ctx.EmitLegacy("#include \"$0\"\n", ForwardingHeaderFilename(file)); // Import forward-declaration of types in dependencies. for (int i = 0; i < file->dependency_count(); ++i) { if (strip_feature_includes && @@ -271,9 +269,10 @@ void WriteHeaderMessageForwardDecls(const protobuf::FileDescriptor* file, // Strip feature imports for editions codegen tests. continue; } - output("#include \"$0\"\n", ForwardingHeaderFilename(file->dependency(i))); + ctx.EmitLegacy("#include \"$0\"\n", + ForwardingHeaderFilename(file->dependency(i))); } - output("\n"); + ctx.Emit("\n"); } } // namespace diff --git a/third_party/protobuf/hpb_generator/tests/basic_test_editions.proto b/third_party/protobuf/hpb_generator/tests/basic_test_editions.proto index f5dc515b6cf76..a3a0808b43c4a 100644 --- a/third_party/protobuf/hpb_generator/tests/basic_test_editions.proto +++ b/third_party/protobuf/hpb_generator/tests/basic_test_editions.proto @@ -1,3 +1,10 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + edition = "2023"; package editions_upb_test; diff --git a/third_party/protobuf/hpb_generator/tests/child_model.proto b/third_party/protobuf/hpb_generator/tests/child_model.proto index 976a72972504f..9b4272a1f370d 100644 --- a/third_party/protobuf/hpb_generator/tests/child_model.proto +++ b/third_party/protobuf/hpb_generator/tests/child_model.proto @@ -5,22 +5,25 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; import public "google/protobuf/compiler/hpb/tests/test_enum.proto"; message ChildModel1 { - optional bool child_b1 = 44; - optional string child_str1 = 56; + bool child_b1 = 44; + string child_str1 = 56; } message ChildModel3 { string sub_key = 1; + bool bool1 = 2; + int32 i32 = 3; - optional string opt_str = 4; - optional bool opt_bool = 5; - optional int32 opt_i32 = 6; + + string opt_str = 4; + bool opt_bool = 5; + int32 opt_i32 = 6; } diff --git a/third_party/protobuf/hpb_generator/tests/extension_test.cc b/third_party/protobuf/hpb_generator/tests/extension_test.cc new file mode 100644 index 0000000000000..aa9e2b5619d53 --- /dev/null +++ b/third_party/protobuf/hpb_generator/tests/extension_test.cc @@ -0,0 +1,539 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include "google/protobuf/hpb/extension.h" + +#include <cstdint> +#include <type_traits> + +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include "google/protobuf/compiler/hpb/tests/child_model.upb.proto.h" +#include "google/protobuf/compiler/hpb/tests/test_extension.upb.proto.h" +#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h" +#include "google/protobuf/hpb/requires.h" + +namespace { +using ::hpb::internal::Requires; + +using ::hpb_unittest::protos::container_ext; +using ::hpb_unittest::protos::ContainerExtension; +using ::hpb_unittest::protos::other_ext; +using ::hpb_unittest::protos::TestModel; +using ::hpb_unittest::protos::theme; +using ::hpb_unittest::protos::ThemeExtension; +using ::hpb_unittest::someotherpackage::protos::bool_ext; +using ::hpb_unittest::someotherpackage::protos::double_ext; +using ::hpb_unittest::someotherpackage::protos::float_ext; +using ::hpb_unittest::someotherpackage::protos::int32_ext; +using ::hpb_unittest::someotherpackage::protos::int64_ext; +using ::hpb_unittest::someotherpackage::protos::repeated_int32_ext; +using ::hpb_unittest::someotherpackage::protos::repeated_int64_ext; +using ::hpb_unittest::someotherpackage::protos::repeated_string_ext; +using ::hpb_unittest::someotherpackage::protos::uint32_ext; +using ::hpb_unittest::someotherpackage::protos::uint64_ext; + +using ::testing::status::IsOkAndHolds; + +TEST(CppGeneratedCode, HasExtension) { + TestModel model; + EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); +} + +TEST(CppGeneratedCode, HasExtensionPtr) { + TestModel model; + EXPECT_EQ(false, ::hpb::HasExtension(model.recursive_child(), theme)); +} + +TEST(CppGeneratedCode, ClearExtensionWithEmptyExtension) { + TestModel model; + EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); + ::hpb::ClearExtension(&model, theme); + EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); +} + +TEST(CppGeneratedCode, ClearExtensionWithEmptyExtensionPtr) { + TestModel model; + ::hpb::Ptr<TestModel> recursive_child = model.mutable_recursive_child(); + ::hpb::ClearExtension(recursive_child, theme); + EXPECT_EQ(false, ::hpb::HasExtension(recursive_child, theme)); +} + +TEST(CppGeneratedCode, GetSetExtensionInt32) { + TestModel model; + EXPECT_EQ(false, hpb::HasExtension(&model, int32_ext)); + int32_t val = 55; + auto x = hpb::SetExtension(&model, int32_ext, val); + EXPECT_EQ(true, hpb::HasExtension(&model, int32_ext)); + EXPECT_THAT(hpb::GetExtension(&model, int32_ext), IsOkAndHolds(val)); +} + +TEST(CppGeneratedCode, GetSetExtensionInt64) { + TestModel model; + EXPECT_EQ(false, hpb::HasExtension(&model, int64_ext)); + int64_t val = std::numeric_limits<int32_t>::max() + int64_t{1}; + auto x = hpb::SetExtension(&model, int64_ext, val); + EXPECT_EQ(true, hpb::HasExtension(&model, int64_ext)); + EXPECT_THAT(hpb::GetExtension(&model, int64_ext), IsOkAndHolds(val)); +} + +TEST(CppGeneratedCode, GetSetExtensionUInt32) { + TestModel model; + EXPECT_EQ(false, hpb::HasExtension(&model, uint32_ext)); + uint32_t val = std::numeric_limits<int32_t>::max() + uint32_t{5}; + auto x = hpb::SetExtension(&model, uint32_ext, val); + EXPECT_EQ(true, hpb::HasExtension(&model, uint32_ext)); + EXPECT_THAT(hpb::GetExtension(&model, uint32_ext), IsOkAndHolds(val)); +} + +TEST(CppGeneratedCode, GetSetExtensionUInt64) { + TestModel model; + EXPECT_EQ(false, hpb::HasExtension(&model, uint64_ext)); + uint64_t val = std::numeric_limits<int64_t>::max() + uint64_t{5}; + auto x = hpb::SetExtension(&model, uint64_ext, val); + EXPECT_EQ(true, hpb::HasExtension(&model, uint64_ext)); + EXPECT_THAT(hpb::GetExtension(&model, uint64_ext), IsOkAndHolds(val)); +} + +TEST(CppGeneratedCode, GetSetExtensionFloat) { + TestModel model; + EXPECT_EQ(false, hpb::HasExtension(&model, float_ext)); + float val = 2.78; + auto x = hpb::SetExtension(&model, float_ext, val); + EXPECT_EQ(true, hpb::HasExtension(&model, float_ext)); + EXPECT_THAT(hpb::GetExtension(&model, float_ext), IsOkAndHolds(val)); +} + +TEST(CppGeneratedCode, GetSetExtensionDouble) { + TestModel model; + EXPECT_EQ(false, hpb::HasExtension(&model, double_ext)); + double val = std::numeric_limits<float>::max() + 1.23; + auto x = hpb::SetExtension(&model, double_ext, val); + EXPECT_EQ(true, hpb::HasExtension(&model, double_ext)); + EXPECT_THAT(hpb::GetExtension(&model, double_ext), IsOkAndHolds(val)); +} + +TEST(CppGeneratedCode, GetSetExtensionBool) { + TestModel model; + EXPECT_EQ(false, hpb::HasExtension(&model, bool_ext)); + auto x = hpb::SetExtension(&model, bool_ext, true); + EXPECT_EQ(true, hpb::HasExtension(&model, bool_ext)); + EXPECT_THAT(hpb::GetExtension(&model, bool_ext), IsOkAndHolds(true)); +} + +TEST(CppGeneratedCode, SetExtension) { + TestModel model; + void* prior_message; + { + // Use a nested scope to make sure the arenas are fused correctly. + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + prior_message = hpb::interop::upb::GetMessage(&extension1); + EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); + EXPECT_EQ(true, + ::hpb::SetExtension(&model, theme, std::move(extension1)).ok()); + } + EXPECT_EQ(true, ::hpb::HasExtension(&model, theme)); + auto ext = hpb::GetExtension(&model, theme); + EXPECT_TRUE(ext.ok()); + EXPECT_EQ(hpb::interop::upb::GetMessage(*ext), prior_message); +} + +TEST(CppGeneratedCode, SetExtensionWithPtr) { + ::hpb::Arena arena_model; + ::hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena_model); + void* prior_message; + { + // Use a nested scope to make sure the arenas are fused correctly. + ::hpb::Arena arena; + ::hpb::Ptr<ThemeExtension> extension1 = + ::hpb::CreateMessage<ThemeExtension>(arena); + extension1->set_ext_name("Hello World"); + prior_message = hpb::interop::upb::GetMessage(extension1); + EXPECT_EQ(false, ::hpb::HasExtension(model, theme)); + auto res = ::hpb::SetExtension(model, theme, extension1); + EXPECT_EQ(true, res.ok()); + } + EXPECT_EQ(true, ::hpb::HasExtension(model, theme)); + auto ext = hpb::GetExtension(model, theme); + EXPECT_TRUE(ext.ok()); + EXPECT_NE(hpb::interop::upb::GetMessage(*ext), prior_message); +} + +#ifndef _MSC_VER +TEST(CppGeneratedCode, SetExtensionShouldNotCompileForWrongType) { + ::hpb::Arena arena; + ::hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena); + ThemeExtension extension1; + ContainerExtension extension2; + + const auto canSetExtension = [&](auto l) { + return Requires<decltype(model)>(l); + }; + EXPECT_TRUE(canSetExtension( + [](auto p) -> decltype(::hpb::SetExtension(p, theme, extension1)) {})); + // Wrong extension value type should fail to compile. + EXPECT_TRUE(!canSetExtension( + [](auto p) -> decltype(::hpb::SetExtension(p, theme, extension2)) {})); + // Wrong extension id with correct extension type should fail to compile. + EXPECT_TRUE( + !canSetExtension([](auto p) -> decltype(::hpb::SetExtension( + p, container_ext, extension1)) {})); +} +#endif + +TEST(CppGeneratedCode, SetExtensionWithPtrSameArena) { + ::hpb::Arena arena; + ::hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena); + void* prior_message; + { + // Use a nested scope to make sure the arenas are fused correctly. + ::hpb::Ptr<ThemeExtension> extension1 = + ::hpb::CreateMessage<ThemeExtension>(arena); + extension1->set_ext_name("Hello World"); + prior_message = hpb::interop::upb::GetMessage(extension1); + EXPECT_EQ(false, ::hpb::HasExtension(model, theme)); + auto res = ::hpb::SetExtension(model, theme, extension1); + EXPECT_EQ(true, res.ok()); + } + EXPECT_EQ(true, ::hpb::HasExtension(model, theme)); + auto ext = hpb::GetExtension(model, theme); + EXPECT_TRUE(ext.ok()); + EXPECT_NE(hpb::interop::upb::GetMessage(*ext), prior_message); +} + +TEST(CppGeneratedCode, SetExtensionFusingFailureShouldCopy) { + // Use an initial block to disallow fusing. + char initial_block[1000]; + hpb::Arena arena(initial_block, sizeof(initial_block)); + + hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena); + + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + ASSERT_FALSE( + upb_Arena_Fuse(arena.ptr(), hpb::interop::upb::GetArena(&extension1))); + EXPECT_FALSE(::hpb::HasExtension(model, theme)); + auto status = ::hpb::SetExtension(model, theme, std::move(extension1)); + EXPECT_TRUE(status.ok()); + EXPECT_TRUE(::hpb::HasExtension(model, theme)); + EXPECT_TRUE(hpb::GetExtension(model, theme).ok()); +} + +TEST(CppGeneratedCode, SetExtensionShouldClone) { + TestModel model; + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); + EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); + extension1.set_ext_name("Goodbye"); + EXPECT_EQ(true, ::hpb::HasExtension(&model, theme)); + auto ext = hpb::GetExtension(&model, theme); + EXPECT_TRUE(ext.ok()); + EXPECT_EQ((*ext)->ext_name(), "Hello World"); +} + +TEST(CppGeneratedCode, SetExtensionShouldCloneConst) { + TestModel model; + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); + EXPECT_EQ(true, + ::hpb::SetExtension(&model, theme, std::as_const(extension1)).ok()); + extension1.set_ext_name("Goodbye"); + EXPECT_EQ(true, ::hpb::HasExtension(&model, theme)); + auto ext = hpb::GetExtension(&model, theme); + EXPECT_TRUE(ext.ok()); + EXPECT_EQ((*ext)->ext_name(), "Hello World"); +} + +TEST(CppGeneratedCode, SetExtensionOnMutableChild) { + TestModel model; + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + EXPECT_EQ(false, ::hpb::HasExtension(model.mutable_recursive_child(), theme)); + EXPECT_EQ(true, ::hpb::SetExtension(model.mutable_recursive_child(), theme, + extension1) + .ok()); + EXPECT_EQ(true, ::hpb::HasExtension(model.mutable_recursive_child(), theme)); +} + +TEST(CppGeneratedCode, GetExtension) { + TestModel model; + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); + EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); + EXPECT_EQ("Hello World", + hpb::GetExtension(&model, theme).value()->ext_name()); +} + +TEST(CppGeneratedCode, GetExtensionInt32WithDefault) { + TestModel model; + auto res = hpb::GetExtension(&model, int32_ext); + EXPECT_TRUE(res.ok()); + EXPECT_EQ(*res, 644); +} + +TEST(CppGeneratedCode, GetExtensionInt64WithDefault) { + TestModel model; + auto res = hpb::GetExtension(&model, int64_ext); + EXPECT_TRUE(res.ok()); + int64_t expected = std::numeric_limits<int32_t>::max() + int64_t{1}; + EXPECT_EQ(*res, expected); +} + +TEST(CppGeneratedCode, GetExtensionUInt32WithDefault) { + TestModel model; + auto res = hpb::GetExtension(&model, uint32_ext); + EXPECT_THAT(res, IsOkAndHolds(12)); +} + +TEST(CppGeneratedCode, GetExtensionUInt64WithDefault) { + TestModel model; + auto res = hpb::GetExtension(&model, uint64_ext); + EXPECT_THAT(res, IsOkAndHolds(4294967296)); +} + +TEST(CppGeneratedCode, GetExtensionFloatWithDefault) { + TestModel model; + auto res = hpb::GetExtension(&model, float_ext); + static_assert(std::is_same_v<decltype(res), absl::StatusOr<float>>); + EXPECT_THAT(res, IsOkAndHolds(3.14f)); +} + +TEST(CppGeneratedCode, GetExtensionDoubleWithDefault) { + TestModel model; + auto res = hpb::GetExtension(&model, double_ext); + static_assert(std::is_same_v<decltype(res), absl::StatusOr<double>>); + EXPECT_THAT(res, IsOkAndHolds(340282000000000000000000000000000000001.23)); +} + +TEST(CppGeneratedCode, GetExtensionBoolWithDefault) { + TestModel model; + auto res = hpb::GetExtension(&model, bool_ext); + EXPECT_THAT(res, IsOkAndHolds(true)); +} + +TEST(CppGeneratedCode, GetExtensionOnMutableChild) { + TestModel model; + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + ::hpb::Ptr<TestModel> mutable_recursive_child = + model.mutable_recursive_child(); + EXPECT_EQ(false, ::hpb::HasExtension(mutable_recursive_child, theme)); + EXPECT_EQ( + true, + ::hpb::SetExtension(mutable_recursive_child, theme, extension1).ok()); + EXPECT_EQ( + "Hello World", + hpb::GetExtension(mutable_recursive_child, theme).value()->ext_name()); +} + +TEST(CppGeneratedCode, GetExtensionOnImmutableChild) { + TestModel model; + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + ::hpb::Ptr<TestModel> mutable_recursive_child = + model.mutable_recursive_child(); + EXPECT_EQ(false, ::hpb::HasExtension(mutable_recursive_child, theme)); + EXPECT_EQ( + true, + ::hpb::SetExtension(mutable_recursive_child, theme, extension1).ok()); + ::hpb::Ptr<const TestModel> recursive_child = model.recursive_child(); + EXPECT_EQ("Hello World", + hpb::GetExtension(recursive_child, theme).value()->ext_name()); +} + +TEST(CppGeneratedCode, Parse) { + TestModel model; + model.set_str1("Test123"); + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); + ::upb::Arena arena; + auto bytes = ::hpb::Serialize(&model, arena); + EXPECT_EQ(true, bytes.ok()); + TestModel parsed_model = ::hpb::Parse<TestModel>(bytes.value()).value(); + EXPECT_EQ("Test123", parsed_model.str1()); + EXPECT_EQ(true, hpb::GetExtension(&parsed_model, theme).ok()); +} + +TEST(CppGeneratedCode, ParseIntoPtrToModel) { + TestModel model; + model.set_str1("Test123"); + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); + ::upb::Arena arena; + auto bytes = ::hpb::Serialize(&model, arena); + EXPECT_EQ(true, bytes.ok()); + ::hpb::Ptr<TestModel> parsed_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_TRUE(::hpb::Parse(parsed_model, bytes.value())); + EXPECT_EQ("Test123", parsed_model->str1()); + // Should return an extension even if we don't pass ExtensionRegistry + // by promoting unknown. + EXPECT_EQ(true, hpb::GetExtension(parsed_model, theme).ok()); +} + +TEST(CppGeneratedCode, ParseWithExtensionRegistry) { + TestModel model; + model.set_str1("Test123"); + ThemeExtension extension1; + extension1.set_ext_name("Hello World"); + EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); + EXPECT_EQ(true, ::hpb::SetExtension(&model, ThemeExtension::theme_extension, + extension1) + .ok()); + ::upb::Arena arena; + auto bytes = ::hpb::Serialize(&model, arena); + EXPECT_EQ(true, bytes.ok()); + + TestModel parsed_model = + ::hpb::Parse<TestModel>(bytes.value(), + hpb::ExtensionRegistry::generated_registry()) + .value(); + EXPECT_EQ("Test123", parsed_model.str1()); + EXPECT_EQ(true, hpb::GetExtension(&parsed_model, theme).ok()); + EXPECT_EQ( + true, + hpb::GetExtension(&parsed_model, ThemeExtension::theme_extension).ok()); + EXPECT_EQ("Hello World", + hpb::GetExtension(&parsed_model, ThemeExtension::theme_extension) + .value() + ->ext_name()); +} + +TEST(CppGeneratedCode, ClearSubMessage) { + // Fill model. + TestModel model; + model.set_int64(5); + auto new_child = model.mutable_child_model_1(); + new_child->set_child_str1("text in child"); + ThemeExtension extension1; + extension1.set_ext_name("name in extension"); + EXPECT_TRUE(::hpb::SetExtension(&model, theme, extension1).ok()); + EXPECT_TRUE(model.mutable_child_model_1()->has_child_str1()); + // Clear using Ptr<T> + ::hpb::ClearMessage(model.mutable_child_model_1()); + EXPECT_FALSE(model.mutable_child_model_1()->has_child_str1()); +} + +TEST(CppGeneratedCode, ClearMessage) { + // Fill model. + TestModel model; + model.set_int64(5); + model.set_str2("Hello"); + auto new_child = model.add_child_models(); + ASSERT_TRUE(new_child.ok()); + new_child.value()->set_child_str1("text in child"); + ThemeExtension extension1; + extension1.set_ext_name("name in extension"); + EXPECT_TRUE(::hpb::SetExtension(&model, theme, extension1).ok()); + // Clear using T* + ::hpb::ClearMessage(&model); + // Verify that scalars, repeated fields and extensions are cleared. + EXPECT_FALSE(model.has_int64()); + EXPECT_FALSE(model.has_str2()); + EXPECT_TRUE(model.child_models().empty()); + EXPECT_FALSE(::hpb::HasExtension(&model, theme)); +} + +TEST(CppGeneratedCode, DeepCopy) { + // Fill model. + TestModel model; + model.set_int64(5); + model.set_str2("Hello"); + auto new_child = model.add_child_models(); + ASSERT_TRUE(new_child.ok()); + new_child.value()->set_child_str1("text in child"); + ThemeExtension extension1; + extension1.set_ext_name("name in extension"); + EXPECT_TRUE(::hpb::SetExtension(&model, theme, extension1).ok()); + TestModel target; + target.set_b1(true); + ::hpb::DeepCopy(&model, &target); + EXPECT_FALSE(target.b1()) << "Target was not cleared before copying content "; + EXPECT_EQ(target.str2(), "Hello"); + EXPECT_TRUE(::hpb::HasExtension(&target, theme)); +} + +TEST(CppGeneratedCode, HasExtensionAndRegistry) { + // Fill model. + TestModel source; + source.set_int64(5); + source.set_str2("Hello"); + auto new_child = source.add_child_models(); + ASSERT_TRUE(new_child.ok()); + new_child.value()->set_child_str1("text in child"); + ThemeExtension extension1; + extension1.set_ext_name("name in extension"); + ASSERT_TRUE(::hpb::SetExtension(&source, theme, extension1).ok()); + + // Now that we have a source model with extension data, serialize. + ::hpb::Arena arena; + std::string data = std::string(::hpb::Serialize(&source, arena).value()); + + // Test with ExtensionRegistry + TestModel parsed_model = + ::hpb::Parse<TestModel>(data, + hpb::ExtensionRegistry::generated_registry()) + .value(); + EXPECT_TRUE(::hpb::HasExtension(&parsed_model, theme)); +} + +TEST(CppGeneratedCode, ExtensionFieldNumberConstant) { + EXPECT_EQ(12003, ::hpb::ExtensionNumber(ThemeExtension::theme_extension)); +} + +TEST(CppGeneratedCode, GetExtensionRepeatedi32) { + TestModel model; + upb::Arena arena; + hpb::ExtensionRegistry extensions(arena); + extensions.AddExtension(repeated_int32_ext); + // These bytes are the serialized form of a repeated int32 field + // with two elements: [2, 3] @index 13004 + auto bytes = "\342\254\006\002\002\003"; + auto parsed_model = hpb::Parse<TestModel>(bytes, extensions).value(); + auto res = hpb::GetExtension(&parsed_model, repeated_int32_ext); + EXPECT_EQ(true, res.ok()); + EXPECT_EQ(res->size(), 2); + EXPECT_EQ((*res)[0], 2); + EXPECT_EQ((*res)[1], 3); +} + +TEST(CppGeneratedCode, GetExtensionRepeatedi64) { + TestModel model; + upb::Arena arena; + hpb::ExtensionRegistry extensions(arena); + extensions.AddExtension(repeated_int64_ext); + // These bytes represent a repeated int64 field with one element: [322]. + auto bytes = "\352\254\006\002\302\002"; + auto parsed_model = hpb::Parse<TestModel>(bytes, extensions).value(); + auto res = hpb::GetExtension(&parsed_model, repeated_int64_ext); + EXPECT_EQ(true, res.ok()); + EXPECT_EQ(res->size(), 1); + EXPECT_EQ((*res)[0], 322); +} + +TEST(CppGeneratedCode, GetExtensionRepeatedString) { + TestModel model; + upb::Arena arena; + hpb::ExtensionRegistry extensions(arena); + extensions.AddExtension(repeated_string_ext); + // These bytes represent a repeated string field with two elements: + // ["hello", "world"] @index 13006. + auto bytes = "\362\254\006\005hello\362\254\006\005world"; + auto parsed_model = hpb::Parse<TestModel>(bytes, extensions).value(); + auto res = hpb::GetExtension(&parsed_model, repeated_string_ext); + EXPECT_EQ(true, res.ok()); + EXPECT_EQ(res->size(), 2); + EXPECT_EQ((*res)[0], "hello"); + EXPECT_EQ((*res)[1], "world"); +} + +} // namespace diff --git a/third_party/protobuf/hpb_generator/tests/legacy-name.proto b/third_party/protobuf/hpb_generator/tests/legacy-name.proto index dbe1b8f751fdb..48527bcc00288 100644 --- a/third_party/protobuf/hpb_generator/tests/legacy-name.proto +++ b/third_party/protobuf/hpb_generator/tests/legacy-name.proto @@ -5,12 +5,10 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; -// option java_multiple_files = true; - enum LegacyEnum { PHASE_DEFAULT = 0; PHASE_BUSY = 1; diff --git a/third_party/protobuf/hpb_generator/tests/naming_conflict.proto b/third_party/protobuf/hpb_generator/tests/naming_conflict.proto index 917d4e0d2995a..2b456937c140b 100644 --- a/third_party/protobuf/hpb_generator/tests/naming_conflict.proto +++ b/third_party/protobuf/hpb_generator/tests/naming_conflict.proto @@ -5,11 +5,11 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; message HasChildCount { - optional HasChildCount has_child_count = 1; - optional int32 child_count = 2; + HasChildCount has_child_count = 1; + int32 child_count = 2; } diff --git a/third_party/protobuf/hpb_generator/tests/no_package.proto b/third_party/protobuf/hpb_generator/tests/no_package.proto index ebd9c2fda6334..799ff3841d7ec 100644 --- a/third_party/protobuf/hpb_generator/tests/no_package.proto +++ b/third_party/protobuf/hpb_generator/tests/no_package.proto @@ -5,8 +5,9 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; +option features.enum_type = CLOSED; // option java_multiple_files = true; enum EnumWithNoPackage { diff --git a/third_party/protobuf/hpb_generator/tests/no_package_enum_user.proto b/third_party/protobuf/hpb_generator/tests/no_package_enum_user.proto index 703fa2ab44d48..98b149f3ee039 100644 --- a/third_party/protobuf/hpb_generator/tests/no_package_enum_user.proto +++ b/third_party/protobuf/hpb_generator/tests/no_package_enum_user.proto @@ -5,14 +5,12 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; package hpb_unittest; import "google/protobuf/compiler/hpb/tests/no_package.proto"; -// option java_multiple_files = true; - message MyMessage { - optional MessageWithEnumUpbTest my_type = 1; + MessageWithEnumUpbTest my_type = 1; } diff --git a/third_party/protobuf/hpb_generator/tests/repeated_test.cc b/third_party/protobuf/hpb_generator/tests/repeated_test.cc new file mode 100644 index 0000000000000..df9d119d7a4de --- /dev/null +++ b/third_party/protobuf/hpb_generator/tests/repeated_test.cc @@ -0,0 +1,318 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include "google/protobuf/compiler/hpb/tests/child_model.upb.proto.h" +#include "google/protobuf/compiler/hpb/tests/test_extension.upb.proto.h" +#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h" +#include "google/protobuf/hpb/requires.h" + +namespace { + +using ::hpb::internal::Requires; +using ::hpb_unittest::protos::ChildModel1; +using ::hpb_unittest::protos::TestModel; +using ::testing::ElementsAre; + +const char kTestStr1[] = "abcdefg"; +const char kTestStr2[] = "just another test string"; + +TEST(CppGeneratedCode, RepeatedMessages) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.child_models_size()); + // Should be able to clear repeated field when empty. + test_model.mutable_child_models()->clear(); + EXPECT_EQ(0, test_model.child_models_size()); + // Add 2 children. + auto new_child = test_model.add_child_models(); + EXPECT_EQ(true, new_child.ok()); + new_child.value()->set_child_str1(kTestStr1); + new_child = test_model.add_child_models(); + EXPECT_EQ(true, new_child.ok()); + new_child.value()->set_child_str1(kTestStr2); + EXPECT_EQ(2, test_model.child_models_size()); + // Mutable access. + auto mutable_first = test_model.mutable_child_models(0); + EXPECT_EQ(mutable_first->child_str1(), kTestStr1); + mutable_first->set_child_str1("change1"); + auto mutable_second = test_model.mutable_child_models(1); + EXPECT_EQ(mutable_second->child_str1(), kTestStr2); + mutable_second->set_child_str1("change2"); + // Check mutations using views. + auto view_first = test_model.child_models(0); + EXPECT_EQ(view_first->child_str1(), "change1"); + auto view_second = test_model.child_models(1); + EXPECT_EQ(view_second->child_str1(), "change2"); +} + +TEST(CppGeneratedCode, RepeatedScalar) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.value_array_size()); + // Should be able to clear repeated field when empty. + test_model.mutable_value_array()->clear(); + EXPECT_EQ(0, test_model.value_array_size()); + // Add 2 children. + EXPECT_EQ(true, test_model.add_value_array(5)); + EXPECT_EQ(true, test_model.add_value_array(6)); + EXPECT_EQ(2, test_model.value_array_size()); + EXPECT_EQ(5, test_model.value_array(0)); + EXPECT_EQ(6, test_model.value_array(1)); + EXPECT_EQ(true, test_model.resize_value_array(3)); + EXPECT_EQ(3, test_model.value_array_size()); + test_model.set_value_array(2, 7); + EXPECT_EQ(5, test_model.value_array(0)); + EXPECT_EQ(6, test_model.value_array(1)); + EXPECT_EQ(7, test_model.value_array(2)); +} + +TEST(CppGeneratedCode, RepeatedFieldClear) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + test_model.mutable_value_array()->push_back(5); + test_model.mutable_value_array()->push_back(16); + test_model.mutable_value_array()->push_back(27); + ASSERT_EQ(test_model.mutable_value_array()->size(), 3); + test_model.mutable_value_array()->clear(); + EXPECT_EQ(test_model.mutable_value_array()->size(), 0); +} + +TEST(CppGeneratedCode, RepeatedFieldProxyForScalars) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.value_array().size()); + EXPECT_EQ(0, test_model.mutable_value_array()->size()); + + test_model.mutable_value_array()->push_back(5); + test_model.mutable_value_array()->push_back(16); + test_model.mutable_value_array()->push_back(27); + + ASSERT_EQ(test_model.mutable_value_array()->size(), 3); + EXPECT_EQ((*test_model.mutable_value_array())[0], 5); + EXPECT_EQ((*test_model.mutable_value_array())[1], 16); + EXPECT_EQ((*test_model.mutable_value_array())[2], 27); + + const auto value_array = test_model.value_array(); + ASSERT_EQ(value_array.size(), 3); + EXPECT_EQ(value_array[0], 5); + EXPECT_EQ(value_array[1], 16); + EXPECT_EQ(value_array[2], 27); + + EXPECT_THAT(value_array, ElementsAre(5, 16, 27)); + + EXPECT_THAT(std::vector(value_array.begin(), value_array.end()), + ElementsAre(5, 16, 27)); + EXPECT_THAT(std::vector(value_array.cbegin(), value_array.cend()), + ElementsAre(5, 16, 27)); + EXPECT_THAT(std::vector(value_array.rbegin(), value_array.rend()), + ElementsAre(27, 16, 5)); + EXPECT_THAT(std::vector(value_array.crbegin(), value_array.crend()), + ElementsAre(27, 16, 5)); +} + +TEST(CppGeneratedCode, RepeatedScalarIterator) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + test_model.mutable_value_array()->push_back(5); + test_model.mutable_value_array()->push_back(16); + test_model.mutable_value_array()->push_back(27); + int sum = 0; + // Access by value. + const ::hpb::RepeatedField<int32_t>::CProxy rep1 = test_model.value_array(); + for (auto i : rep1) { + sum += i; + } + EXPECT_EQ(sum, 5 + 16 + 27); + // Access by const reference. + sum = 0; + for (const auto& i : *test_model.mutable_value_array()) { + sum += i; + } + EXPECT_EQ(sum, 5 + 16 + 27); + // Access by forwarding reference. + sum = 0; + for (auto&& i : *test_model.mutable_value_array()) { + sum += i; + } + EXPECT_EQ(sum, 5 + 16 + 27); + // Test iterator operators. + auto begin = test_model.value_array().begin(); + auto end = test_model.value_array().end(); + sum = 0; + for (auto it = begin; it != end; ++it) { + sum += *it; + } + EXPECT_EQ(sum, 5 + 16 + 27); + auto it = begin; + ++it; + EXPECT_TRUE(begin < it); + EXPECT_TRUE(begin <= it); + it = end; + EXPECT_TRUE(it == end); + EXPECT_TRUE(it > begin); + EXPECT_TRUE(it >= begin); + EXPECT_TRUE(it != begin); + // difference type + it = end; + --it; + --it; + EXPECT_EQ(end - it, 2); + it = begin; + EXPECT_EQ(it[0], 5); + EXPECT_EQ(it[1], 16); + EXPECT_EQ(it[2], 27); + // ValueProxy. + sum = 0; + for (::hpb::RepeatedField<int32_t>::ValueCProxy c : + test_model.value_array()) { + sum += c; + } + EXPECT_EQ(sum, 5 + 16 + 27); + sum = 0; + for (::hpb::RepeatedField<int32_t>::ValueProxy c : + *test_model.mutable_value_array()) { + sum += c; + } + EXPECT_EQ(sum, 5 + 16 + 27); +} + +TEST(CppGeneratedCode, RepeatedFieldProxyForStrings) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.repeated_string().size()); + EXPECT_EQ(0, test_model.mutable_repeated_string()->size()); + + test_model.mutable_repeated_string()->push_back("a"); + test_model.mutable_repeated_string()->push_back("b"); + test_model.mutable_repeated_string()->push_back("c"); + + ASSERT_EQ(test_model.repeated_string().size(), 3); + EXPECT_EQ(test_model.repeated_string()[0], "a"); + EXPECT_EQ(test_model.repeated_string()[1], "b"); + EXPECT_EQ(test_model.repeated_string()[2], "c"); + + EXPECT_THAT(test_model.repeated_string(), ElementsAre("a", "b", "c")); + EXPECT_THAT(*test_model.mutable_repeated_string(), + ElementsAre("a", "b", "c")); + + ASSERT_EQ(test_model.mutable_repeated_string()->size(), 3); + EXPECT_EQ((*test_model.mutable_repeated_string())[0], "a"); + EXPECT_EQ((*test_model.mutable_repeated_string())[1], "b"); + EXPECT_EQ((*test_model.mutable_repeated_string())[2], "c"); + + // The const accessor can't be used to modify the element + EXPECT_FALSE((std::is_assignable<decltype(test_model.repeated_string()[1]), + absl::string_view>::value)); + // But the mutable one is fine. + (*test_model.mutable_repeated_string())[1] = "other"; + EXPECT_THAT(test_model.repeated_string(), ElementsAre("a", "other", "c")); + + test_model.mutable_repeated_string()->clear(); + EXPECT_EQ(test_model.mutable_repeated_string()->size(), 0); +} + +TEST(CppGeneratedCode, RepeatedFieldProxyForMessages) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.child_models().size()); + ChildModel1 child1; + child1.set_child_str1(kTestStr1); + test_model.mutable_child_models()->push_back(child1); + ChildModel1 child2; + child2.set_child_str1(kTestStr2); + test_model.mutable_child_models()->push_back(std::move(child2)); + + int i = 0; + for (auto child : test_model.child_models()) { + EXPECT_FALSE(Requires<decltype(child)>( + [](auto&& x) -> decltype(x.set_child_str1("")) {})); + if (i++ == 0) { + EXPECT_EQ(child.child_str1(), kTestStr1); + } else { + EXPECT_EQ(child.child_str1(), kTestStr2); + } + } + + i = 0; + for (const auto& child : *test_model.mutable_child_models()) { + if (i++ == 0) { + EXPECT_EQ(child.child_str1(), kTestStr1); + } else { + EXPECT_EQ(child.child_str1(), kTestStr2); + } + } + + using testing::_; + EXPECT_THAT(test_model.child_models(), ElementsAre(_, _)); + + EXPECT_EQ(test_model.child_models().size(), 2); + EXPECT_EQ(test_model.child_models()[0].child_str1(), kTestStr1); + EXPECT_EQ(test_model.child_models()[1].child_str1(), kTestStr2); + EXPECT_EQ((*test_model.mutable_child_models())[0].child_str1(), kTestStr1); + EXPECT_EQ((*test_model.mutable_child_models())[1].child_str1(), kTestStr2); + (*test_model.mutable_child_models())[0].set_child_str1("change1"); + EXPECT_EQ((*test_model.mutable_child_models())[0].child_str1(), "change1"); + test_model.mutable_child_models()->clear(); + EXPECT_EQ(test_model.mutable_child_models()->size(), 0); +} + +TEST(CppGeneratedCode, EmptyRepeatedFieldProxyForMessages) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.child_models().size()); + ChildModel1 child1; + child1.set_child_str1(kTestStr1); + + EXPECT_EQ(test_model.child_models().size(), 0); + EXPECT_EQ(std::distance(test_model.child_models().begin(), + test_model.child_models().end()), + 0); +} + +TEST(CppGeneratedCode, RepeatedFieldProxyForMessagesIndexOperator) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.child_models().size()); + ChildModel1 child1; + child1.set_child_str1(kTestStr1); + test_model.mutable_child_models()->push_back(child1); + ChildModel1 child2; + + child2.set_child_str1(kTestStr2); + test_model.mutable_child_models()->push_back(std::move(child2)); + ASSERT_EQ(test_model.child_models().size(), 2); + + // test_model.child_models()[0].set_child_str1("change1"); + (*test_model.mutable_child_models())[0].set_child_str1("change1"); + EXPECT_EQ((*test_model.mutable_child_models())[0].child_str1(), "change1"); +} + +TEST(CppGeneratedCode, RepeatedStrings) { + ::hpb::Arena arena; + auto test_model = ::hpb::CreateMessage<TestModel>(arena); + EXPECT_EQ(0, test_model.repeated_string_size()); + // Should be able to clear repeated field when empty. + test_model.mutable_repeated_string()->clear(); + EXPECT_EQ(0, test_model.repeated_string_size()); + // Add 2 children. + EXPECT_EQ(true, test_model.add_repeated_string("Hello")); + EXPECT_EQ(true, test_model.add_repeated_string("World")); + EXPECT_EQ(2, test_model.repeated_string_size()); + EXPECT_EQ("Hello", test_model.repeated_string(0)); + EXPECT_EQ("World", test_model.repeated_string(1)); + EXPECT_EQ(true, test_model.resize_repeated_string(3)); + EXPECT_EQ(3, test_model.repeated_string_size()); + test_model.set_repeated_string(2, "Test"); + EXPECT_EQ("Hello", test_model.repeated_string(0)); + EXPECT_EQ("World", test_model.repeated_string(1)); + EXPECT_EQ("Test", test_model.repeated_string(2)); +} + + +} // namespace diff --git a/third_party/protobuf/hpb_generator/tests/set_alias.proto b/third_party/protobuf/hpb_generator/tests/set_alias.proto new file mode 100644 index 0000000000000..a8566e7bc1adb --- /dev/null +++ b/third_party/protobuf/hpb_generator/tests/set_alias.proto @@ -0,0 +1,28 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +edition = "2023"; + +package hpb_unittest; + +message Child { + int32 peeps = 1; +} + +message Parent { + int32 x = 2; + Child child = 3; + int64 out_of_order = 1; // set_alias must work regardless of order +} + +message ParentWithRepeated { + repeated Child children = 1; +} + +message ParentWithMap { + map<int32, Child> child_map = 1; +} diff --git a/third_party/protobuf/hpb_generator/tests/test_enum.proto b/third_party/protobuf/hpb_generator/tests/test_enum.proto index 7f76cce4954a7..03afd87f27a77 100644 --- a/third_party/protobuf/hpb_generator/tests/test_enum.proto +++ b/third_party/protobuf/hpb_generator/tests/test_enum.proto @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; diff --git a/third_party/protobuf/hpb_generator/tests/test_extension.proto b/third_party/protobuf/hpb_generator/tests/test_extension.proto index f7758da7df0fa..d4b0e8c33562a 100644 --- a/third_party/protobuf/hpb_generator/tests/test_extension.proto +++ b/third_party/protobuf/hpb_generator/tests/test_extension.proto @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; package hpb_unittest.someotherpackage; @@ -15,5 +15,21 @@ import "google/protobuf/compiler/hpb/tests/test_model.proto"; // defined in different file. extend TestModel { - optional ThemeExtension styling = 13001; + ThemeExtension styling = 13001; +} + +extend TestModel { + int32 int32_ext = 13002 [default = 644]; + int64 int64_ext = 13003 [default = 2147483648]; + + repeated int32 repeated_int32_ext = 13004; + repeated int64 repeated_int64_ext = 13005; + repeated string repeated_string_ext = 13006; + + uint32 uint32_ext = 13007 [default = 12]; + uint64 uint64_ext = 13008 [default = 4294967296]; + float float_ext = 13009 [default = 3.14]; + double double_ext = 13010 + [default = 340282000000000000000000000000000000001.23]; + bool bool_ext = 13011 [default = true]; } diff --git a/third_party/protobuf/hpb_generator/tests/test_generated.cc b/third_party/protobuf/hpb_generator/tests/test_generated.cc index 292fadb888275..27931d91a0595 100644 --- a/third_party/protobuf/hpb_generator/tests/test_generated.cc +++ b/third_party/protobuf/hpb_generator/tests/test_generated.cc @@ -9,10 +9,7 @@ #include <iterator> #include <limits> #include <memory> -#include <string> -#include <type_traits> #include <utility> -#include <vector> #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -20,23 +17,24 @@ #include "absl/strings/string_view.h" #include "google/protobuf/compiler/hpb/tests/child_model.upb.proto.h" #include "google/protobuf/compiler/hpb/tests/no_package.upb.proto.h" +#include "google/protobuf/compiler/hpb/tests/set_alias.upb.proto.h" #include "google/protobuf/compiler/hpb/tests/test_extension.upb.proto.h" #include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h" +#include "google/protobuf/hpb/arena.h" #include "google/protobuf/hpb/backend/upb/interop.h" #include "google/protobuf/hpb/hpb.h" #include "google/protobuf/hpb/ptr.h" -#include "google/protobuf/hpb/repeated_field.h" #include "google/protobuf/hpb/requires.h" -#include "upb/mem/arena.h" #include "upb/mem/arena.hpp" namespace { using ::hpb::internal::Requires; +using ::hpb_unittest::protos::Child; using ::hpb_unittest::protos::ChildModel1; -using ::hpb_unittest::protos::container_ext; -using ::hpb_unittest::protos::ContainerExtension; -using ::hpb_unittest::protos::other_ext; +using ::hpb_unittest::protos::Parent; +using ::hpb_unittest::protos::ParentWithMap; +using ::hpb_unittest::protos::ParentWithRepeated; using ::hpb_unittest::protos::RED; using ::hpb_unittest::protos::TestEnum; using ::hpb_unittest::protos::TestModel; @@ -44,9 +42,6 @@ using ::hpb_unittest::protos::TestModel_Category; using ::hpb_unittest::protos::TestModel_Category_IMAGES; using ::hpb_unittest::protos::TestModel_Category_NEWS; using ::hpb_unittest::protos::TestModel_Category_VIDEO; -using ::hpb_unittest::protos::theme; -using ::hpb_unittest::protos::ThemeExtension; -using ::testing::ElementsAre; TEST(CppGeneratedCode, Constructor) { TestModel test_model; } @@ -333,298 +328,6 @@ TEST(CppGeneratedCode, NestedMessages) { EXPECT_EQ(true, mutable_nested_child->has_nested_child_name()); } -TEST(CppGeneratedCode, RepeatedMessages) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.child_models_size()); - // Should be able to clear repeated field when empty. - test_model.mutable_child_models()->clear(); - EXPECT_EQ(0, test_model.child_models_size()); - // Add 2 children. - auto new_child = test_model.add_child_models(); - EXPECT_EQ(true, new_child.ok()); - new_child.value()->set_child_str1(kTestStr1); - new_child = test_model.add_child_models(); - EXPECT_EQ(true, new_child.ok()); - new_child.value()->set_child_str1(kTestStr2); - EXPECT_EQ(2, test_model.child_models_size()); - // Mutable access. - auto mutable_first = test_model.mutable_child_models(0); - EXPECT_EQ(mutable_first->child_str1(), kTestStr1); - mutable_first->set_child_str1("change1"); - auto mutable_second = test_model.mutable_child_models(1); - EXPECT_EQ(mutable_second->child_str1(), kTestStr2); - mutable_second->set_child_str1("change2"); - // Check mutations using views. - auto view_first = test_model.child_models(0); - EXPECT_EQ(view_first->child_str1(), "change1"); - auto view_second = test_model.child_models(1); - EXPECT_EQ(view_second->child_str1(), "change2"); -} - -TEST(CppGeneratedCode, RepeatedScalar) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.value_array_size()); - // Should be able to clear repeated field when empty. - test_model.mutable_value_array()->clear(); - EXPECT_EQ(0, test_model.value_array_size()); - // Add 2 children. - EXPECT_EQ(true, test_model.add_value_array(5)); - EXPECT_EQ(true, test_model.add_value_array(6)); - EXPECT_EQ(2, test_model.value_array_size()); - EXPECT_EQ(5, test_model.value_array(0)); - EXPECT_EQ(6, test_model.value_array(1)); - EXPECT_EQ(true, test_model.resize_value_array(3)); - EXPECT_EQ(3, test_model.value_array_size()); - test_model.set_value_array(2, 7); - EXPECT_EQ(5, test_model.value_array(0)); - EXPECT_EQ(6, test_model.value_array(1)); - EXPECT_EQ(7, test_model.value_array(2)); -} - -TEST(CppGeneratedCode, RepeatedFieldClear) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - test_model.mutable_value_array()->push_back(5); - test_model.mutable_value_array()->push_back(16); - test_model.mutable_value_array()->push_back(27); - ASSERT_EQ(test_model.mutable_value_array()->size(), 3); - test_model.mutable_value_array()->clear(); - EXPECT_EQ(test_model.mutable_value_array()->size(), 0); -} - -TEST(CppGeneratedCode, RepeatedFieldProxyForScalars) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.value_array().size()); - EXPECT_EQ(0, test_model.mutable_value_array()->size()); - - test_model.mutable_value_array()->push_back(5); - test_model.mutable_value_array()->push_back(16); - test_model.mutable_value_array()->push_back(27); - - ASSERT_EQ(test_model.mutable_value_array()->size(), 3); - EXPECT_EQ((*test_model.mutable_value_array())[0], 5); - EXPECT_EQ((*test_model.mutable_value_array())[1], 16); - EXPECT_EQ((*test_model.mutable_value_array())[2], 27); - - const auto value_array = test_model.value_array(); - ASSERT_EQ(value_array.size(), 3); - EXPECT_EQ(value_array[0], 5); - EXPECT_EQ(value_array[1], 16); - EXPECT_EQ(value_array[2], 27); - - EXPECT_THAT(value_array, ElementsAre(5, 16, 27)); - - EXPECT_THAT(std::vector(value_array.begin(), value_array.end()), - ElementsAre(5, 16, 27)); - EXPECT_THAT(std::vector(value_array.cbegin(), value_array.cend()), - ElementsAre(5, 16, 27)); - EXPECT_THAT(std::vector(value_array.rbegin(), value_array.rend()), - ElementsAre(27, 16, 5)); - EXPECT_THAT(std::vector(value_array.crbegin(), value_array.crend()), - ElementsAre(27, 16, 5)); -} - -TEST(CppGeneratedCode, RepeatedScalarIterator) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - test_model.mutable_value_array()->push_back(5); - test_model.mutable_value_array()->push_back(16); - test_model.mutable_value_array()->push_back(27); - int sum = 0; - // Access by value. - const ::hpb::RepeatedField<int32_t>::CProxy rep1 = test_model.value_array(); - for (auto i : rep1) { - sum += i; - } - EXPECT_EQ(sum, 5 + 16 + 27); - // Access by const reference. - sum = 0; - for (const auto& i : *test_model.mutable_value_array()) { - sum += i; - } - EXPECT_EQ(sum, 5 + 16 + 27); - // Access by forwarding reference. - sum = 0; - for (auto&& i : *test_model.mutable_value_array()) { - sum += i; - } - EXPECT_EQ(sum, 5 + 16 + 27); - // Test iterator operators. - auto begin = test_model.value_array().begin(); - auto end = test_model.value_array().end(); - sum = 0; - for (auto it = begin; it != end; ++it) { - sum += *it; - } - EXPECT_EQ(sum, 5 + 16 + 27); - auto it = begin; - ++it; - EXPECT_TRUE(begin < it); - EXPECT_TRUE(begin <= it); - it = end; - EXPECT_TRUE(it == end); - EXPECT_TRUE(it > begin); - EXPECT_TRUE(it >= begin); - EXPECT_TRUE(it != begin); - // difference type - it = end; - --it; - --it; - EXPECT_EQ(end - it, 2); - it = begin; - EXPECT_EQ(it[0], 5); - EXPECT_EQ(it[1], 16); - EXPECT_EQ(it[2], 27); - // ValueProxy. - sum = 0; - for (::hpb::RepeatedField<int32_t>::ValueCProxy c : - test_model.value_array()) { - sum += c; - } - EXPECT_EQ(sum, 5 + 16 + 27); - sum = 0; - for (::hpb::RepeatedField<int32_t>::ValueProxy c : - *test_model.mutable_value_array()) { - sum += c; - } - EXPECT_EQ(sum, 5 + 16 + 27); -} - -TEST(CppGeneratedCode, RepeatedFieldProxyForStrings) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.repeated_string().size()); - EXPECT_EQ(0, test_model.mutable_repeated_string()->size()); - - test_model.mutable_repeated_string()->push_back("a"); - test_model.mutable_repeated_string()->push_back("b"); - test_model.mutable_repeated_string()->push_back("c"); - - ASSERT_EQ(test_model.repeated_string().size(), 3); - EXPECT_EQ(test_model.repeated_string()[0], "a"); - EXPECT_EQ(test_model.repeated_string()[1], "b"); - EXPECT_EQ(test_model.repeated_string()[2], "c"); - - EXPECT_THAT(test_model.repeated_string(), ElementsAre("a", "b", "c")); - EXPECT_THAT(*test_model.mutable_repeated_string(), - ElementsAre("a", "b", "c")); - - ASSERT_EQ(test_model.mutable_repeated_string()->size(), 3); - EXPECT_EQ((*test_model.mutable_repeated_string())[0], "a"); - EXPECT_EQ((*test_model.mutable_repeated_string())[1], "b"); - EXPECT_EQ((*test_model.mutable_repeated_string())[2], "c"); - - // The const accessor can't be used to modify the element - EXPECT_FALSE((std::is_assignable<decltype(test_model.repeated_string()[1]), - absl::string_view>::value)); - // But the mutable one is fine. - (*test_model.mutable_repeated_string())[1] = "other"; - EXPECT_THAT(test_model.repeated_string(), ElementsAre("a", "other", "c")); - - test_model.mutable_repeated_string()->clear(); - EXPECT_EQ(test_model.mutable_repeated_string()->size(), 0); -} - -TEST(CppGeneratedCode, RepeatedFieldProxyForMessages) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.child_models().size()); - ChildModel1 child1; - child1.set_child_str1(kTestStr1); - test_model.mutable_child_models()->push_back(child1); - ChildModel1 child2; - child2.set_child_str1(kTestStr2); - test_model.mutable_child_models()->push_back(std::move(child2)); - - int i = 0; - for (auto child : test_model.child_models()) { - EXPECT_FALSE(Requires<decltype(child)>( - [](auto&& x) -> decltype(x.set_child_str1("")) {})); - if (i++ == 0) { - EXPECT_EQ(child.child_str1(), kTestStr1); - } else { - EXPECT_EQ(child.child_str1(), kTestStr2); - } - } - - i = 0; - for (const auto& child : *test_model.mutable_child_models()) { - if (i++ == 0) { - EXPECT_EQ(child.child_str1(), kTestStr1); - } else { - EXPECT_EQ(child.child_str1(), kTestStr2); - } - } - - using testing::_; - EXPECT_THAT(test_model.child_models(), ElementsAre(_, _)); - - EXPECT_EQ(test_model.child_models().size(), 2); - EXPECT_EQ(test_model.child_models()[0].child_str1(), kTestStr1); - EXPECT_EQ(test_model.child_models()[1].child_str1(), kTestStr2); - EXPECT_EQ((*test_model.mutable_child_models())[0].child_str1(), kTestStr1); - EXPECT_EQ((*test_model.mutable_child_models())[1].child_str1(), kTestStr2); - (*test_model.mutable_child_models())[0].set_child_str1("change1"); - EXPECT_EQ((*test_model.mutable_child_models())[0].child_str1(), "change1"); - test_model.mutable_child_models()->clear(); - EXPECT_EQ(test_model.mutable_child_models()->size(), 0); -} - -TEST(CppGeneratedCode, EmptyRepeatedFieldProxyForMessages) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.child_models().size()); - ChildModel1 child1; - child1.set_child_str1(kTestStr1); - - EXPECT_EQ(test_model.child_models().size(), 0); - EXPECT_EQ(std::distance(test_model.child_models().begin(), - test_model.child_models().end()), - 0); -} - -TEST(CppGeneratedCode, RepeatedFieldProxyForMessagesIndexOperator) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.child_models().size()); - ChildModel1 child1; - child1.set_child_str1(kTestStr1); - test_model.mutable_child_models()->push_back(child1); - ChildModel1 child2; - - child2.set_child_str1(kTestStr2); - test_model.mutable_child_models()->push_back(std::move(child2)); - ASSERT_EQ(test_model.child_models().size(), 2); - - // test_model.child_models()[0].set_child_str1("change1"); - (*test_model.mutable_child_models())[0].set_child_str1("change1"); - EXPECT_EQ((*test_model.mutable_child_models())[0].child_str1(), "change1"); -} - -TEST(CppGeneratedCode, RepeatedStrings) { - ::hpb::Arena arena; - auto test_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_EQ(0, test_model.repeated_string_size()); - // Should be able to clear repeated field when empty. - test_model.mutable_repeated_string()->clear(); - EXPECT_EQ(0, test_model.repeated_string_size()); - // Add 2 children. - EXPECT_EQ(true, test_model.add_repeated_string("Hello")); - EXPECT_EQ(true, test_model.add_repeated_string("World")); - EXPECT_EQ(2, test_model.repeated_string_size()); - EXPECT_EQ("Hello", test_model.repeated_string(0)); - EXPECT_EQ("World", test_model.repeated_string(1)); - EXPECT_EQ(true, test_model.resize_repeated_string(3)); - EXPECT_EQ(3, test_model.repeated_string_size()); - test_model.set_repeated_string(2, "Test"); - EXPECT_EQ("Hello", test_model.repeated_string(0)); - EXPECT_EQ("World", test_model.repeated_string(1)); - EXPECT_EQ("Test", test_model.repeated_string(2)); -} - TEST(CppGeneratedCode, MessageMapInt32KeyMessageValue) { const int key_test_value = 3; ::hpb::Arena arena; @@ -648,6 +351,23 @@ TEST(CppGeneratedCode, MessageMapInt32KeyMessageValue) { EXPECT_EQ(false, map_result_after_delete.ok()); } +TEST(CppGeneratedCode, MapMutableValue) { + constexpr int key = 1; + hpb::Arena arena; + auto msg = hpb::CreateMessage<ParentWithMap>(arena); + auto child = hpb::CreateMessage<Child>(arena); + child.set_peeps(12); + msg.set_child_map(key, child); + auto const_map_result = msg.get_child_map(key); + EXPECT_EQ(true, const_map_result.ok()); + EXPECT_EQ(12, const_map_result.value()->peeps()); + + auto mut_map_result = msg.get_mutable_child_map(key); + EXPECT_EQ(true, mut_map_result.ok()); + mut_map_result.value()->set_peeps(9001); + EXPECT_EQ(9001, mut_map_result.value()->peeps()); +} + TEST(CppGeneratedCode, MessageMapStringKeyAndStringValue) { ::hpb::Arena arena; auto test_model = ::hpb::CreateMessage<TestModel>(arena); @@ -682,207 +402,6 @@ TEST(CppGeneratedCode, MessageMapStringKeyAndInt32Value) { EXPECT_EQ(false, result_after_delete.ok()); } -TEST(CppGeneratedCode, HasExtension) { - TestModel model; - EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); -} - -TEST(CppGeneratedCode, HasExtensionPtr) { - TestModel model; - EXPECT_EQ(false, ::hpb::HasExtension(model.recursive_child(), theme)); -} - -TEST(CppGeneratedCode, ClearExtensionWithEmptyExtension) { - TestModel model; - EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); - ::hpb::ClearExtension(&model, theme); - EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); -} - -TEST(CppGeneratedCode, ClearExtensionWithEmptyExtensionPtr) { - TestModel model; - ::hpb::Ptr<TestModel> recursive_child = model.mutable_recursive_child(); - ::hpb::ClearExtension(recursive_child, theme); - EXPECT_EQ(false, ::hpb::HasExtension(recursive_child, theme)); -} - -TEST(CppGeneratedCode, SetExtension) { - TestModel model; - void* prior_message; - { - // Use a nested scope to make sure the arenas are fused correctly. - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - prior_message = hpb::interop::upb::GetMessage(&extension1); - EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); - EXPECT_EQ(true, - ::hpb::SetExtension(&model, theme, std::move(extension1)).ok()); - } - EXPECT_EQ(true, ::hpb::HasExtension(&model, theme)); - auto ext = hpb::GetExtension(&model, theme); - EXPECT_TRUE(ext.ok()); - EXPECT_EQ(hpb::interop::upb::GetMessage(*ext), prior_message); -} - -TEST(CppGeneratedCode, SetExtensionWithPtr) { - ::hpb::Arena arena_model; - ::hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena_model); - void* prior_message; - { - // Use a nested scope to make sure the arenas are fused correctly. - ::hpb::Arena arena; - ::hpb::Ptr<ThemeExtension> extension1 = - ::hpb::CreateMessage<ThemeExtension>(arena); - extension1->set_ext_name("Hello World"); - prior_message = hpb::interop::upb::GetMessage(extension1); - EXPECT_EQ(false, ::hpb::HasExtension(model, theme)); - auto res = ::hpb::SetExtension(model, theme, extension1); - EXPECT_EQ(true, res.ok()); - } - EXPECT_EQ(true, ::hpb::HasExtension(model, theme)); - auto ext = hpb::GetExtension(model, theme); - EXPECT_TRUE(ext.ok()); - EXPECT_NE(hpb::interop::upb::GetMessage(*ext), prior_message); -} - -#ifndef _MSC_VER -TEST(CppGeneratedCode, SetExtensionShouldNotCompileForWrongType) { - ::hpb::Arena arena; - ::hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena); - ThemeExtension extension1; - ContainerExtension extension2; - - const auto canSetExtension = [&](auto l) { - return Requires<decltype(model)>(l); - }; - EXPECT_TRUE(canSetExtension( - [](auto p) -> decltype(::hpb::SetExtension(p, theme, extension1)) {})); - // Wrong extension value type should fail to compile. - EXPECT_TRUE(!canSetExtension( - [](auto p) -> decltype(::hpb::SetExtension(p, theme, extension2)) {})); - // Wrong extension id with correct extension type should fail to compile. - EXPECT_TRUE( - !canSetExtension([](auto p) -> decltype(::hpb::SetExtension( - p, container_ext, extension1)) {})); -} -#endif - -TEST(CppGeneratedCode, SetExtensionWithPtrSameArena) { - ::hpb::Arena arena; - ::hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena); - void* prior_message; - { - // Use a nested scope to make sure the arenas are fused correctly. - ::hpb::Ptr<ThemeExtension> extension1 = - ::hpb::CreateMessage<ThemeExtension>(arena); - extension1->set_ext_name("Hello World"); - prior_message = hpb::interop::upb::GetMessage(extension1); - EXPECT_EQ(false, ::hpb::HasExtension(model, theme)); - auto res = ::hpb::SetExtension(model, theme, extension1); - EXPECT_EQ(true, res.ok()); - } - EXPECT_EQ(true, ::hpb::HasExtension(model, theme)); - auto ext = hpb::GetExtension(model, theme); - EXPECT_TRUE(ext.ok()); - EXPECT_NE(hpb::interop::upb::GetMessage(*ext), prior_message); -} - -TEST(CppGeneratedCode, SetExtensionFusingFailureShouldCopy) { - // Use an initial block to disallow fusing. - char initial_block[1000]; - hpb::Arena arena(initial_block, sizeof(initial_block)); - - hpb::Ptr<TestModel> model = ::hpb::CreateMessage<TestModel>(arena); - - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - ASSERT_FALSE( - upb_Arena_Fuse(arena.ptr(), hpb::interop::upb::GetArena(&extension1))); - EXPECT_FALSE(::hpb::HasExtension(model, theme)); - auto status = ::hpb::SetExtension(model, theme, std::move(extension1)); - EXPECT_TRUE(status.ok()); - EXPECT_TRUE(::hpb::HasExtension(model, theme)); - EXPECT_TRUE(hpb::GetExtension(model, theme).ok()); -} - -TEST(CppGeneratedCode, SetExtensionShouldClone) { - TestModel model; - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); - EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); - extension1.set_ext_name("Goodbye"); - EXPECT_EQ(true, ::hpb::HasExtension(&model, theme)); - auto ext = hpb::GetExtension(&model, theme); - EXPECT_TRUE(ext.ok()); - EXPECT_EQ((*ext)->ext_name(), "Hello World"); -} - -TEST(CppGeneratedCode, SetExtensionShouldCloneConst) { - TestModel model; - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); - EXPECT_EQ(true, - ::hpb::SetExtension(&model, theme, std::as_const(extension1)).ok()); - extension1.set_ext_name("Goodbye"); - EXPECT_EQ(true, ::hpb::HasExtension(&model, theme)); - auto ext = hpb::GetExtension(&model, theme); - EXPECT_TRUE(ext.ok()); - EXPECT_EQ((*ext)->ext_name(), "Hello World"); -} - -TEST(CppGeneratedCode, SetExtensionOnMutableChild) { - TestModel model; - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - EXPECT_EQ(false, ::hpb::HasExtension(model.mutable_recursive_child(), theme)); - EXPECT_EQ(true, ::hpb::SetExtension(model.mutable_recursive_child(), theme, - extension1) - .ok()); - EXPECT_EQ(true, ::hpb::HasExtension(model.mutable_recursive_child(), theme)); -} - -TEST(CppGeneratedCode, GetExtension) { - TestModel model; - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - EXPECT_EQ(false, ::hpb::HasExtension(&model, theme)); - EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); - EXPECT_EQ("Hello World", - hpb::GetExtension(&model, theme).value()->ext_name()); -} - -TEST(CppGeneratedCode, GetExtensionOnMutableChild) { - TestModel model; - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - ::hpb::Ptr<TestModel> mutable_recursive_child = - model.mutable_recursive_child(); - EXPECT_EQ(false, ::hpb::HasExtension(mutable_recursive_child, theme)); - EXPECT_EQ( - true, - ::hpb::SetExtension(mutable_recursive_child, theme, extension1).ok()); - EXPECT_EQ( - "Hello World", - hpb::GetExtension(mutable_recursive_child, theme).value()->ext_name()); -} - -TEST(CppGeneratedCode, GetExtensionOnImmutableChild) { - TestModel model; - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - ::hpb::Ptr<TestModel> mutable_recursive_child = - model.mutable_recursive_child(); - EXPECT_EQ(false, ::hpb::HasExtension(mutable_recursive_child, theme)); - EXPECT_EQ( - true, - ::hpb::SetExtension(mutable_recursive_child, theme, extension1).ok()); - ::hpb::Ptr<const TestModel> recursive_child = model.recursive_child(); - EXPECT_EQ("Hello World", - hpb::GetExtension(recursive_child, theme).value()->ext_name()); -} - TEST(CppGeneratedCode, SerializeUsingArena) { TestModel model; model.set_str1("Hello World"); @@ -916,64 +435,6 @@ TEST(CppGeneratedCode, SerializeNestedMessageUsingArena) { EXPECT_EQ("Hello World", parsed_model.str1()); } -TEST(CppGeneratedCode, Parse) { - TestModel model; - model.set_str1("Test123"); - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); - ::upb::Arena arena; - auto bytes = ::hpb::Serialize(&model, arena); - EXPECT_EQ(true, bytes.ok()); - TestModel parsed_model = ::hpb::Parse<TestModel>(bytes.value()).value(); - EXPECT_EQ("Test123", parsed_model.str1()); - EXPECT_EQ(true, hpb::GetExtension(&parsed_model, theme).ok()); -} - -TEST(CppGeneratedCode, ParseIntoPtrToModel) { - TestModel model; - model.set_str1("Test123"); - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); - ::upb::Arena arena; - auto bytes = ::hpb::Serialize(&model, arena); - EXPECT_EQ(true, bytes.ok()); - ::hpb::Ptr<TestModel> parsed_model = ::hpb::CreateMessage<TestModel>(arena); - EXPECT_TRUE(::hpb::Parse(parsed_model, bytes.value())); - EXPECT_EQ("Test123", parsed_model->str1()); - // Should return an extension even if we don't pass ExtensionRegistry - // by promoting unknown. - EXPECT_EQ(true, hpb::GetExtension(parsed_model, theme).ok()); -} - -TEST(CppGeneratedCode, ParseWithExtensionRegistry) { - TestModel model; - model.set_str1("Test123"); - ThemeExtension extension1; - extension1.set_ext_name("Hello World"); - EXPECT_EQ(true, ::hpb::SetExtension(&model, theme, extension1).ok()); - EXPECT_EQ(true, ::hpb::SetExtension(&model, ThemeExtension::theme_extension, - extension1) - .ok()); - ::upb::Arena arena; - auto bytes = ::hpb::Serialize(&model, arena); - EXPECT_EQ(true, bytes.ok()); - ::hpb::ExtensionRegistry extensions( - {&theme, &other_ext, &ThemeExtension::theme_extension}, arena); - TestModel parsed_model = - ::hpb::Parse<TestModel>(bytes.value(), extensions).value(); - EXPECT_EQ("Test123", parsed_model.str1()); - EXPECT_EQ(true, hpb::GetExtension(&parsed_model, theme).ok()); - EXPECT_EQ( - true, - hpb::GetExtension(&parsed_model, ThemeExtension::theme_extension).ok()); - EXPECT_EQ("Hello World", - hpb::GetExtension(&parsed_model, ThemeExtension::theme_extension) - .value() - ->ext_name()); -} - TEST(CppGeneratedCode, NameCollisions) { TestModel model; model.set_template_("test"); @@ -1115,41 +576,6 @@ TEST(CppGeneratedCode, PtrImplicitConversion) { EXPECT_EQ(model_ptr->int64(), 5); } -TEST(CppGeneratedCode, ClearSubMessage) { - // Fill model. - TestModel model; - model.set_int64(5); - auto new_child = model.mutable_child_model_1(); - new_child->set_child_str1("text in child"); - ThemeExtension extension1; - extension1.set_ext_name("name in extension"); - EXPECT_TRUE(::hpb::SetExtension(&model, theme, extension1).ok()); - EXPECT_TRUE(model.mutable_child_model_1()->has_child_str1()); - // Clear using Ptr<T> - ::hpb::ClearMessage(model.mutable_child_model_1()); - EXPECT_FALSE(model.mutable_child_model_1()->has_child_str1()); -} - -TEST(CppGeneratedCode, ClearMessage) { - // Fill model. - TestModel model; - model.set_int64(5); - model.set_str2("Hello"); - auto new_child = model.add_child_models(); - ASSERT_TRUE(new_child.ok()); - new_child.value()->set_child_str1("text in child"); - ThemeExtension extension1; - extension1.set_ext_name("name in extension"); - EXPECT_TRUE(::hpb::SetExtension(&model, theme, extension1).ok()); - // Clear using T* - ::hpb::ClearMessage(&model); - // Verify that scalars, repeated fields and extensions are cleared. - EXPECT_FALSE(model.has_int64()); - EXPECT_FALSE(model.has_str2()); - EXPECT_TRUE(model.child_models().empty()); - EXPECT_FALSE(::hpb::HasExtension(&model, theme)); -} - TEST(CppGeneratedCode, CanInvokeClearMessageWithPtr) { // Fill model. TestModel model; @@ -1188,60 +614,125 @@ TEST(CppGeneratedCode, CannotInvokeClearMessageWithConstRawPtr) { EXPECT_FALSE(CanCallClearMessage<const TestModel*>()); } -TEST(CppGeneratedCode, DeepCopy) { - // Fill model. - TestModel model; - model.set_int64(5); - model.set_str2("Hello"); - auto new_child = model.add_child_models(); - ASSERT_TRUE(new_child.ok()); - new_child.value()->set_child_str1("text in child"); - ThemeExtension extension1; - extension1.set_ext_name("name in extension"); - EXPECT_TRUE(::hpb::SetExtension(&model, theme, extension1).ok()); - TestModel target; - target.set_b1(true); - ::hpb::DeepCopy(&model, &target); - EXPECT_FALSE(target.b1()) << "Target was not cleared before copying content "; - EXPECT_EQ(target.str2(), "Hello"); - EXPECT_TRUE(::hpb::HasExtension(&target, theme)); -} - -TEST(CppGeneratedCode, HasExtensionAndRegistry) { - // Fill model. - TestModel source; - source.set_int64(5); - source.set_str2("Hello"); - auto new_child = source.add_child_models(); - ASSERT_TRUE(new_child.ok()); - new_child.value()->set_child_str1("text in child"); - ThemeExtension extension1; - extension1.set_ext_name("name in extension"); - ASSERT_TRUE(::hpb::SetExtension(&source, theme, extension1).ok()); - - // Now that we have a source model with extension data, serialize. - ::hpb::Arena arena; - std::string data = std::string(::hpb::Serialize(&source, arena).value()); - - // Test with ExtensionRegistry - ::hpb::ExtensionRegistry extensions({&theme}, arena); - TestModel parsed_model = ::hpb::Parse<TestModel>(data, extensions).value(); - EXPECT_TRUE(::hpb::HasExtension(&parsed_model, theme)); -} - TEST(CppGeneratedCode, FieldNumberConstants) { static_assert(TestModel::kChildMapFieldNumber == 225); EXPECT_EQ(225, TestModel::kChildMapFieldNumber); } -TEST(CppGeneratedCode, ExtensionFieldNumberConstant) { - EXPECT_EQ(12003, ::hpb::ExtensionNumber(ThemeExtension::theme_extension)); -} - TEST(CppGeneratedCode, ClearConstMessageShouldFailForConstChild) { TestModel model; EXPECT_FALSE(CanCallClearMessage<decltype(model.child_model_1())>()); EXPECT_TRUE(CanCallClearMessage<decltype(model.mutable_child_model_1())>()); } +TEST(CppGeneratedCode, CloneMessage) { + hpb::Arena arena; + TestModel model; + model.set_str1("Hello World"); + auto ptr = hpb::Ptr<TestModel>(&model); + hpb::Ptr<TestModel> cloned_model = hpb::CloneMessage(ptr, arena); + EXPECT_EQ(cloned_model->str1(), "Hello World"); +} + +TEST(CppGeneratedCode, SetAlias) { + hpb::Arena arena; + auto child = hpb::CreateMessage<Child>(arena); + child.set_peeps(12); + auto parent1 = hpb::CreateMessage<Parent>(arena); + auto parent2 = hpb::CreateMessage<Parent>(arena); + parent1.set_alias_child(child); + parent2.set_alias_child(child); + + ASSERT_EQ(parent1.child()->peeps(), parent2.child()->peeps()); + ASSERT_EQ(hpb::interop::upb::GetMessage(parent1.child()), + hpb::interop::upb::GetMessage(parent2.child())); + auto childPtr = hpb::Ptr<Child>(child); + ASSERT_EQ(hpb::interop::upb::GetMessage(childPtr), + hpb::interop::upb::GetMessage(parent1.child())); +} + +TEST(CppGeneratedCode, SetAliasFieldsOutofOrder) { + hpb::Arena arena; + auto child = hpb::CreateMessage<Child>(arena); + child.set_peeps(12); + auto parent1 = hpb::CreateMessage<Parent>(arena); + auto parent2 = hpb::CreateMessage<Parent>(arena); + parent1.set_alias_child(child); + parent2.set_alias_child(child); + ASSERT_EQ(parent1.child()->peeps(), parent2.child()->peeps()); + ASSERT_EQ(parent1.child()->peeps(), 12); +} + +TEST(CppGeneratedCode, SetAliasFailsForDifferentArena) { + hpb::Arena arena; + auto child = hpb::CreateMessage<Child>(arena); + hpb::Arena different_arena; + auto parent = hpb::CreateMessage<Parent>(different_arena); + EXPECT_DEATH(parent.set_alias_child(child), "hpb::interop::upb::GetArena"); +} + +TEST(CppGeneratedCode, SetAliasSucceedsForDifferentArenaFused) { + hpb::Arena arena; + auto parent1 = hpb::CreateMessage<Parent>(arena); + auto child = parent1.mutable_child(); + child->set_peeps(12); + + hpb::Arena other_arena; + auto parent2 = hpb::CreateMessage<Parent>(other_arena); + arena.Fuse(other_arena); + + parent2.set_alias_child(child); + + ASSERT_EQ(parent1.child()->peeps(), parent2.child()->peeps()); + ASSERT_EQ(hpb::interop::upb::GetMessage(parent1.child()), + hpb::interop::upb::GetMessage(parent2.child())); + auto childPtr = hpb::Ptr<Child>(child); + ASSERT_EQ(hpb::interop::upb::GetMessage(childPtr), + hpb::interop::upb::GetMessage(parent1.child())); +} + +TEST(CppGeneratedCode, SetAliasRepeated) { + hpb::Arena arena; + auto child = hpb::CreateMessage<Child>(arena); + child.set_peeps(1611); + auto parent1 = hpb::CreateMessage<ParentWithRepeated>(arena); + auto parent2 = hpb::CreateMessage<ParentWithRepeated>(arena); + parent1.add_alias_children(child); + parent2.add_alias_children(child); + + ASSERT_EQ(parent1.children(0)->peeps(), parent2.children(0)->peeps()); + ASSERT_EQ(hpb::interop::upb::GetMessage(parent1.children(0)), + hpb::interop::upb::GetMessage(parent2.children(0))); + auto childPtr = hpb::Ptr<Child>(child); + ASSERT_EQ(hpb::interop::upb::GetMessage(childPtr), + hpb::interop::upb::GetMessage(parent1.children(0))); +} + +TEST(CppGeneratedCode, SetAliasRepeatedFailsForDifferentArena) { + hpb::Arena arena; + auto child = hpb::CreateMessage<Child>(arena); + hpb::Arena different_arena; + auto parent = hpb::CreateMessage<ParentWithRepeated>(different_arena); + EXPECT_DEATH(parent.add_alias_children(child), "hpb::interop::upb::GetArena"); +} + +TEST(CppGeneratedCode, SetAliasMap) { + hpb::Arena arena; + auto parent1 = hpb::CreateMessage<ParentWithMap>(arena); + auto parent2 = hpb::CreateMessage<ParentWithMap>(arena); + + auto child = hpb::CreateMessage<Child>(arena); + + constexpr int key = 1; + parent1.set_alias_child_map(key, child); + parent2.set_alias_child_map(key, child); + auto c1 = parent1.get_child_map(key); + auto c2 = parent2.get_child_map(key); + + EXPECT_TRUE(c1.ok()); + EXPECT_TRUE(c2.ok()); + ASSERT_EQ(hpb::interop::upb::GetMessage(c1.value()), + hpb::interop::upb::GetMessage(c2.value())); +} + } // namespace diff --git a/third_party/protobuf/hpb_generator/tests/test_hpb_bzl_alias.cc b/third_party/protobuf/hpb_generator/tests/test_hpb_bzl_alias.cc new file mode 100644 index 0000000000000..399c8ba286a06 --- /dev/null +++ b/third_party/protobuf/hpb_generator/tests/test_hpb_bzl_alias.cc @@ -0,0 +1,22 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include <gtest/gtest.h> +#include "google/protobuf/compiler/hpb/tests/set_alias.upb.proto.h" +#include "google/protobuf/hpb/arena.h" +#include "google/protobuf/hpb/hpb.h" + +namespace { +using hpb_unittest::protos::Child; + +TEST(BzlCode, CheckBzlAlias) { + hpb::Arena arena; + auto child = hpb::CreateMessage<Child>(arena); + child.set_peeps(12); + ASSERT_EQ(child.peeps(), 12); +} +} // namespace diff --git a/third_party/protobuf/hpb_generator/tests/test_model.proto b/third_party/protobuf/hpb_generator/tests/test_model.proto index 8a5401b6b7841..434b3d8aaeabb 100644 --- a/third_party/protobuf/hpb_generator/tests/test_model.proto +++ b/third_party/protobuf/hpb_generator/tests/test_model.proto @@ -5,74 +5,88 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; package hpb_unittest; import "google/protobuf/compiler/hpb/tests/child_model.proto"; +option features.enum_type = CLOSED; +option features.repeated_field_encoding = EXPANDED; +option features.utf8_validation = NONE; + message TestModelContainer { repeated TestModel models = 1; - optional ChildModel3 proto_3_child = 2; + ChildModel3 proto_3_child = 2; + extensions 10000 to max [verification = UNVERIFIED]; } message TestModel { - optional int32 value = 1; + int32 value = 1; repeated int32 value_array = 2; // _UPB_MODE_ARRAY repeated int32 value_packed_array = 3 - [packed = true]; // _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED + [features.repeated_field_encoding = + PACKED]; // _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED + repeated int32 value_deprec = 4 [deprecated = true]; - optional string str1 = 115; - optional bool b1 = 9; - optional bool b2 = 10; - optional string str2 = 50; - optional string str3 = 11; - optional float optional_float = 14; - optional double optional_double = 15; - optional int64 optional_int64 = 16; - optional uint32 optional_uint32 = 17; - optional uint64 optional_uint64 = 18; - optional sint32 optional_sint32 = 19; - optional sint64 optional_sint64 = 20; - optional fixed32 optional_fixed32 = 21; - optional fixed64 optional_fixed64 = 22; - optional sfixed32 optional_sfixed32 = 23; - optional sfixed64 optional_sfixed64 = 24; + + string str1 = 115; + bool b1 = 9; + bool b2 = 10; + string str2 = 50; + string str3 = 11; + float optional_float = 14; + double optional_double = 15; + int64 optional_int64 = 16; + uint32 optional_uint32 = 17; + uint64 optional_uint64 = 18; + sint32 optional_sint32 = 19; + sint64 optional_sint64 = 20; + fixed32 optional_fixed32 = 21; + fixed64 optional_fixed64 = 22; + sfixed32 optional_sfixed32 = 23; + sfixed64 optional_sfixed64 = 24; repeated int64 repeated_int64 = 25; repeated uint64 repeated_uint64 = 26; repeated fixed64 repeated_fixed64 = 27; repeated sfixed64 repeated_sfixed64 = 28; repeated bool repeated_bool = 29; repeated string repeated_string = 35; - optional bytes optional_bytes = 36; + bytes optional_bytes = 36; + message NestedChild { - optional string nested_child_name = 211; + string nested_child_name = 211; } - optional NestedChild nested_child_1 = 212; - optional ChildModel1 child_model_1 = 222; + + NestedChild nested_child_1 = 212; + ChildModel1 child_model_1 = 222; repeated ChildModel1 child_models = 223; - optional ChildModel1 bar = 224; + ChildModel1 bar = 224; + oneof child_oneof1 { string oneof_member1 = 98; bool oneof_member2 = 99; } - optional int32 int_value_with_default = 31 - [default = 65]; // Not supported yet - optional string string_value_with_default = 32 + + int32 int_value_with_default = 31 [default = 65]; // Not supported yet + + string string_value_with_default = 32 [default = "hello"]; // Not supported yet - optional float float_value_with_default = 33 [default = inf]; - optional float double_value_with_default = 34 [default = -inf]; + + float float_value_with_default = 33 [default = inf]; + + float double_value_with_default = 34 [default = -inf]; map<int32, ChildModel1> child_map = 225; - optional TestModel recursive_child = 226; + TestModel recursive_child = 226; map<string, ChildModel1> child_str_map = 227; map<string, int32> str_to_int_map = 228; map<string, string> str_to_str_map = 229; extend TestAnnotation { - optional OtherExtension in_message_ext = 15000; + OtherExtension in_message_ext = 15000; } enum Category { @@ -81,7 +95,8 @@ message TestModel { VIDEO = 7; RADIO = 8 [deprecated = true]; } - optional Category category = 37; + + Category category = 37; // keyword collisions (double, template, ...) oneof type { @@ -89,18 +104,18 @@ message TestModel { int64 int64 = 231; double double = 232; } - optional string template = 233; - optional string msg = 234; - optional string arena = 235; + + string template = 233; + string msg = 234; + string arena = 235; // Tests publicly imported enum. - optional TestEnum imported_enum = 238; + TestEnum imported_enum = 238; - optional string phase = 239; - optional bool clear_phase = 240; - - optional string doc_id = 241; - optional bool set_doc_id = 242; + string phase = 239; + bool clear_phase = 240; + string doc_id = 241; + bool set_doc_id = 242; extensions 10000 to max [verification = UNVERIFIED]; @@ -112,13 +127,15 @@ message TestModelContainerV1 { } message TestModelV1 { - optional int32 value = 1; + int32 value = 1; repeated int32 value2 = 2; - repeated int32 value3 = 3 [packed = true]; + repeated int32 value3 = 3 [features.repeated_field_encoding = PACKED]; + repeated int32 value4 = 4 [deprecated = true]; - optional bool b1 = 9; - optional bool b2 = 10; - optional string str2 = 50; + + bool b1 = 9; + bool b2 = 10; + string str2 = 50; } enum PrimaryColors { @@ -130,33 +147,35 @@ enum PrimaryColors { // TestModel extension. message ThemeExtension { extend TestModel { - optional ThemeExtension theme_extension = 12003; + ThemeExtension theme_extension = 12003; } - optional string ext_name = 1; - optional bool ext_bool = 2; + + string ext_name = 1; + bool ext_bool = 2; } extend TestModel { - optional ThemeExtension theme = 12001; + ThemeExtension theme = 12001; } message ContainerExtension { extend TestModelContainer { - optional ContainerExtension container_extension = 12004; + ContainerExtension container_extension = 12004; } - optional string ext_container_name = 1; + + string ext_container_name = 1; } extend TestModelContainer { - optional ContainerExtension container_ext = 12005; + ContainerExtension container_ext = 12005; } message OtherExtension { - optional string ext2_name = 1; + string ext2_name = 1; } extend TestModel { - optional OtherExtension other_ext = 12002; + OtherExtension other_ext = 12002; } message TestAnnotation { @@ -165,7 +184,7 @@ message TestAnnotation { } message TestMessageHasEnum { - optional EnumDeclaredAfterMessage enum_declared_after_message = 1; + EnumDeclaredAfterMessage enum_declared_after_message = 1; } enum EnumDeclaredAfterMessage { diff --git a/third_party/protobuf/java/README.md b/third_party/protobuf/java/README.md index a6d9a6316c5cb..d73d97eb10f70 100644 --- a/third_party/protobuf/java/README.md +++ b/third_party/protobuf/java/README.md @@ -29,7 +29,7 @@ If you are using Maven, use the following: And **replace `<!--version-->` with a version from the [Maven Protocol Buffers Repository](https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java).** -For example, `3.25.3`. +For example, `4.28.2`. Make sure the version number of the runtime matches (or is newer than) the version number of the protoc. @@ -56,8 +56,8 @@ Lite runtime](lite.md). ### Use Java Protocol Buffers with Bazel Bazel has native build rules to work with protobuf. For Java, you can use the -`java_proto_library` rule for server and the `java_lite_proto_library` rule -for Android. Check out [our build files examples](../examples/BUILD) to learn +`java_proto_library` rule for server and the `java_lite_proto_library` rule for +Android. Check out [our build files examples](../examples/BUILD.bazel) to learn how to use them. ## Build from Source @@ -93,49 +93,63 @@ package). 4) Install the classes wherever you prefer. -### Build from Source - With Maven +## Kotlin Protocol Buffers -WARNING: Building from source with Maven is deprecated and will be removed in the 4.28.x release. +This directory also provides support for Kotlin protocol buffers, which are +built on top of Java protocol buffers. Kotlin protocol buffers require a +dependency on Java protocol buffers, and both Java and Kotlin protocol buffer +code must be generated for every proto file. -1) Install Apache Maven if you don't have it: +The main goal of Kotlin protobuf is to provide idiomatic ways to build and read +protocol buffers in Kotlin. Learn more about Kotlin protobufs in our +[documentation](https://protobuf.dev/getting-started/kotlintutorial/). - http://maven.apache.org/ +### Use Kotlin Protocol Buffers -2) Build the C++ code, or obtain a binary distribution of protoc (see - the toplevel [README.md](../README.md)). If you install a binary - distribution, make sure that it is the same version as this package. - If in doubt, run: +To use protobuf in Kotlin, first install the protocol compiler (protoc -- +instructions for installing are in the top-level [README.md](../README.md)) and +use it to generate Java and Kotlin code for your .proto files: - $ protoc --version +``` +$ protoc --java_out=${OUTPUT_DIR} --kotlin_out=${OUTPUT_DIR} path/to/your/proto/file +``` - You will need to place the protoc executable in ../src. (If you - built it yourself, it should already be there.) +Include the generated Java and Kotlin files in your project and add a dependency on the +protobuf Java and Kotlin runtime. -3) Run the tests: +### Maven - $ mvn test +If you are using Maven, use the following: - If some tests fail, this library may not work correctly on your - system. Continue at your own risk. +```xml +<dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <version><!--version--></version> +</dependency> -4) Install the library into your Maven repository: +<dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-kotlin</artifactId> + <version><!--version--></version> +</dependency> +``` - $ mvn install +**Replace `<!--version-->` with a version from the +[Maven Protocol Buffers Repository](https://mvnrepository.com/artifact/com.google.protobuf/protobuf-kotlin),** +such as `4.28.2`. -5) If you do not use Maven to manage your own build, you can build a - .jar file to use: +Make sure the version number of the runtimes match each other and match (or are +newer than) the version number of the protoc. - $ mvn package +### Use Kotlin Protocol Buffers on Android - The .jar will be placed in the "target" directory. - -The above instructions will install 2 maven artifacts: - - * protobuf-java: The core Java Protocol Buffers library. Most users only - need this artifact. - * protobuf-java-util: Utilities to work with protos. It contains JSON support - as well as utilities to work with proto3 well-known - types. +For Android users, it's recommended to use the Java Lite runtime for its smaller +code size. We provide a `protobuf-kotlin-lite` package in Maven and Bazel to +pair with the Java Lite runtime. Use these if you want to use Kotlin on +Android or in another context where you want to use Java Lite. Similar to the +full runtime, `protobuf-kotlin-lite` requires a dependency on +`protobuf-java-lite`. ## Compatibility Notice @@ -177,8 +191,3 @@ The complete documentation for Protocol Buffers is available via the web at: https://developers.google.com/protocol-buffers/ - -## Kotlin Protocol Buffers - -Code to support more idiomatic Kotlin protocol buffers has been added to the -repository, and Kotlin support will be launched in the next numbered release. diff --git a/third_party/protobuf/java/bom/pom.xml b/third_party/protobuf/java/bom/pom.xml index 880b7c97cc1f4..608f245029b97 100644 --- a/third_party/protobuf/java/bom/pom.xml +++ b/third_party/protobuf/java/bom/pom.xml @@ -4,7 +4,7 @@ <groupId>com.google.protobuf</groupId> <artifactId>protobuf-bom</artifactId> - <version>4.29.3</version> + <version>4.30.1</version> <packaging>pom</packaging> <name>Protocol Buffers [BOM]</name> diff --git a/third_party/protobuf/java/core/BUILD.bazel b/third_party/protobuf/java/core/BUILD.bazel index 2d6cf2f8770ec..0698fefcdb739 100644 --- a/third_party/protobuf/java/core/BUILD.bazel +++ b/third_party/protobuf/java/core/BUILD.bazel @@ -141,12 +141,10 @@ internal_gen_well_known_protos_java( # Should be used as `//java/lite`. java_library( name = "lite", - srcs = LITE_SRCS + [ - ":gen_well_known_protos_javalite", - ], - visibility = [ - "//java/lite:__pkg__", - ], + srcs = [":gen_well_known_protos_javalite"], + visibility = ["//java/lite:__pkg__"], + exports = [":lite_runtime_only"], + deps = [":lite_runtime_only"], ) protobuf_versioned_java_library( @@ -182,6 +180,7 @@ protobuf_java_export( protobuf_java_library( name = "lite_runtime_only", srcs = LITE_SRCS, + visibility = ["//java/kotlin:__pkg__"], ) proto_library( @@ -199,7 +198,10 @@ proto_library( cc_proto_library( name = "java_features_cc_proto", - visibility = ["//editions:__pkg__"], + visibility = [ + "//editions:__pkg__", + "//src/google/protobuf/compiler/java:__pkg__", # For java/names.h + ], deps = [":java_features_proto"], ) @@ -443,6 +445,7 @@ junit_tests( ":lite_test_protos_java_proto", ":test_util", "@protobuf_maven//:com_google_guava_guava", + "@protobuf_maven//:com_google_testparameterinjector_test_parameter_injector", "@protobuf_maven//:com_google_truth_truth", "@protobuf_maven//:junit_junit", "@protobuf_maven//:org_mockito_mockito_core", @@ -567,6 +570,7 @@ LITE_TEST_EXCLUSIONS = [ "src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java", "src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java", "src/test/java/com/google/protobuf/UnknownFieldSetTest.java", + "src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java", "src/test/java/com/google/protobuf/WellKnownTypesTest.java", "src/test/java/com/google/protobuf/WireFormatTest.java", ] @@ -621,6 +625,8 @@ junit_tests( "src/test/java/com/google/protobuf/CodedOutputStreamTest.java", "src/test/java/com/google/protobuf/CodedInputStreamTest.java", "src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java", + "src/test/java/com/google/protobuf/FieldPresenceTest.java", + "src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java", # Excluded in core_tests "src/test/java/com/google/protobuf/DecodeUtf8Test.java", "src/test/java/com/google/protobuf/IsValidUtf8Test.java", @@ -670,6 +676,7 @@ junit_tests( "src/test/java/com/google/protobuf/CodedOutputStreamTest.java", "src/test/java/com/google/protobuf/CodedInputStreamTest.java", "src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java", + "src/test/java/com/google/protobuf/FieldPresenceTest.java", # Excluded in core_tests "src/test/java/com/google/protobuf/DecodeUtf8Test.java", "src/test/java/com/google/protobuf/IsValidUtf8Test.java", @@ -706,4 +713,3 @@ pkg_files( strip_prefix = strip_prefix.from_root(""), visibility = ["//java:__pkg__"], ) - diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessage.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessage.java index fbf1518759306..891e422ed69f2 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessage.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessage.java @@ -119,6 +119,17 @@ public abstract class AbstractMessage return memoizedSize; } + /* + * This method will only ever return true if `this` and `other` have the same descriptor instance + * for their type (including a gencode message compared to a `DynamicMessage` constructed using + * the same descriptor instance). + * + * For reasons of backward compatibility, a comparison + * involving `DynamicMessage` that is constructed using semantically the same descriptor which + * was loaded separately (such that the reference identity of the descriptors does not match) will + * always return false even if there is otherwise no skew between the descriptors and the contents + * of the instances. + */ @Override public boolean equals(final Object other) { if (other == this) { diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java index c7816f88ae1c3..a72ae0bb46872 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java @@ -344,8 +344,7 @@ public abstract class AbstractMessageLite< int growth = ((Collection<T>) values).size(); if (list instanceof ArrayList) { ((ArrayList<T>) list).ensureCapacity(list.size() + growth); - } - if (list instanceof ProtobufArrayList) { + } else if (list instanceof ProtobufArrayList) { ((ProtobufArrayList<T>) list).ensureCapacity(list.size() + growth); } } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java index 2b965af9fda27..ea864721ce617 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java @@ -38,7 +38,8 @@ abstract class AbstractProtobufList<E> extends AbstractList<E> implements Protob } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (o == this) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java index 94cbafc8953ff..f6b9b67b548d2 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java @@ -215,10 +215,10 @@ final class ArrayDecoders { } /** Decodes a message value. */ - @SuppressWarnings({"unchecked", "rawtypes"}) - static int decodeMessageField( - Schema schema, byte[] data, int position, int limit, Registers registers) throws IOException { - Object msg = schema.newInstance(); + static <T> int decodeMessageField( + Schema<T> schema, byte[] data, int position, int limit, Registers registers) + throws IOException { + T msg = schema.newInstance(); int offset = mergeMessageField(msg, schema, data, position, limit, registers); schema.makeImmutable(msg); registers.object1 = msg; @@ -226,20 +226,19 @@ final class ArrayDecoders { } /** Decodes a group value. */ - @SuppressWarnings({"unchecked", "rawtypes"}) - static int decodeGroupField( - Schema schema, byte[] data, int position, int limit, int endGroup, Registers registers) + static <T> int decodeGroupField( + Schema<T> schema, byte[] data, int position, int limit, int endGroup, Registers registers) throws IOException { - Object msg = schema.newInstance(); + T msg = schema.newInstance(); int offset = mergeGroupField(msg, schema, data, position, limit, endGroup, registers); schema.makeImmutable(msg); registers.object1 = msg; return offset; } - @SuppressWarnings({"unchecked", "rawtypes"}) - static int mergeMessageField( - Object msg, Schema schema, byte[] data, int position, int limit, Registers registers) + @SuppressWarnings("unchecked") + static <T> int mergeMessageField( + Object msg, Schema<T> schema, byte[] data, int position, int limit, Registers registers) throws IOException { int length = data[position++]; if (length < 0) { @@ -251,16 +250,16 @@ final class ArrayDecoders { } registers.recursionDepth++; checkRecursionLimit(registers.recursionDepth); - schema.mergeFrom(msg, data, position, position + length, registers); + schema.mergeFrom((T) msg, data, position, position + length, registers); registers.recursionDepth--; registers.object1 = msg; return position + length; } - @SuppressWarnings({"unchecked", "rawtypes"}) - static int mergeGroupField( + @SuppressWarnings("unchecked") + static <T> int mergeGroupField( Object msg, - Schema schema, + Schema<T> schema, byte[] data, int position, int limit, @@ -269,11 +268,11 @@ final class ArrayDecoders { throws IOException { // A group field must has a MessageSchema (the only other subclass of Schema is MessageSetSchema // and it can't be used in group fields). - final MessageSchema messageSchema = (MessageSchema) schema; + final MessageSchema<T> messageSchema = (MessageSchema<T>) schema; registers.recursionDepth++; checkRecursionLimit(registers.recursionDepth); final int endPosition = - messageSchema.parseMessage(msg, data, position, limit, endGroup, registers); + messageSchema.parseMessage((T) msg, data, position, limit, endGroup, registers); registers.recursionDepth--; registers.object1 = msg; return endPosition; @@ -758,17 +757,15 @@ final class ArrayDecoders { * * @return The position of after read all groups */ - @SuppressWarnings({"unchecked", "rawtypes"}) static int decodeGroupList( - Schema schema, + Schema<?> schema, int tag, byte[] data, int position, int limit, - ProtobufList<?> list, + ProtobufList<Object> output, Registers registers) throws IOException { - final ProtobufList<Object> output = (ProtobufList<Object>) list; final int endgroup = (tag & ~0x7) | WireFormat.WIRETYPE_END_GROUP; position = decodeGroupField(schema, data, position, limit, endgroup, registers); output.add(registers.object1); @@ -791,7 +788,7 @@ final class ArrayDecoders { Registers registers) throws IOException { final int number = tag >>> 3; - GeneratedMessageLite.GeneratedExtension extension = + GeneratedMessageLite.GeneratedExtension<?, ?> extension = registers.extensionRegistry.findLiteExtensionByNumber(defaultInstance, number); if (extension == null) { return decodeUnknownField( @@ -972,7 +969,7 @@ final class ArrayDecoders { case GROUP: { final int endTag = (fieldNumber << 3) | WireFormat.WIRETYPE_END_GROUP; - final Schema fieldSchema = + final Schema<?> fieldSchema = Protobuf.getInstance() .schemaFor(extension.getMessageDefaultInstance().getClass()); if (extension.isRepeated()) { @@ -992,7 +989,7 @@ final class ArrayDecoders { } case MESSAGE: { - final Schema fieldSchema = + final Schema<?> fieldSchema = Protobuf.getInstance() .schemaFor(extension.getMessageDefaultInstance().getClass()); if (extension.isRepeated()) { diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BinaryWriter.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BinaryWriter.java index 4b6a06f75214b..5726eff78fe87 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BinaryWriter.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BinaryWriter.java @@ -1283,22 +1283,22 @@ abstract class BinaryWriter extends ByteOutput implements Writer { @Override void writeFixed32(int value) { - buffer[pos--] = (byte) ((value >> 24) & 0xFF); - buffer[pos--] = (byte) ((value >> 16) & 0xFF); - buffer[pos--] = (byte) ((value >> 8) & 0xFF); - buffer[pos--] = (byte) (value & 0xFF); + buffer[pos--] = (byte) (value >> 24); + buffer[pos--] = (byte) (value >> 16); + buffer[pos--] = (byte) (value >> 8); + buffer[pos--] = (byte) value; } @Override void writeFixed64(long value) { - buffer[pos--] = (byte) ((int) (value >> 56) & 0xFF); - buffer[pos--] = (byte) ((int) (value >> 48) & 0xFF); - buffer[pos--] = (byte) ((int) (value >> 40) & 0xFF); - buffer[pos--] = (byte) ((int) (value >> 32) & 0xFF); - buffer[pos--] = (byte) ((int) (value >> 24) & 0xFF); - buffer[pos--] = (byte) ((int) (value >> 16) & 0xFF); - buffer[pos--] = (byte) ((int) (value >> 8) & 0xFF); - buffer[pos--] = (byte) ((int) (value) & 0xFF); + buffer[pos--] = (byte) ((int) (value >> 56)); + buffer[pos--] = (byte) ((int) (value >> 48)); + buffer[pos--] = (byte) ((int) (value >> 40)); + buffer[pos--] = (byte) ((int) (value >> 32)); + buffer[pos--] = (byte) ((int) (value >> 24)); + buffer[pos--] = (byte) ((int) (value >> 16)); + buffer[pos--] = (byte) ((int) (value >> 8)); + buffer[pos--] = (byte) ((int) value); } @Override @@ -1820,22 +1820,22 @@ abstract class BinaryWriter extends ByteOutput implements Writer { @Override void writeFixed32(int value) { - UnsafeUtil.putByte(buffer, pos--, (byte) ((value >> 24) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((value >> 16) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((value >> 8) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) (value & 0xFF)); + UnsafeUtil.putByte(buffer, pos--, (byte) (value >> 24)); + UnsafeUtil.putByte(buffer, pos--, (byte) (value >> 16)); + UnsafeUtil.putByte(buffer, pos--, (byte) (value >> 8)); + UnsafeUtil.putByte(buffer, pos--, (byte) value); } @Override void writeFixed64(long value) { - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 56) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 48) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 40) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 32) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 24) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 16) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 8) & 0xFF)); - UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value) & 0xFF)); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 56))); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 48))); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 40))); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 32))); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 24))); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 16))); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) (value >> 8))); + UnsafeUtil.putByte(buffer, pos--, (byte) ((int) value)); } @Override @@ -2913,22 +2913,22 @@ abstract class BinaryWriter extends ByteOutput implements Writer { @Override void writeFixed32(int value) { - UnsafeUtil.putByte(pos--, (byte) ((value >> 24) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((value >> 16) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((value >> 8) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) (value & 0xFF)); + UnsafeUtil.putByte(pos--, (byte) (value >> 24)); + UnsafeUtil.putByte(pos--, (byte) (value >> 16)); + UnsafeUtil.putByte(pos--, (byte) (value >> 8)); + UnsafeUtil.putByte(pos--, (byte) value); } @Override void writeFixed64(long value) { - UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 56) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 48) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 40) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 32) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 24) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 16) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 8) & 0xFF)); - UnsafeUtil.putByte(pos--, (byte) ((int) (value) & 0xFF)); + UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 56))); + UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 48))); + UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 40))); + UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 32))); + UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 24))); + UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 16))); + UnsafeUtil.putByte(pos--, (byte) ((int) (value >> 8))); + UnsafeUtil.putByte(pos--, (byte) ((int) value)); } @Override diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java index 3b8c72704b165..f5435afdcd25c 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java @@ -68,7 +68,8 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean> } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ByteString.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ByteString.java index 1903a4deba964..558d5a6ab7ffd 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ByteString.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ByteString.java @@ -929,7 +929,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable { // equals() and hashCode() @Override - public abstract boolean equals(Object o); + public abstract boolean equals( + Object o); /** Base class for leaf {@link ByteString}s (i.e. non-ropes). */ abstract static class LeafByteString extends ByteString { @@ -1478,7 +1479,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable { // equals() and hashCode() @Override - public final boolean equals(Object other) { + public final boolean equals( + Object other) { if (other == this) { return true; } @@ -1816,7 +1818,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable { } @Override - public boolean equals(Object other) { + public boolean equals( + Object other) { if (other == this) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStream.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStream.java index 85b7a5bcae1e4..fbdabf22521db 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStream.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStream.java @@ -43,7 +43,9 @@ public abstract class CodedInputStream { private static volatile int defaultRecursionLimit = 100; /** Visible for subclasses. See setRecursionLimit() */ - int recursionDepth; + int messageDepth; + + int groupDepth; int recursionLimit = defaultRecursionLimit; @@ -173,11 +175,22 @@ public abstract class CodedInputStream { } public void checkRecursionLimit() throws InvalidProtocolBufferException { - if (recursionDepth >= recursionLimit) { + if (messageDepth + groupDepth >= recursionLimit) { throw InvalidProtocolBufferException.recursionLimitExceeded(); } } + /** + * Verifies that the last tag was 0 if we aren't inside a group. + * + * @throws InvalidProtocolBufferException The last tag was not 0 and we aren't inside a group. + */ + public void checkValidEndTag() throws InvalidProtocolBufferException { + if (groupDepth == 0) { + checkLastTagWas(0); + } + } + /** Disable construction/inheritance outside of this class. */ private CodedInputStream() {} @@ -231,9 +244,9 @@ public abstract class CodedInputStream { return; } checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; boolean fieldSkipped = skipField(tag); - --recursionDepth; + --groupDepth; if (!fieldSkipped) { return; } @@ -251,9 +264,9 @@ public abstract class CodedInputStream { return; } checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; boolean fieldSkipped = skipField(tag, output); - --recursionDepth; + --groupDepth; if (!fieldSkipped) { return; } @@ -668,6 +681,7 @@ public abstract class CodedInputStream { WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: + checkValidEndTag(); return false; case WireFormat.WIRETYPE_FIXED32: skipRawBytes(FIXED32_SIZE); @@ -714,6 +728,7 @@ public abstract class CodedInputStream { } case WireFormat.WIRETYPE_END_GROUP: { + checkValidEndTag(); return false; } case WireFormat.WIRETYPE_FIXED32: @@ -815,10 +830,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; } @Override @@ -828,10 +843,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; return result; } @@ -849,10 +864,10 @@ public abstract class CodedInputStream { final int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } @@ -865,10 +880,10 @@ public abstract class CodedInputStream { int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } @@ -1306,7 +1321,8 @@ public abstract class CodedInputStream { } private UnsafeDirectNioDecoder(ByteBuffer buffer, boolean immutable) { - this.buffer = buffer; + // Duplicate to avoid non-threadsafe modifications in slice() + this.buffer = buffer.duplicate(); address = UnsafeUtil.addressOffset(buffer); limit = address + buffer.limit(); pos = address + buffer.position(); @@ -1360,6 +1376,7 @@ public abstract class CodedInputStream { WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: + checkValidEndTag(); return false; case WireFormat.WIRETYPE_FIXED32: skipRawBytes(FIXED32_SIZE); @@ -1406,6 +1423,7 @@ public abstract class CodedInputStream { } case WireFormat.WIRETYPE_END_GROUP: { + checkValidEndTag(); return false; } case WireFormat.WIRETYPE_FIXED32: @@ -1512,10 +1530,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; } @Override @@ -1525,10 +1543,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; return result; } @@ -1546,10 +1564,10 @@ public abstract class CodedInputStream { final int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } @@ -1562,10 +1580,10 @@ public abstract class CodedInputStream { int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } @@ -2106,6 +2124,7 @@ public abstract class CodedInputStream { WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: + checkValidEndTag(); return false; case WireFormat.WIRETYPE_FIXED32: skipRawBytes(FIXED32_SIZE); @@ -2152,6 +2171,7 @@ public abstract class CodedInputStream { } case WireFormat.WIRETYPE_END_GROUP: { + checkValidEndTag(); return false; } case WireFormat.WIRETYPE_FIXED32: @@ -2295,10 +2315,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; } @Override @@ -2308,10 +2328,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; return result; } @@ -2329,10 +2349,10 @@ public abstract class CodedInputStream { final int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } @@ -2345,10 +2365,10 @@ public abstract class CodedInputStream { int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } @@ -3233,6 +3253,7 @@ public abstract class CodedInputStream { WireFormat.makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP)); return true; case WireFormat.WIRETYPE_END_GROUP: + checkValidEndTag(); return false; case WireFormat.WIRETYPE_FIXED32: skipRawBytes(FIXED32_SIZE); @@ -3279,6 +3300,7 @@ public abstract class CodedInputStream { } case WireFormat.WIRETYPE_END_GROUP: { + checkValidEndTag(); return false; } case WireFormat.WIRETYPE_FIXED32: @@ -3392,10 +3414,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; } @Override @@ -3405,10 +3427,10 @@ public abstract class CodedInputStream { final ExtensionRegistryLite extensionRegistry) throws IOException { checkRecursionLimit(); - ++recursionDepth; + ++groupDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP)); - --recursionDepth; + --groupDepth; return result; } @@ -3426,10 +3448,10 @@ public abstract class CodedInputStream { final int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; builder.mergeFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } @@ -3442,10 +3464,10 @@ public abstract class CodedInputStream { int length = readRawVarint32(); checkRecursionLimit(); final int oldLimit = pushLimit(length); - ++recursionDepth; + ++messageDepth; T result = parser.parsePartialFrom(this, extensionRegistry); checkLastTagWas(0); - --recursionDepth; + --messageDepth; if (getBytesUntilLimit() != 0) { throw InvalidProtocolBufferException.truncatedMessage(); } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java index 7f4313eb990a4..5acb73716624b 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java @@ -184,16 +184,14 @@ final class CodedInputStreamReader implements Reader { private <T> void mergeMessageFieldInternal( T target, Schema<T> schema, ExtensionRegistryLite extensionRegistry) throws IOException { int size = input.readUInt32(); - if (input.recursionDepth >= input.recursionLimit) { - throw InvalidProtocolBufferException.recursionLimitExceeded(); - } + input.checkRecursionLimit(); // Push the new limit. final int prevLimit = input.pushLimit(size); - ++input.recursionDepth; + ++input.messageDepth; schema.mergeFrom(target, this, extensionRegistry); input.checkLastTagWas(0); - --input.recursionDepth; + --input.messageDepth; // Restore the previous limit. input.popLimit(prevLimit); } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java index 342fdd923a15b..ce9c80b38d020 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java @@ -690,7 +690,7 @@ public abstract class CodedOutputStream extends ByteOutput { } /** - * Compute the number of bytes that would be needed to encode an {@code int32} field, including + * Compute the number of bytes that would be needed to encode an {@code int32} field, excluding * tag. */ public static int computeInt32SizeNoTag(final int value) { @@ -1347,29 +1347,31 @@ public abstract class CodedOutputStream extends ByteOutput { @Override public final void writeUInt32NoTag(int value) throws IOException { + int position = this.position; // Perf: hoist field to register to avoid load/stores. try { while (true) { if ((value & ~0x7F) == 0) { buffer[position++] = (byte) value; - return; + break; } else { - buffer[position++] = (byte) ((value | 0x80) & 0xFF); + buffer[position++] = (byte) (value | 0x80); value >>>= 7; } } } catch (IndexOutOfBoundsException e) { throw new OutOfSpaceException(position, limit, 1, e); } + this.position = position; // Only update position if we stayed within the array bounds. } @Override public final void writeFixed32NoTag(int value) throws IOException { int position = this.position; // Perf: hoist field to register to avoid load/stores. try { - buffer[position] = (byte) (value & 0xFF); - buffer[position + 1] = (byte) ((value >> 8) & 0xFF); - buffer[position + 2] = (byte) ((value >> 16) & 0xFF); - buffer[position + 3] = (byte) ((value >> 24) & 0xFF); + buffer[position] = (byte) value; + buffer[position + 1] = (byte) (value >> 8); + buffer[position + 2] = (byte) (value >> 16); + buffer[position + 3] = (byte) (value >> 24); } catch (IndexOutOfBoundsException e) { throw new OutOfSpaceException(position, limit, FIXED32_SIZE, e); } @@ -1379,13 +1381,14 @@ public abstract class CodedOutputStream extends ByteOutput { @Override public final void writeUInt64NoTag(long value) throws IOException { + int position = this.position; // Perf: hoist field to register to avoid load/stores. if (HAS_UNSAFE_ARRAY_OPERATIONS && spaceLeft() >= MAX_VARINT_SIZE) { while (true) { if ((value & ~0x7FL) == 0) { UnsafeUtil.putByte(buffer, position++, (byte) value); - return; + break; } else { - UnsafeUtil.putByte(buffer, position++, (byte) (((int) value | 0x80) & 0xFF)); + UnsafeUtil.putByte(buffer, position++, (byte) ((int) value | 0x80)); value >>>= 7; } } @@ -1394,9 +1397,9 @@ public abstract class CodedOutputStream extends ByteOutput { while (true) { if ((value & ~0x7FL) == 0) { buffer[position++] = (byte) value; - return; + break; } else { - buffer[position++] = (byte) (((int) value | 0x80) & 0xFF); + buffer[position++] = (byte) ((int) value | 0x80); value >>>= 7; } } @@ -1404,20 +1407,21 @@ public abstract class CodedOutputStream extends ByteOutput { throw new OutOfSpaceException(position, limit, 1, e); } } + this.position = position; // Only update position if we stayed within the array bounds. } @Override public final void writeFixed64NoTag(long value) throws IOException { int position = this.position; // Perf: hoist field to register to avoid load/stores. try { - buffer[position] = (byte) ((int) (value) & 0xFF); - buffer[position + 1] = (byte) ((int) (value >> 8) & 0xFF); - buffer[position + 2] = (byte) ((int) (value >> 16) & 0xFF); - buffer[position + 3] = (byte) ((int) (value >> 24) & 0xFF); - buffer[position + 4] = (byte) ((int) (value >> 32) & 0xFF); - buffer[position + 5] = (byte) ((int) (value >> 40) & 0xFF); - buffer[position + 6] = (byte) ((int) (value >> 48) & 0xFF); - buffer[position + 7] = (byte) ((int) (value >> 56) & 0xFF); + buffer[position] = (byte) value; + buffer[position + 1] = (byte) (value >> 8); + buffer[position + 2] = (byte) (value >> 16); + buffer[position + 3] = (byte) (value >> 24); + buffer[position + 4] = (byte) (value >> 32); + buffer[position + 5] = (byte) (value >> 40); + buffer[position + 6] = (byte) (value >> 48); + buffer[position + 7] = (byte) (value >> 56); } catch (IndexOutOfBoundsException e) { throw new OutOfSpaceException(position, limit, FIXED64_SIZE, e); } @@ -1429,10 +1433,10 @@ public abstract class CodedOutputStream extends ByteOutput { public final void write(byte[] value, int offset, int length) throws IOException { try { System.arraycopy(value, offset, buffer, position, length); - position += length; } catch (IndexOutOfBoundsException e) { throw new OutOfSpaceException(position, limit, length, e); } + position += length; } @Override @@ -1666,7 +1670,7 @@ public abstract class CodedOutputStream extends ByteOutput { try { buffer.put(value); } catch (BufferOverflowException e) { - throw new OutOfSpaceException(e); + throw new OutOfSpaceException(buffer.position(), buffer.limit(), 1, e); } } @@ -1711,7 +1715,7 @@ public abstract class CodedOutputStream extends ByteOutput { buffer.put((byte) value); return; } else { - buffer.put((byte) ((value | 0x80) & 0xFF)); + buffer.put((byte) (value | 0x80)); value >>>= 7; } } @@ -1725,7 +1729,7 @@ public abstract class CodedOutputStream extends ByteOutput { try { buffer.putInt(value); } catch (BufferOverflowException e) { - throw new OutOfSpaceException(e); + throw new OutOfSpaceException(buffer.position(), buffer.limit(), FIXED32_SIZE, e); } } @@ -1737,7 +1741,7 @@ public abstract class CodedOutputStream extends ByteOutput { buffer.put((byte) value); return; } else { - buffer.put((byte) (((int) value | 0x80) & 0xFF)); + buffer.put((byte) ((int) value | 0x80)); value >>>= 7; } } @@ -1751,7 +1755,7 @@ public abstract class CodedOutputStream extends ByteOutput { try { buffer.putLong(value); } catch (BufferOverflowException e) { - throw new OutOfSpaceException(e); + throw new OutOfSpaceException(buffer.position(), buffer.limit(), FIXED64_SIZE, e); } } @@ -2034,29 +2038,34 @@ public abstract class CodedOutputStream extends ByteOutput { @Override public void writeUInt32NoTag(int value) throws IOException { + long position = this.position; // Perf: hoist field to register to avoid load/stores. if (position <= oneVarintLimit) { // Optimization to avoid bounds checks on each iteration. while (true) { if ((value & ~0x7F) == 0) { UnsafeUtil.putByte(position++, (byte) value); - return; + break; } else { - UnsafeUtil.putByte(position++, (byte) ((value | 0x80) & 0xFF)); + UnsafeUtil.putByte(position++, (byte) (value | 0x80)); value >>>= 7; } } } else { - while (position < limit) { + while (true) { + if (position >= limit) { + throw new OutOfSpaceException( + String.format("Pos: %d, limit: %d, len: %d", position, limit, 1)); + } if ((value & ~0x7F) == 0) { UnsafeUtil.putByte(position++, (byte) value); - return; + break; } else { - UnsafeUtil.putByte(position++, (byte) ((value | 0x80) & 0xFF)); + UnsafeUtil.putByte(position++, (byte) (value | 0x80)); value >>>= 7; } } - throw new OutOfSpaceException(position, limit, 1); } + this.position = position; // Only update position if we stayed within the array bounds. } @Override @@ -2071,29 +2080,33 @@ public abstract class CodedOutputStream extends ByteOutput { @Override public void writeUInt64NoTag(long value) throws IOException { + long position = this.position; // Perf: hoist field to register to avoid load/stores. if (position <= oneVarintLimit) { // Optimization to avoid bounds checks on each iteration. while (true) { if ((value & ~0x7FL) == 0) { UnsafeUtil.putByte(position++, (byte) value); - return; + break; } else { - UnsafeUtil.putByte(position++, (byte) (((int) value | 0x80) & 0xFF)); + UnsafeUtil.putByte(position++, (byte) ((int) value | 0x80)); value >>>= 7; } } } else { - while (position < limit) { + while (true) { + if (position >= limit) { + throw new OutOfSpaceException(position, limit, 1); + } if ((value & ~0x7FL) == 0) { UnsafeUtil.putByte(position++, (byte) value); - return; + break; } else { - UnsafeUtil.putByte(position++, (byte) (((int) value | 0x80) & 0xFF)); + UnsafeUtil.putByte(position++, (byte) ((int) value | 0x80)); value >>>= 7; } } - throw new OutOfSpaceException(position, limit, 1); } + this.position = position; // Only update position if we stayed within the array bounds. } @Override @@ -2253,7 +2266,10 @@ public abstract class CodedOutputStream extends ByteOutput { * responsibility of the caller. */ final void buffer(byte value) { - buffer[position++] = value; + int position = this.position; + buffer[position] = value; + // Android optimisation: 1 fewer instruction codegen vs buffer[position++]. + this.position = position + 1; totalBytesWritten++; } @@ -2290,7 +2306,7 @@ public abstract class CodedOutputStream extends ByteOutput { UnsafeUtil.putByte(buffer, position++, (byte) value); break; } else { - UnsafeUtil.putByte(buffer, position++, (byte) ((value | 0x80) & 0xFF)); + UnsafeUtil.putByte(buffer, position++, (byte) (value | 0x80)); value >>>= 7; } } @@ -2303,7 +2319,7 @@ public abstract class CodedOutputStream extends ByteOutput { totalBytesWritten++; return; } else { - buffer[position++] = (byte) ((value | 0x80) & 0xFF); + buffer[position++] = (byte) (value | 0x80); totalBytesWritten++; value >>>= 7; } @@ -2323,7 +2339,7 @@ public abstract class CodedOutputStream extends ByteOutput { UnsafeUtil.putByte(buffer, position++, (byte) value); break; } else { - UnsafeUtil.putByte(buffer, position++, (byte) (((int) value | 0x80) & 0xFF)); + UnsafeUtil.putByte(buffer, position++, (byte) ((int) value | 0x80)); value >>>= 7; } } @@ -2336,7 +2352,7 @@ public abstract class CodedOutputStream extends ByteOutput { totalBytesWritten++; return; } else { - buffer[position++] = (byte) (((int) value | 0x80) & 0xFF); + buffer[position++] = (byte) ((int) value | 0x80); totalBytesWritten++; value >>>= 7; } @@ -2349,10 +2365,12 @@ public abstract class CodedOutputStream extends ByteOutput { * responsibility of the caller. */ final void bufferFixed32NoTag(int value) { - buffer[position++] = (byte) (value & 0xFF); - buffer[position++] = (byte) ((value >> 8) & 0xFF); - buffer[position++] = (byte) ((value >> 16) & 0xFF); - buffer[position++] = (byte) ((value >> 24) & 0xFF); + int position = this.position; // Perf: hoist field to register to avoid load/stores. + buffer[position++] = (byte) value; + buffer[position++] = (byte) (value >> 8); + buffer[position++] = (byte) (value >> 16); + buffer[position++] = (byte) (value >> 24); + this.position = position; totalBytesWritten += FIXED32_SIZE; } @@ -2361,14 +2379,16 @@ public abstract class CodedOutputStream extends ByteOutput { * responsibility of the caller. */ final void bufferFixed64NoTag(long value) { - buffer[position++] = (byte) (value & 0xFF); - buffer[position++] = (byte) ((value >> 8) & 0xFF); - buffer[position++] = (byte) ((value >> 16) & 0xFF); - buffer[position++] = (byte) ((value >> 24) & 0xFF); - buffer[position++] = (byte) ((int) (value >> 32) & 0xFF); - buffer[position++] = (byte) ((int) (value >> 40) & 0xFF); - buffer[position++] = (byte) ((int) (value >> 48) & 0xFF); - buffer[position++] = (byte) ((int) (value >> 56) & 0xFF); + int position = this.position; // Perf: hoist field to register to avoid load/stores. + buffer[position++] = (byte) value; + buffer[position++] = (byte) (value >> 8); + buffer[position++] = (byte) (value >> 16); + buffer[position++] = (byte) (value >> 24); + buffer[position++] = (byte) (value >> 32); + buffer[position++] = (byte) (value >> 40); + buffer[position++] = (byte) (value >> 48); + buffer[position++] = (byte) (value >> 56); + this.position = position; totalBytesWritten += FIXED64_SIZE; } } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DebugFormat.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DebugFormat.java index b3cd63bf66b29..6cbfbca3974eb 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DebugFormat.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DebugFormat.java @@ -23,25 +23,30 @@ public final class DebugFormat { } public String toString(MessageOrBuilder message) { - return TextFormat.printer() + if (!this.isSingleLine) { + return TextFormat.debugFormatPrinter() + .printToString(message, TextFormat.Printer.FieldReporterLevel.DEBUG_MULTILINE); + } + return TextFormat.debugFormatPrinter() .emittingSingleLine(this.isSingleLine) - .enablingSafeDebugFormat(true) - .printToString(message, this.isSingleLine - ? TextFormat.Printer.FieldReporterLevel.DEBUG_SINGLE_LINE - : TextFormat.Printer.FieldReporterLevel.DEBUG_MULTILINE); + .printToString(message, TextFormat.Printer.FieldReporterLevel.DEBUG_SINGLE_LINE); } public String toString(FieldDescriptor field, Object value) { - return TextFormat.printer() + if (!this.isSingleLine) { + return TextFormat.debugFormatPrinter().printFieldToString(field, value); + } + return TextFormat.debugFormatPrinter() .emittingSingleLine(this.isSingleLine) - .enablingSafeDebugFormat(true) .printFieldToString(field, value); } public String toString(UnknownFieldSet fields) { - return TextFormat.printer() + if (!this.isSingleLine) { + return TextFormat.debugFormatPrinter().printToString(fields); + } + return TextFormat.debugFormatPrinter() .emittingSingleLine(this.isSingleLine) - .enablingSafeDebugFormat(true) .printToString(fields); } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Descriptors.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Descriptors.java index 19fd96b4380e1..c45978155c430 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Descriptors.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Descriptors.java @@ -849,7 +849,7 @@ public final class Descriptors { return Collections.unmodifiableList(Arrays.asList(oneofs).subList(0, realOneofCount)); } - /** Get a list of this message type's extensions. */ + /** Get a list of the extensions defined nested within this message type's scope. */ public List<FieldDescriptor> getExtensions() { return Collections.unmodifiableList(Arrays.asList(extensions)); } @@ -1616,6 +1616,16 @@ public final class Descriptors { private final Descriptor extensionScope; private final boolean isProto3Optional; + private enum Sensitivity { + UNKNOWN, + SENSITIVE, + NOT_SENSITIVE + } + + // Caches the result of isSensitive() for performance reasons. + private volatile Sensitivity sensitivity = Sensitivity.UNKNOWN; + private volatile boolean isReportable = false; + // Possibly initialized during cross-linking. private Type type; private Descriptor containingType; @@ -1788,6 +1798,76 @@ public final class Descriptors { file.pool.addSymbol(this); } + @SuppressWarnings("unchecked") // List<EnumValueDescriptor> guaranteed by protobuf runtime. + private List<Boolean> isOptionSensitive(FieldDescriptor field, Object value) { + if (field.getType() == Descriptors.FieldDescriptor.Type.ENUM) { + if (field.isRepeated()) { + for (EnumValueDescriptor v : (List<EnumValueDescriptor>) value) { + if (v.getOptions().getDebugRedact()) { + return Arrays.asList(true, false); + } + } + } else { + if (((EnumValueDescriptor) value).getOptions().getDebugRedact()) { + return Arrays.asList(true, false); + } + } + } else if (field.getJavaType() == Descriptors.FieldDescriptor.JavaType.MESSAGE) { + if (field.isRepeated()) { + for (Message m : (List<Message>) value) { + for (Map.Entry<FieldDescriptor, Object> entry : m.getAllFields().entrySet()) { + List<Boolean> result = isOptionSensitive(entry.getKey(), entry.getValue()); + if (result.get(0)) { + return result; + } + } + } + } else { + for (Map.Entry<FieldDescriptor, Object> entry : + ((Message) value).getAllFields().entrySet()) { + List<Boolean> result = isOptionSensitive(entry.getKey(), entry.getValue()); + if (result.get(0)) { + return result; + } + } + } + } + return Arrays.asList(false, false); + } + + // Lazily calculates if the field is marked as sensitive, and caches results. + private List<Boolean> calculateSensitivityData() { + if (sensitivity == Sensitivity.UNKNOWN) { + // If the field is directly marked with debug_redact=true, then it is sensitive. + synchronized (this) { + if (sensitivity == Sensitivity.UNKNOWN) { + boolean isSensitive = proto.getOptions().getDebugRedact(); + // Check if the FieldOptions contain any enums that are marked as debug_redact=true, + // either directly or indirectly via a message option. + for (Map.Entry<Descriptors.FieldDescriptor, Object> entry : + proto.getOptions().getAllFields().entrySet()) { + List<Boolean> result = isOptionSensitive(entry.getKey(), entry.getValue()); + isSensitive = isSensitive || result.get(0); + isReportable = result.get(1); + if (isSensitive) { + break; + } + } + sensitivity = isSensitive ? Sensitivity.SENSITIVE : Sensitivity.NOT_SENSITIVE; + } + } + } + return Arrays.asList(sensitivity == Sensitivity.SENSITIVE, isReportable); + } + + boolean isSensitive() { + return calculateSensitivityData().get(0); + } + + boolean isReportable() { + return calculateSensitivityData().get(1); + } + /** See {@link FileDescriptor#resolveAllFeatures}. */ private void resolveAllFeatures() throws DescriptorValidationException { resolveFeatures(proto.getOptions().getFeatures()); @@ -2110,9 +2190,9 @@ public final class Descriptors { * present in all runtimes; as of writing, we know that: * * <ul> - * <li> C++, Java, and C++-based Python share this quirk. - * <li> UPB and UPB-based Python do not. - * <li> PHP and Ruby treat all enums as open regardless of declaration. + * <li>C++, Java, and C++-based Python share this quirk. + * <li>UPB and UPB-based Python do not. + * <li>PHP and Ruby treat all enums as open regardless of declaration. * </ul> * * <p>Care should be taken when using this function to respect the target runtime's enum @@ -2820,7 +2900,7 @@ public final class Descriptors { this, "Failed to parse features with Java feature extension registry.", e); } } - + FeatureSet.Builder features; if (this.parent == null) { Edition edition = getFile().getEdition(); @@ -2852,6 +2932,13 @@ public final class Descriptors { || getFile().getEdition() == Edition.EDITION_PROTO3)) { getFile().resolveAllFeaturesImmutable(); } + if (this.features == null) { + throw new NullPointerException( + String.format( + "Features not yet loaded for %s. This may be caused by a known issue for proto2" + + " dependency descriptors obtained from proto1 (b/362326130)", + getFullName())); + } return this.features; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java index 57d30d8737641..4198cd85f4d51 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java @@ -67,7 +67,8 @@ final class DoubleArrayList extends AbstractProtobufList<Double> } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FieldSet.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FieldSet.java index c81a1d1fcfd5f..d029353413d07 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FieldSet.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FieldSet.java @@ -127,7 +127,8 @@ final class FieldSet<T extends FieldSet.FieldDescriptorLite<T>> { } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } @@ -268,6 +269,12 @@ final class FieldSet<T extends FieldSet.FieldDescriptorLite<T>> { return o; } + /** Returns true if the field is a lazy field and it is corrupted. */ + boolean lazyFieldCorrupted(final T descriptor) { + Object o = fields.get(descriptor); + return o instanceof LazyField && ((LazyField) o).isCorrupted(); + } + /** * Useful for implementing {@link Message.Builder#setField(Descriptors.FieldDescriptor,Object)}. */ diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FloatArrayList.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FloatArrayList.java index 7cb35db1eeb5e..c70575437dc19 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FloatArrayList.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/FloatArrayList.java @@ -67,7 +67,8 @@ final class FloatArrayList extends AbstractProtobufList<Float> } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java index 0a01d31b326f7..990210dd53a4b 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java @@ -986,17 +986,26 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial verifyExtensionContainingType(extension); FieldDescriptor descriptor = extension.getDescriptor(); final Object value = extensions.getField(descriptor); + T result = null; if (value == null) { if (descriptor.isRepeated()) { - return (T) ProtobufArrayList.emptyList(); + result = (T) ProtobufArrayList.emptyList(); } else if (descriptor.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { - return (T) extension.getMessageDefaultInstance(); + result = (T) extension.getMessageDefaultInstance(); } else { - return (T) extension.fromReflectionType(descriptor.getDefaultValue()); + result = (T) extension.fromReflectionType(descriptor.getDefaultValue()); } } else { - return (T) extension.fromReflectionType(value); + result = (T) extension.fromReflectionType(value); } + + // If the lazy field is corrupted, we need to invalidate the memoized size in case the + // corrupted message data was replaced with an empty ByteString and yet a previous serialized + // size was memoized. + if (extensions.lazyFieldCorrupted(descriptor)) { + setMemoizedSerializedSize(-1); + } + return result; } /** Get one element of a repeated extension. */ @@ -1098,7 +1107,7 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial /** * For compatibility with older gencode. * - * <p> TODO Remove this in the next breaking release. + * <p>TODO Remove this in the next breaking release. * * @deprecated Use {@link newExtensionSerializer()} instead. */ @@ -2390,8 +2399,7 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial final Class<? extends GeneratedMessage> messageClass, final Class<? extends Builder<?>> builderClass, final String containingOneofCamelCaseName) { - isOneofField = - descriptor.getRealContainingOneof() != null; + isOneofField = descriptor.getRealContainingOneof() != null; hasHasMethod = descriptor.hasPresence(); ReflectionInvoker reflectionInvoker = new ReflectionInvoker( @@ -2709,13 +2717,12 @@ public abstract class GeneratedMessage extends AbstractMessage implements Serial @Override public Message.Builder newBuilder() { - throw new UnsupportedOperationException( - "newBuilderForField() called on a non-Message type."); + throw new UnsupportedOperationException("newBuilderForField() called on a repeated field."); } @Override public Message.Builder getBuilder(GeneratedMessage.Builder<?> builder) { - throw new UnsupportedOperationException("getFieldBuilder() called on a non-Message type."); + throw new UnsupportedOperationException("getFieldBuilder() called on a repeated field."); } @Override diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java index 1d4325ed1995a..2d92e33c5894a 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java @@ -86,23 +86,24 @@ public abstract class GeneratedMessageLite< @Override @SuppressWarnings("unchecked") // Guaranteed by runtime. public final Parser<MessageType> getParserForType() { - return (Parser<MessageType>) dynamicMethod(MethodToInvoke.GET_PARSER); + return (Parser<MessageType>) dynamicMethod(MethodToInvoke.GET_PARSER, null, null); } @Override @SuppressWarnings("unchecked") // Guaranteed by runtime. public final MessageType getDefaultInstanceForType() { - return (MessageType) dynamicMethod(MethodToInvoke.GET_DEFAULT_INSTANCE); + return (MessageType) dynamicMethod(MethodToInvoke.GET_DEFAULT_INSTANCE, null, null); } @Override @SuppressWarnings("unchecked") // Guaranteed by runtime. public final BuilderType newBuilderForType() { - return (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER); + return (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER, null, null); } + @SuppressWarnings("unchecked") // Guaranteed by runtime. MessageType newMutableInstance() { - return (MessageType) dynamicMethod(MethodToInvoke.NEW_MUTABLE_INSTANCE); + return (MessageType) dynamicMethod(MethodToInvoke.NEW_MUTABLE_INSTANCE, null, null); } /** @@ -202,11 +203,12 @@ public abstract class GeneratedMessageLite< markImmutable(); } + @SuppressWarnings("unchecked") // Guaranteed by runtime. protected final < MessageType extends GeneratedMessageLite<MessageType, BuilderType>, BuilderType extends GeneratedMessageLite.Builder<MessageType, BuilderType>> BuilderType createBuilder() { - return (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER); + return (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER, null, null); } protected final < @@ -224,7 +226,7 @@ public abstract class GeneratedMessageLite< @Override @SuppressWarnings("unchecked") public final BuilderType toBuilder() { - BuilderType builder = (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER); + BuilderType builder = (BuilderType) dynamicMethod(MethodToInvoke.NEW_BUILDER, null, null); return builder.mergeFrom((MessageType) this); } @@ -275,19 +277,6 @@ public abstract class GeneratedMessageLite< Object arg0, Object arg1); - /** Same as {@link #dynamicMethod(MethodToInvoke, Object, Object)} with {@code null} padding. */ - @CanIgnoreReturnValue - protected Object dynamicMethod( - MethodToInvoke method, - Object arg0) { - return dynamicMethod(method, arg0, null); - } - - /** Same as {@link #dynamicMethod(MethodToInvoke, Object, Object)} with {@code null} padding. */ - protected Object dynamicMethod(MethodToInvoke method) { - return dynamicMethod(method, null, null); - } - void clearMemoizedSerializedSize() { setMemoizedSerializedSize(UNINITIALIZED_SERIALIZED_SIZE); } @@ -355,7 +344,7 @@ public abstract class GeneratedMessageLite< /** Constructs a {@link MessageInfo} for this message type. */ Object buildMessageInfo() throws Exception { - return dynamicMethod(MethodToInvoke.BUILD_MESSAGE_INFO); + return dynamicMethod(MethodToInvoke.BUILD_MESSAGE_INFO, null, null); } private static Map<Class<?>, GeneratedMessageLite<?, ?>> defaultInstanceMap = @@ -507,24 +496,20 @@ public abstract class GeneratedMessageLite< return (BuilderType) this; } - private static <MessageType> void mergeFromInstance(MessageType dest, MessageType src) { - Protobuf.getInstance().schemaFor(dest).mergeFrom(dest, src); - } - - @Override - public MessageType getDefaultInstanceForType() { - return defaultInstance; - } - @Override public BuilderType mergeFrom( byte[] input, int offset, int length, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException { copyOnWrite(); try { - Protobuf.getInstance().schemaFor(instance).mergeFrom( - instance, input, offset, offset + length, - new ArrayDecoders.Registers(extensionRegistry)); + Protobuf.getInstance() + .schemaFor(instance) + .mergeFrom( + instance, + input, + offset, + offset + length, + new ArrayDecoders.Registers(extensionRegistry)); } catch (InvalidProtocolBufferException e) { throw e; } catch (IndexOutOfBoundsException e) { @@ -536,8 +521,7 @@ public abstract class GeneratedMessageLite< } @Override - public BuilderType mergeFrom( - byte[] input, int offset, int length) + public BuilderType mergeFrom(byte[] input, int offset, int length) throws InvalidProtocolBufferException { return mergeFrom(input, offset, length, ExtensionRegistryLite.getEmptyRegistry()); } @@ -551,8 +535,9 @@ public abstract class GeneratedMessageLite< try { // TODO: Try to make input with type CodedInputStream.ArrayDecoder use // fast path. - Protobuf.getInstance().schemaFor(instance).mergeFrom( - instance, CodedInputStreamReader.forCodedInput(input), extensionRegistry); + Protobuf.getInstance() + .schemaFor(instance) + .mergeFrom(instance, CodedInputStreamReader.forCodedInput(input), extensionRegistry); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); @@ -561,6 +546,15 @@ public abstract class GeneratedMessageLite< } return (BuilderType) this; } + + private static <MessageType> void mergeFromInstance(MessageType dest, MessageType src) { + Protobuf.getInstance().schemaFor(dest).mergeFrom(dest, src); + } + + @Override + public MessageType getDefaultInstanceForType() { + return defaultInstance; + } } // ================================================================= @@ -678,7 +672,7 @@ public abstract class GeneratedMessageLite< while (input.getBytesUntilLimit() > 0) { Object value = FieldSet.readPrimitiveField( - input, extension.descriptor.getLiteType(), /*checkUtf8=*/ false); + input, extension.descriptor.getLiteType(), /* checkUtf8= */ false); extensions.addRepeatedField(extension.descriptor, value); } } @@ -719,7 +713,7 @@ public abstract class GeneratedMessageLite< default: value = FieldSet.readPrimitiveField( - input, extension.descriptor.getLiteType(), /*checkUtf8=*/ false); + input, extension.descriptor.getLiteType(), /* checkUtf8= */ false); break; } @@ -1433,8 +1427,10 @@ public abstract class GeneratedMessageLite< java.lang.reflect.Field defaultInstanceField = messageClass.getDeclaredField("DEFAULT_INSTANCE"); defaultInstanceField.setAccessible(true); - MessageLite defaultInstance = (MessageLite) defaultInstanceField.get(null); - return defaultInstance.newBuilderForType().mergeFrom(asBytes).buildPartial(); + MessageLite.Builder builder = + ((MessageLite) defaultInstanceField.get(null)).newBuilderForType(); + builder.mergeFrom(asBytes); + return builder.buildPartial(); } catch (ClassNotFoundException e) { throw new RuntimeException("Unable to find proto buffer class: " + messageClassName, e); } catch (NoSuchFieldException e) { @@ -1449,7 +1445,16 @@ public abstract class GeneratedMessageLite< } private Class<?> resolveMessageClass() throws ClassNotFoundException { - return messageClass != null ? messageClass : Class.forName(messageClassName); + if (messageClass == null) { + Class<?> clazz = + Class.forName( + messageClassName, /* initialize= */ false, getClass().getClassLoader()); + if (!MessageLite.class.isAssignableFrom(clazz)) { + throw new ClassNotFoundException(); + } + return clazz; + } + return messageClass; } } @@ -1466,15 +1471,11 @@ public abstract class GeneratedMessageLite< return (GeneratedExtension<MessageType, T>) extension; } - /** - * A static helper method for checking if a message is initialized, optionally memoizing. - * - * <p>For use by generated code only. - */ - protected static final <T extends GeneratedMessageLite<T, ?>> boolean isInitialized( + /** A static helper method for checking if a message is initialized, optionally memoizing. */ + private static final <T extends GeneratedMessageLite<T, ?>> boolean isInitialized( T message, boolean shouldMemoize) { byte memoizedIsInitialized = - (Byte) message.dynamicMethod(MethodToInvoke.GET_MEMOIZED_IS_INITIALIZED); + (Byte) message.dynamicMethod(MethodToInvoke.GET_MEMOIZED_IS_INITIALIZED, null, null); if (memoizedIsInitialized == 1) { return true; } @@ -1486,7 +1487,7 @@ public abstract class GeneratedMessageLite< // TODO: remove the unused variable Object unused = message.dynamicMethod( - MethodToInvoke.SET_MEMOIZED_IS_INITIALIZED, isInitialized ? message : null); + MethodToInvoke.SET_MEMOIZED_IS_INITIALIZED, isInitialized ? message : null, null); } return isInitialized; } @@ -1713,8 +1714,9 @@ public abstract class GeneratedMessageLite< // Validates last tag. protected static <T extends GeneratedMessageLite<T, ?>> T parseFrom( T defaultInstance, byte[] data) throws InvalidProtocolBufferException { - return checkMessageInitialized(parsePartialFrom( - defaultInstance, data, 0, data.length, ExtensionRegistryLite.getEmptyRegistry())); + return checkMessageInitialized( + parsePartialFrom( + defaultInstance, data, 0, data.length, ExtensionRegistryLite.getEmptyRegistry())); } // Validates last tag. diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/IntArrayList.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/IntArrayList.java index fe654e0ba14cb..73e03a018763a 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/IntArrayList.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/IntArrayList.java @@ -67,7 +67,8 @@ final class IntArrayList extends AbstractProtobufList<Integer> } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Internal.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Internal.java index 07bec5ef29d7c..d548ccaf2032b 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Internal.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Internal.java @@ -555,7 +555,8 @@ public final class Internal { } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (o == this) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/JavaEditionDefaults.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/JavaEditionDefaults.java index 6c5a077e9fd27..82d51cd491c5f 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/JavaEditionDefaults.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/JavaEditionDefaults.java @@ -4,7 +4,7 @@ package com.google.protobuf; public final class JavaEditionDefaults { - public static final String PROTOBUF_INTERNAL_JAVA_EDITION_DEFAULTS = "\n\035\030\204\007\"\003\312>\000*\023\010\001\020\002\030\002 \003(\0010\002\312>\004\010\001\020\001\n\035\030\347\007\"\003\312>\000*\023\010\002\020\001\030\001 \002(\0010\001\312>\004\010\000\020\001\n\035\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\312>\004\010\000\020\001*\003\312>\000 \346\007(\350\007"; + public static final String PROTOBUF_INTERNAL_JAVA_EDITION_DEFAULTS = "\n!\030\204\007\"\003\312>\000*\027\010\001\020\002\030\002 \003(\0010\0028\002\312>\006\010\001\020\001 \001\n!\030\347\007\"\003\312>\000*\027\010\002\020\001\030\001 \002(\0010\0018\002\312>\006\010\000\020\001 \001\n!\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\312>\004\010\000\020\001*\0078\002\312>\002 \001 \346\007(\350\007"; private JavaEditionDefaults() {} } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyField.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyField.java index d7dddd955aec4..5548a7f96384d 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyField.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyField.java @@ -50,7 +50,8 @@ public class LazyField extends LazyFieldLite { } @Override - public boolean equals(Object obj) { + public boolean equals( + Object obj) { return getValue().equals(obj); } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java index d52fc0a704482..aeb2cc0cab6dd 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java @@ -89,6 +89,8 @@ public class LazyFieldLite { */ private volatile ByteString memoizedBytes; + private volatile boolean corrupted; + /** Constructs a LazyFieldLite with bytes that will be parsed lazily. */ public LazyFieldLite(ExtensionRegistryLite extensionRegistry, ByteString bytes) { checkArguments(extensionRegistry, bytes); @@ -110,7 +112,8 @@ public class LazyFieldLite { } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } @@ -399,6 +402,7 @@ public class LazyFieldLite { } catch (InvalidProtocolBufferException e) { // Nothing is logged and no exceptions are thrown. Clients will be unaware that this proto // was invalid. + this.corrupted = true; this.value = defaultInstance; this.memoizedBytes = ByteString.EMPTY; } @@ -413,4 +417,9 @@ public class LazyFieldLite { throw new NullPointerException("found null ByteString"); } } + + /** Returns whether the lazy field was corrupted and replaced with an empty message. */ + boolean isCorrupted() { + return corrupted; + } } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LongArrayList.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LongArrayList.java index f3c14a5a5482b..e4725c5096968 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LongArrayList.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LongArrayList.java @@ -67,7 +67,8 @@ final class LongArrayList extends AbstractProtobufList<Long> } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapField.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapField.java index 81566a2e1b4a7..f65f4cf899811 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapField.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapField.java @@ -183,7 +183,8 @@ public class MapField<K, V> extends MapFieldReflectionAccessor implements Mutabi @SuppressWarnings("unchecked") @Override - public boolean equals(Object object) { + public boolean equals( + Object object) { if (!(object instanceof MapField)) { return false; } @@ -338,7 +339,8 @@ public class MapField<K, V> extends MapFieldReflectionAccessor implements Mutabi } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { return delegate.equals(o); } @@ -434,7 +436,8 @@ public class MapField<K, V> extends MapFieldReflectionAccessor implements Mutabi } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { return delegate.equals(o); } @@ -531,7 +534,8 @@ public class MapField<K, V> extends MapFieldReflectionAccessor implements Mutabi } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { return delegate.equals(o); } @@ -573,7 +577,8 @@ public class MapField<K, V> extends MapFieldReflectionAccessor implements Mutabi } @Override - public boolean equals(Object obj) { + public boolean equals( + Object obj) { return delegate.equals(obj); } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldBuilder.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldBuilder.java index 05a6d093cf4a3..8569e993c23b2 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldBuilder.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldBuilder.java @@ -166,7 +166,8 @@ public class MapFieldBuilder< @SuppressWarnings("unchecked") @Override - public boolean equals(Object object) { + public boolean equals( + Object object) { if (!(object instanceof MapFieldBuilder)) { return false; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldLite.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldLite.java index bc5704b94821d..dd013efc8ca88 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldLite.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MapFieldLite.java @@ -97,7 +97,9 @@ public final class MapFieldLite<K, V> extends LinkedHashMap<K, V> { } } - private static boolean equals(Object a, Object b) { + private static boolean equals( + Object a, + Object b) { if (a instanceof byte[] && b instanceof byte[]) { return Arrays.equals((byte[]) a, (byte[]) b); } @@ -129,7 +131,8 @@ public final class MapFieldLite<K, V> extends LinkedHashMap<K, V> { /** Checks whether two map fields are equal. */ @SuppressWarnings("unchecked") @Override - public boolean equals(Object object) { + public boolean equals( + Object object) { return (object instanceof Map) && equals(this, (Map<K, V>) object); } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Message.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Message.java index 7fc8cd4a58d8b..6b8649bfd2815 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Message.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Message.java @@ -41,7 +41,8 @@ public interface Message extends MessageLite, MessageOrBuilder { * @return {@code true} if the specified object is equal to this message */ @Override - boolean equals(Object other); + boolean equals( + Object other); /** * Returns the hash code value for this message. The hash code of a message should mix the diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageReflection.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageReflection.java index e33cc45960057..20d8154086a0e 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageReflection.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageReflection.java @@ -1334,6 +1334,8 @@ class MessageReflection { // We haven't seen a type ID yet or we want parse message lazily. rawBytes = input.readBytes(); + } else if (tag == WireFormat.MESSAGE_SET_ITEM_END_TAG) { + break; } else { // Unknown tag. Skip it. if (!input.skipField(tag)) { break; // End of group diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSchema.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSchema.java index 335da2d6ab649..350fea80bd286 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSchema.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSchema.java @@ -3714,7 +3714,7 @@ final class MessageSchema<T> implements Schema<T> { data, position, limit, - list, + (ProtobufList<Object>) list, registers); } break; diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java index ec37d41f98c5a..fde5f9aec2750 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageSetSchema.java @@ -329,6 +329,8 @@ final class MessageSetSchema<T> implements Schema<T> { // We haven't seen a type ID yet or we want parse message lazily. rawBytes = reader.readBytes(); continue; + } else if (tag == WireFormat.MESSAGE_SET_ITEM_END_TAG) { + break loop; } else { if (!reader.skipField()) { break loop; // End of group diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ProtobufToStringOutput.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ProtobufToStringOutput.java index e6df9267d7884..b7ad3be3e5d73 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ProtobufToStringOutput.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ProtobufToStringOutput.java @@ -1,10 +1,12 @@ package com.google.protobuf; +import java.util.Optional; + /** - * ProtobufToStringOutput controls the output format of {@link Message#toString()}. Specifically, for - * the Runnable object passed to `callWithDebugFormat` and `callWithTextFormat`, Message.toString() - * will always output the specified format unless ProtobufToStringOutput is used again to change the - * output format. + * ProtobufToStringOutput controls the output format of {@link Message#toString()}. Specifically, + * for the Runnable object passed to `callWithDebugFormat` and `callWithTextFormat`, + * Message.toString() will always output the specified format unless ProtobufToStringOutput is used + * again to change the output format. */ public final class ProtobufToStringOutput { private enum OutputMode { @@ -13,16 +15,10 @@ public final class ProtobufToStringOutput { } private static final ThreadLocal<OutputMode> outputMode = - new ThreadLocal<OutputMode>() { - @Override - protected OutputMode initialValue() { - return OutputMode.TEXT_FORMAT; - } - }; + ThreadLocal.withInitial(() -> OutputMode.TEXT_FORMAT); private ProtobufToStringOutput() {} - @CanIgnoreReturnValue private static OutputMode setOutputMode(OutputMode newMode) { OutputMode oldMode = outputMode.get(); outputMode.set(newMode); diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java index dc3326190ac19..89e01d8c43b91 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java @@ -25,6 +25,7 @@ import java.util.RandomAccess; * should update gencode to >= 4.26.x which replaces RepeatedFieldBuilderV3 with * RepeatedFieldBuilder. */ +@Deprecated public class RepeatedFieldBuilderV3< MType extends AbstractMessage, BType extends AbstractMessage.Builder, diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RopeByteString.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RopeByteString.java index aa8c6e1473714..cfb26db83e59c 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RopeByteString.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RopeByteString.java @@ -477,7 +477,8 @@ final class RopeByteString extends ByteString { // equals() and hashCode() @Override - public boolean equals(Object other) { + public boolean equals( + Object other) { if (other == this) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RuntimeVersion.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RuntimeVersion.java index 1c208e99d037b..c329902a63f4f 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RuntimeVersion.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/RuntimeVersion.java @@ -27,8 +27,8 @@ public final class RuntimeVersion { // These OSS versions are not stripped to avoid merging conflicts. public static final RuntimeDomain OSS_DOMAIN = RuntimeDomain.PUBLIC; public static final int OSS_MAJOR = 4; - public static final int OSS_MINOR = 29; - public static final int OSS_PATCH = 3; + public static final int OSS_MINOR = 30; + public static final int OSS_PATCH = 1; public static final String OSS_SUFFIX = ""; public static final RuntimeDomain DOMAIN = OSS_DOMAIN; @@ -65,9 +65,6 @@ public final class RuntimeVersion { */ public static void validateProtobufGencodeVersion( RuntimeDomain domain, int major, int minor, int patch, String suffix, String location) { - if (checkDisabled()) { - return; - } validateProtobufGencodeVersionImpl(domain, major, minor, patch, suffix, location); } @@ -77,10 +74,10 @@ public final class RuntimeVersion { if (checkDisabled()) { return; } - String gencodeVersionString = versionString(major, minor, patch, suffix); // Check that version numbers are valid. if (major < 0 || minor < 0 || patch < 0) { - throw new ProtobufRuntimeVersionException("Invalid gencode version: " + gencodeVersionString); + throw new ProtobufRuntimeVersionException( + "Invalid gencode version: " + versionString(major, minor, patch, suffix)); } // Check that runtime domain is the same as the gencode domain. @@ -92,9 +89,12 @@ public final class RuntimeVersion { location, domain, DOMAIN)); } + String gencodeVersionString = null; + // Check that runtime major version is the same as the gencode major version. if (major != MAJOR) { if (major == MAJOR - 1 && majorWarningLoggedCount < MAX_WARNING_COUNT) { + gencodeVersionString = versionString(major, minor, patch, suffix); logger.warning( String.format( " Protobuf gencode version %s is exactly one major version older than the runtime" @@ -107,12 +107,15 @@ public final class RuntimeVersion { String.format( "Detected mismatched Protobuf Gencode/Runtime major versions when loading %s:" + " gencode %s, runtime %s. Same major version is required.", - location, gencodeVersionString, VERSION_STRING)); + location, versionString(major, minor, patch, suffix), VERSION_STRING)); } } // Check that runtime version is newer than the gencode version. if (MINOR < minor || (minor == MINOR && PATCH < patch)) { + if (gencodeVersionString == null) { + gencodeVersionString = versionString(major, minor, patch, suffix); + } throw new ProtobufRuntimeVersionException( String.format( "Detected incompatible Protobuf Gencode/Runtime versions when loading %s: gencode %s," @@ -122,6 +125,9 @@ public final class RuntimeVersion { // Check that runtime version suffix is the same as the gencode version suffix. if (!suffix.equals(SUFFIX)) { + if (gencodeVersionString == null) { + gencodeVersionString = versionString(major, minor, patch, suffix); + } throw new ProtobufRuntimeVersionException( String.format( "Detected mismatched Protobuf Gencode/Runtime version suffixes when loading %s:" diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java index 17326cb0b8782..9697b6ea30b9a 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java @@ -100,12 +100,18 @@ public class SingleFieldBuilder< */ @SuppressWarnings("unchecked") public BType getBuilder() { + // This code is very hot. + // Optimisation: store this.builder in a local variable so that the compiler doesn't reload + // it at 'return'. Android's compiler thinks the methods called between assignment & return + // might reassign this.builder so the compiler can't make this optimisation without our help. + BType builder = this.builder; + if (builder == null) { // builder.mergeFrom() on a fresh builder // does not create any sub-objects with independent clean/dirty states, // therefore setting the builder itself to clean without actually calling // build() cannot break any invariants. - builder = (BType) message.newBuilderForType(this); + this.builder = builder = (BType) message.newBuilderForType(this); builder.mergeFrom(message); // no-op if message is the default message builder.markClean(); } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java index 1d5cddd868e56..b7a1b8e7c27e8 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java @@ -417,7 +417,8 @@ class SmallSortedMap<K extends Comparable<K>, V> extends AbstractMap<K, V> { } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (o == this) { return true; } @@ -439,7 +440,9 @@ class SmallSortedMap<K extends Comparable<K>, V> extends AbstractMap<K, V> { } /** equals() that handles null values. */ - private boolean equals(Object o1, Object o2) { + private boolean equals( + Object o1, + Object o2) { return o1 == null ? o2 == null : o1.equals(o2); } } @@ -609,7 +612,8 @@ class SmallSortedMap<K extends Comparable<K>, V> extends AbstractMap<K, V> { } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (this == o) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormat.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormat.java index af9b4d109a060..5894028558401 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormat.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormat.java @@ -24,7 +24,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.logging.Logger; -import java.util.regex.Matcher; import java.util.regex.Pattern; /** @@ -39,8 +38,6 @@ public final class TextFormat { private static final Logger logger = Logger.getLogger(TextFormat.class.getName()); - private static final String DEBUG_STRING_SILENT_MARKER = "\t "; - private static final String REDACTED_MARKER = "[REDACTED]"; /** @@ -125,20 +122,22 @@ public final class TextFormat { // Printer instance which escapes non-ASCII characters and prints in the text format. private static final Printer DEFAULT_TEXT_FORMAT = new Printer( - true, + /* escapeNonAscii= */ true, + /* useShortRepeatedPrimitives= */ false, TypeRegistry.getEmptyTypeRegistry(), ExtensionRegistryLite.getEmptyRegistry(), - false, - false); + /* enablingSafeDebugFormat= */ false, + /* singleLine= */ false); // Printer instance which escapes non-ASCII characters and prints in the debug format. private static final Printer DEFAULT_DEBUG_FORMAT = new Printer( - true, + /* escapeNonAscii= */ true, + /* useShortRepeatedPrimitives= */ false, TypeRegistry.getEmptyTypeRegistry(), ExtensionRegistryLite.getEmptyRegistry(), - true, - false); + /* enablingSafeDebugFormat= */ true, + /* singleLine= */ false); /** * A list of the public APIs that output human-readable text from a message. A higher-level API @@ -146,18 +145,20 @@ public final class TextFormat { * DEBUG_MULTILINE.compareTo(PRINTER_PRINT_TO_STRING) > 0. The inverse is not necessarily true. */ static enum FieldReporterLevel { - NO_REPORT(0), - PRINT(1), - PRINTER_PRINT_TO_STRING(2), - TEXTFORMAT_PRINT_TO_STRING(3), - PRINT_UNICODE(4), - SHORT_DEBUG_STRING(5), - LEGACY_MULTILINE(6), - LEGACY_SINGLE_LINE(7), - DEBUG_MULTILINE(8), - DEBUG_SINGLE_LINE(9), - ABSTRACT_TO_STRING(10), - ABSTRACT_MUTABLE_TO_STRING(11); + REPORT_ALL(0), + TEXT_GENERATOR(1), + PRINT(2), + PRINTER_PRINT_TO_STRING(3), + TEXTFORMAT_PRINT_TO_STRING(4), + PRINT_UNICODE(5), + SHORT_DEBUG_STRING(6), + LEGACY_MULTILINE(7), + LEGACY_SINGLE_LINE(8), + DEBUG_MULTILINE(9), + DEBUG_SINGLE_LINE(10), + ABSTRACT_TO_STRING(11), + ABSTRACT_MUTABLE_TO_STRING(12), + REPORT_NONE(13); private final int index; FieldReporterLevel(int index) { @@ -168,6 +169,9 @@ public final class TextFormat { /** Whether to escape non ASCII characters with backslash and octal. */ private final boolean escapeNonAscii; + /** Whether to print repeated primitive fields using short square bracket notation. */ + private final boolean useShortRepeatedPrimitives; + private final TypeRegistry typeRegistry; private final ExtensionRegistryLite extensionRegistry; @@ -179,23 +183,25 @@ public final class TextFormat { private final boolean singleLine; - // Any API level higher than this level will be reported. This is set to - // ABSTRACT_MUTABLE_TO_STRING by default to prevent reporting for now. + // Any API level equal to or greater than this level will be reported. This is set to + // REPORT_NONE by default to prevent reporting for now. private static final ThreadLocal<FieldReporterLevel> sensitiveFieldReportingLevel = new ThreadLocal<FieldReporterLevel>() { @Override protected FieldReporterLevel initialValue() { - return FieldReporterLevel.ABSTRACT_MUTABLE_TO_STRING; + return FieldReporterLevel.REPORT_NONE; } }; private Printer( boolean escapeNonAscii, + boolean useShortRepeatedPrimitives, TypeRegistry typeRegistry, ExtensionRegistryLite extensionRegistry, boolean enablingSafeDebugFormat, boolean singleLine) { this.escapeNonAscii = escapeNonAscii; + this.useShortRepeatedPrimitives = useShortRepeatedPrimitives; this.typeRegistry = typeRegistry; this.extensionRegistry = extensionRegistry; this.enablingSafeDebugFormat = enablingSafeDebugFormat; @@ -213,7 +219,12 @@ public final class TextFormat { */ public Printer escapingNonAscii(boolean escapeNonAscii) { return new Printer( - escapeNonAscii, typeRegistry, extensionRegistry, enablingSafeDebugFormat, singleLine); + escapeNonAscii, + useShortRepeatedPrimitives, + typeRegistry, + extensionRegistry, + enablingSafeDebugFormat, + singleLine); } /** @@ -227,7 +238,12 @@ public final class TextFormat { throw new IllegalArgumentException("Only one typeRegistry is allowed."); } return new Printer( - escapeNonAscii, typeRegistry, extensionRegistry, enablingSafeDebugFormat, singleLine); + escapeNonAscii, + useShortRepeatedPrimitives, + typeRegistry, + extensionRegistry, + enablingSafeDebugFormat, + singleLine); } /** @@ -241,7 +257,12 @@ public final class TextFormat { throw new IllegalArgumentException("Only one extensionRegistry is allowed."); } return new Printer( - escapeNonAscii, typeRegistry, extensionRegistry, enablingSafeDebugFormat, singleLine); + escapeNonAscii, + useShortRepeatedPrimitives, + typeRegistry, + extensionRegistry, + enablingSafeDebugFormat, + singleLine); } /** @@ -255,7 +276,30 @@ public final class TextFormat { */ Printer enablingSafeDebugFormat(boolean enablingSafeDebugFormat) { return new Printer( - escapeNonAscii, typeRegistry, extensionRegistry, enablingSafeDebugFormat, singleLine); + escapeNonAscii, + useShortRepeatedPrimitives, + typeRegistry, + extensionRegistry, + enablingSafeDebugFormat, + singleLine); + } + + /** + * Return a new Printer instance that outputs primitive repeated fields in short notation + * + * @param useShortRepeatedPrimitives If true, repeated fields with a primitive type are printed + * using the short hand notation with comma-delimited field values in square brackets. + * @return a new Printer that clones all other configurations from the current {@link Printer}, + * with the useShortRepeatedPrimitives mode set to the given parameter. + */ + public Printer usingShortRepeatedPrimitives(boolean useShortRepeatedPrimitives) { + return new Printer( + escapeNonAscii, + useShortRepeatedPrimitives, + typeRegistry, + extensionRegistry, + enablingSafeDebugFormat, + singleLine); } /** @@ -267,7 +311,12 @@ public final class TextFormat { */ public Printer emittingSingleLine(boolean singleLine) { return new Printer( - escapeNonAscii, typeRegistry, extensionRegistry, enablingSafeDebugFormat, singleLine); + escapeNonAscii, + useShortRepeatedPrimitives, + typeRegistry, + extensionRegistry, + enablingSafeDebugFormat, + singleLine); } void setSensitiveFieldReportingLevel(FieldReporterLevel level) { @@ -285,7 +334,8 @@ public final class TextFormat { void print(final MessageOrBuilder message, final Appendable output, FieldReporterLevel level) throws IOException { - TextGenerator generator = setSingleLineOutput(output, this.singleLine, level); + TextGenerator generator = + setSingleLineOutput(output, this.singleLine, message.getDescriptorForType(), level); print(message, generator); } @@ -397,9 +447,12 @@ public final class TextFormat { printSingleField(field, adapter.getEntry(), generator); } } else if (field.isRepeated()) { - // Repeated field. Print each element. - for (Object element : (List<?>) value) { - printSingleField(field, element, generator); + if (useShortRepeatedPrimitives && field.getJavaType() != FieldDescriptor.JavaType.MESSAGE) { + printShortRepeatedField(field, value, generator); + } else { + for (Object element : (List<?>) value) { + printSingleField(field, element, generator); + } } } else { printSingleField(field, value, generator); @@ -407,68 +460,57 @@ public final class TextFormat { } /** An adapter class that can take a {@link MapEntry} and returns its key and entry. */ - private static class MapEntryAdapter implements Comparable<MapEntryAdapter> { + static class MapEntryAdapter implements Comparable<MapEntryAdapter> { private Object entry; - - @SuppressWarnings({"rawtypes"}) - private MapEntry mapEntry; - - private final FieldDescriptor.JavaType fieldType; + private Message messageEntry; + private final FieldDescriptor keyField; MapEntryAdapter(Object entry, FieldDescriptor fieldDescriptor) { - if (entry instanceof MapEntry) { - this.mapEntry = (MapEntry) entry; + if (entry instanceof Message) { + this.messageEntry = (Message) entry; } else { this.entry = entry; } - this.fieldType = extractFieldType(fieldDescriptor); - } - - private static FieldDescriptor.JavaType extractFieldType(FieldDescriptor fieldDescriptor) { - return fieldDescriptor.getMessageType().getFields().get(0).getJavaType(); + this.keyField = fieldDescriptor.getMessageType().findFieldByName("key"); } Object getKey() { - if (mapEntry != null) { - return mapEntry.getKey(); + if (messageEntry != null && keyField != null) { + return messageEntry.getField(keyField); } return null; } Object getEntry() { - if (mapEntry != null) { - return mapEntry; + if (messageEntry != null) { + return messageEntry; } return entry; } @Override public int compareTo(MapEntryAdapter b) { - if (getKey() == null || b.getKey() == null) { - logger.info("Invalid key for map field."); + Object aKey = getKey(); + Object bKey = b.getKey(); + if (aKey == null && bKey == null) { + return 0; + } else if (aKey == null) { return -1; - } - switch (fieldType) { - case BOOLEAN: - return ((Boolean) getKey()).compareTo((Boolean) b.getKey()); - case LONG: - return ((Long) getKey()).compareTo((Long) b.getKey()); - case INT: - return ((Integer) getKey()).compareTo((Integer) b.getKey()); - case STRING: - String aString = (String) getKey(); - String bString = (String) b.getKey(); - if (aString == null && bString == null) { + } else if (bKey == null) { + return 1; + } else { + switch (keyField.getJavaType()) { + case BOOLEAN: + return ((Boolean) aKey).compareTo((Boolean) bKey); + case LONG: + return ((Long) aKey).compareTo((Long) bKey); + case INT: + return ((Integer) aKey).compareTo((Integer) bKey); + case STRING: + return ((String) aKey).compareTo((String) bKey); + default: return 0; - } else if (aString == null && bString != null) { - return -1; - } else if (aString != null && bString == null) { - return 1; - } else { - return aString.compareTo(bString); - } - default: - return 0; + } } } } @@ -568,55 +610,13 @@ public final class TextFormat { } } - private boolean shouldRedactOptionValue(EnumValueDescriptor optionValue) { - if (optionValue.getOptions().hasDebugRedact()) { - return optionValue.getOptions().getDebugRedact(); - } - return false; - } - // The criteria for redacting a field is as follows: 1) The enablingSafeDebugFormat printer - // option - // must be on. 2) The field must be marked by a debug_redact=true option, or is marked by an - // option with an enum value that is marked by a debug_redact=true option. - @SuppressWarnings("unchecked") // List<EnumValueDescriptor> guaranteed by protobuf runtime. + // option must be on. 2) The field must be considered "sensitive". A sensitive field can be + // marked as sensitive via two methods: a) via a direct debug_redact=true annotation on the + // field, b) via an enum field marked with debug_redact=true that is within the proto's + // FieldOptions, either directly or indirectly via a message option. private boolean shouldRedact(final FieldDescriptor field, TextGenerator generator) { - // Skip checking if it's sensitive and potentially reporting it if we don't care about either. - if (!shouldReport(generator.fieldReporterLevel) && !enablingSafeDebugFormat) { - return false; - } - boolean isSensitive = false; - if (field.getOptions().hasDebugRedact() && field.getOptions().getDebugRedact()) { - isSensitive = true; - } else { - // Iterate through every option; if it's an enum, we check each enum value for debug_redact. - for (Map.Entry<Descriptors.FieldDescriptor, Object> entry : - field.getOptions().getAllFields().entrySet()) { - Descriptors.FieldDescriptor option = entry.getKey(); - if (option.getType() != Descriptors.FieldDescriptor.Type.ENUM) { - continue; - } - if (option.isRepeated()) { - for (EnumValueDescriptor value : (List<EnumValueDescriptor>) entry.getValue()) { - if (shouldRedactOptionValue(value)) { - isSensitive = true; - break; - } - } - } else { - EnumValueDescriptor optionValue = (EnumValueDescriptor) entry.getValue(); - if (shouldRedactOptionValue(optionValue)) { - isSensitive = true; - break; - } - } - } - } - return isSensitive && enablingSafeDebugFormat; - } - - private boolean shouldReport(FieldReporterLevel level) { - return sensitiveFieldReportingLevel.get().compareTo(level) < 0; + return enablingSafeDebugFormat && field.isSensitive(); } /** Like {@code print()}, but writes directly to a {@code String} and returns it. */ @@ -748,6 +748,22 @@ public final class TextFormat { printUnknownFields(message.getUnknownFields(), generator, this.enablingSafeDebugFormat); } + private void printShortRepeatedField( + final FieldDescriptor field, final Object value, final TextGenerator generator) + throws IOException { + generator.print(field.getName()); + generator.print(": "); + generator.print("["); + String separator = ""; + for (Object element : (List<?>) value) { + generator.print(separator); + printFieldValue(field, element, generator); + separator = ", "; + } + generator.print("]"); + generator.eol(); + } + private void printSingleField( final FieldDescriptor field, final Object value, final TextGenerator generator) throws IOException { @@ -861,12 +877,15 @@ public final class TextFormat { } private static TextGenerator setSingleLineOutput(Appendable output, boolean singleLine) { - return new TextGenerator(output, singleLine, Printer.FieldReporterLevel.NO_REPORT); + return new TextGenerator(output, singleLine, null, Printer.FieldReporterLevel.TEXT_GENERATOR); } private static TextGenerator setSingleLineOutput( - Appendable output, boolean singleLine, Printer.FieldReporterLevel fieldReporterLevel) { - return new TextGenerator(output, singleLine, fieldReporterLevel); + Appendable output, + boolean singleLine, + Descriptor rootMessageType, + Printer.FieldReporterLevel fieldReporterLevel) { + return new TextGenerator(output, singleLine, rootMessageType, fieldReporterLevel); } /** An inner class for writing text to the output stream. */ @@ -881,13 +900,18 @@ public final class TextFormat { // Indicate which Protobuf public stringification API (e.g AbstractMessage.toString()) is // called. private final Printer.FieldReporterLevel fieldReporterLevel; + // The root message type being printed. Null if the root message type is not known (e.g. + // printing a field). + private final Descriptor rootMessageType; private TextGenerator( final Appendable output, boolean singleLineMode, + Descriptor rootMessageType, Printer.FieldReporterLevel fieldReporterLevel) { this.output = output; this.singleLineMode = singleLineMode; + this.rootMessageType = rootMessageType; this.fieldReporterLevel = fieldReporterLevel; } @@ -956,14 +980,9 @@ public final class TextFormat { * Scanner} provides no way to inspect the contents of delimiters, making it impossible to * keep track of line and column numbers. * </ul> - * - * <p>Luckily, Java's regular expression support does manage to be useful to us. (Barely: We need - * {@code Matcher.usePattern()}, which is new in Java 1.5.) So, we can use that, at least. - * Unfortunately, this implies that we need to have the entire input in one contiguous string. */ private static final class Tokenizer { private final CharSequence text; - private final Matcher matcher; private String currentToken; // The character index within this.text at which the current token begins. @@ -972,42 +991,16 @@ public final class TextFormat { // The line and column numbers of the current token. private int line = 0; private int column = 0; + private int lineInfoTrackingPos = 0; // The line and column numbers of the previous token (allows throwing // errors *after* consuming). private int previousLine = 0; private int previousColumn = 0; - // We use possessive quantifiers (*+ and ++) because otherwise the Java - // regex matcher has stack overflows on large inputs. - private static final Pattern WHITESPACE = Pattern.compile("(\\s|(#.*$))++", Pattern.MULTILINE); - private static final Pattern TOKEN = - Pattern.compile( - "[a-zA-Z_][0-9a-zA-Z_+-]*+|" // an identifier - + "[.]?[0-9+-][0-9a-zA-Z_.+-]*+|" // a number - + "\"([^\"\n\\\\]|\\\\.)*+(\"|\\\\?$)|" // a double-quoted string - + "\'([^\'\n\\\\]|\\\\.)*+(\'|\\\\?$)", // a single-quoted string - Pattern.MULTILINE); - - private static final Pattern DOUBLE_INFINITY = - Pattern.compile("-?inf(inity)?", Pattern.CASE_INSENSITIVE); - private static final Pattern FLOAT_INFINITY = - Pattern.compile("-?inf(inity)?f?", Pattern.CASE_INSENSITIVE); - private static final Pattern FLOAT_NAN = Pattern.compile("nanf?", Pattern.CASE_INSENSITIVE); - - /** - * {@link containsSilentMarkerAfterCurrentToken} indicates if there is a silent marker after the - * current token. This value is moved to {@link containsSilentMarkerAfterPrevToken} every time - * the next token is parsed. - */ - private boolean containsSilentMarkerAfterCurrentToken = false; - - private boolean containsSilentMarkerAfterPrevToken = false; - /** Construct a tokenizer that parses tokens from the given text. */ private Tokenizer(final CharSequence text) { this.text = text; - this.matcher = WHITESPACE.matcher(text); skipWhitespace(); nextToken(); } @@ -1028,14 +1021,6 @@ public final class TextFormat { return column; } - boolean getContainsSilentMarkerAfterCurrentToken() { - return containsSilentMarkerAfterCurrentToken; - } - - boolean getContainsSilentMarkerAfterPrevToken() { - return containsSilentMarkerAfterPrevToken; - } - /** Are we at the end of the input? */ boolean atEnd() { return currentToken.length() == 0; @@ -1047,41 +1032,156 @@ public final class TextFormat { previousColumn = column; // Advance the line counter to the current position. - while (pos < matcher.regionStart()) { - if (text.charAt(pos) == '\n') { + while (lineInfoTrackingPos < pos) { + if (text.charAt(lineInfoTrackingPos) == '\n') { ++line; column = 0; } else { ++column; } - ++pos; + ++lineInfoTrackingPos; } // Match the next token. - if (matcher.regionStart() == matcher.regionEnd()) { - // EOF - currentToken = ""; + if (pos == text.length()) { + currentToken = ""; // EOF } else { - matcher.usePattern(TOKEN); - if (matcher.lookingAt()) { - currentToken = matcher.group(); - matcher.region(matcher.end(), matcher.regionEnd()); - } else { - // Take one character. - currentToken = String.valueOf(text.charAt(pos)); - matcher.region(pos + 1, matcher.regionEnd()); + currentToken = nextTokenInternal(); + skipWhitespace(); + } + } + + private String nextTokenInternal() { + final int textLength = this.text.length(); + final int startPos = this.pos; + final char startChar = this.text.charAt(startPos); + + int endPos = pos; + if (isAlphaUnder(startChar)) { // Identifier + while (++endPos != textLength) { + char c = this.text.charAt(endPos); + if (!(isAlphaUnder(c) || isDigitPlusMinus(c))) { + break; + } + } + } else if (isDigitPlusMinus(startChar) || startChar == '.') { // Number + if (startChar == '.') { // Optional leading dot + if (++endPos == textLength) { + return nextTokenSingleChar(); + } + + if (!isDigitPlusMinus(this.text.charAt(endPos))) { // Mandatory first digit + return nextTokenSingleChar(); + } } - skipWhitespace(); + while (++endPos != textLength) { + char c = this.text.charAt(endPos); + if (!(isDigitPlusMinus(c) || isAlphaUnder(c) || c == '.')) { + break; + } + } + } else if (startChar == '"' || startChar == '\'') { // String + while (++endPos != textLength) { + char c = this.text.charAt(endPos); + if (c == startChar) { + ++endPos; + break; // Quote terminates + } else if (c == '\n') { + break; // Newline terminates (error during parsing) (not consumed) + } else if (c == '\\') { + if (++endPos == textLength) { + break; // Escape into end-of-text terminates (error during parsing) + } else if (this.text.charAt(endPos) == '\n') { + break; // Escape into newline terminates (error during parsing) (not consumed) + } else { + // Otherwise the escaped char is legal and consumed + } + } else { + // Otherwise the char is a legal and consumed + } + } + } else { + return nextTokenSingleChar(); // Unrecognized start character + } + + this.pos = endPos; + return this.text.subSequence(startPos, endPos).toString(); + } + + private static boolean isAlphaUnder(char c) { + // Defining this char-class with numeric comparisons is much faster than using a regex. + return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '_'; + } + + private static boolean isDigitPlusMinus(char c) { + // Defining this char-class with numeric comparisons is much faster than using a regex. + return ('0' <= c && c <= '9') || c == '+' || c == '-'; + } + + private static boolean isWhitespace(char c) { + // Defining this char-class with numeric comparisons is much faster than using a regex. + return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t'; + } + + /** + * Produce a token for the single char at the current position. + * + * <p>We hardcode the expected single-char tokens to avoid allocating a unique string every + * time, which is a GC risk. String-literals are always loaded from the class constant pool. + * + * <p>This method must not be called if the current position is after the end-of-text. + */ + private String nextTokenSingleChar() { + final char c = this.text.charAt(this.pos++); + switch (c) { + case ':': + return ":"; + case ',': + return ","; + case '[': + return "["; + case ']': + return "]"; + case '{': + return "{"; + case '}': + return "}"; + case '<': + return "<"; + case '>': + return ">"; + default: + // If we don't recognize the char, create a string and let the parser report any errors + return String.valueOf(c); } } /** Skip over any whitespace so that the matcher region starts at the next token. */ private void skipWhitespace() { - matcher.usePattern(WHITESPACE); - if (matcher.lookingAt()) { - matcher.region(matcher.end(), matcher.regionEnd()); + final int textLength = this.text.length(); + final int startPos = this.pos; + + int endPos = this.pos - 1; + while (++endPos != textLength) { + char c = this.text.charAt(endPos); + if (c == '#') { + while (++endPos != textLength) { + if (this.text.charAt(endPos) == '\n') { + break; // Consume the newline as whitespace. + } + } + if (endPos == textLength) { + break; + } + } else if (isWhitespace(c)) { + // OK + } else { + break; + } } + + this.pos = endPos; } /** @@ -1113,8 +1213,7 @@ public final class TextFormat { return false; } - final char c = currentToken.charAt(0); - return ('0' <= c && c <= '9') || c == '-' || c == '+'; + return isDigitPlusMinus(currentToken.charAt(0)); } /** Returns {@code true} if the current token's text is equal to that specified. */ @@ -1129,11 +1228,7 @@ public final class TextFormat { String consumeIdentifier() throws ParseException { for (int i = 0; i < currentToken.length(); i++) { final char c = currentToken.charAt(i); - if (('a' <= c && c <= 'z') - || ('A' <= c && c <= 'Z') - || ('0' <= c && c <= '9') - || (c == '_') - || (c == '.')) { + if (isAlphaUnder(c) || ('0' <= c && c <= '9') || (c == '.')) { // OK } else { throw parseException("Expected identifier. Found '" + currentToken + "'"); @@ -1247,15 +1342,22 @@ public final class TextFormat { public double consumeDouble() throws ParseException { // We need to parse infinity and nan separately because // Double.parseDouble() does not accept "inf", "infinity", or "nan". - if (DOUBLE_INFINITY.matcher(currentToken).matches()) { - final boolean negative = currentToken.startsWith("-"); - nextToken(); - return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; - } - if (currentToken.equalsIgnoreCase("nan")) { - nextToken(); - return Double.NaN; + switch (currentToken.toLowerCase(Locale.ROOT)) { + case "-inf": + case "-infinity": + nextToken(); + return Double.NEGATIVE_INFINITY; + case "inf": + case "infinity": + nextToken(); + return Double.POSITIVE_INFINITY; + case "nan": + nextToken(); + return Double.NaN; + default: + // fall through } + try { final double result = Double.parseDouble(currentToken); nextToken(); @@ -1285,15 +1387,27 @@ public final class TextFormat { public float consumeFloat() throws ParseException { // We need to parse infinity and nan separately because // Float.parseFloat() does not accept "inf", "infinity", or "nan". - if (FLOAT_INFINITY.matcher(currentToken).matches()) { - final boolean negative = currentToken.startsWith("-"); - nextToken(); - return negative ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY; - } - if (FLOAT_NAN.matcher(currentToken).matches()) { - nextToken(); - return Float.NaN; + switch (currentToken.toLowerCase(Locale.ROOT)) { + case "-inf": + case "-inff": + case "-infinity": + case "-infinityf": + nextToken(); + return Float.NEGATIVE_INFINITY; + case "inf": + case "inff": + case "infinity": + case "infinityf": + nextToken(); + return Float.POSITIVE_INFINITY; + case "nan": + case "nanf": + nextToken(); + return Float.NaN; + default: + // fall through } + try { final float result = Float.parseFloat(currentToken); nextToken(); @@ -1595,19 +1709,6 @@ public final class TextFormat { * control the parser behavior. */ public static class Parser { - - /** - * A valid silent marker appears between a field name and its value. If there is a ":" in - * between, the silent marker will only appear after the colon. This is called after a field - * name is parsed, and before the ":" if it exists. If the current token is ":", then - * containsSilentMarkerAfterCurrentToken indicates if there is a valid silent marker. Otherwise, - * the current token is part of the field value, so the silent marker is indicated by - * containsSilentMarkerAfterPrevToken. - */ - private void detectSilentMarker( - Tokenizer tokenizer, Descriptor immediateMessageType, String fieldName) { - } - /** * Determines if repeated values for non-repeated fields and oneofs are permitted. For example, * given required/optional field "foo" and a oneof containing "baz" and "moo": @@ -1980,14 +2081,12 @@ public final class TextFormat { // Skips unknown fields. if (field == null) { - detectSilentMarker(tokenizer, type, name); guessFieldTypeAndSkip(tokenizer, type, recursionLimit); return; } // Handle potential ':'. if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { - detectSilentMarker(tokenizer, type, field.getFullName()); tokenizer.tryConsume(":"); // optional if (parseTreeBuilder != null) { TextFormatParseInfoTree.Builder childParseTreeBuilder = @@ -2013,7 +2112,6 @@ public final class TextFormat { recursionLimit); } } else { - detectSilentMarker(tokenizer, type, field.getFullName()); tokenizer.consume(":"); // required consumeFieldValues( tokenizer, @@ -2037,27 +2135,26 @@ public final class TextFormat { } } - private String consumeFullTypeName(Tokenizer tokenizer) throws ParseException { + private void consumeFullTypeName(Tokenizer tokenizer) throws ParseException { // If there is not a leading `[`, this is just a type name. if (!tokenizer.tryConsume("[")) { - return tokenizer.consumeIdentifier(); + tokenizer.consumeIdentifier(); + return; } // Otherwise, this is an extension or google.protobuf.Any type URL: we consume proto path // elements until we've addressed the type. - String name = tokenizer.consumeIdentifier(); + tokenizer.consumeIdentifier(); while (tokenizer.tryConsume(".")) { - name += "." + tokenizer.consumeIdentifier(); + tokenizer.consumeIdentifier(); } if (tokenizer.tryConsume("/")) { - name += "/" + tokenizer.consumeIdentifier(); + tokenizer.consumeIdentifier(); while (tokenizer.tryConsume(".")) { - name += "." + tokenizer.consumeIdentifier(); + tokenizer.consumeIdentifier(); } } tokenizer.consume("]"); - - return name; } /** @@ -2303,7 +2400,6 @@ public final class TextFormat { throw tokenizer.parseExceptionPreviousToken("Expected a valid type URL."); } } - detectSilentMarker(tokenizer, anyDescriptor, typeUrlBuilder.toString()); tokenizer.tryConsume(":"); final String anyEndToken; if (tokenizer.tryConsume("<")) { @@ -2348,8 +2444,7 @@ public final class TextFormat { /** Skips the next field including the field's name and value. */ private void skipField(Tokenizer tokenizer, Descriptor type, int recursionLimit) throws ParseException { - String name = consumeFullTypeName(tokenizer); - detectSilentMarker(tokenizer, type, name); + consumeFullTypeName(tokenizer); guessFieldTypeAndSkip(tokenizer, type, recursionLimit); // For historical reasons, fields may optionally be separated by commas or diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java index 154efaa551962..a6469bfff3bde 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java @@ -59,7 +59,8 @@ public final class TextFormatParseLocation { } @Override - public boolean equals(Object o) { + public boolean equals( + Object o) { if (o == this) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java index 80602b16359aa..5e2683dc6ccd1 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java @@ -93,6 +93,9 @@ abstract class UnknownFieldSchema<T, B> { addGroup(unknownFields, fieldNumber, toImmutable(subFields)); return true; case WireFormat.WIRETYPE_END_GROUP: + if (currentDepth == 0) { + throw InvalidProtocolBufferException.invalidEndTag(); + } return false; default: throw InvalidProtocolBufferException.invalidWireType(); diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java index 40fc62596b380..de50583c4ff9b 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java @@ -66,7 +66,8 @@ public final class UnknownFieldSet implements MessageLite { new UnknownFieldSet(new TreeMap<Integer, Field>()); @Override - public boolean equals(Object other) { + public boolean equals( + Object other) { if (this == other) { return true; } @@ -530,6 +531,7 @@ public final class UnknownFieldSet implements MessageLite { getFieldBuilder(number).addGroup(subBuilder.build()); return true; case WireFormat.WIRETYPE_END_GROUP: + input.checkValidEndTag(); return false; case WireFormat.WIRETYPE_FIXED32: getFieldBuilder(number).addFixed32(input.readFixed32()); @@ -739,7 +741,8 @@ public final class UnknownFieldSet implements MessageLite { } @Override - public boolean equals(Object other) { + public boolean equals( + Object other) { if (this == other) { return true; } diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java index 36c9481d7e4ec..da905a52db43d 100644 --- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java @@ -299,7 +299,8 @@ public final class UnknownFieldSetLite { } @Override - public boolean equals(Object obj) { + public boolean equals( + Object obj) { if (this == obj) { return true; } @@ -426,6 +427,7 @@ public final class UnknownFieldSetLite { storeField(tag, subFieldSet); return true; case WireFormat.WIRETYPE_END_GROUP: + input.checkValidEndTag(); return false; default: throw InvalidProtocolBufferException.invalidWireType(); diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnredactedDebugFormatForTest.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnredactedDebugFormatForTest.java new file mode 100644 index 0000000000000..e28ddd30502bb --- /dev/null +++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnredactedDebugFormatForTest.java @@ -0,0 +1,39 @@ +package com.google.protobuf; + +/** + * These APIs are restricted to test-only targets, and are suitable for test purposes where it is + * impractical to compare protos directly via ProtoTruth (e.g. log output). + */ +public final class UnredactedDebugFormatForTest { + + private UnredactedDebugFormatForTest() {} + + /** Like {@code TextFormat.printer().printToString(message)}, but for test assertion purposes. */ + public static String unredactedMultilineString(MessageOrBuilder message) { + return TextFormat.printer() + .printToString(message, TextFormat.Printer.FieldReporterLevel.TEXT_GENERATOR); + } + + /** Like {@code TextFormat.printer().printToString(fields)}, but for test assertion purposes. */ + public static String unredactedMultilineString(UnknownFieldSet fields) { + return TextFormat.printer().printToString(fields); + } + + /** + * Like {@code TextFormat.printer().emittingSingleLine(true).printToString(message)}, but for test + * assertion purposes. + */ + public static String unredactedSingleLineString(MessageOrBuilder message) { + return TextFormat.printer() + .emittingSingleLine(true) + .printToString(message, TextFormat.Printer.FieldReporterLevel.TEXT_GENERATOR); + } + + /** + * Like {@code TextFormat.printer().emittingSingleLine(true).printToString(fields)}, but for test + * assertion purposes. + */ + public static String unredactedSingleLineString(UnknownFieldSet fields) { + return TextFormat.printer().emittingSingleLine(true).printToString(fields); + } +} diff --git a/third_party/protobuf/java/core/src/main/resources/google/protobuf/java_features.proto b/third_party/protobuf/java/core/src/main/resources/google/protobuf/java_features.proto index 1c6dbdbcdabe0..3f8ee1a225d0d 100644 --- a/third_party/protobuf/java/core/src/main/resources/google/protobuf/java_features.proto +++ b/third_party/protobuf/java/core/src/main/resources/google/protobuf/java_features.proto @@ -1,3 +1,4 @@ + // Protocol Buffers - Google's data interchange format // Copyright 2023 Google Inc. All rights reserved. // @@ -66,4 +67,21 @@ message JavaFeatures { }, edition_defaults = { edition: EDITION_LEGACY, value: "DEFAULT" } ]; + + // Whether to use the old default outer class name scheme, or the new feature + // which adds a "Proto" suffix to the outer class name. + // + // Users will not be able to set this option, because we removed it in the + // same edition that it was introduced. But we use it to determine which + // naming scheme to use for outer class name defaults. + optional bool use_old_outer_classname_default = 4 [ + retention = RETENTION_RUNTIME, + targets = TARGET_TYPE_FILE, + feature_support = { + edition_introduced: EDITION_2024, + edition_removed: EDITION_2024, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "true" }, + edition_defaults = { edition: EDITION_2024, value: "false" } + ]; } diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java index 60aa76b6ec0f4..2db4bffa4d7c0 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java @@ -13,15 +13,15 @@ import static com.google.protobuf.TestUtil.TEST_REQUIRED_INITIALIZED; import static com.google.protobuf.TestUtil.TEST_REQUIRED_UNINITIALIZED; import com.google.protobuf.Descriptors.FieldDescriptor; -import protobuf_unittest.UnittestOptimizeFor.TestOptimizedForSize; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.ForeignMessage; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestPackedTypes; -import protobuf_unittest.UnittestProto.TestRequired; -import protobuf_unittest.UnittestProto.TestRequiredForeign; -import protobuf_unittest.UnittestProto.TestUnpackedTypes; +import proto2_unittest.UnittestOptimizeFor.TestOptimizedForSize; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.ForeignMessage; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.UnittestProto.TestRequired; +import proto2_unittest.UnittestProto.TestRequiredForeign; +import proto2_unittest.UnittestProto.TestUnpackedTypes; import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AnyTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AnyTest.java index c84f6e64e9d8b..6fb97653264bb 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AnyTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/AnyTest.java @@ -11,7 +11,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import any_test.AnyTestProto.TestAny; -import protobuf_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes; import java.util.Objects; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CachedFieldSizeTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CachedFieldSizeTest.java index a4e5e2ad7a07a..eade2418997d5 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CachedFieldSizeTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CachedFieldSizeTest.java @@ -9,9 +9,9 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.TestCachedFieldSizeMessage; +import proto2_unittest.UnittestProto.TestPackedTypes; import proto3_unittest.UnittestProto3; -import protobuf_unittest.TestCachedFieldSizeMessage; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java index f73cb3b0eecf3..22be2a8891219 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java @@ -14,11 +14,13 @@ import static org.junit.Assert.assertThrows; import com.google.common.primitives.Bytes; import map_test.MapTestProto.MapContainer; -import protobuf_unittest.UnittestProto.BoolMessage; -import protobuf_unittest.UnittestProto.Int32Message; -import protobuf_unittest.UnittestProto.Int64Message; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestRecursiveMessage; +import proto2_unittest.UnittestProto.BoolMessage; +import proto2_unittest.UnittestProto.Int32Message; +import proto2_unittest.UnittestProto.Int64Message; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestRecursiveMessage; +import com.google.testing.junit.testparameterinjector.TestParameter; +import com.google.testing.junit.testparameterinjector.TestParameterInjector; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FilterInputStream; @@ -28,12 +30,12 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.Supplier; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; /** Unit test for {@link CodedInputStream}. */ -@RunWith(JUnit4.class) +@RunWith(TestParameterInjector.class) public class CodedInputStreamTest { private static final int DEFAULT_BLOCK_SIZE = 4096; @@ -44,7 +46,6 @@ public class CodedInputStreamTest { private static final byte[] NESTING_SGROUP_WITH_INITIAL_BYTES = generateSGroupTagsForMapField(); - private enum InputType { ARRAY { @Override @@ -1405,6 +1406,41 @@ public class CodedInputStreamTest { } } + @Test + public void testByteBufferInputStreamReadBytesWithAliasConcurrently() { + int size = 127; + assertThat(CodedOutputStream.computeInt32SizeNoTag(size)).isEqualTo(1); + ByteBuffer input = ByteBuffer.allocateDirect(1 + size); + input.put(0, (byte) size); + + Supplier<ByteString> embeddedBytes = + () -> { + try { + final CodedInputStream inputStream = CodedInputStream.newInstance(input, true); + inputStream.enableAliasing(true); + return inputStream.readBytes(); + } catch (IOException e) { + throw new RuntimeException(e); + } + }; + + assertThat(embeddedBytes.get().size()).isEqualTo(size); + + // Concurrent reader should have no impact. + int iterations = 100000; + new Thread( + () -> { + for (int i = 0; i < iterations; i++) { + ByteString unused = embeddedBytes.get(); + } + }) + .start(); + + for (int i = 0; i < iterations; i++) { + assertThat(embeddedBytes.get().size()).isEqualTo(size); + } + } + @Test public void testIterableByteBufferInputStreamReadBytesWithAlias() throws Exception { ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); @@ -1488,6 +1524,38 @@ public class CodedInputStreamTest { } } + @Test + public void testSkipInvalidEndGroup(@TestParameter InputType inputType) throws Exception { + byte[] data = new byte[] {(byte) WireFormat.makeTag(1, WireFormat.WIRETYPE_END_GROUP)}; + + CodedInputStream input = CodedInputStream.newInstance(data); + assertThrows(InvalidProtocolBufferException.class, () -> input.skipField(input.readTag())); + + CodedInputStream input2 = CodedInputStream.newInstance(data); + CodedOutputStream output = CodedOutputStream.newInstance(new byte[1]); + assertThrows( + InvalidProtocolBufferException.class, () -> input2.skipField(input2.readTag(), output)); + } + + @Test + public void testSkipInvalidEndGroup_nested(@TestParameter InputType inputType) throws Exception { + ByteString.Output output = ByteString.newOutput(); + CodedOutputStream codedOutput = CodedOutputStream.newInstance(output); + codedOutput.writeTag(1, WireFormat.WIRETYPE_START_GROUP); + codedOutput.writeTag(2, WireFormat.WIRETYPE_END_GROUP); + codedOutput.writeTag(1, WireFormat.WIRETYPE_END_GROUP); + codedOutput.flush(); + byte[] data = output.toByteString().toByteArray(); + + CodedInputStream input = CodedInputStream.newInstance(data); + assertThrows(InvalidProtocolBufferException.class, () -> input.skipField(input.readTag())); + + CodedInputStream input2 = CodedInputStream.newInstance(data); + assertThrows( + InvalidProtocolBufferException.class, + () -> input2.skipField(input2.readTag(), codedOutput)); + } + @Test public void testSkipPastEndOfByteArrayInput() throws Exception { try { diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java index 7a808e9f13083..a30d8bd355321 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java @@ -13,11 +13,13 @@ import static com.google.common.truth.TruthJUnit.assume; import static org.junit.Assert.assertThrows; import com.google.protobuf.CodedOutputStream.OutOfSpaceException; -import protobuf_unittest.UnittestProto.SparseEnumMessage; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestSparseEnum; +import proto2_unittest.UnittestProto.SparseEnumMessage; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestSparseEnum; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.List; @@ -46,13 +48,41 @@ public class CodedOutputStreamTest { byte[] toByteArray(); } + // Like ByteArrayOutputStream, but doesn't dynamically grow the backing byte[]. Instead, it + // throws OutOfSpaceException if we overflow the backing byte[]. + private static final class FixedSizeByteArrayOutputStream extends OutputStream { + private final byte[] buf; + private int size = 0; + + FixedSizeByteArrayOutputStream(int size) { + this.buf = new byte[size]; + } + + @Override + public void write(int b) throws IOException { + try { + buf[size] = (byte) b; + } catch (IndexOutOfBoundsException e) { + // Real OutputStreams probably won't be so kind as to throw the exact OutOfSpaceException + // that we want in our tests. Throwing this makes our tests simpler, and OutputStream + // doesn't really have a good protocol for signalling running out of buffer space. + throw new OutOfSpaceException(size, buf.length, 1, e); + } + size++; + } + + public byte[] toByteArray() { + return Arrays.copyOf(buf, size); + } + } + private static final class OutputStreamCoder implements Coder { private final CodedOutputStream stream; - private final ByteArrayOutputStream output; + private final FixedSizeByteArrayOutputStream output; - OutputStreamCoder(int size) { - output = new ByteArrayOutputStream(); - stream = CodedOutputStream.newInstance(output, size); + OutputStreamCoder(int size, int blockSize) { + output = new FixedSizeByteArrayOutputStream(size); + stream = CodedOutputStream.newInstance(output, blockSize); } @Override @@ -155,6 +185,29 @@ public class CodedOutputStreamTest { } } + private static final class ByteOutputWrappingArrayCoder implements Coder { + private final CodedOutputStream stream; + private final byte[] bytes; + + ByteOutputWrappingArrayCoder(int size) { + bytes = new byte[size]; + // Any ByteOutput subclass would do. All CodedInputStreams implement ByteOutput, so it + // seemed most convenient to this this with a CodedInputStream.newInstance(byte[]). + ByteOutput byteOutput = CodedOutputStream.newInstance(bytes); + stream = CodedOutputStream.newInstance(byteOutput, size); + } + + @Override + public CodedOutputStream stream() { + return stream; + } + + @Override + public byte[] toByteArray() { + return Arrays.copyOf(bytes, stream.getTotalBytesWritten()); + } + } + private enum OutputType { ARRAY() { @Override @@ -204,7 +257,20 @@ public class CodedOutputStreamTest { STREAM() { @Override Coder newCoder(int size) { - return new OutputStreamCoder(size); + return new OutputStreamCoder(size, /* blockSize= */ size); + } + }, + STREAM_MINIMUM_BUFFER_SIZE() { + @Override + Coder newCoder(int size) { + // Block Size 0 gets rounded up to minimum block size, see AbstractBufferedEncoder. + return new OutputStreamCoder(size, /* blockSize= */ 0); + } + }, + BYTE_OUTPUT_WRAPPING_ARRAY() { + @Override + Coder newCoder(int size) { + return new ByteOutputWrappingArrayCoder(size); } }; @@ -212,8 +278,15 @@ public class CodedOutputStreamTest { /** Whether we can call CodedOutputStream.spaceLeft(). */ boolean supportsSpaceLeft() { - // STREAM doesn't know how much space is left. - return this != OutputType.STREAM; + // Buffered encoders don't know how much space is left. + switch (this) { + case STREAM: + case STREAM_MINIMUM_BUFFER_SIZE: + case BYTE_OUTPUT_WRAPPING_ARRAY: + return false; + default: + return true; + } } } @@ -288,25 +361,86 @@ public class CodedOutputStreamTest { @Test public void testWriteFixed32NoTag_outOfBounds_throws() throws Exception { - // Streaming's buffering masks out of bounds writes. - assume().that(outputType).isNotEqualTo(OutputType.STREAM); - for (int i = 0; i < 4; i++) { Coder coder = outputType.newCoder(i); - assertThrows(OutOfSpaceException.class, () -> coder.stream().writeFixed32NoTag(1)); - assertThat(coder.stream().spaceLeft()).isEqualTo(i); + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + OutOfSpaceException e = + assertThrows( + OutOfSpaceException.class, + () -> { + coder.stream().writeFixed32NoTag(1); + coder.stream().flush(); + }); + // STREAM writes one byte at a time. + if (outputType != OutputType.STREAM && outputType != OutputType.STREAM_MINIMUM_BUFFER_SIZE) { + assertThat(e).hasMessageThat().contains("len: 4"); + } + if (outputType.supportsSpaceLeft()) { + assertThat(coder.stream().spaceLeft()).isEqualTo(i); + } } } @Test public void testWriteFixed64NoTag_outOfBounds_throws() throws Exception { - // Streaming's buffering masks out of bounds writes. - assume().that(outputType).isNotEqualTo(OutputType.STREAM); - for (int i = 0; i < 8; i++) { Coder coder = outputType.newCoder(i); - assertThrows(OutOfSpaceException.class, () -> coder.stream().writeFixed64NoTag(1)); - assertThat(coder.stream().spaceLeft()).isEqualTo(i); + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + OutOfSpaceException e = + assertThrows( + OutOfSpaceException.class, + () -> { + coder.stream().writeFixed64NoTag(1); + coder.stream().flush(); + }); + if (outputType != OutputType.STREAM && outputType != OutputType.STREAM_MINIMUM_BUFFER_SIZE) { + assertThat(e).hasMessageThat().contains("len: 8"); + } + if (outputType.supportsSpaceLeft()) { + assertThat(coder.stream().spaceLeft()).isEqualTo(i); + } + } + } + + @Test + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + public void testWriteUInt32NoTag_outOfBounds_throws() throws Exception { + for (int i = 0; i < 5; i++) { + Coder coder = outputType.newCoder(i); + assertThrows( + OutOfSpaceException.class, + () -> { + coder.stream().writeUInt32NoTag(Integer.MAX_VALUE); + coder.stream().flush(); + }); + + // Space left should not go negative. + if (outputType.supportsSpaceLeft()) { + assertWithMessage("i=%s", i).that(coder.stream().spaceLeft()).isAtLeast(0); + } + } + } + + @Test + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + public void testWriteUInt64NoTag_outOfBounds_throws() throws Exception { + for (int i = 0; i < 9; i++) { + Coder coder = outputType.newCoder(i); + assertThrows( + OutOfSpaceException.class, + () -> { + coder.stream().writeUInt64NoTag(Long.MAX_VALUE); + coder.stream().flush(); + }); + + // Space left should not go negative. + if (outputType.supportsSpaceLeft()) { + assertWithMessage("i=%s", i).that(coder.stream().spaceLeft()).isAtLeast(0); + } } } @@ -473,7 +607,7 @@ public class CodedOutputStreamTest { public void testGetTotalBytesWritten() throws Exception { assume().that(outputType).isEqualTo(OutputType.STREAM); - Coder coder = outputType.newCoder(4 * 1024); + Coder coder = outputType.newCoder(/* size= */ 16 * 1024); // Write some some bytes (more than the buffer can hold) and verify that totalWritten // is correct. @@ -572,32 +706,39 @@ public class CodedOutputStreamTest { assertThat(coder.stream().spaceLeft()).isEqualTo(0); } - // Going beyond bounds should throw. Except if we're streaming, where buffering masks the - // failure. - if (outputType == OutputType.STREAM) { - return; - } - assertThrows(OutOfSpaceException.class, () -> coder.stream().write((byte) 1)); + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + OutOfSpaceException e = + assertThrows( + OutOfSpaceException.class, + () -> { + coder.stream().write((byte) 1); + coder.stream().flush(); + }); + assertThat(e).hasMessageThat().contains("len: 1"); if (outputType.supportsSpaceLeft()) { assertThat(coder.stream().spaceLeft()).isEqualTo(0); } } @Test - public void testWriteByteBuffer() throws Exception { + public void testWriteRawBytes_byteBuffer() throws Exception { byte[] value = "abcde".getBytes(Internal.UTF_8); Coder coder = outputType.newCoder(100); CodedOutputStream codedStream = coder.stream(); - ByteBuffer byteBuffer = ByteBuffer.wrap(value, 0, 1); + ByteBuffer byteBuffer = ByteBuffer.wrap(value, /* offset= */ 0, /* length= */ 1); + assertThat(byteBuffer.capacity()).isEqualTo(5); // This will actually write 5 bytes into the CodedOutputStream as the // ByteBuffer's capacity() is 5. codedStream.writeRawBytes(byteBuffer); - // The above call shouldn't affect the ByteBuffer's state. + assertThat(codedStream.getTotalBytesWritten()).isEqualTo(5); + + // writeRawBytes shouldn't affect the ByteBuffer's state. assertThat(byteBuffer.position()).isEqualTo(0); assertThat(byteBuffer.limit()).isEqualTo(1); // The correct way to write part of an array using ByteBuffer. - codedStream.writeRawBytes(ByteBuffer.wrap(value, 2, 1).slice()); + codedStream.writeRawBytes(ByteBuffer.wrap(value, /* offset= */ 2, /* length= */ 1).slice()); codedStream.flush(); byte[] result = coder.toByteArray(); @@ -609,7 +750,74 @@ public class CodedOutputStreamTest { } @Test - public void testWriteByteArrayWithOffsets() throws Exception { + public void testWrite_byteBuffer() throws Exception { + byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + Coder coder = outputType.newCoder(100); + CodedOutputStream codedStream = coder.stream(); + ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); + assertThat(byteBuffer.capacity()).isEqualTo(10); + assertThat(byteBuffer.position()).isEqualTo(0); + assertThat(byteBuffer.limit()).isEqualTo(10); + + codedStream.write(byteBuffer); + codedStream.flush(); + assertThat(codedStream.getTotalBytesWritten()).isEqualTo(10); + + // write should update the ByteBuffer's state. + assertThat(byteBuffer.position()).isEqualTo(10); + assertThat(byteBuffer.limit()).isEqualTo(10); + + assertThat(coder.toByteArray()).isEqualTo(bytes); + } + + @Test + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + public void testWrite_byteBuffer_outOfSpace() throws Exception { + byte[] bytes = new byte[10]; + + for (int i = 0; i < 10; i++) { + ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); + Coder coder = outputType.newCoder(i); + CodedOutputStream codedStream = coder.stream(); + assertThrows("i=" + i, OutOfSpaceException.class, () -> { + codedStream.write(byteBuffer); + codedStream.flush(); + }); + } + } + + @Test + public void testWrite_byteArray() throws Exception { + byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + Coder coder = outputType.newCoder(100); + CodedOutputStream codedStream = coder.stream(); + + codedStream.write(bytes, 0, bytes.length); + codedStream.flush(); + assertThat(codedStream.getTotalBytesWritten()).isEqualTo(10); + + assertThat(coder.toByteArray()).isEqualTo(bytes); + } + + @Test + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + public void testWrite_byteArray_outOfSpace() throws Exception { + byte[] bytes = new byte[10]; + + for (int i = 0; i < 10; i++) { + Coder coder = outputType.newCoder(i); + CodedOutputStream codedStream = coder.stream(); + assertThrows("i=" + i, OutOfSpaceException.class, () -> { + codedStream.write(bytes, 0, bytes.length); + codedStream.flush(); + }); + } + } + + @Test + public void testWriteByteArrayNoTag_withOffsets() throws Exception { assume().that(outputType).isEqualTo(OutputType.ARRAY); byte[] fullArray = bytes(0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88); @@ -665,24 +873,29 @@ public class CodedOutputStreamTest { // encoding invalid UTF-8 strings. @Test public void testSerializeInvalidUtf8FollowedByOutOfSpace() throws Exception { - // Streaming's buffering masks out of space errors. - assume().that(outputType).isNotEqualTo(OutputType.STREAM); - final int notEnoughBytes = 4; + // This test fails for BYTE_OUTPUT_WRAPPING_ARRAY + assume().that(outputType).isNotEqualTo(OutputType.BYTE_OUTPUT_WRAPPING_ARRAY); Coder coder = outputType.newCoder(notEnoughBytes); String invalidString = newString(Character.MIN_HIGH_SURROGATE, 'f', 'o', 'o', 'b', 'a', 'r'); - try { - coder.stream().writeStringNoTag(invalidString); - assertWithMessage("Expected OutOfSpaceException").fail(); - } catch (OutOfSpaceException e) { - assertThat(e).hasCauseThat().isInstanceOf(IndexOutOfBoundsException.class); - } + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") + OutOfSpaceException e = + assertThrows( + OutOfSpaceException.class, + () -> { + coder.stream().writeStringNoTag(invalidString); + coder.stream().flush(); + }); + assertThat(e).hasCauseThat().isInstanceOf(IndexOutOfBoundsException.class); } /** Regression test for https://github.com/protocolbuffers/protobuf/issues/292 */ @Test + // Some coders throw immediately on write, some throw on flush. + @SuppressWarnings("AssertThrowsMultipleStatements") public void testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace() throws Exception { String testCase = "Foooooooo"; assertThat(CodedOutputStream.computeUInt32SizeNoTag(testCase.length())) @@ -697,7 +910,10 @@ public class CodedOutputStreamTest { for (int i = 0; i < 11; i++) { Coder coder = outputType.newCoder(i); - assertThrows(OutOfSpaceException.class, () -> coder.stream().writeString(1, testCase)); + assertThrows(OutOfSpaceException.class, () -> { + coder.stream().writeString(1, testCase); + coder.stream().flush(); + }); } } @@ -738,22 +954,10 @@ public class CodedOutputStreamTest { * value. */ private void assertWriteFixed32(byte[] data, int value) throws Exception { - { - Coder coder = outputType.newCoder(data.length); - coder.stream().writeFixed32NoTag(value); - coder.stream().flush(); - assertThat(coder.toByteArray()).isEqualTo(data); - } - - // If streaming, try different block sizes. - if (outputType == OutputType.STREAM) { - for (int blockSize = 1; blockSize <= 16; blockSize *= 2) { - Coder coder = outputType.newCoder(blockSize); - coder.stream().writeFixed32NoTag(value); - coder.stream().flush(); - assertThat(coder.toByteArray()).isEqualTo(data); - } - } + Coder coder = outputType.newCoder(data.length); + coder.stream().writeFixed32NoTag(value); + coder.stream().flush(); + assertThat(coder.toByteArray()).isEqualTo(data); } /** @@ -761,22 +965,10 @@ public class CodedOutputStreamTest { * value. */ private void assertWriteFixed64(byte[] data, long value) throws Exception { - { - Coder coder = outputType.newCoder(data.length); - coder.stream().writeFixed64NoTag(value); - coder.stream().flush(); - assertThat(coder.toByteArray()).isEqualTo(data); - } - - // If streaming, try different block sizes. - if (outputType == OutputType.STREAM) { - for (int blockSize = 1; blockSize <= 16; blockSize *= 2) { - Coder coder = outputType.newCoder(blockSize); - coder.stream().writeFixed64NoTag(value); - coder.stream().flush(); - assertThat(coder.toByteArray()).isEqualTo(data); - } - } + Coder coder = outputType.newCoder(data.length); + coder.stream().writeFixed64NoTag(value); + coder.stream().flush(); + assertThat(coder.toByteArray()).isEqualTo(data); } private static String newString(char... chars) { @@ -837,32 +1029,6 @@ public class CodedOutputStreamTest { // Also try computing size. assertThat(data).hasLength(CodedOutputStream.computeUInt64SizeNoTag(value)); } - - // If streaming, try different block sizes. - if (outputType == OutputType.STREAM) { - for (int blockSize = 1; blockSize <= 16; blockSize *= 2) { - // Only test 32-bit write if the value fits into an int. - if (value == (int) value) { - Coder coder = outputType.newCoder(blockSize); - coder.stream().writeUInt64NoTag((int) value); - coder.stream().flush(); - assertThat(coder.toByteArray()).isEqualTo(data); - - ByteArrayOutputStream rawOutput = new ByteArrayOutputStream(); - CodedOutputStream output = CodedOutputStream.newInstance(rawOutput, blockSize); - output.writeUInt32NoTag((int) value); - output.flush(); - assertThat(rawOutput.toByteArray()).isEqualTo(data); - } - - { - Coder coder = outputType.newCoder(blockSize); - coder.stream().writeUInt64NoTag(value); - coder.stream().flush(); - assertThat(coder.toByteArray()).isEqualTo(data); - } - } - } } private void assertVarintRoundTrip(long value) throws Exception { diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java index 29d06fff54589..5540660ff8bfc 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java @@ -1,12 +1,12 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import static protobuf_unittest.UnittestProto.redactedExtension; +import static proto2_unittest.UnittestProto.redactedExtension; import com.google.protobuf.Descriptors.FieldDescriptor; -import protobuf_unittest.UnittestProto.RedactedFields; -import protobuf_unittest.UnittestProto.TestEmptyMessage; -import protobuf_unittest.UnittestProto.TestNestedMessageRedaction; +import proto2_unittest.UnittestProto.RedactedFields; +import proto2_unittest.UnittestProto.TestEmptyMessage; +import proto2_unittest.UnittestProto.TestNestedMessageRedaction; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -94,7 +94,7 @@ public class DebugFormatTest { assertThat(result) .matches( String.format( - "%s\\[protobuf_unittest\\.redacted_extension\\]: %s\n", + "%s\\[proto2_unittest\\.redacted_extension\\]: %s\n", UNSTABLE_PREFIX_MULTILINE, REDACTED_REGEX)); } diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java index 1add511205274..ec778f9deaec7 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java @@ -9,7 +9,7 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertWithMessage; -import protobuf_unittest.UnittestProto.TestDeprecatedFields; +import proto2_unittest.UnittestProto.TestDeprecatedFields; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import org.junit.Test; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java index 903e1158d548d..cc6d01eeac450 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java @@ -39,21 +39,21 @@ import com.google.protobuf.test.UnittestImport.ImportEnum; import com.google.protobuf.test.UnittestImport.ImportEnumForMap; import legacy_features_unittest.UnittestLegacyFeatures; import pb.UnittestFeatures; -import protobuf_unittest.TestCustomOptions; -import protobuf_unittest.UnittestCustomOptions; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.ForeignEnum; -import protobuf_unittest.UnittestProto.ForeignMessage; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestExtremeDefaultValues; -import protobuf_unittest.UnittestProto.TestJsonName; -import protobuf_unittest.UnittestProto.TestMultipleExtensionRanges; -import protobuf_unittest.UnittestProto.TestRequired; -import protobuf_unittest.UnittestProto.TestReservedEnumFields; -import protobuf_unittest.UnittestProto.TestReservedFields; -import protobuf_unittest.UnittestProto.TestService; -import protobuf_unittest.UnittestRetention; +import proto2_unittest.TestCustomOptions; +import proto2_unittest.UnittestCustomOptions; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.ForeignEnum; +import proto2_unittest.UnittestProto.ForeignMessage; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestExtremeDefaultValues; +import proto2_unittest.UnittestProto.TestJsonName; +import proto2_unittest.UnittestProto.TestMultipleExtensionRanges; +import proto2_unittest.UnittestProto.TestRequired; +import proto2_unittest.UnittestProto.TestReservedEnumFields; +import proto2_unittest.UnittestProto.TestReservedFields; +import proto2_unittest.UnittestProto.TestService; +import proto2_unittest.UnittestRetention; import protobuf_unittest.UnittestProto3Extensions.Proto3FileExtensions; import java.util.Collections; import java.util.List; @@ -62,8 +62,8 @@ import org.junit.Test; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; -import protobuf_unittest.NestedExtension; -import protobuf_unittest.NonNestedExtension; +import proto2_unittest.NestedExtension; +import proto2_unittest.NonNestedExtension; /** Unit test for {@link Descriptors}. */ @RunWith(Enclosed.class) @@ -92,7 +92,7 @@ public class DescriptorsTest { FileDescriptor file = UnittestProto.getDescriptor(); assertThat(file.getName()).isEqualTo("google/protobuf/unittest.proto"); - assertThat(file.getPackage()).isEqualTo("protobuf_unittest"); + assertThat(file.getPackage()).isEqualTo("proto2_unittest"); assertThat(file.getOptions().getJavaOuterClassname()).isEqualTo("UnittestProto"); assertThat(file.toProto().getName()).isEqualTo("google/protobuf/unittest.proto"); @@ -102,7 +102,7 @@ public class DescriptorsTest { assertThat(file.getMessageTypes().get(0)).isEqualTo(messageType); assertThat(file.findMessageTypeByName("TestAllTypes")).isEqualTo(messageType); assertThat(file.findMessageTypeByName("NoSuchType")).isNull(); - assertThat(file.findMessageTypeByName("protobuf_unittest.TestAllTypes")).isNull(); + assertThat(file.findMessageTypeByName("proto2_unittest.TestAllTypes")).isNull(); for (int i = 0; i < file.getMessageTypes().size(); i++) { assertThat(file.getMessageTypes().get(i).getIndex()).isEqualTo(i); } @@ -111,7 +111,7 @@ public class DescriptorsTest { assertThat(file.getEnumTypes().get(0)).isEqualTo(enumType); assertThat(file.findEnumTypeByName("ForeignEnum")).isEqualTo(enumType); assertThat(file.findEnumTypeByName("NoSuchType")).isNull(); - assertThat(file.findEnumTypeByName("protobuf_unittest.ForeignEnum")).isNull(); + assertThat(file.findEnumTypeByName("proto2_unittest.ForeignEnum")).isNull(); assertThat(UnittestImport.getDescriptor().getEnumTypes()) .containsExactly(ImportEnum.getDescriptor(), ImportEnumForMap.getDescriptor()) .inOrder(); @@ -123,7 +123,7 @@ public class DescriptorsTest { assertThat(file.getServices().get(0)).isEqualTo(service); assertThat(file.findServiceByName("TestService")).isEqualTo(service); assertThat(file.findServiceByName("NoSuchType")).isNull(); - assertThat(file.findServiceByName("protobuf_unittest.TestService")).isNull(); + assertThat(file.findServiceByName("proto2_unittest.TestService")).isNull(); assertThat(UnittestImport.getDescriptor().getServices()).isEqualTo(Collections.emptyList()); for (int i = 0; i < file.getServices().size(); i++) { assertThat(file.getServices().get(i).getIndex()).isEqualTo(i); @@ -133,7 +133,7 @@ public class DescriptorsTest { assertThat(file.getExtensions().get(0)).isEqualTo(extension); assertThat(file.findExtensionByName("optional_int32_extension")).isEqualTo(extension); assertThat(file.findExtensionByName("no_such_ext")).isNull(); - assertThat(file.findExtensionByName("protobuf_unittest.optional_int32_extension")).isNull(); + assertThat(file.findExtensionByName("proto2_unittest.optional_int32_extension")).isNull(); assertThat(UnittestImport.getDescriptor().getExtensions()).isEqualTo(Collections.emptyList()); for (int i = 0; i < file.getExtensions().size(); i++) { assertThat(file.getExtensions().get(i).getIndex()).isEqualTo(i); @@ -211,7 +211,7 @@ public class DescriptorsTest { Descriptor nestedType = TestAllTypes.NestedMessage.getDescriptor(); assertThat(messageType.getName()).isEqualTo("TestAllTypes"); - assertThat(messageType.getFullName()).isEqualTo("protobuf_unittest.TestAllTypes"); + assertThat(messageType.getFullName()).isEqualTo("proto2_unittest.TestAllTypes"); assertThat(messageType.getFile()).isEqualTo(UnittestProto.getDescriptor()); assertThat(messageType.getContainingType()).isNull(); assertThat(messageType.getOptions()) @@ -219,7 +219,7 @@ public class DescriptorsTest { assertThat(messageType.toProto().getName()).isEqualTo("TestAllTypes"); assertThat(nestedType.getName()).isEqualTo("NestedMessage"); - assertThat(nestedType.getFullName()).isEqualTo("protobuf_unittest.TestAllTypes.NestedMessage"); + assertThat(nestedType.getFullName()).isEqualTo("proto2_unittest.TestAllTypes.NestedMessage"); assertThat(nestedType.getFile()).isEqualTo(UnittestProto.getDescriptor()); assertThat(nestedType.getContainingType()).isEqualTo(messageType); @@ -261,7 +261,7 @@ public class DescriptorsTest { assertThat(primitiveField.getName()).isEqualTo("optional_int32"); assertThat(primitiveField.getFullName()) - .isEqualTo("protobuf_unittest.TestAllTypes.optional_int32"); + .isEqualTo("proto2_unittest.TestAllTypes.optional_int32"); assertThat(primitiveField.getNumber()).isEqualTo(1); assertThat(primitiveField.getContainingType()).isEqualTo(messageType); assertThat(primitiveField.getFile()).isEqualTo(UnittestProto.getDescriptor()); @@ -289,7 +289,7 @@ public class DescriptorsTest { .isEqualTo(DescriptorProtos.FieldOptions.CType.CORD); assertThat(extension.getName()).isEqualTo("optional_int32_extension"); - assertThat(extension.getFullName()).isEqualTo("protobuf_unittest.optional_int32_extension"); + assertThat(extension.getFullName()).isEqualTo("proto2_unittest.optional_int32_extension"); assertThat(extension.getNumber()).isEqualTo(1); assertThat(extension.getContainingType()).isEqualTo(TestAllExtensions.getDescriptor()); assertThat(extension.getFile()).isEqualTo(UnittestProto.getDescriptor()); @@ -302,7 +302,7 @@ public class DescriptorsTest { assertThat(extension.toProto().getName()).isEqualTo("optional_int32_extension"); assertThat(nestedExtension.getName()).isEqualTo("single"); - assertThat(nestedExtension.getFullName()).isEqualTo("protobuf_unittest.TestRequired.single"); + assertThat(nestedExtension.getFullName()).isEqualTo("proto2_unittest.TestRequired.single"); assertThat(nestedExtension.getExtensionScope()).isEqualTo(TestRequired.getDescriptor()); } @@ -622,7 +622,7 @@ public class DescriptorsTest { EnumDescriptor nestedType = TestAllTypes.NestedEnum.getDescriptor(); assertThat(enumType.getName()).isEqualTo("ForeignEnum"); - assertThat(enumType.getFullName()).isEqualTo("protobuf_unittest.ForeignEnum"); + assertThat(enumType.getFullName()).isEqualTo("proto2_unittest.ForeignEnum"); assertThat(enumType.getFile()).isEqualTo(UnittestProto.getDescriptor()); assertThat(enumType.isClosed()).isTrue(); assertThat(enumType.getContainingType()).isNull(); @@ -630,7 +630,7 @@ public class DescriptorsTest { .isEqualTo(DescriptorProtos.EnumOptions.getDefaultInstance()); assertThat(nestedType.getName()).isEqualTo("NestedEnum"); - assertThat(nestedType.getFullName()).isEqualTo("protobuf_unittest.TestAllTypes.NestedEnum"); + assertThat(nestedType.getFullName()).isEqualTo("proto2_unittest.TestAllTypes.NestedEnum"); assertThat(nestedType.getFile()).isEqualTo(UnittestProto.getDescriptor()); assertThat(nestedType.getContainingType()).isEqualTo(TestAllTypes.getDescriptor()); @@ -652,7 +652,7 @@ public class DescriptorsTest { ServiceDescriptor service = TestService.getDescriptor(); assertThat(service.getName()).isEqualTo("TestService"); - assertThat(service.getFullName()).isEqualTo("protobuf_unittest.TestService"); + assertThat(service.getFullName()).isEqualTo("proto2_unittest.TestService"); assertThat(service.getFile()).isEqualTo(UnittestProto.getDescriptor()); MethodDescriptor fooMethod = service.getMethods().get(0); @@ -1162,7 +1162,7 @@ public class DescriptorsTest { UnittestProto.TestAllTypes.getDescriptor() .findFieldByNumber(UnittestProto.TestAllTypes.OPTIONAL_UINT64_FIELD_NUMBER) .toString()) - .isEqualTo("protobuf_unittest.TestAllTypes.optional_uint64"); + .isEqualTo("proto2_unittest.TestAllTypes.optional_uint64"); } @Test @@ -1366,7 +1366,7 @@ public class DescriptorsTest { FileDescriptor.buildFrom( FileDescriptorProto.newBuilder() .setName("some/filename/some.proto") - .setPackage("protobuf_unittest") + .setPackage("proto2_unittest") .setSyntax("proto2") .setOptions(FileOptions.newBuilder().setJavaStringCheckUtf8(true)) .build(), @@ -1381,7 +1381,7 @@ public class DescriptorsTest { FileDescriptor.buildFrom( FileDescriptorProto.newBuilder() .setName("some/filename/some.proto") - .setPackage("protobuf_unittest") + .setPackage("proto2_unittest") .setSyntax("proto2") .build(), new FileDescriptor[0]); @@ -1475,7 +1475,7 @@ public class DescriptorsTest { this.fileProto = DescriptorProtos.FileDescriptorProto.newBuilder() .setName("some/filename/some.proto") - .setPackage("protobuf_unittest") + .setPackage("proto2_unittest") .setEdition(DescriptorProtos.Edition.EDITION_2023) .setSyntax("editions"); @@ -1486,7 +1486,7 @@ public class DescriptorsTest { .setNumber(10) .setType(FieldDescriptorProto.Type.TYPE_INT32) .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL) - .setExtendee(".protobuf_unittest.TopMessage"); + .setExtendee(".proto2_unittest.TopMessage"); this.topEnumProto = this.fileProto.addEnumTypeBuilder().setName("TopEnum"); this.enumValueProto = this.topEnumProto.addValueBuilder().setName("TOP_VALUE").setNumber(0); @@ -1511,7 +1511,7 @@ public class DescriptorsTest { .setNumber(11) .setType(FieldDescriptorProto.Type.TYPE_INT32) .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL) - .setExtendee(".protobuf_unittest.TopMessage"); + .setExtendee(".proto2_unittest.TopMessage"); this.nestedMessageProto = this.topMessageProto.addNestedTypeBuilder().setName("NestedMessage"); this.nestedEnumProto = @@ -1533,8 +1533,8 @@ public class DescriptorsTest { this.serviceProto .addMethodBuilder() .setName("CallMethod") - .setInputType(".protobuf_unittest.TopMessage") - .setOutputType(".protobuf_unittest.TopMessage"); + .setInputType(".proto2_unittest.TopMessage") + .setOutputType(".proto2_unittest.TopMessage"); } void setTestFeature(DescriptorProtos.FeatureSet.Builder features, int value) { diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java index 1004de8d97430..d018ba9500f06 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java @@ -9,7 +9,7 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertWithMessage; -import protobuf_unittest.UnittestProto; +import proto2_unittest.UnittestProto; import proto3_unittest.UnittestProto3; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java index ad634e92b1708..03784124f536b 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java @@ -15,13 +15,13 @@ import com.google.protobuf.Descriptors.FieldDescriptor; import com.google.protobuf.Descriptors.OneofDescriptor; import dynamicmessagetest.DynamicMessageTestProto.EmptyMessage; import dynamicmessagetest.DynamicMessageTestProto.MessageWithMapFields; -import protobuf_unittest.UnittestMset.TestMessageSetExtension2; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage; -import protobuf_unittest.UnittestProto.TestEmptyMessage; -import protobuf_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.UnittestMset.TestMessageSetExtension2; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes.NestedMessage; +import proto2_unittest.UnittestProto.TestEmptyMessage; +import proto2_unittest.UnittestProto.TestPackedTypes; import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet; import java.util.ArrayList; import org.junit.Test; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/EnumTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/EnumTest.java index b4326a596de19..c68988ab01b13 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/EnumTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/EnumTest.java @@ -11,8 +11,8 @@ import static com.google.common.truth.Truth.assertThat; import com.google.protobuf.UnittestLite.ForeignEnumLite; import com.google.protobuf.UnittestLite.TestAllTypesLite; -import protobuf_unittest.UnittestProto.ForeignEnum; -import protobuf_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.ForeignEnum; +import proto2_unittest.UnittestProto.TestAllTypes; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java index 198796a96f4d6..7ca1080b014cc 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java @@ -12,8 +12,8 @@ import static com.google.common.truth.Truth.assertWithMessage; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.ClassPath; -import protobuf_unittest.NonNestedExtension; -import protobuf_unittest.NonNestedExtensionLite; +import proto2_unittest.NonNestedExtension; +import proto2_unittest.NonNestedExtensionLite; import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; @@ -98,7 +98,7 @@ public class ExtensionRegistryFactoryTest extends TestCase { .that(NonNestedExtensionLite.nonNestedExtensionLite.getClass()) .isInstanceOf(GeneratedMessageLite.GeneratedExtension.class); assertWithMessage("Extension is not registered in masqueraded full registry") - .that(fullRegistry1.findImmutableExtensionByName("protobuf_unittest.nonNestedExtension")) + .that(fullRegistry1.findImmutableExtensionByName("proto2_unittest.nonNestedExtension")) .isNull(); GeneratedMessageLite.GeneratedExtension<NonNestedExtensionLite.MessageLiteToBeExtended, ?> extension = @@ -110,7 +110,7 @@ public class ExtensionRegistryFactoryTest extends TestCase { .that(Extension.class.isAssignableFrom(NonNestedExtension.nonNestedExtension.getClass())) .isTrue(); assertWithMessage("Extension is registered in masqueraded full registry") - .that(fullRegistry2.findImmutableExtensionByName("protobuf_unittest.nonNestedExtension")) + .that(fullRegistry2.findImmutableExtensionByName("proto2_unittest.nonNestedExtension")) .isNotNull(); } diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java index 8981ab8af2625..73a2ac648b94d 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java @@ -18,7 +18,7 @@ import com.google.protobuf.FieldPresenceTestProto.TestAllTypes; import com.google.protobuf.FieldPresenceTestProto.TestOptionalFieldsOnly; import com.google.protobuf.FieldPresenceTestProto.TestRepeatedFieldsOnly; import com.google.protobuf.testing.proto.TestProto3Optional; -import protobuf_unittest.UnittestProto; +import proto2_unittest.UnittestProto; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -102,6 +102,7 @@ public class FieldPresenceTest { assertThat(TestProto3Optional.getDefaultInstance().hasOptionalBool()).isFalse(); assertThat(TestProto3Optional.getDefaultInstance().hasOptionalString()).isFalse(); assertThat(TestProto3Optional.getDefaultInstance().hasOptionalBytes()).isFalse(); + assertThat(TestProto3Optional.getDefaultInstance().hasOptionalNestedEnum()).isFalse(); TestProto3Optional.Builder builder = TestProto3Optional.newBuilder().setOptionalInt32(0); assertThat(builder.hasOptionalInt32()).isTrue(); @@ -125,6 +126,67 @@ public class FieldPresenceTest { assertThat(proto.toBuilder().hasOptionalInt32()).isTrue(); } + @Test + public void testMergeFrom_unknownExplicitOpenEnum() throws Exception { + TestProto3Optional.Builder builder = + TestProto3Optional.newBuilder().setOptionalNestedEnumValue(100); + + TestProto3Optional.Builder mergedBuilder = + TestProto3Optional.newBuilder() + .setOptionalNestedEnum(TestProto3Optional.NestedEnum.FOO) + .mergeFrom(builder.build()); + + assertThat(builder.hasOptionalNestedEnum()).isTrue(); + assertThat(builder.build().getOptionalNestedEnumValue()).isEqualTo(100); + assertThat(mergedBuilder.hasOptionalNestedEnum()).isTrue(); + assertThat(mergedBuilder.getOptionalNestedEnumValue()).isEqualTo(100); + } + + @Test + public void testParseFrom_unknownExplicitOpenEnum() throws Exception { + TestProto3Optional.Builder builder = + TestProto3Optional.newBuilder().setOptionalNestedEnumValue(100); + + TestProto3Optional parsedProto = + TestProto3Optional.parseFrom( + builder.build().toByteArray(), ExtensionRegistry.getEmptyRegistry()); + + assertThat(parsedProto.hasOptionalNestedEnum()).isTrue(); + assertThat(parsedProto.getOptionalNestedEnumValue()).isEqualTo(100); + } + + @Test + public void testMergeFrom_defaultExplicitOpenEnum() throws Exception { + TestProto3Optional.Builder builder = + TestProto3Optional.newBuilder().setOptionalNestedEnumValue(0); + + TestProto3Optional.Builder otherBuilder = + TestProto3Optional.newBuilder() + .setOptionalNestedEnum(TestProto3Optional.NestedEnum.FOO) + .mergeFrom(builder.build()); + + assertThat(builder.hasOptionalNestedEnum()).isTrue(); + assertThat(builder.build().getOptionalNestedEnum()) + .isEqualTo(TestProto3Optional.NestedEnum.UNSPECIFIED); + assertThat(otherBuilder.hasOptionalNestedEnum()).isTrue(); + assertThat(otherBuilder.getOptionalNestedEnum()) + .isEqualTo(TestProto3Optional.NestedEnum.UNSPECIFIED); + } + + @Test + public void testParseFrom_defaultExplicitOpenEnum() throws Exception { + TestProto3Optional.Builder builder = + TestProto3Optional.newBuilder().setOptionalNestedEnumValue(0); + + TestProto3Optional parsedProto = + TestProto3Optional.parseFrom( + builder.build().toByteArray(), ExtensionRegistry.getEmptyRegistry()); + + assertThat(parsedProto.hasOptionalNestedEnum()).isTrue(); + assertThat(parsedProto.getOptionalNestedEnum()) + .isEqualTo(TestProto3Optional.NestedEnum.UNSPECIFIED); + } + private static void assertProto3OptionalReflection(String name) throws Exception { FieldDescriptor fieldDescriptor = TestProto3Optional.getDescriptor().findFieldByName(name); OneofDescriptor oneofDescriptor = fieldDescriptor.getContainingOneof(); @@ -274,6 +336,28 @@ public class FieldPresenceTest { assertThat(message.hashCode()).isEqualTo(empty.hashCode()); } + @Test + public void testFieldPresence_mergeEmptyBytesValue() { + TestAllTypes mergeFrom = + TestAllTypes.newBuilder().setOptionalBytes(ByteString.copyFrom(new byte[0])).build(); + TestAllTypes mergeTo = + TestAllTypes.newBuilder().setOptionalBytes(ByteString.copyFromUtf8("A")).build(); + + // An empty ByteString should be treated as "unset" and not override the value in mergeTo. + assertThat(mergeTo.toBuilder().mergeFrom(mergeFrom).build()).isEqualTo(mergeTo); + } + + @Test + public void testFieldPresence_mergeNegativeZeroValue() { + TestAllTypes mergeFrom = + TestAllTypes.newBuilder().setOptionalFloat(-0.0F).setOptionalDouble(-0.0).build(); + TestAllTypes mergeTo = + TestAllTypes.newBuilder().setOptionalFloat(42.23F).setOptionalDouble(23.42).build(); + + // Negative zero should be treated as "set" and override the value in mergeTo. + assertThat(mergeTo.toBuilder().mergeFrom(mergeFrom).build()).isEqualTo(mergeFrom); + } + @Test public void testFieldPresenceByReflection() { Descriptor descriptor = TestAllTypes.getDescriptor(); @@ -356,8 +440,7 @@ public class FieldPresenceTest { // Field set to default value is seen as not present. message = - message - .toBuilder() + message.toBuilder() .setField(optionalInt32Field, 0) .setField(optionalStringField, "") .setField(optionalBytesField, ByteString.EMPTY) diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java index 920693947e14b..af55f19a38ce5 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java @@ -14,33 +14,33 @@ import static org.junit.Assert.assertThrows; import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.FieldDescriptor; import com.google.protobuf.test.UnittestImport; -import protobuf_unittest.EnumWithNoOuter; -import protobuf_unittest.MessageWithNoOuter; -import protobuf_unittest.MultipleFilesTestProto; -import protobuf_unittest.NestedExtension.MyNestedExtension; -import protobuf_unittest.NonNestedExtension; -import protobuf_unittest.NonNestedExtension.MessageToBeExtended; -import protobuf_unittest.NonNestedExtension.MyNonNestedExtension; -import protobuf_unittest.OuterClassNameTest2OuterClass; -import protobuf_unittest.OuterClassNameTest3OuterClass; -import protobuf_unittest.OuterClassNameTestOuterClass; -import protobuf_unittest.ServiceWithNoOuter; -import protobuf_unittest.UnittestOptimizeFor.TestOptimizedForSize; -import protobuf_unittest.UnittestOptimizeFor.TestOptionalOptimizedForSize; -import protobuf_unittest.UnittestOptimizeFor.TestRequiredOptimizedForSize; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.ForeignEnum; -import protobuf_unittest.UnittestProto.ForeignMessage; -import protobuf_unittest.UnittestProto.ForeignMessageOrBuilder; -import protobuf_unittest.UnittestProto.NestedTestAllTypes; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage; -import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder; -import protobuf_unittest.UnittestProto.TestExtremeDefaultValues; -import protobuf_unittest.UnittestProto.TestOneof2; -import protobuf_unittest.UnittestProto.TestPackedTypes; -import protobuf_unittest.UnittestProto.TestUnpackedTypes; +import proto2_unittest.EnumWithNoOuter; +import proto2_unittest.MessageWithNoOuter; +import proto2_unittest.MultipleFilesTestProto; +import proto2_unittest.NestedExtension.MyNestedExtension; +import proto2_unittest.NonNestedExtension; +import proto2_unittest.NonNestedExtension.MessageToBeExtended; +import proto2_unittest.NonNestedExtension.MyNonNestedExtension; +import proto2_unittest.OuterClassNameTest2OuterClass; +import proto2_unittest.OuterClassNameTest3OuterClass; +import proto2_unittest.OuterClassNameTestOuterClass; +import proto2_unittest.ServiceWithNoOuter; +import proto2_unittest.UnittestOptimizeFor.TestOptimizedForSize; +import proto2_unittest.UnittestOptimizeFor.TestOptionalOptimizedForSize; +import proto2_unittest.UnittestOptimizeFor.TestRequiredOptimizedForSize; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.ForeignEnum; +import proto2_unittest.UnittestProto.ForeignMessage; +import proto2_unittest.UnittestProto.ForeignMessageOrBuilder; +import proto2_unittest.UnittestProto.NestedTestAllTypes; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes.NestedMessage; +import proto2_unittest.UnittestProto.TestAllTypesOrBuilder; +import proto2_unittest.UnittestProto.TestExtremeDefaultValues; +import proto2_unittest.UnittestProto.TestOneof2; +import proto2_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.UnittestProto.TestUnpackedTypes; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazilyParsedMessageSetTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazilyParsedMessageSetTest.java index c41a381823db4..740d168908682 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazilyParsedMessageSetTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazilyParsedMessageSetTest.java @@ -9,10 +9,10 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestMset.RawMessageSet; -import protobuf_unittest.UnittestMset.TestMessageSetExtension1; -import protobuf_unittest.UnittestMset.TestMessageSetExtension2; -import protobuf_unittest.UnittestMset.TestMessageSetExtension3; +import proto2_unittest.UnittestMset.RawMessageSet; +import proto2_unittest.UnittestMset.TestMessageSetExtension1; +import proto2_unittest.UnittestMset.TestMessageSetExtension2; +import proto2_unittest.UnittestMset.TestMessageSetExtension3; import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet; import org.junit.Before; import org.junit.Test; @@ -159,4 +159,42 @@ public class LazilyParsedMessageSetTest { assertThat(actualRaw).isEqualTo(expectedRaw); } + + @Test + public void testLoadCorruptedLazyField_getSerializedSize() throws Exception { + ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance(); + extensionRegistry.add(TestMessageSetExtension1.messageSetExtension); + RawMessageSet inputRaw = + RawMessageSet.newBuilder() + .addItem( + RawMessageSet.Item.newBuilder() + .setTypeId(TYPE_ID_1) + .setMessage(CORRUPTED_MESSAGE_PAYLOAD)) + .build(); + ByteString inputData = inputRaw.toByteString(); + TestMessageSet messageSet = TestMessageSet.parseFrom(inputData, extensionRegistry); + + // Effectively cache the serialized size of the message set. + assertThat(messageSet.getSerializedSize()).isEqualTo(9); + + // getExtension should mark the memoized size as "dirty" (i.e. -1). + assertThat(messageSet.getExtension(TestMessageSetExtension1.messageSetExtension)) + .isEqualTo(TestMessageSetExtension1.getDefaultInstance()); + + // toByteString calls getSerializedSize() which should re-compute the serialized size as the + // message contains lazy fields. + ByteString outputData = messageSet.toByteString(); + + // Re-parse as RawMessageSet + RawMessageSet actualRaw = + RawMessageSet.parseFrom(outputData, ExtensionRegistry.getEmptyRegistry()); + + RawMessageSet expectedRaw = + RawMessageSet.newBuilder() + .addItem( + RawMessageSet.Item.newBuilder().setTypeId(TYPE_ID_1).setMessage(ByteString.empty())) + .build(); + + assertThat(actualRaw).isEqualTo(expectedRaw); + } } diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java index ed8c3a51d6bcf..678e67ddf9631 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java @@ -8,10 +8,10 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import static protobuf_unittest.UnittestProto.optionalInt32Extension; +import static proto2_unittest.UnittestProto.optionalInt32Extension; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; import java.io.IOException; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java index de2fc8a9e160d..dce0f47217ba5 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java @@ -9,8 +9,8 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java index 182d9d3877492..2073f23aeaa98 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java @@ -10,10 +10,10 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -import protobuf_unittest.LazyFieldsLite.LazyExtension; -import protobuf_unittest.LazyFieldsLite.LazyInnerMessageLite; -import protobuf_unittest.LazyFieldsLite.LazyMessageLite; -import protobuf_unittest.LazyFieldsLite.LazyNestedInnerMessageLite; +import proto2_unittest.LazyFieldsLite.LazyExtension; +import proto2_unittest.LazyFieldsLite.LazyInnerMessageLite; +import proto2_unittest.LazyFieldsLite.LazyMessageLite; +import proto2_unittest.LazyFieldsLite.LazyNestedInnerMessageLite; import java.util.ArrayList; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java index 966e6eefb779c..59b71e695ee93 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java @@ -9,7 +9,7 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestProto; +import proto2_unittest.UnittestProto; import java.io.IOException; import org.junit.Before; import org.junit.Test; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java index 61b164dec886a..6dcf550039721 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java @@ -2,7 +2,7 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestProto; +import proto2_unittest.UnittestProto; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java index 3e3126aa2541c..92ebd5ded83e5 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java @@ -8,11 +8,11 @@ package com.google.protobuf; import junit.framework.TestCase; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.BarPrime; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestOneofEquals; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestRecursiveOneof; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.BarPrime; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestOneofEquals; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestRecursiveOneof; /** * Test generate equal and hash methods for the lite runtime. diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/MessageTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/MessageTest.java index ff776a7a6372f..09fab52eb1f78 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/MessageTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/MessageTest.java @@ -10,11 +10,11 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -import protobuf_unittest.UnittestProto.ForeignMessage; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestRequired; -import protobuf_unittest.UnittestProto.TestRequiredForeign; +import proto2_unittest.UnittestProto.ForeignMessage; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestRequired; +import proto2_unittest.UnittestProto.TestRequiredForeign; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java index 39e0b5dba40ba..61b0cdb488c57 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java @@ -9,10 +9,10 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.Engine; -import protobuf_unittest.TimingBelt; -import protobuf_unittest.Vehicle; -import protobuf_unittest.Wheel; +import proto2_unittest.Engine; +import proto2_unittest.TimingBelt; +import proto2_unittest.Vehicle; +import proto2_unittest.Wheel; import java.util.ArrayList; import java.util.List; import org.junit.Test; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserLiteTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserLiteTest.java index c903e95246d42..712d45f5a484f 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserLiteTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserLiteTest.java @@ -15,8 +15,8 @@ import com.google.protobuf.UnittestLite.TestAllTypesLite; import com.google.protobuf.UnittestLite.TestMergeExceptionLite; import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; import com.google.protobuf.UnittestLite.TestParsingMergeLite; -import protobuf_unittest.MapLiteUnittest; -import protobuf_unittest.MapLiteUnittest.TestRequiredLite; +import proto2_unittest.MapLiteUnittest; +import proto2_unittest.MapLiteUnittest.TestRequiredLite; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserTest.java index bf899283e3ef9..f1f9f02f462eb 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ParserTest.java @@ -10,16 +10,16 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -import protobuf_unittest.UnittestOptimizeFor; -import protobuf_unittest.UnittestOptimizeFor.TestOptimizedForSize; -import protobuf_unittest.UnittestOptimizeFor.TestRequiredOptimizedForSize; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.ForeignMessage; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestEmptyMessage; -import protobuf_unittest.UnittestProto.TestMergeException; -import protobuf_unittest.UnittestProto.TestParsingMerge; -import protobuf_unittest.UnittestProto.TestRequired; +import proto2_unittest.UnittestOptimizeFor; +import proto2_unittest.UnittestOptimizeFor.TestOptimizedForSize; +import proto2_unittest.UnittestOptimizeFor.TestRequiredOptimizedForSize; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.ForeignMessage; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestEmptyMessage; +import proto2_unittest.UnittestProto.TestMergeException; +import proto2_unittest.UnittestProto.TestParsingMerge; +import proto2_unittest.UnittestProto.TestRequired; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java index 394c612f3dba6..1b16ce473efba 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java @@ -10,9 +10,9 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; import com.google.protobuf.Descriptors.FieldDescriptor; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java index 809734a475371..e4bd6aac506dc 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java @@ -2,8 +2,8 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestProto.RedactedFields; -import protobuf_unittest.UnittestProto.TestNestedMessageRedaction; +import proto2_unittest.UnittestProto.RedactedFields; +import proto2_unittest.UnittestProto.TestNestedMessageRedaction; import java.util.ArrayList; import org.junit.Before; import org.junit.Test; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java index 19587e588e849..e7aeb3e8207c4 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java @@ -10,8 +10,8 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypesOrBuilder; import java.util.Collections; import java.util.List; import org.junit.Test; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/SensitiveFieldReportingTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/SensitiveFieldReportingTest.java deleted file mode 100644 index 4212d76438ee1..0000000000000 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/SensitiveFieldReportingTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.google.protobuf; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public final class SensitiveFieldReportingTest { - @Test - public void testStub() throws Exception { - // Open source fails if no tests are present. - } -} diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ServiceTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ServiceTest.java index b12051bd0c7f3..bc9a8175e0353 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ServiceTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ServiceTest.java @@ -14,15 +14,15 @@ import static org.mockito.Mockito.when; import com.google.protobuf.Descriptors.FileDescriptor; import com.google.protobuf.Descriptors.MethodDescriptor; -import protobuf_unittest.MessageWithNoOuter; -import protobuf_unittest.ServiceWithNoOuter; -import protobuf_unittest.UnittestProto.BarRequest; -import protobuf_unittest.UnittestProto.BarResponse; -import protobuf_unittest.UnittestProto.FooRequest; -import protobuf_unittest.UnittestProto.FooResponse; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestService; -import protobuf_unittest.no_generic_services_test.UnittestNoGenericServices; +import proto2_unittest.MessageWithNoOuter; +import proto2_unittest.ServiceWithNoOuter; +import proto2_unittest.UnittestProto.BarRequest; +import proto2_unittest.UnittestProto.BarResponse; +import proto2_unittest.UnittestProto.FooRequest; +import proto2_unittest.UnittestProto.FooResponse; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestService; +import proto2_unittest.no_generic_services_test.UnittestNoGenericServices; import java.util.HashSet; import java.util.Set; import org.junit.Test; @@ -192,7 +192,7 @@ public class ServiceTest { // Build a list of the class names nested in UnittestNoGenericServices. String outerName = - "protobuf_unittest.no_generic_services_test.UnittestNoGenericServices"; + "proto2_unittest.no_generic_services_test.UnittestNoGenericServices"; Class<?> outerClass = Class.forName(outerName); Set<String> innerClassNames = new HashSet<>(); diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java index e1806110d47e7..0b3dd336329cf 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java @@ -9,8 +9,8 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypesOrBuilder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java index 82335ad6f1417..3ccfc85c5fa89 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TestUtil.java @@ -97,96 +97,96 @@ import static com.google.protobuf.UnittestLite.repeatedStringExtensionLite; import static com.google.protobuf.UnittestLite.repeatedStringPieceExtensionLite; import static com.google.protobuf.UnittestLite.repeatedUint32ExtensionLite; import static com.google.protobuf.UnittestLite.repeatedUint64ExtensionLite; -import static protobuf_unittest.UnittestProto.defaultBoolExtension; -import static protobuf_unittest.UnittestProto.defaultBytesExtension; -import static protobuf_unittest.UnittestProto.defaultCordExtension; -import static protobuf_unittest.UnittestProto.defaultDoubleExtension; -import static protobuf_unittest.UnittestProto.defaultFixed32Extension; -import static protobuf_unittest.UnittestProto.defaultFixed64Extension; -import static protobuf_unittest.UnittestProto.defaultFloatExtension; -import static protobuf_unittest.UnittestProto.defaultForeignEnumExtension; -import static protobuf_unittest.UnittestProto.defaultImportEnumExtension; -import static protobuf_unittest.UnittestProto.defaultInt32Extension; -import static protobuf_unittest.UnittestProto.defaultInt64Extension; -import static protobuf_unittest.UnittestProto.defaultNestedEnumExtension; -import static protobuf_unittest.UnittestProto.defaultSfixed32Extension; -import static protobuf_unittest.UnittestProto.defaultSfixed64Extension; -import static protobuf_unittest.UnittestProto.defaultSint32Extension; -import static protobuf_unittest.UnittestProto.defaultSint64Extension; -import static protobuf_unittest.UnittestProto.defaultStringExtension; -import static protobuf_unittest.UnittestProto.defaultStringPieceExtension; -import static protobuf_unittest.UnittestProto.defaultUint32Extension; -import static protobuf_unittest.UnittestProto.defaultUint64Extension; -import static protobuf_unittest.UnittestProto.oneofBytesExtension; -import static protobuf_unittest.UnittestProto.oneofNestedMessageExtension; -import static protobuf_unittest.UnittestProto.oneofStringExtension; -import static protobuf_unittest.UnittestProto.oneofUint32Extension; -import static protobuf_unittest.UnittestProto.optionalBoolExtension; -import static protobuf_unittest.UnittestProto.optionalBytesExtension; -import static protobuf_unittest.UnittestProto.optionalCordExtension; -import static protobuf_unittest.UnittestProto.optionalDoubleExtension; -import static protobuf_unittest.UnittestProto.optionalFixed32Extension; -import static protobuf_unittest.UnittestProto.optionalFixed64Extension; -import static protobuf_unittest.UnittestProto.optionalFloatExtension; -import static protobuf_unittest.UnittestProto.optionalForeignEnumExtension; -import static protobuf_unittest.UnittestProto.optionalForeignMessageExtension; -import static protobuf_unittest.UnittestProto.optionalGroupExtension; -import static protobuf_unittest.UnittestProto.optionalImportEnumExtension; -import static protobuf_unittest.UnittestProto.optionalImportMessageExtension; -import static protobuf_unittest.UnittestProto.optionalInt32Extension; -import static protobuf_unittest.UnittestProto.optionalInt64Extension; -import static protobuf_unittest.UnittestProto.optionalLazyMessageExtension; -import static protobuf_unittest.UnittestProto.optionalNestedEnumExtension; -import static protobuf_unittest.UnittestProto.optionalNestedMessageExtension; -import static protobuf_unittest.UnittestProto.optionalPublicImportMessageExtension; -import static protobuf_unittest.UnittestProto.optionalSfixed32Extension; -import static protobuf_unittest.UnittestProto.optionalSfixed64Extension; -import static protobuf_unittest.UnittestProto.optionalSint32Extension; -import static protobuf_unittest.UnittestProto.optionalSint64Extension; -import static protobuf_unittest.UnittestProto.optionalStringExtension; -import static protobuf_unittest.UnittestProto.optionalStringPieceExtension; -import static protobuf_unittest.UnittestProto.optionalUint32Extension; -import static protobuf_unittest.UnittestProto.optionalUint64Extension; -import static protobuf_unittest.UnittestProto.optionalUnverifiedLazyMessageExtension; -import static protobuf_unittest.UnittestProto.packedBoolExtension; -import static protobuf_unittest.UnittestProto.packedDoubleExtension; -import static protobuf_unittest.UnittestProto.packedEnumExtension; -import static protobuf_unittest.UnittestProto.packedFixed32Extension; -import static protobuf_unittest.UnittestProto.packedFixed64Extension; -import static protobuf_unittest.UnittestProto.packedFloatExtension; -import static protobuf_unittest.UnittestProto.packedInt32Extension; -import static protobuf_unittest.UnittestProto.packedInt64Extension; -import static protobuf_unittest.UnittestProto.packedSfixed32Extension; -import static protobuf_unittest.UnittestProto.packedSfixed64Extension; -import static protobuf_unittest.UnittestProto.packedSint32Extension; -import static protobuf_unittest.UnittestProto.packedSint64Extension; -import static protobuf_unittest.UnittestProto.packedUint32Extension; -import static protobuf_unittest.UnittestProto.packedUint64Extension; -import static protobuf_unittest.UnittestProto.repeatedBoolExtension; -import static protobuf_unittest.UnittestProto.repeatedBytesExtension; -import static protobuf_unittest.UnittestProto.repeatedCordExtension; -import static protobuf_unittest.UnittestProto.repeatedDoubleExtension; -import static protobuf_unittest.UnittestProto.repeatedFixed32Extension; -import static protobuf_unittest.UnittestProto.repeatedFixed64Extension; -import static protobuf_unittest.UnittestProto.repeatedFloatExtension; -import static protobuf_unittest.UnittestProto.repeatedForeignEnumExtension; -import static protobuf_unittest.UnittestProto.repeatedForeignMessageExtension; -import static protobuf_unittest.UnittestProto.repeatedGroupExtension; -import static protobuf_unittest.UnittestProto.repeatedImportEnumExtension; -import static protobuf_unittest.UnittestProto.repeatedImportMessageExtension; -import static protobuf_unittest.UnittestProto.repeatedInt32Extension; -import static protobuf_unittest.UnittestProto.repeatedInt64Extension; -import static protobuf_unittest.UnittestProto.repeatedLazyMessageExtension; -import static protobuf_unittest.UnittestProto.repeatedNestedEnumExtension; -import static protobuf_unittest.UnittestProto.repeatedNestedMessageExtension; -import static protobuf_unittest.UnittestProto.repeatedSfixed32Extension; -import static protobuf_unittest.UnittestProto.repeatedSfixed64Extension; -import static protobuf_unittest.UnittestProto.repeatedSint32Extension; -import static protobuf_unittest.UnittestProto.repeatedSint64Extension; -import static protobuf_unittest.UnittestProto.repeatedStringExtension; -import static protobuf_unittest.UnittestProto.repeatedStringPieceExtension; -import static protobuf_unittest.UnittestProto.repeatedUint32Extension; -import static protobuf_unittest.UnittestProto.repeatedUint64Extension; +import static proto2_unittest.UnittestProto.defaultBoolExtension; +import static proto2_unittest.UnittestProto.defaultBytesExtension; +import static proto2_unittest.UnittestProto.defaultCordExtension; +import static proto2_unittest.UnittestProto.defaultDoubleExtension; +import static proto2_unittest.UnittestProto.defaultFixed32Extension; +import static proto2_unittest.UnittestProto.defaultFixed64Extension; +import static proto2_unittest.UnittestProto.defaultFloatExtension; +import static proto2_unittest.UnittestProto.defaultForeignEnumExtension; +import static proto2_unittest.UnittestProto.defaultImportEnumExtension; +import static proto2_unittest.UnittestProto.defaultInt32Extension; +import static proto2_unittest.UnittestProto.defaultInt64Extension; +import static proto2_unittest.UnittestProto.defaultNestedEnumExtension; +import static proto2_unittest.UnittestProto.defaultSfixed32Extension; +import static proto2_unittest.UnittestProto.defaultSfixed64Extension; +import static proto2_unittest.UnittestProto.defaultSint32Extension; +import static proto2_unittest.UnittestProto.defaultSint64Extension; +import static proto2_unittest.UnittestProto.defaultStringExtension; +import static proto2_unittest.UnittestProto.defaultStringPieceExtension; +import static proto2_unittest.UnittestProto.defaultUint32Extension; +import static proto2_unittest.UnittestProto.defaultUint64Extension; +import static proto2_unittest.UnittestProto.oneofBytesExtension; +import static proto2_unittest.UnittestProto.oneofNestedMessageExtension; +import static proto2_unittest.UnittestProto.oneofStringExtension; +import static proto2_unittest.UnittestProto.oneofUint32Extension; +import static proto2_unittest.UnittestProto.optionalBoolExtension; +import static proto2_unittest.UnittestProto.optionalBytesExtension; +import static proto2_unittest.UnittestProto.optionalCordExtension; +import static proto2_unittest.UnittestProto.optionalDoubleExtension; +import static proto2_unittest.UnittestProto.optionalFixed32Extension; +import static proto2_unittest.UnittestProto.optionalFixed64Extension; +import static proto2_unittest.UnittestProto.optionalFloatExtension; +import static proto2_unittest.UnittestProto.optionalForeignEnumExtension; +import static proto2_unittest.UnittestProto.optionalForeignMessageExtension; +import static proto2_unittest.UnittestProto.optionalGroupExtension; +import static proto2_unittest.UnittestProto.optionalImportEnumExtension; +import static proto2_unittest.UnittestProto.optionalImportMessageExtension; +import static proto2_unittest.UnittestProto.optionalInt32Extension; +import static proto2_unittest.UnittestProto.optionalInt64Extension; +import static proto2_unittest.UnittestProto.optionalLazyMessageExtension; +import static proto2_unittest.UnittestProto.optionalNestedEnumExtension; +import static proto2_unittest.UnittestProto.optionalNestedMessageExtension; +import static proto2_unittest.UnittestProto.optionalPublicImportMessageExtension; +import static proto2_unittest.UnittestProto.optionalSfixed32Extension; +import static proto2_unittest.UnittestProto.optionalSfixed64Extension; +import static proto2_unittest.UnittestProto.optionalSint32Extension; +import static proto2_unittest.UnittestProto.optionalSint64Extension; +import static proto2_unittest.UnittestProto.optionalStringExtension; +import static proto2_unittest.UnittestProto.optionalStringPieceExtension; +import static proto2_unittest.UnittestProto.optionalUint32Extension; +import static proto2_unittest.UnittestProto.optionalUint64Extension; +import static proto2_unittest.UnittestProto.optionalUnverifiedLazyMessageExtension; +import static proto2_unittest.UnittestProto.packedBoolExtension; +import static proto2_unittest.UnittestProto.packedDoubleExtension; +import static proto2_unittest.UnittestProto.packedEnumExtension; +import static proto2_unittest.UnittestProto.packedFixed32Extension; +import static proto2_unittest.UnittestProto.packedFixed64Extension; +import static proto2_unittest.UnittestProto.packedFloatExtension; +import static proto2_unittest.UnittestProto.packedInt32Extension; +import static proto2_unittest.UnittestProto.packedInt64Extension; +import static proto2_unittest.UnittestProto.packedSfixed32Extension; +import static proto2_unittest.UnittestProto.packedSfixed64Extension; +import static proto2_unittest.UnittestProto.packedSint32Extension; +import static proto2_unittest.UnittestProto.packedSint64Extension; +import static proto2_unittest.UnittestProto.packedUint32Extension; +import static proto2_unittest.UnittestProto.packedUint64Extension; +import static proto2_unittest.UnittestProto.repeatedBoolExtension; +import static proto2_unittest.UnittestProto.repeatedBytesExtension; +import static proto2_unittest.UnittestProto.repeatedCordExtension; +import static proto2_unittest.UnittestProto.repeatedDoubleExtension; +import static proto2_unittest.UnittestProto.repeatedFixed32Extension; +import static proto2_unittest.UnittestProto.repeatedFixed64Extension; +import static proto2_unittest.UnittestProto.repeatedFloatExtension; +import static proto2_unittest.UnittestProto.repeatedForeignEnumExtension; +import static proto2_unittest.UnittestProto.repeatedForeignMessageExtension; +import static proto2_unittest.UnittestProto.repeatedGroupExtension; +import static proto2_unittest.UnittestProto.repeatedImportEnumExtension; +import static proto2_unittest.UnittestProto.repeatedImportMessageExtension; +import static proto2_unittest.UnittestProto.repeatedInt32Extension; +import static proto2_unittest.UnittestProto.repeatedInt64Extension; +import static proto2_unittest.UnittestProto.repeatedLazyMessageExtension; +import static proto2_unittest.UnittestProto.repeatedNestedEnumExtension; +import static proto2_unittest.UnittestProto.repeatedNestedMessageExtension; +import static proto2_unittest.UnittestProto.repeatedSfixed32Extension; +import static proto2_unittest.UnittestProto.repeatedSfixed64Extension; +import static proto2_unittest.UnittestProto.repeatedSint32Extension; +import static proto2_unittest.UnittestProto.repeatedSint64Extension; +import static proto2_unittest.UnittestProto.repeatedStringExtension; +import static proto2_unittest.UnittestProto.repeatedStringPieceExtension; +import static proto2_unittest.UnittestProto.repeatedUint32Extension; +import static proto2_unittest.UnittestProto.repeatedUint64Extension; import com.google.protobuf.UnittestImportLite.ImportEnumLite; import com.google.protobuf.UnittestLite.ForeignEnumLite; @@ -196,20 +196,20 @@ import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; import com.google.protobuf.test.UnittestImport.ImportEnum; import com.google.protobuf.test.UnittestImport.ImportMessage; import com.google.protobuf.test.UnittestImportPublic.PublicImportMessage; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.ForeignEnum; -import protobuf_unittest.UnittestProto.ForeignMessage; -import protobuf_unittest.UnittestProto.OptionalGroup_extension; -import protobuf_unittest.UnittestProto.RepeatedGroup_extension; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllExtensionsOrBuilder; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder; -import protobuf_unittest.UnittestProto.TestOneof2; -import protobuf_unittest.UnittestProto.TestPackedExtensions; -import protobuf_unittest.UnittestProto.TestPackedTypes; -import protobuf_unittest.UnittestProto.TestRequired; -import protobuf_unittest.UnittestProto.TestUnpackedTypes; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.ForeignEnum; +import proto2_unittest.UnittestProto.ForeignMessage; +import proto2_unittest.UnittestProto.OptionalGroup_extension; +import proto2_unittest.UnittestProto.RepeatedGroup_extension; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllExtensionsOrBuilder; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypesOrBuilder; +import proto2_unittest.UnittestProto.TestOneof2; +import proto2_unittest.UnittestProto.TestPackedExtensions; +import proto2_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.UnittestProto.TestRequired; +import proto2_unittest.UnittestProto.TestUnpackedTypes; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -368,143 +368,143 @@ public final class TestUtil { public static final String ALL_EXTENSIONS_SET_TEXT = "" - + "[protobuf_unittest.optional_int32_extension]: 101\n" - + "[protobuf_unittest.optional_int64_extension]: 102\n" - + "[protobuf_unittest.optional_uint32_extension]: 103\n" - + "[protobuf_unittest.optional_uint64_extension]: 104\n" - + "[protobuf_unittest.optional_sint32_extension]: 105\n" - + "[protobuf_unittest.optional_sint64_extension]: 106\n" - + "[protobuf_unittest.optional_fixed32_extension]: 107\n" - + "[protobuf_unittest.optional_fixed64_extension]: 108\n" - + "[protobuf_unittest.optional_sfixed32_extension]: 109\n" - + "[protobuf_unittest.optional_sfixed64_extension]: 110\n" - + "[protobuf_unittest.optional_float_extension]: 111.0\n" - + "[protobuf_unittest.optional_double_extension]: 112.0\n" - + "[protobuf_unittest.optional_bool_extension]: true\n" - + "[protobuf_unittest.optional_string_extension]: \"115\"\n" - + "[protobuf_unittest.optional_bytes_extension]: \"116\"\n" - + "[protobuf_unittest.optionalgroup_extension] {\n" + + "[proto2_unittest.optional_int32_extension]: 101\n" + + "[proto2_unittest.optional_int64_extension]: 102\n" + + "[proto2_unittest.optional_uint32_extension]: 103\n" + + "[proto2_unittest.optional_uint64_extension]: 104\n" + + "[proto2_unittest.optional_sint32_extension]: 105\n" + + "[proto2_unittest.optional_sint64_extension]: 106\n" + + "[proto2_unittest.optional_fixed32_extension]: 107\n" + + "[proto2_unittest.optional_fixed64_extension]: 108\n" + + "[proto2_unittest.optional_sfixed32_extension]: 109\n" + + "[proto2_unittest.optional_sfixed64_extension]: 110\n" + + "[proto2_unittest.optional_float_extension]: 111.0\n" + + "[proto2_unittest.optional_double_extension]: 112.0\n" + + "[proto2_unittest.optional_bool_extension]: true\n" + + "[proto2_unittest.optional_string_extension]: \"115\"\n" + + "[proto2_unittest.optional_bytes_extension]: \"116\"\n" + + "[proto2_unittest.optionalgroup_extension] {\n" + " a: 117\n" + "}\n" - + "[protobuf_unittest.optional_nested_message_extension] {\n" + + "[proto2_unittest.optional_nested_message_extension] {\n" + " bb: 118\n" + "}\n" - + "[protobuf_unittest.optional_foreign_message_extension] {\n" + + "[proto2_unittest.optional_foreign_message_extension] {\n" + " c: 119\n" + "}\n" - + "[protobuf_unittest.optional_import_message_extension] {\n" + + "[proto2_unittest.optional_import_message_extension] {\n" + " d: 120\n" + "}\n" - + "[protobuf_unittest.optional_nested_enum_extension]: BAZ\n" - + "[protobuf_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ\n" - + "[protobuf_unittest.optional_import_enum_extension]: IMPORT_BAZ\n" - + "[protobuf_unittest.optional_string_piece_extension]: \"124\"\n" - + "[protobuf_unittest.optional_cord_extension]: \"125\"\n" - + "[protobuf_unittest.optional_public_import_message_extension] {\n" + + "[proto2_unittest.optional_nested_enum_extension]: BAZ\n" + + "[proto2_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ\n" + + "[proto2_unittest.optional_import_enum_extension]: IMPORT_BAZ\n" + + "[proto2_unittest.optional_string_piece_extension]: \"124\"\n" + + "[proto2_unittest.optional_cord_extension]: \"125\"\n" + + "[proto2_unittest.optional_public_import_message_extension] {\n" + " e: 126\n" + "}\n" - + "[protobuf_unittest.optional_lazy_message_extension] {\n" + + "[proto2_unittest.optional_lazy_message_extension] {\n" + " bb: 127\n" + "}\n" - + "[protobuf_unittest.optional_unverified_lazy_message_extension] {\n" + + "[proto2_unittest.optional_unverified_lazy_message_extension] {\n" + " bb: 128\n" + "}\n" - + "[protobuf_unittest.repeated_int32_extension]: 201\n" - + "[protobuf_unittest.repeated_int32_extension]: 301\n" - + "[protobuf_unittest.repeated_int64_extension]: 202\n" - + "[protobuf_unittest.repeated_int64_extension]: 302\n" - + "[protobuf_unittest.repeated_uint32_extension]: 203\n" - + "[protobuf_unittest.repeated_uint32_extension]: 303\n" - + "[protobuf_unittest.repeated_uint64_extension]: 204\n" - + "[protobuf_unittest.repeated_uint64_extension]: 304\n" - + "[protobuf_unittest.repeated_sint32_extension]: 205\n" - + "[protobuf_unittest.repeated_sint32_extension]: 305\n" - + "[protobuf_unittest.repeated_sint64_extension]: 206\n" - + "[protobuf_unittest.repeated_sint64_extension]: 306\n" - + "[protobuf_unittest.repeated_fixed32_extension]: 207\n" - + "[protobuf_unittest.repeated_fixed32_extension]: 307\n" - + "[protobuf_unittest.repeated_fixed64_extension]: 208\n" - + "[protobuf_unittest.repeated_fixed64_extension]: 308\n" - + "[protobuf_unittest.repeated_sfixed32_extension]: 209\n" - + "[protobuf_unittest.repeated_sfixed32_extension]: 309\n" - + "[protobuf_unittest.repeated_sfixed64_extension]: 210\n" - + "[protobuf_unittest.repeated_sfixed64_extension]: 310\n" - + "[protobuf_unittest.repeated_float_extension]: 211.0\n" - + "[protobuf_unittest.repeated_float_extension]: 311.0\n" - + "[protobuf_unittest.repeated_double_extension]: 212.0\n" - + "[protobuf_unittest.repeated_double_extension]: 312.0\n" - + "[protobuf_unittest.repeated_bool_extension]: true\n" - + "[protobuf_unittest.repeated_bool_extension]: false\n" - + "[protobuf_unittest.repeated_string_extension]: \"215\"\n" - + "[protobuf_unittest.repeated_string_extension]: \"315\"\n" - + "[protobuf_unittest.repeated_bytes_extension]: \"216\"\n" - + "[protobuf_unittest.repeated_bytes_extension]: \"316\"\n" - + "[protobuf_unittest.repeatedgroup_extension] {\n" + + "[proto2_unittest.repeated_int32_extension]: 201\n" + + "[proto2_unittest.repeated_int32_extension]: 301\n" + + "[proto2_unittest.repeated_int64_extension]: 202\n" + + "[proto2_unittest.repeated_int64_extension]: 302\n" + + "[proto2_unittest.repeated_uint32_extension]: 203\n" + + "[proto2_unittest.repeated_uint32_extension]: 303\n" + + "[proto2_unittest.repeated_uint64_extension]: 204\n" + + "[proto2_unittest.repeated_uint64_extension]: 304\n" + + "[proto2_unittest.repeated_sint32_extension]: 205\n" + + "[proto2_unittest.repeated_sint32_extension]: 305\n" + + "[proto2_unittest.repeated_sint64_extension]: 206\n" + + "[proto2_unittest.repeated_sint64_extension]: 306\n" + + "[proto2_unittest.repeated_fixed32_extension]: 207\n" + + "[proto2_unittest.repeated_fixed32_extension]: 307\n" + + "[proto2_unittest.repeated_fixed64_extension]: 208\n" + + "[proto2_unittest.repeated_fixed64_extension]: 308\n" + + "[proto2_unittest.repeated_sfixed32_extension]: 209\n" + + "[proto2_unittest.repeated_sfixed32_extension]: 309\n" + + "[proto2_unittest.repeated_sfixed64_extension]: 210\n" + + "[proto2_unittest.repeated_sfixed64_extension]: 310\n" + + "[proto2_unittest.repeated_float_extension]: 211.0\n" + + "[proto2_unittest.repeated_float_extension]: 311.0\n" + + "[proto2_unittest.repeated_double_extension]: 212.0\n" + + "[proto2_unittest.repeated_double_extension]: 312.0\n" + + "[proto2_unittest.repeated_bool_extension]: true\n" + + "[proto2_unittest.repeated_bool_extension]: false\n" + + "[proto2_unittest.repeated_string_extension]: \"215\"\n" + + "[proto2_unittest.repeated_string_extension]: \"315\"\n" + + "[proto2_unittest.repeated_bytes_extension]: \"216\"\n" + + "[proto2_unittest.repeated_bytes_extension]: \"316\"\n" + + "[proto2_unittest.repeatedgroup_extension] {\n" + " a: 217\n" + "}\n" - + "[protobuf_unittest.repeatedgroup_extension] {\n" + + "[proto2_unittest.repeatedgroup_extension] {\n" + " a: 317\n" + "}\n" - + "[protobuf_unittest.repeated_nested_message_extension] {\n" + + "[proto2_unittest.repeated_nested_message_extension] {\n" + " bb: 218\n" + "}\n" - + "[protobuf_unittest.repeated_nested_message_extension] {\n" + + "[proto2_unittest.repeated_nested_message_extension] {\n" + " bb: 318\n" + "}\n" - + "[protobuf_unittest.repeated_foreign_message_extension] {\n" + + "[proto2_unittest.repeated_foreign_message_extension] {\n" + " c: 219\n" + "}\n" - + "[protobuf_unittest.repeated_foreign_message_extension] {\n" + + "[proto2_unittest.repeated_foreign_message_extension] {\n" + " c: 319\n" + "}\n" - + "[protobuf_unittest.repeated_import_message_extension] {\n" + + "[proto2_unittest.repeated_import_message_extension] {\n" + " d: 220\n" + "}\n" - + "[protobuf_unittest.repeated_import_message_extension] {\n" + + "[proto2_unittest.repeated_import_message_extension] {\n" + " d: 320\n" + "}\n" - + "[protobuf_unittest.repeated_nested_enum_extension]: BAR\n" - + "[protobuf_unittest.repeated_nested_enum_extension]: BAZ\n" - + "[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR\n" - + "[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ\n" - + "[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAR\n" - + "[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAZ\n" - + "[protobuf_unittest.repeated_string_piece_extension]: \"224\"\n" - + "[protobuf_unittest.repeated_string_piece_extension]: \"324\"\n" - + "[protobuf_unittest.repeated_cord_extension]: \"225\"\n" - + "[protobuf_unittest.repeated_cord_extension]: \"325\"\n" - + "[protobuf_unittest.repeated_lazy_message_extension] {\n" + + "[proto2_unittest.repeated_nested_enum_extension]: BAR\n" + + "[proto2_unittest.repeated_nested_enum_extension]: BAZ\n" + + "[proto2_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR\n" + + "[proto2_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ\n" + + "[proto2_unittest.repeated_import_enum_extension]: IMPORT_BAR\n" + + "[proto2_unittest.repeated_import_enum_extension]: IMPORT_BAZ\n" + + "[proto2_unittest.repeated_string_piece_extension]: \"224\"\n" + + "[proto2_unittest.repeated_string_piece_extension]: \"324\"\n" + + "[proto2_unittest.repeated_cord_extension]: \"225\"\n" + + "[proto2_unittest.repeated_cord_extension]: \"325\"\n" + + "[proto2_unittest.repeated_lazy_message_extension] {\n" + " bb: 227\n" + "}\n" - + "[protobuf_unittest.repeated_lazy_message_extension] {\n" + + "[proto2_unittest.repeated_lazy_message_extension] {\n" + " bb: 327\n" + "}\n" - + "[protobuf_unittest.default_int32_extension]: 401\n" - + "[protobuf_unittest.default_int64_extension]: 402\n" - + "[protobuf_unittest.default_uint32_extension]: 403\n" - + "[protobuf_unittest.default_uint64_extension]: 404\n" - + "[protobuf_unittest.default_sint32_extension]: 405\n" - + "[protobuf_unittest.default_sint64_extension]: 406\n" - + "[protobuf_unittest.default_fixed32_extension]: 407\n" - + "[protobuf_unittest.default_fixed64_extension]: 408\n" - + "[protobuf_unittest.default_sfixed32_extension]: 409\n" - + "[protobuf_unittest.default_sfixed64_extension]: 410\n" - + "[protobuf_unittest.default_float_extension]: 411.0\n" - + "[protobuf_unittest.default_double_extension]: 412.0\n" - + "[protobuf_unittest.default_bool_extension]: false\n" - + "[protobuf_unittest.default_string_extension]: \"415\"\n" - + "[protobuf_unittest.default_bytes_extension]: \"416\"\n" - + "[protobuf_unittest.default_nested_enum_extension]: FOO\n" - + "[protobuf_unittest.default_foreign_enum_extension]: FOREIGN_FOO\n" - + "[protobuf_unittest.default_import_enum_extension]: IMPORT_FOO\n" - + "[protobuf_unittest.default_string_piece_extension]: \"424\"\n" - + "[protobuf_unittest.default_cord_extension]: \"425\"\n" - + "[protobuf_unittest.oneof_uint32_extension]: 601\n" - + "[protobuf_unittest.oneof_nested_message_extension] {\n" + + "[proto2_unittest.default_int32_extension]: 401\n" + + "[proto2_unittest.default_int64_extension]: 402\n" + + "[proto2_unittest.default_uint32_extension]: 403\n" + + "[proto2_unittest.default_uint64_extension]: 404\n" + + "[proto2_unittest.default_sint32_extension]: 405\n" + + "[proto2_unittest.default_sint64_extension]: 406\n" + + "[proto2_unittest.default_fixed32_extension]: 407\n" + + "[proto2_unittest.default_fixed64_extension]: 408\n" + + "[proto2_unittest.default_sfixed32_extension]: 409\n" + + "[proto2_unittest.default_sfixed64_extension]: 410\n" + + "[proto2_unittest.default_float_extension]: 411.0\n" + + "[proto2_unittest.default_double_extension]: 412.0\n" + + "[proto2_unittest.default_bool_extension]: false\n" + + "[proto2_unittest.default_string_extension]: \"415\"\n" + + "[proto2_unittest.default_bytes_extension]: \"416\"\n" + + "[proto2_unittest.default_nested_enum_extension]: FOO\n" + + "[proto2_unittest.default_foreign_enum_extension]: FOREIGN_FOO\n" + + "[proto2_unittest.default_import_enum_extension]: IMPORT_FOO\n" + + "[proto2_unittest.default_string_piece_extension]: \"424\"\n" + + "[proto2_unittest.default_cord_extension]: \"425\"\n" + + "[proto2_unittest.oneof_uint32_extension]: 601\n" + + "[proto2_unittest.oneof_nested_message_extension] {\n" + " bb: 602\n" + "}\n" - + "[protobuf_unittest.oneof_string_extension]: \"603\"\n" - + "[protobuf_unittest.oneof_bytes_extension]: \"604\"\n"; + + "[proto2_unittest.oneof_string_extension]: \"603\"\n" + + "[proto2_unittest.oneof_bytes_extension]: \"604\"\n"; public static final TestRequired TEST_REQUIRED_UNINITIALIZED = TestRequired.newBuilder().setA(1).buildPartial(); diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java index 6a4d0cd81af58..66ee0cbd5b610 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java @@ -12,7 +12,7 @@ import static com.google.common.truth.Truth.assertWithMessage; import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.FieldDescriptor; -import protobuf_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatTest.java index 54d0f3ba3b721..c00fe99b1bb9d 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TextFormatTest.java @@ -11,9 +11,10 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static com.google.protobuf.TestUtil.TEST_REQUIRED_INITIALIZED; import static com.google.protobuf.TestUtil.TEST_REQUIRED_UNINITIALIZED; -import static protobuf_unittest.UnittestProto.optionalInt32Extension; +import static proto2_unittest.UnittestProto.optionalInt32Extension; import static org.junit.Assert.assertThrows; +import com.google.common.collect.ImmutableList; import com.google.protobuf.DescriptorProtos.DescriptorProto; import com.google.protobuf.DescriptorProtos.FieldDescriptorProto; import com.google.protobuf.DescriptorProtos.FileDescriptorProto; @@ -31,17 +32,17 @@ import editions_unittest.NotGroupLikeScope; import editions_unittest.TestDelimited; import editions_unittest.UnittestDelimited; import map_test.MapTestProto.TestMap; -import protobuf_unittest.UnittestMset.TestMessageSetExtension1; -import protobuf_unittest.UnittestMset.TestMessageSetExtension2; -import protobuf_unittest.UnittestProto.OneString; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage; -import protobuf_unittest.UnittestProto.TestEmptyMessage; -import protobuf_unittest.UnittestProto.TestOneof2; -import protobuf_unittest.UnittestProto.TestRecursiveMessage; -import protobuf_unittest.UnittestProto.TestRequired; -import protobuf_unittest.UnittestProto.TestReservedFields; +import proto2_unittest.UnittestMset.TestMessageSetExtension1; +import proto2_unittest.UnittestMset.TestMessageSetExtension2; +import proto2_unittest.UnittestProto.OneString; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes.NestedMessage; +import proto2_unittest.UnittestProto.TestEmptyMessage; +import proto2_unittest.UnittestProto.TestOneof2; +import proto2_unittest.UnittestProto.TestRecursiveMessage; +import proto2_unittest.UnittestProto.TestRequired; +import proto2_unittest.UnittestProto.TestReservedFields; import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet; import java.io.StringReader; import java.util.Arrays; @@ -80,6 +81,7 @@ public class TextFormatTest { + "repeated_double: 0.125\n" + "repeated_double: .125\n" + "repeated_double: -.125\n" + + "repeated_double: .0\n" + "repeated_double: 1.23E17\n" + "repeated_double: 1.23E+17\n" + "repeated_double: -1.23e-17\n" @@ -106,19 +108,19 @@ public class TextFormatTest { private static final String MESSAGE_SET_TEXT = "" - + "[protobuf_unittest.TestMessageSetExtension1] {\n" + + "[proto2_unittest.TestMessageSetExtension1] {\n" + " i: 123\n" + "}\n" - + "[protobuf_unittest.TestMessageSetExtension2] {\n" + + "[proto2_unittest.TestMessageSetExtension2] {\n" + " str: \"foo\"\n" + "}\n"; private static final String MESSAGE_SET_TEXT_WITH_REPEATED_EXTENSION = "" - + "[protobuf_unittest.TestMessageSetExtension1] {\n" + + "[proto2_unittest.TestMessageSetExtension1] {\n" + " i: 123\n" + "}\n" - + "[protobuf_unittest.TestMessageSetExtension1] {\n" + + "[proto2_unittest.TestMessageSetExtension1] {\n" + " i: 456\n" + "}\n"; @@ -240,6 +242,39 @@ public class TextFormatTest { .isEqualTo("optional_nested_message {\n bb: 42\n}\n"); } + @Test + public void testPrintRepeatedFieldUsingShortRepeatedPrimitives_usesRegularNotationForMessageType() + throws Exception { + final FieldDescriptor repeatedMessageField = + TestAllTypes.getDescriptor().findFieldByName("repeated_nested_message"); + assertThat( + TextFormat.printer() + .usingShortRepeatedPrimitives(true) + .printFieldToString( + repeatedMessageField, + ImmutableList.of( + TestAllTypes.NestedMessage.getDefaultInstance(), + TestAllTypes.NestedMessage.getDefaultInstance()))) + .isEqualTo("repeated_nested_message {\n}\nrepeated_nested_message {\n}\n"); + } + + @Test + public void testPrintRepeatedFieldUsingShortRepeatedPrimitives_usesShortNotationForPrimitiveType() + throws Exception { + final FieldDescriptor repeatedInt32Field = + TestAllTypes.getDescriptor().findFieldByName("repeated_int32"); + assertThat( + TextFormat.printer() + .usingShortRepeatedPrimitives(true) + .printFieldToString(repeatedInt32Field, ImmutableList.of(0))) + .isEqualTo("repeated_int32: [0]\n"); + assertThat( + TextFormat.printer() + .usingShortRepeatedPrimitives(true) + .printFieldToString(repeatedInt32Field, ImmutableList.of(0, 1, 2, 3))) + .isEqualTo("repeated_int32: [0, 1, 2, 3]\n"); + } + /** * Helper to construct a ByteString from a String containing only 8-bit characters. The characters * are converted directly to bytes, *not* encoded using UTF-8. @@ -280,6 +315,7 @@ public class TextFormatTest { .addRepeatedDouble(0.125) .addRepeatedDouble(.125) .addRepeatedDouble(-.125) + .addRepeatedDouble(.0) .addRepeatedDouble(123e15) .addRepeatedDouble(123e15) .addRepeatedDouble(-1.23e-17) @@ -503,8 +539,8 @@ public class TextFormatTest { assertThat(e) .hasMessageThat() .isEqualTo( - "4:44: Non-repeated field " - + "\"protobuf_unittest.TestMessageSetExtension1.message_set_extension\"" + "4:42: Non-repeated field " + + "\"proto2_unittest.TestMessageSetExtension1.message_set_extension\"" + " cannot be overwritten."); } } @@ -554,7 +590,7 @@ public class TextFormatTest { .printToString(testAny); String expected = "value {\n" - + " [type.googleapis.com/protobuf_unittest.TestAllTypes] {\n" + + " [type.googleapis.com/proto2_unittest.TestAllTypes] {\n" + " optional_int32: 12345\n" + " }\n" + "}\n"; @@ -606,7 +642,7 @@ public class TextFormatTest { .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build()) .printToString(testAny); String expected = - "[type.googleapis.com/protobuf_unittest.TestAllTypes] {\n" + "[type.googleapis.com/proto2_unittest.TestAllTypes] {\n" + " optional_int32: 12345\n" + "}\n"; assertThat(actual).isEqualTo(expected); @@ -645,7 +681,7 @@ public class TextFormatTest { TextFormat.printer() .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build()) .printToString(testAny); - String expected = "[type.googleapis.com/protobuf_unittest.TestAllExtensions] {\n 1: 12345\n}\n"; + String expected = "[type.googleapis.com/proto2_unittest.TestAllExtensions] {\n 1: 12345\n}\n"; assertThat(actual).isEqualTo(expected); } @@ -683,8 +719,8 @@ public class TextFormatTest { .usingExtensionRegistry(TestUtil.getFullExtensionRegistry()) .printToString(testAny); String expected = - "[type.googleapis.com/protobuf_unittest.TestAllExtensions] {\n" - + " [protobuf_unittest.optional_int32_extension]: 12345\n" + "[type.googleapis.com/proto2_unittest.TestAllExtensions] {\n" + + " [proto2_unittest.optional_int32_extension]: 12345\n" + "}\n"; assertThat(actual).isEqualTo(expected); } @@ -709,7 +745,7 @@ public class TextFormatTest { TextFormat.printer() .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build()) .printToString(testAny); - String expected = "type_url: \"type.googleapis.com/protobuf_unittest.TestAllTypes\"\n"; + String expected = "type_url: \"type.googleapis.com/proto2_unittest.TestAllTypes\"\n"; assertThat(actual).isEqualTo(expected); } @@ -765,7 +801,7 @@ public class TextFormatTest { .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build()) .printToString(testAny); String expected = - "type_url: \"type.googleapis.com/protobuf_unittest.TestAllTypes\"\n" + "value: \"test\"\n"; + "type_url: \"type.googleapis.com/proto2_unittest.TestAllTypes\"\n" + "value: \"test\"\n"; assertThat(actual).isEqualTo(expected); } @@ -777,7 +813,7 @@ public class TextFormatTest { .build() .merge( "value: {\n" - + "[type.googleapis.com/protobuf_unittest.TestAllTypes] {\n" + + "[type.googleapis.com/proto2_unittest.TestAllTypes] {\n" + "optional_int32: 12345\n" + "optional_nested_message {\n" + " bb: 123\n" @@ -896,25 +932,28 @@ public class TextFormatTest { "1:18: String missing ending quote.", "optional_string: \"ueoauaoe\noptional_int32: 123"); assertParseError( "1:2: Input contains unknown fields and/or extensions:\n" - + "1:2:\tprotobuf_unittest.TestAllTypes.[nosuchext]", + + "1:2:\tproto2_unittest.TestAllTypes.[nosuchext]", "[nosuchext]: 123"); assertParseError( - "1:20: Extension \"protobuf_unittest.optional_int32_extension\" does " - + "not extend message type \"protobuf_unittest.TestAllTypes\".", - "[protobuf_unittest.optional_int32_extension]: 123"); + "1:18: Extension \"proto2_unittest.optional_int32_extension\" does " + + "not extend message type \"proto2_unittest.TestAllTypes\".", + "[proto2_unittest.optional_int32_extension]: 123"); assertParseError( "1:1: Input contains unknown fields and/or extensions:\n" - + "1:1:\tprotobuf_unittest.TestAllTypes.nosuchfield", + + "1:1:\tproto2_unittest.TestAllTypes.nosuchfield", "nosuchfield: 123"); assertParseError("1:21: Expected \">\".", "OptionalGroup < a: 1"); assertParseError( - "1:23: Enum type \"protobuf_unittest.TestAllTypes.NestedEnum\" has no " + "1:23: Enum type \"proto2_unittest.TestAllTypes.NestedEnum\" has no " + "value named \"NO_SUCH_VALUE\".", "optional_nested_enum: NO_SUCH_VALUE"); assertParseError( - "1:23: Enum type \"protobuf_unittest.TestAllTypes.NestedEnum\" has no " + "1:23: Enum type \"proto2_unittest.TestAllTypes.NestedEnum\" has no " + "value with number 123.", "optional_nested_enum: 123"); + assertParseError("1:18: Couldn't parse number: For input string: \".\"", "repeated_double: ."); + assertParseError( + "1:18: Couldn't parse number: For input string: \".+\"", "repeated_double: .+"); // Delimiters must match. assertParseError("1:22: Expected identifier. Found '}'", "OptionalGroup < a: 1 }"); @@ -1455,36 +1494,36 @@ public class TextFormatTest { assertThat(logHandler.getStoredLogRecords().get(0).getMessage()) .isEqualTo( "Input contains unknown fields and/or extensions:\n" - + "1:2:\tprotobuf_unittest.TestAllTypes.[unknown_extension]"); + + "1:2:\tproto2_unittest.TestAllTypes.[unknown_extension]"); assertThat(logHandler.getStoredLogRecords().get(1).getMessage()) .isEqualTo( "Input contains unknown fields and/or extensions:\n" - + "1:2:\tprotobuf_unittest.TestAllTypes.[unknown_extension]\n" - + "2:2:\tprotobuf_unittest.TestAllTypes.[unknown_ext]\n" - + "3:2:\tprotobuf_unittest.TestAllTypes.[unknown]"); + + "1:2:\tproto2_unittest.TestAllTypes.[unknown_extension]\n" + + "2:2:\tproto2_unittest.TestAllTypes.[unknown_ext]\n" + + "3:2:\tproto2_unittest.TestAllTypes.[unknown]"); // Test unknown field can not pass. assertParseErrorWithUnknownExtensions( "2:1: Input contains unknown fields and/or extensions:\n" - + "1:2:\tprotobuf_unittest.TestAllTypes.[unknown_extension]\n" - + "2:1:\tprotobuf_unittest.TestAllTypes.unknown_field", + + "1:2:\tproto2_unittest.TestAllTypes.[unknown_extension]\n" + + "2:1:\tproto2_unittest.TestAllTypes.unknown_field", "[unknown_extension]: 1\n" + "unknown_field: 12345"); assertParseErrorWithUnknownExtensions( "3:1: Input contains unknown fields and/or extensions:\n" - + "1:2:\tprotobuf_unittest.TestAllTypes.[unknown_extension1]\n" - + "2:2:\tprotobuf_unittest.TestAllTypes.[unknown_extension2]\n" - + "3:1:\tprotobuf_unittest.TestAllTypes.unknown_field\n" - + "4:2:\tprotobuf_unittest.TestAllTypes.[unknown_extension3]", + + "1:2:\tproto2_unittest.TestAllTypes.[unknown_extension1]\n" + + "2:2:\tproto2_unittest.TestAllTypes.[unknown_extension2]\n" + + "3:1:\tproto2_unittest.TestAllTypes.unknown_field\n" + + "4:2:\tproto2_unittest.TestAllTypes.[unknown_extension3]", "[unknown_extension1]: 1\n" + "[unknown_extension2]: 2\n" + "unknown_field: 12345\n" + "[unknown_extension3]: 3\n"); assertParseErrorWithUnknownExtensions( "1:1: Input contains unknown fields and/or extensions:\n" - + "1:1:\tprotobuf_unittest.TestAllTypes.unknown_field1\n" - + "2:1:\tprotobuf_unittest.TestAllTypes.unknown_field2\n" - + "3:2:\tprotobuf_unittest.TestAllTypes.[unknown_extension]\n" - + "4:1:\tprotobuf_unittest.TestAllTypes.unknown_field3", + + "1:1:\tproto2_unittest.TestAllTypes.unknown_field1\n" + + "2:1:\tproto2_unittest.TestAllTypes.unknown_field2\n" + + "3:2:\tproto2_unittest.TestAllTypes.[unknown_extension]\n" + + "4:1:\tproto2_unittest.TestAllTypes.unknown_field3", "unknown_field1: 1\n" + "unknown_field2: 2\n" + "[unknown_extension]: 12345\n" @@ -1496,7 +1535,7 @@ public class TextFormatTest { assertParseSuccessWithUnknownExtensions( "[unknown_extension]: { " + " any_value { " - + " [type.googleapis.com/protobuf_unittest.OneString] { " + + " [type.googleapis.com/proto2_unittest.OneString] { " + " data: 123 " + " } " + " } " @@ -1513,29 +1552,29 @@ public class TextFormatTest { assertParseErrorWithOverwriteForbidden( "3:15: Non-repeated field " - + "\"protobuf_unittest.TestAllTypes.optional_int32\" " + + "\"proto2_unittest.TestAllTypes.optional_int32\" " + "cannot be overwritten.", "optional_int32: 1\noptional_bool: true\noptional_int32: 1\n"); assertParseErrorWithOverwriteForbidden( "2:1: Non-repeated field " - + "\"protobuf_unittest.TestAllTypes.optionalgroup\" " + + "\"proto2_unittest.TestAllTypes.optionalgroup\" " + "cannot be overwritten.", "OptionalGroup { a: 1 }\nOptionalGroup { }\n"); assertParseErrorWithOverwriteForbidden( "2:1: Non-repeated field " - + "\"protobuf_unittest.TestAllTypes.optional_nested_message\" " + + "\"proto2_unittest.TestAllTypes.optional_nested_message\" " + "cannot be overwritten.", "optional_nested_message { }\noptional_nested_message { bb: 3 }\n"); assertParseErrorWithOverwriteForbidden( "2:14: Non-repeated field " - + "\"protobuf_unittest.TestAllTypes.default_int32\" " + + "\"proto2_unittest.TestAllTypes.default_int32\" " + "cannot be overwritten.", "default_int32: 41\n" + // the default value "default_int32: 41\n"); assertParseErrorWithOverwriteForbidden( "2:15: Non-repeated field " - + "\"protobuf_unittest.TestAllTypes.default_string\" " + + "\"proto2_unittest.TestAllTypes.default_string\" " + "cannot be overwritten.", "default_string: \"zxcv\"\ndefault_string: \"asdf\"\n"); } @@ -1798,8 +1837,8 @@ public class TextFormatTest { assertThat(e) .hasMessageThat() .isEqualTo( - "1:34: Field \"protobuf_unittest.TestOneof2.foo_int\"" - + " is specified along with field \"protobuf_unittest.TestOneof2.foo_string\"," + "1:34: Field \"proto2_unittest.TestOneof2.foo_int\"" + + " is specified along with field \"proto2_unittest.TestOneof2.foo_string\"," + " another member of oneof \"foo\"."); } } @@ -1937,6 +1976,58 @@ public class TextFormatTest { } } + @Test + public void testMapDynamicMessage() throws Exception { + TestMap message = + TestMap.newBuilder() + .putInt32ToStringField(30, "cherry") + .putInt32ToStringField(10, "apple") + .putInt32ToStringField(20, "banana") + .build(); + DynamicMessage dynamic = + DynamicMessage.parseFrom( + TestMap.getDescriptor(), message.toByteString(), ExtensionRegistry.getEmptyRegistry()); + assertThat(TextFormat.printer().printToString(dynamic)) + .isEqualTo(TextFormat.printer().printToString(message)); + } + + @Test + public void testMapKeyAdapterComparison() throws Exception { + FieldDescriptor int32ToStringField = + TestMap.getDescriptor().findFieldByNumber(TestMap.INT32_TO_STRING_FIELD_FIELD_NUMBER); + TestMap map = + TestMap.newBuilder() + .putInt32ToStringField(10, "apple") + .putInt32ToStringField(20, "banana") + .build(); + TextFormat.Printer.MapEntryAdapter nullEntry = + new TextFormat.Printer.MapEntryAdapter(null, int32ToStringField); + TextFormat.Printer.MapEntryAdapter entry1 = + new TextFormat.Printer.MapEntryAdapter( + map.getRepeatedField(int32ToStringField, 0), int32ToStringField); + TextFormat.Printer.MapEntryAdapter entry2 = + new TextFormat.Printer.MapEntryAdapter( + map.getRepeatedField(int32ToStringField, 1), int32ToStringField); + assertThat(nullEntry).isEquivalentAccordingToCompareTo(nullEntry); + assertThat(entry1).isEquivalentAccordingToCompareTo(entry1); + assertThat(entry2).isEquivalentAccordingToCompareTo(entry2); + assertThat(nullEntry).isLessThan(entry1); + assertThat(entry1).isGreaterThan(nullEntry); + assertThat(nullEntry).isLessThan(entry2); + assertThat(entry2).isGreaterThan(nullEntry); + assertThat(entry1).isLessThan(entry2); + assertThat(entry2).isGreaterThan(entry1); + } + + @Test + public void testMapKeyAdapterComparisonInvalidType() throws Exception { + TextFormat.Printer.MapEntryAdapter invalidEntry = + new TextFormat.Printer.MapEntryAdapter( + TestOneof2.NestedMessage.getDefaultInstance(), + TestOneof2.getDescriptor().findFieldByNumber(TestOneof2.FOO_MESSAGE_FIELD_NUMBER)); + assertThat(invalidEntry).isEquivalentAccordingToCompareTo(invalidEntry); + } + // ======================================================================= // test location information @@ -2143,12 +2234,12 @@ public class TextFormatTest { .build(); TestAny.Builder depth2 = TestAny.newBuilder(); parser.merge( - "value { [type.googleapis.com/protobuf_unittest.TestAllTypes] { optional_int32: 1 } }", + "value { [type.googleapis.com/proto2_unittest.TestAllTypes] { optional_int32: 1 } }", depth2); try { TestAny.Builder depth3 = TestAny.newBuilder(); parser.merge( - "value { [type.googleapis.com/protobuf_unittest.TestAllTypes] { optional_nested_message {" + "value { [type.googleapis.com/proto2_unittest.TestAllTypes] { optional_nested_message {" + "} } }", depth3); assertWithMessage("Parsing deep message should have failed").fail(); @@ -2167,11 +2258,11 @@ public class TextFormatTest { .build(); Any.Builder depth2 = Any.newBuilder(); parser.merge( - "[type.googleapis.com/protobuf_unittest.TestRecursiveMessage] { a { i: 0 } }", depth2); + "[type.googleapis.com/proto2_unittest.TestRecursiveMessage] { a { i: 0 } }", depth2); try { Any.Builder depth3 = Any.newBuilder(); parser.merge( - "[type.googleapis.com/protobuf_unittest.TestRecursiveMessage] { a { a { i: 0 } } }", + "[type.googleapis.com/proto2_unittest.TestRecursiveMessage] { a { a { i: 0 } } }", depth3); assertWithMessage("Parsing deep message should have failed").fail(); } catch (TextFormat.ParseException e) { diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java index 048948f957fb1..4633765a2ad14 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java @@ -11,7 +11,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertThrows; import com.google.protobuf.Descriptors.Descriptor; -import protobuf_unittest.UnittestProto; +import proto2_unittest.UnittestProto; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java index 58ac736d4ab96..402d3de08cb30 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java @@ -9,15 +9,16 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static org.junit.Assert.assertThrows; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.ForeignEnum; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestEmptyMessage; -import protobuf_unittest.UnittestProto.TestEmptyMessageWithExtensions; -import protobuf_unittest.UnittestProto.TestPackedExtensions; -import protobuf_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.ForeignEnum; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestEmptyMessage; +import proto2_unittest.UnittestProto.TestEmptyMessageWithExtensions; +import proto2_unittest.UnittestProto.TestPackedExtensions; +import proto2_unittest.UnittestProto.TestPackedTypes; import proto3_unittest.UnittestProto3; import java.util.List; import java.util.Map; @@ -267,6 +268,17 @@ public class UnknownFieldSetTest { } } + @Test + public void testMergeFieldFromInvalidEndGroup() { + byte[] data = new byte[] {(byte) WireFormat.makeTag(1, WireFormat.WIRETYPE_END_GROUP)}; + CodedInputStream input = CodedInputStream.newInstance(data); + + UnknownFieldSet.Builder instance = UnknownFieldSet.newBuilder(); + assertThrows( + InvalidProtocolBufferException.class, + () -> instance.mergeFieldFrom(input.readTag(), input)); + } + @Test @SuppressWarnings("ModifiedButNotUsed") public void testHasField_negative() { diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java new file mode 100644 index 0000000000000..3fe01b6eb3dd5 --- /dev/null +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java @@ -0,0 +1,132 @@ +package com.google.protobuf; + +import static com.google.common.truth.Truth.assertThat; + +import proto2_unittest.UnittestProto; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public final class UnredactedDebugFormatForTestTest { + + @Test + public void unredactedDebugFormatForTestMessage_defaultMessageIsEmpty() { + UnittestProto.TestEmptyMessage message = UnittestProto.TestEmptyMessage.getDefaultInstance(); + assertThat(UnredactedDebugFormatForTest.unredactedMultilineString(message)).isEmpty(); + + UnittestProto.TestEmptyMessage singleLineMessage = + UnittestProto.TestEmptyMessage.getDefaultInstance(); + assertThat(UnredactedDebugFormatForTest.unredactedSingleLineString(singleLineMessage)) + .isEmpty(); + } + + @Test + public void unredactedDebugFormatForTestMessage_hasExpectedFormats() { + UnittestProto.RedactedFields message = + UnittestProto.RedactedFields.newBuilder() + .setOptionalRedactedString("redacted") + .setOptionalUnredactedString("hello") + .setOptionalRedactedMessage( + UnittestProto.TestNestedMessageRedaction.newBuilder() + .setOptionalRedactedNestedString("nested") + .build()) + .setOptionalUnredactedMessage( + UnittestProto.TestNestedMessageRedaction.newBuilder() + .setOptionalUnredactedNestedString("unredacted") + .build()) + .build(); + assertThat(UnredactedDebugFormatForTest.unredactedMultilineString(message)) + .isEqualTo( + "optional_redacted_string: \"redacted\"\n" + + "optional_unredacted_string: \"hello\"\n" + + "optional_redacted_message {\n" + + " optional_redacted_nested_string: \"nested\"\n" + + "}\n" + + "optional_unredacted_message {\n" + + " optional_unredacted_nested_string: \"unredacted\"\n" + + "}\n"); + assertThat(UnredactedDebugFormatForTest.unredactedSingleLineString(message)) + .isEqualTo( + "optional_redacted_string: \"redacted\"" + + " optional_unredacted_string: \"hello\"" + + " optional_redacted_message {" + + " optional_redacted_nested_string: \"nested\"" + + " }" + + " optional_unredacted_message {" + + " optional_unredacted_nested_string: \"unredacted\"" + + " }"); + } + + private UnknownFieldSet makeUnknownFieldSet() { + return UnknownFieldSet.newBuilder() + .addField( + 5, + UnknownFieldSet.Field.newBuilder() + .addVarint(1) + .addFixed32(2) + .addFixed64(3) + .addLengthDelimited(ByteString.copyFromUtf8("4")) + .addLengthDelimited( + UnknownFieldSet.newBuilder() + .addField(12, UnknownFieldSet.Field.newBuilder().addVarint(6).build()) + .build() + .toByteString()) + .addGroup( + UnknownFieldSet.newBuilder() + .addField(10, UnknownFieldSet.Field.newBuilder().addVarint(5).build()) + .build()) + .build()) + .addField( + 8, UnknownFieldSet.Field.newBuilder().addVarint(1).addVarint(2).addVarint(3).build()) + .addField( + 15, + UnknownFieldSet.Field.newBuilder() + .addVarint(0xABCDEF1234567890L) + .addFixed32(0xABCD1234) + .addFixed64(0xABCDEF1234567890L) + .build()) + .build(); + } + + @Test + public void unredactedDebugFormatForTestUnknownFields_hasExpectedFormats() { + UnknownFieldSet unknownFields = makeUnknownFieldSet(); + assertThat(UnredactedDebugFormatForTest.unredactedMultilineString(unknownFields)) + .isEqualTo( + "5: 1\n" + + "5: 0x00000002\n" + + "5: 0x0000000000000003\n" + + "5: \"4\"\n" + + "5: {\n" + + " 12: 6\n" + + "}\n" + + "5 {\n" + + " 10: 5\n" + + "}\n" + + "8: 1\n" + + "8: 2\n" + + "8: 3\n" + + "15: 12379813812177893520\n" + + "15: 0xabcd1234\n" + + "15: 0xabcdef1234567890\n"); + assertThat(UnredactedDebugFormatForTest.unredactedSingleLineString(unknownFields)) + .isEqualTo( + "5: 1" + + " 5: 0x00000002" + + " 5: 0x0000000000000003" + + " 5: \"4\"" + + " 5: {" + + " 12: 6" + + " }" + + " 5 {" + + " 10: 5" + + " }" + + " 8: 1" + + " 8: 2" + + " 8: 3" + + " 15: 12379813812177893520" + + " 15: 0xabcd1234" + + " 15: 0xabcdef1234567890"); + } +} diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatLiteTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatLiteTest.java index f57e5c9a6d758..62698f786602e 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatLiteTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatLiteTest.java @@ -16,18 +16,18 @@ import com.google.protobuf.UnittestLite.TestAllExtensionsLite; import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; import map_test.MapForProto2TestProto; import map_test.MapTestProto.TestMap; -import protobuf_unittest.UnittestMset.RawMessageSet; -import protobuf_unittest.UnittestMset.TestMessageSetExtension1; -import protobuf_unittest.UnittestMset.TestMessageSetExtension2; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestExtensionInsideTable; -import protobuf_unittest.UnittestProto.TestFieldOrderings; -import protobuf_unittest.UnittestProto.TestOneof2; -import protobuf_unittest.UnittestProto.TestOneofBackwardsCompatible; -import protobuf_unittest.UnittestProto.TestPackedExtensions; -import protobuf_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.UnittestMset.RawMessageSet; +import proto2_unittest.UnittestMset.TestMessageSetExtension1; +import proto2_unittest.UnittestMset.TestMessageSetExtension2; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestExtensionInsideTable; +import proto2_unittest.UnittestProto.TestFieldOrderings; +import proto2_unittest.UnittestProto.TestOneof2; +import proto2_unittest.UnittestProto.TestOneofBackwardsCompatible; +import proto2_unittest.UnittestProto.TestPackedExtensions; +import proto2_unittest.UnittestProto.TestPackedTypes; import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet; import proto3_unittest.UnittestProto3; import java.io.ByteArrayInputStream; diff --git a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatTest.java b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatTest.java index bbf8d0cba685d..558b6c94ff96b 100644 --- a/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatTest.java +++ b/third_party/protobuf/java/core/src/test/java/com/google/protobuf/WireFormatTest.java @@ -9,18 +9,18 @@ package com.google.protobuf; import static com.google.common.truth.Truth.assertThat; -import protobuf_unittest.UnittestMset.RawMessageSet; -import protobuf_unittest.UnittestMset.TestMessageSetExtension1; -import protobuf_unittest.UnittestMset.TestMessageSetExtension2; -import protobuf_unittest.UnittestProto; -import protobuf_unittest.UnittestProto.TestAllExtensions; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestExtensionInsideTable; -import protobuf_unittest.UnittestProto.TestFieldOrderings; -import protobuf_unittest.UnittestProto.TestOneof2; -import protobuf_unittest.UnittestProto.TestOneofBackwardsCompatible; -import protobuf_unittest.UnittestProto.TestPackedExtensions; -import protobuf_unittest.UnittestProto.TestPackedTypes; +import proto2_unittest.UnittestMset.RawMessageSet; +import proto2_unittest.UnittestMset.TestMessageSetExtension1; +import proto2_unittest.UnittestMset.TestMessageSetExtension2; +import proto2_unittest.UnittestProto; +import proto2_unittest.UnittestProto.TestAllExtensions; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestExtensionInsideTable; +import proto2_unittest.UnittestProto.TestFieldOrderings; +import proto2_unittest.UnittestProto.TestOneof2; +import proto2_unittest.UnittestProto.TestOneofBackwardsCompatible; +import proto2_unittest.UnittestProto.TestPackedExtensions; +import proto2_unittest.UnittestProto.TestPackedTypes; import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto index bfc81e8ed6a68..fd99069888eb1 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto @@ -8,7 +8,7 @@ // A regression test for b/74087933 edition = "2023"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/unittest.proto"; import "google/protobuf/unittest_proto3.proto"; @@ -17,6 +17,6 @@ option optimize_for = CODE_SIZE; option java_multiple_files = true; message TestCachedFieldSizeMessage { - protobuf_unittest.TestPackedTypes proto2_child = 1; + proto2_unittest.TestPackedTypes proto2_child = 1; proto3_unittest.TestPackedTypes proto3_child = 2; } diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto new file mode 100644 index 0000000000000..225edd7eef4d0 --- /dev/null +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto @@ -0,0 +1,19 @@ +edition = "2023"; + +package protobuf_unittest; + +option java_multiple_files = true; + +message BlankMessage {} + +// If a field `foo` causes protoc to generate a method like `fooField()` then +// this message will fail to build. +// Some of these clashes are inevitable, e.g. a field named `foo_builder` will +// cause compilation to fail because `getFooBuilder()` is part of the public +// java proto API of field number 1. +// But we can attempt to avoid name clashes caused by internal methods/fields. +message FieldsWithPotentialNameClashes { + BlankMessage foo = 1; + BlankMessage foo_field = 2; + BlankMessage foo_field_accessor_table = 3; +} diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto index d73822260192e..53f05284d4938 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto @@ -29,9 +29,11 @@ message TestAllTypes { int32 optional_int32 = 1; string optional_string = 2; bytes optional_bytes = 3; + float optional_float = 8; + double optional_double = 9; NestedEnum optional_nested_enum = 4; NestedMessage optional_nested_message = 5; - protobuf_unittest.TestRequired optional_proto2_message = 6; + proto2_unittest.TestRequired optional_proto2_message = 6; NestedMessage optional_lazy_message = 7 [lazy = true]; oneof oneof_field { @@ -41,7 +43,7 @@ message TestAllTypes { bytes oneof_bytes = 14; NestedEnum oneof_nested_enum = 15; NestedMessage oneof_nested_message = 16; - protobuf_unittest.TestRequired oneof_proto2_message = 17; + proto2_unittest.TestRequired oneof_proto2_message = 17; } repeated int32 repeated_int32 = 21; @@ -49,7 +51,7 @@ message TestAllTypes { repeated bytes repeated_bytes = 23; repeated NestedEnum repeated_nested_enum = 24; repeated NestedMessage repeated_nested_message = 25; - repeated protobuf_unittest.TestRequired repeated_proto2_message = 26; + repeated proto2_unittest.TestRequired repeated_proto2_message = 26; repeated NestedEnum packed_nested_enum = 27; } @@ -59,7 +61,7 @@ message TestOptionalFieldsOnly { bytes optional_bytes = 3; TestAllTypes.NestedEnum optional_nested_enum = 4; TestAllTypes.NestedMessage optional_nested_message = 5; - protobuf_unittest.TestRequired optional_proto2_message = 6; + proto2_unittest.TestRequired optional_proto2_message = 6; TestAllTypes.NestedMessage optional_lazy_message = 7 [lazy = true]; } @@ -69,5 +71,5 @@ message TestRepeatedFieldsOnly { repeated bytes repeated_bytes = 23; repeated TestAllTypes.NestedEnum repeated_nested_enum = 24; repeated TestAllTypes.NestedMessage repeated_nested_message = 25; - repeated protobuf_unittest.TestRequired repeated_proto2_message = 26; + repeated proto2_unittest.TestRequired repeated_proto2_message = 26; } diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto index 381423e52590e..1537fe8e257ba 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto @@ -11,7 +11,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; option features.utf8_validation = NONE; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto index 141ba314195eb..611f6716aa6b0 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto @@ -9,7 +9,7 @@ edition = "2023"; -package protobuf_unittest.lite_equals_and_hash; +package proto2_unittest.lite_equals_and_hash; option features.utf8_validation = NONE; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto index 57ae5fed256bb..9fc4e7e31da4a 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto @@ -13,7 +13,7 @@ edition = "2023"; // Some generic_services option(s) added automatically. // See: http://go/proto2-generic-services-default -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/descriptor.proto"; import "google/protobuf/unittest.proto"; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto index c5ce68c1c085f..4fe81b5d73403 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto @@ -8,7 +8,7 @@ // Author: jonp@google.com (Jon Perlow) edition = "2023"; -package protobuf_unittest; +package proto2_unittest; option java_multiple_files = true; option java_outer_classname = "NestedBuilders"; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension.proto index 1427c57276e7a..ff739a8ead50a 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension.proto @@ -14,7 +14,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; import "com/google/protobuf/non_nested_extension.proto"; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto index c5fa560f75a5f..c76ba2a2d6a17 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto @@ -15,7 +15,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; import "com/google/protobuf/non_nested_extension_lite.proto"; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto index 230f561858c3a..6dbcf48658dbf 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto @@ -13,7 +13,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; option features.utf8_validation = NONE; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto index f25fb6311354f..f1b194c5ccbc4 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto @@ -13,7 +13,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; option optimize_for = LITE_RUNTIME; diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto index fbbc4dcc63eeb..8687cebcb4189 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto @@ -7,7 +7,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; // This message's name is the same with the default outer class name of this diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto index 3bc3c1240c014..ba49634cad2ce 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto @@ -7,7 +7,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; message TestMessage2 { diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto index ba40da2452d65..df8ae6878ee68 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto @@ -7,7 +7,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; message TestMessage3 { diff --git a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto index 40a93523d9964..2f2d0dcaa883e 100644 --- a/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto +++ b/third_party/protobuf/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto @@ -11,7 +11,7 @@ // initialized. syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/unittest_custom_options.proto"; diff --git a/third_party/protobuf/java/internal/BUILD.bazel b/third_party/protobuf/java/internal/BUILD.bazel index 413360533c08a..f349e5a6a14f7 100644 --- a/third_party/protobuf/java/internal/BUILD.bazel +++ b/third_party/protobuf/java/internal/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_java//java:java_test.bzl", "java_test") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") package(default_visibility = ["//java:__subpackages__"]) diff --git a/third_party/protobuf/java/kotlin-lite/BUILD.bazel b/third_party/protobuf/java/kotlin-lite/BUILD.bazel index 8570268a14187..6f3d01b6d478e 100644 --- a/third_party/protobuf/java/kotlin-lite/BUILD.bazel +++ b/third_party/protobuf/java/kotlin-lite/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_java//java:java_test.bzl", "java_test") load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export") load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") diff --git a/third_party/protobuf/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt b/third_party/protobuf/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt index 7937a3df2e163..bfd5e0b5509f0 100644 --- a/third_party/protobuf/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt +++ b/third_party/protobuf/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt @@ -29,9 +29,9 @@ import com.google.protobuf.testAllExtensionsLite import com.google.protobuf.testAllTypesLite import com.google.protobuf.testEmptyMessageLite import com.google.protobuf.testEmptyMessageWithExtensionsLite -import protobuf_unittest.MapLiteUnittest.MapEnumLite -import protobuf_unittest.MapLiteUnittest.TestMapLite -import protobuf_unittest.testMapLite +import proto2_unittest.MapLiteUnittest.MapEnumLite +import proto2_unittest.MapLiteUnittest.TestMapLite +import proto2_unittest.testMapLite import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2 import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2 import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt diff --git a/third_party/protobuf/java/kotlin/BUILD.bazel b/third_party/protobuf/java/kotlin/BUILD.bazel index 1d9cb5f82d0ab..f286d6878b40d 100644 --- a/third_party/protobuf/java/kotlin/BUILD.bazel +++ b/third_party/protobuf/java/kotlin/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_java//java:java_test.bzl", "java_test") load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export") load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") @@ -25,7 +26,7 @@ kt_jvm_library( visibility = ["//visibility:public"], deps = [ ":only_for_use_in_proto_generated_code_its_generator_and_tests", - "//java/lite", + "//java/core:lite_runtime_only", ], ) @@ -39,7 +40,7 @@ kt_jvm_library( name = "bytestring_lib", srcs = ["src/main/kotlin/com/google/protobuf/ByteStrings.kt"], visibility = ["//java:__subpackages__"], - deps = ["//java/lite"], + deps = ["//java/core:lite_runtime_only"], ) kt_jvm_library( @@ -115,7 +116,7 @@ kt_jvm_library( srcs = ["src/test/kotlin/com/google/protobuf/ByteStringsTest.kt"], deps = [ ":bytestring_lib", - "//java/lite", + "//java/core:lite_runtime_only", "@protobuf_maven//:com_google_truth_truth", "@protobuf_maven//:junit_junit", "@rules_kotlin//kotlin/compiler:kotlin-test", diff --git a/third_party/protobuf/java/kotlin/pom.xml b/third_party/protobuf/java/kotlin/pom.xml index 70077d29206c5..9c2ce19053afa 100644 --- a/third_party/protobuf/java/kotlin/pom.xml +++ b/third_party/protobuf/java/kotlin/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-parent</artifactId> - <version>4.29.3</version> + <version>4.30.1</version> </parent> <artifactId>protobuf-kotlin</artifactId> diff --git a/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt b/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt index f7b5e69cd46d0..52b5bd4f7023b 100644 --- a/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt +++ b/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt @@ -10,9 +10,9 @@ package com.google.protobuf.kotlin import com.google.common.truth.Truth.assertThat import com.google.protobuf.Any as ProtoAny import com.google.protobuf.InvalidProtocolBufferException -import protobuf_unittest.UnittestProto.BoolMessage -import protobuf_unittest.UnittestProto.Int32Message -import protobuf_unittest.int32Message +import proto2_unittest.UnittestProto.BoolMessage +import proto2_unittest.UnittestProto.Int32Message +import proto2_unittest.int32Message import kotlin.test.assertFailsWith import org.junit.Test import org.junit.runner.RunWith diff --git a/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt b/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt index 1d8cf054f2b06..e35adfd0de37b 100644 --- a/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt +++ b/third_party/protobuf/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt @@ -13,32 +13,32 @@ import com.google.protobuf.TestUtil.toBytes import com.google.protobuf.test.UnittestImport.ImportEnum import com.google.protobuf.test.UnittestImport.ImportMessage import com.google.protobuf.test.UnittestImportPublic.PublicImportMessage -import protobuf_unittest.MapProto2Unittest.Proto2MapEnum -import protobuf_unittest.MapProto2Unittest.TestEnumMap -import protobuf_unittest.MapProto2Unittest.TestIntIntMap -import protobuf_unittest.MapProto2Unittest.TestMaps -import protobuf_unittest.TestAllTypesKt -import protobuf_unittest.TestAllTypesKt.nestedMessage -import protobuf_unittest.UnittestProto -import protobuf_unittest.UnittestProto.ForeignEnum -import protobuf_unittest.UnittestProto.TestAllTypes -import protobuf_unittest.UnittestProto.TestAllTypes.NestedEnum -import protobuf_unittest.UnittestProto.TestEmptyMessage -import protobuf_unittest.UnittestProto.TestEmptyMessageWithExtensions -import protobuf_unittest.copy -import protobuf_unittest.deprecatedMessageOrNull -import protobuf_unittest.foreignMessage -import protobuf_unittest.optionalGroupExtension -import protobuf_unittest.optionalNestedMessageOrNull -import protobuf_unittest.repeatedGroupExtension -import protobuf_unittest.testAllExtensions -import protobuf_unittest.testAllTypes -import protobuf_unittest.testDeprecatedFields -import protobuf_unittest.testEmptyMessage -import protobuf_unittest.testEmptyMessageWithExtensions -import protobuf_unittest.testEnumMap -import protobuf_unittest.testIntIntMap -import protobuf_unittest.testMaps +import proto2_unittest.MapProto2Unittest.Proto2MapEnum +import proto2_unittest.MapProto2Unittest.TestEnumMap +import proto2_unittest.MapProto2Unittest.TestIntIntMap +import proto2_unittest.MapProto2Unittest.TestMaps +import proto2_unittest.TestAllTypesKt +import proto2_unittest.TestAllTypesKt.nestedMessage +import proto2_unittest.UnittestProto +import proto2_unittest.UnittestProto.ForeignEnum +import proto2_unittest.UnittestProto.TestAllTypes +import proto2_unittest.UnittestProto.TestAllTypes.NestedEnum +import proto2_unittest.UnittestProto.TestEmptyMessage +import proto2_unittest.UnittestProto.TestEmptyMessageWithExtensions +import proto2_unittest.copy +import proto2_unittest.deprecatedMessageOrNull +import proto2_unittest.foreignMessage +import proto2_unittest.optionalGroupExtension +import proto2_unittest.optionalNestedMessageOrNull +import proto2_unittest.repeatedGroupExtension +import proto2_unittest.testAllExtensions +import proto2_unittest.testAllTypes +import proto2_unittest.testDeprecatedFields +import proto2_unittest.testEmptyMessage +import proto2_unittest.testEmptyMessageWithExtensions +import proto2_unittest.testEnumMap +import proto2_unittest.testIntIntMap +import proto2_unittest.testMaps import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2 import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2 import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt @@ -965,7 +965,7 @@ class Proto2Test { @Test fun testDeprecated() { val testInstance = - protobuf_unittest.UnittestProto.TestDeprecatedFields.getDefaultInstance() + proto2_unittest.UnittestProto.TestDeprecatedFields.getDefaultInstance() assertThat(testInstance::deprecatedMessageOrNull.annotations.any { it is Deprecated }).isTrue() val unused = testDeprecatedFields { diff --git a/third_party/protobuf/java/lite/BUILD.bazel b/third_party/protobuf/java/lite/BUILD.bazel index b4df648f6b636..c67cb767cb7cb 100644 --- a/third_party/protobuf/java/lite/BUILD.bazel +++ b/third_party/protobuf/java/lite/BUILD.bazel @@ -1,5 +1,5 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test") -load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix") +load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain") load("//conformance:defs.bzl", "conformance_test") load("//java/internal:testing.bzl", "junit_tests") diff --git a/third_party/protobuf/java/lite/src/test/java/com/google/protobuf/LiteTest.java b/third_party/protobuf/java/lite/src/test/java/com/google/protobuf/LiteTest.java index ecf997f8313b4..b1e41ee50719d 100644 --- a/third_party/protobuf/java/lite/src/test/java/com/google/protobuf/LiteTest.java +++ b/third_party/protobuf/java/lite/src/test/java/com/google/protobuf/LiteTest.java @@ -34,14 +34,14 @@ import com.google.protobuf.testing.Proto3TestingLite.Proto3MessageLite; import map_lite_test.MapTestProto.MapContainer; import map_lite_test.MapTestProto.TestMap; import map_lite_test.MapTestProto.TestMap.MessageValue; -import protobuf_unittest.NestedExtensionLite; -import protobuf_unittest.NonNestedExtensionLite; -import protobuf_unittest.UnittestProto.TestOneof2; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.BarPrime; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestOneofEquals; -import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestRecursiveOneof; +import proto2_unittest.NestedExtensionLite; +import proto2_unittest.NonNestedExtensionLite; +import proto2_unittest.UnittestProto.TestOneof2; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.BarPrime; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestOneofEquals; +import proto2_unittest.lite_equals_and_hash.LiteEqualsAndHash.TestRecursiveOneof; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/third_party/protobuf/java/pom.xml b/third_party/protobuf/java/pom.xml index 79329d8eb066c..2256dd88f54c0 100644 --- a/third_party/protobuf/java/pom.xml +++ b/third_party/protobuf/java/pom.xml @@ -4,7 +4,7 @@ <groupId>com.google.protobuf</groupId> <artifactId>protobuf-parent</artifactId> - <version>4.29.3</version> + <version>4.30.1</version> <packaging>pom</packaging> <name>Protocol Buffers [Parent]</name> diff --git a/third_party/protobuf/java/protoc/pom.xml b/third_party/protobuf/java/protoc/pom.xml index b3720aa850782..9e5c0202ba0cf 100644 --- a/third_party/protobuf/java/protoc/pom.xml +++ b/third_party/protobuf/java/protoc/pom.xml @@ -8,7 +8,7 @@ </parent> <groupId>com.google.protobuf</groupId> <artifactId>protoc</artifactId> - <version>4.29.3</version> + <version>4.30.1</version> <packaging>pom</packaging> <name>Protobuf Compiler</name> <description> diff --git a/third_party/protobuf/java/util/BUILD.bazel b/third_party/protobuf/java/util/BUILD.bazel index c6ad3e5a37a74..d80e63fb8aab7 100644 --- a/third_party/protobuf/java/util/BUILD.bazel +++ b/third_party/protobuf/java/util/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_java//java:java_library.bzl", "java_library") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") load("//bazel:java_proto_library.bzl", "java_proto_library") @@ -13,11 +14,11 @@ java_library( visibility = ["//visibility:public"], deps = [ "//java/core", - "@protobuf_maven//:com_google_code_findbugs_jsr305", - "@protobuf_maven//:com_google_code_gson_gson", - "@protobuf_maven//:com_google_errorprone_error_prone_annotations", - "@protobuf_maven//:com_google_guava_guava", - "@protobuf_maven//:com_google_j2objc_j2objc_annotations", + "@maven//:com_google_code_findbugs_jsr305", + "@maven//:com_google_code_gson_gson", + "@maven//:com_google_errorprone_error_prone_annotations", + "@maven//:com_google_guava_guava", + "@maven//:com_google_j2objc_j2objc_annotations", ], ) @@ -92,6 +93,7 @@ junit_tests( "//java/core:generic_test_protos_java_proto", "@protobuf_maven//:com_google_code_gson_gson", "@protobuf_maven//:com_google_guava_guava", + "@protobuf_maven//:com_google_j2objc_j2objc_annotations", "@protobuf_maven//:com_google_truth_truth", "@protobuf_maven//:junit_junit", ], diff --git a/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java b/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java index 77f7e944ebad6..bbcac19b05fa9 100644 --- a/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java +++ b/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java @@ -19,8 +19,11 @@ import static com.google.protobuf.util.Timestamps.NANOS_PER_MICROSECOND; import static com.google.protobuf.util.Timestamps.NANOS_PER_MILLISECOND; import static com.google.protobuf.util.Timestamps.NANOS_PER_SECOND; +import com.google.common.annotations.GwtIncompatible; +import com.google.common.base.Strings; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.CompileTimeConstant; +import com.google.j2objc.annotations.J2ObjCIncompatible; import com.google.protobuf.Duration; import java.io.Serializable; import java.text.ParseException; @@ -140,6 +143,8 @@ public final class Durations { * @throws NullPointerException if {@code duration} is {@code null} */ @CanIgnoreReturnValue + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public static Duration checkNotNegative(Duration duration) { checkArgument(!isNegative(duration), "duration (%s) must not be negative", toString(duration)); return duration; @@ -152,6 +157,8 @@ public final class Durations { * @throws NullPointerException if {@code duration} is {@code null} */ @CanIgnoreReturnValue + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public static Duration checkPositive(Duration duration) { checkArgument(isPositive(duration), "duration (%s) must be positive", toString(duration)); return duration; @@ -164,7 +171,7 @@ public final class Durations { int nanos = duration.getNanos(); if (!isValid(seconds, nanos)) { throw new IllegalArgumentException( - String.format( + Strings.lenientFormat( "Duration is not valid. See proto definition for valid values. " + "Seconds (%s) must be in range [-315,576,000,000, +315,576,000,000]. " + "Nanos (%s) must be in range [-999,999,999, +999,999,999]. " @@ -193,6 +200,8 @@ public final class Durations { * @return The string representation of the given duration. * @throws IllegalArgumentException if the given duration is not in the valid range. */ + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public static String toString(Duration duration) { checkValid(duration); @@ -220,6 +229,8 @@ public final class Durations { * @return a Duration parsed from the string * @throws ParseException if the string is not in the duration format */ + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public static Duration parse(String value) throws ParseException { // Must end with "s". if (value.isEmpty() || value.charAt(value.length() - 1) != 's') { @@ -237,7 +248,12 @@ public final class Durations { nanoValue = secondValue.substring(pointPosition + 1); secondValue = secondValue.substring(0, pointPosition); } - long seconds = Long.parseLong(secondValue); + long seconds; + try { + seconds = Long.parseLong(secondValue); + } catch (NumberFormatException e) { + throw new ParseException("Invalid duration string: " + value, 0); + } int nanos = nanoValue.isEmpty() ? 0 : Timestamps.parseNanos(nanoValue); if (seconds < 0) { throw new ParseException("Invalid duration string: " + value, 0); @@ -264,6 +280,8 @@ public final class Durations { * @return a {@link Duration} parsed from the string * @throws IllegalArgumentException if parsing fails */ + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public static Duration parseUnchecked(@CompileTimeConstant String value) { try { return parse(value); diff --git a/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java b/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java index 7901a89a9e700..5adefd6098e1f 100644 --- a/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java +++ b/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java @@ -91,7 +91,8 @@ public class JsonFormat { /* preservingProtoFieldNames */ false, /* omittingInsignificantWhitespace */ false, /* printingEnumsAsInts */ false, - /* sortingMapKeys */ false); + /* sortingMapKeys */ false, + /* unsafeDisableCodepointsForHtmlSymbols */ false); } private enum ShouldPrintDefaults { @@ -114,6 +115,7 @@ public class JsonFormat { private final boolean omittingInsignificantWhitespace; private final boolean printingEnumsAsInts; private final boolean sortingMapKeys; + private final boolean unsafeDisableCodepointsForHtmlSymbols; private Printer( com.google.protobuf.TypeRegistry registry, @@ -123,7 +125,8 @@ public class JsonFormat { boolean preservingProtoFieldNames, boolean omittingInsignificantWhitespace, boolean printingEnumsAsInts, - boolean sortingMapKeys) { + boolean sortingMapKeys, + boolean unsafeDisableCodepointsForHtmlSymbols) { this.registry = registry; this.oldRegistry = oldRegistry; this.shouldPrintDefaults = shouldOutputDefaults; @@ -132,6 +135,7 @@ public class JsonFormat { this.omittingInsignificantWhitespace = omittingInsignificantWhitespace; this.printingEnumsAsInts = printingEnumsAsInts; this.sortingMapKeys = sortingMapKeys; + this.unsafeDisableCodepointsForHtmlSymbols = unsafeDisableCodepointsForHtmlSymbols; } /** @@ -153,7 +157,8 @@ public class JsonFormat { preservingProtoFieldNames, omittingInsignificantWhitespace, printingEnumsAsInts, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } /** @@ -175,7 +180,8 @@ public class JsonFormat { preservingProtoFieldNames, omittingInsignificantWhitespace, printingEnumsAsInts, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } /** @@ -204,15 +210,15 @@ public class JsonFormat { preservingProtoFieldNames, omittingInsignificantWhitespace, printingEnumsAsInts, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } /** * Creates a new {@link Printer} that will also print default-valued fields if their * FieldDescriptors are found in the supplied set. Empty repeated fields and map fields will be * printed as well, if they match. The new Printer clones all other configurations from the - * current {@link Printer}. Call includingDefaultValueFields() with no args to unconditionally - * output all fields. + * current {@link Printer}. * * <p>Note that non-repeated message fields or fields in a oneof are not honored if provided * here. @@ -233,7 +239,8 @@ public class JsonFormat { preservingProtoFieldNames, omittingInsignificantWhitespace, printingEnumsAsInts, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } /** @@ -254,7 +261,8 @@ public class JsonFormat { preservingProtoFieldNames, omittingInsignificantWhitespace, printingEnumsAsInts, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } /** @@ -271,7 +279,8 @@ public class JsonFormat { preservingProtoFieldNames, omittingInsignificantWhitespace, true, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } private void checkUnsetPrintingEnumsAsInts() { @@ -295,7 +304,8 @@ public class JsonFormat { true, omittingInsignificantWhitespace, printingEnumsAsInts, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } @@ -324,7 +334,8 @@ public class JsonFormat { preservingProtoFieldNames, true, printingEnumsAsInts, - sortingMapKeys); + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols); } /** @@ -347,7 +358,8 @@ public class JsonFormat { preservingProtoFieldNames, omittingInsignificantWhitespace, printingEnumsAsInts, - true); + true, + unsafeDisableCodepointsForHtmlSymbols); } /** @@ -369,7 +381,8 @@ public class JsonFormat { output, omittingInsignificantWhitespace, printingEnumsAsInts, - sortingMapKeys) + sortingMapKeys, + unsafeDisableCodepointsForHtmlSymbols) .print(message); } @@ -727,6 +740,8 @@ public class JsonFormat { private static class GsonHolder { private static final Gson DEFAULT_GSON = new GsonBuilder().create(); + private static final Gson GSON_WITHOUT_HTML_ESCAPING = + new GsonBuilder().disableHtmlEscaping().create(); } PrinterImpl( @@ -738,7 +753,8 @@ public class JsonFormat { Appendable jsonOutput, boolean omittingInsignificantWhitespace, boolean printingEnumsAsInts, - boolean sortingMapKeys) { + boolean sortingMapKeys, + boolean unsafeDisableCodepointsForHtmlSymbols) { this.registry = registry; this.oldRegistry = oldRegistry; this.shouldPrintDefaults = shouldPrintDefaults; @@ -746,7 +762,10 @@ public class JsonFormat { this.preservingProtoFieldNames = preservingProtoFieldNames; this.printingEnumsAsInts = printingEnumsAsInts; this.sortingMapKeys = sortingMapKeys; - this.gson = GsonHolder.DEFAULT_GSON; + this.gson = + unsafeDisableCodepointsForHtmlSymbols + ? GsonHolder.GSON_WITHOUT_HTML_ESCAPING + : GsonHolder.DEFAULT_GSON; // json format related properties, determined by printerType if (omittingInsignificantWhitespace) { this.generator = new CompactTextGenerator(jsonOutput); @@ -863,7 +882,7 @@ public class JsonFormat { /** Prints google.protobuf.Any */ private void printAny(MessageOrBuilder message) throws IOException { - if (Any.getDefaultInstance().equals(message)) { + if (message.getDefaultInstanceForType().equals(message)) { generator.print("{}"); return; } diff --git a/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Timestamps.java b/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Timestamps.java index 7a5558c8115f9..8d60a93e93a1e 100644 --- a/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Timestamps.java +++ b/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Timestamps.java @@ -13,6 +13,8 @@ import static com.google.common.math.LongMath.checkedAdd; import static com.google.common.math.LongMath.checkedMultiply; import static com.google.common.math.LongMath.checkedSubtract; +import com.google.common.annotations.GwtIncompatible; +import com.google.common.base.Strings; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.CompileTimeConstant; import com.google.j2objc.annotations.J2ObjCIncompatible; @@ -62,6 +64,8 @@ public final class Timestamps { */ public static final Timestamp EPOCH = Timestamp.newBuilder().setSeconds(0).setNanos(0).build(); + @GwtIncompatible("Date formatting is not supported in non JVM java.time") + @J2ObjCIncompatible private static final ThreadLocal<SimpleDateFormat> timestampFormat = new ThreadLocal<SimpleDateFormat>() { @Override @@ -70,6 +74,8 @@ public final class Timestamps { } }; + @GwtIncompatible("Date formatting is not supported in non JVM java.time") + @J2ObjCIncompatible private static SimpleDateFormat createTimestampFormat() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); @@ -163,7 +169,7 @@ public final class Timestamps { int nanos = timestamp.getNanos(); if (!isValid(seconds, nanos)) { throw new IllegalArgumentException( - String.format( + Strings.lenientFormat( "Timestamp is not valid. See proto definition for valid values. " + "Seconds (%s) must be in range [-62,135,596,800, +253,402,300,799]. " + "Nanos (%s) must be in range [0, +999,999,999].", @@ -193,6 +199,8 @@ public final class Timestamps { * @return The string representation of the given timestamp. * @throws IllegalArgumentException if the given timestamp is not in the valid range. */ + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public static String toString(Timestamp timestamp) { checkValid(timestamp); @@ -222,6 +230,8 @@ public final class Timestamps { * @return a Timestamp parsed from the string * @throws ParseException if parsing fails */ + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public static Timestamp parse(String value) throws ParseException { int dayOffset = value.indexOf('T'); if (dayOffset == -1) { @@ -287,6 +297,8 @@ public final class Timestamps { * @return a {@link Timestamp} parsed from the string * @throws IllegalArgumentException if parsing fails */ + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public static Timestamp parseUnchecked(@CompileTimeConstant String value) { try { return parse(value); @@ -299,12 +311,23 @@ public final class Timestamps { // the following 3 constants contain references to java.time.Instant methods (if that class is // available at runtime); otherwise, they are null. - @Nullable private static final Method INSTANT_NOW = instantMethod("now"); + @GwtIncompatible("Uses reflection to access methods of java.time.Instant") + @J2ObjCIncompatible + @Nullable + private static final Method INSTANT_NOW = instantMethod("now"); - @Nullable private static final Method INSTANT_GET_EPOCH_SECOND = instantMethod("getEpochSecond"); + @GwtIncompatible("Uses reflection to access methods of java.time.Instant") + @J2ObjCIncompatible + @Nullable + private static final Method INSTANT_GET_EPOCH_SECOND = instantMethod("getEpochSecond"); - @Nullable private static final Method INSTANT_GET_NANO = instantMethod("getNano"); + @GwtIncompatible("Uses reflection to access methods of java.time.Instant") + @J2ObjCIncompatible + @Nullable + private static final Method INSTANT_GET_NANO = instantMethod("getNano"); + @GwtIncompatible("Uses reflection to access methods of java.time.Instant") + @J2ObjCIncompatible @Nullable private static Method instantMethod(String methodName) { try { @@ -321,6 +344,9 @@ public final class Timestamps { * you're unable to mock the current time. Instead, you may want to consider injecting a clock * instance to read the current time. */ + @GwtIncompatible("Uses reflection to access methods of java.time.Instant") + @J2ObjCIncompatible + @SuppressWarnings("nullness") public static Timestamp now() { if (INSTANT_NOW != null) { try { @@ -469,7 +495,7 @@ public final class Timestamps { // when normalized. if (!isValidSeconds(seconds)) { throw new IllegalArgumentException( - String.format( + Strings.lenientFormat( "Timestamp is not valid. Input seconds is too large. " + "Seconds (%s) must be in range [-62,135,596,800, +253,402,300,799]. ", seconds)); @@ -488,6 +514,8 @@ public final class Timestamps { return checkValid(timestamp); } + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible private static long parseTimezoneOffset(String value) throws ParseException { int pos = value.indexOf(':'); if (pos == -1) { @@ -504,6 +532,8 @@ public final class Timestamps { } } + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible static int parseNanos(String value) throws ParseException { int result = 0; for (int i = 0; i < 9; ++i) { @@ -519,6 +549,8 @@ public final class Timestamps { } /** Format the nano part of a timestamp or a duration. */ + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible static String formatNanos(int nanos) { // Determine whether to use 3, 6, or 9 digits for the nano part. if (nanos % NANOS_PER_MILLISECOND == 0) { diff --git a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/DurationsTest.java b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/DurationsTest.java index 2b72a052091d8..213a4918fa7b1 100644 --- a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/DurationsTest.java +++ b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/DurationsTest.java @@ -12,7 +12,9 @@ import static com.google.common.truth.Truth.assertWithMessage; import static com.google.protobuf.util.Durations.toSecondsAsDouble; import static org.junit.Assert.fail; +import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.Lists; +import com.google.j2objc.annotations.J2ObjCIncompatible; import com.google.protobuf.Duration; import com.google.protobuf.Timestamp; import java.text.ParseException; @@ -47,6 +49,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testCheckNotNegative() { Durations.checkNotNegative(Durations.ZERO); Durations.checkNotNegative(Durations.fromNanos(1)); @@ -68,6 +72,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testCheckPositive() { Durations.checkPositive(Durations.fromNanos(1)); Durations.checkPositive(Durations.fromSeconds(1)); @@ -163,6 +169,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testParse_outOfRange() throws ParseException { try { Durations.parse("316576000000.123456789123456789s"); @@ -174,6 +182,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testDurationStringFormat() throws Exception { Timestamp start = Timestamps.parse("0001-01-01T00:00:00Z"); Timestamp end = Timestamps.parse("9999-12-31T23:59:59.999999999Z"); @@ -226,6 +236,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testDurationInvalidFormat() { // Value too small. try { @@ -346,6 +358,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testDurationConversion() throws Exception { Duration duration = Durations.parse("1.111111111s"); assertThat(Durations.toNanos(duration)).isEqualTo(1111111111); @@ -377,6 +391,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testTimeOperations() throws Exception { Timestamp start = Timestamps.parse("0001-01-01T00:00:00Z"); Timestamp end = Timestamps.parse("9999-12-31T23:59:59.999999999Z"); @@ -406,6 +422,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testToString() { assertThat(Durations.toString(duration(1, 1))).isEqualTo("1.000000001s"); assertThat(Durations.toString(duration(-1, -1))).isEqualTo("-1.000000001s"); @@ -504,6 +522,8 @@ public class DurationsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testOverflows() throws Exception { try { Durations.toNanos(duration(315576000000L, 999999999)); diff --git a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java index 64344c529c4b6..092d5986e470d 100644 --- a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java +++ b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java @@ -12,11 +12,11 @@ import static com.google.common.truth.Truth.assertThat; import com.google.protobuf.DynamicMessage; import com.google.protobuf.Message; import com.google.protobuf.UninitializedMessageException; -import protobuf_unittest.UnittestProto.NestedTestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage; -import protobuf_unittest.UnittestProto.TestRequired; -import protobuf_unittest.UnittestProto.TestRequiredMessage; +import proto2_unittest.UnittestProto.NestedTestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes.NestedMessage; +import proto2_unittest.UnittestProto.TestRequired; +import proto2_unittest.UnittestProto.TestRequiredMessage; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java index 3b39d993a2bee..6d414a5f95907 100644 --- a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java +++ b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java @@ -12,8 +12,8 @@ import static com.google.common.truth.Truth.assertWithMessage; import com.google.common.collect.ImmutableList; import com.google.protobuf.FieldMask; -import protobuf_unittest.UnittestProto.NestedTestAllTypes; -import protobuf_unittest.UnittestProto.TestAllTypes; +import proto2_unittest.UnittestProto.NestedTestAllTypes; +import proto2_unittest.UnittestProto.TestAllTypes; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; diff --git a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/TimestampsTest.java b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/TimestampsTest.java index aff882a79979b..ef59bc7c8da74 100644 --- a/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/TimestampsTest.java +++ b/third_party/protobuf/java/util/src/test/java/com/google/protobuf/util/TimestampsTest.java @@ -11,7 +11,9 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.protobuf.util.DurationsTest.duration; import static org.junit.Assert.fail; +import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.Lists; +import com.google.j2objc.annotations.J2ObjCIncompatible; import com.google.protobuf.Duration; import com.google.protobuf.Timestamp; import java.text.ParseException; @@ -51,6 +53,8 @@ public class TimestampsTest { Timestamp.newBuilder().setSeconds(Long.MIN_VALUE).setNanos(Integer.MIN_VALUE).build(); @Test + @GwtIncompatible("Uses reflection to access methods of java.time.Instant") + @J2ObjCIncompatible public void testNow() { Timestamp now = Timestamps.now(); long epochSeconds = System.currentTimeMillis() / 1000; @@ -59,6 +63,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Uses reflection to access methods of java.time.Instant") + @J2ObjCIncompatible public void testNowWithSubMillisecondPrecision() { try { // throws if we're not on Java9+ @@ -110,6 +116,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testTimestampStringFormat() throws Exception { Timestamp start = Timestamps.parse("0001-01-01T00:00:00Z"); Timestamp end = Timestamps.parse("9999-12-31T23:59:59.999999999Z"); @@ -138,27 +146,29 @@ public class TimestampsTest { assertThat(value.getNanos()).isEqualTo(999000000); // Test that 3, 6, or 9 digits are used for the fractional part. - value = Timestamp.newBuilder().setNanos(10).build(); - assertThat(Timestamps.toString(value)).isEqualTo("1970-01-01T00:00:00.000000010Z"); - value = Timestamp.newBuilder().setNanos(10000).build(); - assertThat(Timestamps.toString(value)).isEqualTo("1970-01-01T00:00:00.000010Z"); - value = Timestamp.newBuilder().setNanos(10000000).build(); - assertThat(Timestamps.toString(value)).isEqualTo("1970-01-01T00:00:00.010Z"); + assertThat(Timestamps.toString(Timestamp.newBuilder().setNanos(10).build())) + .isEqualTo("1970-01-01T00:00:00.000000010Z"); + assertThat(Timestamps.toString(Timestamp.newBuilder().setNanos(10000).build())) + .isEqualTo("1970-01-01T00:00:00.000010Z"); + assertThat(Timestamps.toString(Timestamp.newBuilder().setNanos(10000000).build())) + .isEqualTo("1970-01-01T00:00:00.010Z"); // Test that parsing accepts timezone offsets. - value = Timestamps.parse("1970-01-01T00:00:00.010+08:00"); - assertThat(Timestamps.toString(value)).isEqualTo("1969-12-31T16:00:00.010Z"); - value = Timestamps.parse("1970-01-01T00:00:00.010-08:00"); - assertThat(Timestamps.toString(value)).isEqualTo("1970-01-01T08:00:00.010Z"); - value = Timestamps.parseUnchecked("1970-01-01T00:00:00.010+08:00"); - assertThat(Timestamps.toString(value)).isEqualTo("1969-12-31T16:00:00.010Z"); - value = Timestamps.parseUnchecked("1970-01-01T00:00:00.010-08:00"); - assertThat(Timestamps.toString(value)).isEqualTo("1970-01-01T08:00:00.010Z"); + assertThat(Timestamps.toString(Timestamps.parse("1970-01-01T00:00:00.010+08:00"))) + .isEqualTo("1969-12-31T16:00:00.010Z"); + assertThat(Timestamps.toString(Timestamps.parse("1970-01-01T00:00:00.010-08:00"))) + .isEqualTo("1970-01-01T08:00:00.010Z"); + assertThat(Timestamps.toString(Timestamps.parseUnchecked("1970-01-01T00:00:00.010+08:00"))) + .isEqualTo("1969-12-31T16:00:00.010Z"); + assertThat(Timestamps.toString(Timestamps.parseUnchecked("1970-01-01T00:00:00.010-08:00"))) + .isEqualTo("1970-01-01T08:00:00.010Z"); } private volatile boolean stopParsingThreads = false; private volatile String errorMessage = ""; + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible private class ParseTimestampThread extends Thread { private final String[] strings; private final Timestamp[] values; @@ -192,6 +202,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampConcurrentParsing() throws Exception { String[] timestampStrings = new String[] { @@ -225,11 +237,13 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testTimestampInvalidFormatValueTooSmall() throws Exception { + // Value too small. + Timestamp value = + Timestamp.newBuilder().setSeconds(Timestamps.TIMESTAMP_SECONDS_MIN - 1).build(); try { - // Value too small. - Timestamp value = - Timestamp.newBuilder().setSeconds(Timestamps.TIMESTAMP_SECONDS_MIN - 1).build(); Timestamps.toString(value); fail("IllegalArgumentException is expected."); } catch (IllegalArgumentException expected) { @@ -237,11 +251,13 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testTimestampInvalidFormatValueTooLarge() throws Exception { + // Value too large. + Timestamp value = + Timestamp.newBuilder().setSeconds(Timestamps.TIMESTAMP_SECONDS_MAX + 1).build(); try { - // Value too large. - Timestamp value = - Timestamp.newBuilder().setSeconds(Timestamps.TIMESTAMP_SECONDS_MAX + 1).build(); Timestamps.toString(value); fail("IllegalArgumentException is expected."); } catch (IllegalArgumentException expected) { @@ -249,10 +265,12 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testTimestampInvalidFormatNanosTooSmall() throws Exception { + // Invalid nanos value. + Timestamp value = Timestamp.newBuilder().setNanos(-1).build(); try { - // Invalid nanos value. - Timestamp value = Timestamp.newBuilder().setNanos(-1).build(); Timestamps.toString(value); fail("IllegalArgumentException is expected."); } catch (IllegalArgumentException expected) { @@ -260,10 +278,12 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testTimestampInvalidFormatNanosTooLarge() throws Exception { + // Invalid nanos value. + Timestamp value = Timestamp.newBuilder().setNanos(1000000000).build(); try { - // Invalid nanos value. - Timestamp value = Timestamp.newBuilder().setNanos(1000000000).build(); Timestamps.toString(value); fail("IllegalArgumentException is expected."); } catch (IllegalArgumentException expected) { @@ -271,16 +291,19 @@ public class TimestampsTest { } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidFormatDateTooSmall() { + final String value = "0000-01-01T00:00:00Z"; try { - Timestamps.parse("0000-01-01T00:00:00Z"); + Timestamps.parse(value); fail(); } catch (ParseException expected) { assertThat(expected).hasMessageThat().isNotNull(); assertThat(expected).hasCauseThat().isNotNull(); } try { - Timestamps.parseUnchecked("0000-01-01T00:00:00Z"); + Timestamps.parseUnchecked(value); fail("IllegalArgumentException is expected."); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessageThat().isNotNull(); @@ -288,149 +311,112 @@ public class TimestampsTest { } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidFormatDateTooLarge() { - try { - Timestamps.parse("10000-01-01T00:00:00Z"); - fail(); - } catch (ParseException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } - try { - Timestamps.parseUnchecked("10000-01-01T00:00:00Z"); - fail("IllegalArgumentException is expected."); - } catch (IllegalArgumentException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } + assertParseFails("10000-01-01T00:00:00Z"); } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidFormatMissingT() { - try { - Timestamps.parse("1970-01-01 00:00:00Z"); - fail(); - } catch (ParseException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } - try { - Timestamps.parseUnchecked("1970-01-01 00:00:00Z"); - fail("IllegalArgumentException is expected."); - } catch (IllegalArgumentException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } + assertParseFails("1970-01-01 00:00:00Z"); } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidFormatMissingZ() { - try { - Timestamps.parse("1970-01-01T00:00:00"); - fail("ParseException is expected."); - } catch (ParseException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } - try { - Timestamps.parseUnchecked("1970-01-01T00:00:00"); - fail("IllegalArgumentException is expected."); - } catch (IllegalArgumentException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } + assertParseFails("1970-01-01T00:00:00"); } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidOffset() { - try { - Timestamps.parse("1970-01-01T00:00:00+0000"); - fail("ParseException is expected."); - } catch (ParseException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } - try { - Timestamps.parseUnchecked("1970-01-01T00:00:00+0000"); - fail("IllegalArgumentException is expected."); - } catch (IllegalArgumentException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } + assertParseFails("1970-01-01T00:00:00+0000"); } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidOffsetWithDot() { - try { - Timestamps.parse("2021-08-19T10:24:25-07.:00"); - fail("ParseException is expected."); - } catch (ParseException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } - try { - Timestamps.parseUnchecked("2021-08-19T10:24:25-07.:00"); - fail("IllegalArgumentException is expected."); - } catch (IllegalArgumentException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } + assertParseFails("2021-08-19T10:24:25-07.:00"); } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidTrailingText() { - try { - Timestamps.parse("1970-01-01T00:00:00Z0"); - fail("ParseException is expected."); - } catch (ParseException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } - try { - Timestamps.parseUnchecked("1970-01-01T00:00:00Z0"); - fail("IllegalArgumentException is expected."); - } catch (IllegalArgumentException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } + assertParseFails("1970-01-01T00:00:00Z0"); } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimestampInvalidNanoSecond() { + assertParseFails("1970-01-01T00:00:00.ABCZ"); + } + + @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible + public void testTimestampParseInvalidMonth() throws Exception { + final String value = "2000-40-01T00:00:00Z"; + final String expected = "2003-04-01T00:00:00Z"; + // TODO: b/379874415 - this shouldn't parse successfully + assertThat(Timestamps.parse(value)).isEqualTo(Timestamps.parse(expected)); + assertThat(Timestamps.parseUnchecked(value)).isEqualTo(Timestamps.parse(expected)); + } + + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible + private static void assertParseFails(String value) { try { - Timestamps.parse("1970-01-01T00:00:00.ABCZ"); + Timestamps.parse(value); fail("ParseException is expected."); } catch (ParseException expected) { assertThat(expected).hasMessageThat().isNotNull(); } - try { - Timestamps.parseUnchecked("1970-01-01T00:00:00.ABCZ"); - fail("IllegalArgumentException is expected."); - } catch (IllegalArgumentException expected) { - assertThat(expected).hasMessageThat().isNotNull(); - } } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testTimestampConversion() throws Exception { Timestamp timestamp = Timestamps.parse("1970-01-01T00:00:01.111111111Z"); assertThat(Timestamps.toNanos(timestamp)).isEqualTo(1111111111); assertThat(Timestamps.toMicros(timestamp)).isEqualTo(1111111); assertThat(Timestamps.toMillis(timestamp)).isEqualTo(1111); assertThat(Timestamps.toSeconds(timestamp)).isEqualTo(1); - timestamp = Timestamps.fromNanos(1111111111); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1970-01-01T00:00:01.111111111Z"); - timestamp = Timestamps.fromMicros(1111111); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1970-01-01T00:00:01.111111Z"); - timestamp = Timestamps.fromMillis(1111); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1970-01-01T00:00:01.111Z"); - timestamp = Timestamps.fromSeconds(1); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1970-01-01T00:00:01Z"); + + assertThat(Timestamps.toString(Timestamps.fromNanos(1111111111))) + .isEqualTo("1970-01-01T00:00:01.111111111Z"); + assertThat(Timestamps.toString(Timestamps.fromMicros(1111111))) + .isEqualTo("1970-01-01T00:00:01.111111Z"); + assertThat(Timestamps.toString(Timestamps.fromMillis(1111))) + .isEqualTo("1970-01-01T00:00:01.111Z"); + assertThat(Timestamps.toString(Timestamps.fromSeconds(1))).isEqualTo("1970-01-01T00:00:01Z"); timestamp = Timestamps.parse("1969-12-31T23:59:59.111111111Z"); assertThat(Timestamps.toNanos(timestamp)).isEqualTo(-888888889); assertThat(Timestamps.toMicros(timestamp)).isEqualTo(-888889); assertThat(Timestamps.toMillis(timestamp)).isEqualTo(-889); assertThat(Timestamps.toSeconds(timestamp)).isEqualTo(-1); - timestamp = Timestamps.fromNanos(-888888889); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1969-12-31T23:59:59.111111111Z"); - timestamp = Timestamps.fromMicros(-888889); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1969-12-31T23:59:59.111111Z"); - timestamp = Timestamps.fromMillis(-889); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1969-12-31T23:59:59.111Z"); - timestamp = Timestamps.fromSeconds(-1); - assertThat(Timestamps.toString(timestamp)).isEqualTo("1969-12-31T23:59:59Z"); + + assertThat(Timestamps.toString(Timestamps.fromNanos(-888888889))) + .isEqualTo("1969-12-31T23:59:59.111111111Z"); + assertThat(Timestamps.toString(Timestamps.fromMicros(-888889))) + .isEqualTo("1969-12-31T23:59:59.111111Z"); + assertThat(Timestamps.toString(Timestamps.fromMillis(-889))) + .isEqualTo("1969-12-31T23:59:59.111Z"); + assertThat(Timestamps.toString(Timestamps.fromSeconds(-1))).isEqualTo("1969-12-31T23:59:59Z"); } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testFromDate() { Date date = new Date(1111); Timestamp timestamp = Timestamps.fromDate(date); @@ -438,6 +424,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Calendar is not supported in non JVM java.time") + @J2ObjCIncompatible public void testFromDate_after9999CE() { // protobuf still requires Java 7 so no java.time :-( Calendar calendar = Calendar.getInstance(); @@ -454,6 +442,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Calendar is not supported in non JVM java.time") + @J2ObjCIncompatible public void testFromDate_beforeYear1() { // protobuf still requires Java 7 so no java.time :-( Calendar calendar = Calendar.getInstance(); @@ -470,6 +460,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Calendar is not supported in non JVM java.time") + @J2ObjCIncompatible public void testFromDate_after2262CE() { // protobuf still requires Java 7 so no java.time :-( Calendar calendar = Calendar.getInstance(); @@ -484,6 +476,8 @@ public class TimestampsTest { /* Timestamp only stores integral seconds in the Date parent class and stores the nanosecond * adjustment in the Timestamp class. */ @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testFromSqlTimestampSubMillisecondPrecision() { java.sql.Timestamp sqlTimestamp = new java.sql.Timestamp(1111); sqlTimestamp.setNanos(sqlTimestamp.getNanos() + 234567); @@ -492,6 +486,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testFromSqlTimestamp() { Date date = new java.sql.Timestamp(1111); Timestamp timestamp = Timestamps.fromDate(date); @@ -499,6 +495,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testFromSqlTimestamp_beforeEpoch() { Date date = new java.sql.Timestamp(-1111); Timestamp timestamp = Timestamps.fromDate(date); @@ -506,6 +504,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testFromSqlTimestamp_beforeEpochWholeSecond() { Date date = new java.sql.Timestamp(-2000); Timestamp timestamp = Timestamps.fromDate(date); @@ -513,6 +513,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testTimeOperations() throws Exception { Timestamp start = Timestamps.parse("0001-01-01T00:00:00Z"); Timestamp end = Timestamps.parse("9999-12-31T23:59:59.999999999Z"); @@ -603,9 +605,12 @@ public class TimestampsTest { } @Test + @GwtIncompatible("ParseException is not supported in Xplat") + @J2ObjCIncompatible public void testOverflowsArithmeticException() throws Exception { + Timestamp timestamp = Timestamps.parse("9999-12-31T23:59:59.999999999Z"); try { - Timestamps.toNanos(Timestamps.parse("9999-12-31T23:59:59.999999999Z")); + Timestamps.toNanos(timestamp); fail("Expected an ArithmeticException to be thrown"); } catch (ArithmeticException expected) { } @@ -702,6 +707,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testMaxNanosecondsConversion() { assertThat(Timestamps.toString(Timestamps.fromNanos(Long.MAX_VALUE))) .isEqualTo("2262-04-11T23:47:16.854775807Z"); @@ -726,6 +733,8 @@ public class TimestampsTest { } @Test + @GwtIncompatible("Depends on String.format which is not supported in Xplat.") + @J2ObjCIncompatible public void testMinNanosecondsConversion() { assertThat(Timestamps.toString(Timestamps.fromNanos(Long.MIN_VALUE))) .isEqualTo("1677-09-21T00:12:43.145224192Z"); diff --git a/third_party/protobuf/lua/BUILD.bazel b/third_party/protobuf/lua/BUILD.bazel index b464e234c4261..04383a533de61 100644 --- a/third_party/protobuf/lua/BUILD.bazel +++ b/third_party/protobuf/lua/BUILD.bazel @@ -5,6 +5,7 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("//bazel:proto_library.bzl", "proto_library") load( "//lua:lua_proto_library.bzl", "lua_proto_library", @@ -48,7 +49,7 @@ cc_binary( "//src/google/protobuf", "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) diff --git a/third_party/protobuf/lua/def.c b/third_party/protobuf/lua/def.c index 1f9ee1217b6c3..194800ec9a2bc 100644 --- a/third_party/protobuf/lua/def.c +++ b/third_party/protobuf/lua/def.c @@ -597,7 +597,7 @@ const upb_FileDef* lupb_FileDef_check(lua_State* L, int narg) { static int lupb_FileDef_Dependency(lua_State* L) { const upb_FileDef* f = lupb_FileDef_check(L, 1); - int index = luaL_checkint(L, 2); + int index = lupb_checkint32(L, 2); const upb_FileDef* dep = upb_FileDef_Dependency(f, index); lupb_wrapper_pushwrapper(L, 1, dep, LUPB_FILEDEF); return 1; @@ -611,7 +611,7 @@ static int lupb_FileDef_DependencyCount(lua_State* L) { static int lupb_FileDef_enum(lua_State* L) { const upb_FileDef* f = lupb_FileDef_check(L, 1); - int index = luaL_checkint(L, 2); + int index = lupb_checkint32(L, 2); const upb_EnumDef* e = upb_FileDef_TopLevelEnum(f, index); lupb_wrapper_pushwrapper(L, 1, e, LUPB_ENUMDEF); return 1; @@ -625,7 +625,7 @@ static int lupb_FileDef_enumcount(lua_State* L) { static int lupb_FileDef_msg(lua_State* L) { const upb_FileDef* f = lupb_FileDef_check(L, 1); - int index = luaL_checkint(L, 2); + int index = lupb_checkint32(L, 2); const upb_MessageDef* m = upb_FileDef_TopLevelMessage(f, index); lupb_wrapper_pushwrapper(L, 1, m, LUPB_MSGDEF); return 1; diff --git a/third_party/protobuf/lua/upb.c b/third_party/protobuf/lua/upb.c index e1e40613d4549..6a0eec45df99f 100644 --- a/third_party/protobuf/lua/upb.c +++ b/third_party/protobuf/lua/upb.c @@ -41,11 +41,13 @@ /* Lua compatibility code *****************************************************/ /* Shims for upcoming Lua 5.3 functionality. */ +#if LUA_VERSION_NUM < 503 static bool lua_isinteger(lua_State* L, int argn) { LUPB_UNUSED(L); LUPB_UNUSED(argn); return false; } +#endif /* Utility functions **********************************************************/ diff --git a/third_party/protobuf/lua/upbc.cc b/third_party/protobuf/lua/upbc.cc index bce4b7d28485f..5193614d505fa 100644 --- a/third_party/protobuf/lua/upbc.cc +++ b/third_party/protobuf/lua/upbc.cc @@ -50,6 +50,11 @@ static void PrintHexDigit(char digit, protobuf::io::Printer* printer) { printer->WriteRaw(&text, 1); } +static bool IsPrint(int ch) { + // isprint(ch) with negative values is UB. + return ch < 0 ? false : isprint(ch); +} + static void PrintString(int max_cols, absl::string_view* str, protobuf::io::Printer* printer) { printer->Print("\'"); @@ -61,7 +66,7 @@ static void PrintString(int max_cols, absl::string_view* str, } else if (ch == '\'') { printer->PrintRaw("\\'"); max_cols--; - } else if (isprint(ch)) { + } else if (IsPrint(ch)) { printer->WriteRaw(&ch, 1); max_cols--; } else { diff --git a/third_party/protobuf/maven_dev_install.json b/third_party/protobuf/maven_dev_install.json new file mode 100644 index 0000000000000..44a9b0be9e8c9 --- /dev/null +++ b/third_party/protobuf/maven_dev_install.json @@ -0,0 +1,1364 @@ +{ + "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", + "__INPUT_ARTIFACTS_HASH": 30376387, + "__RESOLVED_ARTIFACTS_HASH": 52907685, + "conflict_resolution": { + "com.google.errorprone:error_prone_annotations:2.5.1": "com.google.errorprone:error_prone_annotations:2.18.0" + }, + "artifacts": { + "biz.aQute.bnd:biz.aQute.bnd.util": { + "shasums": { + "jar": "65b5bd4a0fab16812f1800c98ff74a038f37a38bfe899af382efed4efdc1e3e1" + }, + "version": "6.4.0" + }, + "biz.aQute.bnd:biz.aQute.bndlib": { + "shasums": { + "jar": "357145074872f9dbf67e629fcd237e6152707e575d735df4535282f9f588d2d8" + }, + "version": "6.4.0" + }, + "com.google.auto.value:auto-value-annotations": { + "shasums": { + "jar": "37ec09b47d7ed35a99d13927db5c86fc9071f620f943ead5d757144698310852" + }, + "version": "1.8.1" + }, + "com.google.caliper:caliper": { + "shasums": { + "jar": "d54e1bfdbe9359a79e175c217b8d472555cf20da9c5c0a18bdb1ea7db979ed8e" + }, + "version": "1.0-beta-3" + }, + "com.google.caliper:caliper-api": { + "shasums": { + "jar": "374f0c6c0c1f8784cb69d885e1dcbb7498c34ca20369e0597264568530642928" + }, + "version": "1.0-beta-3" + }, + "com.google.caliper:caliper-core": { + "shasums": { + "jar": "514deac8f8b09dd4262733e0a4406a333208c899dc7ea726b03600b9bb94f192" + }, + "version": "1.0-beta-3" + }, + "com.google.caliper:caliper-runner": { + "shasums": { + "jar": "3ab58890aa01343361adedf859500d280f67813df0cedfcd165b169533b9b1fa" + }, + "version": "1.0-beta-3" + }, + "com.google.caliper:caliper-util": { + "shasums": { + "jar": "6e9af500c7020450dfdb5003d09501d512d395f431c54c7ee8f79e712463fe66" + }, + "version": "1.0-beta-3" + }, + "com.google.caliper:caliper-worker": { + "shasums": { + "jar": "315d8e51df1f60551645a0e3bf2c504d2c79762f688e6f728eb9d1d9cd9a491b" + }, + "version": "1.0-beta-3" + }, + "com.google.caliper:caliper-worker-jvm": { + "shasums": { + "jar": "e14e1ecfdf939c82abdb902105be41ff3f83c18cb968116232015f2662d065a4" + }, + "version": "1.0-beta-3" + }, + "com.google.code.findbugs:jsr305": { + "shasums": { + "jar": "766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7" + }, + "version": "3.0.2" + }, + "com.google.code.gson:gson": { + "shasums": { + "jar": "d3999291855de495c94c743761b8ab5176cfeabe281a5ab0d8e8d45326fd703e" + }, + "version": "2.8.9" + }, + "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter": { + "shasums": { + "jar": "1ef5535a8bd41cf3072469f381b9ee6ab28275311a7499f53d6e52adf976fef0" + }, + "version": "3.3.0" + }, + "com.google.dagger:dagger": { + "shasums": { + "jar": "329d4340f24c4f5717af016c097e90668bfea2a5376e6aa9964b01cef3fd241a" + }, + "version": "2.22.1" + }, + "com.google.dagger:dagger-producers": { + "shasums": { + "jar": "f834a0082014213a68ff06a0f048d750178d02196c58b0b15beb367d32b97e35" + }, + "version": "2.22.1" + }, + "com.google.errorprone:error_prone_annotations": { + "shasums": { + "jar": "9e6814cb71816988a4fd1b07a993a8f21bb7058d522c162b1de849e19bea54ae" + }, + "version": "2.18.0" + }, + "com.google.guava:failureaccess": { + "shasums": { + "jar": "a171ee4c734dd2da837e4b16be9df4661afab72a41adaf31eb84dfdaf936ca26" + }, + "version": "1.0.1" + }, + "com.google.guava:guava": { + "shasums": { + "jar": "bd7fa227591fb8509677d0d1122cf95158f3b8a9f45653f58281d879f6dc48c5" + }, + "version": "32.0.1-jre" + }, + "com.google.guava:guava-testlib": { + "shasums": { + "jar": "c97511849a5e085280f106df2b059566febd280b118d33d6a9e068d238100b63" + }, + "version": "32.0.1-jre" + }, + "com.google.guava:listenablefuture": { + "shasums": { + "jar": "b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99" + }, + "version": "9999.0-empty-to-avoid-conflict-with-guava" + }, + "com.google.j2objc:j2objc-annotations": { + "shasums": { + "jar": "f02a95fa1a5e95edb3ed859fd0fb7df709d121a35290eff8b74dce2ab7f4d6ed" + }, + "version": "2.8" + }, + "com.google.testparameterinjector:test-parameter-injector": { + "shasums": { + "jar": "e5a7c649c54c412049908247ca5e25fe6921d746849c6017a84dc6044237a4b4" + }, + "version": "1.18" + }, + "com.google.truth:truth": { + "shasums": { + "jar": "a85e03b8b6ae8780f060cfded9500a3d1b5f52808f99a2ea6da9c683313c7518" + }, + "version": "1.1.2" + }, + "com.squareup.okhttp:okhttp": { + "shasums": { + "jar": "88ac9fd1bb51f82bcc664cc1eb9c225c90dc4389d660231b4cc737bebfe7d0aa" + }, + "version": "2.7.5" + }, + "com.squareup.okio:okio": { + "shasums": { + "jar": "114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266" + }, + "version": "1.6.0" + }, + "com.sun.jersey:jersey-client": { + "shasums": { + "jar": "639c825c5db580f8115bf49ffc893093526d2ed1079fbc929b6a5fbd0b2eda40" + }, + "version": "1.19.4" + }, + "com.sun.jersey:jersey-core": { + "shasums": { + "jar": "64b03198e0264849d0fc341857ebcc9c882b1909a2dc35a0972fe7d901b826e5" + }, + "version": "1.19.4" + }, + "info.picocli:picocli": { + "shasums": { + "jar": "b0a5159e926de8084ff066025142270443533656bc599b8bb31d14d11fd138a4" + }, + "version": "4.6.3" + }, + "javax.annotation:javax.annotation-api": { + "shasums": { + "jar": "e04ba5195bcd555dc95650f7cc614d151e4bcd52d29a10b8aa2197f3ab89ab9b" + }, + "version": "1.3.2" + }, + "javax.inject:javax.inject": { + "shasums": { + "jar": "91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff" + }, + "version": "1" + }, + "javax.ws.rs:jsr311-api": { + "shasums": { + "jar": "ab1534b73b5fa055808e6598a5e73b599ccda28c3159c3c0908977809422ee4a" + }, + "version": "1.1.1" + }, + "joda-time:joda-time": { + "shasums": { + "jar": "dd8e7c92185a678d1b7b933f31209b6203c8ffa91e9880475a1be0346b9617e3" + }, + "version": "2.10.10" + }, + "junit:junit": { + "shasums": { + "jar": "8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3" + }, + "version": "4.13.2" + }, + "net.bytebuddy:byte-buddy": { + "shasums": { + "jar": "d2e46555699e70361b5471a7e142f9c67855bba6907a285177ebd8ad973775d8" + }, + "version": "1.12.7" + }, + "net.bytebuddy:byte-buddy-agent": { + "shasums": { + "jar": "73d84bb6e8e8980e674d796a29063f510ceb527c6f8c912a08a13e236be05c71" + }, + "version": "1.12.7" + }, + "org.checkerframework:checker-compat-qual": { + "shasums": { + "jar": "d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d" + }, + "version": "2.5.3" + }, + "org.checkerframework:checker-qual": { + "shasums": { + "jar": "e316255bbfcd9fe50d165314b85abb2b33cb2a66a93c491db648e498a82c2de1" + }, + "version": "3.33.0" + }, + "org.hamcrest:hamcrest-core": { + "shasums": { + "jar": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9" + }, + "version": "1.3" + }, + "org.mockito:mockito-core": { + "shasums": { + "jar": "148de2c6928365db29443ca12d35c930d9f481172b934fdd801d1cb1409ea83a" + }, + "version": "4.3.1" + }, + "org.objenesis:objenesis": { + "shasums": { + "jar": "03d960bd5aef03c653eb000413ada15eb77cdd2b8e4448886edf5692805e35f3" + }, + "version": "3.2" + }, + "org.osgi:org.osgi.dto": { + "shasums": { + "jar": "cb75f3c7e48e5a31a31df22e26873346f5bf659e2dcab2369e031e4850d2ff43" + }, + "version": "1.0.0" + }, + "org.osgi:org.osgi.framework": { + "shasums": { + "jar": "ec194b7871af27681716ff05259319a5c3c9b9727e8000e9e832499b93484b4e" + }, + "version": "1.8.0" + }, + "org.osgi:org.osgi.resource": { + "shasums": { + "jar": "81fc50f1f1d38a4af28e131907d4afe213249aab05060484edca0e60c4af9b4a" + }, + "version": "1.0.0" + }, + "org.osgi:org.osgi.service.log": { + "shasums": { + "jar": "ff6710c4856d32684cf3ebdc45248f41036ff734f2b03bbc08c4609a61fecfa0" + }, + "version": "1.3.0" + }, + "org.osgi:org.osgi.service.repository": { + "shasums": { + "jar": "c5553e95b459529192433486d4c4cc22ff45a2eae4968484f9f717319264a532" + }, + "version": "1.1.0" + }, + "org.osgi:org.osgi.util.function": { + "shasums": { + "jar": "208819c7c71690c15a6bb8b187474e7f9d0147946b680182a62b9f222ae014ec" + }, + "version": "1.2.0" + }, + "org.osgi:org.osgi.util.promise": { + "shasums": { + "jar": "fef86e64f584d012a16a0306160764f6179663b90988a226c4641b920f3a4b36" + }, + "version": "1.2.0" + }, + "org.osgi:org.osgi.util.tracker": { + "shasums": { + "jar": "7d78c2cc9bcb6421c24f17aa097866ce8d9115c219a4f8d6cc753bc4dfb97efa" + }, + "version": "1.5.4" + }, + "org.osgi:osgi.annotation": { + "shasums": { + "jar": "a0e8a4c362bd3600812f37b0ea45fba966c7bc049d01fed56a09ecc74082759e" + }, + "version": "8.0.1" + }, + "org.ow2.asm:asm": { + "shasums": { + "jar": "0df97574914aee92fd349d0cb4e00f3345d45b2c239e0bb50f0a90ead47888e0" + }, + "version": "9.0" + }, + "org.ow2.asm:asm-analysis": { + "shasums": { + "jar": "be922aae60ff1ff1768e8e6544a38a7f92bd0a6d6b0b9791f94955d1bd453de2" + }, + "version": "7.2" + }, + "org.ow2.asm:asm-commons": { + "shasums": { + "jar": "0e86b8b179c5fb223d1a880a0ff4960b6978223984b94e62e71135f2d8ea3558" + }, + "version": "7.2" + }, + "org.ow2.asm:asm-tree": { + "shasums": { + "jar": "c063f5a67fa03cdc9bd79fd1c2ea6816cc4a19473ecdfbd9e9153b408c6f2656" + }, + "version": "7.2" + }, + "org.ow2.asm:asm-util": { + "shasums": { + "jar": "6e24913b021ffacfe8e7e053d6e0ccc731941148cfa078d4f1ed3d96904530f8" + }, + "version": "7.2" + }, + "org.slf4j:slf4j-api": { + "shasums": { + "jar": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79" + }, + "version": "1.7.25" + }, + "org.yaml:snakeyaml": { + "shasums": { + "jar": "880c9d896e4b74a06c549c15ca496450165d6909fa15d7e662bee8f6a66d7afa" + }, + "version": "2.0" + } + }, + "dependencies": { + "biz.aQute.bnd:biz.aQute.bndlib": [ + "biz.aQute.bnd:biz.aQute.bnd.util", + "org.osgi:org.osgi.dto", + "org.osgi:org.osgi.framework", + "org.osgi:org.osgi.resource", + "org.osgi:org.osgi.service.log", + "org.osgi:org.osgi.service.repository", + "org.osgi:org.osgi.util.function", + "org.osgi:org.osgi.util.promise", + "org.osgi:org.osgi.util.tracker", + "org.slf4j:slf4j-api" + ], + "com.google.caliper:caliper": [ + "com.google.caliper:caliper-core", + "com.google.caliper:caliper-runner", + "com.google.caliper:caliper-worker-jvm", + "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter", + "com.google.dagger:dagger", + "com.google.guava:guava", + "com.sun.jersey:jersey-client" + ], + "com.google.caliper:caliper-api": [ + "com.google.guava:guava", + "joda-time:joda-time" + ], + "com.google.caliper:caliper-core": [ + "com.google.auto.value:auto-value-annotations", + "com.google.caliper:caliper-api", + "com.google.caliper:caliper-util", + "com.google.dagger:dagger", + "com.google.guava:guava", + "com.squareup.okhttp:okhttp", + "joda-time:joda-time" + ], + "com.google.caliper:caliper-runner": [ + "com.google.caliper:caliper-api", + "com.google.caliper:caliper-core", + "com.google.caliper:caliper-util", + "com.google.dagger:dagger", + "com.google.dagger:dagger-producers", + "com.google.guava:guava", + "com.squareup.okhttp:okhttp", + "joda-time:joda-time" + ], + "com.google.caliper:caliper-util": [ + "com.google.code.gson:gson", + "com.google.dagger:dagger", + "com.google.guava:guava", + "joda-time:joda-time" + ], + "com.google.caliper:caliper-worker": [ + "com.google.caliper:caliper-api", + "com.google.caliper:caliper-core", + "com.google.caliper:caliper-util", + "com.google.dagger:dagger", + "com.google.guava:guava", + "com.squareup.okhttp:okhttp", + "joda-time:joda-time" + ], + "com.google.caliper:caliper-worker-jvm": [ + "com.google.caliper:caliper-core", + "com.google.caliper:caliper-worker", + "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter", + "com.google.dagger:dagger", + "com.google.guava:guava", + "com.sun.jersey:jersey-client" + ], + "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter": [ + "com.google.guava:guava", + "javax.annotation:javax.annotation-api", + "org.ow2.asm:asm", + "org.ow2.asm:asm-analysis", + "org.ow2.asm:asm-commons", + "org.ow2.asm:asm-tree", + "org.ow2.asm:asm-util" + ], + "com.google.dagger:dagger": [ + "javax.inject:javax.inject" + ], + "com.google.dagger:dagger-producers": [ + "com.google.dagger:dagger", + "com.google.guava:guava", + "javax.inject:javax.inject", + "org.checkerframework:checker-compat-qual" + ], + "com.google.guava:guava": [ + "com.google.code.findbugs:jsr305", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:failureaccess", + "com.google.guava:listenablefuture", + "com.google.j2objc:j2objc-annotations", + "org.checkerframework:checker-qual" + ], + "com.google.guava:guava-testlib": [ + "com.google.code.findbugs:jsr305", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:guava", + "com.google.j2objc:j2objc-annotations", + "junit:junit", + "org.checkerframework:checker-qual" + ], + "com.google.testparameterinjector:test-parameter-injector": [ + "com.google.auto.value:auto-value-annotations", + "com.google.code.findbugs:jsr305", + "com.google.guava:guava", + "junit:junit", + "org.yaml:snakeyaml" + ], + "com.google.truth:truth": [ + "com.google.auto.value:auto-value-annotations", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:guava", + "junit:junit", + "org.checkerframework:checker-qual", + "org.ow2.asm:asm" + ], + "com.squareup.okhttp:okhttp": [ + "com.squareup.okio:okio" + ], + "com.sun.jersey:jersey-client": [ + "com.sun.jersey:jersey-core" + ], + "com.sun.jersey:jersey-core": [ + "javax.ws.rs:jsr311-api" + ], + "junit:junit": [ + "org.hamcrest:hamcrest-core" + ], + "org.mockito:mockito-core": [ + "net.bytebuddy:byte-buddy", + "net.bytebuddy:byte-buddy-agent", + "org.objenesis:objenesis" + ], + "org.osgi:org.osgi.util.function": [ + "org.osgi:osgi.annotation" + ], + "org.osgi:org.osgi.util.promise": [ + "org.osgi:org.osgi.util.function", + "org.osgi:osgi.annotation" + ], + "org.osgi:org.osgi.util.tracker": [ + "org.osgi:osgi.annotation" + ], + "org.ow2.asm:asm-analysis": [ + "org.ow2.asm:asm-tree" + ], + "org.ow2.asm:asm-commons": [ + "org.ow2.asm:asm", + "org.ow2.asm:asm-analysis", + "org.ow2.asm:asm-tree" + ], + "org.ow2.asm:asm-tree": [ + "org.ow2.asm:asm" + ], + "org.ow2.asm:asm-util": [ + "org.ow2.asm:asm", + "org.ow2.asm:asm-analysis", + "org.ow2.asm:asm-tree" + ] + }, + "packages": { + "biz.aQute.bnd:biz.aQute.bnd.util": [ + "aQute.bnd.classfile", + "aQute.bnd.classfile.builder", + "aQute.bnd.classfile.preview", + "aQute.bnd.exceptions", + "aQute.bnd.memoize", + "aQute.bnd.result", + "aQute.bnd.signatures", + "aQute.bnd.stream", + "aQute.bnd.unmodifiable", + "aQute.lib.io", + "aQute.lib.stringrover", + "aQute.libg.glob" + ], + "biz.aQute.bnd:biz.aQute.bndlib": [ + "aQute.bnd.annotation", + "aQute.bnd.annotation.baseline", + "aQute.bnd.annotation.component", + "aQute.bnd.annotation.headers", + "aQute.bnd.annotation.jpms", + "aQute.bnd.annotation.licenses", + "aQute.bnd.annotation.metatype", + "aQute.bnd.annotation.plugin", + "aQute.bnd.annotation.service", + "aQute.bnd.annotation.spi", + "aQute.bnd.annotation.xml", + "aQute.bnd.apiguardian.api", + "aQute.bnd.aspectj.plugin", + "aQute.bnd.build", + "aQute.bnd.build.api", + "aQute.bnd.build.model", + "aQute.bnd.build.model.clauses", + "aQute.bnd.build.model.conversions", + "aQute.bnd.buildtool", + "aQute.bnd.bundle.annotations", + "aQute.bnd.cdi", + "aQute.bnd.classindex", + "aQute.bnd.compatibility", + "aQute.bnd.component", + "aQute.bnd.component.annotations", + "aQute.bnd.component.error", + "aQute.bnd.connection.settings", + "aQute.bnd.differ", + "aQute.bnd.exporter.executable", + "aQute.bnd.exporter.runbundles", + "aQute.bnd.filerepo", + "aQute.bnd.header", + "aQute.bnd.help", + "aQute.bnd.help.instructions", + "aQute.bnd.http", + "aQute.bnd.junit", + "aQute.bnd.make", + "aQute.bnd.make.calltree", + "aQute.bnd.make.component", + "aQute.bnd.make.coverage", + "aQute.bnd.make.metatype", + "aQute.bnd.maven", + "aQute.bnd.maven.support", + "aQute.bnd.metatype", + "aQute.bnd.metatype.annotations", + "aQute.bnd.obr", + "aQute.bnd.osgi", + "aQute.bnd.osgi.eclipse", + "aQute.bnd.osgi.repository", + "aQute.bnd.osgi.resource", + "aQute.bnd.plugin.ant", + "aQute.bnd.plugin.eclipse", + "aQute.bnd.plugin.git", + "aQute.bnd.plugin.gradle", + "aQute.bnd.plugin.jpms", + "aQute.bnd.plugin.maven", + "aQute.bnd.plugin.spi", + "aQute.bnd.print", + "aQute.bnd.properties", + "aQute.bnd.remoteworkspace.client", + "aQute.bnd.remoteworkspace.server", + "aQute.bnd.resource.repository", + "aQute.bnd.service", + "aQute.bnd.service.action", + "aQute.bnd.service.classparser", + "aQute.bnd.service.clipboard", + "aQute.bnd.service.diff", + "aQute.bnd.service.export", + "aQute.bnd.service.extension", + "aQute.bnd.service.externalplugin", + "aQute.bnd.service.generate", + "aQute.bnd.service.library", + "aQute.bnd.service.lifecycle", + "aQute.bnd.service.maven", + "aQute.bnd.service.message", + "aQute.bnd.service.progress", + "aQute.bnd.service.release", + "aQute.bnd.service.remotelaunch", + "aQute.bnd.service.remoteworkspace", + "aQute.bnd.service.reporter", + "aQute.bnd.service.repository", + "aQute.bnd.service.resolve.hook", + "aQute.bnd.service.specifications", + "aQute.bnd.service.url", + "aQute.bnd.service.verifier", + "aQute.bnd.signing", + "aQute.bnd.url", + "aQute.bnd.util.dto", + "aQute.bnd.util.home", + "aQute.bnd.util.repository", + "aQute.bnd.version", + "aQute.bnd.version.maven", + "aQute.bnd.xmlattribute", + "aQute.lib.aspects", + "aQute.lib.base64", + "aQute.lib.collections", + "aQute.lib.concurrent.serial", + "aQute.lib.concurrentinit", + "aQute.lib.converter", + "aQute.lib.date", + "aQute.lib.deployer", + "aQute.lib.fileset", + "aQute.lib.filter", + "aQute.lib.formatter", + "aQute.lib.hex", + "aQute.lib.hierarchy", + "aQute.lib.io", + "aQute.lib.json", + "aQute.lib.link", + "aQute.lib.manifest", + "aQute.lib.mavenpasswordobfuscator", + "aQute.lib.persistentmap", + "aQute.lib.redirect", + "aQute.lib.settings", + "aQute.lib.specinterface", + "aQute.lib.spring", + "aQute.lib.stringrover", + "aQute.lib.strings", + "aQute.lib.tag", + "aQute.lib.utf8properties", + "aQute.lib.watcher", + "aQute.lib.xml", + "aQute.lib.xpath", + "aQute.lib.zip", + "aQute.libg.command", + "aQute.libg.cryptography", + "aQute.libg.filelock", + "aQute.libg.generics", + "aQute.libg.glob", + "aQute.libg.gzip", + "aQute.libg.ints", + "aQute.libg.map", + "aQute.libg.qtokens", + "aQute.libg.reporter", + "aQute.libg.reporter.slf4j", + "aQute.libg.sed", + "aQute.libg.tuple", + "aQute.libg.uri", + "aQute.service.reporter" + ], + "com.google.auto.value:auto-value-annotations": [ + "com.google.auto.value", + "com.google.auto.value.extension.memoized", + "com.google.auto.value.extension.serializable", + "com.google.auto.value.extension.toprettystring" + ], + "com.google.caliper:caliper": [ + "com.google.caliper.runner", + "com.google.caliper.runner.instrument", + "com.google.caliper.runner.resultprocessor" + ], + "com.google.caliper:caliper-api": [ + "com.google.caliper", + "com.google.caliper.api", + "com.google.caliper.model" + ], + "com.google.caliper:caliper-core": [ + "com.google.caliper.bridge", + "com.google.caliper.core", + "com.google.caliper.memory" + ], + "com.google.caliper:caliper-runner": [ + "com.google.caliper.runner", + "com.google.caliper.runner.config", + "com.google.caliper.runner.experiment", + "com.google.caliper.runner.instrument", + "com.google.caliper.runner.options", + "com.google.caliper.runner.resultprocessor", + "com.google.caliper.runner.server", + "com.google.caliper.runner.target", + "com.google.caliper.runner.worker", + "com.google.caliper.runner.worker.dryrun", + "com.google.caliper.runner.worker.targetinfo", + "com.google.caliper.runner.worker.trial" + ], + "com.google.caliper:caliper-util": [ + "com.google.caliper.json", + "com.google.caliper.util" + ], + "com.google.caliper:caliper-worker": [ + "com.google.caliper.worker", + "com.google.caliper.worker.connection", + "com.google.caliper.worker.handler", + "com.google.caliper.worker.instrument" + ], + "com.google.caliper:caliper-worker-jvm": [ + "com.google.caliper.worker" + ], + "com.google.code.findbugs:jsr305": [ + "javax.annotation", + "javax.annotation.concurrent", + "javax.annotation.meta" + ], + "com.google.code.gson:gson": [ + "com.google.gson", + "com.google.gson.annotations", + "com.google.gson.internal", + "com.google.gson.internal.bind", + "com.google.gson.internal.bind.util", + "com.google.gson.internal.reflect", + "com.google.gson.internal.sql", + "com.google.gson.reflect", + "com.google.gson.stream" + ], + "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter": [ + "com.google.monitoring.runtime.instrumentation", + "com.google.monitoring.runtime.instrumentation.asm", + "com.google.monitoring.runtime.instrumentation.asm.commons", + "com.google.monitoring.runtime.instrumentation.asm.signature", + "com.google.monitoring.runtime.instrumentation.asm.tree", + "com.google.monitoring.runtime.instrumentation.asm.tree.analysis", + "com.google.monitoring.runtime.instrumentation.asm.util", + "com.google.monitoring.runtime.instrumentation.checker.nullness.compatqual", + "com.google.monitoring.runtime.instrumentation.common.annotations", + "com.google.monitoring.runtime.instrumentation.common.base", + "com.google.monitoring.runtime.instrumentation.common.base.internal", + "com.google.monitoring.runtime.instrumentation.common.cache", + "com.google.monitoring.runtime.instrumentation.common.collect", + "com.google.monitoring.runtime.instrumentation.common.escape", + "com.google.monitoring.runtime.instrumentation.common.eventbus", + "com.google.monitoring.runtime.instrumentation.common.graph", + "com.google.monitoring.runtime.instrumentation.common.hash", + "com.google.monitoring.runtime.instrumentation.common.html", + "com.google.monitoring.runtime.instrumentation.common.io", + "com.google.monitoring.runtime.instrumentation.common.math", + "com.google.monitoring.runtime.instrumentation.common.net", + "com.google.monitoring.runtime.instrumentation.common.primitives", + "com.google.monitoring.runtime.instrumentation.common.reflect", + "com.google.monitoring.runtime.instrumentation.common.util.concurrent", + "com.google.monitoring.runtime.instrumentation.common.xml", + "com.google.monitoring.runtime.instrumentation.errorprone.annotations", + "com.google.monitoring.runtime.instrumentation.errorprone.annotations.concurrent", + "com.google.monitoring.runtime.instrumentation.j2objc.annotations", + "com.google.thirdparty.publicsuffix" + ], + "com.google.dagger:dagger": [ + "dagger", + "dagger.internal", + "dagger.multibindings" + ], + "com.google.dagger:dagger-producers": [ + "dagger.producers", + "dagger.producers.internal", + "dagger.producers.monitoring", + "dagger.producers.monitoring.internal" + ], + "com.google.errorprone:error_prone_annotations": [ + "com.google.errorprone.annotations", + "com.google.errorprone.annotations.concurrent" + ], + "com.google.guava:failureaccess": [ + "com.google.common.util.concurrent.internal" + ], + "com.google.guava:guava": [ + "com.google.common.annotations", + "com.google.common.base", + "com.google.common.base.internal", + "com.google.common.cache", + "com.google.common.collect", + "com.google.common.escape", + "com.google.common.eventbus", + "com.google.common.graph", + "com.google.common.hash", + "com.google.common.html", + "com.google.common.io", + "com.google.common.math", + "com.google.common.net", + "com.google.common.primitives", + "com.google.common.reflect", + "com.google.common.util.concurrent", + "com.google.common.xml", + "com.google.thirdparty.publicsuffix" + ], + "com.google.guava:guava-testlib": [ + "com.google.common.collect.testing", + "com.google.common.collect.testing.features", + "com.google.common.collect.testing.google", + "com.google.common.collect.testing.suites", + "com.google.common.collect.testing.testers", + "com.google.common.escape.testing", + "com.google.common.testing", + "com.google.common.util.concurrent.testing" + ], + "com.google.j2objc:j2objc-annotations": [ + "com.google.j2objc.annotations" + ], + "com.google.testparameterinjector:test-parameter-injector": [ + "com.google.testing.junit.testparameterinjector" + ], + "com.google.truth:truth": [ + "com.google.common.truth" + ], + "com.squareup.okhttp:okhttp": [ + "com.squareup.okhttp", + "com.squareup.okhttp.internal", + "com.squareup.okhttp.internal.framed", + "com.squareup.okhttp.internal.http", + "com.squareup.okhttp.internal.io", + "com.squareup.okhttp.internal.tls" + ], + "com.squareup.okio:okio": [ + "okio" + ], + "com.sun.jersey:jersey-client": [ + "com.sun.jersey.api.client", + "com.sun.jersey.api.client.async", + "com.sun.jersey.api.client.config", + "com.sun.jersey.api.client.filter", + "com.sun.jersey.client.impl", + "com.sun.jersey.client.impl.async", + "com.sun.jersey.client.proxy", + "com.sun.jersey.client.urlconnection", + "com.sun.ws.rs.ext" + ], + "com.sun.jersey:jersey-core": [ + "com.sun.jersey.api.provider.jaxb", + "com.sun.jersey.api.representation", + "com.sun.jersey.api.uri", + "com.sun.jersey.core.header", + "com.sun.jersey.core.header.reader", + "com.sun.jersey.core.impl.provider.entity", + "com.sun.jersey.core.impl.provider.header", + "com.sun.jersey.core.impl.provider.xml", + "com.sun.jersey.core.osgi", + "com.sun.jersey.core.provider", + "com.sun.jersey.core.provider.jaxb", + "com.sun.jersey.core.reflection", + "com.sun.jersey.core.spi.component", + "com.sun.jersey.core.spi.component.ioc", + "com.sun.jersey.core.spi.factory", + "com.sun.jersey.core.spi.scanning", + "com.sun.jersey.core.spi.scanning.uri", + "com.sun.jersey.core.util", + "com.sun.jersey.impl", + "com.sun.jersey.localization", + "com.sun.jersey.spi", + "com.sun.jersey.spi.inject", + "com.sun.jersey.spi.service" + ], + "info.picocli:picocli": [ + "picocli" + ], + "javax.annotation:javax.annotation-api": [ + "javax.annotation", + "javax.annotation.security", + "javax.annotation.sql" + ], + "javax.inject:javax.inject": [ + "javax.inject" + ], + "javax.ws.rs:jsr311-api": [ + "javax.ws.rs", + "javax.ws.rs.core", + "javax.ws.rs.ext" + ], + "joda-time:joda-time": [ + "org.joda.time", + "org.joda.time.base", + "org.joda.time.chrono", + "org.joda.time.convert", + "org.joda.time.field", + "org.joda.time.format", + "org.joda.time.tz" + ], + "junit:junit": [ + "junit.extensions", + "junit.framework", + "junit.runner", + "junit.textui", + "org.junit", + "org.junit.experimental", + "org.junit.experimental.categories", + "org.junit.experimental.max", + "org.junit.experimental.results", + "org.junit.experimental.runners", + "org.junit.experimental.theories", + "org.junit.experimental.theories.internal", + "org.junit.experimental.theories.suppliers", + "org.junit.function", + "org.junit.internal", + "org.junit.internal.builders", + "org.junit.internal.management", + "org.junit.internal.matchers", + "org.junit.internal.requests", + "org.junit.internal.runners", + "org.junit.internal.runners.model", + "org.junit.internal.runners.rules", + "org.junit.internal.runners.statements", + "org.junit.matchers", + "org.junit.rules", + "org.junit.runner", + "org.junit.runner.manipulation", + "org.junit.runner.notification", + "org.junit.runners", + "org.junit.runners.model", + "org.junit.runners.parameterized", + "org.junit.validator" + ], + "net.bytebuddy:byte-buddy": [ + "net.bytebuddy", + "net.bytebuddy.agent.builder", + "net.bytebuddy.asm", + "net.bytebuddy.build", + "net.bytebuddy.description", + "net.bytebuddy.description.annotation", + "net.bytebuddy.description.enumeration", + "net.bytebuddy.description.field", + "net.bytebuddy.description.method", + "net.bytebuddy.description.modifier", + "net.bytebuddy.description.type", + "net.bytebuddy.dynamic", + "net.bytebuddy.dynamic.loading", + "net.bytebuddy.dynamic.scaffold", + "net.bytebuddy.dynamic.scaffold.inline", + "net.bytebuddy.dynamic.scaffold.subclass", + "net.bytebuddy.implementation", + "net.bytebuddy.implementation.attribute", + "net.bytebuddy.implementation.auxiliary", + "net.bytebuddy.implementation.bind", + "net.bytebuddy.implementation.bind.annotation", + "net.bytebuddy.implementation.bytecode", + "net.bytebuddy.implementation.bytecode.assign", + "net.bytebuddy.implementation.bytecode.assign.primitive", + "net.bytebuddy.implementation.bytecode.assign.reference", + "net.bytebuddy.implementation.bytecode.collection", + "net.bytebuddy.implementation.bytecode.constant", + "net.bytebuddy.implementation.bytecode.member", + "net.bytebuddy.jar.asm", + "net.bytebuddy.jar.asm.commons", + "net.bytebuddy.jar.asm.signature", + "net.bytebuddy.matcher", + "net.bytebuddy.pool", + "net.bytebuddy.utility", + "net.bytebuddy.utility.dispatcher", + "net.bytebuddy.utility.nullability", + "net.bytebuddy.utility.privilege", + "net.bytebuddy.utility.visitor" + ], + "net.bytebuddy:byte-buddy-agent": [ + "net.bytebuddy.agent", + "net.bytebuddy.agent.utility.nullability" + ], + "org.checkerframework:checker-compat-qual": [ + "org.checkerframework.checker.nullness.compatqual" + ], + "org.checkerframework:checker-qual": [ + "org.checkerframework.checker.builder.qual", + "org.checkerframework.checker.calledmethods.qual", + "org.checkerframework.checker.compilermsgs.qual", + "org.checkerframework.checker.fenum.qual", + "org.checkerframework.checker.formatter.qual", + "org.checkerframework.checker.guieffect.qual", + "org.checkerframework.checker.i18n.qual", + "org.checkerframework.checker.i18nformatter.qual", + "org.checkerframework.checker.index.qual", + "org.checkerframework.checker.initialization.qual", + "org.checkerframework.checker.interning.qual", + "org.checkerframework.checker.lock.qual", + "org.checkerframework.checker.mustcall.qual", + "org.checkerframework.checker.nullness.qual", + "org.checkerframework.checker.optional.qual", + "org.checkerframework.checker.propkey.qual", + "org.checkerframework.checker.regex.qual", + "org.checkerframework.checker.signature.qual", + "org.checkerframework.checker.signedness.qual", + "org.checkerframework.checker.tainting.qual", + "org.checkerframework.checker.units.qual", + "org.checkerframework.common.aliasing.qual", + "org.checkerframework.common.initializedfields.qual", + "org.checkerframework.common.reflection.qual", + "org.checkerframework.common.returnsreceiver.qual", + "org.checkerframework.common.subtyping.qual", + "org.checkerframework.common.util.report.qual", + "org.checkerframework.common.value.qual", + "org.checkerframework.dataflow.qual", + "org.checkerframework.framework.qual" + ], + "org.hamcrest:hamcrest-core": [ + "org.hamcrest", + "org.hamcrest.core", + "org.hamcrest.internal" + ], + "org.mockito:mockito-core": [ + "org.mockito", + "org.mockito.codegen", + "org.mockito.configuration", + "org.mockito.creation.instance", + "org.mockito.exceptions.base", + "org.mockito.exceptions.misusing", + "org.mockito.exceptions.stacktrace", + "org.mockito.exceptions.verification", + "org.mockito.exceptions.verification.junit", + "org.mockito.exceptions.verification.opentest4j", + "org.mockito.hamcrest", + "org.mockito.internal", + "org.mockito.internal.configuration", + "org.mockito.internal.configuration.injection", + "org.mockito.internal.configuration.injection.filter", + "org.mockito.internal.configuration.injection.scanner", + "org.mockito.internal.configuration.plugins", + "org.mockito.internal.creation", + "org.mockito.internal.creation.bytebuddy", + "org.mockito.internal.creation.instance", + "org.mockito.internal.creation.proxy", + "org.mockito.internal.creation.settings", + "org.mockito.internal.creation.util", + "org.mockito.internal.debugging", + "org.mockito.internal.exceptions", + "org.mockito.internal.exceptions.stacktrace", + "org.mockito.internal.exceptions.util", + "org.mockito.internal.framework", + "org.mockito.internal.hamcrest", + "org.mockito.internal.handler", + "org.mockito.internal.invocation", + "org.mockito.internal.invocation.finder", + "org.mockito.internal.invocation.mockref", + "org.mockito.internal.junit", + "org.mockito.internal.listeners", + "org.mockito.internal.matchers", + "org.mockito.internal.matchers.apachecommons", + "org.mockito.internal.matchers.text", + "org.mockito.internal.progress", + "org.mockito.internal.reporting", + "org.mockito.internal.runners", + "org.mockito.internal.runners.util", + "org.mockito.internal.session", + "org.mockito.internal.stubbing", + "org.mockito.internal.stubbing.answers", + "org.mockito.internal.stubbing.defaultanswers", + "org.mockito.internal.util", + "org.mockito.internal.util.collections", + "org.mockito.internal.util.concurrent", + "org.mockito.internal.util.io", + "org.mockito.internal.util.reflection", + "org.mockito.internal.verification", + "org.mockito.internal.verification.api", + "org.mockito.internal.verification.argumentmatching", + "org.mockito.internal.verification.checkers", + "org.mockito.invocation", + "org.mockito.junit", + "org.mockito.listeners", + "org.mockito.mock", + "org.mockito.plugins", + "org.mockito.quality", + "org.mockito.session", + "org.mockito.stubbing", + "org.mockito.verification" + ], + "org.objenesis:objenesis": [ + "org.objenesis", + "org.objenesis.instantiator", + "org.objenesis.instantiator.android", + "org.objenesis.instantiator.annotations", + "org.objenesis.instantiator.basic", + "org.objenesis.instantiator.gcj", + "org.objenesis.instantiator.perc", + "org.objenesis.instantiator.sun", + "org.objenesis.instantiator.util", + "org.objenesis.strategy" + ], + "org.osgi:org.osgi.dto": [ + "org.osgi.dto" + ], + "org.osgi:org.osgi.framework": [ + "org.osgi.framework", + "org.osgi.framework.dto", + "org.osgi.framework.hooks.bundle", + "org.osgi.framework.hooks.resolver", + "org.osgi.framework.hooks.service", + "org.osgi.framework.hooks.weaving", + "org.osgi.framework.launch", + "org.osgi.framework.namespace", + "org.osgi.framework.startlevel", + "org.osgi.framework.startlevel.dto", + "org.osgi.framework.wiring", + "org.osgi.framework.wiring.dto" + ], + "org.osgi:org.osgi.resource": [ + "org.osgi.resource", + "org.osgi.resource.dto" + ], + "org.osgi:org.osgi.service.log": [ + "org.osgi.service.log" + ], + "org.osgi:org.osgi.service.repository": [ + "org.osgi.service.repository" + ], + "org.osgi:org.osgi.util.function": [ + "org.osgi.util.function" + ], + "org.osgi:org.osgi.util.promise": [ + "org.osgi.util.promise" + ], + "org.osgi:org.osgi.util.tracker": [ + "org.osgi.util.tracker" + ], + "org.osgi:osgi.annotation": [ + "org.osgi.annotation.bundle", + "org.osgi.annotation.versioning" + ], + "org.ow2.asm:asm": [ + "org.objectweb.asm", + "org.objectweb.asm.signature" + ], + "org.ow2.asm:asm-analysis": [ + "org.objectweb.asm.tree.analysis" + ], + "org.ow2.asm:asm-commons": [ + "org.objectweb.asm.commons" + ], + "org.ow2.asm:asm-tree": [ + "org.objectweb.asm.tree" + ], + "org.ow2.asm:asm-util": [ + "org.objectweb.asm.util" + ], + "org.slf4j:slf4j-api": [ + "org.slf4j", + "org.slf4j.event", + "org.slf4j.helpers", + "org.slf4j.spi" + ], + "org.yaml:snakeyaml": [ + "org.yaml.snakeyaml", + "org.yaml.snakeyaml.comments", + "org.yaml.snakeyaml.composer", + "org.yaml.snakeyaml.constructor", + "org.yaml.snakeyaml.emitter", + "org.yaml.snakeyaml.env", + "org.yaml.snakeyaml.error", + "org.yaml.snakeyaml.events", + "org.yaml.snakeyaml.extensions.compactnotation", + "org.yaml.snakeyaml.external.biz.base64Coder", + "org.yaml.snakeyaml.external.com.google.gdata.util.common.base", + "org.yaml.snakeyaml.inspector", + "org.yaml.snakeyaml.internal", + "org.yaml.snakeyaml.introspector", + "org.yaml.snakeyaml.nodes", + "org.yaml.snakeyaml.parser", + "org.yaml.snakeyaml.reader", + "org.yaml.snakeyaml.representer", + "org.yaml.snakeyaml.resolver", + "org.yaml.snakeyaml.scanner", + "org.yaml.snakeyaml.serializer", + "org.yaml.snakeyaml.tokens", + "org.yaml.snakeyaml.util" + ] + }, + "repositories": { + "https://repo1.maven.org/maven2/": [ + "biz.aQute.bnd:biz.aQute.bnd.util", + "biz.aQute.bnd:biz.aQute.bndlib", + "com.google.auto.value:auto-value-annotations", + "com.google.caliper:caliper", + "com.google.caliper:caliper-api", + "com.google.caliper:caliper-core", + "com.google.caliper:caliper-runner", + "com.google.caliper:caliper-util", + "com.google.caliper:caliper-worker", + "com.google.caliper:caliper-worker-jvm", + "com.google.code.findbugs:jsr305", + "com.google.code.gson:gson", + "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter", + "com.google.dagger:dagger", + "com.google.dagger:dagger-producers", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:failureaccess", + "com.google.guava:guava", + "com.google.guava:guava-testlib", + "com.google.guava:listenablefuture", + "com.google.j2objc:j2objc-annotations", + "com.google.testparameterinjector:test-parameter-injector", + "com.google.truth:truth", + "com.squareup.okhttp:okhttp", + "com.squareup.okio:okio", + "com.sun.jersey:jersey-client", + "com.sun.jersey:jersey-core", + "info.picocli:picocli", + "javax.annotation:javax.annotation-api", + "javax.inject:javax.inject", + "javax.ws.rs:jsr311-api", + "joda-time:joda-time", + "junit:junit", + "net.bytebuddy:byte-buddy", + "net.bytebuddy:byte-buddy-agent", + "org.checkerframework:checker-compat-qual", + "org.checkerframework:checker-qual", + "org.hamcrest:hamcrest-core", + "org.mockito:mockito-core", + "org.objenesis:objenesis", + "org.osgi:org.osgi.dto", + "org.osgi:org.osgi.framework", + "org.osgi:org.osgi.resource", + "org.osgi:org.osgi.service.log", + "org.osgi:org.osgi.service.repository", + "org.osgi:org.osgi.util.function", + "org.osgi:org.osgi.util.promise", + "org.osgi:org.osgi.util.tracker", + "org.osgi:osgi.annotation", + "org.ow2.asm:asm", + "org.ow2.asm:asm-analysis", + "org.ow2.asm:asm-commons", + "org.ow2.asm:asm-tree", + "org.ow2.asm:asm-util", + "org.slf4j:slf4j-api", + "org.yaml:snakeyaml" + ], + "https://repo.maven.apache.org/maven2/": [ + "biz.aQute.bnd:biz.aQute.bnd.util", + "biz.aQute.bnd:biz.aQute.bndlib", + "com.google.auto.value:auto-value-annotations", + "com.google.caliper:caliper", + "com.google.caliper:caliper-api", + "com.google.caliper:caliper-core", + "com.google.caliper:caliper-runner", + "com.google.caliper:caliper-util", + "com.google.caliper:caliper-worker", + "com.google.caliper:caliper-worker-jvm", + "com.google.code.findbugs:jsr305", + "com.google.code.gson:gson", + "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter", + "com.google.dagger:dagger", + "com.google.dagger:dagger-producers", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:failureaccess", + "com.google.guava:guava", + "com.google.guava:guava-testlib", + "com.google.guava:listenablefuture", + "com.google.j2objc:j2objc-annotations", + "com.google.testparameterinjector:test-parameter-injector", + "com.google.truth:truth", + "com.squareup.okhttp:okhttp", + "com.squareup.okio:okio", + "com.sun.jersey:jersey-client", + "com.sun.jersey:jersey-core", + "info.picocli:picocli", + "javax.annotation:javax.annotation-api", + "javax.inject:javax.inject", + "javax.ws.rs:jsr311-api", + "joda-time:joda-time", + "junit:junit", + "net.bytebuddy:byte-buddy", + "net.bytebuddy:byte-buddy-agent", + "org.checkerframework:checker-compat-qual", + "org.checkerframework:checker-qual", + "org.hamcrest:hamcrest-core", + "org.mockito:mockito-core", + "org.objenesis:objenesis", + "org.osgi:org.osgi.dto", + "org.osgi:org.osgi.framework", + "org.osgi:org.osgi.resource", + "org.osgi:org.osgi.service.log", + "org.osgi:org.osgi.service.repository", + "org.osgi:org.osgi.util.function", + "org.osgi:org.osgi.util.promise", + "org.osgi:org.osgi.util.tracker", + "org.osgi:osgi.annotation", + "org.ow2.asm:asm", + "org.ow2.asm:asm-analysis", + "org.ow2.asm:asm-commons", + "org.ow2.asm:asm-tree", + "org.ow2.asm:asm-util", + "org.slf4j:slf4j-api", + "org.yaml:snakeyaml" + ] + }, + "services": { + "com.sun.jersey:jersey-core": { + "com.sun.jersey.spi.HeaderDelegateProvider": [ + "com.sun.jersey.core.impl.provider.header.CacheControlProvider", + "com.sun.jersey.core.impl.provider.header.CookieProvider", + "com.sun.jersey.core.impl.provider.header.DateProvider", + "com.sun.jersey.core.impl.provider.header.EntityTagProvider", + "com.sun.jersey.core.impl.provider.header.LocaleProvider", + "com.sun.jersey.core.impl.provider.header.MediaTypeProvider", + "com.sun.jersey.core.impl.provider.header.NewCookieProvider", + "com.sun.jersey.core.impl.provider.header.StringProvider", + "com.sun.jersey.core.impl.provider.header.URIProvider" + ], + "com.sun.jersey.spi.inject.InjectableProvider": [ + "com.sun.jersey.core.impl.provider.xml.DocumentBuilderFactoryProvider", + "com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider", + "com.sun.jersey.core.impl.provider.xml.TransformerFactoryProvider", + "com.sun.jersey.core.impl.provider.xml.XMLStreamReaderContextProvider" + ], + "javax.ws.rs.ext.MessageBodyReader": [ + "com.sun.jersey.core.impl.provider.entity.ByteArrayProvider", + "com.sun.jersey.core.impl.provider.entity.DataSourceProvider", + "com.sun.jersey.core.impl.provider.entity.DocumentProvider", + "com.sun.jersey.core.impl.provider.entity.EntityHolderReader", + "com.sun.jersey.core.impl.provider.entity.FileProvider", + "com.sun.jersey.core.impl.provider.entity.FormMultivaluedMapProvider", + "com.sun.jersey.core.impl.provider.entity.FormProvider", + "com.sun.jersey.core.impl.provider.entity.InputStreamProvider", + "com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider", + "com.sun.jersey.core.impl.provider.entity.ReaderProvider", + "com.sun.jersey.core.impl.provider.entity.RenderedImageProvider", + "com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader", + "com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader", + "com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader", + "com.sun.jersey.core.impl.provider.entity.StringProvider", + "com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App", + "com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General", + "com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text", + "com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App", + "com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General", + "com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$Text", + "com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App", + "com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General", + "com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text", + "com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$App", + "com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General", + "com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$Text" + ], + "javax.ws.rs.ext.MessageBodyWriter": [ + "com.sun.jersey.core.impl.provider.entity.ByteArrayProvider", + "com.sun.jersey.core.impl.provider.entity.DataSourceProvider", + "com.sun.jersey.core.impl.provider.entity.DocumentProvider", + "com.sun.jersey.core.impl.provider.entity.FileProvider", + "com.sun.jersey.core.impl.provider.entity.FormMultivaluedMapProvider", + "com.sun.jersey.core.impl.provider.entity.FormProvider", + "com.sun.jersey.core.impl.provider.entity.InputStreamProvider", + "com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider", + "com.sun.jersey.core.impl.provider.entity.ReaderProvider", + "com.sun.jersey.core.impl.provider.entity.RenderedImageProvider", + "com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter", + "com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider", + "com.sun.jersey.core.impl.provider.entity.StringProvider", + "com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App", + "com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General", + "com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text", + "com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App", + "com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General", + "com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$Text", + "com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App", + "com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General", + "com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text" + ] + } + }, + "version": "2" +} diff --git a/third_party/protobuf/maven_install.json b/third_party/protobuf/maven_install.json index 28efd80e2651a..b617e7d329d8b 100644 --- a/third_party/protobuf/maven_install.json +++ b/third_party/protobuf/maven_install.json @@ -1,967 +1,172 @@ { - "dependency_tree": { - "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": -1740498846, - "__RESOLVED_ARTIFACTS_HASH": -60988338, - "conflict_resolution": { - "com.google.errorprone:error_prone_annotations:2.5.1": "com.google.errorprone:error_prone_annotations:2.18.0" - }, - "dependencies": [ - { - "coord": "biz.aQute.bnd:biz.aQute.bnd.util:6.4.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd.util/6.4.0/biz.aQute.bnd.util-6.4.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd.util/6.4.0/biz.aQute.bnd.util-6.4.0.jar", - "https://repo.maven.apache.org/maven2/biz/aQute/bnd/biz.aQute.bnd.util/6.4.0/biz.aQute.bnd.util-6.4.0.jar" - ], - "sha256": "65b5bd4a0fab16812f1800c98ff74a038f37a38bfe899af382efed4efdc1e3e1", - "url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd.util/6.4.0/biz.aQute.bnd.util-6.4.0.jar" - }, - { - "coord": "biz.aQute.bnd:biz.aQute.bndlib:6.4.0", - "dependencies": [ - "biz.aQute.bnd:biz.aQute.bnd.util:6.4.0", - "org.osgi:org.osgi.dto:1.0.0", - "org.osgi:org.osgi.framework:1.8.0", - "org.osgi:org.osgi.resource:1.0.0", - "org.osgi:org.osgi.service.log:1.3.0", - "org.osgi:org.osgi.service.repository:1.1.0", - "org.osgi:org.osgi.util.function:1.2.0", - "org.osgi:org.osgi.util.promise:1.2.0", - "org.osgi:org.osgi.util.tracker:1.5.4", - "org.osgi:osgi.annotation:8.0.1", - "org.slf4j:slf4j-api:1.7.25" - ], - "directDependencies": [ - "biz.aQute.bnd:biz.aQute.bnd.util:6.4.0", - "org.osgi:org.osgi.dto:1.0.0", - "org.osgi:org.osgi.framework:1.8.0", - "org.osgi:org.osgi.resource:1.0.0", - "org.osgi:org.osgi.service.log:1.3.0", - "org.osgi:org.osgi.service.repository:1.1.0", - "org.osgi:org.osgi.util.function:1.2.0", - "org.osgi:org.osgi.util.promise:1.2.0", - "org.osgi:org.osgi.util.tracker:1.5.4", - "org.slf4j:slf4j-api:1.7.25" - ], - "file": "v1/https/repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bndlib/6.4.0/biz.aQute.bndlib-6.4.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bndlib/6.4.0/biz.aQute.bndlib-6.4.0.jar", - "https://repo.maven.apache.org/maven2/biz/aQute/bnd/biz.aQute.bndlib/6.4.0/biz.aQute.bndlib-6.4.0.jar" - ], - "sha256": "357145074872f9dbf67e629fcd237e6152707e575d735df4535282f9f588d2d8", - "url": "https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bndlib/6.4.0/biz.aQute.bndlib-6.4.0.jar" - }, - { - "coord": "com.google.auto.value:auto-value-annotations:1.8.1", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.8.1/auto-value-annotations-1.8.1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.8.1/auto-value-annotations-1.8.1.jar", - "https://repo.maven.apache.org/maven2/com/google/auto/value/auto-value-annotations/1.8.1/auto-value-annotations-1.8.1.jar" - ], - "sha256": "37ec09b47d7ed35a99d13927db5c86fc9071f620f943ead5d757144698310852", - "url": "https://repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.8.1/auto-value-annotations-1.8.1.jar" - }, - { - "coord": "com.google.caliper:caliper-api:1.0-beta-3", - "dependencies": [ - "com.google.guava:guava:32.0.1-jre", - "joda-time:joda-time:2.10.10" - ], - "directDependencies": [ - "com.google.guava:guava:32.0.1-jre", - "joda-time:joda-time:2.10.10" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/caliper/caliper-api/1.0-beta-3/caliper-api-1.0-beta-3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/caliper/caliper-api/1.0-beta-3/caliper-api-1.0-beta-3.jar", - "https://repo.maven.apache.org/maven2/com/google/caliper/caliper-api/1.0-beta-3/caliper-api-1.0-beta-3.jar" - ], - "sha256": "374f0c6c0c1f8784cb69d885e1dcbb7498c34ca20369e0597264568530642928", - "url": "https://repo1.maven.org/maven2/com/google/caliper/caliper-api/1.0-beta-3/caliper-api-1.0-beta-3.jar" - }, - { - "coord": "com.google.caliper:caliper-core:1.0-beta-3", - "dependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.code.gson:gson:2.8.9", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "com.squareup.okio:okio:1.6.0", - "javax.inject:javax.inject:1", - "joda-time:joda-time:2.10.10" - ], - "directDependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "joda-time:joda-time:2.10.10" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/caliper/caliper-core/1.0-beta-3/caliper-core-1.0-beta-3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/caliper/caliper-core/1.0-beta-3/caliper-core-1.0-beta-3.jar", - "https://repo.maven.apache.org/maven2/com/google/caliper/caliper-core/1.0-beta-3/caliper-core-1.0-beta-3.jar" - ], - "sha256": "514deac8f8b09dd4262733e0a4406a333208c899dc7ea726b03600b9bb94f192", - "url": "https://repo1.maven.org/maven2/com/google/caliper/caliper-core/1.0-beta-3/caliper-core-1.0-beta-3.jar" - }, - { - "coord": "com.google.caliper:caliper-runner:1.0-beta-3", - "dependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.code.gson:gson:2.8.9", - "com.google.dagger:dagger-producers:2.22.1", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "com.squareup.okio:okio:1.6.0", - "javax.inject:javax.inject:1", - "joda-time:joda-time:2.10.10", - "org.checkerframework:checker-compat-qual:2.5.3" - ], - "directDependencies": [ - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.dagger:dagger-producers:2.22.1", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "joda-time:joda-time:2.10.10" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/caliper/caliper-runner/1.0-beta-3/caliper-runner-1.0-beta-3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/caliper/caliper-runner/1.0-beta-3/caliper-runner-1.0-beta-3.jar", - "https://repo.maven.apache.org/maven2/com/google/caliper/caliper-runner/1.0-beta-3/caliper-runner-1.0-beta-3.jar" - ], - "sha256": "3ab58890aa01343361adedf859500d280f67813df0cedfcd165b169533b9b1fa", - "url": "https://repo1.maven.org/maven2/com/google/caliper/caliper-runner/1.0-beta-3/caliper-runner-1.0-beta-3.jar" - }, - { - "coord": "com.google.caliper:caliper-util:1.0-beta-3", - "dependencies": [ - "com.google.code.gson:gson:2.8.9", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "javax.inject:javax.inject:1", - "joda-time:joda-time:2.10.10" - ], - "directDependencies": [ - "com.google.code.gson:gson:2.8.9", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "joda-time:joda-time:2.10.10" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/caliper/caliper-util/1.0-beta-3/caliper-util-1.0-beta-3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/caliper/caliper-util/1.0-beta-3/caliper-util-1.0-beta-3.jar", - "https://repo.maven.apache.org/maven2/com/google/caliper/caliper-util/1.0-beta-3/caliper-util-1.0-beta-3.jar" - ], - "sha256": "6e9af500c7020450dfdb5003d09501d512d395f431c54c7ee8f79e712463fe66", - "url": "https://repo1.maven.org/maven2/com/google/caliper/caliper-util/1.0-beta-3/caliper-util-1.0-beta-3.jar" - }, - { - "coord": "com.google.caliper:caliper-worker-jvm:1.0-beta-3", - "dependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.caliper:caliper-worker:1.0-beta-3", - "com.google.code.gson:gson:2.8.9", - "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:3.3.0", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "com.squareup.okio:okio:1.6.0", - "com.sun.jersey:jersey-client:1.19.4", - "com.sun.jersey:jersey-core:1.19.4", - "javax.annotation:javax.annotation-api:1.3.2", - "javax.inject:javax.inject:1", - "javax.ws.rs:jsr311-api:1.1.1", - "joda-time:joda-time:2.10.10", - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-commons:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm-util:7.2", - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-worker:1.0-beta-3", - "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:3.3.0", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.sun.jersey:jersey-client:1.19.4" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/caliper/caliper-worker-jvm/1.0-beta-3/caliper-worker-jvm-1.0-beta-3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/caliper/caliper-worker-jvm/1.0-beta-3/caliper-worker-jvm-1.0-beta-3.jar", - "https://repo.maven.apache.org/maven2/com/google/caliper/caliper-worker-jvm/1.0-beta-3/caliper-worker-jvm-1.0-beta-3.jar" - ], - "sha256": "e14e1ecfdf939c82abdb902105be41ff3f83c18cb968116232015f2662d065a4", - "url": "https://repo1.maven.org/maven2/com/google/caliper/caliper-worker-jvm/1.0-beta-3/caliper-worker-jvm-1.0-beta-3.jar" - }, - { - "coord": "com.google.caliper:caliper-worker:1.0-beta-3", - "dependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.code.gson:gson:2.8.9", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "com.squareup.okio:okio:1.6.0", - "javax.inject:javax.inject:1", - "joda-time:joda-time:2.10.10" - ], - "directDependencies": [ - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "joda-time:joda-time:2.10.10" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/caliper/caliper-worker/1.0-beta-3/caliper-worker-1.0-beta-3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/caliper/caliper-worker/1.0-beta-3/caliper-worker-1.0-beta-3.jar", - "https://repo.maven.apache.org/maven2/com/google/caliper/caliper-worker/1.0-beta-3/caliper-worker-1.0-beta-3.jar" - ], - "sha256": "315d8e51df1f60551645a0e3bf2c504d2c79762f688e6f728eb9d1d9cd9a491b", - "url": "https://repo1.maven.org/maven2/com/google/caliper/caliper-worker/1.0-beta-3/caliper-worker-1.0-beta-3.jar" - }, - { - "coord": "com.google.caliper:caliper:1.0-beta-3", - "dependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.caliper:caliper-api:1.0-beta-3", - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-runner:1.0-beta-3", - "com.google.caliper:caliper-util:1.0-beta-3", - "com.google.caliper:caliper-worker-jvm:1.0-beta-3", - "com.google.caliper:caliper-worker:1.0-beta-3", - "com.google.code.gson:gson:2.8.9", - "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:3.3.0", - "com.google.dagger:dagger-producers:2.22.1", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.squareup.okhttp:okhttp:2.7.5", - "com.squareup.okio:okio:1.6.0", - "com.sun.jersey:jersey-client:1.19.4", - "com.sun.jersey:jersey-core:1.19.4", - "javax.annotation:javax.annotation-api:1.3.2", - "javax.inject:javax.inject:1", - "javax.ws.rs:jsr311-api:1.1.1", - "joda-time:joda-time:2.10.10", - "org.checkerframework:checker-compat-qual:2.5.3", - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-commons:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm-util:7.2", - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "com.google.caliper:caliper-core:1.0-beta-3", - "com.google.caliper:caliper-runner:1.0-beta-3", - "com.google.caliper:caliper-worker-jvm:1.0-beta-3", - "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:3.3.0", - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "com.sun.jersey:jersey-client:1.19.4" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/caliper/caliper/1.0-beta-3/caliper-1.0-beta-3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/caliper/caliper/1.0-beta-3/caliper-1.0-beta-3.jar", - "https://repo.maven.apache.org/maven2/com/google/caliper/caliper/1.0-beta-3/caliper-1.0-beta-3.jar" - ], - "sha256": "d54e1bfdbe9359a79e175c217b8d472555cf20da9c5c0a18bdb1ea7db979ed8e", - "url": "https://repo1.maven.org/maven2/com/google/caliper/caliper/1.0-beta-3/caliper-1.0-beta-3.jar" - }, - { - "coord": "com.google.code.findbugs:jsr305:3.0.2", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar", - "https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" - ], - "sha256": "766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7", - "url": "https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" - }, - { - "coord": "com.google.code.gson:gson:2.8.9", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar", - "https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar" - ], - "sha256": "d3999291855de495c94c743761b8ab5176cfeabe281a5ab0d8e8d45326fd703e", - "url": "https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar" - }, - { - "coord": "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:3.3.0", - "dependencies": [ - "com.google.guava:guava:32.0.1-jre", - "javax.annotation:javax.annotation-api:1.3.2", - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-commons:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm-util:7.2", - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "com.google.guava:guava:32.0.1-jre", - "javax.annotation:javax.annotation-api:1.3.2", - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-commons:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm-util:7.2", - "org.ow2.asm:asm:9.0" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/code/java-allocation-instrumenter/java-allocation-instrumenter/3.3.0/java-allocation-instrumenter-3.3.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/code/java-allocation-instrumenter/java-allocation-instrumenter/3.3.0/java-allocation-instrumenter-3.3.0.jar", - "https://repo.maven.apache.org/maven2/com/google/code/java-allocation-instrumenter/java-allocation-instrumenter/3.3.0/java-allocation-instrumenter-3.3.0.jar" - ], - "sha256": "1ef5535a8bd41cf3072469f381b9ee6ab28275311a7499f53d6e52adf976fef0", - "url": "https://repo1.maven.org/maven2/com/google/code/java-allocation-instrumenter/java-allocation-instrumenter/3.3.0/java-allocation-instrumenter-3.3.0.jar" - }, - { - "coord": "com.google.dagger:dagger-producers:2.22.1", - "dependencies": [ - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "javax.inject:javax.inject:1", - "org.checkerframework:checker-compat-qual:2.5.3" - ], - "directDependencies": [ - "com.google.dagger:dagger:2.22.1", - "com.google.guava:guava:32.0.1-jre", - "javax.inject:javax.inject:1", - "org.checkerframework:checker-compat-qual:2.5.3" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/dagger/dagger-producers/2.22.1/dagger-producers-2.22.1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/dagger/dagger-producers/2.22.1/dagger-producers-2.22.1.jar", - "https://repo.maven.apache.org/maven2/com/google/dagger/dagger-producers/2.22.1/dagger-producers-2.22.1.jar" - ], - "sha256": "f834a0082014213a68ff06a0f048d750178d02196c58b0b15beb367d32b97e35", - "url": "https://repo1.maven.org/maven2/com/google/dagger/dagger-producers/2.22.1/dagger-producers-2.22.1.jar" - }, - { - "coord": "com.google.dagger:dagger:2.22.1", - "dependencies": [ - "javax.inject:javax.inject:1" - ], - "directDependencies": [ - "javax.inject:javax.inject:1" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/dagger/dagger/2.22.1/dagger-2.22.1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/dagger/dagger/2.22.1/dagger-2.22.1.jar", - "https://repo.maven.apache.org/maven2/com/google/dagger/dagger/2.22.1/dagger-2.22.1.jar" - ], - "sha256": "329d4340f24c4f5717af016c097e90668bfea2a5376e6aa9964b01cef3fd241a", - "url": "https://repo1.maven.org/maven2/com/google/dagger/dagger/2.22.1/dagger-2.22.1.jar" - }, - { - "coord": "com.google.errorprone:error_prone_annotations:2.18.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar", - "https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar" - ], - "sha256": "9e6814cb71816988a4fd1b07a993a8f21bb7058d522c162b1de849e19bea54ae", - "url": "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar" - }, - { - "coord": "com.google.guava:failureaccess:1.0.1", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar", - "https://repo.maven.apache.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar" - ], - "sha256": "a171ee4c734dd2da837e4b16be9df4661afab72a41adaf31eb84dfdaf936ca26", - "url": "https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar" - }, - { - "coord": "com.google.guava:guava-testlib:32.0.1-jre", - "dependencies": [ - "com.google.code.findbugs:jsr305:3.0.2", - "com.google.errorprone:error_prone_annotations:2.18.0", - "com.google.guava:failureaccess:1.0.1", - "com.google.guava:guava:32.0.1-jre", - "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava", - "com.google.j2objc:j2objc-annotations:2.8", - "junit:junit:4.13.2", - "org.checkerframework:checker-qual:3.33.0", - "org.hamcrest:hamcrest-core:1.3" - ], - "directDependencies": [ - "com.google.code.findbugs:jsr305:3.0.2", - "com.google.errorprone:error_prone_annotations:2.18.0", - "com.google.guava:guava:32.0.1-jre", - "com.google.j2objc:j2objc-annotations:2.8", - "junit:junit:4.13.2", - "org.checkerframework:checker-qual:3.33.0" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/guava/guava-testlib/32.0.1-jre/guava-testlib-32.0.1-jre.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/guava/guava-testlib/32.0.1-jre/guava-testlib-32.0.1-jre.jar", - "https://repo.maven.apache.org/maven2/com/google/guava/guava-testlib/32.0.1-jre/guava-testlib-32.0.1-jre.jar" - ], - "sha256": "c97511849a5e085280f106df2b059566febd280b118d33d6a9e068d238100b63", - "url": "https://repo1.maven.org/maven2/com/google/guava/guava-testlib/32.0.1-jre/guava-testlib-32.0.1-jre.jar" - }, - { - "coord": "com.google.guava:guava:32.0.1-jre", - "dependencies": [ - "com.google.code.findbugs:jsr305:3.0.2", - "com.google.errorprone:error_prone_annotations:2.18.0", - "com.google.guava:failureaccess:1.0.1", - "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava", - "com.google.j2objc:j2objc-annotations:2.8", - "org.checkerframework:checker-qual:3.33.0" - ], - "directDependencies": [ - "com.google.code.findbugs:jsr305:3.0.2", - "com.google.errorprone:error_prone_annotations:2.18.0", - "com.google.guava:failureaccess:1.0.1", - "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava", - "com.google.j2objc:j2objc-annotations:2.8", - "org.checkerframework:checker-qual:3.33.0" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar", - "https://repo.maven.apache.org/maven2/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar" - ], - "sha256": "bd7fa227591fb8509677d0d1122cf95158f3b8a9f45653f58281d879f6dc48c5", - "url": "https://repo1.maven.org/maven2/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar" - }, - { - "coord": "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar", - "https://repo.maven.apache.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar" - ], - "sha256": "b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99", - "url": "https://repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar" - }, - { - "coord": "com.google.j2objc:j2objc-annotations:2.8", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar", - "https://repo.maven.apache.org/maven2/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar" - ], - "sha256": "f02a95fa1a5e95edb3ed859fd0fb7df709d121a35290eff8b74dce2ab7f4d6ed", - "url": "https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar" - }, - { - "coord": "com.google.truth:truth:1.1.2", - "dependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.errorprone:error_prone_annotations:2.18.0", - "com.google.guava:guava:32.0.1-jre", - "junit:junit:4.13.2", - "org.checkerframework:checker-qual:3.33.0", - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "com.google.auto.value:auto-value-annotations:1.8.1", - "com.google.errorprone:error_prone_annotations:2.18.0", - "com.google.guava:guava:32.0.1-jre", - "junit:junit:4.13.2", - "org.checkerframework:checker-qual:3.33.0", - "org.ow2.asm:asm:9.0" - ], - "file": "v1/https/repo1.maven.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar", - "https://repo.maven.apache.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar" - ], - "sha256": "a85e03b8b6ae8780f060cfded9500a3d1b5f52808f99a2ea6da9c683313c7518", - "url": "https://repo1.maven.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar" - }, - { - "coord": "com.squareup.okhttp:okhttp:2.7.5", - "dependencies": [ - "com.squareup.okio:okio:1.6.0" - ], - "directDependencies": [ - "com.squareup.okio:okio:1.6.0" - ], - "file": "v1/https/repo1.maven.org/maven2/com/squareup/okhttp/okhttp/2.7.5/okhttp-2.7.5.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/squareup/okhttp/okhttp/2.7.5/okhttp-2.7.5.jar", - "https://repo.maven.apache.org/maven2/com/squareup/okhttp/okhttp/2.7.5/okhttp-2.7.5.jar" - ], - "sha256": "88ac9fd1bb51f82bcc664cc1eb9c225c90dc4389d660231b4cc737bebfe7d0aa", - "url": "https://repo1.maven.org/maven2/com/squareup/okhttp/okhttp/2.7.5/okhttp-2.7.5.jar" - }, - { - "coord": "com.squareup.okio:okio:1.6.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.jar", - "https://repo.maven.apache.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.jar" - ], - "sha256": "114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266", - "url": "https://repo1.maven.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.jar" - }, - { - "coord": "com.sun.jersey:jersey-client:1.19.4", - "dependencies": [ - "com.sun.jersey:jersey-core:1.19.4", - "javax.ws.rs:jsr311-api:1.1.1" - ], - "directDependencies": [ - "com.sun.jersey:jersey-core:1.19.4" - ], - "file": "v1/https/repo1.maven.org/maven2/com/sun/jersey/jersey-client/1.19.4/jersey-client-1.19.4.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/sun/jersey/jersey-client/1.19.4/jersey-client-1.19.4.jar", - "https://repo.maven.apache.org/maven2/com/sun/jersey/jersey-client/1.19.4/jersey-client-1.19.4.jar" - ], - "sha256": "639c825c5db580f8115bf49ffc893093526d2ed1079fbc929b6a5fbd0b2eda40", - "url": "https://repo1.maven.org/maven2/com/sun/jersey/jersey-client/1.19.4/jersey-client-1.19.4.jar" - }, - { - "coord": "com.sun.jersey:jersey-core:1.19.4", - "dependencies": [ - "javax.ws.rs:jsr311-api:1.1.1" - ], - "directDependencies": [ - "javax.ws.rs:jsr311-api:1.1.1" - ], - "file": "v1/https/repo1.maven.org/maven2/com/sun/jersey/jersey-core/1.19.4/jersey-core-1.19.4.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/com/sun/jersey/jersey-core/1.19.4/jersey-core-1.19.4.jar", - "https://repo.maven.apache.org/maven2/com/sun/jersey/jersey-core/1.19.4/jersey-core-1.19.4.jar" - ], - "sha256": "64b03198e0264849d0fc341857ebcc9c882b1909a2dc35a0972fe7d901b826e5", - "url": "https://repo1.maven.org/maven2/com/sun/jersey/jersey-core/1.19.4/jersey-core-1.19.4.jar" - }, - { - "coord": "info.picocli:picocli:4.6.3", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/info/picocli/picocli/4.6.3/picocli-4.6.3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/info/picocli/picocli/4.6.3/picocli-4.6.3.jar", - "https://repo.maven.apache.org/maven2/info/picocli/picocli/4.6.3/picocli-4.6.3.jar" - ], - "sha256": "b0a5159e926de8084ff066025142270443533656bc599b8bb31d14d11fd138a4", - "url": "https://repo1.maven.org/maven2/info/picocli/picocli/4.6.3/picocli-4.6.3.jar" - }, - { - "coord": "javax.annotation:javax.annotation-api:1.3.2", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar", - "https://repo.maven.apache.org/maven2/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar" - ], - "sha256": "e04ba5195bcd555dc95650f7cc614d151e4bcd52d29a10b8aa2197f3ab89ab9b", - "url": "https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar" - }, - { - "coord": "javax.inject:javax.inject:1", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar", - "https://repo.maven.apache.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar" - ], - "sha256": "91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff", - "url": "https://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar" - }, - { - "coord": "javax.ws.rs:jsr311-api:1.1.1", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar", - "https://repo.maven.apache.org/maven2/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar" - ], - "sha256": "ab1534b73b5fa055808e6598a5e73b599ccda28c3159c3c0908977809422ee4a", - "url": "https://repo1.maven.org/maven2/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar" - }, - { - "coord": "joda-time:joda-time:2.10.10", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/joda-time/joda-time/2.10.10/joda-time-2.10.10.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/joda-time/joda-time/2.10.10/joda-time-2.10.10.jar", - "https://repo.maven.apache.org/maven2/joda-time/joda-time/2.10.10/joda-time-2.10.10.jar" - ], - "sha256": "dd8e7c92185a678d1b7b933f31209b6203c8ffa91e9880475a1be0346b9617e3", - "url": "https://repo1.maven.org/maven2/joda-time/joda-time/2.10.10/joda-time-2.10.10.jar" - }, - { - "coord": "junit:junit:4.13.2", - "dependencies": [ - "org.hamcrest:hamcrest-core:1.3" - ], - "directDependencies": [ - "org.hamcrest:hamcrest-core:1.3" - ], - "file": "v1/https/repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar", - "https://repo.maven.apache.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar" - ], - "sha256": "8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3", - "url": "https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar" - }, - { - "coord": "net.bytebuddy:byte-buddy-agent:1.12.7", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent/1.12.7/byte-buddy-agent-1.12.7.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent/1.12.7/byte-buddy-agent-1.12.7.jar", - "https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-agent/1.12.7/byte-buddy-agent-1.12.7.jar" - ], - "sha256": "73d84bb6e8e8980e674d796a29063f510ceb527c6f8c912a08a13e236be05c71", - "url": "https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent/1.12.7/byte-buddy-agent-1.12.7.jar" - }, - { - "coord": "net.bytebuddy:byte-buddy:1.12.7", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.12.7/byte-buddy-1.12.7.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.12.7/byte-buddy-1.12.7.jar", - "https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.12.7/byte-buddy-1.12.7.jar" - ], - "sha256": "d2e46555699e70361b5471a7e142f9c67855bba6907a285177ebd8ad973775d8", - "url": "https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.12.7/byte-buddy-1.12.7.jar" - }, - { - "coord": "org.checkerframework:checker-compat-qual:2.5.3", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.3/checker-compat-qual-2.5.3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.3/checker-compat-qual-2.5.3.jar", - "https://repo.maven.apache.org/maven2/org/checkerframework/checker-compat-qual/2.5.3/checker-compat-qual-2.5.3.jar" - ], - "sha256": "d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d", - "url": "https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.3/checker-compat-qual-2.5.3.jar" - }, - { - "coord": "org.checkerframework:checker-qual:3.33.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar", - "https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar" - ], - "sha256": "e316255bbfcd9fe50d165314b85abb2b33cb2a66a93c491db648e498a82c2de1", - "url": "https://repo1.maven.org/maven2/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar" - }, - { - "coord": "org.hamcrest:hamcrest-core:1.3", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", - "https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" - ], - "sha256": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9", - "url": "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" - }, - { - "coord": "org.mockito:mockito-core:4.3.1", - "dependencies": [ - "net.bytebuddy:byte-buddy-agent:1.12.7", - "net.bytebuddy:byte-buddy:1.12.7", - "org.objenesis:objenesis:3.2" - ], - "directDependencies": [ - "net.bytebuddy:byte-buddy-agent:1.12.7", - "net.bytebuddy:byte-buddy:1.12.7", - "org.objenesis:objenesis:3.2" - ], - "file": "v1/https/repo1.maven.org/maven2/org/mockito/mockito-core/4.3.1/mockito-core-4.3.1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/mockito/mockito-core/4.3.1/mockito-core-4.3.1.jar", - "https://repo.maven.apache.org/maven2/org/mockito/mockito-core/4.3.1/mockito-core-4.3.1.jar" - ], - "sha256": "148de2c6928365db29443ca12d35c930d9f481172b934fdd801d1cb1409ea83a", - "url": "https://repo1.maven.org/maven2/org/mockito/mockito-core/4.3.1/mockito-core-4.3.1.jar" - }, - { - "coord": "org.objenesis:objenesis:3.2", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/objenesis/objenesis/3.2/objenesis-3.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/objenesis/objenesis/3.2/objenesis-3.2.jar", - "https://repo.maven.apache.org/maven2/org/objenesis/objenesis/3.2/objenesis-3.2.jar" - ], - "sha256": "03d960bd5aef03c653eb000413ada15eb77cdd2b8e4448886edf5692805e35f3", - "url": "https://repo1.maven.org/maven2/org/objenesis/objenesis/3.2/objenesis-3.2.jar" - }, - { - "coord": "org.osgi:org.osgi.dto:1.0.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.dto/1.0.0/org.osgi.dto-1.0.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.dto/1.0.0/org.osgi.dto-1.0.0.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.dto/1.0.0/org.osgi.dto-1.0.0.jar" - ], - "sha256": "cb75f3c7e48e5a31a31df22e26873346f5bf659e2dcab2369e031e4850d2ff43", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.dto/1.0.0/org.osgi.dto-1.0.0.jar" - }, - { - "coord": "org.osgi:org.osgi.framework:1.8.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.framework/1.8.0/org.osgi.framework-1.8.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.framework/1.8.0/org.osgi.framework-1.8.0.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.framework/1.8.0/org.osgi.framework-1.8.0.jar" - ], - "sha256": "ec194b7871af27681716ff05259319a5c3c9b9727e8000e9e832499b93484b4e", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.framework/1.8.0/org.osgi.framework-1.8.0.jar" - }, - { - "coord": "org.osgi:org.osgi.resource:1.0.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.resource/1.0.0/org.osgi.resource-1.0.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.resource/1.0.0/org.osgi.resource-1.0.0.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.resource/1.0.0/org.osgi.resource-1.0.0.jar" - ], - "sha256": "81fc50f1f1d38a4af28e131907d4afe213249aab05060484edca0e60c4af9b4a", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.resource/1.0.0/org.osgi.resource-1.0.0.jar" - }, - { - "coord": "org.osgi:org.osgi.service.log:1.3.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.service.log/1.3.0/org.osgi.service.log-1.3.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.service.log/1.3.0/org.osgi.service.log-1.3.0.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.service.log/1.3.0/org.osgi.service.log-1.3.0.jar" - ], - "sha256": "ff6710c4856d32684cf3ebdc45248f41036ff734f2b03bbc08c4609a61fecfa0", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.service.log/1.3.0/org.osgi.service.log-1.3.0.jar" - }, - { - "coord": "org.osgi:org.osgi.service.repository:1.1.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.service.repository/1.1.0/org.osgi.service.repository-1.1.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.service.repository/1.1.0/org.osgi.service.repository-1.1.0.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.service.repository/1.1.0/org.osgi.service.repository-1.1.0.jar" - ], - "sha256": "c5553e95b459529192433486d4c4cc22ff45a2eae4968484f9f717319264a532", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.service.repository/1.1.0/org.osgi.service.repository-1.1.0.jar" - }, - { - "coord": "org.osgi:org.osgi.util.function:1.2.0", - "dependencies": [ - "org.osgi:osgi.annotation:8.0.1" - ], - "directDependencies": [ - "org.osgi:osgi.annotation:8.0.1" - ], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.util.function/1.2.0/org.osgi.util.function-1.2.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.util.function/1.2.0/org.osgi.util.function-1.2.0.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.util.function/1.2.0/org.osgi.util.function-1.2.0.jar" - ], - "sha256": "208819c7c71690c15a6bb8b187474e7f9d0147946b680182a62b9f222ae014ec", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.util.function/1.2.0/org.osgi.util.function-1.2.0.jar" - }, - { - "coord": "org.osgi:org.osgi.util.promise:1.2.0", - "dependencies": [ - "org.osgi:org.osgi.util.function:1.2.0", - "org.osgi:osgi.annotation:8.0.1" - ], - "directDependencies": [ - "org.osgi:org.osgi.util.function:1.2.0", - "org.osgi:osgi.annotation:8.0.1" - ], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.util.promise/1.2.0/org.osgi.util.promise-1.2.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.util.promise/1.2.0/org.osgi.util.promise-1.2.0.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.util.promise/1.2.0/org.osgi.util.promise-1.2.0.jar" - ], - "sha256": "fef86e64f584d012a16a0306160764f6179663b90988a226c4641b920f3a4b36", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.util.promise/1.2.0/org.osgi.util.promise-1.2.0.jar" - }, - { - "coord": "org.osgi:org.osgi.util.tracker:1.5.4", - "dependencies": [ - "org.osgi:osgi.annotation:8.0.1" - ], - "directDependencies": [ - "org.osgi:osgi.annotation:8.0.1" - ], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/org.osgi.util.tracker/1.5.4/org.osgi.util.tracker-1.5.4.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/org.osgi.util.tracker/1.5.4/org.osgi.util.tracker-1.5.4.jar", - "https://repo.maven.apache.org/maven2/org/osgi/org.osgi.util.tracker/1.5.4/org.osgi.util.tracker-1.5.4.jar" - ], - "sha256": "7d78c2cc9bcb6421c24f17aa097866ce8d9115c219a4f8d6cc753bc4dfb97efa", - "url": "https://repo1.maven.org/maven2/org/osgi/org.osgi.util.tracker/1.5.4/org.osgi.util.tracker-1.5.4.jar" - }, - { - "coord": "org.osgi:osgi.annotation:8.0.1", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/osgi/osgi.annotation/8.0.1/osgi.annotation-8.0.1.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/osgi/osgi.annotation/8.0.1/osgi.annotation-8.0.1.jar", - "https://repo.maven.apache.org/maven2/org/osgi/osgi.annotation/8.0.1/osgi.annotation-8.0.1.jar" - ], - "sha256": "a0e8a4c362bd3600812f37b0ea45fba966c7bc049d01fed56a09ecc74082759e", - "url": "https://repo1.maven.org/maven2/org/osgi/osgi.annotation/8.0.1/osgi.annotation-8.0.1.jar" - }, - { - "coord": "org.ow2.asm:asm-analysis:7.2", - "dependencies": [ - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "org.ow2.asm:asm-tree:7.2" - ], - "file": "v1/https/repo1.maven.org/maven2/org/ow2/asm/asm-analysis/7.2/asm-analysis-7.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/7.2/asm-analysis-7.2.jar", - "https://repo.maven.apache.org/maven2/org/ow2/asm/asm-analysis/7.2/asm-analysis-7.2.jar" - ], - "sha256": "be922aae60ff1ff1768e8e6544a38a7f92bd0a6d6b0b9791f94955d1bd453de2", - "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/7.2/asm-analysis-7.2.jar" - }, - { - "coord": "org.ow2.asm:asm-commons:7.2", - "dependencies": [ - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm:9.0" - ], - "file": "v1/https/repo1.maven.org/maven2/org/ow2/asm/asm-commons/7.2/asm-commons-7.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/7.2/asm-commons-7.2.jar", - "https://repo.maven.apache.org/maven2/org/ow2/asm/asm-commons/7.2/asm-commons-7.2.jar" - ], - "sha256": "0e86b8b179c5fb223d1a880a0ff4960b6978223984b94e62e71135f2d8ea3558", - "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/7.2/asm-commons-7.2.jar" - }, - { - "coord": "org.ow2.asm:asm-tree:7.2", - "dependencies": [ - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "org.ow2.asm:asm:9.0" - ], - "file": "v1/https/repo1.maven.org/maven2/org/ow2/asm/asm-tree/7.2/asm-tree-7.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/7.2/asm-tree-7.2.jar", - "https://repo.maven.apache.org/maven2/org/ow2/asm/asm-tree/7.2/asm-tree-7.2.jar" - ], - "sha256": "c063f5a67fa03cdc9bd79fd1c2ea6816cc4a19473ecdfbd9e9153b408c6f2656", - "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/7.2/asm-tree-7.2.jar" - }, - { - "coord": "org.ow2.asm:asm-util:7.2", - "dependencies": [ - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm:9.0" - ], - "directDependencies": [ - "org.ow2.asm:asm-analysis:7.2", - "org.ow2.asm:asm-tree:7.2", - "org.ow2.asm:asm:9.0" - ], - "file": "v1/https/repo1.maven.org/maven2/org/ow2/asm/asm-util/7.2/asm-util-7.2.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/ow2/asm/asm-util/7.2/asm-util-7.2.jar", - "https://repo.maven.apache.org/maven2/org/ow2/asm/asm-util/7.2/asm-util-7.2.jar" - ], - "sha256": "6e24913b021ffacfe8e7e053d6e0ccc731941148cfa078d4f1ed3d96904530f8", - "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm-util/7.2/asm-util-7.2.jar" - }, - { - "coord": "org.ow2.asm:asm:9.0", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar", - "https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar" - ], - "sha256": "0df97574914aee92fd349d0cb4e00f3345d45b2c239e0bb50f0a90ead47888e0", - "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar" - }, - { - "coord": "org.slf4j:slf4j-api:1.7.25", - "dependencies": [], - "directDependencies": [], - "file": "v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar", - "mirror_urls": [ - "https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar", - "https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar" - ], - "sha256": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79", - "url": "https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar" - } - ], - "version": "0.1.0" + "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", + "__INPUT_ARTIFACTS_HASH": 771645571, + "__RESOLVED_ARTIFACTS_HASH": -1085701786, + "conflict_resolution": { + "com.google.errorprone:error_prone_annotations:2.5.1": "com.google.errorprone:error_prone_annotations:2.18.0" + }, + "artifacts": { + "com.google.code.findbugs:jsr305": { + "shasums": { + "jar": "766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7" + }, + "version": "3.0.2" + }, + "com.google.code.gson:gson": { + "shasums": { + "jar": "d3999291855de495c94c743761b8ab5176cfeabe281a5ab0d8e8d45326fd703e" + }, + "version": "2.8.9" + }, + "com.google.errorprone:error_prone_annotations": { + "shasums": { + "jar": "9e6814cb71816988a4fd1b07a993a8f21bb7058d522c162b1de849e19bea54ae" + }, + "version": "2.18.0" + }, + "com.google.guava:failureaccess": { + "shasums": { + "jar": "a171ee4c734dd2da837e4b16be9df4661afab72a41adaf31eb84dfdaf936ca26" + }, + "version": "1.0.1" + }, + "com.google.guava:guava": { + "shasums": { + "jar": "bd7fa227591fb8509677d0d1122cf95158f3b8a9f45653f58281d879f6dc48c5" + }, + "version": "32.0.1-jre" + }, + "com.google.guava:listenablefuture": { + "shasums": { + "jar": "b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99" + }, + "version": "9999.0-empty-to-avoid-conflict-with-guava" + }, + "com.google.j2objc:j2objc-annotations": { + "shasums": { + "jar": "f02a95fa1a5e95edb3ed859fd0fb7df709d121a35290eff8b74dce2ab7f4d6ed" + }, + "version": "2.8" + }, + "org.checkerframework:checker-qual": { + "shasums": { + "jar": "e316255bbfcd9fe50d165314b85abb2b33cb2a66a93c491db648e498a82c2de1" + }, + "version": "3.33.0" } + }, + "dependencies": { + "com.google.guava:guava": [ + "com.google.code.findbugs:jsr305", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:failureaccess", + "com.google.guava:listenablefuture", + "com.google.j2objc:j2objc-annotations", + "org.checkerframework:checker-qual" + ] + }, + "packages": { + "com.google.code.findbugs:jsr305": [ + "javax.annotation", + "javax.annotation.concurrent", + "javax.annotation.meta" + ], + "com.google.code.gson:gson": [ + "com.google.gson", + "com.google.gson.annotations", + "com.google.gson.internal", + "com.google.gson.internal.bind", + "com.google.gson.internal.bind.util", + "com.google.gson.internal.reflect", + "com.google.gson.internal.sql", + "com.google.gson.reflect", + "com.google.gson.stream" + ], + "com.google.errorprone:error_prone_annotations": [ + "com.google.errorprone.annotations", + "com.google.errorprone.annotations.concurrent" + ], + "com.google.guava:failureaccess": [ + "com.google.common.util.concurrent.internal" + ], + "com.google.guava:guava": [ + "com.google.common.annotations", + "com.google.common.base", + "com.google.common.base.internal", + "com.google.common.cache", + "com.google.common.collect", + "com.google.common.escape", + "com.google.common.eventbus", + "com.google.common.graph", + "com.google.common.hash", + "com.google.common.html", + "com.google.common.io", + "com.google.common.math", + "com.google.common.net", + "com.google.common.primitives", + "com.google.common.reflect", + "com.google.common.util.concurrent", + "com.google.common.xml", + "com.google.thirdparty.publicsuffix" + ], + "com.google.j2objc:j2objc-annotations": [ + "com.google.j2objc.annotations" + ], + "org.checkerframework:checker-qual": [ + "org.checkerframework.checker.builder.qual", + "org.checkerframework.checker.calledmethods.qual", + "org.checkerframework.checker.compilermsgs.qual", + "org.checkerframework.checker.fenum.qual", + "org.checkerframework.checker.formatter.qual", + "org.checkerframework.checker.guieffect.qual", + "org.checkerframework.checker.i18n.qual", + "org.checkerframework.checker.i18nformatter.qual", + "org.checkerframework.checker.index.qual", + "org.checkerframework.checker.initialization.qual", + "org.checkerframework.checker.interning.qual", + "org.checkerframework.checker.lock.qual", + "org.checkerframework.checker.mustcall.qual", + "org.checkerframework.checker.nullness.qual", + "org.checkerframework.checker.optional.qual", + "org.checkerframework.checker.propkey.qual", + "org.checkerframework.checker.regex.qual", + "org.checkerframework.checker.signature.qual", + "org.checkerframework.checker.signedness.qual", + "org.checkerframework.checker.tainting.qual", + "org.checkerframework.checker.units.qual", + "org.checkerframework.common.aliasing.qual", + "org.checkerframework.common.initializedfields.qual", + "org.checkerframework.common.reflection.qual", + "org.checkerframework.common.returnsreceiver.qual", + "org.checkerframework.common.subtyping.qual", + "org.checkerframework.common.util.report.qual", + "org.checkerframework.common.value.qual", + "org.checkerframework.dataflow.qual", + "org.checkerframework.framework.qual" + ] + }, + "repositories": { + "https://repo1.maven.org/maven2/": [ + "com.google.code.findbugs:jsr305", + "com.google.code.gson:gson", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:failureaccess", + "com.google.guava:guava", + "com.google.guava:listenablefuture", + "com.google.j2objc:j2objc-annotations", + "org.checkerframework:checker-qual" + ], + "https://repo.maven.apache.org/maven2/": [ + "com.google.code.findbugs:jsr305", + "com.google.code.gson:gson", + "com.google.errorprone:error_prone_annotations", + "com.google.guava:failureaccess", + "com.google.guava:guava", + "com.google.guava:listenablefuture", + "com.google.j2objc:j2objc-annotations", + "org.checkerframework:checker-qual" + ] + }, + "services": {}, + "version": "2" } diff --git a/third_party/protobuf/objectivec/BUILD.bazel b/third_party/protobuf/objectivec/BUILD.bazel index 11dd63041d1e3..7dbbb353c195f 100644 --- a/third_party/protobuf/objectivec/BUILD.bazel +++ b/third_party/protobuf/objectivec/BUILD.bazel @@ -89,20 +89,9 @@ objc_library( "GPBRuntimeTypes.h", "GPBUnknownField.h", "GPBUnknownFields.h", - "GPBUnknownFieldSet.h", "GPBUtilities.h", "GPBWellKnownTypes.h", "GPBWireFormat.h", - "google/protobuf/Any.pbobjc.h", - "google/protobuf/Api.pbobjc.h", - "google/protobuf/Duration.pbobjc.h", - "google/protobuf/Empty.pbobjc.h", - "google/protobuf/FieldMask.pbobjc.h", - "google/protobuf/SourceContext.pbobjc.h", - "google/protobuf/Struct.pbobjc.h", - "google/protobuf/Timestamp.pbobjc.h", - "google/protobuf/Type.pbobjc.h", - "google/protobuf/Wrappers.pbobjc.h", # Package private headers, but exposed because the generated sources # need to use them. "GPBArray_PackagePrivate.h", @@ -112,7 +101,6 @@ objc_library( "GPBDictionary_PackagePrivate.h", "GPBMessage_PackagePrivate.h", "GPBRootObject_PackagePrivate.h", - "GPBUnknownFieldSet_PackagePrivate.h", "GPBUnknownField_PackagePrivate.h", "GPBUtilities_PackagePrivate.h", ], @@ -142,7 +130,6 @@ objc_library( "GPBTimestamp.pbobjc.m", "GPBType.pbobjc.m", "GPBUnknownField.m", - "GPBUnknownFieldSet.m", "GPBUnknownFields.m", "GPBUtilities.m", "GPBWellKnownTypes.m", diff --git a/third_party/protobuf/objectivec/DevTools/full_mac_build.sh b/third_party/protobuf/objectivec/DevTools/full_mac_build.sh index 861143a924682..3cade64d27e96 100755 --- a/third_party/protobuf/objectivec/DevTools/full_mac_build.sh +++ b/third_party/protobuf/objectivec/DevTools/full_mac_build.sh @@ -7,7 +7,7 @@ set -eu # Some base locations. readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") readonly ProtoRootDir="${ScriptDir}/../.." -readonly BazelFlags="${BAZEL_FLAGS:---announce_rc --macos_minimum_os=10.13}" +readonly BazelFlags="${BAZEL_FLAGS:---announce_rc --macos_minimum_os=11.0}" # Invoke with BAZEL=bazelisk to use that instead. readonly BazelBin="${BAZEL:-bazel}" @@ -219,6 +219,11 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" ) ;; + 15.* | 16.*) + XCODEBUILD_TEST_BASE_IOS+=( + -destination "platform=iOS Simulator,name=iPhone 15,OS=latest" + ) + ;; * ) echo "" echo "ATTENTION: Time to update the simulator targets for Xcode ${XCODE_VERSION}" @@ -279,6 +284,11 @@ if [[ "${DO_XCODE_TVOS_TESTS}" == "yes" ]] ; then -destination "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=latest" ) ;; + 15.* | 16.*) + XCODEBUILD_TEST_BASE_TVOS+=( + -destination "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest" + ) + ;; * ) echo "" echo "ATTENTION: Time to update the simulator targets for Xcode ${XCODE_VERSION}" diff --git a/third_party/protobuf/objectivec/GPBBootstrap.h b/third_party/protobuf/objectivec/GPBBootstrap.h index 78601c68e9730..1d3c6be9fef8c 100644 --- a/third_party/protobuf/objectivec/GPBBootstrap.h +++ b/third_party/protobuf/objectivec/GPBBootstrap.h @@ -118,10 +118,4 @@ // Minimum runtime version supported for compiling/running against. // - Gets changed when support for the older generated code is dropped. -#define GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION 30001 - -// This is a legacy constant now frozen in time for old generated code. If -// GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION ever gets moved above 30001 then -// this should also change to break code compiled with an old runtime that -// can't be supported any more. -#define GOOGLE_PROTOBUF_OBJC_GEN_VERSION 30001 +#define GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION 30007 diff --git a/third_party/protobuf/objectivec/GPBCodedInputStream.m b/third_party/protobuf/objectivec/GPBCodedInputStream.m index 3e33336c802ca..bc4421344f6c4 100644 --- a/third_party/protobuf/objectivec/GPBCodedInputStream.m +++ b/third_party/protobuf/objectivec/GPBCodedInputStream.m @@ -12,8 +12,6 @@ #import "GPBDictionary_PackagePrivate.h" #import "GPBMessage.h" #import "GPBMessage_PackagePrivate.h" -#import "GPBUnknownFieldSet.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUtilities.h" #import "GPBUtilities_PackagePrivate.h" #import "GPBWireFormat.h" @@ -499,18 +497,6 @@ void GPBCodedInputStreamCheckLastTagWas(GPBCodedInputStreamState *state, int32_t --state_.recursionDepth; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -- (void)readUnknownGroup:(int32_t)fieldNumber message:(GPBUnknownFieldSet *)message { - CheckRecursionLimit(&state_); - ++state_.recursionDepth; - [message mergeFromCodedInputStream:self]; - GPBCodedInputStreamCheckLastTagWas(&state_, - GPBWireFormatMakeTag(fieldNumber, GPBWireFormatEndGroup)); - --state_.recursionDepth; -} -#pragma clang diagnostic pop - - (void)readMessage:(GPBMessage *)message extensionRegistry:(id<GPBExtensionRegistry>)extensionRegistry { CheckRecursionLimit(&state_); diff --git a/third_party/protobuf/objectivec/GPBCodedInputStream_PackagePrivate.h b/third_party/protobuf/objectivec/GPBCodedInputStream_PackagePrivate.h index b6b77b50e2a59..73deb14975334 100644 --- a/third_party/protobuf/objectivec/GPBCodedInputStream_PackagePrivate.h +++ b/third_party/protobuf/objectivec/GPBCodedInputStream_PackagePrivate.h @@ -12,9 +12,6 @@ #import "GPBCodedInputStream.h" #import "GPBDescriptor.h" -#import "GPBUnknownFieldSet.h" - -@class GPBUnknownFieldSet; typedef struct GPBCodedInputStreamState { const uint8_t *bytes; @@ -42,13 +39,6 @@ typedef struct GPBCodedInputStreamState { message:(GPBMessage *)message extensionRegistry:(id<GPBExtensionRegistry>)extensionRegistry; -// Reads a group field value from the stream and merges it into the given -// UnknownFieldSet. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -- (void)readUnknownGroup:(int32_t)fieldNumber message:(GPBUnknownFieldSet *)message; -#pragma clang diagnostic pop - // Reads a map entry. - (void)readMapEntry:(id)mapDictionary extensionRegistry:(id<GPBExtensionRegistry>)extensionRegistry diff --git a/third_party/protobuf/objectivec/GPBCodedOutputStream.h b/third_party/protobuf/objectivec/GPBCodedOutputStream.h index 3461fa95e06a6..92e0d8ff36275 100644 --- a/third_party/protobuf/objectivec/GPBCodedOutputStream.h +++ b/third_party/protobuf/objectivec/GPBCodedOutputStream.h @@ -11,9 +11,6 @@ #import "GPBWireFormat.h" #import "GPBArray.h" -#import "GPBUnknownFieldSet.h" - -@class GPBUnknownFieldSet; NS_ASSUME_NONNULL_BEGIN @@ -587,36 +584,6 @@ __attribute__((objc_subclassing_restricted)) // clang-format on -/** - * Write a GPBUnknownFieldSet for the given field number. - * - * @param fieldNumber The field number assigned to the value. - * @param value The value to write out. - **/ -- (void)writeUnknownGroup:(int32_t)fieldNumber - value:(GPBUnknownFieldSet *)value - __attribute__((deprecated("GPBUnknownFieldSet is going away."))); - -/** - * Write an array of GPBUnknownFieldSet for the given field number. - * - * @param fieldNumber The field number assigned to the values. - * @param values The values to write out. - **/ -- (void)writeUnknownGroupArray:(int32_t)fieldNumber - values:(NSArray<GPBUnknownFieldSet *> *)values - __attribute__((deprecated("GPBUnknownFieldSet is going away."))); - -/** - * Write a GPBUnknownFieldSet without any tag (but does write the endGroup tag). - * - * @param fieldNumber The field number assigned to the value. - * @param value The value to write out. - **/ -- (void)writeUnknownGroupNoTag:(int32_t)fieldNumber - value:(GPBUnknownFieldSet *)value - __attribute__((deprecated("GPBUnknownFieldSet is going away."))); - /** Write a MessageSet extension field to the stream. For historical reasons, the wire format differs from normal fields. diff --git a/third_party/protobuf/objectivec/GPBCodedOutputStream.m b/third_party/protobuf/objectivec/GPBCodedOutputStream.m index 122bcd98df3db..67c69a43c90c3 100644 --- a/third_party/protobuf/objectivec/GPBCodedOutputStream.m +++ b/third_party/protobuf/objectivec/GPBCodedOutputStream.m @@ -11,8 +11,6 @@ #import <mach/vm_param.h> #import "GPBArray.h" -#import "GPBUnknownFieldSet.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUtilities.h" #import "GPBUtilities_PackagePrivate.h" @@ -355,21 +353,6 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state, int64_t value [self writeGroupNoTag:fieldNumber value:value]; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -- (void)writeUnknownGroupNoTag:(int32_t)fieldNumber value:(const GPBUnknownFieldSet *)value { - [value writeToCodedOutputStream:self]; - GPBWriteTagWithFormat(&state_, fieldNumber, GPBWireFormatEndGroup); -} - -- (void)writeUnknownGroup:(int32_t)fieldNumber value:(GPBUnknownFieldSet *)value { - GPBWriteTagWithFormat(&state_, fieldNumber, GPBWireFormatStartGroup); - [self writeUnknownGroupNoTag:fieldNumber value:value]; -} - -#pragma clang diagnostic pop - - (void)writeMessageNoTag:(GPBMessage *)value { GPBWriteRawVarint32(&state_, (int32_t)[value serializedSize]); [value writeToCodedOutputStream:self]; @@ -850,17 +833,6 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state, int64_t value // clang-format on -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -- (void)writeUnknownGroupArray:(int32_t)fieldNumber values:(NSArray *)values { - for (GPBUnknownFieldSet *value in values) { - [self writeUnknownGroup:fieldNumber value:value]; - } -} - -#pragma clang diagnostic pop - - (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value { GPBWriteTagWithFormat(&state_, GPBWireFormatMessageSetItem, GPBWireFormatStartGroup); GPBWriteUInt32(&state_, GPBWireFormatMessageSetTypeId, fieldNumber); @@ -992,11 +964,6 @@ size_t GPBComputeStringSizeNoTag(NSString *value) { size_t GPBComputeGroupSizeNoTag(GPBMessage *value) { return [value serializedSize]; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -size_t GPBComputeUnknownGroupSizeNoTag(GPBUnknownFieldSet *value) { return value.serializedSize; } -#pragma clang diagnostic pop - size_t GPBComputeMessageSizeNoTag(GPBMessage *value) { size_t size = [value serializedSize]; return GPBComputeRawVarint32SizeForInteger(size) + size; @@ -1063,13 +1030,6 @@ size_t GPBComputeGroupSize(int32_t fieldNumber, GPBMessage *value) { return GPBComputeTagSize(fieldNumber) * 2 + GPBComputeGroupSizeNoTag(value); } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -size_t GPBComputeUnknownGroupSize(int32_t fieldNumber, GPBUnknownFieldSet *value) { - return GPBComputeTagSize(fieldNumber) * 2 + GPBComputeUnknownGroupSizeNoTag(value); -} -#pragma clang diagnostic pop - size_t GPBComputeMessageSize(int32_t fieldNumber, GPBMessage *value) { return GPBComputeTagSize(fieldNumber) + GPBComputeMessageSizeNoTag(value); } diff --git a/third_party/protobuf/objectivec/GPBCodedOutputStream_PackagePrivate.h b/third_party/protobuf/objectivec/GPBCodedOutputStream_PackagePrivate.h index 3cadb556803d7..f87609c9d5b74 100644 --- a/third_party/protobuf/objectivec/GPBCodedOutputStream_PackagePrivate.h +++ b/third_party/protobuf/objectivec/GPBCodedOutputStream_PackagePrivate.h @@ -25,11 +25,6 @@ size_t GPBComputeFixed32Size(int32_t fieldNumber, uint32_t value) __attribute__( size_t GPBComputeBoolSize(int32_t fieldNumber, BOOL value) __attribute__((const)); size_t GPBComputeStringSize(int32_t fieldNumber, NSString *value) __attribute__((const)); size_t GPBComputeGroupSize(int32_t fieldNumber, GPBMessage *value) __attribute__((const)); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -size_t GPBComputeUnknownGroupSize(int32_t fieldNumber, GPBUnknownFieldSet *value) - __attribute__((const)); -#pragma clang diagnostic pop size_t GPBComputeMessageSize(int32_t fieldNumber, GPBMessage *value) __attribute__((const)); size_t GPBComputeBytesSize(int32_t fieldNumber, NSData *value) __attribute__((const)); size_t GPBComputeUInt32Size(int32_t fieldNumber, uint32_t value) __attribute__((const)); @@ -50,10 +45,6 @@ size_t GPBComputeFixed32SizeNoTag(uint32_t value) __attribute__((const)); size_t GPBComputeBoolSizeNoTag(BOOL value) __attribute__((const)); size_t GPBComputeStringSizeNoTag(NSString *value) __attribute__((const)); size_t GPBComputeGroupSizeNoTag(GPBMessage *value) __attribute__((const)); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -size_t GPBComputeUnknownGroupSizeNoTag(GPBUnknownFieldSet *value) __attribute__((const)); -#pragma clang diagnostic pop size_t GPBComputeMessageSizeNoTag(GPBMessage *value) __attribute__((const)); size_t GPBComputeBytesSizeNoTag(NSData *value) __attribute__((const)); size_t GPBComputeUInt32SizeNoTag(int32_t value) __attribute__((const)); diff --git a/third_party/protobuf/objectivec/GPBDescriptor.h b/third_party/protobuf/objectivec/GPBDescriptor.h index c59f2c0715638..957b3af830af1 100644 --- a/third_party/protobuf/objectivec/GPBDescriptor.h +++ b/third_party/protobuf/objectivec/GPBDescriptor.h @@ -114,9 +114,6 @@ __attribute__((objc_subclassing_restricted)) @property(nonatomic, readonly, copy) NSString *package; /** The objc prefix declared in the proto file. */ @property(nonatomic, readonly, copy, nullable) NSString *objcPrefix; -/** The syntax of the proto file, this property will be removed in the future. */ -@property(nonatomic, readonly) GPBFileSyntax syntax - __attribute__((deprecated("Syntax will be removed in the future."))); @end diff --git a/third_party/protobuf/objectivec/GPBDescriptor.m b/third_party/protobuf/objectivec/GPBDescriptor.m index 25b48b0dea84f..7f9de425dddd0 100644 --- a/third_party/protobuf/objectivec/GPBDescriptor.m +++ b/third_party/protobuf/objectivec/GPBDescriptor.m @@ -16,6 +16,16 @@ #import "GPBUtilities_PackagePrivate.h" #import "GPBWireFormat.h" +@interface GPBFileDescriptor () +- (instancetype)initWithPackage:(NSString *)package objcPrefix:(NSString *)objcPrefix; +- (instancetype)initWithPackage:(NSString *)package; +@end + +@interface GPBOneofDescriptor () +// name must be long lived. +- (instancetype)initWithName:(const char *)name fields:(NSArray *)fields; +@end + @interface GPBDescriptor () - (instancetype)initWithClass:(Class)messageClass messageName:(NSString *)messageName @@ -51,7 +61,6 @@ // The addresses of these variables are used as keys for objc_getAssociatedObject. static const char kTextFormatExtraValueKey = 0; static const char kParentClassValueKey = 0; -static const char kClassNameSuffixKey = 0; static const char kFileDescriptorCacheKey = 0; static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageFields) @@ -91,11 +100,11 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField // Compute the unknown flags by this version of the runtime and then check the passed in flags // (from the generated code) to detect when sources from a newer version are being used with an // older runtime. - GPBDescriptorInitializationFlags unknownFlags = - ~(GPBDescriptorInitializationFlag_FieldsWithDefault | - GPBDescriptorInitializationFlag_WireFormat | GPBDescriptorInitializationFlag_UsesClassRefs | - GPBDescriptorInitializationFlag_Proto3OptionalKnown | - GPBDescriptorInitializationFlag_ClosedEnumSupportKnown); + GPBDescriptorInitializationFlags unknownFlags = (GPBDescriptorInitializationFlags)(~( + GPBDescriptorInitializationFlag_FieldsWithDefault | + GPBDescriptorInitializationFlag_WireFormat | GPBDescriptorInitializationFlag_UsesClassRefs | + GPBDescriptorInitializationFlag_Proto3OptionalKnown | + GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)); if ((flags & unknownFlags) != 0) { GPBRuntimeMatchFailure(); } @@ -108,10 +117,8 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField NSAssert((flags & GPBDescriptorInitializationFlag_ClosedEnumSupportKnown) != 0, @"Internal error: close enum should be known"); - // `messageName` and `fileDescription` should both be set or both be unset depending on if this is - // being called from current code generation or legacy code generation. - NSAssert((messageName == nil) == (fileDescription == NULL), - @"name and fileDescription should always be provided together"); + NSAssert((messageName != nil), @"Internal error: missing messageName"); + NSAssert((fileDescription != NULL), @"Internal error: missing fileDescription"); #endif NSMutableArray *fields = @@ -137,10 +144,10 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField } // No real value in checking all the fields individually, just check the combined flags at the // end. - GPBFieldFlags unknownFieldFlags = - ~(GPBFieldRequired | GPBFieldRepeated | GPBFieldPacked | GPBFieldOptional | - GPBFieldHasDefaultValue | GPBFieldClearHasIvarOnZero | GPBFieldTextFormatNameCustom | - GPBFieldHasEnumDescriptor | GPBFieldMapKeyMask | GPBFieldClosedEnum); + GPBFieldFlags unknownFieldFlags = (GPBFieldFlags)(~( + GPBFieldRequired | GPBFieldRepeated | GPBFieldPacked | GPBFieldOptional | + GPBFieldHasDefaultValue | GPBFieldClearHasIvarOnZero | GPBFieldTextFormatNameCustom | + GPBFieldHasEnumDescriptor | GPBFieldMapKeyMask | GPBFieldClosedEnum)); if ((mergedFieldFlags & unknownFieldFlags) != 0) { GPBRuntimeMatchFailure(); } @@ -156,114 +163,6 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField return descriptor; } -+ (instancetype)allocDescriptorForClass:(Class)messageClass - file:(GPBFileDescriptor *)file - fields:(void *)fieldDescriptions - fieldCount:(uint32_t)fieldCount - storageSize:(uint32_t)storageSize - flags:(GPBDescriptorInitializationFlags)flags { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30006, - time_to_remove_this_old_version_shim); - - BOOL fixClassRefs = (flags & GPBDescriptorInitializationFlag_UsesClassRefs) == 0; - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30003, - time_to_remove_non_class_ref_support); - - BOOL fixProto3Optional = (flags & GPBDescriptorInitializationFlag_Proto3OptionalKnown) == 0; - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30004, - time_to_remove_proto3_optional_fallback); - - BOOL fixClosedEnums = (flags & GPBDescriptorInitializationFlag_ClosedEnumSupportKnown) == 0; - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30005, - time_to_remove_closed_enum_fallback); - - if (fixClassRefs || fixProto3Optional || fixClosedEnums) { - BOOL fieldsIncludeDefault = (flags & GPBDescriptorInitializationFlag_FieldsWithDefault) != 0; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBFileSyntax fileSyntax = file.syntax; -#pragma clang diagnostic pop - - for (uint32_t i = 0; i < fieldCount; ++i) { - GPBMessageFieldDescription *coreDesc; - if (fieldsIncludeDefault) { - coreDesc = &((((GPBMessageFieldDescriptionWithDefault *)fieldDescriptions)[i]).core); - } else { - coreDesc = &(((GPBMessageFieldDescription *)fieldDescriptions)[i]); - } - - if (fixClassRefs && GPBDataTypeIsMessage(coreDesc->dataType)) { - const char *className = coreDesc->dataTypeSpecific.className; - Class msgClass = objc_getClass(className); - NSAssert(msgClass, @"Class %s not defined", className); - coreDesc->dataTypeSpecific.clazz = msgClass; - } - - if (fixProto3Optional) { - // If it was... - // - proto3 syntax - // - not repeated/map - // - not in a oneof (negative has index) - // - not a message (the flag doesn't make sense for messages) - BOOL clearOnZero = ((fileSyntax == GPBFileSyntaxProto3) && - ((coreDesc->flags & (GPBFieldRepeated | GPBFieldMapKeyMask)) == 0) && - (coreDesc->hasIndex >= 0) && !GPBDataTypeIsMessage(coreDesc->dataType)); - if (clearOnZero) { - coreDesc->flags |= GPBFieldClearHasIvarOnZero; - } - } - - if (fixClosedEnums) { - // NOTE: This isn't correct, it is using the syntax of the file that - // declared the field, not the syntax of the file that declared the - // enum; but for older generated code, that's all we have and that happens - // to be what the runtime was doing (even though it was wrong). This is - // only wrong in the rare cases an enum is declared in a proto3 syntax - // file but used for a field in the proto2 syntax file. - BOOL isClosedEnum = - (coreDesc->dataType == GPBDataTypeEnum && fileSyntax == GPBFileSyntaxProto2); - if (isClosedEnum) { - coreDesc->flags |= GPBFieldClosedEnum; - } - } - } - flags |= (GPBDescriptorInitializationFlag_UsesClassRefs | - GPBDescriptorInitializationFlag_Proto3OptionalKnown | - GPBDescriptorInitializationFlag_ClosedEnumSupportKnown); - } - - GPBDescriptor *result = [self allocDescriptorForClass:messageClass - messageName:nil - fileDescription:NULL - fields:fieldDescriptions - fieldCount:fieldCount - storageSize:storageSize - flags:flags]; - objc_setAssociatedObject(result, &kFileDescriptorCacheKey, file, - OBJC_ASSOCIATION_RETAIN_NONATOMIC); - return result; -} - -+ (instancetype)allocDescriptorForClass:(Class)messageClass - rootClass:(__unused Class)rootClass - file:(GPBFileDescriptor *)file - fields:(void *)fieldDescriptions - fieldCount:(uint32_t)fieldCount - storageSize:(uint32_t)storageSize - flags:(GPBDescriptorInitializationFlags)flags { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30006, - time_to_remove_this_old_version_shim); - // The rootClass is no longer used, but it is passed as [ROOT class] to - // ensure it was started up during initialization also when the message - // scopes extensions. - return [self allocDescriptorForClass:messageClass - file:file - fields:fieldDescriptions - fieldCount:fieldCount - storageSize:storageSize - flags:flags]; -} - - (instancetype)initWithClass:(Class)messageClass messageName:(NSString *)messageName fileDescription:(GPBFileDescription *)fileDescription @@ -304,7 +203,8 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField firstHasIndex:(int32_t)firstHasIndex { NSCAssert(firstHasIndex < 0, @"Should always be <0"); NSMutableArray *oneofs = [[NSMutableArray alloc] initWithCapacity:count]; - for (uint32_t i = 0, hasIndex = firstHasIndex; i < count; ++i, --hasIndex) { + int32_t hasIndex = firstHasIndex; + for (uint32_t i = 0; i < count; ++i, --hasIndex) { const char *name = oneofNames[i]; NSArray *fieldsForOneof = NewFieldsArrayForHasIndex(hasIndex, fields_); NSCAssert(fieldsForOneof.count > 0, @"No fields for this oneof? (%s:%d)", name, hasIndex); @@ -332,32 +232,13 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField - (void)setupExtensionRanges:(const GPBExtensionRange *)ranges count:(int32_t)count { extensionRanges_ = ranges; - extensionRangesCount_ = count; + extensionRangesCount_ = (uint32_t)count; } - (void)setupContainingMessageClass:(Class)messageClass { objc_setAssociatedObject(self, &kParentClassValueKey, messageClass, OBJC_ASSOCIATION_ASSIGN); } -- (void)setupContainingMessageClassName:(const char *)msgClassName { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30003, - time_to_remove_this_old_version_shim); - // Note: Only fetch the class here, can't send messages to it because - // that could cause cycles back to this class within +initialize if - // two messages have each other in fields (i.e. - they build a graph). - Class clazz = objc_getClass(msgClassName); - NSAssert(clazz, @"Class %s not defined", msgClassName); - [self setupContainingMessageClass:clazz]; -} - -- (void)setupMessageClassNameSuffix:(NSString *)suffix { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30007, - time_to_remove_this_old_version_shim); - if (suffix.length) { - objc_setAssociatedObject(self, &kClassNameSuffixKey, suffix, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } -} - - (NSString *)name { return NSStringFromClass(messageClass_); } @@ -373,12 +254,10 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField NSString *package = fileDescription_->package ? @(fileDescription_->package) : @""; if (fileDescription_->prefix) { result = [[GPBFileDescriptor alloc] initWithPackage:package - objcPrefix:@(fileDescription_->prefix) - syntax:fileDescription_->syntax]; + objcPrefix:@(fileDescription_->prefix)]; } else { - result = [[GPBFileDescriptor alloc] initWithPackage:package - syntax:fileDescription_->syntax]; + result = [[GPBFileDescriptor alloc] initWithPackage:package]; } objc_setAssociatedObject(result, &kFileDescriptorCacheKey, result, OBJC_ASSOCIATION_RETAIN_NONATOMIC); @@ -404,62 +283,10 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField return messageName_; } - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30007, - time_to_remove_this_old_approach); - // NOTE: When this code path is removed, this also means this api can't return nil any more but - // that would be a breaking code change (not longer a Swift optional), so changing that will be - // harder. - - NSString *className = NSStringFromClass(self.messageClass); - GPBFileDescriptor *file = self.file; - NSString *objcPrefix = file.objcPrefix; - if (objcPrefix && ![className hasPrefix:objcPrefix]) { - NSAssert(0, @"Class didn't have correct prefix? (%@ - %@)", className, objcPrefix); - return nil; - } - - NSString *name = nil; - if (parent) { - NSString *parentClassName = NSStringFromClass(parent.messageClass); - // The generator will add _Class to avoid reserved words, drop it. - NSString *suffix = objc_getAssociatedObject(parent, &kClassNameSuffixKey); - if (suffix) { - if (![parentClassName hasSuffix:suffix]) { - NSAssert(0, @"ParentMessage class didn't have correct suffix? (%@ - %@)", className, - suffix); - return nil; - } - parentClassName = [parentClassName substringToIndex:(parentClassName.length - suffix.length)]; - } - NSString *parentPrefix = [parentClassName stringByAppendingString:@"_"]; - if (![className hasPrefix:parentPrefix]) { - NSAssert(0, @"Class didn't have the correct parent name prefix? (%@ - %@)", parentPrefix, - className); - return nil; - } - name = [className substringFromIndex:parentPrefix.length]; - } else { - name = [className substringFromIndex:objcPrefix.length]; - } - - // The generator will add _Class to avoid reserved words, drop it. - NSString *suffix = objc_getAssociatedObject(self, &kClassNameSuffixKey); - if (suffix) { - if (![name hasSuffix:suffix]) { - NSAssert(0, @"Message class didn't have correct suffix? (%@ - %@)", name, suffix); - return nil; - } - name = [name substringToIndex:(name.length - suffix.length)]; - } - - NSString *prefix = (parent != nil ? parent.fullName : file.package); - NSString *result; - if (prefix.length > 0) { - result = [NSString stringWithFormat:@"%@.%@", prefix, name]; - } else { - result = name; - } - return result; +#if defined(DEBUG) && DEBUG + NSAssert(NO, @"Missing messageName_"); +#endif + return nil; } - (GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber { @@ -494,30 +321,24 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField @implementation GPBFileDescriptor { NSString *package_; NSString *objcPrefix_; - GPBFileSyntax syntax_; } @synthesize package = package_; @synthesize objcPrefix = objcPrefix_; -@synthesize syntax = syntax_; -- (instancetype)initWithPackage:(NSString *)package - objcPrefix:(NSString *)objcPrefix - syntax:(GPBFileSyntax)syntax { +- (instancetype)initWithPackage:(NSString *)package objcPrefix:(NSString *)objcPrefix { self = [super init]; if (self) { package_ = [package copy]; objcPrefix_ = [objcPrefix copy]; - syntax_ = syntax; } return self; } -- (instancetype)initWithPackage:(NSString *)package syntax:(GPBFileSyntax)syntax { +- (instancetype)initWithPackage:(NSString *)package { self = [super init]; if (self) { package_ = [package copy]; - syntax_ = syntax; } return self; } @@ -537,7 +358,7 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField } GPBFileDescriptor *otherFile = other; // objcPrefix can be nil, otherwise, straight up compare. - return (syntax_ == otherFile->syntax_ && [package_ isEqual:otherFile->package_] && + return ([package_ isEqual:otherFile->package_] && (objcPrefix_ == otherFile->objcPrefix_ || (otherFile->objcPrefix_ && [objcPrefix_ isEqual:otherFile->objcPrefix_]))); } @@ -669,9 +490,17 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { NSAssert((coreDesc->flags & GPBFieldHasEnumDescriptor) != 0, @"Field must have GPBFieldHasEnumDescriptor set"); #endif // DEBUG +#if defined(DEBUG) && DEBUG && !defined(NS_BLOCK_ASSERTIONS) + if (enumDescriptor_.isClosed) { + NSAssert((coreDesc->flags & GPBFieldClosedEnum) != 0, + @"Field must have GPBFieldClosedEnum set"); + } else { + NSAssert((coreDesc->flags & GPBFieldClosedEnum) == 0, + @"Field must not have GPBFieldClosedEnum set"); + } +#endif // defined(DEBUG) && DEBUG && !NS_BLOCK_ASSERTIONS } - // Non map<>/repeated fields can have defaults in proto2 syntax. BOOL isMapOrArray = GPBFieldIsMapOrArray(self); if (!isMapOrArray && includesDefault) { defaultValue_ = ((GPBMessageFieldDescriptionWithDefault *)description)->defaultValue; @@ -813,7 +642,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { return nil; } const uint8_t *extraTextFormatInfo = [extraInfoValue pointerValue]; - return GPBDecodeTextFormatName(extraTextFormatInfo, GPBFieldNumber(self), self.name); + return GPBDecodeTextFormatName(extraTextFormatInfo, (int32_t)GPBFieldNumber(self), self.name); } // The logic here has to match SetCommonFieldVariables() from @@ -895,7 +724,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { // (from the generated code) to detect when sources from a newer version are being used with an // older runtime. GPBEnumDescriptorInitializationFlags unknownFlags = - ~(GPBEnumDescriptorInitializationFlag_IsClosed); + (GPBEnumDescriptorInitializationFlags)(~(GPBEnumDescriptorInitializationFlag_IsClosed)); if ((flags & unknownFlags) != 0) { GPBRuntimeMatchFailure(); } @@ -927,38 +756,6 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { return descriptor; } -+ (instancetype)allocDescriptorForName:(NSString *)name - valueNames:(const char *)valueNames - values:(const int32_t *)values - count:(uint32_t)valueCount - enumVerifier:(GPBEnumValidationFunc)enumVerifier { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30005, - time_to_remove_this_old_version_shim); - return [self allocDescriptorForName:name - valueNames:valueNames - values:values - count:valueCount - enumVerifier:enumVerifier - flags:GPBEnumDescriptorInitializationFlag_None]; -} - -+ (instancetype)allocDescriptorForName:(NSString *)name - valueNames:(const char *)valueNames - values:(const int32_t *)values - count:(uint32_t)valueCount - enumVerifier:(GPBEnumValidationFunc)enumVerifier - extraTextFormatInfo:(const char *)extraTextFormatInfo { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30005, - time_to_remove_this_old_version_shim); - return [self allocDescriptorForName:name - valueNames:valueNames - values:values - count:valueCount - enumVerifier:enumVerifier - flags:GPBEnumDescriptorInitializationFlag_None - extraTextFormatInfo:extraTextFormatInfo]; -} - - (instancetype)initWithName:(NSString *)name valueNames:(const char *)valueNames values:(const int32_t *)values @@ -993,6 +790,10 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { return (flags_ & GPBEnumDescriptorInitializationFlag_IsClosed) != 0; } +- (BOOL)isOpenOrValidValue:(int32_t)value { + return (flags_ & GPBEnumDescriptorInitializationFlag_IsClosed) == 0 || enumVerifier_(value); +} + - (void)calcValueNameOffsets { @synchronized(self) { if (nameOffsets_ != NULL) { @@ -1140,8 +941,8 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { // Compute the unknown options by this version of the runtime and then check the passed in // descriptor's options (from the generated code) to detect when sources from a newer version are // being used with an older runtime. - GPBExtensionOptions unknownOptions = - ~(GPBExtensionRepeated | GPBExtensionPacked | GPBExtensionSetWireFormat); + GPBExtensionOptions unknownOptions = (GPBExtensionOptions)(~( + GPBExtensionRepeated | GPBExtensionPacked | GPBExtensionSetWireFormat)); if ((desc->options & unknownOptions) != 0) { GPBRuntimeMatchFailure(); } @@ -1186,27 +987,6 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { return self; } -- (instancetype)initWithExtensionDescription:(GPBExtensionDescription *)desc { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30003, - time_to_remove_this_old_version_shim); - - const char *className = desc->messageOrGroupClass.name; - if (className) { - Class clazz = objc_lookUpClass(className); - NSAssert(clazz != Nil, @"Class %s not defined", className); - desc->messageOrGroupClass.clazz = clazz; - } - - const char *extendedClassName = desc->extendedClass.name; - if (extendedClassName) { - Class clazz = objc_lookUpClass(extendedClassName); - NSAssert(clazz, @"Class %s not defined", extendedClassName); - desc->extendedClass.clazz = clazz; - } - - return [self initWithExtensionDescription:desc usesClassRefs:YES]; -} - - (void)dealloc { if ((description_->dataType == GPBDataTypeBytes) && !GPBExtensionIsRepeated(description_)) { [defaultValue_.valueData release]; @@ -1230,7 +1010,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { } - (uint32_t)fieldNumber { - return description_->fieldNumber; + return (uint32_t)(description_->fieldNumber); } - (GPBDataType)dataType { diff --git a/third_party/protobuf/objectivec/GPBDescriptor_PackagePrivate.h b/third_party/protobuf/objectivec/GPBDescriptor_PackagePrivate.h index 739b44d133ace..c9c690e7fe80c 100644 --- a/third_party/protobuf/objectivec/GPBDescriptor_PackagePrivate.h +++ b/third_party/protobuf/objectivec/GPBDescriptor_PackagePrivate.h @@ -77,6 +77,9 @@ typedef struct GPBFileDescription { GPBFileSyntax syntax; } GPBFileDescription; +// Fetches an EnumDescriptor. +typedef GPBEnumDescriptor *(*GPBEnumDescriptorFunc)(void); + // Describes a single field in a protobuf as it is represented as an ivar. typedef struct GPBMessageFieldDescription { // Name of ivar. @@ -86,13 +89,8 @@ typedef struct GPBMessageFieldDescription { // C identifier for large apps. const char *name; union { - // className is deprecated and will be removed in favor of clazz. - // kept around right now for backwards compatibility. - // clazz is used iff GPBDescriptorInitializationFlag_UsesClassRefs is set. - char *className; // Name of the class of the message. - Class clazz; // Class of the message. - // For enums only. - GPBEnumDescriptorFunc enumDescFunc; + Class clazz; // Class of the message. + GPBEnumDescriptorFunc enumDescFunc; // Function to get the enum descriptor. } dataTypeSpecific; // The field number for the ivar. uint32_t number; @@ -131,29 +129,16 @@ typedef NS_OPTIONS(uint8_t, GPBExtensionOptions) { typedef struct GPBExtensionDescription { GPBGenericValue defaultValue; const char *singletonName; - // Before 3.12, `extendedClass` was just a `const char *`. Thanks to nested - // initialization - // (https://en.cppreference.com/w/c/language/struct_initialization#Nested_initialization) old - // generated code with `.extendedClass = GPBStringifySymbol(Something)` still works; and the - // current generator can use `extendedClass.clazz`, to pass a Class reference. + // Historically this had more than one entry, but the union name is referenced in the generated + // code so it can't be removed without breaking compatibility. union { - const char *name; Class clazz; } extendedClass; - // Before 3.12, this was `const char *messageOrGroupClassName`. In the - // initial 3.12 release, we moved the `union messageOrGroupClass`, and failed - // to realize that would break existing source code for extensions. So to - // keep existing source code working, we added an unnamed union (C11) to - // provide both the old field name and the new union. This keeps both older - // and newer code working. - // Background: https://github.com/protocolbuffers/protobuf/issues/7555 + // Historically this had more than one entry, but the union name is referenced in the generated + // code so it can't be removed without breaking compatibility. union { - const char *messageOrGroupClassName; - union { - const char *name; - Class clazz; - } messageOrGroupClass; - }; + Class clazz; + } messageOrGroupClass; GPBEnumDescriptorFunc enumDescriptorFunc; int32_t fieldNumber; GPBDataType dataType; @@ -209,38 +194,6 @@ typedef NS_OPTIONS(uint32_t, GPBDescriptorInitializationFlags) { - (void)setupExtensionRanges:(const GPBExtensionRange *)ranges count:(int32_t)count; - (void)setupContainingMessageClass:(Class)msgClass; -// Deprecated, these remain to support older versions of source generation. -+ (instancetype)allocDescriptorForClass:(Class)messageClass - file:(GPBFileDescriptor *)file - fields:(void *)fieldDescriptions - fieldCount:(uint32_t)fieldCount - storageSize:(uint32_t)storageSize - flags:(GPBDescriptorInitializationFlags)flags - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); -+ (instancetype)allocDescriptorForClass:(Class)messageClass - rootClass:(Class)rootClass - file:(GPBFileDescriptor *)file - fields:(void *)fieldDescriptions - fieldCount:(uint32_t)fieldCount - storageSize:(uint32_t)storageSize - flags:(GPBDescriptorInitializationFlags)flags - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); -- (void)setupContainingMessageClassName:(const char *)msgClassName - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); -- (void)setupMessageClassNameSuffix:(NSString *)suffix - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); - -@end - -@interface GPBFileDescriptor () -- (instancetype)initWithPackage:(NSString *)package - objcPrefix:(NSString *)objcPrefix - syntax:(GPBFileSyntax)syntax; -- (instancetype)initWithPackage:(NSString *)package syntax:(GPBFileSyntax)syntax; @end @interface GPBOneofDescriptor () { @@ -248,8 +201,6 @@ typedef NS_OPTIONS(uint32_t, GPBDescriptorInitializationFlags) { const char *name_; NSArray *fields_; } -// name must be long lived. -- (instancetype)initWithName:(const char *)name fields:(NSArray *)fields; @end @interface GPBFieldDescriptor () { @@ -285,22 +236,7 @@ typedef NS_OPTIONS(uint32_t, GPBEnumDescriptorInitializationFlags) { flags:(GPBEnumDescriptorInitializationFlags)flags extraTextFormatInfo:(const char *)extraTextFormatInfo; -// Deprecated, these remain to support older versions of source generation. -+ (instancetype)allocDescriptorForName:(NSString *)name - valueNames:(const char *)valueNames - values:(const int32_t *)values - count:(uint32_t)valueCount - enumVerifier:(GPBEnumValidationFunc)enumVerifier - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); -+ (instancetype)allocDescriptorForName:(NSString *)name - valueNames:(const char *)valueNames - values:(const int32_t *)values - count:(uint32_t)valueCount - enumVerifier:(GPBEnumValidationFunc)enumVerifier - extraTextFormatInfo:(const char *)extraTextFormatInfo - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); +- (BOOL)isOpenOrValidValue:(int32_t)value; @end @interface GPBExtensionDescriptor () { @@ -318,10 +254,6 @@ typedef NS_OPTIONS(uint32_t, GPBEnumDescriptorInitializationFlags) { // description has to be long lived, it is held as a raw pointer. - (instancetype)initWithExtensionDescription:(GPBExtensionDescription *)desc usesClassRefs:(BOOL)usesClassRefs; -// Deprecated. Calls above with `usesClassRefs = NO` -- (instancetype)initWithExtensionDescription:(GPBExtensionDescription *)desc - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); - (NSComparisonResult)compareByFieldNumber:(GPBExtensionDescriptor *)other; @end @@ -350,10 +282,6 @@ GPB_INLINE uint32_t GPBFieldNumber(GPBFieldDescriptor *field) { return field->description_->number; } -GPB_INLINE BOOL GPBFieldIsClosedEnum(GPBFieldDescriptor *field) { - return (field->description_->flags & GPBFieldClosedEnum) != 0; -} - #pragma clang diagnostic pop uint32_t GPBFieldTag(GPBFieldDescriptor *self); diff --git a/third_party/protobuf/objectivec/GPBDictionary.m b/third_party/protobuf/objectivec/GPBDictionary.m index 520abf72235a7..c7199fe80136d 100644 --- a/third_party/protobuf/objectivec/GPBDictionary.m +++ b/third_party/protobuf/objectivec/GPBDictionary.m @@ -484,7 +484,7 @@ void GPBDictionaryReadEntry(id mapDictionary, GPBCodedInputStream *stream, [(NSMutableDictionary *)mapDictionary setObject:value.valueString forKey:key.valueString]; } else { if (valueDataType == GPBDataTypeEnum) { - if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:value.valueEnum]) { + if ([field.enumDescriptor isOpenOrValidValue:value.valueEnum]) { [mapDictionary setGPBGenericValue:&value forGPBGenericValueKey:&key]; } else { NSData *data = [mapDictionary serializedDataForUnknownValue:value.valueEnum diff --git a/third_party/protobuf/objectivec/GPBMessage.h b/third_party/protobuf/objectivec/GPBMessage.h index 87d21e76cc8ca..f206bf360659c 100644 --- a/third_party/protobuf/objectivec/GPBMessage.h +++ b/third_party/protobuf/objectivec/GPBMessage.h @@ -12,12 +12,10 @@ #import "GPBCodedOutputStream.h" #import "GPBDescriptor.h" #import "GPBExtensionRegistry.h" -#import "GPBUnknownFieldSet.h" #import "GPBUnknownFields.h" @class GPBCodedInputStream; @class GPBCodedOutputStream; -@class GPBUnknownFieldSet; @class GPBUnknownFields; NS_ASSUME_NONNULL_BEGIN @@ -72,13 +70,6 @@ CF_EXTERN_C_END // fields declared in protos, you need to update objective_helpers.cc. The main // cases are methods that take no arguments, or setFoo:/hasFoo: type methods. -/** - * The set of unknown fields for this message. - **/ -@property(nonatomic, copy, nullable) GPBUnknownFieldSet *unknownFields __attribute__(( - deprecated("Use GPBUnknownFields and the -initFromMessage: initializer and " - "mergeUnknownFields:extensionRegistry:error: to add the data back to a message."))); - /** * Whether the message, along with all submessages, have the required fields * set. @@ -250,21 +241,6 @@ CF_EXTERN_C_END (nullable id<GPBExtensionRegistry>)extensionRegistry error:(NSError **)errorPtr; -/** - * Parses the given data as this message's class, and merges those values into - * this message. - * - * @param data The binary representation of the message to merge. - * @param extensionRegistry The extension registry to use to look up extensions. - * - * @exception GPBCodedInputStreamException Exception thrown when parsing was - * unsuccessful. - **/ -- (void)mergeFromData:(NSData *)data - extensionRegistry:(nullable id<GPBExtensionRegistry>)extensionRegistry - __attribute__((deprecated( - "Use -mergeFromData:extensionRegistry:error: instead, especaily if calling from Swift."))); - /** * Parses the given data as this message's class, and merges those values into * this message. diff --git a/third_party/protobuf/objectivec/GPBMessage.m b/third_party/protobuf/objectivec/GPBMessage.m index 9dd6ae58635d1..fd6a029956781 100644 --- a/third_party/protobuf/objectivec/GPBMessage.m +++ b/third_party/protobuf/objectivec/GPBMessage.m @@ -29,8 +29,6 @@ #import "GPBRootObject.h" #import "GPBRootObject_PackagePrivate.h" #import "GPBUnknownField.h" -#import "GPBUnknownFieldSet.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUnknownFields.h" #import "GPBUnknownFields_PackagePrivate.h" #import "GPBUtilities.h" @@ -79,18 +77,7 @@ NSString *const GPBMessageExceptionMessageTooLarge = @interface GPBMessage () { @package - // Only one of these two is ever set, GPBUnknownFieldSet is being deprecated and will - // eventually be removed, but because that api support mutation, once the property is - // fetch it must continue to be used so any mutations will be honored in future operations - // on the message. - // Read only operations that access these two/cause things to migration between them should - // be protected with an @synchronized(self) block (that way the code also doesn't have to - // worry about throws). NSMutableData *unknownFieldData_; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknownFields_; -#pragma clang diagnostic pop NSMutableDictionary *extensionMap_; // Readonly access to autocreatedExtensionMap_ is protected via readOnlyLock_. @@ -198,10 +185,6 @@ static uint8_t *EncodeVarintS32(int32_t val, uint8_t *ptr) { GPB_NOINLINE static void AddUnknownFieldVarint32(GPBMessage *self, uint32_t fieldNumber, int32_t value) { - if (self->unknownFields_) { - [self->unknownFields_ mergeVarintField:fieldNumber value:value]; - return; - } uint8_t buf[20]; uint8_t *ptr = buf; ptr = EncodeVarintU32(GPBWireFormatMakeTag(fieldNumber, GPBWireFormatVarint), ptr); @@ -216,10 +199,6 @@ static void AddUnknownFieldVarint32(GPBMessage *self, uint32_t fieldNumber, int3 GPB_NOINLINE static void AddUnknownFieldLengthDelimited(GPBMessage *self, uint32_t fieldNumber, NSData *value) { - if (self->unknownFields_) { - [self->unknownFields_ mergeLengthDelimited:fieldNumber value:value]; - return; - } uint8_t buf[20]; uint8_t *ptr = buf; ptr = EncodeVarintU32(GPBWireFormatMakeTag(fieldNumber, GPBWireFormatLengthDelimited), ptr); @@ -235,12 +214,6 @@ static void AddUnknownFieldLengthDelimited(GPBMessage *self, uint32_t fieldNumbe GPB_NOINLINE static void AddUnknownMessageSetEntry(GPBMessage *self, uint32_t typeId, NSData *value) { - if (self->unknownFields_) { - // Legacy Set does this odd storage for MessageSet. - [self->unknownFields_ mergeLengthDelimited:typeId value:value]; - return; - } - uint8_t buf[60]; uint8_t *ptr = buf; ptr = EncodeVarintU32(GPBWireFormatMessageSetItemTag, ptr); @@ -264,13 +237,6 @@ static void AddUnknownMessageSetEntry(GPBMessage *self, uint32_t typeId, NSData GPB_NOINLINE static void ParseUnknownField(GPBMessage *self, uint32_t tag, GPBCodedInputStream *input) { - if (self->unknownFields_) { - if (![self->unknownFields_ mergeFieldFrom:tag input:input]) { - GPBRaiseStreamError(GPBCodedInputStreamErrorInvalidTag, @"Unexpected end-group tag"); - } - return; - } - uint8_t buf[20]; uint8_t *ptr = buf; ptr = EncodeVarintU32(tag, ptr); // All will need the tag @@ -1117,55 +1083,6 @@ void GPBClearMessageAutocreator(GPBMessage *self) { self->autocreatorExtension_ = nil; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -GPB_NOINLINE -static void MergeUnknownFieldDataIntoFieldSet(GPBMessage *self, NSData *data, - GPBUnknownFieldSet *targetSet) { - GPBUnknownFieldSet *unknownFields = targetSet ? targetSet : self->unknownFields_; - -#if defined(DEBUG) && DEBUG - NSCAssert(unknownFields != nil, @"Internal error: unknown fields not initialized."); -#endif - - BOOL isMessageSet = self.descriptor.isWireFormat; - GPBUnknownFieldSet *decodeInto = isMessageSet ? [[GPBUnknownFieldSet alloc] init] : unknownFields; - - GPBCodedInputStream *input = [[GPBCodedInputStream alloc] initWithData:data]; - @try { - [decodeInto mergeFromCodedInputStream:input]; - } @catch (NSException *exception) { -#if defined(DEBUG) && DEBUG - NSLog(@"%@: Internal exception while parsing the unknown fields into a Set: %@", [self class], - exception); -#endif - } - [input release]; - - if (isMessageSet) { - // Need to transform the groups back into how Message feeds the data into a MessageSet when - // doing a full MessageSet based decode. - GPBUnknownField *groupField = [decodeInto getField:GPBWireFormatMessageSetItem]; - for (GPBUnknownFieldSet *group in groupField.groupList) { - GPBUnknownField *typeIdField = [group getField:GPBWireFormatMessageSetTypeId]; - GPBUnknownField *messageField = [group getField:GPBWireFormatMessageSetMessage]; - if (typeIdField.varintList.count != 1 || messageField.lengthDelimitedList.count != 1) { -#if defined(DEBUG) && DEBUG - NSCAssert(NO, @"Internal error: MessageSet group missing typeId or message."); -#endif - continue; - } - int32_t fieldNumber = (int32_t)[typeIdField.varintList valueAtIndex:0]; - GPBUnknownField *messageSetField = [[GPBUnknownField alloc] initWithNumber:fieldNumber]; - [messageSetField addLengthDelimited:messageField.lengthDelimitedList[0]]; - [unknownFields addField:messageSetField]; - [messageSetField release]; - } - [decodeInto release]; - } -} -#pragma clang diagnostic pop - @implementation GPBMessage + (void)initialize { @@ -1402,11 +1319,7 @@ static void MergeUnknownFieldDataIntoFieldSet(GPBMessage *self, NSData *data, [self copyFieldsInto:result zone:zone descriptor:descriptor]; - @synchronized(self) { - result->unknownFields_ = [unknownFields_ copyWithZone:zone]; - result->unknownFieldData_ = [unknownFieldData_ mutableCopyWithZone:zone]; - } - + result->unknownFieldData_ = [unknownFieldData_ mutableCopyWithZone:zone]; result->extensionMap_ = CloneExtensionMap(extensionMap_, zone); return result; } @@ -1482,8 +1395,6 @@ static void MergeUnknownFieldDataIntoFieldSet(GPBMessage *self, NSData *data, extensionMap_ = nil; [unknownFieldData_ release]; unknownFieldData_ = nil; - [unknownFields_ release]; - unknownFields_ = nil; // Note that clearing does not affect autocreator_. If we are being cleared // because of a dealloc, then autocreator_ should be nil anyway. If we are @@ -1498,11 +1409,6 @@ static void MergeUnknownFieldDataIntoFieldSet(GPBMessage *self, NSData *data, - (void)clearUnknownFields { [unknownFieldData_ release]; unknownFieldData_ = nil; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [unknownFields_ release]; - unknownFields_ = nil; -#pragma clang diagnostic pop GPBBecomeVisibleToAutocreator(self); } @@ -1690,20 +1596,9 @@ static void MergeUnknownFieldDataIntoFieldSet(GPBMessage *self, NSData *data, sortedExtensions:sortedExtensions]; } } - @synchronized(self) { - if (unknownFieldData_) { -#if defined(DEBUG) && DEBUG - NSAssert(unknownFields_ == nil, @"Internal error both unknown states were set"); -#endif - [output writeRawData:unknownFieldData_]; - } else { - if (descriptor.isWireFormat) { - [unknownFields_ writeAsMessageSetTo:output]; - } else { - [unknownFields_ writeToCodedOutputStream:output]; - } - } - } // @synchronized(self) + if (unknownFieldData_) { + [output writeRawData:unknownFieldData_]; + } } - (void)writeDelimitedToOutputStream:(NSOutputStream *)output { @@ -2332,15 +2227,6 @@ static void MergeUnknownFieldDataIntoFieldSet(GPBMessage *self, NSData *data, #pragma mark - mergeFrom -- (void)mergeFromData:(NSData *)data extensionRegistry:(id<GPBExtensionRegistry>)extensionRegistry { - GPBCodedInputStream *input = [[GPBCodedInputStream alloc] initWithData:data]; - @try { - [self mergeFromCodedInputStream:input extensionRegistry:extensionRegistry endingTag:0]; - } @finally { - [input release]; - } -} - - (BOOL)mergeFromData:(NSData *)data extensionRegistry:(nullable id<GPBExtensionRegistry>)extensionRegistry error:(NSError **)errorPtr { @@ -2421,34 +2307,6 @@ static void MergeUnknownFieldDataIntoFieldSet(GPBMessage *self, NSData *data, return result; } -#pragma mark - Unknown Field Support - -- (GPBUnknownFieldSet *)unknownFields { - @synchronized(self) { - if (unknownFieldData_) { -#if defined(DEBUG) && DEBUG - NSAssert(unknownFields_ == nil, @"Internal error both unknown states were set"); -#endif - unknownFields_ = [[GPBUnknownFieldSet alloc] init]; - MergeUnknownFieldDataIntoFieldSet(self, unknownFieldData_, nil); - [unknownFieldData_ release]; - unknownFieldData_ = nil; - } - return unknownFields_; - } // @synchronized(self) -} - -- (void)setUnknownFields:(GPBUnknownFieldSet *)unknownFields { - if (unknownFields != unknownFields_ || unknownFieldData_ != nil) { - // Changing sets or clearing. - [unknownFieldData_ release]; - unknownFieldData_ = nil; - [unknownFields_ release]; - unknownFields_ = [unknownFields copy]; - GPBBecomeVisibleToAutocreator(self); - } -} - - (void)parseMessageSet:(GPBCodedInputStream *)input extensionRegistry:(id<GPBExtensionRegistry>)extensionRegistry { uint32_t typeId = 0; @@ -2606,7 +2464,7 @@ static void MergeSingleFieldFromCodedInputStream(GPBMessage *self, GPBFieldDescr case GPBDataTypeEnum: { int32_t val = GPBCodedInputStreamReadEnum(&input->state_); - if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:val]) { + if ([field.enumDescriptor isOpenOrValidValue:val]) { GPBSetInt32IvarWithFieldPrivate(self, field, val); } else { AddUnknownFieldVarint32(self, GPBFieldNumber(field), val); @@ -2655,7 +2513,7 @@ static void MergeRepeatedPackedFieldFromCodedInputStream(GPBMessage *self, case GPBDataTypeEnum: { int32_t val = GPBCodedInputStreamReadEnum(state); - if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:val]) { + if ([field.enumDescriptor isOpenOrValidValue:val]) { [(GPBEnumArray *)genericArray addRawValue:val]; } else { AddUnknownFieldVarint32(self, GPBFieldNumber(field), val); @@ -2723,7 +2581,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream( } case GPBDataTypeEnum: { int32_t val = GPBCodedInputStreamReadEnum(state); - if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:val]) { + if ([field.enumDescriptor isOpenOrValidValue:val]) { [(GPBEnumArray *)genericArray addRawValue:val]; } else { AddUnknownFieldVarint32(self, GPBFieldNumber(field), val); @@ -2973,28 +2831,11 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream( } // for(fields) // Unknown fields. - if (unknownFields_) { -#if defined(DEBUG) && DEBUG - NSAssert(unknownFieldData_ == nil, @"Internal error both unknown states were set"); -#endif - @synchronized(other) { - if (other->unknownFields_) { -#if defined(DEBUG) && DEBUG - NSAssert(other->unknownFieldData_ == nil, @"Internal error both unknown states were set"); -#endif - [unknownFields_ mergeUnknownFields:other->unknownFields_]; - } else if (other->unknownFieldData_) { - MergeUnknownFieldDataIntoFieldSet(self, other->unknownFieldData_, nil); - } - } // @synchronized(other) - } else { - NSData *otherData = GPBMessageUnknownFieldsData(other); - if (otherData) { - if (unknownFieldData_) { - [unknownFieldData_ appendData:otherData]; - } else { - unknownFieldData_ = [otherData mutableCopy]; - } + if (other->unknownFieldData_) { + if (unknownFieldData_) { + [unknownFieldData_ appendData:other->unknownFieldData_]; + } else { + unknownFieldData_ = [other->unknownFieldData_ mutableCopy]; } } @@ -3167,78 +3008,13 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream( } } - // Mutation while another thread is doing read only access is invalid, so the only thing we - // need to guard against is concurrent r/o access, so we can grab the values (and retain them) - // so we have a version to compare against safely incase the second access causes the transform - // between internal states. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *selfUnknownFields; - NSData *selfUnknownFieldData; - @synchronized(self) { - selfUnknownFields = [unknownFields_ retain]; - selfUnknownFieldData = [unknownFieldData_ retain]; + BOOL selfHas = unknownFieldData_ != nil; + BOOL otherHas = otherMsg->unknownFieldData_ != nil; + if (selfHas != otherHas) { + return NO; // Only one has the data, not equal. } - GPBUnknownFieldSet *otherUnknownFields; - NSData *otherUnknownFieldData; - @synchronized(otherMsg) { - otherUnknownFields = [otherMsg->unknownFields_ retain]; - otherUnknownFieldData = [otherMsg->unknownFieldData_ retain]; - } -#pragma clang diagnostic pop -#if defined(DEBUG) && DEBUG && !defined(NS_BLOCK_ASSERTIONS) - if (selfUnknownFields) { - NSAssert(selfUnknownFieldData == nil, @"Internal error both unknown states were set"); - } - if (otherUnknownFields) { - NSAssert(otherUnknownFieldData == nil, @"Internal error both unknown states were set"); - } -#endif - // Since a developer can set the legacy unknownFieldSet, treat nil and empty as the same. - if (selfUnknownFields && selfUnknownFields.countOfFields == 0) { - [selfUnknownFields release]; - selfUnknownFields = nil; - } - if (otherUnknownFields && otherUnknownFields.countOfFields == 0) { - [otherUnknownFields release]; - otherUnknownFields = nil; - } - - BOOL result = YES; - - if (selfUnknownFieldData && otherUnknownFieldData) { - // Both had data, compare it. - result = [selfUnknownFieldData isEqual:otherUnknownFieldData]; - } else if (selfUnknownFields && otherUnknownFields) { - // Both had fields set, compare them. - result = [selfUnknownFields isEqual:otherUnknownFields]; - } else { - // At this point, we're done to one have a set/nothing, and the other having data/nothing. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *theSet = selfUnknownFields ? selfUnknownFields : otherUnknownFields; - NSData *theData = selfUnknownFieldData ? selfUnknownFieldData : otherUnknownFieldData; - if (theSet) { - if (theData) { - GPBUnknownFieldSet *tempSet = [[GPBUnknownFieldSet alloc] init]; - MergeUnknownFieldDataIntoFieldSet(self, theData, tempSet); - result = [tempSet isEqual:theSet]; - [tempSet release]; - } else { - result = NO; - } - } else { - // It was a data/nothing and nothing, so they equal if the other didn't have data. - result = theData == nil; - } -#pragma clang diagnostic pop - } - - [selfUnknownFields release]; - [selfUnknownFieldData release]; - [otherUnknownFields release]; - [otherUnknownFieldData release]; - return result; + // They both don't have (then equal) or they both have, and then compare the two. + return !selfHas || [unknownFieldData_ isEqual:otherMsg->unknownFieldData_]; } // It is very difficult to implement a generic hash for ProtoBuf messages that @@ -3501,20 +3277,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream( } // for(fields) // Add any unknown fields. - @synchronized(self) { - if (unknownFieldData_) { -#if defined(DEBUG) && DEBUG - NSAssert(unknownFields_ == nil, @"Internal error both unknown states were set"); -#endif - result += [unknownFieldData_ length]; - } else { - if (descriptor.wireFormat) { - result += [unknownFields_ serializedSizeAsMessageSet]; - } else { - result += [unknownFields_ serializedSize]; - } - } - } // @synchronized(self) + result += [unknownFieldData_ length]; // Add any extensions. for (GPBExtensionDescriptor *extension in extensionMap_) { @@ -4040,35 +3803,6 @@ id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) { return expected; } -NSData *GPBMessageUnknownFieldsData(GPBMessage *self) { - NSData *result = nil; - @synchronized(self) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknownFields = self->unknownFields_; -#pragma clang diagnostic pop - if (unknownFields) { -#if defined(DEBUG) && DEBUG - NSCAssert(self->unknownFieldData_ == nil, @"Internal error both unknown states were set"); -#endif - if (self.descriptor.isWireFormat) { - NSMutableData *mutableData = - [NSMutableData dataWithLength:unknownFields.serializedSizeAsMessageSet]; - GPBCodedOutputStream *output = [[GPBCodedOutputStream alloc] initWithData:mutableData]; - [unknownFields writeAsMessageSetTo:output]; - [output flush]; - [output release]; - result = mutableData; - } else { - result = [unknownFields data]; - } - } else { - // Internally we can borrow it without a copy since this is immediately used by callers - // and multithreaded access with any mutation is not allow on messages. - result = self->unknownFieldData_; - } - } // @synchronized(self) - return result; -} +NSData *GPBMessageUnknownFieldsData(GPBMessage *self) { return self->unknownFieldData_; } #pragma clang diagnostic pop diff --git a/third_party/protobuf/objectivec/GPBMessage_PackagePrivate.h b/third_party/protobuf/objectivec/GPBMessage_PackagePrivate.h index 58649c44f7c29..b46b6472133ee 100644 --- a/third_party/protobuf/objectivec/GPBMessage_PackagePrivate.h +++ b/third_party/protobuf/objectivec/GPBMessage_PackagePrivate.h @@ -11,12 +11,6 @@ #import "GPBMessage.h" -// TODO: Remove this import. Older generated code use the OSAtomic* apis, -// so anyone that hasn't regenerated says building by having this. After -// enough time has passed, this likely can be removed as folks should have -// regenerated. -#import <libkern/OSAtomic.h> - #import "GPBBootstrap.h" typedef struct GPBMessage_Storage { diff --git a/third_party/protobuf/objectivec/GPBProtocolBuffers.h b/third_party/protobuf/objectivec/GPBProtocolBuffers.h index fd38fde30c734..b7f3605d728a1 100644 --- a/third_party/protobuf/objectivec/GPBProtocolBuffers.h +++ b/third_party/protobuf/objectivec/GPBProtocolBuffers.h @@ -18,7 +18,6 @@ #import "GPBMessage.h" #import "GPBRootObject.h" #import "GPBUnknownField.h" -#import "GPBUnknownFieldSet.h" #import "GPBUnknownFields.h" #import "GPBUtilities.h" #import "GPBWellKnownTypes.h" diff --git a/third_party/protobuf/objectivec/GPBProtocolBuffers.m b/third_party/protobuf/objectivec/GPBProtocolBuffers.m index 07cd4003c62ee..753dee99129f6 100644 --- a/third_party/protobuf/objectivec/GPBProtocolBuffers.m +++ b/third_party/protobuf/objectivec/GPBProtocolBuffers.m @@ -25,7 +25,6 @@ #import "GPBMessage.m" #import "GPBRootObject.m" #import "GPBUnknownField.m" -#import "GPBUnknownFieldSet.m" #import "GPBUnknownFields.m" #import "GPBUtilities.m" #import "GPBWellKnownTypes.m" diff --git a/third_party/protobuf/objectivec/GPBRuntimeTypes.h b/third_party/protobuf/objectivec/GPBRuntimeTypes.h index 440628a34268f..0f59c133fc605 100644 --- a/third_party/protobuf/objectivec/GPBRuntimeTypes.h +++ b/third_party/protobuf/objectivec/GPBRuntimeTypes.h @@ -17,11 +17,6 @@ * */ typedef BOOL (*GPBEnumValidationFunc)(int32_t); -/** - * Fetches an EnumDescriptor. - * */ -typedef GPBEnumDescriptor *(*GPBEnumDescriptorFunc)(void); - /** * Magic value used at runtime to indicate an enum value that wasn't know at * compile time. @@ -102,15 +97,6 @@ typedef NS_ENUM(uint8_t, GPBDataType) { GPBDataTypeEnum, }; -enum { - /** - * A count of the number of types in GPBDataType. Separated out from the - * GPBDataType enum to avoid warnings regarding not handling GPBDataType_Count - * in switch statements. - **/ - GPBDataType_Count = GPBDataTypeEnum + 1 -}; - /** An extension range. */ typedef struct GPBExtensionRange { /** Inclusive. */ @@ -118,10 +104,3 @@ typedef struct GPBExtensionRange { /** Exclusive. */ uint32_t end; } GPBExtensionRange; - -/** - A type to represent an Objective C class. - This is actually an `objc_class` but the runtime headers will not allow us to - reference `objc_class`, so we have defined our own. -*/ -typedef struct GPBObjcClass_t GPBObjcClass_t; diff --git a/third_party/protobuf/objectivec/GPBUnknownField+Additions.swift b/third_party/protobuf/objectivec/GPBUnknownField+Additions.swift index 8e2040b2eefb2..0be181554d756 100644 --- a/third_party/protobuf/objectivec/GPBUnknownField+Additions.swift +++ b/third_party/protobuf/objectivec/GPBUnknownField+Additions.swift @@ -18,8 +18,6 @@ extension GPBUnknownField { } /// The value of the field in a type-safe manner. - /// - /// - Note: This is only valid for non-legacy fields. public var value: Value { switch type { case .varint: @@ -32,8 +30,6 @@ extension GPBUnknownField { return .lengthDelimited(lengthDelimited) case .group: return .group(group) - case .legacy: - fatalError("`value` not valid for Legacy fields.") @unknown default: fatalError("Internal error: Unknown field type: \(type)") } diff --git a/third_party/protobuf/objectivec/GPBUnknownField.h b/third_party/protobuf/objectivec/GPBUnknownField.h index e4dd0596fa5cb..0b1b922692481 100644 --- a/third_party/protobuf/objectivec/GPBUnknownField.h +++ b/third_party/protobuf/objectivec/GPBUnknownField.h @@ -8,10 +8,8 @@ #import <Foundation/Foundation.h> #import "GPBArray.h" -#import "GPBUnknownFieldSet.h" #import "GPBUnknownFields.h" -@class GPBUnknownFieldSet; @class GPBUnknownFields; NS_ASSUME_NONNULL_BEGIN @@ -22,13 +20,6 @@ typedef NS_ENUM(uint8_t, GPBUnknownFieldType) { GPBUnknownFieldTypeFixed64, GPBUnknownFieldTypeLengthDelimited, // Length prefixed GPBUnknownFieldTypeGroup, // Tag delimited - - /** - * This type is only used with fields from `GPBUnknownFieldsSet`. Some methods - * only work with instances with this type and other apis require the other - * type(s). It is a programming error to use the wrong methods. - **/ - GPBUnknownFieldTypeLegacy, }; /** @@ -37,11 +28,6 @@ typedef NS_ENUM(uint8_t, GPBUnknownFieldType) { __attribute__((objc_subclassing_restricted)) @interface GPBUnknownField : NSObject<NSCopying> -/** Initialize a field with the given number. */ -- (instancetype)initWithNumber:(int32_t)number - __attribute__((deprecated( - "Use the apis on GPBUnknownFields to add new fields instead of making them directly."))); - /** The field number the data is stored under. */ @property(nonatomic, readonly, assign) int32_t number; @@ -84,106 +70,6 @@ __attribute__((objc_subclassing_restricted)) */ @property(nonatomic, readonly, strong, nonnull) GPBUnknownFields *group; -/** - * An array of varint values for this field. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - */ -@property(nonatomic, readonly, strong) GPBUInt64Array *varintList - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * An array of fixed32 values for this field. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - */ -@property(nonatomic, readonly, strong) GPBUInt32Array *fixed32List - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * An array of fixed64 values for this field. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - */ -@property(nonatomic, readonly, strong) GPBUInt64Array *fixed64List - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * An array of data values for this field. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - */ -@property(nonatomic, readonly, strong) NSArray<NSData *> *lengthDelimitedList - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * An array of groups of values for this field. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - */ -@property(nonatomic, readonly, strong) NSArray<GPBUnknownFieldSet *> *groupList - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * Add a value to the varintList. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - * - * @param value The value to add. - **/ -- (void)addVarint:(uint64_t)value - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * Add a value to the fixed32List. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - * - * @param value The value to add. - **/ -- (void)addFixed32:(uint32_t)value - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * Add a value to the fixed64List. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - * - * @param value The value to add. - **/ -- (void)addFixed64:(uint64_t)value - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * Add a value to the lengthDelimitedList. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - * - * @param value The value to add. - **/ -- (void)addLengthDelimited:(NSData *)value - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - -/** - * Add a value to the groupList. - * - * Only valid for type == GPBUnknownFieldTypeLegacy, it is a programming error - * to use with any other type. - * - * @param value The value to add. - **/ -- (void)addGroup:(GPBUnknownFieldSet *)value - __attribute__((deprecated("See the new apis on GPBUnknownFields and thus reduced api here."))); - @end NS_ASSUME_NONNULL_END diff --git a/third_party/protobuf/objectivec/GPBUnknownField.m b/third_party/protobuf/objectivec/GPBUnknownField.m index 3614bdf3acc7e..d6ef65908cd88 100644 --- a/third_party/protobuf/objectivec/GPBUnknownField.m +++ b/third_party/protobuf/objectivec/GPBUnknownField.m @@ -8,10 +8,8 @@ #import "GPBUnknownField.h" #import "GPBUnknownField_PackagePrivate.h" -#import "GPBArray.h" #import "GPBCodedOutputStream.h" #import "GPBCodedOutputStream_PackagePrivate.h" -#import "GPBUnknownFieldSet.h" #import "GPBUnknownFields.h" #import "GPBUnknownFields_PackagePrivate.h" #import "GPBWireFormat.h" @@ -27,14 +25,6 @@ @synthesize number = number_; @synthesize type = type_; -- (instancetype)initWithNumber:(int32_t)number { - if ((self = [super init])) { - number_ = number; - type_ = GPBUnknownFieldTypeLegacy; - } - return self; -} - - (instancetype)initWithNumber:(int32_t)number varint:(uint64_t)varint { if ((self = [super init])) { number_ = number; @@ -93,13 +83,6 @@ case GPBUnknownFieldTypeGroup: [storage_.group release]; break; - case GPBUnknownFieldTypeLegacy: - [storage_.legacy.mutableVarintList release]; - [storage_.legacy.mutableFixed32List release]; - [storage_.legacy.mutableFixed64List release]; - [storage_.legacy.mutableLengthDelimitedList release]; - [storage_.legacy.mutableGroupList release]; - break; } [super dealloc]; @@ -136,31 +119,6 @@ return storage_.group; } -- (GPBUInt64Array *)varintList { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - return storage_.legacy.mutableVarintList; -} - -- (GPBUInt32Array *)fixed32List { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - return storage_.legacy.mutableFixed32List; -} - -- (GPBUInt64Array *)fixed64List { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - return storage_.legacy.mutableFixed64List; -} - -- (NSArray<NSData *> *)lengthDelimitedList { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - return storage_.legacy.mutableLengthDelimitedList; -} - -- (NSArray<GPBUnknownFieldSet *> *)groupList { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - return storage_.legacy.mutableGroupList; -} - - (id)copyWithZone:(NSZone *)zone { switch (type_) { case GPBUnknownFieldTypeVarint: @@ -178,30 +136,6 @@ [copyGroup release]; return copy; } - case GPBUnknownFieldTypeLegacy: { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownField *result = [[GPBUnknownField allocWithZone:zone] initWithNumber:number_]; - result->storage_.legacy.mutableFixed32List = - [storage_.legacy.mutableFixed32List copyWithZone:zone]; - result->storage_.legacy.mutableFixed64List = - [storage_.legacy.mutableFixed64List copyWithZone:zone]; - result->storage_.legacy.mutableLengthDelimitedList = - [storage_.legacy.mutableLengthDelimitedList mutableCopyWithZone:zone]; - result->storage_.legacy.mutableVarintList = - [storage_.legacy.mutableVarintList copyWithZone:zone]; - if (storage_.legacy.mutableGroupList.count) { - result->storage_.legacy.mutableGroupList = [[NSMutableArray allocWithZone:zone] - initWithCapacity:storage_.legacy.mutableGroupList.count]; - for (GPBUnknownFieldSet *group in storage_.legacy.mutableGroupList) { - GPBUnknownFieldSet *copied = [group copyWithZone:zone]; - [result->storage_.legacy.mutableGroupList addObject:copied]; - [copied release]; - } - } -#pragma clang diagnostic pop - return result; - } } } @@ -220,34 +154,6 @@ return [storage_.lengthDelimited isEqual:field->storage_.lengthDelimited]; case GPBUnknownFieldTypeGroup: return [storage_.group isEqual:field->storage_.group]; - case GPBUnknownFieldTypeLegacy: { - BOOL equalVarint = - (storage_.legacy.mutableVarintList.count == 0 && - field->storage_.legacy.mutableVarintList.count == 0) || - [storage_.legacy.mutableVarintList isEqual:field->storage_.legacy.mutableVarintList]; - if (!equalVarint) return NO; - BOOL equalFixed32 = - (storage_.legacy.mutableFixed32List.count == 0 && - field->storage_.legacy.mutableFixed32List.count == 0) || - [storage_.legacy.mutableFixed32List isEqual:field->storage_.legacy.mutableFixed32List]; - if (!equalFixed32) return NO; - BOOL equalFixed64 = - (storage_.legacy.mutableFixed64List.count == 0 && - field->storage_.legacy.mutableFixed64List.count == 0) || - [storage_.legacy.mutableFixed64List isEqual:field->storage_.legacy.mutableFixed64List]; - if (!equalFixed64) return NO; - BOOL equalLDList = (storage_.legacy.mutableLengthDelimitedList.count == 0 && - field->storage_.legacy.mutableLengthDelimitedList.count == 0) || - [storage_.legacy.mutableLengthDelimitedList - isEqual:field->storage_.legacy.mutableLengthDelimitedList]; - if (!equalLDList) return NO; - BOOL equalGroupList = - (storage_.legacy.mutableGroupList.count == 0 && - field->storage_.legacy.mutableGroupList.count == 0) || - [storage_.legacy.mutableGroupList isEqual:field->storage_.legacy.mutableGroupList]; - if (!equalGroupList) return NO; - return YES; - } } } @@ -265,89 +171,6 @@ break; case GPBUnknownFieldTypeGroup: result = prime * result + [storage_.group hash]; - case GPBUnknownFieldTypeLegacy: - result = prime * result + [storage_.legacy.mutableVarintList hash]; - result = prime * result + [storage_.legacy.mutableFixed32List hash]; - result = prime * result + [storage_.legacy.mutableFixed64List hash]; - result = prime * result + [storage_.legacy.mutableLengthDelimitedList hash]; - result = prime * result + [storage_.legacy.mutableGroupList hash]; - break; - } - return result; -} - -- (void)writeToOutput:(GPBCodedOutputStream *)output { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - NSUInteger count = storage_.legacy.mutableVarintList.count; - if (count > 0) { - [output writeUInt64Array:number_ values:storage_.legacy.mutableVarintList tag:0]; - } - count = storage_.legacy.mutableFixed32List.count; - if (count > 0) { - [output writeFixed32Array:number_ values:storage_.legacy.mutableFixed32List tag:0]; - } - count = storage_.legacy.mutableFixed64List.count; - if (count > 0) { - [output writeFixed64Array:number_ values:storage_.legacy.mutableFixed64List tag:0]; - } - count = storage_.legacy.mutableLengthDelimitedList.count; - if (count > 0) { - [output writeBytesArray:number_ values:storage_.legacy.mutableLengthDelimitedList]; - } - count = storage_.legacy.mutableGroupList.count; - if (count > 0) { - [output writeUnknownGroupArray:number_ values:storage_.legacy.mutableGroupList]; - } -#pragma clang diagnostic pop -} - -- (size_t)serializedSize { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - __block size_t result = 0; - int32_t number = number_; - [storage_.legacy.mutableVarintList - enumerateValuesWithBlock:^(uint64_t value, __unused NSUInteger idx, __unused BOOL *stop) { - result += GPBComputeUInt64Size(number, value); - }]; - - [storage_.legacy.mutableFixed32List - enumerateValuesWithBlock:^(uint32_t value, __unused NSUInteger idx, __unused BOOL *stop) { - result += GPBComputeFixed32Size(number, value); - }]; - - [storage_.legacy.mutableFixed64List - enumerateValuesWithBlock:^(uint64_t value, __unused NSUInteger idx, __unused BOOL *stop) { - result += GPBComputeFixed64Size(number, value); - }]; - - for (NSData *data in storage_.legacy.mutableLengthDelimitedList) { - result += GPBComputeBytesSize(number, data); - } - - for (GPBUnknownFieldSet *set in storage_.legacy.mutableGroupList) { - result += GPBComputeUnknownGroupSize(number, set); - } -#pragma clang diagnostic pop - - return result; -} - -- (void)writeAsMessageSetExtensionToOutput:(GPBCodedOutputStream *)output { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - for (NSData *data in storage_.legacy.mutableLengthDelimitedList) { - [output writeRawMessageSetExtension:number_ value:data]; - } -} - -- (size_t)serializedSizeAsMessageSetExtension { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - size_t result = 0; - for (NSData *data in storage_.legacy.mutableLengthDelimitedList) { - result += GPBComputeRawMessageSetExtensionSize(number_, data); } return result; } @@ -371,137 +194,10 @@ case GPBUnknownFieldTypeGroup: [description appendFormat:@" group: %@", storage_.group]; break; - case GPBUnknownFieldTypeLegacy: -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [description appendString:@" {\n"]; - [storage_.legacy.mutableVarintList - enumerateValuesWithBlock:^(uint64_t value, __unused NSUInteger idx, __unused BOOL *stop) { - [description appendFormat:@"\t%llu\n", value]; - }]; - [storage_.legacy.mutableFixed32List - enumerateValuesWithBlock:^(uint32_t value, __unused NSUInteger idx, __unused BOOL *stop) { - [description appendFormat:@"\t%u\n", value]; - }]; - [storage_.legacy.mutableFixed64List - enumerateValuesWithBlock:^(uint64_t value, __unused NSUInteger idx, __unused BOOL *stop) { - [description appendFormat:@"\t%llu\n", value]; - }]; - for (NSData *data in storage_.legacy.mutableLengthDelimitedList) { - [description appendFormat:@"\t%@\n", data]; - } - for (GPBUnknownFieldSet *set in storage_.legacy.mutableGroupList) { - [description appendFormat:@"\t%@\n", set]; - } - [description appendString:@"}"]; -#pragma clang diagnostic pop - break; } return description; } -- (void)mergeFromField:(GPBUnknownField *)other { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - GPBUInt64Array *otherVarintList = other.varintList; - if (otherVarintList.count > 0) { - if (storage_.legacy.mutableVarintList == nil) { - storage_.legacy.mutableVarintList = [otherVarintList copy]; - } else { - [storage_.legacy.mutableVarintList addValuesFromArray:otherVarintList]; - } - } - - GPBUInt32Array *otherFixed32List = other.fixed32List; - if (otherFixed32List.count > 0) { - if (storage_.legacy.mutableFixed32List == nil) { - storage_.legacy.mutableFixed32List = [otherFixed32List copy]; - } else { - [storage_.legacy.mutableFixed32List addValuesFromArray:otherFixed32List]; - } - } - - GPBUInt64Array *otherFixed64List = other.fixed64List; - if (otherFixed64List.count > 0) { - if (storage_.legacy.mutableFixed64List == nil) { - storage_.legacy.mutableFixed64List = [otherFixed64List copy]; - } else { - [storage_.legacy.mutableFixed64List addValuesFromArray:otherFixed64List]; - } - } - - NSArray *otherLengthDelimitedList = other.lengthDelimitedList; - if (otherLengthDelimitedList.count > 0) { - if (storage_.legacy.mutableLengthDelimitedList == nil) { - storage_.legacy.mutableLengthDelimitedList = [otherLengthDelimitedList mutableCopy]; - } else { - [storage_.legacy.mutableLengthDelimitedList addObjectsFromArray:otherLengthDelimitedList]; - } - } - - NSArray *otherGroupList = other.groupList; - if (otherGroupList.count > 0) { - if (storage_.legacy.mutableGroupList == nil) { - storage_.legacy.mutableGroupList = - [[NSMutableArray alloc] initWithCapacity:otherGroupList.count]; - } - // Make our own mutable copies. - for (GPBUnknownFieldSet *group in otherGroupList) { - GPBUnknownFieldSet *copied = [group copy]; - [storage_.legacy.mutableGroupList addObject:copied]; - [copied release]; - } - } -#pragma clang diagnostic pop -} - -- (void)addVarint:(uint64_t)value { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - if (storage_.legacy.mutableVarintList == nil) { - storage_.legacy.mutableVarintList = [[GPBUInt64Array alloc] initWithValues:&value count:1]; - } else { - [storage_.legacy.mutableVarintList addValue:value]; - } -} - -- (void)addFixed32:(uint32_t)value { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - if (storage_.legacy.mutableFixed32List == nil) { - storage_.legacy.mutableFixed32List = [[GPBUInt32Array alloc] initWithValues:&value count:1]; - } else { - [storage_.legacy.mutableFixed32List addValue:value]; - } -} - -- (void)addFixed64:(uint64_t)value { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - if (storage_.legacy.mutableFixed64List == nil) { - storage_.legacy.mutableFixed64List = [[GPBUInt64Array alloc] initWithValues:&value count:1]; - } else { - [storage_.legacy.mutableFixed64List addValue:value]; - } -} - -- (void)addLengthDelimited:(NSData *)value { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - if (storage_.legacy.mutableLengthDelimitedList == nil) { - storage_.legacy.mutableLengthDelimitedList = [[NSMutableArray alloc] initWithObjects:&value - count:1]; - } else { - [storage_.legacy.mutableLengthDelimitedList addObject:value]; - } -} - -- (void)addGroup:(GPBUnknownFieldSet *)value { - ASSERT_FIELD_TYPE(GPBUnknownFieldTypeLegacy); - if (storage_.legacy.mutableGroupList == nil) { - storage_.legacy.mutableGroupList = [[NSMutableArray alloc] initWithObjects:&value count:1]; - } else { - [storage_.legacy.mutableGroupList addObject:value]; - } -} - #pragma clang diagnostic pop @end diff --git a/third_party/protobuf/objectivec/GPBUnknownFieldSet.h b/third_party/protobuf/objectivec/GPBUnknownFieldSet.h deleted file mode 100644 index 7807ff0023d7e..0000000000000 --- a/third_party/protobuf/objectivec/GPBUnknownFieldSet.h +++ /dev/null @@ -1,61 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#import <Foundation/Foundation.h> - -#import "GPBUnknownField.h" - -@class GPBUnknownField; - -NS_ASSUME_NONNULL_BEGIN - -/** - * A collection of unknown fields. Fields parsed from the binary representation - * of a message that are unknown end up in an instance of this set. - **/ -__attribute__((deprecated("Use GPBUnknownFields instead.", "GPBUnknownFields"))) -__attribute__((objc_subclassing_restricted)) -@interface GPBUnknownFieldSet : NSObject<NSCopying> - -/** - * Tests to see if the given field number has a value. - * - * @param number The field number to check. - * - * @return YES if there is an unknown field for the given field number. - **/ -- (BOOL)hasField:(int32_t)number; - -/** - * Fetches the GPBUnknownField for the given field number. - * - * @param number The field number to look up. - * - * @return The GPBUnknownField or nil if none found. - **/ -- (nullable GPBUnknownField *)getField:(int32_t)number; - -/** - * @return The number of fields in this set. - **/ -- (NSUInteger)countOfFields; - -/** - * Adds the given field to the set. - * - * @param field The field to add to the set. - **/ -- (void)addField:(GPBUnknownField *)field; - -/** - * @return An array of the GPBUnknownFields sorted by the field numbers. - **/ -- (NSArray<GPBUnknownField *> *)sortedFields; - -@end - -NS_ASSUME_NONNULL_END diff --git a/third_party/protobuf/objectivec/GPBUnknownFieldSet.m b/third_party/protobuf/objectivec/GPBUnknownFieldSet.m deleted file mode 100644 index 6a294cd5d9338..0000000000000 --- a/third_party/protobuf/objectivec/GPBUnknownFieldSet.m +++ /dev/null @@ -1,348 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#import "GPBUnknownFieldSet.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" - -#import "GPBCodedInputStream.h" -#import "GPBCodedInputStream_PackagePrivate.h" -#import "GPBCodedOutputStream.h" -#import "GPBUnknownField.h" -#import "GPBUnknownField_PackagePrivate.h" -#import "GPBUtilities.h" -#import "GPBWireFormat.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#pragma clang diagnostic ignored "-Wdeprecated-implementations" - -#pragma mark Helpers - -static void checkNumber(int32_t number) { - if (number == 0) { - [NSException raise:NSInvalidArgumentException format:@"Zero is not a valid field number."]; - } -} - -@implementation GPBUnknownFieldSet { - @package - CFMutableDictionaryRef fields_; -} - -static void CopyWorker(__unused const void *key, const void *value, void *context) { - GPBUnknownField *field = value; - GPBUnknownFieldSet *result = context; - - GPBUnknownField *copied = [field copy]; - [result addField:copied]; - [copied release]; -} - -// Direct access is use for speed, to avoid even internally declaring things -// read/write, etc. The warning is enabled in the project to ensure code calling -// protos can turn on -Wdirect-ivar-access without issues. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdirect-ivar-access" - -- (id)copyWithZone:(NSZone *)zone { - GPBUnknownFieldSet *result = [[GPBUnknownFieldSet allocWithZone:zone] init]; - if (fields_) { - CFDictionaryApplyFunction(fields_, CopyWorker, result); - } - return result; -} - -- (void)dealloc { - if (fields_) { - CFRelease(fields_); - } - [super dealloc]; -} - -- (BOOL)isEqual:(id)object { - BOOL equal = NO; - if ([object isKindOfClass:[GPBUnknownFieldSet class]]) { - GPBUnknownFieldSet *set = (GPBUnknownFieldSet *)object; - if ((fields_ == NULL) && (set->fields_ == NULL)) { - equal = YES; - } else if ((fields_ != NULL) && (set->fields_ != NULL)) { - equal = CFEqual(fields_, set->fields_); - } - } - return equal; -} - -- (NSUInteger)hash { - // Return the hash of the fields dictionary (or just some value). - if (fields_) { - return CFHash(fields_); - } - return (NSUInteger)[GPBUnknownFieldSet class]; -} - -#pragma mark - Public Methods - -- (BOOL)hasField:(int32_t)number { - ssize_t key = number; - return fields_ ? (CFDictionaryGetValue(fields_, (void *)key) != nil) : NO; -} - -- (GPBUnknownField *)getField:(int32_t)number { - ssize_t key = number; - GPBUnknownField *result = fields_ ? CFDictionaryGetValue(fields_, (void *)key) : nil; - return result; -} - -- (NSUInteger)countOfFields { - return fields_ ? CFDictionaryGetCount(fields_) : 0; -} - -- (NSArray *)sortedFields { - if (!fields_) return [NSArray array]; - size_t count = CFDictionaryGetCount(fields_); - ssize_t keys[count]; - GPBUnknownField *values[count]; - CFDictionaryGetKeysAndValues(fields_, (const void **)keys, (const void **)values); - struct GPBFieldPair { - ssize_t key; - GPBUnknownField *value; - } pairs[count]; - for (size_t i = 0; i < count; ++i) { - pairs[i].key = keys[i]; - pairs[i].value = values[i]; - }; - qsort_b(pairs, count, sizeof(struct GPBFieldPair), ^(const void *first, const void *second) { - const struct GPBFieldPair *a = first; - const struct GPBFieldPair *b = second; - return (a->key > b->key) ? 1 : ((a->key == b->key) ? 0 : -1); - }); - for (size_t i = 0; i < count; ++i) { - values[i] = pairs[i].value; - }; - return [NSArray arrayWithObjects:values count:count]; -} - -#pragma mark - Internal Methods - -- (void)writeToCodedOutputStream:(GPBCodedOutputStream *)output { - if (!fields_) return; - size_t count = CFDictionaryGetCount(fields_); - ssize_t keys[count]; - GPBUnknownField *values[count]; - CFDictionaryGetKeysAndValues(fields_, (const void **)keys, (const void **)values); - if (count > 1) { - struct GPBFieldPair { - ssize_t key; - GPBUnknownField *value; - } pairs[count]; - - for (size_t i = 0; i < count; ++i) { - pairs[i].key = keys[i]; - pairs[i].value = values[i]; - }; - qsort_b(pairs, count, sizeof(struct GPBFieldPair), ^(const void *first, const void *second) { - const struct GPBFieldPair *a = first; - const struct GPBFieldPair *b = second; - return (a->key > b->key) ? 1 : ((a->key == b->key) ? 0 : -1); - }); - for (size_t i = 0; i < count; ++i) { - GPBUnknownField *value = pairs[i].value; - [value writeToOutput:output]; - } - } else { - [values[0] writeToOutput:output]; - } -} - -- (NSString *)description { - NSMutableString *description = - [NSMutableString stringWithFormat:@"<%@ %p>: TextFormat: {\n", [self class], self]; - NSString *textFormat = GPBTextFormatForUnknownFieldSet(self, @" "); - [description appendString:textFormat]; - [description appendString:@"}"]; - return description; -} - -static void GPBUnknownFieldSetSerializedSize(__unused const void *key, const void *value, - void *context) { - GPBUnknownField *field = value; - size_t *result = context; - *result += [field serializedSize]; -} - -- (size_t)serializedSize { - size_t result = 0; - if (fields_) { - CFDictionaryApplyFunction(fields_, GPBUnknownFieldSetSerializedSize, &result); - } - return result; -} - -static void GPBUnknownFieldSetWriteAsMessageSetTo(__unused const void *key, const void *value, - void *context) { - GPBUnknownField *field = value; - GPBCodedOutputStream *output = context; - [field writeAsMessageSetExtensionToOutput:output]; -} - -- (void)writeAsMessageSetTo:(GPBCodedOutputStream *)output { - if (fields_) { - CFDictionaryApplyFunction(fields_, GPBUnknownFieldSetWriteAsMessageSetTo, output); - } -} - -static void GPBUnknownFieldSetSerializedSizeAsMessageSet(__unused const void *key, - const void *value, void *context) { - GPBUnknownField *field = value; - size_t *result = context; - *result += [field serializedSizeAsMessageSetExtension]; -} - -- (size_t)serializedSizeAsMessageSet { - size_t result = 0; - if (fields_) { - CFDictionaryApplyFunction(fields_, GPBUnknownFieldSetSerializedSizeAsMessageSet, &result); - } - return result; -} - -- (NSData *)data { - NSMutableData *data = [NSMutableData dataWithLength:self.serializedSize]; - GPBCodedOutputStream *output = [[GPBCodedOutputStream alloc] initWithData:data]; - [self writeToCodedOutputStream:output]; - [output flush]; - [output release]; - return data; -} - -- (void)addField:(GPBUnknownField *)field { - int32_t number = [field number]; - checkNumber(number); - if (!fields_) { - // Use a custom dictionary here because the keys are numbers and conversion - // back and forth from NSNumber isn't worth the cost. - fields_ = - CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, &kCFTypeDictionaryValueCallBacks); - } - ssize_t key = number; - CFDictionarySetValue(fields_, (const void *)key, field); -} - -- (GPBUnknownField *)mutableFieldForNumber:(int32_t)number create:(BOOL)create { - ssize_t key = number; - GPBUnknownField *existing = fields_ ? CFDictionaryGetValue(fields_, (const void *)key) : nil; - if (!existing && create) { - existing = [[GPBUnknownField alloc] initWithNumber:number]; - // This retains existing. - [self addField:existing]; - [existing release]; - } - return existing; -} - -static void GPBUnknownFieldSetMergeUnknownFields(__unused const void *key, const void *value, - void *context) { - GPBUnknownField *field = value; - GPBUnknownFieldSet *self = context; - - int32_t number = [field number]; - checkNumber(number); - GPBUnknownField *oldField = [self mutableFieldForNumber:number create:NO]; - if (oldField) { - [oldField mergeFromField:field]; - } else { - // Merge only comes from GPBMessage's mergeFrom:, so it means we are on - // mutable message and are an mutable instance, so make sure we need - // mutable fields. - GPBUnknownField *fieldCopy = [field copy]; - [self addField:fieldCopy]; - [fieldCopy release]; - } -} - -- (void)mergeUnknownFields:(GPBUnknownFieldSet *)other { - if (other && other->fields_) { - CFDictionaryApplyFunction(other->fields_, GPBUnknownFieldSetMergeUnknownFields, self); - } -} - -- (void)mergeVarintField:(int32_t)number value:(int32_t)value { - checkNumber(number); - [[self mutableFieldForNumber:number create:YES] addVarint:value]; -} - -- (void)mergeLengthDelimited:(int32_t)fieldNum value:(NSData *)value { - checkNumber(fieldNum); - [[self mutableFieldForNumber:fieldNum create:YES] addLengthDelimited:value]; -} - -- (BOOL)mergeFieldFrom:(int32_t)tag input:(GPBCodedInputStream *)input { - NSAssert(GPBWireFormatIsValidTag(tag), @"Got passed an invalid tag"); - int32_t number = GPBWireFormatGetTagFieldNumber(tag); - GPBCodedInputStreamState *state = &input->state_; - switch (GPBWireFormatGetTagWireType(tag)) { - case GPBWireFormatVarint: { - GPBUnknownField *field = [self mutableFieldForNumber:number create:YES]; - [field addVarint:GPBCodedInputStreamReadInt64(state)]; - return YES; - } - case GPBWireFormatFixed64: { - GPBUnknownField *field = [self mutableFieldForNumber:number create:YES]; - [field addFixed64:GPBCodedInputStreamReadFixed64(state)]; - return YES; - } - case GPBWireFormatLengthDelimited: { - NSData *data = GPBCodedInputStreamReadRetainedBytes(state); - GPBUnknownField *field = [self mutableFieldForNumber:number create:YES]; - [field addLengthDelimited:data]; - [data release]; - return YES; - } - case GPBWireFormatStartGroup: { - GPBUnknownFieldSet *unknownFieldSet = [[GPBUnknownFieldSet alloc] init]; - GPBUnknownField *field = [self mutableFieldForNumber:number create:YES]; - [field addGroup:unknownFieldSet]; - // The field will now retain unknownFieldSet, so go ahead and release it in case - // -readUnknownGroup:message: throws so it won't be leaked. - [unknownFieldSet release]; - [input readUnknownGroup:number message:unknownFieldSet]; - return YES; - } - case GPBWireFormatEndGroup: - return NO; - case GPBWireFormatFixed32: { - GPBUnknownField *field = [self mutableFieldForNumber:number create:YES]; - [field addFixed32:GPBCodedInputStreamReadFixed32(state)]; - return YES; - } - } -} - -- (void)mergeFromCodedInputStream:(GPBCodedInputStream *)input { - while (YES) { - int32_t tag = GPBCodedInputStreamReadTag(&input->state_); - if (tag == 0 || ![self mergeFieldFrom:tag input:input]) { - break; - } - } -} - -- (void)getTags:(int32_t *)tags { - if (!fields_) return; - size_t count = CFDictionaryGetCount(fields_); - ssize_t keys[count]; - CFDictionaryGetKeysAndValues(fields_, (const void **)keys, NULL); - for (size_t i = 0; i < count; ++i) { - tags[i] = (int32_t)keys[i]; - } -} - -#pragma clang diagnostic pop - -@end - -#pragma clang diagnostic pop // -Wdeprecated-declarations suppression diff --git a/third_party/protobuf/objectivec/GPBUnknownFieldSet_PackagePrivate.h b/third_party/protobuf/objectivec/GPBUnknownFieldSet_PackagePrivate.h deleted file mode 100644 index 0428fbb9b3cac..0000000000000 --- a/third_party/protobuf/objectivec/GPBUnknownFieldSet_PackagePrivate.h +++ /dev/null @@ -1,32 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#import <Foundation/Foundation.h> - -#import "GPBCodedInputStream.h" -#import "GPBCodedOutputStream.h" -#import "GPBUnknownFieldSet.h" - -@interface GPBUnknownFieldSet () - -- (NSData *)data; - -- (size_t)serializedSize; -- (size_t)serializedSizeAsMessageSet; - -- (void)writeToCodedOutputStream:(GPBCodedOutputStream *)output; -- (void)writeAsMessageSetTo:(GPBCodedOutputStream *)output; - -- (void)mergeUnknownFields:(GPBUnknownFieldSet *)other; - -- (void)mergeFromCodedInputStream:(GPBCodedInputStream *)input; - -- (void)mergeVarintField:(int32_t)number value:(int32_t)value; -- (void)mergeLengthDelimited:(int32_t)number value:(NSData *)value; -- (BOOL)mergeFieldFrom:(int32_t)tag input:(GPBCodedInputStream *)input; - -@end diff --git a/third_party/protobuf/objectivec/GPBUnknownField_PackagePrivate.h b/third_party/protobuf/objectivec/GPBUnknownField_PackagePrivate.h index dde6548805a57..e7aa1642f7c7d 100644 --- a/third_party/protobuf/objectivec/GPBUnknownField_PackagePrivate.h +++ b/third_party/protobuf/objectivec/GPBUnknownField_PackagePrivate.h @@ -9,10 +9,6 @@ #import "GPBUnknownField.h" -#import "GPBArray.h" - -@class GPBCodedOutputStream; - @interface GPBUnknownField () { @package int32_t number_; @@ -22,16 +18,6 @@ uint64_t intValue; // type == Varint, Fixed32, Fixed64 NSData *_Nonnull lengthDelimited; // type == LengthDelimited GPBUnknownFields *_Nonnull group; // type == Group - struct { // type == Legacy - GPBUInt64Array *_Null_unspecified mutableVarintList; - GPBUInt32Array *_Null_unspecified mutableFixed32List; - GPBUInt64Array *_Null_unspecified mutableFixed64List; - NSMutableArray<NSData *> *_Null_unspecified mutableLengthDelimitedList; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - NSMutableArray<GPBUnknownFieldSet *> *_Null_unspecified mutableGroupList; -#pragma clang diagnostic pop - } legacy; } storage_; } @@ -41,12 +27,4 @@ - (nonnull instancetype)initWithNumber:(int32_t)number lengthDelimited:(nonnull NSData *)data; - (nonnull instancetype)initWithNumber:(int32_t)number group:(nonnull GPBUnknownFields *)group; -- (void)writeToOutput:(nonnull GPBCodedOutputStream *)output; -- (size_t)serializedSize; - -- (void)writeAsMessageSetExtensionToOutput:(nonnull GPBCodedOutputStream *)output; -- (size_t)serializedSizeAsMessageSetExtension; - -- (void)mergeFromField:(nonnull GPBUnknownField *)other; - @end diff --git a/third_party/protobuf/objectivec/GPBUnknownFields.h b/third_party/protobuf/objectivec/GPBUnknownFields.h index 17ffc2def47a2..0e33e6d1cfcf0 100644 --- a/third_party/protobuf/objectivec/GPBUnknownFields.h +++ b/third_party/protobuf/objectivec/GPBUnknownFields.h @@ -121,8 +121,6 @@ __attribute__((objc_subclassing_restricted)) * the `.group` of that result is also new, so if you intent is to modify the group * it *must* be fetched out of the result. * - * It is a programming error to call this when the `type` is a legacy field. - * * @param field The field to add. * * @return The autoreleased field that was added. diff --git a/third_party/protobuf/objectivec/GPBUnknownFields.m b/third_party/protobuf/objectivec/GPBUnknownFields.m index 0c53a724f6802..7b5c515c5093a 100644 --- a/third_party/protobuf/objectivec/GPBUnknownFields.m +++ b/third_party/protobuf/objectivec/GPBUnknownFields.m @@ -18,8 +18,6 @@ #import "GPBMessage.h" #import "GPBMessage_PackagePrivate.h" #import "GPBUnknownField.h" -#import "GPBUnknownFieldSet.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUnknownField_PackagePrivate.h" #import "GPBWireFormat.h" @@ -66,11 +64,6 @@ static size_t ComputeSerializeSize(GPBUnknownFields *_Nonnull self) { result += (GPBComputeTagSize(fieldNumber) * 2) + ComputeSerializeSize(field->storage_.group); break; - case GPBUnknownFieldTypeLegacy: -#if defined(DEBUG) && DEBUG - NSCAssert(NO, @"Internal error within the library"); -#endif - break; } } return result; @@ -99,11 +92,6 @@ static void WriteToCoddedOutputStream(GPBUnknownFields *_Nonnull self, WriteToCoddedOutputStream(field->storage_.group, output); [output writeRawVarint32:GPBWireFormatMakeTag(fieldNumber, GPBWireFormatEndGroup)]; break; - case GPBUnknownFieldTypeLegacy: -#if defined(DEBUG) && DEBUG - NSCAssert(NO, @"Internal error within the library"); -#endif - break; } } } @@ -326,10 +314,6 @@ static BOOL MergeFromInputStream(GPBUnknownFields *self, GPBCodedInputStream *in } - (GPBUnknownField *)addCopyOfField:(nonnull GPBUnknownField *)field { - if (field->type_ == GPBUnknownFieldTypeLegacy) { - [NSException raise:NSInternalInconsistencyException - format:@"GPBUnknownField is the wrong type"]; - } GPBUnknownField *result = [field copy]; [fields_ addObject:result]; return [result autorelease]; diff --git a/third_party/protobuf/objectivec/GPBUtilities.h b/third_party/protobuf/objectivec/GPBUtilities.h index d317a3ba38b78..d9461eb26dcb4 100644 --- a/third_party/protobuf/objectivec/GPBUtilities.h +++ b/third_party/protobuf/objectivec/GPBUtilities.h @@ -28,21 +28,6 @@ NS_ASSUME_NONNULL_BEGIN **/ NSString *GPBTextFormatForMessage(GPBMessage *message, NSString *__nullable lineIndent); -/** - * Generates a string that should be a valid "TextFormat" for the C++ version - * of Protocol Buffers. - * - * @param unknownSet The unknown field set to generate from. - * @param lineIndent A string to use as the prefix for all lines generated. Can - * be nil if no extra indent is needed. - * - * @return An NSString with the TextFormat of the unknown field set. - **/ -NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet *__nullable unknownSet, - NSString *__nullable lineIndent) - __attribute__((deprecated("Use GPBTextFormatForMessage will include the unknown fields, and " - "GPBUnknownFieldSet it going away."))); - /** * Checks if the given field number is set on a message. * diff --git a/third_party/protobuf/objectivec/GPBUtilities.m b/third_party/protobuf/objectivec/GPBUtilities.m index 56db2f312652e..64f5be42bc8c8 100644 --- a/third_party/protobuf/objectivec/GPBUtilities.m +++ b/third_party/protobuf/objectivec/GPBUtilities.m @@ -18,7 +18,6 @@ #import "GPBMessage.h" #import "GPBMessage_PackagePrivate.h" #import "GPBUnknownField.h" -#import "GPBUnknownFieldSet.h" #import "GPBUnknownField_PackagePrivate.h" #import "GPBUnknownFields.h" #import "GPBUtilities.h" @@ -211,14 +210,6 @@ void GPBCheckRuntimeVersionSupport(int32_t objcRuntimeVersion) { @" supports back to %d!", objcRuntimeVersion, GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION]; } -#if defined(DEBUG) && DEBUG - if (objcRuntimeVersion < GOOGLE_PROTOBUF_OBJC_VERSION) { - // This is a version we haven't generated for yet. - NSLog(@"WARNING: Code from generated Objective-C proto from an older version of the library is " - @"being used. Please regenerate with the current version as the code will stop working " - @"in a future release."); - } -#endif } void GPBRuntimeMatchFailure(void) { @@ -228,20 +219,6 @@ void GPBRuntimeMatchFailure(void) { GOOGLE_PROTOBUF_OBJC_VERSION]; } -// This api is no longer used for version checks. 30001 is the last version -// using this old versioning model. When that support is removed, this function -// can be removed (along with the declaration in GPBUtilities_PackagePrivate.h). -void GPBCheckRuntimeVersionInternal(int32_t version) { - GPBInternalCompileAssert(GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION <= 30001, - time_to_remove_this_old_version_shim); - if (version != GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION) { - [NSException raise:NSInternalInconsistencyException - format:@"Linked to ProtocolBuffer runtime version %d," - @" but code compiled with version %d!", - GOOGLE_PROTOBUF_OBJC_GEN_VERSION, version]; - } -} - BOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber) { GPBDescriptor *descriptor = [self descriptor]; GPBFieldDescriptor *field = [descriptor fieldWithNumber:fieldNumber]; @@ -300,7 +277,7 @@ BOOL GPBGetHasIvar(GPBMessage *self, int32_t idx, uint32_t fieldNumber) { return hasIvar; } else { NSCAssert(idx != GPBNoHasBit, @"Invalid has bit."); - uint32_t byteIndex = idx / 32; + uint32_t byteIndex = (uint32_t)idx / 32; uint32_t bitMask = (1U << (idx % 32)); BOOL hasIvar = (self->messageStorage_->_has_storage_[byteIndex] & bitMask) ? YES : NO; return hasIvar; @@ -321,7 +298,7 @@ void GPBSetHasIvar(GPBMessage *self, int32_t idx, uint32_t fieldNumber, BOOL val } else { NSCAssert(idx != GPBNoHasBit, @"Invalid has bit."); uint32_t *has_storage = self->messageStorage_->_has_storage_; - uint32_t byte = idx / 32; + uint32_t byte = (uint32_t)idx / 32; uint32_t bitMask = (1U << (idx % 32)); if (value) { has_storage[byte] |= bitMask; @@ -669,8 +646,7 @@ int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field) { int32_t result = GPBGetMessageInt32Field(self, field); // If this is presevering unknown enums, make sure the value is valid before // returning it. - - if (!GPBFieldIsClosedEnum(field) && ![field isValidEnumValue:result]) { + if (!field.enumDescriptor.isClosed && ![field isValidEnumValue:result]) { result = kGPBUnrecognizedEnumeratorValue; } return result; @@ -1894,7 +1870,7 @@ static void AppendTextFormatForMessageExtensionRange(GPBMessage *message, NSArra FIELD_CASE(Int32, int32_t, intValue, @"%d") FIELD_CASE(SInt32, int32_t, intValue, @"%d") - FIELD_CASE(SFixed32, int32_t, unsignedIntValue, @"%d") + FIELD_CASE(SFixed32, int32_t, intValue, @"%d") FIELD_CASE(UInt32, uint32_t, unsignedIntValue, @"%u") FIELD_CASE(Fixed32, uint32_t, unsignedIntValue, @"%u") FIELD_CASE(Int64, int64_t, longLongValue, @"%lld") @@ -2004,13 +1980,6 @@ static void AppendTextFormatForUnknownFields(GPBUnknownFields *ufs, NSMutableStr [toStr appendFormat:@"%@}\n", lineIndent]; } } break; - case GPBUnknownFieldTypeLegacy: -#if defined(DEBUG) && DEBUG - NSCAssert( - NO, - @"Internal error: Shouldn't have gotten a legacy field type in the unknown fields."); -#endif - break; } } [subIndent release]; @@ -2056,45 +2025,6 @@ NSString *GPBTextFormatForMessage(GPBMessage *message, NSString *lineIndent) { return buildString; } -NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet *unknownSet, NSString *lineIndent) { - if (unknownSet == nil) return @""; - if (lineIndent == nil) lineIndent = @""; - - NSMutableString *result = [NSMutableString string]; - for (GPBUnknownField *field in [unknownSet sortedFields]) { - int32_t fieldNumber = [field number]; - -#define PRINT_LOOP(PROPNAME, CTYPE, FORMAT) \ - [field.PROPNAME \ - enumerateValuesWithBlock:^(CTYPE value, __unused NSUInteger idx, __unused BOOL * stop) { \ - [result appendFormat:@"%@%d: " FORMAT "\n", lineIndent, fieldNumber, value]; \ - }]; - - PRINT_LOOP(varintList, uint64_t, "%llu"); - PRINT_LOOP(fixed32List, uint32_t, "0x%X"); - PRINT_LOOP(fixed64List, uint64_t, "0x%llX"); - -#undef PRINT_LOOP - - // NOTE: C++ version of TextFormat tries to parse this as a message - // and print that if it succeeds. - for (NSData *data in field.lengthDelimitedList) { - [result appendFormat:@"%@%d: ", lineIndent, fieldNumber]; - AppendBufferAsString(data, result); - [result appendString:@"\n"]; - } - - for (GPBUnknownFieldSet *subUnknownSet in field.groupList) { - [result appendFormat:@"%@%d: {\n", lineIndent, fieldNumber]; - NSString *subIndent = [lineIndent stringByAppendingString:@" "]; - NSString *subUnknownSetStr = GPBTextFormatForUnknownFieldSet(subUnknownSet, subIndent); - [result appendString:subUnknownSetStr]; - [result appendFormat:@"%@}\n", lineIndent]; - } - } - return result; -} - // Helpers to decode a varint. Not using GPBCodedInputStream version because // that needs a state object, and we don't want to create an input stream out // of the data. @@ -2206,12 +2136,12 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key, NSStri const uint8_t kOpAllUpper = 0b01100000; const uint8_t kSegmentLenMask = 0b00011111; - NSInteger i = 0; + NSUInteger i = 0; for (; *scan != 0; ++scan) { if (*scan & kAddUnderscore) { [result appendString:@"_"]; } - int segmentLen = *scan & kSegmentLenMask; + NSUInteger segmentLen = *scan & kSegmentLenMask; uint8_t decodeOp = *scan & kOpMask; // Do op specific handling of the first character. @@ -2229,7 +2159,7 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key, NSStri // else op == kOpAsIs || op == kOpAllUpper // Now pull over the rest of the length for this segment. - for (int x = 0; x < segmentLen; ++x) { + for (NSUInteger x = 0; x < segmentLen; ++x) { unichar c = [inputStr characterAtIndex:(i + x)]; if (decodeOp == kOpAllUpper) { [result appendFormat:@"%c", toupper((char)c)]; diff --git a/third_party/protobuf/objectivec/GPBUtilities_PackagePrivate.h b/third_party/protobuf/objectivec/GPBUtilities_PackagePrivate.h index e8c8cb52dcfe5..858fd00ea117e 100644 --- a/third_party/protobuf/objectivec/GPBUtilities_PackagePrivate.h +++ b/third_party/protobuf/objectivec/GPBUtilities_PackagePrivate.h @@ -21,6 +21,11 @@ #define GPBNSStringify(S) @ #S #define GPBNSStringifySymbol(S) GPBNSStringify(S) +// A type to represent an Objective C class. +// This is actually an `objc_class` but the runtime headers will not allow us to +// reference `objc_class`, so we have defined our own. +typedef struct GPBObjcClass_t GPBObjcClass_t; + // Macros for generating a Class from a class name. These are used in // the generated GPB descriptor classes wherever an Objective C class // reference is needed for a generated class. @@ -50,19 +55,6 @@ GPB_INLINE void GPB_DEBUG_CHECK_RUNTIME_VERSIONS(void) { // is just a final safety net to prevent otherwise hard to diagnose errors. void GPBRuntimeMatchFailure(void); -// Legacy version of the checks, remove when GOOGLE_PROTOBUF_OBJC_GEN_VERSION -// goes away (see more info in GPBBootstrap.h). -void GPBCheckRuntimeVersionInternal(int32_t version) - __attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))); -__attribute__((deprecated("Please use a newer version of protoc to regenerate your sources. " - "Support for this version will go away in the future."))) GPB_INLINE void -GPBDebugCheckRuntimeVersion(void) { -#if defined(DEBUG) && DEBUG - GPBCheckRuntimeVersionInternal(GOOGLE_PROTOBUF_OBJC_GEN_VERSION); -#endif -} - // Conversion functions for de/serializing floating point types. GPB_INLINE int64_t GPBConvertDoubleToInt64(double v) { @@ -182,9 +174,9 @@ GPB_INLINE BOOL GPBFieldStoresObject(GPBFieldDescriptor *field) { return GPBDataTypeIsObject(desc->dataType); } -BOOL GPBGetHasIvar(GPBMessage *self, int32_t index, uint32_t fieldNumber); +BOOL GPBGetHasIvar(GPBMessage *self, int32_t idx, uint32_t fieldNumber); void GPBSetHasIvar(GPBMessage *self, int32_t idx, uint32_t fieldNumber, BOOL value); -uint32_t GPBGetHasOneof(GPBMessage *self, int32_t index); +uint32_t GPBGetHasOneof(GPBMessage *self, int32_t idx); GPB_INLINE BOOL GPBGetHasIvarField(GPBMessage *self, GPBFieldDescriptor *field) { GPBMessageFieldDescription *fieldDesc = field->description_; diff --git a/third_party/protobuf/objectivec/GPBWellKnownTypes.h b/third_party/protobuf/objectivec/GPBWellKnownTypes.h index 4cf5bcffd8b0c..64a7fb9b3c65f 100644 --- a/third_party/protobuf/objectivec/GPBWellKnownTypes.h +++ b/third_party/protobuf/objectivec/GPBWellKnownTypes.h @@ -88,17 +88,6 @@ typedef NS_ENUM(NSInteger, GPBWellKnownTypesErrorCode) { **/ - (instancetype)initWithTimeInterval:(NSTimeInterval)timeInterval; -// These next two methods are deprecated because GBPDuration has no need of a -// "base" time. The older methods were about symmetry with GBPTimestamp, but -// the unix epoch usage is too confusing. - -/** Deprecated, use timeInterval instead. */ -@property(nonatomic, readwrite) NSTimeInterval timeIntervalSince1970 - __attribute__((deprecated("Use timeInterval"))); -/** Deprecated, use initWithTimeInterval: instead. */ -- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 - __attribute__((deprecated("Use initWithTimeInterval:"))); - @end #pragma mark - GPBAny diff --git a/third_party/protobuf/objectivec/GPBWellKnownTypes.m b/third_party/protobuf/objectivec/GPBWellKnownTypes.m index f725bca896373..d758702ce3beb 100644 --- a/third_party/protobuf/objectivec/GPBWellKnownTypes.m +++ b/third_party/protobuf/objectivec/GPBWellKnownTypes.m @@ -114,10 +114,6 @@ static NSString *ParseTypeFromURL(NSString *typeURLString) { return self; } -- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 { - return [self initWithTimeInterval:timeIntervalSince1970]; -} - - (NSTimeInterval)timeInterval { return TimeIntervalFromSecondsAndNanos(self.seconds, self.nanos); } @@ -129,14 +125,6 @@ static NSString *ParseTypeFromURL(NSString *typeURLString) { self.nanos = nanos; } -- (NSTimeInterval)timeIntervalSince1970 { - return self.timeInterval; -} - -- (void)setTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970 { - self.timeInterval = timeIntervalSince1970; -} - @end #pragma mark - GPBAny diff --git a/third_party/protobuf/objectivec/GPBWireFormat.m b/third_party/protobuf/objectivec/GPBWireFormat.m index 021ea756f32c0..2a069b833fc20 100644 --- a/third_party/protobuf/objectivec/GPBWireFormat.m +++ b/third_party/protobuf/objectivec/GPBWireFormat.m @@ -39,7 +39,7 @@ GPBWireFormat GPBWireFormatForType(GPBDataType type, BOOL isPacked) { return GPBWireFormatLengthDelimited; } - static const GPBWireFormat format[GPBDataType_Count] = { + static const GPBWireFormat format[] = { GPBWireFormatVarint, // GPBDataTypeBool GPBWireFormatFixed32, // GPBDataTypeFixed32 GPBWireFormatFixed32, // GPBDataTypeSFixed32 diff --git a/third_party/protobuf/objectivec/GPBWrappers.pbobjc.h b/third_party/protobuf/objectivec/GPBWrappers.pbobjc.h index b9c46a31e543f..49857769eb60f 100644 --- a/third_party/protobuf/objectivec/GPBWrappers.pbobjc.h +++ b/third_party/protobuf/objectivec/GPBWrappers.pbobjc.h @@ -48,6 +48,9 @@ typedef GPB_ENUM(GPBDoubleValue_FieldNumber) { * Wrapper message for `double`. * * The JSON representation for `DoubleValue` is JSON number. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBDoubleValue : GPBMessage @@ -66,6 +69,9 @@ typedef GPB_ENUM(GPBFloatValue_FieldNumber) { * Wrapper message for `float`. * * The JSON representation for `FloatValue` is JSON number. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBFloatValue : GPBMessage @@ -84,6 +90,9 @@ typedef GPB_ENUM(GPBInt64Value_FieldNumber) { * Wrapper message for `int64`. * * The JSON representation for `Int64Value` is JSON string. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBInt64Value : GPBMessage @@ -102,6 +111,9 @@ typedef GPB_ENUM(GPBUInt64Value_FieldNumber) { * Wrapper message for `uint64`. * * The JSON representation for `UInt64Value` is JSON string. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBUInt64Value : GPBMessage @@ -120,6 +132,9 @@ typedef GPB_ENUM(GPBInt32Value_FieldNumber) { * Wrapper message for `int32`. * * The JSON representation for `Int32Value` is JSON number. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBInt32Value : GPBMessage @@ -138,6 +153,9 @@ typedef GPB_ENUM(GPBUInt32Value_FieldNumber) { * Wrapper message for `uint32`. * * The JSON representation for `UInt32Value` is JSON number. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBUInt32Value : GPBMessage @@ -156,6 +174,9 @@ typedef GPB_ENUM(GPBBoolValue_FieldNumber) { * Wrapper message for `bool`. * * The JSON representation for `BoolValue` is JSON `true` and `false`. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBBoolValue : GPBMessage @@ -174,6 +195,9 @@ typedef GPB_ENUM(GPBStringValue_FieldNumber) { * Wrapper message for `string`. * * The JSON representation for `StringValue` is JSON string. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBStringValue : GPBMessage @@ -192,6 +216,9 @@ typedef GPB_ENUM(GPBBytesValue_FieldNumber) { * Wrapper message for `bytes`. * * The JSON representation for `BytesValue` is JSON string. + * + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. **/ GPB_FINAL @interface GPBBytesValue : GPBMessage diff --git a/third_party/protobuf/objectivec/Tests/GPBCodedInputStreamTests.m b/third_party/protobuf/objectivec/Tests/GPBCodedInputStreamTests.m index e6b0ef6ccc274..81c7e13330446 100644 --- a/third_party/protobuf/objectivec/Tests/GPBCodedInputStreamTests.m +++ b/third_party/protobuf/objectivec/Tests/GPBCodedInputStreamTests.m @@ -12,7 +12,6 @@ #import "GPBCodedOutputStream.h" #import "GPBTestUtilities.h" #import "GPBUnknownField.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUnknownFields.h" #import "GPBUtilities.h" #import "GPBUtilities_PackagePrivate.h" @@ -293,10 +292,6 @@ case GPBUnknownFieldTypeGroup: wireFormat = GPBWireFormatStartGroup; break; - case GPBUnknownFieldTypeLegacy: - XCTFail(@"Legacy field type not expected"); - wireFormat = GPBWireFormatVarint; - break; } uint32_t tag = GPBWireFormatMakeTag(field.number, wireFormat); [fieldNumbers addObject:@(tag)]; @@ -304,23 +299,16 @@ // Check the tags compared to what's in the UnknownFields to confirm the stream is // skipping as expected (this covers the tags within a group also). - GPBCodedInputStream* input1 = [GPBCodedInputStream streamWithData:rawBytes]; GPBCodedInputStream* input2 = [GPBCodedInputStream streamWithData:rawBytes]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet* unknownFields = [[[GPBUnknownFieldSet alloc] init] autorelease]; -#pragma clang diagnostic pop NSUInteger idx = 0; while (YES) { - int32_t tag = [input1 readTag]; - XCTAssertEqual(tag, [input2 readTag]); + int32_t tag = [input2 readTag]; if (tag == 0) { XCTAssertEqual(idx, fieldNumbers.count); break; } XCTAssertEqual(tag, [fieldNumbers[idx] intValue]); - [unknownFields mergeFieldFrom:tag input:input1]; [input2 skipField:tag]; ++idx; } diff --git a/third_party/protobuf/objectivec/Tests/GPBCompileTest10.m b/third_party/protobuf/objectivec/Tests/GPBCompileTest10.m index 0399f93652c70..06b1c773ece26 100644 --- a/third_party/protobuf/objectivec/Tests/GPBCompileTest10.m +++ b/third_party/protobuf/objectivec/Tests/GPBCompileTest10.m @@ -8,7 +8,7 @@ // This is a test including a single public header to ensure things build. // It helps test that imports are complete/ordered correctly. -#import "GPBUnknownFieldSet.h" +#import "GPBUnknownFields.h" // Something in the body of this file so the compiler/linker won't complain // about an empty .o file. diff --git a/third_party/protobuf/objectivec/Tests/GPBCompileTest25.m b/third_party/protobuf/objectivec/Tests/GPBCompileTest25.m deleted file mode 100644 index 450795b3ab4a6..0000000000000 --- a/third_party/protobuf/objectivec/Tests/GPBCompileTest25.m +++ /dev/null @@ -1,15 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2024 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -// This is a test including a single public header to ensure things build. -// It helps test that imports are complete/ordered correctly. - -#import "GPBUnknownFields.h" - -// Something in the body of this file so the compiler/linker won't complain -// about an empty .o file. -__attribute__((visibility("default"))) char dummy_symbol_25 = 0; diff --git a/third_party/protobuf/objectivec/Tests/GPBMessage30007FormatTest.m b/third_party/protobuf/objectivec/Tests/GPBMessage30007FormatTest.m new file mode 100644 index 0000000000000..ce3b3a8e66c18 --- /dev/null +++ b/third_party/protobuf/objectivec/Tests/GPBMessage30007FormatTest.m @@ -0,0 +1,445 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2025 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#import <stdatomic.h> + +#import "GPBDescriptor_PackagePrivate.h" +#import "GPBExtensionRegistry.h" +#import "GPBMessage.h" +#import "GPBProtocolBuffers_RuntimeSupport.h" +#import "GPBRootObject_PackagePrivate.h" +#import "GPBTestUtilities.h" + +@interface MessageClassNameTests : GPBTestCase +@end + +// clang-format off + +// ------------------------------------------------------------------------------------------------- +// +// This is extracted from generated code with the 30007 format for the following proto: +// +// syntax = "proto2"; +// +// enum Enum30007 { +// FOO = 0; +// BAR = 1; +// } +// +// message Message30007 { +// message SubMessage { +// optional int32 x = 1; +// } +// enum SubEnum { +// SUB_FOO = 0; +// SUB_BAR = 1; +// } +// optional string name = 1; +// optional Enum30007 value = 2; +// repeated string names = 11; +// repeated Enum30007 values = 12; +// optional SubMessage sub_m = 20; +// optional SubEnum sub_e = 21; +// extensions 100 to max; +// } +// +// extend Message30007 { +// optional Message30007 other_m = 100; +// optional Enum30007 other_e = 101; +// repeated Message30007 other_ms = 110; +// repeated Enum30007 other_es = 111; +// } +// +// ------------------------------------------------------------------------------------------------- + +@class Message30007_SubMessage; + +NS_ASSUME_NONNULL_BEGIN + +typedef GPB_ENUM(Enum30007) { + Enum30007_Foo = 0, + Enum30007_Bar = 1, +}; + +GPBEnumDescriptor *Enum30007_EnumDescriptor(void); +BOOL Enum30007_IsValidValue(int32_t value); + +typedef GPB_ENUM(Message30007_SubEnum) { + Message30007_SubEnum_SubFoo = 0, + Message30007_SubEnum_SubBar = 1, +}; + +GPBEnumDescriptor *Message30007_SubEnum_EnumDescriptor(void); + +BOOL Message30007_SubEnum_IsValidValue(int32_t value); + +GPB_FINAL @interface Test30007Root : GPBRootObject +@end + +@interface Test30007Root (DynamicMethods) ++ (GPBExtensionDescriptor *)otherM; ++ (GPBExtensionDescriptor *)otherE; ++ (GPBExtensionDescriptor *)otherMs; ++ (GPBExtensionDescriptor *)otherEs; +@end + +typedef GPB_ENUM(Message30007_FieldNumber) { + Message30007_FieldNumber_Name = 1, + Message30007_FieldNumber_Value = 2, + Message30007_FieldNumber_NamesArray = 11, + Message30007_FieldNumber_ValuesArray = 12, + Message30007_FieldNumber_SubM = 20, + Message30007_FieldNumber_SubE = 21, +}; + +GPB_FINAL @interface Message30007 : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSString *name; +@property(nonatomic, readwrite) BOOL hasName; + +@property(nonatomic, readwrite) Enum30007 value; +@property(nonatomic, readwrite) BOOL hasValue; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<NSString*> *namesArray; +@property(nonatomic, readonly) NSUInteger namesArray_Count; + +// |valuesArray| contains |Enum30007| +@property(nonatomic, readwrite, strong, null_resettable) GPBEnumArray *valuesArray; +@property(nonatomic, readonly) NSUInteger valuesArray_Count; + +@property(nonatomic, readwrite, strong, null_resettable) Message30007_SubMessage *subM; +@property(nonatomic, readwrite) BOOL hasSubM; + +@property(nonatomic, readwrite) Message30007_SubEnum subE; +@property(nonatomic, readwrite) BOOL hasSubE; + +@end + +typedef GPB_ENUM(Message30007_SubMessage_FieldNumber) { + Message30007_SubMessage_FieldNumber_X = 1, +}; + +GPB_FINAL @interface Message30007_SubMessage : GPBMessage + +@property(nonatomic, readwrite) int32_t x; +@property(nonatomic, readwrite) BOOL hasX; + +@end + +NS_ASSUME_NONNULL_END + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension" + +GPBObjCClassDeclaration(Message30007); +GPBObjCClassDeclaration(Message30007_SubMessage); + +@implementation Test30007Root + ++ (GPBExtensionRegistry*)extensionRegistry { + // This is called by +initialize so there is no need to worry + // about thread safety and initialization of registry. + static GPBExtensionRegistry* registry = nil; + if (!registry) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + registry = [[GPBExtensionRegistry alloc] init]; + static GPBExtensionDescription descriptions[] = { + { + .defaultValue.valueMessage = nil, + .singletonName = GPBStringifySymbol(Test30007Root) "_otherM", + .extendedClass.clazz = GPBObjCClass(Message30007), + .messageOrGroupClass.clazz = GPBObjCClass(Message30007), + .enumDescriptorFunc = NULL, + .fieldNumber = 100, + .dataType = GPBDataTypeMessage, + .options = GPBExtensionNone, + }, + { + .defaultValue.valueEnum = Enum30007_Foo, + .singletonName = GPBStringifySymbol(Test30007Root) "_otherE", + .extendedClass.clazz = GPBObjCClass(Message30007), + .messageOrGroupClass.clazz = Nil, + .enumDescriptorFunc = Enum30007_EnumDescriptor, + .fieldNumber = 101, + .dataType = GPBDataTypeEnum, + .options = GPBExtensionNone, + }, + { + .defaultValue.valueMessage = nil, + .singletonName = GPBStringifySymbol(Test30007Root) "_otherMs", + .extendedClass.clazz = GPBObjCClass(Message30007), + .messageOrGroupClass.clazz = GPBObjCClass(Message30007), + .enumDescriptorFunc = NULL, + .fieldNumber = 110, + .dataType = GPBDataTypeMessage, + .options = GPBExtensionRepeated, + }, + { + .defaultValue.valueMessage = nil, + .singletonName = GPBStringifySymbol(Test30007Root) "_otherEs", + .extendedClass.clazz = GPBObjCClass(Message30007), + .messageOrGroupClass.clazz = Nil, + .enumDescriptorFunc = Enum30007_EnumDescriptor, + .fieldNumber = 111, + .dataType = GPBDataTypeEnum, + .options = GPBExtensionRepeated, + }, + }; + for (size_t i = 0; i < sizeof(descriptions) / sizeof(descriptions[0]); ++i) { + GPBExtensionDescriptor *extension = + [[GPBExtensionDescriptor alloc] initWithExtensionDescription:&descriptions[i] + usesClassRefs:YES]; + [registry addExtension:extension]; + [self globallyRegisterExtension:extension]; + [extension release]; + } + // None of the imports (direct or indirect) defined extensions, so no need to add + // them to this registry. + } + return registry; +} + +@end + +static GPBFileDescription Test30007Root_FileDescription = { + .package = NULL, + .prefix = NULL, + .syntax = GPBFileSyntaxProto2 +}; + +GPBEnumDescriptor *Enum30007_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + static const char *valueNames = + "Foo\000Bar\000"; + static const int32_t values[] = { + Enum30007_Foo, + Enum30007_Bar, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(Enum30007) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:Enum30007_IsValidValue + flags:GPBEnumDescriptorInitializationFlag_IsClosed]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL Enum30007_IsValidValue(int32_t value__) { + switch (value__) { + case Enum30007_Foo: + case Enum30007_Bar: + return YES; + default: + return NO; + } +} + +GPBEnumDescriptor *Message30007_SubEnum_EnumDescriptor(void) { + static _Atomic(GPBEnumDescriptor*) descriptor = nil; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + static const char *valueNames = + "SubFoo\000SubBar\000"; + static const int32_t values[] = { + Message30007_SubEnum_SubFoo, + Message30007_SubEnum_SubBar, + }; + GPBEnumDescriptor *worker = + [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(Message30007_SubEnum) + valueNames:valueNames + values:values + count:(uint32_t)(sizeof(values) / sizeof(int32_t)) + enumVerifier:Message30007_SubEnum_IsValidValue + flags:GPBEnumDescriptorInitializationFlag_IsClosed]; + GPBEnumDescriptor *expected = nil; + if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) { + [worker release]; + } + } + return descriptor; +} + +BOOL Message30007_SubEnum_IsValidValue(int32_t value__) { + switch (value__) { + case Message30007_SubEnum_SubFoo: + case Message30007_SubEnum_SubBar: + return YES; + default: + return NO; + } +} + +@implementation Message30007 + +@dynamic hasName, name; +@dynamic hasValue, value; +@dynamic namesArray, namesArray_Count; +@dynamic valuesArray, valuesArray_Count; +@dynamic hasSubM, subM; +@dynamic hasSubE, subE; + +typedef struct Message30007__storage_ { + uint32_t _has_storage_[1]; + Enum30007 value; + Message30007_SubEnum subE; + NSString *name; + NSMutableArray *namesArray; + GPBEnumArray *valuesArray; + Message30007_SubMessage *subM; +} Message30007__storage_; + ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + static GPBMessageFieldDescription fields[] = { + { + .name = "name", + .dataTypeSpecific.clazz = Nil, + .number = Message30007_FieldNumber_Name, + .hasIndex = 0, + .offset = (uint32_t)offsetof(Message30007__storage_, name), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "value", + .dataTypeSpecific.enumDescFunc = Enum30007_EnumDescriptor, + .number = Message30007_FieldNumber_Value, + .hasIndex = 1, + .offset = (uint32_t)offsetof(Message30007__storage_, value), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClosedEnum), + .dataType = GPBDataTypeEnum, + }, + { + .name = "namesArray", + .dataTypeSpecific.clazz = Nil, + .number = Message30007_FieldNumber_NamesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(Message30007__storage_, namesArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeString, + }, + { + .name = "valuesArray", + .dataTypeSpecific.enumDescFunc = Enum30007_EnumDescriptor, + .number = Message30007_FieldNumber_ValuesArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(Message30007__storage_, valuesArray), + .flags = (GPBFieldFlags)(GPBFieldRepeated | GPBFieldHasEnumDescriptor | GPBFieldClosedEnum), + .dataType = GPBDataTypeEnum, + }, + { + .name = "subM", + .dataTypeSpecific.clazz = GPBObjCClass(Message30007_SubMessage), + .number = Message30007_FieldNumber_SubM, + .hasIndex = 2, + .offset = (uint32_t)offsetof(Message30007__storage_, subM), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "subE", + .dataTypeSpecific.enumDescFunc = Message30007_SubEnum_EnumDescriptor, + .number = Message30007_FieldNumber_SubE, + .hasIndex = 3, + .offset = (uint32_t)offsetof(Message30007__storage_, subE), + .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClosedEnum), + .dataType = GPBDataTypeEnum, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:GPBObjCClass(Message30007) + messageName:@"Message30007" + fileDescription:&Test30007Root_FileDescription + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(Message30007__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; + static const GPBExtensionRange ranges[] = { + { .start = 100, .end = 536870912 }, + }; + [localDescriptor setupExtensionRanges:ranges + count:(uint32_t)(sizeof(ranges) / sizeof(GPBExtensionRange))]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +@implementation Message30007_SubMessage + +@dynamic hasX, x; + +typedef struct Message30007_SubMessage__storage_ { + uint32_t _has_storage_[1]; + int32_t x; +} Message30007_SubMessage__storage_; + ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + static GPBMessageFieldDescription fields[] = { + { + .name = "x", + .dataTypeSpecific.clazz = Nil, + .number = Message30007_SubMessage_FieldNumber_X, + .hasIndex = 0, + .offset = (uint32_t)offsetof(Message30007_SubMessage__storage_, x), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt32, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:GPBObjCClass(Message30007_SubMessage) + messageName:@"SubMessage" + fileDescription:&Test30007Root_FileDescription + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(Message30007_SubMessage__storage_) + flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; + [localDescriptor setupContainingMessageClass:GPBObjCClass(Message30007)]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma clang diagnostic pop + +// clang-format on + +// ------------------------------------------------------------------------------------------------- + +@implementation MessageClassNameTests + +- (void)test30007MessageFormat { + // This doesn't test everything, just exists to ensure the code compiles/links and seems + // to work. + Message30007 *message = [Message30007 message]; + message.name = @"foo"; + message.subM.x = 123; +} + +@end diff --git a/third_party/protobuf/objectivec/Tests/GPBMessageTests+ClassNames.m b/third_party/protobuf/objectivec/Tests/GPBMessageTests+ClassNames.m deleted file mode 100644 index e1b49d8af330c..0000000000000 --- a/third_party/protobuf/objectivec/Tests/GPBMessageTests+ClassNames.m +++ /dev/null @@ -1,145 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2015 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#import <objc/runtime.h> - -#import "GPBDescriptor_PackagePrivate.h" -#import "GPBExtensionRegistry.h" -#import "GPBMessage.h" -#import "GPBRootObject_PackagePrivate.h" -#import "GPBTestUtilities.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -// Support classes for tests using old class name (vs classrefs) interfaces. -GPB_FINAL @interface MessageLackingClazzRoot : GPBRootObject -@end - -@interface MessageLackingClazzRoot (DynamicMethods) -+ (GPBExtensionDescriptor *)ext1; -@end - -GPB_FINAL @interface MessageLackingClazz : GPBMessage -@property(copy, nonatomic) NSString *foo; -@end - -@implementation MessageLackingClazz - -@dynamic foo; - -typedef struct MessageLackingClazz_storage_ { - uint32_t _has_storage_[1]; - NSString *foo; -} MessageLackingClazz_storage_; - -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = nil; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "foo", - .dataTypeSpecific.className = "NSString", - .number = 1, - .hasIndex = 0, - .offset = (uint32_t)offsetof(MessageLackingClazz_storage_, foo), - .flags = (GPBFieldFlags)(GPBFieldOptional), - .dataType = GPBDataTypeMessage, - }, - }; - GPBFileDescriptor *desc = - [[[GPBFileDescriptor alloc] initWithPackage:@"test" - objcPrefix:@"TEST" - syntax:GPBFileSyntaxProto3] autorelease]; - - // GPBDescriptorInitializationFlag_UsesClassRefs intentionally not set here - descriptor = [GPBDescriptor - allocDescriptorForClass:[MessageLackingClazz class] - rootClass:[MessageLackingClazzRoot class] - file:desc - fields:fields - fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) - storageSize:sizeof(MessageLackingClazz_storage_) - flags:GPBDescriptorInitializationFlag_None]; - [descriptor setupContainingMessageClassName:"MessageLackingClazz"]; - } - return descriptor; -} -@end - -@implementation MessageLackingClazzRoot - -+ (GPBExtensionRegistry *)extensionRegistry { - // This is called by +initialize so there is no need to worry - // about thread safety and initialization of registry. - static GPBExtensionRegistry *registry = nil; - if (!registry) { - registry = [[GPBExtensionRegistry alloc] init]; - static GPBExtensionDescription descriptions[] = { - { - .defaultValue.valueMessage = NULL, - .singletonName = "MessageLackingClazzRoot_ext1", - .extendedClass.name = "MessageLackingClazz", - .messageOrGroupClass.name = "MessageLackingClazz", - .enumDescriptorFunc = NULL, - .fieldNumber = 1, - .dataType = GPBDataTypeMessage, - // GPBExtensionUsesClazz Intentionally not set - .options = 0, - }, - }; - for (size_t i = 0; i < sizeof(descriptions) / sizeof(descriptions[0]); ++i) { - // Intentionall using `-initWithExtensionDescription:` and not ` - // -initWithExtensionDescription:usesClassRefs:` to test backwards - // compatibility - GPBExtensionDescriptor *extension = - [[GPBExtensionDescriptor alloc] initWithExtensionDescription:&descriptions[i]]; - [registry addExtension:extension]; - [self globallyRegisterExtension:extension]; - [extension release]; - } - // None of the imports (direct or indirect) defined extensions, so no need to add - // them to this registry. - } - return registry; -} -@end - -#pragma clang diagnostic pop - -@interface MessageClassNameTests : GPBTestCase -@end - -@implementation MessageClassNameTests - -- (void)testClassNameSupported { - // This tests backwards compatibility to make sure we support older sources - // that use class names instead of references. - GPBDescriptor *desc = [MessageLackingClazz descriptor]; - GPBFieldDescriptor *fieldDesc = [desc fieldWithName:@"foo"]; - XCTAssertEqualObjects(fieldDesc.msgClass, [NSString class]); -} - -- (void)testSetupContainingMessageClassNameSupported { - // This tests backwards compatibility to make sure we support older sources - // that use class names instead of references. - GPBDescriptor *desc = [MessageLackingClazz descriptor]; - GPBDescriptor *container = [desc containingType]; - XCTAssertEqualObjects(container.messageClass, [MessageLackingClazz class]); -} - -- (void)testExtensionsNameSupported { - // This tests backwards compatibility to make sure we support older sources - // that use class names instead of references. - GPBExtensionDescriptor *desc = [MessageLackingClazzRoot ext1]; - Class containerClass = [desc containingMessageClass]; - XCTAssertEqualObjects(containerClass, [MessageLackingClazz class]); - Class msgClass = [desc msgClass]; - XCTAssertEqualObjects(msgClass, [MessageLackingClazz class]); -} - -@end diff --git a/third_party/protobuf/objectivec/Tests/GPBMessageTests+Serialization.m b/third_party/protobuf/objectivec/Tests/GPBMessageTests+Serialization.m index 049fcfd6c2f4b..671c083201f6d 100644 --- a/third_party/protobuf/objectivec/Tests/GPBMessageTests+Serialization.m +++ b/third_party/protobuf/objectivec/Tests/GPBMessageTests+Serialization.m @@ -428,30 +428,6 @@ XCTAssertEqual(varint, (uint64_t)Message3_Enum_Extra3); [ufs release]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - - GPBUnknownFieldSet *unknownFields = msg.unknownFields; - - XCTAssertEqual([unknownFields countOfFields], 3U); - XCTAssertTrue([unknownFields hasField:Message2_FieldNumber_OptionalEnum]); - XCTAssertTrue([unknownFields hasField:Message2_FieldNumber_RepeatedEnumArray]); - XCTAssertTrue([unknownFields hasField:Message2_FieldNumber_OneofEnum]); - - GPBUnknownField *field = [unknownFields getField:Message2_FieldNumber_OptionalEnum]; - XCTAssertEqual(field.varintList.count, 1U); - XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)Message3_Enum_Extra3); - - field = [unknownFields getField:Message2_FieldNumber_RepeatedEnumArray]; - XCTAssertEqual(field.varintList.count, 1U); - XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)Message3_Enum_Extra3); - - field = [unknownFields getField:Message2_FieldNumber_OneofEnum]; - XCTAssertEqual(field.varintList.count, 1U); - XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)Message3_Enum_Extra3); - -#pragma clang diagnostic pop - [msg release]; [orig release]; } @@ -1415,10 +1391,6 @@ GPBUnknownFields *ufs = [[GPBUnknownFields alloc] initFromMessage:msg1]; XCTAssertEqual(ufs.count, 1U); [ufs release]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqual(msg1.unknownFields.countOfFields, 1U); -#pragma clang diagnostic pop data = [msg1 data]; TestEnumMapPlusExtra *msg2 = [TestEnumMapPlusExtra parseFromData:data error:NULL]; @@ -1433,10 +1405,6 @@ ufs = [[GPBUnknownFields alloc] initFromMessage:msg2]; XCTAssertTrue(ufs.empty); [ufs release]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqual(msg2.unknownFields.countOfFields, 0U); -#pragma clang diagnostic pop XCTAssertEqualObjects(orig, msg2); diff --git a/third_party/protobuf/objectivec/Tests/GPBMessageTests.m b/third_party/protobuf/objectivec/Tests/GPBMessageTests.m index a8b2a7dd2b095..d273b48048119 100644 --- a/third_party/protobuf/objectivec/Tests/GPBMessageTests.m +++ b/third_party/protobuf/objectivec/Tests/GPBMessageTests.m @@ -16,8 +16,6 @@ #import "GPBMessage_PackagePrivate.h" #import "GPBTestUtilities.h" #import "GPBUnknownField.h" -#import "GPBUnknownFieldSet.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUnknownField_PackagePrivate.h" #import "GPBUnknownFields.h" #import "objectivec/Tests/Unittest.pbobjc.h" @@ -496,19 +494,6 @@ TestAllTypes *message = [TestAllTypes message]; [self setAllFields:message repeatedCount:kGPBDefaultRepeatCount]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknownFields = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField *field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; - [field addVarint:2]; - [unknownFields addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease]; - [field addVarint:4]; - [unknownFields addField:field]; - - [message setUnknownFields:unknownFields]; -#pragma clang diagnostic pop - GPBUnknownFields *ufs = [[[GPBUnknownFields alloc] init] autorelease]; [ufs addFieldNumber:1234 fixed32:1234]; [ufs addFieldNumber:2345 varint:54321]; @@ -981,47 +966,6 @@ [nestedMessage release]; } -- (void)testAutocreatedUnknownFields { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - - // Doing anything with (except reading) unknown fields should cause the - // submessage to become visible. - TestAllTypes *message = [TestAllTypes message]; - XCTAssertNotNil(message.optionalNestedMessage); - XCTAssertFalse([message hasOptionalNestedMessage]); - XCTAssertNil(message.optionalNestedMessage.unknownFields); - XCTAssertFalse([message hasOptionalNestedMessage]); - - GPBUnknownFieldSet *unknownFields = [[[GPBUnknownFieldSet alloc] init] autorelease]; - message.optionalNestedMessage.unknownFields = unknownFields; - XCTAssertTrue([message hasOptionalNestedMessage]); - - message.optionalNestedMessage = nil; - XCTAssertFalse([message hasOptionalNestedMessage]); - [message.optionalNestedMessage setUnknownFields:unknownFields]; - XCTAssertTrue([message hasOptionalNestedMessage]); - - message.optionalNestedMessage = nil; - XCTAssertFalse([message hasOptionalNestedMessage]); - GPBUnknownFields *ufs = [[[GPBUnknownFields alloc] init] autorelease]; - [ufs addFieldNumber:1 varint:1]; - XCTAssertTrue([message.optionalNestedMessage mergeUnknownFields:ufs - extensionRegistry:nil - error:NULL]); - XCTAssertTrue([message hasOptionalNestedMessage]); - - message.optionalNestedMessage = nil; - XCTAssertFalse([message hasOptionalNestedMessage]); - [ufs clear]; // Also make sure merging zero length forces it to become visible. - XCTAssertTrue([message.optionalNestedMessage mergeUnknownFields:ufs - extensionRegistry:nil - error:NULL]); - XCTAssertTrue([message hasOptionalNestedMessage]); - -#pragma clang diagnostic pop -} - - (void)testSetAutocreatedSubmessageToSelf { // Setting submessage to itself should cause it to become visible. TestAllTypes *message = [TestAllTypes message]; @@ -1529,24 +1473,6 @@ varint:&varint]); XCTAssertEqual(varint, 12); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknownFields = msg.unknownFields; - GPBUnknownField *field = - [unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber]; - XCTAssertNotNil(field); - XCTAssertEqual(field.varintList.count, 1); - XCTAssertEqual([field.varintList valueAtIndex:0], 10); - field = [unknownFields getField:[UnittestRoot repeatedNestedEnumExtension].fieldNumber]; - XCTAssertNotNil(field); - XCTAssertEqual(field.varintList.count, 1); - XCTAssertEqual([field.varintList valueAtIndex:0], 11); - field = [unknownFields getField:[UnittestRoot repeatedForeignEnumExtension].fieldNumber]; - XCTAssertNotNil(field); - XCTAssertEqual(field.varintList.count, 1); - XCTAssertEqual([field.varintList valueAtIndex:0], 12); -#pragma clang diagnostic pop - // Unknown and known, the known come though an unknown go to unknown fields. data = DataFromCStr( @@ -1585,23 +1511,6 @@ XCTAssertTrue([ufs getFirst:[UnittestRoot repeatedForeignEnumExtension].fieldNumber varint:&varint]); XCTAssertEqual(varint, 12); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - unknownFields = msg.unknownFields; - field = [unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber]; - XCTAssertNotNil(field); - XCTAssertEqual(field.varintList.count, 1); - XCTAssertEqual([field.varintList valueAtIndex:0], 10); - field = [unknownFields getField:[UnittestRoot repeatedNestedEnumExtension].fieldNumber]; - XCTAssertNotNil(field); - XCTAssertEqual(field.varintList.count, 1); - XCTAssertEqual([field.varintList valueAtIndex:0], 11); - field = [unknownFields getField:[UnittestRoot repeatedForeignEnumExtension].fieldNumber]; - XCTAssertNotNil(field); - XCTAssertEqual(field.varintList.count, 1); - XCTAssertEqual([field.varintList valueAtIndex:0], 12); -#pragma clang diagnostic pop } - (void)testDefaultingExtensionMessages { @@ -1902,15 +1811,9 @@ } - (void)testGenerateAndParseUnknownMessage { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknowns = [[[GPBUnknownFieldSet alloc] init] autorelease]; - [unknowns mergeVarintField:123 value:456]; - GPBMessage *message = [GPBMessage message]; - [message setUnknownFields:unknowns]; -#pragma clang diagnostic pop GPBUnknownFields *ufs = [[[GPBUnknownFields alloc] init] autorelease]; [ufs addFieldNumber:1234 varint:5678]; + GPBMessage *message = [GPBMessage message]; XCTAssertTrue([message mergeUnknownFields:ufs extensionRegistry:nil error:NULL]); NSData *data = [message data]; GPBMessage *message2 = [GPBMessage parseFromData:data extensionRegistry:nil error:NULL]; @@ -1918,28 +1821,15 @@ } - (void)testDelimitedWriteAndParseMultipleMessages { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknowns1 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - [unknowns1 mergeVarintField:123 value:456]; - GPBMessage *message1 = [GPBMessage message]; - [message1 setUnknownFields:unknowns1]; -#pragma clang diagnostic pop GPBUnknownFields *ufs1 = [[[GPBUnknownFields alloc] init] autorelease]; [ufs1 addFieldNumber:1234 varint:5678]; + GPBMessage *message1 = [GPBMessage message]; XCTAssertTrue([message1 mergeUnknownFields:ufs1 extensionRegistry:nil error:NULL]); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknowns2 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - [unknowns2 mergeVarintField:789 value:987]; - [unknowns2 mergeVarintField:654 value:321]; - GPBMessage *message2 = [GPBMessage message]; - [message2 setUnknownFields:unknowns2]; -#pragma clang diagnostic pop GPBUnknownFields *ufs2 = [[[GPBUnknownFields alloc] init] autorelease]; [ufs2 addFieldNumber:2345 fixed32:6789]; [ufs2 addFieldNumber:3456 fixed32:7890]; + GPBMessage *message2 = [GPBMessage message]; XCTAssertTrue([message2 mergeUnknownFields:ufs2 extensionRegistry:nil error:NULL]); NSMutableData *delimitedData = [NSMutableData data]; @@ -2136,26 +2026,6 @@ XCTAssertEqual(fields.count, 2U); XCTAssertEqual(fields[0].varint, (uint64_t)EnumTestMsg_MyEnum_Two); XCTAssertEqual(fields[1].varint, (uint64_t)EnumTestMsg_MyEnum_NegTwo); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownFieldSet *unknownFields = msg2.unknownFields; - XCTAssertNotNil(unknownFields); - XCTAssertEqual(unknownFields.countOfFields, 3U); - XCTAssertTrue([unknownFields hasField:EnumTestMsg_FieldNumber_Bar]); - XCTAssertTrue([unknownFields hasField:EnumTestMsg_FieldNumber_Baz]); - XCTAssertTrue([unknownFields hasField:EnumTestMsg_FieldNumber_MumbleArray]); - GPBUnknownField *field = [unknownFields getField:EnumTestMsg_FieldNumber_Bar]; - XCTAssertEqual(field.varintList.count, 1U); - XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)EnumTestMsg_MyEnum_NegTwo); - field = [unknownFields getField:EnumTestMsg_FieldNumber_Baz]; - XCTAssertEqual(field.varintList.count, 1U); - XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)EnumTestMsg_MyEnum_Two); - field = [unknownFields getField:EnumTestMsg_FieldNumber_MumbleArray]; - XCTAssertEqual(field.varintList.count, 2U); - XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)EnumTestMsg_MyEnum_Two); - XCTAssertEqual([field.varintList valueAtIndex:1], (uint64_t)EnumTestMsg_MyEnum_NegTwo); -#pragma clang diagnostic pop } - (void)testReservedWordNaming { diff --git a/third_party/protobuf/objectivec/Tests/GPBTestUtilities.h b/third_party/protobuf/objectivec/Tests/GPBTestUtilities.h index 0d4093706211f..f1989f40ae8db 100644 --- a/third_party/protobuf/objectivec/Tests/GPBTestUtilities.h +++ b/third_party/protobuf/objectivec/Tests/GPBTestUtilities.h @@ -15,7 +15,7 @@ static inline NSData *DataFromCStr(const char *str) { return [NSData dataWithBytes:str length:strlen(str)]; } -static inline NSData *_DataFromBytesInternal(int32_t unused, ...) { +static inline NSData *_DataFromBytesInternal(__unused int32_t unused, ...) { NSMutableData *values = [NSMutableData dataWithCapacity:0]; va_list list; va_start(list, unused); diff --git a/third_party/protobuf/objectivec/Tests/GPBUnknownFieldSetTest.m b/third_party/protobuf/objectivec/Tests/GPBUnknownFieldSetTest.m deleted file mode 100644 index aa009bf0b4b9e..0000000000000 --- a/third_party/protobuf/objectivec/Tests/GPBUnknownFieldSetTest.m +++ /dev/null @@ -1,674 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -#import "GPBTestUtilities.h" -#import "GPBUnknownFieldSet.h" -#import "GPBUnknownFieldSet_PackagePrivate.h" -#import "GPBUnknownField_PackagePrivate.h" -#import "objectivec/Tests/Unittest.pbobjc.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -@interface GPBUnknownFieldSet (GPBUnknownFieldSetTest) -- (void)getTags:(int32_t*)tags; -@end - -@interface UnknownFieldSetTest : GPBTestCase { - @private - TestAllTypes* allFields_; - NSData* allFieldsData_; - - // An empty message that has been parsed from allFieldsData. So, it has - // unknown fields of every type. - TestEmptyMessage* emptyMessage_; - GPBUnknownFieldSet* unknownFields_; -} - -@end - -@implementation UnknownFieldSetTest - -- (void)setUp { - allFields_ = [self allSetRepeatedCount:kGPBDefaultRepeatCount]; - allFieldsData_ = [allFields_ data]; - emptyMessage_ = [TestEmptyMessage parseFromData:allFieldsData_ error:NULL]; - unknownFields_ = emptyMessage_.unknownFields; -} - -- (void)testInvalidFieldNumber { - GPBUnknownFieldSet* set = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:0] autorelease]; - XCTAssertThrowsSpecificNamed([set addField:field], NSException, NSInvalidArgumentException); -} - -- (void)testEqualityAndHash { - // Empty - - GPBUnknownFieldSet* set1 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - XCTAssertTrue([set1 isEqual:set1]); - XCTAssertFalse([set1 isEqual:@"foo"]); - GPBUnknownFieldSet* set2 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - XCTAssertEqualObjects(set1, set2); - XCTAssertEqual([set1 hash], [set2 hash]); - - // Varint - - GPBUnknownField* field1 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - [field1 addVarint:1]; - [set1 addField:field1]; - XCTAssertNotEqualObjects(set1, set2); - GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - [field2 addVarint:1]; - [set2 addField:field2]; - XCTAssertEqualObjects(set1, set2); - XCTAssertEqual([set1 hash], [set2 hash]); - - // Fixed32 - - field1 = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; - [field1 addFixed32:2]; - [set1 addField:field1]; - XCTAssertNotEqualObjects(set1, set2); - field2 = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; - [field2 addFixed32:2]; - [set2 addField:field2]; - XCTAssertEqualObjects(set1, set2); - XCTAssertEqual([set1 hash], [set2 hash]); - - // Fixed64 - - field1 = [[[GPBUnknownField alloc] initWithNumber:3] autorelease]; - [field1 addFixed64:3]; - [set1 addField:field1]; - XCTAssertNotEqualObjects(set1, set2); - field2 = [[[GPBUnknownField alloc] initWithNumber:3] autorelease]; - [field2 addFixed64:3]; - [set2 addField:field2]; - XCTAssertEqualObjects(set1, set2); - XCTAssertEqual([set1 hash], [set2 hash]); - - // LengthDelimited - - field1 = [[[GPBUnknownField alloc] initWithNumber:4] autorelease]; - [field1 addLengthDelimited:DataFromCStr("foo")]; - [set1 addField:field1]; - XCTAssertNotEqualObjects(set1, set2); - field2 = [[[GPBUnknownField alloc] initWithNumber:4] autorelease]; - [field2 addLengthDelimited:DataFromCStr("foo")]; - [set2 addField:field2]; - XCTAssertEqualObjects(set1, set2); - XCTAssertEqual([set1 hash], [set2 hash]); - - // Group - - GPBUnknownFieldSet* group1 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* fieldGroup1 = [[[GPBUnknownField alloc] initWithNumber:10] autorelease]; - [fieldGroup1 addVarint:1]; - [group1 addField:fieldGroup1]; - GPBUnknownFieldSet* group2 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* fieldGroup2 = [[[GPBUnknownField alloc] initWithNumber:10] autorelease]; - [fieldGroup2 addVarint:1]; - [group2 addField:fieldGroup2]; - - field1 = [[[GPBUnknownField alloc] initWithNumber:5] autorelease]; - [field1 addGroup:group1]; - [set1 addField:field1]; - XCTAssertNotEqualObjects(set1, set2); - field2 = [[[GPBUnknownField alloc] initWithNumber:5] autorelease]; - [field2 addGroup:group2]; - [set2 addField:field2]; - XCTAssertEqualObjects(set1, set2); - XCTAssertEqual([set1 hash], [set2 hash]); - - // Exercise description for completeness. - XCTAssertTrue(set1.description.length > 10); -} - -// Constructs a protocol buffer which contains fields with all the same -// numbers as allFieldsData except that each field is some other wire -// type. -- (NSData*)getBizarroData { - GPBUnknownFieldSet* bizarroFields = [[[GPBUnknownFieldSet alloc] init] autorelease]; - NSUInteger count = [unknownFields_ countOfFields]; - int32_t* tags = malloc(count * sizeof(int32_t)); - if (!tags) { - XCTFail(@"Failed to make scratch buffer for testing"); - return [NSData data]; - } - @try { - [unknownFields_ getTags:tags]; - for (NSUInteger i = 0; i < count; ++i) { - int32_t tag = tags[i]; - GPBUnknownField* field = [unknownFields_ getField:tag]; - if (field.varintList.count == 0) { - // Original field is not a varint, so use a varint. - GPBUnknownField* varintField = [[[GPBUnknownField alloc] initWithNumber:tag] autorelease]; - [varintField addVarint:1]; - [bizarroFields addField:varintField]; - } else { - // Original field *is* a varint, so use something else. - GPBUnknownField* fixed32Field = [[[GPBUnknownField alloc] initWithNumber:tag] autorelease]; - [fixed32Field addFixed32:1]; - [bizarroFields addField:fixed32Field]; - } - } - } @finally { - free(tags); - } - - return [bizarroFields data]; -} - -- (void)testSerialize { - // Check that serializing the UnknownFieldSet produces the original data - // again. - NSData* data = [emptyMessage_ data]; - XCTAssertEqualObjects(allFieldsData_, data); -} - -- (void)testCopyFrom { - TestEmptyMessage* message = [TestEmptyMessage message]; - [message mergeFrom:emptyMessage_]; - - XCTAssertEqualObjects(emptyMessage_.data, message.data); -} - -- (void)testMergeFrom { - GPBUnknownFieldSet* set1 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; - [field addVarint:2]; - [set1 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease]; - [field addVarint:4]; - [set1 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:4] autorelease]; - [field addFixed32:6]; - [set1 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:5] autorelease]; - [field addFixed64:20]; - [set1 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:10] autorelease]; - [field addLengthDelimited:DataFromCStr("data1")]; - [set1 addField:field]; - - GPBUnknownFieldSet* group1 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* fieldGroup1 = [[[GPBUnknownField alloc] initWithNumber:200] autorelease]; - [fieldGroup1 addVarint:100]; - [group1 addField:fieldGroup1]; - - field = [[[GPBUnknownField alloc] initWithNumber:11] autorelease]; - [field addGroup:group1]; - [set1 addField:field]; - - GPBUnknownFieldSet* set2 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - [field addVarint:1]; - [set2 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease]; - [field addVarint:3]; - [set2 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:4] autorelease]; - [field addFixed32:7]; - [set2 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:5] autorelease]; - [field addFixed64:30]; - [set2 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:10] autorelease]; - [field addLengthDelimited:DataFromCStr("data2")]; - [set2 addField:field]; - - GPBUnknownFieldSet* group2 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* fieldGroup2 = [[[GPBUnknownField alloc] initWithNumber:201] autorelease]; - [fieldGroup2 addVarint:99]; - [group2 addField:fieldGroup2]; - - field = [[[GPBUnknownField alloc] initWithNumber:11] autorelease]; - [field addGroup:group2]; - [set2 addField:field]; - - GPBUnknownFieldSet* set3 = [[[GPBUnknownFieldSet alloc] init] autorelease]; - field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - [field addVarint:1]; - [set3 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; - [field addVarint:2]; - [set3 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:3] autorelease]; - [field addVarint:4]; - [set3 addField:field]; - [field addVarint:3]; - [set3 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:4] autorelease]; - [field addFixed32:6]; - [field addFixed32:7]; - [set3 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:5] autorelease]; - [field addFixed64:20]; - [field addFixed64:30]; - [set3 addField:field]; - field = [[[GPBUnknownField alloc] initWithNumber:10] autorelease]; - [field addLengthDelimited:DataFromCStr("data1")]; - [field addLengthDelimited:DataFromCStr("data2")]; - [set3 addField:field]; - - GPBUnknownFieldSet* group3a = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* fieldGroup3a1 = [[[GPBUnknownField alloc] initWithNumber:200] autorelease]; - [fieldGroup3a1 addVarint:100]; - [group3a addField:fieldGroup3a1]; - GPBUnknownFieldSet* group3b = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* fieldGroup3b2 = [[[GPBUnknownField alloc] initWithNumber:201] autorelease]; - [fieldGroup3b2 addVarint:99]; - [group3b addField:fieldGroup3b2]; - - field = [[[GPBUnknownField alloc] initWithNumber:11] autorelease]; - [field addGroup:group1]; - [field addGroup:group3b]; - [set3 addField:field]; - - TestEmptyMessage* source1 = [TestEmptyMessage message]; - [source1 setUnknownFields:set1]; - TestEmptyMessage* source2 = [TestEmptyMessage message]; - [source2 setUnknownFields:set2]; - TestEmptyMessage* source3 = [TestEmptyMessage message]; - [source3 setUnknownFields:set3]; - - TestEmptyMessage* destination1 = [TestEmptyMessage message]; - [destination1 mergeFrom:source1]; - [destination1 mergeFrom:source2]; - - TestEmptyMessage* destination2 = [TestEmptyMessage message]; - [destination2 mergeFrom:source3]; - - XCTAssertEqualObjects(destination1.unknownFields, destination2.unknownFields); - XCTAssertEqualObjects(destination1.unknownFields, source3.unknownFields); - XCTAssertEqualObjects(destination2.unknownFields, source3.unknownFields); - - XCTAssertEqualObjects(destination1.data, destination2.data); - XCTAssertEqualObjects(destination1.data, source3.data); - XCTAssertEqualObjects(destination2.data, source3.data); -} - -- (void)testClearMessage { - TestEmptyMessage* message = [TestEmptyMessage message]; - [message mergeFrom:emptyMessage_]; - [message clear]; - XCTAssertEqual(message.serializedSize, (size_t)0); -} - -- (void)testParseKnownAndUnknown { - // Test mixing known and unknown fields when parsing. - GPBUnknownFieldSet* fields = [[unknownFields_ copy] autorelease]; - GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:123456] autorelease]; - [field addVarint:654321]; - [fields addField:field]; - - NSData* data = fields.data; - TestAllTypes* destination = [TestAllTypes parseFromData:data error:NULL]; - - [self assertAllFieldsSet:destination repeatedCount:kGPBDefaultRepeatCount]; - XCTAssertEqual(destination.unknownFields.countOfFields, (NSUInteger)1); - - GPBUnknownField* field2 = [destination.unknownFields getField:123456]; - XCTAssertEqual(field2.varintList.count, (NSUInteger)1); - XCTAssertEqual(654321ULL, [field2.varintList valueAtIndex:0]); -} - -- (void)testWrongTypeTreatedAsUnknown { - // Test that fields of the wrong wire type are treated like unknown fields - // when parsing. - - NSData* bizarroData = [self getBizarroData]; - TestAllTypes* allTypesMessage = [TestAllTypes parseFromData:bizarroData error:NULL]; - TestEmptyMessage* emptyMessage = [TestEmptyMessage parseFromData:bizarroData error:NULL]; - - // All fields should have been interpreted as unknown, so the debug strings - // should be the same. - XCTAssertEqualObjects(emptyMessage.data, allTypesMessage.data); -} - -- (void)testUnknownExtensions { - // Make sure fields are properly parsed to the UnknownFieldSet even when - // they are declared as extension numbers. - - TestEmptyMessageWithExtensions* message = - [TestEmptyMessageWithExtensions parseFromData:allFieldsData_ error:NULL]; - - XCTAssertEqual(unknownFields_.countOfFields, message.unknownFields.countOfFields); - XCTAssertEqualObjects(allFieldsData_, message.data); - - // Just confirm as known extensions, they don't go into unknown data and end up in the - // extensions dictionary. - TestAllExtensions* allExtensionsMessage = - [TestAllExtensions parseFromData:allFieldsData_ - extensionRegistry:[UnittestRoot extensionRegistry] - error:NULL]; - XCTAssertEqual(allExtensionsMessage.unknownFields.countOfFields, (NSUInteger)0); - XCTAssertEqualObjects([allExtensionsMessage data], allFieldsData_); -} - -- (void)testWrongExtensionTypeTreatedAsUnknown { - // Test that fields of the wrong wire type are treated like unknown fields - // when parsing extensions. - - NSData* bizarroData = [self getBizarroData]; - TestAllExtensions* allExtensionsMessage = - [TestAllExtensions parseFromData:bizarroData - extensionRegistry:[UnittestRoot extensionRegistry] - error:NULL]; - TestEmptyMessage* emptyMessage = [TestEmptyMessage parseFromData:bizarroData error:NULL]; - - // All fields should have been interpreted as unknown, so the debug strings - // should be the same. - XCTAssertEqualObjects(emptyMessage.data, allExtensionsMessage.data); -} - -- (void)testLargeVarint { - GPBUnknownFieldSet* fields = [[unknownFields_ copy] autorelease]; - GPBUnknownField* field = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - [field addVarint:0x7FFFFFFFFFFFFFFFL]; - [fields addField:field]; - - NSData* data = [fields data]; - - GPBUnknownFieldSet* parsed = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBCodedInputStream* input = [[[GPBCodedInputStream alloc] initWithData:data] autorelease]; - [parsed mergeFromCodedInputStream:input]; - GPBUnknownField* field2 = [parsed getField:1]; - XCTAssertEqual(field2.varintList.count, (NSUInteger)1); - XCTAssertEqual(0x7FFFFFFFFFFFFFFFULL, [field2.varintList valueAtIndex:0]); -} - -static NSData* DataForGroupsOfDepth(NSUInteger depth) { - NSMutableData* data = [NSMutableData dataWithCapacity:0]; - - uint32_t byte = 35; // 35 = 0b100011 -> field 4/start group - for (NSUInteger i = 0; i < depth; ++i) { - [data appendBytes:&byte length:1]; - } - - byte = 8; // 8 = 0b1000, -> field 1/varint - [data appendBytes:&byte length:1]; - byte = 1; // 1 -> varint value of 1 - [data appendBytes:&byte length:1]; - - byte = 36; // 36 = 0b100100 -> field 4/end group - for (NSUInteger i = 0; i < depth; ++i) { - [data appendBytes:&byte length:1]; - } - return data; -} - -- (void)testParsingNestingGroupData { - // 35 = 0b100011 -> field 4/start group - // 36 = 0b100100 -> field 4/end group - // 43 = 0b101011 -> field 5/end group - // 44 = 0b101100 -> field 5/end group - // 8 = 0b1000, 1 -> field 1/varint, value of 1 - // 21 = 0b10101, 0x78, 0x56, 0x34, 0x12 -> field 2/fixed32, value of 0x12345678 - // 25 = 0b11001, 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12 -> field 3/fixed64, - // value of 0x123456789abcdef0LL - // 50 = 0b110010, 0x0 -> field 6/length delimited, length 0 - // 50 = 0b110010, 0x1, 42 -> field 6/length delimited, length 1, byte 42 - // 0 -> field 0 which is invalid/varint - // 15 = 0b1111 -> field 1, wire type 7 which is invalid - - TestEmptyMessage* m = [TestEmptyMessage parseFromData:DataFromBytes(35, 36) - error:NULL]; // empty group - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - GPBUnknownField* field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - GPBUnknownFieldSet* group = field.groupList[0]; - XCTAssertEqual(group.countOfFields, (NSUInteger)0); - - m = [TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1, 36) error:NULL]; // varint - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - field = [group getField:1]; - XCTAssertEqual(field.varintList.count, (NSUInteger)1); - XCTAssertEqual([field.varintList valueAtIndex:0], 1); - - m = [TestEmptyMessage parseFromData:DataFromBytes(35, 21, 0x78, 0x56, 0x34, 0x12, 36) - error:NULL]; // fixed32 - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - field = [group getField:2]; - XCTAssertEqual(field.fixed32List.count, (NSUInteger)1); - XCTAssertEqual([field.fixed32List valueAtIndex:0], 0x12345678); - - m = [TestEmptyMessage - parseFromData:DataFromBytes(35, 25, 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12, - 36) - error:NULL]; // fixed64 - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - field = [group getField:3]; - XCTAssertEqual(field.fixed64List.count, (NSUInteger)1); - XCTAssertEqual([field.fixed64List valueAtIndex:0], 0x123456789abcdef0LL); - - m = [TestEmptyMessage parseFromData:DataFromBytes(35, 50, 0, 36) - error:NULL]; // length delimited, length 0 - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - field = [group getField:6]; - XCTAssertEqual(field.lengthDelimitedList.count, (NSUInteger)1); - XCTAssertEqualObjects(field.lengthDelimitedList[0], [NSData data]); - - m = [TestEmptyMessage parseFromData:DataFromBytes(35, 50, 1, 42, 36) - error:NULL]; // length delimited, length 1, byte 42 - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - field = [group getField:6]; - XCTAssertEqual(field.lengthDelimitedList.count, (NSUInteger)1); - XCTAssertEqualObjects(field.lengthDelimitedList[0], DataFromBytes(42)); - - m = [TestEmptyMessage parseFromData:DataFromBytes(35, 43, 44, 36) error:NULL]; // Sub group - field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - XCTAssertEqual(group.countOfFields, (NSUInteger)1); - field = [group getField:5]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - XCTAssertEqual(group.countOfFields, (NSUInteger)0); - - m = [TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1, 43, 8, 2, 44, 36) - error:NULL]; // varint and sub group with varint - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - field = [m.unknownFields getField:4]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - XCTAssertEqual(group.countOfFields, (NSUInteger)2); - field = [group getField:1]; - XCTAssertEqual(field.varintList.count, (NSUInteger)1); - XCTAssertEqual([field.varintList valueAtIndex:0], 1); - field = [group getField:5]; - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - field = [group getField:1]; - XCTAssertEqual(field.varintList.count, (NSUInteger)1); - XCTAssertEqual([field.varintList valueAtIndex:0], 2); - - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 0, 36) - error:NULL]); // Invalid field number - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 15, 36) - error:NULL]); // Invalid wire type - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 21, 0x78, 0x56, 0x34) - error:NULL]); // truncated fixed32 - XCTAssertNil([TestEmptyMessage - parseFromData:DataFromBytes(35, 25, 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, - 0x34) - error:NULL]); // truncated fixed64 - - // Missing end group - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43, 8, 1) error:NULL]); - - // Wrong end group - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 44) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1, 44) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43, 36) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43, 8, 1, 36) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43, 44, 44) error:NULL]); - XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43, 8, 1, 44, 44) error:NULL]); - - // This is the same limit as within GPBCodedInputStream. - const NSUInteger kDefaultRecursionLimit = 100; - // That depth parses. - NSData* testData = DataForGroupsOfDepth(kDefaultRecursionLimit); - m = [TestEmptyMessage parseFromData:testData error:NULL]; - XCTAssertEqual(m.unknownFields.countOfFields, (NSUInteger)1); - field = [m.unknownFields getField:4]; - for (NSUInteger i = 0; i < kDefaultRecursionLimit; ++i) { - XCTAssertEqual(field.varintList.count, (NSUInteger)0); - XCTAssertEqual(field.fixed32List.count, (NSUInteger)0); - XCTAssertEqual(field.fixed64List.count, (NSUInteger)0); - XCTAssertEqual(field.lengthDelimitedList.count, (NSUInteger)0); - XCTAssertEqual(field.groupList.count, (NSUInteger)1); - group = field.groupList[0]; - XCTAssertEqual(group.countOfFields, (NSUInteger)1); - field = [group getField:(i < (kDefaultRecursionLimit - 1) ? 4 : 1)]; - } - // field is of the inner most group - XCTAssertEqual(field.varintList.count, (NSUInteger)1); - XCTAssertEqual([field.varintList valueAtIndex:0], (NSUInteger)1); - XCTAssertEqual(field.fixed32List.count, (NSUInteger)0); - XCTAssertEqual(field.fixed64List.count, (NSUInteger)0); - XCTAssertEqual(field.lengthDelimitedList.count, (NSUInteger)0); - XCTAssertEqual(field.groupList.count, (NSUInteger)0); - // One more level deep fails. - testData = DataForGroupsOfDepth(kDefaultRecursionLimit + 1); - XCTAssertNil([TestEmptyMessage parseFromData:testData error:NULL]); -} - -#pragma mark - Field tests -// Some tests directly on fields since the dictionary in FieldSet can gate -// testing some of these. - -- (void)testFieldEqualityAndHash { - GPBUnknownField* field1 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - XCTAssertTrue([field1 isEqual:field1]); - XCTAssertFalse([field1 isEqual:@"foo"]); - GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:2] autorelease]; - XCTAssertNotEqualObjects(field1, field2); - - field2 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - - // Varint - - [field1 addVarint:10]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addVarint:10]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - [field1 addVarint:11]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addVarint:11]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - - // Fixed32 - - [field1 addFixed32:20]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addFixed32:20]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - [field1 addFixed32:21]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addFixed32:21]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - - // Fixed64 - - [field1 addFixed64:30]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addFixed64:30]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - [field1 addFixed64:31]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addFixed64:31]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - - // LengthDelimited - - [field1 addLengthDelimited:DataFromCStr("foo")]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addLengthDelimited:DataFromCStr("foo")]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - [field1 addLengthDelimited:DataFromCStr("bar")]; - XCTAssertNotEqualObjects(field1, field2); - [field2 addLengthDelimited:DataFromCStr("bar")]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - - // Group - - GPBUnknownFieldSet* group = [[[GPBUnknownFieldSet alloc] init] autorelease]; - GPBUnknownField* fieldGroup = [[[GPBUnknownField alloc] initWithNumber:100] autorelease]; - [fieldGroup addVarint:100]; - [group addField:fieldGroup]; - [field1 addGroup:group]; - XCTAssertNotEqualObjects(field1, field2); - group = [[[GPBUnknownFieldSet alloc] init] autorelease]; - fieldGroup = [[[GPBUnknownField alloc] initWithNumber:100] autorelease]; - [fieldGroup addVarint:100]; - [group addField:fieldGroup]; - [field2 addGroup:group]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - - group = [[[GPBUnknownFieldSet alloc] init] autorelease]; - fieldGroup = [[[GPBUnknownField alloc] initWithNumber:101] autorelease]; - [fieldGroup addVarint:101]; - [group addField:fieldGroup]; - [field1 addGroup:group]; - XCTAssertNotEqualObjects(field1, field2); - group = [[[GPBUnknownFieldSet alloc] init] autorelease]; - fieldGroup = [[[GPBUnknownField alloc] initWithNumber:101] autorelease]; - [fieldGroup addVarint:101]; - [group addField:fieldGroup]; - [field2 addGroup:group]; - XCTAssertEqualObjects(field1, field2); - XCTAssertEqual([field1 hash], [field2 hash]); - - // Exercise description for completeness. - XCTAssertTrue(field1.description.length > 10); -} - -- (void)testMergingFields { - GPBUnknownField* field1 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - [field1 addVarint:1]; - [field1 addFixed32:2]; - [field1 addFixed64:3]; - [field1 addLengthDelimited:[NSData dataWithBytes:"hello" length:5]]; - [field1 addGroup:[[unknownFields_ copy] autorelease]]; - GPBUnknownField* field2 = [[[GPBUnknownField alloc] initWithNumber:1] autorelease]; - [field2 mergeFromField:field1]; -} - -@end - -#pragma clang diagnostic pop diff --git a/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m b/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m index 08c64f13fecb7..d7c7547303763 100644 --- a/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m +++ b/third_party/protobuf/objectivec/Tests/GPBUtilitiesTests.m @@ -239,20 +239,6 @@ } } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -// Helper to make an unknown field set with something in it. -static GPBUnknownFieldSet *UnknownFieldsSetHelper(int num) { - GPBUnknownFieldSet *result = [[[GPBUnknownFieldSet alloc] init] autorelease]; - - GPBUnknownField *field = [[[GPBUnknownField alloc] initWithNumber:num] autorelease]; - [field addVarint:num]; - [result addField:field]; - - return result; -} -#pragma clang diagnostic pop - // Helper to add an unknown field data to messages. static void AddUnknownFields(GPBMessage *message, int num) { GPBUnknownFields *ufs = [[GPBUnknownFields alloc] init]; @@ -272,11 +258,7 @@ static BOOL HasUnknownFields(GPBMessage *message) { - (void)testDropMessageUnknownFieldsRecursively { TestAllExtensions *message = [TestAllExtensions message]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - // Give it unknownFields. - message.unknownFields = UnknownFieldsSetHelper(777); AddUnknownFields(message, 1777); // Given it extensions that include a message with unknown fields of its own. @@ -287,21 +269,18 @@ static BOOL HasUnknownFields(GPBMessage *message) { // Group OptionalGroup_extension *optionalGroup = [OptionalGroup_extension message]; optionalGroup.a = 123; - optionalGroup.unknownFields = UnknownFieldsSetHelper(779); AddUnknownFields(optionalGroup, 1779); [message setExtension:[UnittestRoot optionalGroupExtension] value:optionalGroup]; // Message TestAllTypes_NestedMessage *nestedMessage = [TestAllTypes_NestedMessage message]; nestedMessage.bb = 456; - nestedMessage.unknownFields = UnknownFieldsSetHelper(778); AddUnknownFields(nestedMessage, 1778); [message setExtension:[UnittestRoot optionalNestedMessageExtension] value:nestedMessage]; // Repeated Group RepeatedGroup_extension *repeatedGroup = [[RepeatedGroup_extension alloc] init]; repeatedGroup.a = 567; - repeatedGroup.unknownFields = UnknownFieldsSetHelper(780); AddUnknownFields(repeatedGroup, 1780); [message addExtension:[UnittestRoot repeatedGroupExtension] value:repeatedGroup]; [repeatedGroup release]; @@ -309,7 +288,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { // Repeated Message nestedMessage = [[TestAllTypes_NestedMessage alloc] init]; nestedMessage.bb = 678; - nestedMessage.unknownFields = UnknownFieldsSetHelper(781); AddUnknownFields(nestedMessage, 1781); [message addExtension:[UnittestRoot repeatedNestedMessageExtension] value:nestedMessage]; [nestedMessage release]; @@ -319,7 +297,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(message); XCTAssertTrue(HasUnknownFields(message)); - XCTAssertNotNil(message.unknownFields); XCTAssertTrue([message hasExtension:[UnittestRoot optionalInt32Extension]]); { @@ -329,7 +306,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(optionalGroup); XCTAssertEqual(optionalGroup.a, 123); XCTAssertTrue(HasUnknownFields(optionalGroup)); - XCTAssertNotNil(optionalGroup.unknownFields); } { @@ -339,7 +315,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(nestedMessage); XCTAssertEqual(nestedMessage.bb, 456); XCTAssertTrue(HasUnknownFields(nestedMessage)); - XCTAssertNotNil(nestedMessage.unknownFields); } { @@ -350,7 +325,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(repeatedGroup); XCTAssertEqual(repeatedGroup.a, 567); XCTAssertTrue(HasUnknownFields(repeatedGroup)); - XCTAssertNotNil(repeatedGroup.unknownFields); } { @@ -362,7 +336,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(repeatedNestedMessage); XCTAssertEqual(repeatedNestedMessage.bb, 678); XCTAssertTrue(HasUnknownFields(repeatedNestedMessage)); - XCTAssertNotNil(repeatedNestedMessage.unknownFields); } // Drop them. @@ -372,7 +345,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(message); XCTAssertFalse(HasUnknownFields(message)); - XCTAssertNil(message.unknownFields); XCTAssertTrue([message hasExtension:[UnittestRoot optionalInt32Extension]]); { @@ -382,7 +354,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(optionalGroup); XCTAssertEqual(optionalGroup.a, 123); XCTAssertFalse(HasUnknownFields(optionalGroup)); - XCTAssertNil(optionalGroup.unknownFields); } { @@ -392,7 +363,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(nestedMessage); XCTAssertEqual(nestedMessage.bb, 456); XCTAssertFalse(HasUnknownFields(nestedMessage)); - XCTAssertNil(nestedMessage.unknownFields); } { @@ -403,7 +373,6 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(repeatedGroup); XCTAssertEqual(repeatedGroup.a, 567); XCTAssertFalse(HasUnknownFields(repeatedGroup)); - XCTAssertNil(repeatedGroup.unknownFields); } { @@ -415,26 +384,18 @@ static BOOL HasUnknownFields(GPBMessage *message) { XCTAssertNotNil(repeatedNestedMessage); XCTAssertEqual(repeatedNestedMessage.bb, 678); XCTAssertFalse(HasUnknownFields(repeatedNestedMessage)); - XCTAssertNil(repeatedNestedMessage.unknownFields); } - -#pragma clang diagnostic pop } - (void)testDropMessageUnknownFieldsRecursively_Maps { TestMap *message = [TestMap message]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - { ForeignMessage *foreignMessage = [ForeignMessage message]; - foreignMessage.unknownFields = UnknownFieldsSetHelper(100); AddUnknownFields(foreignMessage, 1000); [message.mapInt32ForeignMessage setObject:foreignMessage forKey:100]; foreignMessage = [ForeignMessage message]; - foreignMessage.unknownFields = UnknownFieldsSetHelper(101); AddUnknownFields(foreignMessage, 1001); [message.mapStringForeignMessage setObject:foreignMessage forKey:@"101"]; } @@ -447,14 +408,12 @@ static BOOL HasUnknownFields(GPBMessage *message) { ForeignMessage *foreignMessage = [message.mapInt32ForeignMessage objectForKey:100]; XCTAssertNotNil(foreignMessage); XCTAssertTrue(HasUnknownFields(foreignMessage)); - XCTAssertNotNil(foreignMessage.unknownFields); } { ForeignMessage *foreignMessage = [message.mapStringForeignMessage objectForKey:@"101"]; XCTAssertNotNil(foreignMessage); XCTAssertTrue(HasUnknownFields(foreignMessage)); - XCTAssertNotNil(foreignMessage.unknownFields); } GPBMessageDropUnknownFieldsRecursively(message); @@ -467,17 +426,13 @@ static BOOL HasUnknownFields(GPBMessage *message) { ForeignMessage *foreignMessage = [message.mapInt32ForeignMessage objectForKey:100]; XCTAssertNotNil(foreignMessage); XCTAssertFalse(HasUnknownFields(foreignMessage)); - XCTAssertNil(foreignMessage.unknownFields); } { ForeignMessage *foreignMessage = [message.mapStringForeignMessage objectForKey:@"101"]; XCTAssertNotNil(foreignMessage); XCTAssertFalse(HasUnknownFields(foreignMessage)); - XCTAssertNil(foreignMessage.unknownFields); } - -#pragma clang diagnostic pop } @end diff --git a/third_party/protobuf/objectivec/Tests/GPBWireFormatTests.m b/third_party/protobuf/objectivec/Tests/GPBWireFormatTests.m index 552c48b803a0e..f3c96cb7aef25 100644 --- a/third_party/protobuf/objectivec/Tests/GPBWireFormatTests.m +++ b/third_party/protobuf/objectivec/Tests/GPBWireFormatTests.m @@ -120,16 +120,6 @@ const int kUnknownTypeId2 = 1550056; [[message_set getExtension:[MSetMessageExtension1 messageSetExtension]] setI:123]; [[message_set getExtension:[MSetMessageExtension2 messageSetExtension]] setStr:@"foo"]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - GPBUnknownField* unknownField = - [[[GPBUnknownField alloc] initWithNumber:kUnknownTypeId] autorelease]; - [unknownField addLengthDelimited:DataFromCStr("bar")]; - GPBUnknownFieldSet* unknownFieldSet = [[[GPBUnknownFieldSet alloc] init] autorelease]; - [unknownFieldSet addField:unknownField]; - [message_set setUnknownFields:unknownFieldSet]; -#pragma clang diagnostic pop - GPBUnknownFields* ufs = [[[GPBUnknownFields alloc] init] autorelease]; GPBUnknownFields* group = [ufs addGroupWithFieldNumber:GPBWireFormatMessageSetItem]; [group addFieldNumber:GPBWireFormatMessageSetTypeId varint:kUnknownTypeId2]; @@ -145,18 +135,13 @@ const int kUnknownTypeId2 = 1550056; GPBUnknownFields* ufs2 = [[[GPBUnknownFields alloc] initFromMessage:raw] autorelease]; XCTAssertTrue(ufs2.empty); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqual([raw.unknownFields countOfFields], (NSUInteger)0); -#pragma clang diagnostic pop - XCTAssertEqual(raw.itemArray.count, (NSUInteger)4); + XCTAssertEqual(raw.itemArray.count, (NSUInteger)3); XCTAssertEqual((uint32_t)[raw.itemArray[0] typeId], [MSetMessageExtension1 messageSetExtension].fieldNumber); XCTAssertEqual((uint32_t)[raw.itemArray[1] typeId], [MSetMessageExtension2 messageSetExtension].fieldNumber); - XCTAssertEqual([raw.itemArray[2] typeId], kUnknownTypeId); - XCTAssertEqual([raw.itemArray[3] typeId], kUnknownTypeId2); + XCTAssertEqual([raw.itemArray[2] typeId], kUnknownTypeId2); MSetMessageExtension1* message1 = [MSetMessageExtension1 parseFromData:[((MSetRawMessageSet_Item*)raw.itemArray[0]) message] @@ -168,8 +153,7 @@ const int kUnknownTypeId2 = 1550056; error:NULL]; XCTAssertEqualObjects(message2.str, @"foo"); - XCTAssertEqualObjects([raw.itemArray[2] message], DataFromCStr("bar")); - XCTAssertEqualObjects([raw.itemArray[3] message], DataFromCStr("baz")); + XCTAssertEqualObjects([raw.itemArray[2] message], DataFromCStr("baz")); } - (void)testParseMessageSet { @@ -222,15 +206,6 @@ const int kUnknownTypeId2 = 1550056; XCTAssertEqual(varint, kUnknownTypeId); XCTAssertEqualObjects([group firstLengthDelimited:GPBWireFormatMessageSetMessage], DataFromCStr("bar")); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqual([messageSet.unknownFields countOfFields], (NSUInteger)1); - GPBUnknownField* unknownField = [messageSet.unknownFields getField:kUnknownTypeId]; - XCTAssertNotNil(unknownField); - XCTAssertEqual(unknownField.lengthDelimitedList.count, (NSUInteger)1); - XCTAssertEqualObjects(unknownField.lengthDelimitedList[0], DataFromCStr("bar")); -#pragma clang diagnostic pop } - (void)testParseMessageSet_FirstValueSticks { diff --git a/third_party/protobuf/objectivec/google/protobuf/Any.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Any.pbobjc.h deleted file mode 100644 index e6d1b7450abe5..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Any.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBAny.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/Api.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Api.pbobjc.h deleted file mode 100644 index e7957db4e1220..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Api.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBApi.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/Duration.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Duration.pbobjc.h deleted file mode 100644 index fabf00f413d1e..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Duration.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBDuration.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/Empty.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Empty.pbobjc.h deleted file mode 100644 index 4de910870aa15..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Empty.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBEmpty.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/FieldMask.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/FieldMask.pbobjc.h deleted file mode 100644 index 26913200467ae..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/FieldMask.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBFieldMask.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/SourceContext.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/SourceContext.pbobjc.h deleted file mode 100644 index 321dfec993b21..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/SourceContext.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBSourceContext.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/Struct.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Struct.pbobjc.h deleted file mode 100644 index 1173d16fac609..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Struct.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBStruct.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/Timestamp.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Timestamp.pbobjc.h deleted file mode 100644 index 6a7cef84492ae..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Timestamp.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBTimestamp.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/Type.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Type.pbobjc.h deleted file mode 100644 index e14e7cdcae8fb..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Type.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBType.pbobjc.h" diff --git a/third_party/protobuf/objectivec/google/protobuf/Wrappers.pbobjc.h b/third_party/protobuf/objectivec/google/protobuf/Wrappers.pbobjc.h deleted file mode 100644 index 8365afc6df211..0000000000000 --- a/third_party/protobuf/objectivec/google/protobuf/Wrappers.pbobjc.h +++ /dev/null @@ -1,2 +0,0 @@ -// Moved to root of objectivec directory, shim to keep anyone's imports working. -#import "GPBWrappers.pbobjc.h" diff --git a/third_party/protobuf/patches/0029-make-initializers-optimizable.patch b/third_party/protobuf/patches/0029-make-initializers-optimizable.patch index b03b6e9f8662b..7646aad4839be 100644 --- a/third_party/protobuf/patches/0029-make-initializers-optimizable.patch +++ b/third_party/protobuf/patches/0029-make-initializers-optimizable.patch @@ -1,28 +1,30 @@ diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc -index 09b7db5d66226..887f97cc28639 100644 +index c073444d6cde8..9457a859eb8c1 100644 --- a/src/google/protobuf/generated_message_util.cc +++ b/src/google/protobuf/generated_message_util.cc -@@ -87,26 +87,17 @@ static void InitWeakDefaults() { +@@ -83,27 +83,17 @@ static void InitWeakDefaults() { void InitWeakDefaults() {} #endif -PROTOBUF_CONSTINIT std::atomic<bool> init_protobuf_defaults_state{false}; -static bool InitProtobufDefaultsImpl() { -+PROTOBUF_CONSTINIT bool init_protobuf_defaults_state{false}; -+void InitProtobufDefaultsSlow() { - fixed_address_empty_string.DefaultConstruct(); -- OnShutdownDestroyString(fixed_address_empty_string.get_mutable()); -+ init_protobuf_defaults_state = true; - InitWeakDefaults(); +- if (auto* to_destroy = fixed_address_empty_string.Init()) { +- OnShutdownDestroyString(to_destroy); +- } +- InitWeakDefaults(); - - - init_protobuf_defaults_state.store(true, std::memory_order_release); - return true; -} - --void InitProtobufDefaultsSlow() { ++PROTOBUF_CONSTINIT bool init_protobuf_defaults_state{false}; + void InitProtobufDefaultsSlow() { - static bool is_inited = InitProtobufDefaultsImpl(); - (void)is_inited; ++ fixed_address_empty_string.Init(); ++ init_protobuf_defaults_state = true; ++ InitWeakDefaults(); } // Force the initialization of the empty string. // Normally, registration would do it, but we don't have any guarantee that @@ -31,13 +33,13 @@ index 09b7db5d66226..887f97cc28639 100644 - (InitProtobufDefaultsSlow(), std::true_type{}); + (InitProtobufDefaults(), std::true_type{}); - size_t StringSpaceUsedExcludingSelfLong(const std::string& str) { - const void* start = &str; + const std::string& GetEmptyString() { + InitProtobufDefaults(); diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h -index ab676e406be78..99bb53ef7c5cb 100644 +index 989734e57f5d5..f7e29d6028ebc 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h -@@ -66,11 +66,14 @@ namespace internal { +@@ -67,11 +67,14 @@ namespace internal { // This fastpath inlines a single branch instead of having to make the // InitProtobufDefaults function call. // It also generates less inlined code than a function-scope static initializer. @@ -45,32 +47,16 @@ index ab676e406be78..99bb53ef7c5cb 100644 +PROTOBUF_EXPORT extern bool init_protobuf_defaults_state; PROTOBUF_EXPORT void InitProtobufDefaultsSlow(); PROTOBUF_EXPORT inline void InitProtobufDefaults() { -- if (PROTOBUF_PREDICT_FALSE( +- if (ABSL_PREDICT_FALSE( - !init_protobuf_defaults_state.load(std::memory_order_acquire))) { + // This is not thread-safe, but is called within a static initializer. As long + // as there are no calls to this function from off the main thread, before + // main() starts, this is safe. After main() starts, + // init_protobuf_defaults_state will always be true. -+ if (PROTOBUF_PREDICT_FALSE(!init_protobuf_defaults_state)) { ++ if (ABSL_PREDICT_FALSE(!init_protobuf_defaults_state)) { InitProtobufDefaultsSlow(); } } -diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc -index 8200a61ba8ad9..33ff5fd1d3219 100644 ---- a/src/google/protobuf/port_def.inc -+++ b/src/google/protobuf/port_def.inc -@@ -657,14 +657,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), - #define PROTOBUF_FINAL final - #endif - --// Determines the platforms where descriptor weak messages can be used. --#ifdef PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED --#error PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED was previously defined --#endif --#if defined(__GNUC__) && defined(__clang__) && !defined(__APPLE__) && \ -- !defined(_MSC_VER) --#define PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED --#endif - - - // TODO: Enable the feature by default and remove this flag. +-- +2.49.0.rc1.451.g8f38331e32-goog + diff --git a/third_party/protobuf/patches/0030-workaround-windows-constinit.patch b/third_party/protobuf/patches/0030-workaround-windows-constinit.patch index d0c406db1d7d7..5f5d209f9e222 100644 --- a/third_party/protobuf/patches/0030-workaround-windows-constinit.patch +++ b/third_party/protobuf/patches/0030-workaround-windows-constinit.patch @@ -38,32 +38,32 @@ index 460ff6c0244ec..8672b34a76967 100644 PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 $type$ $name$; )cc"); } -diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc -index bca954732d122..bd5b8cc3818ec 100644 ---- a/src/google/protobuf/compiler/cpp/message.cc -+++ b/src/google/protobuf/compiler/cpp/message.cc -@@ -4052,7 +4052,7 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { - }}, - }, - R"cc( -- PROTOBUF_CONSTINIT -+ PROTOBUF_CONSTINIT_WITH_PTR - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 - const $pbi$::ClassDataFull $classname$::_class_data_ = { - $pbi$::ClassData{ -diff --git a/src/google/protobuf/compiler/cpp/parse_function_generator.cc b/src/google/protobuf/compiler/cpp/parse_function_generator.cc -index d0a1731ddf7d5..283e9cc3b2d5b 100644 ---- a/src/google/protobuf/compiler/cpp/parse_function_generator.cc -+++ b/src/google/protobuf/compiler/cpp/parse_function_generator.cc -@@ -269,7 +269,7 @@ void ParseFunctionGenerator::GenerateTailCallTable(io::Printer* printer) { - // FileDescriptorProto is safe from this. - IsFileDescriptorProto(descriptor_->file(), options_) - ? "constexpr" -- : "PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1\nconst", -+ : "PROTOBUF_CONSTINIT_WITH_PTR PROTOBUF_ATTRIBUTE_INIT_PRIORITY1\nconst", - tc_table_info_->table_size_log2, ordered_fields_.size(), - tc_table_info_->aux_entries.size(), - FieldNameDataSize(tc_table_info_->field_name_data), +diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc +index 1b4b8e6051772..9caa39c20af28 100644 +--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc ++++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc +@@ -4210,7 +4210,7 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { + }; + } + +- PROTOBUF_CONSTINIT$ dllexport_decl$ ++ PROTOBUF_CONSTINIT_WITH_PTR$ dllexport_decl$ + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const $pbi$::ClassDataFull + $classname$_class_data_ = + $classname$::InternalGenerateClassData_(); +diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc +index 774679bd30804..be004cef4b39b 100644 +--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc ++++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc +@@ -464,7 +464,7 @@ void ParseFunctionGenerator::GenerateTailCallTable(io::Printer* p) { + // FileDescriptorProto is safe from this. + IsFileDescriptorProto(descriptor_->file(), options_) + ? "constexpr" +- : "PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1\nconst"}, ++ : "PROTOBUF_CONSTINIT_WITH_PTR PROTOBUF_ATTRIBUTE_INIT_PRIORITY1\nconst"}, + {"table_size_log2", tc_table_info_->table_size_log2}, + {"ordered_size", ordered_fields_.size()}, + {"aux_size", tc_table_info_->aux_entries.size()}, diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc index bad7d59e2bcdd..94229c6491476 100644 --- a/src/google/protobuf/extension_set.cc @@ -78,19 +78,6 @@ index bad7d59e2bcdd..94229c6491476 100644 prototype->GetTcParseTable() #else nullptr -diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h -index 0e37a16d7bc53..656a99fdc04e1 100644 ---- a/src/google/protobuf/map_field.h -+++ b/src/google/protobuf/map_field.h -@@ -680,7 +680,7 @@ class MapField final : public TypeDefinedMapFieldBase<Key, T> { - template <typename Derived, typename Key, typename T, - WireFormatLite::FieldType kKeyFieldType_, - WireFormatLite::FieldType kValueFieldType_> --PROTOBUF_CONSTINIT const MapFieldBase::VTable -+PROTOBUF_CONSTINIT_WITH_PTR const MapFieldBase::VTable - MapField<Derived, Key, T, kKeyFieldType_, kValueFieldType_>::kVTable = - MapField::template MakeVTable<MapField>(); - diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 075e10e925efa..999032346b18a 100644 --- a/src/google/protobuf/port_def.inc diff --git a/third_party/protobuf/patches/0031-workaround-cfi-unrelated-cast.patch b/third_party/protobuf/patches/0031-workaround-cfi-unrelated-cast.patch index 8d9aaa474616b..8202c74a02b0e 100644 --- a/third_party/protobuf/patches/0031-workaround-cfi-unrelated-cast.patch +++ b/third_party/protobuf/patches/0031-workaround-cfi-unrelated-cast.patch @@ -46,3 +46,23 @@ index cae9ebe01ec2c..b84b55e4d8762 100644 // ThreadSafeArenaz is turned off completely in opensource builds. // Windows declares several inconvenient macro names. We #undef them and then +diff --git a/third_party/protobuf/src/google/protobuf/map.h b/third_party/protobuf/src/google/protobuf/map.h +index 769435b9996b1..2d22dd031c53e 100644 +--- a/third_party/protobuf/src/google/protobuf/map.h ++++ b/third_party/protobuf/src/google/protobuf/map.h +@@ -320,6 +320,7 @@ class PROTOBUF_EXPORT UntypedMapBase { + UntypedMapBase& operator=(const UntypedMapBase&) = delete; + + template <typename T> ++ PROTOBUF_NO_SANITIZE("cfi-unrelated-cast", "vptr") + T* GetKey(NodeBase* node) const { + // Debug check that `T` matches what we expect from the type info. + ABSL_DCHECK_EQ(static_cast<int>(StaticTypeKind<T>()), +@@ -332,6 +333,7 @@ class PROTOBUF_EXPORT UntypedMapBase { + } + + template <typename T> ++ PROTOBUF_NO_SANITIZE("cfi-unrelated-cast", "vptr") + T* GetValue(NodeBase* node) const { + // Debug check that `T` matches what we expect from the type info. + ABSL_DCHECK_EQ(static_cast<int>(StaticTypeKind<T>()), diff --git a/third_party/protobuf/patches/0039-generate-mediapipe-anylite.patch b/third_party/protobuf/patches/0039-generate-mediapipe-anylite.patch index 5699273942336..d7de4c682527f 100644 --- a/third_party/protobuf/patches/0039-generate-mediapipe-anylite.patch +++ b/third_party/protobuf/patches/0039-generate-mediapipe-anylite.patch @@ -34,10 +34,10 @@ index e6a89222c432f..f515316381b81 100644 } diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc -index 7bd9e9f7d0668..0c9632cd0899d 100644 +index 825c685fe43de..1b4b8e6051772 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc -@@ -2303,28 +2303,32 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { +@@ -2444,30 +2444,34 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { return; } if (IsAnyMessage(descriptor_)) { @@ -56,33 +56,37 @@ index 7bd9e9f7d0668..0c9632cd0899d 100644 + p->Emit( + R"cc( + bool $classname$::GetAnyFieldDescriptors( -+ const ::$proto_ns$::Message& message, -+ const ::$proto_ns$::FieldDescriptor** type_url_field, -+ const ::$proto_ns$::FieldDescriptor** value_field) { ++ const $pb$::Message& message, ++ const $pb$::FieldDescriptor** type_url_field, ++ const $pb$::FieldDescriptor** value_field) { + return ::_pbi::GetAnyFieldDescriptors(message, type_url_field, value_field); + } + )cc"); + }}}, + R"cc( + $any_field_descriptor$; -+ bool $classname$::ParseAnyTypeUrl(::absl::string_view type_url, -+ std::string* full_type_name) { ++ bool $classname$::ParseAnyTypeUrl( ++ //~ ++ ::absl::string_view type_url, ++ std::string* $nonnull$ full_type_name) { + return ::_pbi::ParseAnyTypeUrl(type_url, full_type_name); } - p->Emit( - R"cc( - bool $classname$::GetAnyFieldDescriptors( -- const ::$proto_ns$::Message& message, -- const ::$proto_ns$::FieldDescriptor** type_url_field, -- const ::$proto_ns$::FieldDescriptor** value_field) { +- const $pb$::Message& message, +- const $pb$::FieldDescriptor** type_url_field, +- const $pb$::FieldDescriptor** value_field) { - return ::_pbi::GetAnyFieldDescriptors(message, type_url_field, value_field); - } - )cc"); - }}}, - R"cc( - $any_field_descriptor$; -- bool $classname$::ParseAnyTypeUrl(::absl::string_view type_url, -- std::string* full_type_name) { +- bool $classname$::ParseAnyTypeUrl( +- //~ +- ::absl::string_view type_url, +- std::string* $nonnull$ full_type_name) { - return ::_pbi::ParseAnyTypeUrl(type_url, full_type_name); - } - )cc"); diff --git a/third_party/protobuf/patches/0046-absl-log.patch b/third_party/protobuf/patches/0046-absl-log.patch deleted file mode 100644 index d6b4b71214357..0000000000000 --- a/third_party/protobuf/patches/0046-absl-log.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc -index 9652028e07bdb..6bb2f434db2c1 100644 ---- a/src/google/protobuf/message_lite.cc -+++ b/src/google/protobuf/message_lite.cc -@@ -23,7 +23,6 @@ - - #include "absl/log/absl_check.h" - #include "absl/log/absl_log.h" --#include "absl/log/log.h" - #include "absl/strings/cord.h" - #include "absl/strings/cord_buffer.h" - #include "absl/strings/str_cat.h" -diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc -index 989a3372624d1..cbe6f3adfe143 100644 ---- a/src/google/protobuf/wire_format_lite.cc -+++ b/src/google/protobuf/wire_format_lite.cc -@@ -20,7 +20,6 @@ - - #include "absl/log/absl_check.h" - #include "absl/log/absl_log.h" --#include "absl/log/log.h" - #include "absl/strings/cord.h" - #include "absl/strings/str_cat.h" - #include "absl/strings/str_format.h" diff --git a/third_party/protobuf/patches/0054-remove-usage-if-absl-internal-if_constexpr.patch b/third_party/protobuf/patches/0054-remove-usage-if-absl-internal-if_constexpr.patch deleted file mode 100644 index ef1be7eae6b40..0000000000000 --- a/third_party/protobuf/patches/0054-remove-usage-if-absl-internal-if_constexpr.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 1de8261ac45cbd24ad473847be04d4d1a1a50536 Mon Sep 17 00:00:00 2001 -From: Sophie Chang <sophiechang@chromium.org> -Date: Tue, 25 Feb 2025 17:51:22 +0000 -Subject: [PATCH] Remove usage if absl internal if_constexpr - ---- - .../protobuf/src/google/protobuf/arena.h | 61 ++++++++----------- - 1 file changed, 25 insertions(+), 36 deletions(-) - -diff --git a/third_party/protobuf/src/google/protobuf/arena.h b/third_party/protobuf/src/google/protobuf/arena.h -index 545fd5126a478..55b1ec83bd06f 100644 ---- a/third_party/protobuf/src/google/protobuf/arena.h -+++ b/third_party/protobuf/src/google/protobuf/arena.h -@@ -32,7 +32,6 @@ using type_info = ::type_info; - #include "absl/base/optimization.h" - #include "absl/base/prefetch.h" - #include "absl/log/absl_check.h" --#include "absl/utility/internal/if_constexpr.h" - #include "google/protobuf/arena_align.h" - #include "google/protobuf/arena_allocation_policy.h" - #include "google/protobuf/port.h" -@@ -214,41 +213,31 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { - // otherwise, returns a heap-allocated object. - template <typename T, typename... Args> - PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { -- return absl::utility_internal::IfConstexprElse< -- is_arena_constructable<T>::value>( -- // Arena-constructable -- [arena](auto&&... args) { -- using Type = std::remove_const_t<T>; --#ifdef __cpp_if_constexpr -- // DefaultConstruct/CopyConstruct are optimized for messages, which -- // are both arena constructible and destructor skippable and they -- // assume much. Don't use these functions unless the invariants -- // hold. -- if constexpr (is_destructor_skippable<T>::value) { -- constexpr auto construct_type = GetConstructType<T, Args&&...>(); -- // We delegate to DefaultConstruct/CopyConstruct where appropriate -- // because protobuf generated classes have external templates for -- // these functions for code size reasons. When `if constexpr` is not -- // available always use the fallback. -- if constexpr (construct_type == ConstructType::kDefault) { -- return static_cast<Type*>(DefaultConstruct<Type>(arena)); -- } else if constexpr (construct_type == ConstructType::kCopy) { -- return static_cast<Type*>(CopyConstruct<Type>(arena, &args...)); -- } -- } --#endif -- return CreateArenaCompatible<Type>(arena, -- std::forward<Args>(args)...); -- }, -- // Non arena-constructable -- [arena](auto&&... args) { -- if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { -- return new T(std::forward<Args>(args)...); -- } -- return new (arena->AllocateInternal<T>()) -- T(std::forward<Args>(args)...); -- }, -- std::forward<Args>(args)...); -+ if constexpr (is_arena_constructable<T>::value) { -+ using Type = std::remove_const_t<T>; -+ // DefaultConstruct/CopyConstruct are optimized for messages, which -+ // are both arena constructible and destructor skippable and they -+ // assume much. Don't use these functions unless the invariants -+ // hold. -+ if constexpr (is_destructor_skippable<T>::value) { -+ constexpr auto construct_type = GetConstructType<T, Args&&...>(); -+ // We delegate to DefaultConstruct/CopyConstruct where appropriate -+ // because protobuf generated classes have external templates for -+ // these functions for code size reasons. When `if constexpr` is not -+ // available always use the fallback. -+ if constexpr (construct_type == ConstructType::kDefault) { -+ return static_cast<Type*>(DefaultConstruct<Type>(arena)); -+ } else if constexpr (construct_type == ConstructType::kCopy) { -+ return static_cast<Type*>(CopyConstruct<Type>(arena, &args...)); -+ } -+ } -+ return CreateArenaCompatible<Type>(arena, std::forward<Args>(args)...); -+ } else { -+ if (ABSL_PREDICT_FALSE(arena == nullptr)) { -+ return new T(std::forward<Args>(args)...); -+ } -+ return new (arena->AllocateInternal<T>()) T(std::forward<Args>(args)...); -+ } - } - - // API to delete any objects not on an arena. This can be used to safely --- -2.48.1.711.g2feabab25a-goog - diff --git a/third_party/protobuf/php/BUILD.bazel b/third_party/protobuf/php/BUILD.bazel index cc0ba5b174a47..f1a0728d18834 100644 --- a/third_party/protobuf/php/BUILD.bazel +++ b/third_party/protobuf/php/BUILD.bazel @@ -7,14 +7,57 @@ load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("//:protobuf_version.bzl", "PROTOBUF_PHP_VERSION", "PROTOC_VERSION") load("//build_defs:internal_shell.bzl", "inline_sh_binary") load("//conformance:defs.bzl", "conformance_test") +load("//php:internal_generated_files.bzl", "DESCRIPTOR_GENERATED_FILES", "WKT_GENERATED_FILES") load("//upb/cmake:build_defs.bzl", "staleness_test") +# We must explicitly classify every checked-in php file because we can't +# distinguish gencode from hand-written code. The former must be kept +# up-to-date though, using our staleness infrastructure. + +_RUNTIME_SOURCES = [ + "src/Google/Protobuf/Descriptor.php", + "src/Google/Protobuf/DescriptorPool.php", + "src/Google/Protobuf/EnumDescriptor.php", + "src/Google/Protobuf/EnumValueDescriptor.php", + "src/Google/Protobuf/Field_Cardinality.php", + "src/Google/Protobuf/Field_Kind.php", + "src/Google/Protobuf/FieldDescriptor.php", + "src/Google/Protobuf/Internal/AnyBase.php", + "src/Google/Protobuf/Internal/CodedInputStream.php", + "src/Google/Protobuf/Internal/CodedOutputStream.php", + "src/Google/Protobuf/Internal/Descriptor.php", + "src/Google/Protobuf/Internal/DescriptorPool.php", + "src/Google/Protobuf/Internal/EnumBuilderContext.php", + "src/Google/Protobuf/Internal/EnumDescriptor.php", + "src/Google/Protobuf/Internal/FieldDescriptor.php", + "src/Google/Protobuf/Internal/FileDescriptor.php", + "src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php", + "src/Google/Protobuf/Internal/GPBDecodeException.php", + "src/Google/Protobuf/Internal/GPBJsonWire.php", + "src/Google/Protobuf/Internal/GPBLabel.php", + "src/Google/Protobuf/Internal/GPBType.php", + "src/Google/Protobuf/Internal/GPBUtil.php", + "src/Google/Protobuf/Internal/GPBWire.php", + "src/Google/Protobuf/Internal/GPBWireType.php", + "src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php", + "src/Google/Protobuf/Internal/MapEntry.php", + "src/Google/Protobuf/Internal/MapField.php", + "src/Google/Protobuf/Internal/MapFieldIter.php", + "src/Google/Protobuf/Internal/Message.php", + "src/Google/Protobuf/Internal/MessageBuilderContext.php", + "src/Google/Protobuf/Internal/OneofDescriptor.php", + "src/Google/Protobuf/Internal/OneofField.php", + "src/Google/Protobuf/Internal/RawInputStream.php", + "src/Google/Protobuf/Internal/RepeatedField.php", + "src/Google/Protobuf/Internal/RepeatedFieldIter.php", + "src/Google/Protobuf/Internal/TimestampBase.php", + "src/Google/Protobuf/OneofDescriptor.php", +] + filegroup( name = "source_files", - srcs = glob([ - "src/GPBMetadata/Google/Protobuf/**/*.php", - "src/Google/Protobuf/**/*.php", - ]) + [ + srcs = _RUNTIME_SOURCES + + ["generated/" + f for f in DESCRIPTOR_GENERATED_FILES + WKT_GENERATED_FILES] + [ "composer.json", ":php_ext_source_files", ], @@ -47,9 +90,16 @@ genrule( srcs = [ ":source_files", "//third_party/utf8_range:utf8_range_srcs", + "generated/ext/google/protobuf/wkt.inc", + "generated/ext/google/protobuf/php-upb.h", + "generated/ext/google/protobuf/php-upb.c", ], outs = ["protobuf.so"], cmd = """ + mkdir -p php/ext/google/protobuf + cp -f $(location generated/ext/google/protobuf/wkt.inc) php/ext/google/protobuf + cp -f $(location generated/ext/google/protobuf/php-upb.h) php/ext/google/protobuf + cp -f $(location generated/ext/google/protobuf/php-upb.c) php/ext/google/protobuf ./$(execpath :build_extension) $@ cp php/ext/google/protobuf/modules/protobuf.so $(OUTS) """, @@ -65,10 +115,6 @@ conformance_test( name = "conformance_test", failure_list = "//conformance:failure_list_php.txt", maximum_edition = "2023", - target_compatible_with = select({ - "@platforms//os:osx": ["@platforms//:incompatible"], - "//conditions:default": [], - }), testee = "//conformance:conformance_php", text_format_failure_list = "//conformance:text_format_failure_list_php.txt", ) @@ -77,10 +123,6 @@ conformance_test( name = "conformance_test_c", failure_list = "//conformance:failure_list_php_c.txt", maximum_edition = "2023", - target_compatible_with = select({ - "@platforms//os:osx": [], - "//conditions:default": ["@platforms//:incompatible"], - }), testee = "//conformance:conformance_php_c", text_format_failure_list = "//conformance:text_format_failure_list_php.txt", ) @@ -88,14 +130,14 @@ conformance_test( genrule( name = "copy_php_amalgamation_h", srcs = ["//upb:php-upb.h"], - outs = ["generated-in/ext/google/protobuf/php-upb.h"], + outs = ["generated/ext/google/protobuf/php-upb.h"], cmd = "cp $< $@", ) genrule( name = "copy_php_amalgamation_c", srcs = ["//upb:php-upb.c"], - outs = ["generated-in/ext/google/protobuf/php-upb.c"], + outs = ["generated/ext/google/protobuf/php-upb.c"], cmd = "cp $< $@", ) @@ -104,8 +146,51 @@ staleness_test( outs = [ "ext/google/protobuf/php-upb.c", "ext/google/protobuf/php-upb.h", + "ext/google/protobuf/wkt.inc", ], - generated_pattern = "generated-in/%s", + generated_pattern = "generated/%s", + tags = ["manual"], +) + +# The WKTs have to be checked in to support the Composer builds. This +# generule and test ensure the source are current. + +# Make sure we error if new files start showing up, since that may go unnoticed. +_CHECK_GENCODE = """ +for f in $$(find $(@D) -name "*.php"); do + local=$$(echo $$f | sed "s:bazel-out.*.bin.php.::g"); + if [[ "$(OUTS)" != *$$local* ]]; then + echo "Extra generated file $$local! Please update the lists in php/internal_generated_files.bzl" && exit 1; + fi +done +""" + +# These must be combined due to windows sandbox isolation issues. +genrule( + name = "gen_wkt_sources", + srcs = [ + "//src/google/protobuf:well_known_type_protos", + "//src/google/protobuf:descriptor_proto_srcs", + ], + outs = ["generated/" + wkt for wkt in WKT_GENERATED_FILES + DESCRIPTOR_GENERATED_FILES] + [ + "generated/ext/google/protobuf/wkt.inc", + ], + cmd = """ + $(execpath //:protoc) --php_out=internal_generate_c_wkt:$(RULEDIR)/generated/src --proto_path=src $(locations //src/google/protobuf:well_known_type_protos); + $(execpath //:protoc) --php_out=internal:$(RULEDIR)/generated/src --proto_path=src $(location //src/google/protobuf:descriptor_proto_srcs); + """ + _CHECK_GENCODE, + tags = ["manual"], + tools = ["//:protoc"], +) + +staleness_test( + name = "proto_staleness_test", + outs = glob( + ["src/**/*.php"], + allow_empty = True, + exclude = _RUNTIME_SOURCES + WKT_GENERATED_FILES + DESCRIPTOR_GENERATED_FILES, + ) + WKT_GENERATED_FILES + DESCRIPTOR_GENERATED_FILES, + generated_pattern = "generated/%s", tags = ["manual"], ) @@ -145,13 +230,18 @@ pkg_files( pkg_files( name = "php_ext_source_files", - srcs = glob([ - "ext/google/protobuf/*.h", - "ext/google/protobuf/*.c", - ]) + [ + srcs = glob( + [ + "ext/google/protobuf/*.h", + "ext/google/protobuf/*.c", + ], + exclude = [ + "*/php-upb.*", + "*/wkt.inc", + ], + ) + [ "ext/google/protobuf/config.m4", "ext/google/protobuf/config.w32", - "ext/google/protobuf/wkt.inc", "//:LICENSE", ], ) @@ -165,9 +255,20 @@ pkg_files( prefix = "third_party/utf8_range", ) +pkg_files( + name = "generated_files", + srcs = [ + "ext/google/protobuf/php-upb.c", + "ext/google/protobuf/php-upb.h", + "ext/google/protobuf/wkt.inc", + ], + prefix = "third_party/utf8_range", +) + pkg_filegroup( name = "pecl_release_files", srcs = [ + ":generated_files", ":php_ext_source_files", ":utf8_range_files", ], diff --git a/third_party/protobuf/php/ext/google/protobuf/config.w32 b/third_party/protobuf/php/ext/google/protobuf/config.w32 index 825197c409bd5..0223f9fd1e7c5 100644 --- a/third_party/protobuf/php/ext/google/protobuf/config.w32 +++ b/third_party/protobuf/php/ext/google/protobuf/config.w32 @@ -1,14 +1,7 @@ ARG_ENABLE("protobuf", "whether to enable Protobuf extension", "no"); if (PHP_PROTOBUF != "no") { - - var PHP_PROTOBUF_SRC_ARRAY = glob(configure_module_dirname + "/third_party/utf8_range/*.c"); - var PHP_PROTOBUF_SOURCES=" "; - for (var i=0; i<PHP_PROTOBUF_SRC_ARRAY.length; ++i) { - var basename = FSO.GetFileName(PHP_PROTOBUF_SRC_ARRAY[i]); - PHP_PROTOBUF_SOURCES = PHP_PROTOBUF_SOURCES + " " + basename; - } - ADD_SOURCES(configure_module_dirname + "/third_party/utf8_range", PHP_PROTOBUF_SOURCES, "PROTOBUF"); + ADD_SOURCES(configure_module_dirname + "/third_party/utf8_range", "utf8_range.c", "PROTOBUF"); ADD_FLAG("CFLAGS_PROTOBUF", "/I" + configure_module_dirname + "/third_party/utf8_range"); EXTENSION("protobuf", "arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c"); } diff --git a/third_party/protobuf/php/ext/google/protobuf/generate_package_xml.sh b/third_party/protobuf/php/ext/google/protobuf/generate_package_xml.sh index 7d4aa94a91dfa..8fc43dba3fd0d 100755 --- a/third_party/protobuf/php/ext/google/protobuf/generate_package_xml.sh +++ b/third_party/protobuf/php/ext/google/protobuf/generate_package_xml.sh @@ -37,5 +37,5 @@ sed -e "s;TEMPLATE_TIME;${time};" | sed -e "s;TEMPLATE_PHP_RELEASE;${release_version};" | sed -e "s;TEMPLATE_PHP_API;${api_version};" | sed -e "s;TEMPLATE_PHP_STABILITY;${stability};g" | -sed -e "s;TEMPLATE_PROTOC_VERSION;${protoc_version};" | +sed -e "s;TEMPLATE_PROTOC_VERSION;${protoc_version//-rc-/-rc};" | sed -e "s;TEMPLATE_FILES;${files};" > $out diff --git a/third_party/protobuf/php/ext/google/protobuf/message.c b/third_party/protobuf/php/ext/google/protobuf/message.c index b00a11519d22d..c1ada126d0afd 100644 --- a/third_party/protobuf/php/ext/google/protobuf/message.c +++ b/third_party/protobuf/php/ext/google/protobuf/message.c @@ -312,7 +312,13 @@ static zval* Message_read_property(zend_object* obj, zend_string* member, const upb_FieldDef* f = get_field(intern, member); if (!f) return &EG(uninitialized_zval); - Message_get(intern, f, rv); + + if (upb_FieldDef_IsOptional(f) && upb_FieldDef_HasPresence(f) && + Message_has_property(obj, member, 0, cache_slot) == false) { + ZVAL_NULL(rv); + } else { + Message_get(intern, f, rv); + } return rv; } @@ -577,7 +583,8 @@ PHP_METHOD(Message, __construct) { */ PHP_METHOD(Message, discardUnknownFields) { Message* intern = (Message*)Z_OBJ_P(getThis()); - upb_Message_DiscardUnknown(intern->msg, intern->desc->msgdef, 64); + upb_Message_DiscardUnknown(intern->msg, intern->desc->msgdef, + DescriptorPool_GetSymbolTable(), 64); } /** @@ -729,9 +736,6 @@ PHP_METHOD(Message, mergeFromJsonString) { switch (result) { case kUpb_JsonDecodeResult_Ok: break; - case kUpb_JsonDecodeResult_OkWithEmptyStringNumerics: - zend_error(E_USER_WARNING, "%s", upb_Status_ErrorMessage(&status)); - return; case kUpb_JsonDecodeResult_Error: zend_throw_exception_ex(NULL, 0, "Error occurred during parsing: %s", upb_Status_ErrorMessage(&status)); diff --git a/third_party/protobuf/php/ext/google/protobuf/php-upb.c b/third_party/protobuf/php/ext/google/protobuf/php-upb.c index 5e09474c7e85f..c89034dd7b0f2 100644 --- a/third_party/protobuf/php/ext/google/protobuf/php-upb.c +++ b/third_party/protobuf/php/ext/google/protobuf/php-upb.c @@ -24,9 +24,9 @@ */ #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(__cplusplus) && __cplusplus >= 201703L) || \ (defined(_MSC_VER) && _MSC_VER >= 1900)) -#error upb requires C99 or C++14 or MSVC >= 2015. +#error upb requires C99 or C++17 or MSVC >= 2015. #endif // Portable check for GCC minimum version: @@ -58,7 +58,14 @@ Error, UINTPTR_MAX is undefined /* If we always read/write as a consistent type to each address, this shouldn't * violate aliasing. */ -#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) +#define UPB_PTR_AT(msg, ofs, type) ((type *)((char *)(msg) + (ofs))) + +// A flexible array member may have lower alignment requirements than the struct +// overall - in that case, it can overlap with the trailing padding of the rest +// of the struct, and a naive sizeof(base) + sizeof(flex) * count calculation +// will not take into account that overlap, and allocate more than is required. +#define UPB_SIZEOF_FLEX(type, member, count) \ + UPB_MAX(sizeof(type), offsetof(type, member[count])) #define UPB_MAPTYPE_STRING 0 @@ -72,12 +79,19 @@ Error, UINTPTR_MAX is undefined // UPB_INLINE: inline if possible, emit standalone code if required. #ifdef __cplusplus #define UPB_INLINE inline -#elif defined (__GNUC__) || defined(__clang__) +#elif defined(__GNUC__) || defined(__clang__) #define UPB_INLINE static __inline__ #else #define UPB_INLINE static #endif +// UPB_INLINE_IF_NOT_GCC: because gcc can be very noisy at times. +#if defined(__GNUC__) && !defined(__clang__) +#define UPB_INLINE_IF_NOT_GCC static +#else +#define UPB_INLINE_IF_NOT_GCC UPB_INLINE +#endif + #ifdef UPB_BUILD_API #define UPB_API UPB_EXPORT #define UPB_API_INLINE UPB_EXPORT @@ -99,7 +113,13 @@ Error, UINTPTR_MAX is undefined #ifdef __clang__ #define UPB_ALIGN_OF(type) _Alignof(type) #else -#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) +#define UPB_ALIGN_OF(type) \ + offsetof( \ + struct { \ + char c; \ + type member; \ + }, \ + member) #endif #ifdef _MSC_VER @@ -110,7 +130,7 @@ Error, UINTPTR_MAX is undefined #endif // Hints to the compiler about likely/unlikely branches. -#if defined (__GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) #else @@ -118,18 +138,30 @@ Error, UINTPTR_MAX is undefined #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static #define UPB_NOINLINE __attribute__((noinline)) #define UPB_NORETURN __attribute__((__noreturn__)) -#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) +#define UPB_PRINTF(str, first_vararg) \ + __attribute__((format(printf, str, first_vararg))) #elif defined(_MSC_VER) #define UPB_NOINLINE #define UPB_FORCEINLINE static #define UPB_NORETURN __declspec(noreturn) #define UPB_PRINTF(str, first_vararg) -#else /* !defined(__GNUC__) */ +#else /* !defined(__GNUC__) */ #define UPB_FORCEINLINE static #define UPB_NOINLINE #define UPB_NORETURN @@ -144,11 +176,15 @@ Error, UINTPTR_MAX is undefined // UPB_ASSUME(): in release mode, we tell the compiler to assume this is true. #ifdef NDEBUG #ifdef __GNUC__ -#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() +#define UPB_ASSUME(expr) \ + if (!(expr)) __builtin_unreachable() #elif defined _MSC_VER -#define UPB_ASSUME(expr) if (!(expr)) __assume(0) +#define UPB_ASSUME(expr) \ + if (!(expr)) __assume(0) #else -#define UPB_ASSUME(expr) do {} while (false && (expr)) +#define UPB_ASSUME(expr) \ + do { \ + } while (false && (expr)) #endif #else #define UPB_ASSUME(expr) assert(expr) @@ -157,13 +193,19 @@ Error, UINTPTR_MAX is undefined /* UPB_ASSERT(): in release mode, we use the expression without letting it be * evaluated. This prevents "unused variable" warnings. */ #ifdef NDEBUG -#define UPB_ASSERT(expr) do {} while (false && (expr)) +#define UPB_ASSERT(expr) \ + do { \ + } while (false && (expr)) #else #define UPB_ASSERT(expr) assert(expr) #endif #if defined(__GNUC__) || defined(__clang__) -#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __builtin_unreachable(); \ + } while (0) #elif defined(_MSC_VER) #define UPB_UNREACHABLE() \ do { \ @@ -171,13 +213,26 @@ Error, UINTPTR_MAX is undefined __assume(0); \ } while (0) #else -#define UPB_UNREACHABLE() do { assert(0); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + } while (0) #endif -/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ -#ifdef __APPLE__ -#define UPB_SETJMP(buf) _setjmp(buf) -#define UPB_LONGJMP(buf, val) _longjmp(buf, val) +#ifdef __ANDROID__ +#define UPB_DEFAULT_MAX_BLOCK_SIZE 8192 +#else +#define UPB_DEFAULT_MAX_BLOCK_SIZE 32768 +#endif + +/* UPB_SETJMP() / UPB_LONGJMP() */ +// Android uses a custom libc that does not implement all of posix, but it has +// had sigsetjmp/siglongjmp forever on arm and since API 12 on x86. Apple has +// sigsetjmp, but does not define the posix feature test macro. +#if defined(__APPLE__) || defined(_POSIX_C_SOURCE) || defined(__ANDROID__) +// avoid setting/restoring signal mask, which involves costly syscalls +#define UPB_SETJMP(buf) sigsetjmp(buf, 0) +#define UPB_LONGJMP(buf, val) siglongjmp(buf, val) #elif defined(WASM_WAMR) #define UPB_SETJMP(buf) 0 #define UPB_LONGJMP(buf, val) abort() @@ -186,9 +241,23 @@ Error, UINTPTR_MAX is undefined #define UPB_LONGJMP(buf, val) longjmp(buf, val) #endif -#ifdef __GNUC__ +#if ((__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)) #define UPB_USE_C11_ATOMICS +#elif defined(__has_extension) +#if __has_extension(c_atomic) +#define UPB_USE_C11_ATOMICS +#endif +#elif defined(__GNUC__) +// GCC supported atomics as an extension before it supported __has_extension +#define UPB_USE_C11_ATOMICS +#elif defined(_MSC_VER) +#define UPB_USE_MSC_ATOMICS +#endif + +#if defined(UPB_USE_C11_ATOMICS) #define UPB_ATOMIC(T) _Atomic(T) +#elif defined(UPB_USE_MSC_ATOMICS) +#define UPB_ATOMIC(T) volatile T #else #define UPB_ATOMIC(T) T #endif @@ -276,7 +345,7 @@ Error, UINTPTR_MAX is undefined */ /* Due to preprocessor limitations, the conditional logic for setting - * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner. + * UPB_CLANG_ASAN below cannot be consolidated into a portable one-liner. * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html. */ #if defined(__has_feature) @@ -285,8 +354,14 @@ Error, UINTPTR_MAX is undefined #else #define UPB_CLANG_ASAN 0 #endif +#if __has_feature(thread_sanitizer) +#define UPB_CLANG_TSAN 1 +#else +#define UPB_CLANG_TSAN 0 +#endif #else #define UPB_CLANG_ASAN 0 +#define UPB_CLANG_TSAN 0 #endif #if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN @@ -295,10 +370,10 @@ Error, UINTPTR_MAX is undefined #ifdef __cplusplus extern "C" { #endif -void __asan_poison_memory_region(void const volatile *addr, size_t size); -void __asan_unpoison_memory_region(void const volatile *addr, size_t size); + void __asan_poison_memory_region(void const volatile *addr, size_t size); + void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #ifdef __cplusplus -} /* extern "C" */ +} /* extern "C" */ #endif #define UPB_POISON_MEMORY_REGION(addr, size) \ __asan_poison_memory_region((addr), (size)) @@ -307,10 +382,38 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #else #define UPB_ASAN 0 #define UPB_ASAN_GUARD_SIZE 0 -#define UPB_POISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) -#define UPB_UNPOISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) +#define UPB_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#define UPB_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#endif + +#if defined(__SANITIZE_THREAD__) || UPB_CLANG_TSAN +#define UPB_TSAN_PUBLISHED_MEMBER uintptr_t upb_tsan_safely_published; +#define UPB_TSAN_INIT_PUBLISHED(ptr) (ptr)->upb_tsan_safely_published = 0x5AFE +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + UPB_ASSERT((ptr)->upb_tsan_safely_published == 0x5AFE) +#define UPB_TSAN_PUBLISH 1 +#define UPB_TSAN_CHECK_READ(member) \ + __asm__ volatile("" ::"r"(*(char *)&(member))) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + char *write_upb_tsan_detect_race_ptr = (char *)&(member); \ + char write_upb_tsan_detect_race = *write_upb_tsan_detect_race_ptr; \ + __asm__ volatile("" : "+r"(write_upb_tsan_detect_race)); \ + *write_upb_tsan_detect_race_ptr = write_upb_tsan_detect_race; \ + } while (false) +#else +#define UPB_TSAN_PUBLISHED_MEMBER +#define UPB_TSAN_INIT_PUBLISHED(ptr) +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + do { \ + } while (false && (ptr)) +#define UPB_TSAN_PUBLISH 0 +#define UPB_TSAN_CHECK_READ(member) \ + do { \ + } while (false && (member)) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + } while (false && (member)) #endif /* Disable proto2 arena behavior (TEMPORARY) **********************************/ @@ -376,8 +479,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #if defined(__ELF__) || defined(__wasm__) -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("linkarr_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("linkarr_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name; \ extern type const __stop_linkarr_##name; \ @@ -388,8 +492,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #elif defined(__MACH__) /* As described in: https://stackoverflow.com/a/22366882 */ -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("__DATA,__la_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("__DATA,__la_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name __asm( \ "section$start$__DATA$__la_" #name); \ @@ -409,8 +514,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // Usage of __attribute__ here probably means this is Clang-specific, and would // not work on MSVC. -#define UPB_LINKARR_APPEND(name) \ - __declspec(allocate("la_" #name "$j")) __attribute__((retain, used)) +#define UPB_LINKARR_APPEND(name) \ + __declspec(allocate("la_" #name "$j")) \ + __attribute__((retain, used, no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ __declspec(allocate("la_" #name "$a")) type __start_linkarr_##name; \ __declspec(allocate("la_" #name "$z")) type __stop_linkarr_##name; \ @@ -431,10 +537,6 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // user code can be updated before upgrading versions of protobuf. #ifdef UPB_FUTURE_BREAKING_CHANGES -// Properly enforce closed enums in python. -// Owner: mkruskal@ -#define UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT 1 - #endif @@ -1156,7 +1258,7 @@ static int64_t jsondec_strtoint64(jsondec* d, upb_StringView str) { static void jsondec_checkempty(jsondec* d, upb_StringView str, const upb_FieldDef* f) { if (str.size != 0) return; - d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics; + d->result = kUpb_JsonDecodeResult_Error; upb_Status_SetErrorFormat(d->status, "Empty string is not a valid number (field: %s). " "This will be an error in a future version.", @@ -1264,7 +1366,7 @@ static upb_MessageValue jsondec_double(jsondec* d, const upb_FieldDef* f) { char* end; val.double_val = strtod(str.data, &end); if (end != str.data + str.size) { - d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics; + d->result = kUpb_JsonDecodeResult_Error; upb_Status_SetErrorFormat( d->status, "Non-number characters in quoted number (field: %s). " @@ -2859,14 +2961,15 @@ upb_alloc upb_alloc_global = {&upb_global_allocfunc}; // Must be last. -static UPB_ATOMIC(size_t) max_block_size = 32 << 10; +static UPB_ATOMIC(size_t) g_max_block_size = UPB_DEFAULT_MAX_BLOCK_SIZE; -void upb_Arena_SetMaxBlockSize(size_t max) { max_block_size = max; } +void upb_Arena_SetMaxBlockSize(size_t max) { + upb_Atomic_Store(&g_max_block_size, max, memory_order_relaxed); +} typedef struct upb_MemBlock { - // Atomic only for the benefit of SpaceAllocated(). - UPB_ATOMIC(struct upb_MemBlock*) next; - uint32_t size; + struct upb_MemBlock* next; + size_t size; // Data follows. } upb_MemBlock; @@ -2875,6 +2978,10 @@ typedef struct upb_ArenaInternal { // block. uintptr_t block_alloc; + // The cleanup for the allocator. This is called after all the blocks are + // freed in an arena. + upb_AllocCleanupFunc* upb_alloc_cleanup; + // When multiple arenas are fused together, each arena points to a parent // arena (root points to itself). The root tracks how many live arenas // reference it. @@ -2888,15 +2995,19 @@ typedef struct upb_ArenaInternal { // == NULL at end of list. UPB_ATOMIC(struct upb_ArenaInternal*) next; - // The last element of the linked list. This is present only as an - // optimization, so that we do not have to iterate over all members for every - // fuse. Only significant for an arena root. In other cases it is ignored. - // == self when no other list members. - UPB_ATOMIC(struct upb_ArenaInternal*) tail; + // If the low bit is set, is a pointer to the tail of the list (populated for + // roots, set to self for roots with no fused arenas). If the low bit is not + // set, is a pointer to the previous node in the list, such that + // a->previous_or_tail->next == a. + UPB_ATOMIC(uintptr_t) previous_or_tail; - // Linked list of blocks to free/cleanup. Atomic only for the benefit of - // upb_Arena_SpaceAllocated(). - UPB_ATOMIC(upb_MemBlock*) blocks; + // Linked list of blocks to free/cleanup. + upb_MemBlock* blocks; + + // Total space allocated in blocks, atomic only for SpaceAllocated + UPB_ATOMIC(uintptr_t) space_allocated; + + UPB_TSAN_PUBLISHED_MEMBER } upb_ArenaInternal; // All public + private state for an arena. @@ -2911,7 +3022,7 @@ typedef struct { } upb_ArenaRoot; static const size_t kUpb_MemblockReserve = - UPB_ALIGN_UP(sizeof(upb_MemBlock), UPB_MALLOC_ALIGN); + UPB_ALIGN_MALLOC(sizeof(upb_MemBlock)); // Extracts the (upb_ArenaInternal*) from a (upb_Arena*) static upb_ArenaInternal* upb_Arena_Internal(const upb_Arena* a) { @@ -2949,6 +3060,38 @@ static uintptr_t _upb_Arena_TaggedFromPointer(upb_ArenaInternal* ai) { return parent_or_count; } +static bool _upb_Arena_IsTaggedTail(uintptr_t previous_or_tail) { + return (previous_or_tail & 1) == 1; +} + +static bool _upb_Arena_IsTaggedPrevious(uintptr_t previous_or_tail) { + return (previous_or_tail & 1) == 0; +} + +static upb_ArenaInternal* _upb_Arena_TailFromTagged( + uintptr_t previous_or_tail) { + UPB_ASSERT(_upb_Arena_IsTaggedTail(previous_or_tail)); + return (upb_ArenaInternal*)(previous_or_tail ^ 1); +} + +static uintptr_t _upb_Arena_TaggedFromTail(upb_ArenaInternal* tail) { + uintptr_t previous_or_tail = (uintptr_t)tail | 1; + UPB_ASSERT(_upb_Arena_IsTaggedTail(previous_or_tail)); + return previous_or_tail; +} + +static upb_ArenaInternal* _upb_Arena_PreviousFromTagged( + uintptr_t previous_or_tail) { + UPB_ASSERT(_upb_Arena_IsTaggedPrevious(previous_or_tail)); + return (upb_ArenaInternal*)previous_or_tail; +} + +static uintptr_t _upb_Arena_TaggedFromPrevious(upb_ArenaInternal* ai) { + uintptr_t previous = (uintptr_t)ai; + UPB_ASSERT(_upb_Arena_IsTaggedPrevious(previous)); + return previous; +} + static upb_alloc* _upb_ArenaInternal_BlockAlloc(upb_ArenaInternal* ai) { return (upb_alloc*)(ai->block_alloc & ~0x1); } @@ -2995,56 +3138,79 @@ void upb_Arena_LogFree(const upb_Arena* arena) { } #endif // UPB_TRACING_ENABLED -static upb_ArenaRoot _upb_Arena_FindRoot(upb_Arena* a) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - while (_upb_Arena_IsTaggedPointer(poc)) { +// If the param a is already the root, provides no memory order of refcount. +// If it has a parent, then acquire memory order is provided for both the root +// and the refcount. Thread safe. +static upb_ArenaRoot _upb_Arena_FindRoot(upb_ArenaInternal* ai) { + uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_relaxed); + if (_upb_Arena_IsTaggedRefcount(poc)) { + // Fast, relaxed path - arenas that have never been fused to a parent only + // need relaxed memory order, since they're returning themselves and the + // refcount. + return (upb_ArenaRoot){.root = ai, .tagged_count = poc}; + } + // Slow path needs acquire order; reloading is cheaper than a fence on ARM + // (LDA vs DMB ISH). Even though this is a reread, we know it must be a tagged + // pointer because if this Arena isn't a root, it can't ever become one. + poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); + do { upb_ArenaInternal* next = _upb_Arena_PointerFromTagged(poc); + UPB_TSAN_CHECK_PUBLISHED(next); UPB_ASSERT(ai != next); - uintptr_t next_poc = - upb_Atomic_Load(&next->parent_or_count, memory_order_acquire); + poc = upb_Atomic_Load(&next->parent_or_count, memory_order_acquire); - if (_upb_Arena_IsTaggedPointer(next_poc)) { + if (_upb_Arena_IsTaggedPointer(poc)) { // To keep complexity down, we lazily collapse levels of the tree. This // keeps it flat in the final case, but doesn't cost much incrementally. // // Path splitting keeps time complexity down, see: // https://en.wikipedia.org/wiki/Disjoint-set_data_structure - // - // We can safely use a relaxed atomic here because all threads doing this - // will converge on the same value and we don't need memory orderings to - // be visible. - // - // This is true because: - // - If no fuses occur, this will eventually become the root. - // - If fuses are actively occurring, the root may change, but the - // invariant is that `parent_or_count` merely points to *a* parent. - // - // In other words, it is moving towards "the" root, and that root may move - // further away over time, but the path towards that root will continue to - // be valid and the creation of the path carries all the memory orderings - // required. - UPB_ASSERT(ai != _upb_Arena_PointerFromTagged(next_poc)); - upb_Atomic_Store(&ai->parent_or_count, next_poc, memory_order_relaxed); + UPB_ASSERT(ai != _upb_Arena_PointerFromTagged(poc)); + upb_Atomic_Store(&ai->parent_or_count, poc, memory_order_release); } ai = next; - poc = next_poc; - } + } while (_upb_Arena_IsTaggedPointer(poc)); return (upb_ArenaRoot){.root = ai, .tagged_count = poc}; } -size_t upb_Arena_SpaceAllocated(upb_Arena* arena, size_t* fused_count) { - upb_ArenaInternal* ai = _upb_Arena_FindRoot(arena).root; - size_t memsize = 0; +uintptr_t upb_Arena_SpaceAllocated(const upb_Arena* arena, + size_t* fused_count) { + upb_ArenaInternal* ai = upb_Arena_Internal(arena); + uintptr_t memsize = 0; size_t local_fused_count = 0; - + // Our root would get updated by any racing fuses before our target arena + // became reachable from the root via the linked list; in order to preserve + // monotonic output (any arena counted by a previous invocation is counted by + // this one), we instead iterate forwards and backwards so that we only see + // the results of completed fuses. + uintptr_t previous_or_tail = + upb_Atomic_Load(&ai->previous_or_tail, memory_order_acquire); + while (_upb_Arena_IsTaggedPrevious(previous_or_tail)) { + upb_ArenaInternal* previous = + _upb_Arena_PreviousFromTagged(previous_or_tail); + UPB_ASSERT(previous != ai); + UPB_TSAN_CHECK_PUBLISHED(previous); + // Unfortunate macro behavior; prior to C11 when using nonstandard atomics + // this returns a void* and can't be used with += without an intermediate + // conversion to an integer. + // Relaxed is safe - no subsequent reads depend this one + uintptr_t allocated = + upb_Atomic_Load(&previous->space_allocated, memory_order_relaxed); + memsize += allocated; + previous_or_tail = + upb_Atomic_Load(&previous->previous_or_tail, memory_order_acquire); + local_fused_count++; + } while (ai != NULL) { - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_relaxed); - while (block != NULL) { - memsize += sizeof(upb_MemBlock) + block->size; - block = upb_Atomic_Load(&block->next, memory_order_relaxed); - } - ai = upb_Atomic_Load(&ai->next, memory_order_relaxed); + UPB_TSAN_CHECK_PUBLISHED(ai); + // Unfortunate macro behavior; prior to C11 when using nonstandard atomics + // this returns a void* and can't be used with += without an intermediate + // conversion to an integer. + // Relaxed is safe - no subsequent reads depend this one + uintptr_t allocated = + upb_Atomic_Load(&ai->space_allocated, memory_order_relaxed); + memsize += allocated; + ai = upb_Atomic_Load(&ai->next, memory_order_acquire); local_fused_count++; } @@ -3052,44 +3218,24 @@ size_t upb_Arena_SpaceAllocated(upb_Arena* arena, size_t* fused_count) { return memsize; } -bool UPB_PRIVATE(_upb_Arena_Contains)(const upb_Arena* a, void* ptr) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - UPB_ASSERT(ai); - - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_relaxed); - while (block) { - uintptr_t beg = (uintptr_t)block; - uintptr_t end = beg + block->size; - if ((uintptr_t)ptr >= beg && (uintptr_t)ptr < end) return true; - block = upb_Atomic_Load(&block->next, memory_order_relaxed); - } - - return false; +uint32_t upb_Arena_DebugRefCount(const upb_Arena* a) { + uintptr_t tagged = _upb_Arena_FindRoot(upb_Arena_Internal(a)).tagged_count; + return (uint32_t)_upb_Arena_RefCountFromTagged(tagged); } -uint32_t upb_Arena_DebugRefCount(upb_Arena* a) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - // These loads could probably be relaxed, but given that this is debug-only, - // it's not worth introducing a new variant for it. - uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - while (_upb_Arena_IsTaggedPointer(poc)) { - ai = _upb_Arena_PointerFromTagged(poc); - poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - } - return _upb_Arena_RefCountFromTagged(poc); -} - -static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t size) { +static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t offset, + size_t block_size) { upb_ArenaInternal* ai = upb_Arena_Internal(a); upb_MemBlock* block = ptr; + block->size = block_size; // Insert into linked list. - block->size = (uint32_t)size; - upb_Atomic_Init(&block->next, ai->blocks); - upb_Atomic_Store(&ai->blocks, block, memory_order_release); + block->next = ai->blocks; + ai->blocks = block; - a->UPB_PRIVATE(ptr) = UPB_PTR_AT(block, kUpb_MemblockReserve, char); - a->UPB_PRIVATE(end) = UPB_PTR_AT(block, size, char); + UPB_ASSERT(offset >= kUpb_MemblockReserve); + a->UPB_PRIVATE(ptr) = UPB_PTR_AT(block, offset, char); + a->UPB_PRIVATE(end) = UPB_PTR_AT(block, block_size, char); UPB_POISON_MEMORY_REGION(a->UPB_PRIVATE(ptr), a->UPB_PRIVATE(end) - a->UPB_PRIVATE(ptr)); @@ -3098,21 +3244,37 @@ static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t size) { static bool _upb_Arena_AllocBlock(upb_Arena* a, size_t size) { upb_ArenaInternal* ai = upb_Arena_Internal(a); if (!ai->block_alloc) return false; - upb_MemBlock* last_block = upb_Atomic_Load(&ai->blocks, memory_order_acquire); - size_t last_size = last_block != NULL ? last_block->size : 128; + size_t last_size = 128; + upb_MemBlock* last_block = ai->blocks; + if (last_block) { + last_size = a->UPB_PRIVATE(end) - (char*)last_block; + } + + // Relaxed order is safe here as we don't need any ordering with the setter. + size_t max_block_size = + upb_Atomic_Load(&g_max_block_size, memory_order_relaxed); // Don't naturally grow beyond the max block size. size_t clamped_size = UPB_MIN(last_size * 2, max_block_size); // We may need to exceed the max block size if the user requested a large // allocation. - size_t block_size = UPB_MAX(size, clamped_size) + kUpb_MemblockReserve; + size_t block_size = UPB_MAX(kUpb_MemblockReserve + size, clamped_size); upb_MemBlock* block = upb_malloc(_upb_ArenaInternal_BlockAlloc(ai), block_size); if (!block) return false; - _upb_Arena_AddBlock(a, block, block_size); + _upb_Arena_AddBlock(a, block, kUpb_MemblockReserve, block_size); + // Atomic add not required here, as threads won't race allocating blocks, plus + // atomic fetch-add is slower than load/add/store on arm devices compiled + // targetting pre-v8.1. Relaxed order is safe as nothing depends on order of + // size allocated. + + uintptr_t old_space_allocated = + upb_Atomic_Load(&ai->space_allocated, memory_order_relaxed); + upb_Atomic_Store(&ai->space_allocated, old_space_allocated + block_size, + memory_order_relaxed); UPB_ASSERT(UPB_PRIVATE(_upb_ArenaHas)(a) >= size); return true; } @@ -3122,28 +3284,33 @@ void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(upb_Arena* a, size_t size) { return upb_Arena_Malloc(a, size - UPB_ASAN_GUARD_SIZE); } -static upb_Arena* _upb_Arena_InitSlow(upb_alloc* alloc) { +static upb_Arena* _upb_Arena_InitSlow(upb_alloc* alloc, size_t first_size) { const size_t first_block_overhead = - sizeof(upb_ArenaState) + kUpb_MemblockReserve; + UPB_ALIGN_MALLOC(kUpb_MemblockReserve + sizeof(upb_ArenaState)); upb_ArenaState* a; // We need to malloc the initial block. char* mem; - size_t n = first_block_overhead + 256; - if (!alloc || !(mem = upb_malloc(alloc, n))) { + size_t block_size = + first_block_overhead + + UPB_MAX(256, UPB_ALIGN_MALLOC(first_size) + UPB_ASAN_GUARD_SIZE); + if (!alloc || !(mem = upb_malloc(alloc, block_size))) { return NULL; } - a = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), upb_ArenaState); - n -= sizeof(upb_ArenaState); + a = UPB_PTR_AT(mem, kUpb_MemblockReserve, upb_ArenaState); a->body.block_alloc = _upb_Arena_MakeBlockAlloc(alloc, 0); upb_Atomic_Init(&a->body.parent_or_count, _upb_Arena_TaggedFromRefcount(1)); upb_Atomic_Init(&a->body.next, NULL); - upb_Atomic_Init(&a->body.tail, &a->body); - upb_Atomic_Init(&a->body.blocks, NULL); + upb_Atomic_Init(&a->body.previous_or_tail, + _upb_Arena_TaggedFromTail(&a->body)); + upb_Atomic_Init(&a->body.space_allocated, block_size); + a->body.blocks = NULL; + a->body.upb_alloc_cleanup = NULL; + UPB_TSAN_INIT_PUBLISHED(&a->body); - _upb_Arena_AddBlock(&a->head, mem, n); + _upb_Arena_AddBlock(&a->head, mem, first_block_overhead, block_size); return &a->head; } @@ -3152,38 +3319,34 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) { UPB_ASSERT(sizeof(void*) * UPB_ARENA_SIZE_HACK >= sizeof(upb_ArenaState)); upb_ArenaState* a; - if (n) { + if (mem) { /* Align initial pointer up so that we return properly-aligned pointers. */ - void* aligned = (void*)UPB_ALIGN_UP((uintptr_t)mem, UPB_MALLOC_ALIGN); + void* aligned = (void*)UPB_ALIGN_MALLOC((uintptr_t)mem); size_t delta = (uintptr_t)aligned - (uintptr_t)mem; n = delta <= n ? n - delta : 0; mem = aligned; } - - /* Round block size down to alignof(*a) since we will allocate the arena - * itself at the end. */ - n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_ArenaState)); - - if (UPB_UNLIKELY(n < sizeof(upb_ArenaState))) { + if (UPB_UNLIKELY(n < sizeof(upb_ArenaState) || !mem)) { + upb_Arena* ret = _upb_Arena_InitSlow(alloc, mem ? 0 : n); #ifdef UPB_TRACING_ENABLED - upb_Arena* ret = _upb_Arena_InitSlow(alloc); upb_Arena_LogInit(ret, n); - return ret; -#else - return _upb_Arena_InitSlow(alloc); #endif + return ret; } - a = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), upb_ArenaState); + a = mem; upb_Atomic_Init(&a->body.parent_or_count, _upb_Arena_TaggedFromRefcount(1)); upb_Atomic_Init(&a->body.next, NULL); - upb_Atomic_Init(&a->body.tail, &a->body); - upb_Atomic_Init(&a->body.blocks, NULL); - + upb_Atomic_Init(&a->body.previous_or_tail, + _upb_Arena_TaggedFromTail(&a->body)); + upb_Atomic_Init(&a->body.space_allocated, 0); + a->body.blocks = NULL; + a->body.upb_alloc_cleanup = NULL; a->body.block_alloc = _upb_Arena_MakeBlockAlloc(alloc, 1); - a->head.UPB_PRIVATE(ptr) = mem; - a->head.UPB_PRIVATE(end) = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), char); + a->head.UPB_PRIVATE(ptr) = (void*)UPB_ALIGN_MALLOC((uintptr_t)(a + 1)); + a->head.UPB_PRIVATE(end) = UPB_PTR_AT(mem, n, char); + UPB_TSAN_INIT_PUBLISHED(&a->body); #ifdef UPB_TRACING_ENABLED upb_Arena_LogInit(&a->head, n); #endif @@ -3193,28 +3356,40 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) { static void _upb_Arena_DoFree(upb_ArenaInternal* ai) { UPB_ASSERT(_upb_Arena_RefCountFromTagged(ai->parent_or_count) == 1); while (ai != NULL) { + UPB_TSAN_CHECK_PUBLISHED(ai); // Load first since arena itself is likely from one of its blocks. upb_ArenaInternal* next_arena = (upb_ArenaInternal*)upb_Atomic_Load(&ai->next, memory_order_acquire); + // Freeing may have memory barriers that confuse tsan, so assert immdiately + // after load here + if (next_arena) { + UPB_TSAN_CHECK_PUBLISHED(next_arena); + } upb_alloc* block_alloc = _upb_ArenaInternal_BlockAlloc(ai); - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_acquire); + upb_MemBlock* block = ai->blocks; + upb_AllocCleanupFunc* alloc_cleanup = *ai->upb_alloc_cleanup; while (block != NULL) { // Load first since we are deleting block. - upb_MemBlock* next_block = - upb_Atomic_Load(&block->next, memory_order_acquire); - upb_free(block_alloc, block); + upb_MemBlock* next_block = block->next; + upb_free_sized(block_alloc, block, block->size); block = next_block; } + if (alloc_cleanup != NULL) { + alloc_cleanup(block_alloc); + } ai = next_arena; } } void upb_Arena_Free(upb_Arena* a) { upb_ArenaInternal* ai = upb_Arena_Internal(a); + // Cannot be replaced with _upb_Arena_FindRoot, as that provides only a + // relaxed read of the refcount if ai is already the root. uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); retry: while (_upb_Arena_IsTaggedPointer(poc)) { ai = _upb_Arena_PointerFromTagged(poc); + UPB_TSAN_CHECK_PUBLISHED(ai); poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); } @@ -3244,32 +3419,70 @@ retry: static void _upb_Arena_DoFuseArenaLists(upb_ArenaInternal* const parent, upb_ArenaInternal* child) { - upb_ArenaInternal* parent_tail = - upb_Atomic_Load(&parent->tail, memory_order_relaxed); - - do { + UPB_TSAN_CHECK_PUBLISHED(parent); + uintptr_t parent_previous_or_tail = + upb_Atomic_Load(&parent->previous_or_tail, memory_order_acquire); + upb_ArenaInternal* parent_tail = parent; + if (_upb_Arena_IsTaggedTail(parent_previous_or_tail)) { // Our tail might be stale, but it will always converge to the true tail. + parent_tail = _upb_Arena_TailFromTagged(parent_previous_or_tail); + } + + // Link parent to child going forwards + while (true) { + UPB_TSAN_CHECK_PUBLISHED(parent_tail); upb_ArenaInternal* parent_tail_next = - upb_Atomic_Load(&parent_tail->next, memory_order_relaxed); + upb_Atomic_Load(&parent_tail->next, memory_order_acquire); while (parent_tail_next != NULL) { parent_tail = parent_tail_next; + UPB_TSAN_CHECK_PUBLISHED(parent_tail); parent_tail_next = - upb_Atomic_Load(&parent_tail->next, memory_order_relaxed); + upb_Atomic_Load(&parent_tail->next, memory_order_acquire); } + if (upb_Atomic_CompareExchangeWeak(&parent_tail->next, &parent_tail_next, + child, memory_order_release, + memory_order_acquire)) { + break; + } + if (parent_tail_next != NULL) { + parent_tail = parent_tail_next; + } + } - upb_ArenaInternal* displaced = - upb_Atomic_Exchange(&parent_tail->next, child, memory_order_relaxed); - parent_tail = upb_Atomic_Load(&child->tail, memory_order_relaxed); + // Update parent's tail (may be stale). + uintptr_t child_previous_or_tail = + upb_Atomic_Load(&child->previous_or_tail, memory_order_acquire); + upb_ArenaInternal* new_parent_tail = + _upb_Arena_TailFromTagged(child_previous_or_tail); + UPB_TSAN_CHECK_PUBLISHED(new_parent_tail); - // If we displaced something that got installed racily, we can simply - // reinstall it on our new tail. - child = displaced; - } while (child != NULL); + // If another thread fused with us, don't overwrite their previous pointer + // with our tail. Relaxed order is fine here as we only inspect the tag bit + parent_previous_or_tail = + upb_Atomic_Load(&parent->previous_or_tail, memory_order_relaxed); + if (_upb_Arena_IsTaggedTail(parent_previous_or_tail)) { + upb_Atomic_CompareExchangeStrong( + &parent->previous_or_tail, &parent_previous_or_tail, + _upb_Arena_TaggedFromTail(new_parent_tail), memory_order_release, + memory_order_relaxed); + } - upb_Atomic_Store(&parent->tail, parent_tail, memory_order_relaxed); + // Link child to parent going backwards, for SpaceAllocated + upb_Atomic_Store(&child->previous_or_tail, + _upb_Arena_TaggedFromPrevious(parent_tail), + memory_order_release); } -static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, +void upb_Arena_SetAllocCleanup(upb_Arena* a, upb_AllocCleanupFunc* func) { + UPB_TSAN_CHECK_READ(a->UPB_ONLYBITS(ptr)); + upb_ArenaInternal* ai = upb_Arena_Internal(a); + UPB_ASSERT(ai->upb_alloc_cleanup == NULL); + ai->upb_alloc_cleanup = func; +} + +// Thread safe. +static upb_ArenaInternal* _upb_Arena_DoFuse(upb_ArenaInternal** ai1, + upb_ArenaInternal** ai2, uintptr_t* ref_delta) { // `parent_or_count` has two distinct modes // - parent pointer mode @@ -3278,11 +3491,14 @@ static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, // In parent pointer mode, it may change what pointer it refers to in the // tree, but it will always approach a root. Any operation that walks the // tree to the root may collapse levels of the tree concurrently. - upb_ArenaRoot r1 = _upb_Arena_FindRoot(a1); - upb_ArenaRoot r2 = _upb_Arena_FindRoot(a2); + upb_ArenaRoot r1 = _upb_Arena_FindRoot(*ai1); + upb_ArenaRoot r2 = _upb_Arena_FindRoot(*ai2); if (r1.root == r2.root) return r1.root; // Already fused. + *ai1 = r1.root; + *ai2 = r2.root; + // Avoid cycles by always fusing into the root with the lower address. if ((uintptr_t)r1.root > (uintptr_t)r2.root) { upb_ArenaRoot tmp = r1; @@ -3328,20 +3544,33 @@ static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, return r1.root; } +// Thread safe. static bool _upb_Arena_FixupRefs(upb_ArenaInternal* new_root, uintptr_t ref_delta) { if (ref_delta == 0) return true; // No fixup required. + // Relaxed order is safe here as if the value is a pointer, we don't deref it + // or publish it anywhere else. The refcount does provide memory order + // between allocations on arenas and the eventual free and thus normally + // requires acquire/release; but in this case any edges provided by the refs + // we are cleaning up were already provided by the fuse operation itself. It's + // not valid for a decrement that could cause the overall fused arena to reach + // a zero refcount to race with this function, as that could result in a + // use-after-free anyway. uintptr_t poc = upb_Atomic_Load(&new_root->parent_or_count, memory_order_relaxed); if (_upb_Arena_IsTaggedPointer(poc)) return false; uintptr_t with_refs = poc - ref_delta; UPB_ASSERT(!_upb_Arena_IsTaggedPointer(with_refs)); + // Relaxed order on success is safe here, for the same reasons as the relaxed + // read above. Relaxed order is safe on failure because the updated value is + // stored in a local variable which goes immediately out of scope; the retry + // loop will reread what it needs with proper memory order. return upb_Atomic_CompareExchangeStrong(&new_root->parent_or_count, &poc, with_refs, memory_order_relaxed, memory_order_relaxed); } -bool upb_Arena_Fuse(upb_Arena* a1, upb_Arena* a2) { +bool upb_Arena_Fuse(const upb_Arena* a1, const upb_Arena* a2) { if (a1 == a2) return true; // trivial fuse #ifdef UPB_TRACING_ENABLED @@ -3361,25 +3590,46 @@ bool upb_Arena_Fuse(upb_Arena* a1, upb_Arena* a2) { // The number of refs we ultimately need to transfer to the new root. uintptr_t ref_delta = 0; while (true) { - upb_ArenaInternal* new_root = _upb_Arena_DoFuse(a1, a2, &ref_delta); + upb_ArenaInternal* new_root = _upb_Arena_DoFuse(&ai1, &ai2, &ref_delta); if (new_root != NULL && _upb_Arena_FixupRefs(new_root, ref_delta)) { return true; } } } -bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner) { +bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b) { + if (a == b) return true; // trivial fuse + upb_ArenaInternal* ra = _upb_Arena_FindRoot(upb_Arena_Internal(a)).root; + upb_ArenaInternal* rb = upb_Arena_Internal(b); + while (true) { + rb = _upb_Arena_FindRoot(rb).root; + if (ra == rb) return true; + upb_ArenaInternal* tmp = _upb_Arena_FindRoot(ra).root; + if (ra == tmp) return false; + // a's root changed since we last checked. Retry. + ra = tmp; + } +} + +bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner) { upb_ArenaInternal* ai = upb_Arena_Internal(a); if (_upb_ArenaInternal_HasInitialBlock(ai)) return false; upb_ArenaRoot r; + r.root = ai; retry: - r = _upb_Arena_FindRoot(a); + r = _upb_Arena_FindRoot(r.root); if (upb_Atomic_CompareExchangeWeak( &r.root->parent_or_count, &r.tagged_count, _upb_Arena_TaggedFromRefcount( _upb_Arena_RefCountFromTagged(r.tagged_count) + 1), - memory_order_release, memory_order_acquire)) { + // Relaxed order is safe on success, incrementing the refcount + // need not perform any synchronization with the eventual free of the + // arena - that's provided by decrements. + memory_order_relaxed, + // Relaxed order is safe on failure as r.tagged_count is immediately + // overwritten by retrying the find root operation. + memory_order_relaxed)) { // We incremented it successfully, so we are done. return true; } @@ -3387,7 +3637,15 @@ retry: goto retry; } -void upb_Arena_DecRefFor(upb_Arena* a, const void* owner) { upb_Arena_Free(a); } +void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner) { + upb_Arena_Free((upb_Arena*)a); +} + +upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a) { + UPB_TSAN_CHECK_READ(a->UPB_ONLYBITS(ptr)); + upb_ArenaInternal* ai = upb_Arena_Internal(a); + return _upb_ArenaInternal_BlockAlloc(ai); +} void UPB_PRIVATE(_upb_Arena_SwapIn)(upb_Arena* des, const upb_Arena* src) { upb_ArenaInternal* desi = upb_Arena_Internal(des); @@ -3395,8 +3653,7 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(upb_Arena* des, const upb_Arena* src) { *des = *src; desi->block_alloc = srci->block_alloc; - upb_MemBlock* blocks = upb_Atomic_Load(&srci->blocks, memory_order_relaxed); - upb_Atomic_Init(&desi->blocks, blocks); + desi->blocks = srci->blocks; } void UPB_PRIVATE(_upb_Arena_SwapOut)(upb_Arena* des, const upb_Arena* src) { @@ -3404,8 +3661,7 @@ void UPB_PRIVATE(_upb_Arena_SwapOut)(upb_Arena* des, const upb_Arena* src) { upb_ArenaInternal* srci = upb_Arena_Internal(src); *des = *src; - upb_MemBlock* blocks = upb_Atomic_Load(&srci->blocks, memory_order_relaxed); - upb_Atomic_Store(&desi->blocks, blocks, memory_order_relaxed); + desi->blocks = srci->blocks; } @@ -3577,23 +3833,20 @@ void upb_Array_Freeze(upb_Array* arr, const upb_MiniTable* m) { // Must be last. -const upb_MiniTableExtension* upb_Message_ExtensionByIndex( - const upb_Message* msg, size_t index) { - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - - UPB_ASSERT(index < count); - return ext[index].ext; +bool upb_Message_NextExtensionReverse(const upb_Message* msg, + const upb_MiniTableExtension** result, + uintptr_t* iter) { + upb_MessageValue val; + return UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, result, &val, + iter); } const upb_MiniTableExtension* upb_Message_FindExtensionByNumber( const upb_Message* msg, uint32_t field_number) { - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - - for (; count--; ext++) { - const upb_MiniTableExtension* e = ext->ext; - if (upb_MiniTableExtension_Number(e) == field_number) return e; + uintptr_t iter = kUpb_Message_ExtensionBegin; + const upb_MiniTableExtension* result; + while (upb_Message_NextExtensionReverse(msg, &result, &iter)) { + if (upb_MiniTableExtension_Number(result) == field_number) return result; } return NULL; } @@ -3728,6 +3981,7 @@ upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size) { #include <stdint.h> +#include <stdlib.h> #include <string.h> @@ -3812,7 +4066,7 @@ static bool _upb_mapsorter_resize(_upb_mapsorter* s, _upb_sortedmap* sorted, if (sorted->end > s->cap) { const int oldsize = s->cap * sizeof(*s->entries); - s->cap = upb_Log2CeilingSize(sorted->end); + s->cap = upb_RoundUpToPowerOfTwo(sorted->end); const int newsize = s->cap * sizeof(*s->entries); s->entries = upb_grealloc(s->entries, oldsize, newsize); if (!s->entries) return false; @@ -3856,20 +4110,29 @@ static int _upb_mapsorter_cmpext(const void* _a, const void* _b) { return a_num < b_num ? -1 : 1; } -bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, - size_t count, _upb_sortedmap* sorted) { - if (!_upb_mapsorter_resize(s, sorted, count)) return false; - - for (size_t i = 0; i < count; i++) { - s->entries[sorted->start + i] = &exts[i]; +bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Message_Internal* in, + _upb_sortedmap* sorted) { + size_t count = 0; + for (size_t i = 0; i < in->size; i++) { + count += upb_TaggedAuxPtr_IsExtension(in->aux_data[i]); + } + if (!_upb_mapsorter_resize(s, sorted, count)) return false; + if (count == 0) return true; + const upb_Extension** entry = + (const upb_Extension**)&s->entries[sorted->start]; + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + *entry++ = upb_TaggedAuxPtr_Extension(tagged_ptr); + } } - qsort(&s->entries[sorted->start], count, sizeof(*s->entries), _upb_mapsorter_cmpext); return true; } +#include <stdarg.h> #include <stddef.h> #include <stdint.h> #include <string.h> @@ -3877,64 +4140,109 @@ bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, // Must be last. -static const size_t message_overhead = sizeof(upb_Message_Internal); - upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* a) { return _upb_Message_New(m, a); } bool UPB_PRIVATE(_upb_Message_AddUnknown)(upb_Message* msg, const char* data, - size_t len, upb_Arena* arena) { + size_t len, upb_Arena* arena, + bool alias) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); - if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, len, arena)) return false; + // TODO: b/376969853 - Add debug check that the unknown field is an overall + // valid proto field + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, arena)) { + return false; + } + upb_StringView* view; + if (alias) { + view = upb_Arena_Malloc(arena, sizeof(upb_StringView)); + if (!view) return false; + view->data = data; + } else { + view = upb_Arena_Malloc(arena, sizeof(upb_StringView) + len); + if (!view) return false; + char* copy = UPB_PTR_AT(view, sizeof(upb_StringView), char); + memcpy(copy, data, len); + view->data = copy; + } + view->size = len; upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - memcpy(UPB_PTR_AT(in, in->unknown_end, char), data, len); - in->unknown_end += len; + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeUnknownData(view); + return true; +} + +bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg, + upb_Arena* arena, + upb_StringView data[], + size_t count) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSERT(count > 0); + size_t total_len = 0; + for (size_t i = 0; i < count; i++) { + total_len += data[i].size; + } + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, arena)) return false; + + upb_StringView* view = + upb_Arena_Malloc(arena, sizeof(upb_StringView) + total_len); + if (!view) return false; + char* copy = UPB_PTR_AT(view, sizeof(upb_StringView), char); + view->data = copy; + view->size = total_len; + for (size_t i = 0; i < count; i++) { + memcpy(copy, data[i].data, data[i].size); + copy += data[i].size; + } + // TODO: b/376969853 - Add debug check that the unknown field is an overall + // valid proto field + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeUnknownData(view); return true; } void _upb_Message_DiscardUnknown_shallow(upb_Message* msg) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - in->unknown_end = message_overhead; + if (!in) return; + uint32_t size = 0; + for (uint32_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + in->aux_data[size++] = tagged_ptr; + } } + in->size = size; } -const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len) { - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - *len = in->unknown_end - message_overhead; - return (char*)(in + 1); - } else { - *len = 0; - return NULL; - } -} - -void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len) { +bool upb_Message_DeleteUnknown(upb_Message* msg, upb_StringView* data, + uintptr_t* iter) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSERT(*iter != kUpb_Message_UnknownBegin); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - const char* internal_unknown_end = UPB_PTR_AT(in, in->unknown_end, char); - + UPB_ASSERT(in); + UPB_ASSERT(*iter <= in->size); #ifndef NDEBUG - size_t full_unknown_size; - const char* full_unknown = upb_Message_GetUnknown(msg, &full_unknown_size); - UPB_ASSERT((uintptr_t)data >= (uintptr_t)full_unknown); - UPB_ASSERT((uintptr_t)data < (uintptr_t)(full_unknown + full_unknown_size)); - UPB_ASSERT((uintptr_t)(data + len) > (uintptr_t)data); - UPB_ASSERT((uintptr_t)(data + len) <= (uintptr_t)internal_unknown_end); + upb_TaggedAuxPtr unknown_ptr = in->aux_data[*iter - 1]; + UPB_ASSERT(upb_TaggedAuxPtr_IsUnknown(unknown_ptr)); + upb_StringView* unknown = upb_TaggedAuxPtr_UnknownData(unknown_ptr); + UPB_ASSERT(unknown->data == data->data); + UPB_ASSERT(unknown->size == data->size); #endif + in->aux_data[*iter - 1] = upb_TaggedAuxPtr_Null(); - if ((data + len) != internal_unknown_end) { - memmove((char*)data, data + len, internal_unknown_end - data - len); - } - in->unknown_end -= len; + return upb_Message_NextUnknown(msg, data, iter); } size_t upb_Message_ExtensionCount(const upb_Message* msg) { - size_t count; - UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return 0; + const upb_MiniTableExtension* ext; + upb_MessageValue val; + uintptr_t iter = kUpb_Message_ExtensionBegin; + size_t count = 0; + while (upb_Message_NextExtension(msg, &ext, &val, &iter)) { + count++; + } return count; } @@ -3975,16 +4283,21 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) { } // Extensions. - size_t ext_count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &ext_count); - - for (size_t i = 0; i < ext_count; i++) { - const upb_MiniTableExtension* e = ext[i].ext; + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + // TODO: b/376969853 - use iterator API + uint32_t size = in ? in->size : 0; + for (size_t i = 0; i < size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + continue; + } + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + const upb_MiniTableExtension* e = ext->ext; const upb_MiniTableField* f = &e->UPB_PRIVATE(field); const upb_MiniTable* m2 = upb_MiniTableExtension_GetSubMessage(e); upb_MessageValue val; - memcpy(&val, &ext[i].data, sizeof(upb_MessageValue)); + memcpy(&val, &(ext->data), sizeof(upb_MessageValue)); switch (UPB_PRIVATE(_upb_MiniTableField_Mode)(f)) { case kUpb_FieldMode_Array: { @@ -4007,6 +4320,7 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) { #include <stddef.h> +#include <stdint.h> // Must be last. @@ -4117,20 +4431,18 @@ static bool _upb_Message_ExtensionsAreEqual(const upb_Message* msg1, const upb_Message* msg2, const upb_MiniTable* m, int options) { - // Must have identical extension counts. - if (upb_Message_ExtensionCount(msg1) != upb_Message_ExtensionCount(msg2)) { - return false; - } - const upb_MiniTableExtension* e; upb_MessageValue val1; // Iterate over all extensions for msg1, and search msg2 for each extension. - size_t iter1 = kUpb_Extension_Begin; - while (UPB_PRIVATE(_upb_Message_NextExtension)(msg1, m, &e, &val1, &iter1)) { + size_t count1 = 0; + size_t iter1 = kUpb_Message_ExtensionBegin; + while (upb_Message_NextExtension(msg1, &e, &val1, &iter1)) { const upb_Extension* ext2 = UPB_PRIVATE(_upb_Message_Getext)(msg2, e); if (!ext2) return false; + count1++; + const upb_MessageValue val2 = ext2->data; const upb_MiniTableField* f = &e->UPB_PRIVATE(field); const upb_MiniTable* subm = upb_MiniTableField_IsSubMessage(f) @@ -4154,6 +4466,11 @@ static bool _upb_Message_ExtensionsAreEqual(const upb_Message* msg1, } if (!eq) return false; } + + // Must have identical extension counts (this catches the case where msg2 + // has extensions that msg1 doesn't). + if (count1 != upb_Message_ExtensionCount(msg2)) return false; + return true; } @@ -4166,18 +4483,341 @@ bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2, if (!(options & kUpb_CompareOption_IncludeUnknownFields)) return true; - // Check the unknown fields. - size_t usize1, usize2; - const char* uf1 = upb_Message_GetUnknown(msg1, &usize1); - const char* uf2 = upb_Message_GetUnknown(msg2, &usize2); - // The wire encoder enforces a maximum depth of 100 so we match that here. - return UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - uf1, usize1, uf2, usize2, 100) == kUpb_UnknownCompareResult_Equal; + return UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(msg1, msg2, 100) == + kUpb_UnknownCompareResult_Equal; +} + + +#include <stdint.h> +#include <stdlib.h> + + +// Must be last. + +typedef struct upb_UnknownFields upb_UnknownFields; + +typedef struct { + uint32_t tag; + union { + uint64_t varint; + uint64_t uint64; + uint32_t uint32; + upb_StringView delimited; + upb_UnknownFields* group; + } data; +} upb_UnknownField; + +struct upb_UnknownFields { + size_t size; + size_t capacity; + upb_UnknownField* fields; +}; + +typedef struct { + upb_EpsCopyInputStream stream; + upb_Arena* arena; + upb_UnknownField* tmp; + size_t tmp_size; + int depth; + upb_UnknownCompareResult status; + jmp_buf err; +} upb_UnknownField_Context; + +typedef struct { + upb_UnknownField* arr_base; + upb_UnknownField* arr_ptr; + upb_UnknownField* arr_end; + uint32_t last_tag; + bool sorted; +} upb_UnknownFields_Builder; + +UPB_NORETURN static void upb_UnknownFields_OutOfMemory( + upb_UnknownField_Context* ctx) { + ctx->status = kUpb_UnknownCompareResult_OutOfMemory; + UPB_LONGJMP(ctx->err, 1); +} + +static void upb_UnknownFields_Grow(upb_UnknownField_Context* ctx, + upb_UnknownField** base, + upb_UnknownField** ptr, + upb_UnknownField** end) { + size_t old = (*ptr - *base); + size_t new = UPB_MAX(4, old * 2); + + *base = upb_Arena_Realloc(ctx->arena, *base, old * sizeof(**base), + new * sizeof(**base)); + if (!*base) upb_UnknownFields_OutOfMemory(ctx); + + *ptr = *base + old; + *end = *base + new; +} + +// We have to implement our own sort here, since qsort() is not an in-order +// sort. Here we use merge sort, the simplest in-order sort. +static void upb_UnknownFields_Merge(upb_UnknownField* arr, size_t start, + size_t mid, size_t end, + upb_UnknownField* tmp) { + memcpy(tmp, &arr[start], (end - start) * sizeof(*tmp)); + + upb_UnknownField* ptr1 = tmp; + upb_UnknownField* end1 = &tmp[mid - start]; + upb_UnknownField* ptr2 = &tmp[mid - start]; + upb_UnknownField* end2 = &tmp[end - start]; + upb_UnknownField* out = &arr[start]; + + while (ptr1 < end1 && ptr2 < end2) { + if (ptr1->tag <= ptr2->tag) { + *out++ = *ptr1++; + } else { + *out++ = *ptr2++; + } + } + + if (ptr1 < end1) { + memcpy(out, ptr1, (end1 - ptr1) * sizeof(*out)); + } else if (ptr2 < end2) { + memcpy(out, ptr1, (end2 - ptr2) * sizeof(*out)); + } +} + +static void upb_UnknownFields_SortRecursive(upb_UnknownField* arr, size_t start, + size_t end, upb_UnknownField* tmp) { + if (end - start > 1) { + size_t mid = start + ((end - start) / 2); + upb_UnknownFields_SortRecursive(arr, start, mid, tmp); + upb_UnknownFields_SortRecursive(arr, mid, end, tmp); + upb_UnknownFields_Merge(arr, start, mid, end, tmp); + } +} + +static void upb_UnknownFields_Sort(upb_UnknownField_Context* ctx, + upb_UnknownFields* fields) { + if (ctx->tmp_size < fields->size) { + const int oldsize = ctx->tmp_size * sizeof(*ctx->tmp); + ctx->tmp_size = UPB_MAX(8, ctx->tmp_size); + while (ctx->tmp_size < fields->size) ctx->tmp_size *= 2; + const int newsize = ctx->tmp_size * sizeof(*ctx->tmp); + ctx->tmp = upb_grealloc(ctx->tmp, oldsize, newsize); + } + upb_UnknownFields_SortRecursive(fields->fields, 0, fields->size, ctx->tmp); +} + +static upb_UnknownFields* upb_UnknownFields_BuildFromBuffer( + upb_UnknownField_Context* ctx, const char** buf); + +// Combines two unknown fields into one. +static void upb_CombineUnknownFields(upb_UnknownField_Context* ctx, + upb_UnknownFields_Builder* builder, + const char** buf) { + upb_UnknownField* arr_base = builder->arr_base; + upb_UnknownField* arr_ptr = builder->arr_ptr; + upb_UnknownField* arr_end = builder->arr_end; + const char* ptr = *buf; + uint32_t last_tag = builder->last_tag; + bool sorted = builder->sorted; + while (!upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr)) { + uint32_t tag; + ptr = upb_WireReader_ReadTag(ptr, &tag); + UPB_ASSERT(tag <= UINT32_MAX); + int wire_type = upb_WireReader_GetWireType(tag); + if (wire_type == kUpb_WireType_EndGroup) break; + if (tag < last_tag) sorted = false; + last_tag = tag; + + if (arr_ptr == arr_end) { + upb_UnknownFields_Grow(ctx, &arr_base, &arr_ptr, &arr_end); + } + upb_UnknownField* field = arr_ptr; + field->tag = tag; + arr_ptr++; + + switch (wire_type) { + case kUpb_WireType_Varint: + ptr = upb_WireReader_ReadVarint(ptr, &field->data.varint); + break; + case kUpb_WireType_64Bit: + ptr = upb_WireReader_ReadFixed64(ptr, &field->data.uint64); + break; + case kUpb_WireType_32Bit: + ptr = upb_WireReader_ReadFixed32(ptr, &field->data.uint32); + break; + case kUpb_WireType_Delimited: { + int size; + ptr = upb_WireReader_ReadSize(ptr, &size); + const char* s_ptr = ptr; + ptr = upb_EpsCopyInputStream_ReadStringAliased(&ctx->stream, &s_ptr, + size); + field->data.delimited.data = s_ptr; + field->data.delimited.size = size; + break; + } + case kUpb_WireType_StartGroup: + if (--ctx->depth == 0) { + ctx->status = kUpb_UnknownCompareResult_MaxDepthExceeded; + UPB_LONGJMP(ctx->err, 1); + } + field->data.group = upb_UnknownFields_BuildFromBuffer(ctx, &ptr); + ctx->depth++; + break; + default: + UPB_UNREACHABLE(); + } + } + *buf = ptr; + builder->arr_base = arr_base; + builder->arr_ptr = arr_ptr; + builder->arr_end = arr_end; + builder->sorted = sorted; + builder->last_tag = last_tag; +} + +static upb_UnknownFields* upb_UnknownFields_DoBuild( + upb_UnknownField_Context* ctx, upb_UnknownFields_Builder* builder) { + upb_UnknownFields* ret = upb_Arena_Malloc(ctx->arena, sizeof(*ret)); + if (!ret) upb_UnknownFields_OutOfMemory(ctx); + ret->fields = builder->arr_base; + ret->size = builder->arr_ptr - builder->arr_base; + ret->capacity = builder->arr_end - builder->arr_base; + if (!builder->sorted) { + upb_UnknownFields_Sort(ctx, ret); + } + return ret; +} + +// Builds a upb_UnknownFields data structure from the binary data in buf. +static upb_UnknownFields* upb_UnknownFields_BuildFromBuffer( + upb_UnknownField_Context* ctx, const char** buf) { + upb_UnknownFields_Builder builder = { + .arr_base = NULL, + .arr_ptr = NULL, + .arr_end = NULL, + .sorted = true, + .last_tag = 0, + }; + const char* ptr = *buf; + upb_CombineUnknownFields(ctx, &builder, &ptr); + upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &builder); + *buf = ptr; + return fields; +} + +// Builds a upb_UnknownFields data structure from the unknown fields of a +// upb_Message. +static upb_UnknownFields* upb_UnknownFields_Build(upb_UnknownField_Context* ctx, + const upb_Message* msg) { + upb_UnknownFields_Builder builder = { + .arr_base = NULL, + .arr_ptr = NULL, + .arr_end = NULL, + .sorted = true, + .last_tag = 0, + }; + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView view; + while (upb_Message_NextUnknown(msg, &view, &iter)) { + upb_EpsCopyInputStream_Init(&ctx->stream, &view.data, view.size, true); + upb_CombineUnknownFields(ctx, &builder, &view.data); + UPB_ASSERT(upb_EpsCopyInputStream_IsDone(&ctx->stream, &view.data) && + !upb_EpsCopyInputStream_IsError(&ctx->stream)); + } + upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &builder); + return fields; +} + +// Compares two sorted upb_UnknownFields structures for equality. +static bool upb_UnknownFields_IsEqual(const upb_UnknownFields* uf1, + const upb_UnknownFields* uf2) { + if (uf1->size != uf2->size) return false; + for (size_t i = 0, n = uf1->size; i < n; i++) { + upb_UnknownField* f1 = &uf1->fields[i]; + upb_UnknownField* f2 = &uf2->fields[i]; + if (f1->tag != f2->tag) return false; + int wire_type = f1->tag & 7; + switch (wire_type) { + case kUpb_WireType_Varint: + if (f1->data.varint != f2->data.varint) return false; + break; + case kUpb_WireType_64Bit: + if (f1->data.uint64 != f2->data.uint64) return false; + break; + case kUpb_WireType_32Bit: + if (f1->data.uint32 != f2->data.uint32) return false; + break; + case kUpb_WireType_Delimited: + if (!upb_StringView_IsEqual(f1->data.delimited, f2->data.delimited)) { + return false; + } + break; + case kUpb_WireType_StartGroup: + if (!upb_UnknownFields_IsEqual(f1->data.group, f2->data.group)) { + return false; + } + break; + default: + UPB_UNREACHABLE(); + } + } + return true; +} + +static upb_UnknownCompareResult upb_UnknownField_DoCompare( + upb_UnknownField_Context* ctx, const upb_Message* msg1, + const upb_Message* msg2) { + upb_UnknownCompareResult ret; + // First build both unknown fields into a sorted data structure (similar + // to the UnknownFieldSet in C++). + upb_UnknownFields* uf1 = upb_UnknownFields_Build(ctx, msg1); + upb_UnknownFields* uf2 = upb_UnknownFields_Build(ctx, msg2); + + // Now perform the equality check on the sorted structures. + if (upb_UnknownFields_IsEqual(uf1, uf2)) { + ret = kUpb_UnknownCompareResult_Equal; + } else { + ret = kUpb_UnknownCompareResult_NotEqual; + } + return ret; +} + +static upb_UnknownCompareResult upb_UnknownField_Compare( + upb_UnknownField_Context* const ctx, const upb_Message* msg1, + const upb_Message* msg2) { + upb_UnknownCompareResult ret; + if (UPB_SETJMP(ctx->err) == 0) { + ret = upb_UnknownField_DoCompare(ctx, msg1, msg2); + } else { + ret = ctx->status; + UPB_ASSERT(ret != kUpb_UnknownCompareResult_Equal); + } + + upb_Arena_Free(ctx->arena); + upb_gfree(ctx->tmp); + return ret; +} + +upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( + const upb_Message* msg1, const upb_Message* msg2, int max_depth) { + bool msg1_empty = !upb_Message_HasUnknown(msg1); + bool msg2_empty = !upb_Message_HasUnknown(msg2); + if (msg1_empty && msg2_empty) return kUpb_UnknownCompareResult_Equal; + if (msg1_empty || msg2_empty) return kUpb_UnknownCompareResult_NotEqual; + + upb_UnknownField_Context ctx = { + .arena = upb_Arena_New(), + .depth = max_depth, + .tmp = NULL, + .tmp_size = 0, + .status = kUpb_UnknownCompareResult_Equal, + }; + + if (!ctx.arena) return kUpb_UnknownCompareResult_OutOfMemory; + + return upb_UnknownField_Compare(&ctx, msg1, msg2); } #include <stdbool.h> +#include <stdint.h> #include <string.h> @@ -4301,7 +4941,7 @@ upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type, for (size_t i = 0; i < size; ++i) { upb_MessageValue val = upb_Array_Get(array, i); if (!upb_Clone_MessageValue(&val, value_type, sub, arena)) { - return false; + return NULL; } upb_Array_Set(cloned_array, i, val); } @@ -4405,41 +5045,44 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src, } } // Clone extensions. - size_t ext_count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(src, &ext_count); - for (size_t i = 0; i < ext_count; ++i) { - const upb_Extension* msg_ext = &ext[i]; - const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field); - upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( - dst, msg_ext->ext, arena); - if (!dst_ext) return NULL; - if (upb_MiniTableField_IsScalar(field)) { - if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) { + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(src); + if (!in) return dst; + + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + // Clone extension + const upb_Extension* msg_ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field); + upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( + dst, msg_ext->ext, arena); + if (!dst_ext) return NULL; + if (upb_MiniTableField_IsScalar(field)) { + if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) { + return NULL; + } + } else { + upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val; + UPB_ASSERT(msg_array); + upb_Array* cloned_array = upb_Array_DeepClone( + msg_array, upb_MiniTableField_CType(field), + upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena); + if (!cloned_array) { + return NULL; + } + dst_ext->data.array_val = cloned_array; + } + } else if (upb_TaggedAuxPtr_IsUnknown(tagged_ptr)) { + // Clone unknown + upb_StringView* unknown = upb_TaggedAuxPtr_UnknownData(tagged_ptr); + // Make a copy into destination arena. + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, unknown->data, + unknown->size, arena, false)) { return NULL; } - } else { - upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val; - UPB_ASSERT(msg_array); - upb_Array* cloned_array = upb_Array_DeepClone( - msg_array, upb_MiniTableField_CType(field), - upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena); - if (!cloned_array) { - return NULL; - } - dst_ext->data.array_val = cloned_array; } } - // Clone unknowns. - size_t unknown_size = 0; - const char* ptr = upb_Message_GetUnknown(src, &unknown_size); - if (unknown_size != 0) { - UPB_ASSERT(ptr); - // Make a copy into destination arena. - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, ptr, unknown_size, arena)) { - return NULL; - } - } return dst; } @@ -4522,7 +5165,7 @@ typedef struct { } upb_MdEnumDecoder; static size_t upb_MiniTableEnum_Size(size_t count) { - return sizeof(upb_MiniTableEnum) + count * sizeof(uint32_t); + return UPB_SIZEOF_FLEX(upb_MiniTableEnum, UPB_PRIVATE(data), count); } static upb_MiniTableEnum* _upb_MiniTable_AddEnumDataMember(upb_MdEnumDecoder* d, @@ -4644,39 +5287,36 @@ upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, size_t len, // 64 is the first hasbit that we currently use. #define kUpb_Reserved_Hasbits (kUpb_Reserved_Hasbytes * 8) -// Note: we sort by this number when calculating layout order. -typedef enum { - kUpb_LayoutItemType_OneofCase, // Oneof case. - kUpb_LayoutItemType_OneofField, // Oneof field data. - kUpb_LayoutItemType_Field, // Non-oneof field data. +#define kUpb_OneOfLayoutItem_IndexSentinel ((uint16_t)-1) - kUpb_LayoutItemType_Max = kUpb_LayoutItemType_Field, -} upb_LayoutItemType; - -#define kUpb_LayoutItem_IndexSentinel ((uint16_t) - 1) +// Stores the field number of the present value of the oneof +#define kUpb_OneOf_CaseFieldRep (kUpb_FieldRep_4Byte) typedef struct { - // Index of the corresponding field. When this is a oneof field, the field's - // offset will be the index of the next field in a linked list. + // Index of the corresponding field. The field's offset will be the index of + // the next field in a linked list. uint16_t field_index; - uint16_t offset; - upb_FieldRep rep; - upb_LayoutItemType type; -} upb_LayoutItem; + // This enum is stored in bytes to avoid trailing padding while preserving + // two-byte alignment. + uint8_t /* upb_FieldRep*/ rep; +} upb_OneOfLayoutItem; typedef struct { - upb_LayoutItem* data; + upb_OneOfLayoutItem* data; size_t size; - size_t capacity; -} upb_LayoutItemVector; + size_t buf_capacity_bytes; +} upb_OneOfLayoutItemVector; typedef struct { upb_MdDecoder base; upb_MiniTable* table; upb_MiniTableField* fields; upb_MiniTablePlatform platform; - upb_LayoutItemVector vec; + upb_OneOfLayoutItemVector oneofs; upb_Arena* arena; + // Initially tracks the count of each field rep type; then, during assignment, + // tracks the base offset for the next processed field of the given rep. + uint16_t rep_counts_offsets[kUpb_FieldRep_Max + 1]; } upb_MtDecoder; // In each field's offset, we temporarily store a presence classifier: @@ -4862,30 +5502,24 @@ static void upb_MtDecoder_ModifyField(upb_MtDecoder* d, } } -static void upb_MtDecoder_PushItem(upb_MtDecoder* d, upb_LayoutItem item) { - if (d->vec.size == d->vec.capacity) { - size_t new_cap = UPB_MAX(8, d->vec.size * 2); - d->vec.data = realloc(d->vec.data, new_cap * sizeof(*d->vec.data)); - upb_MdDecoder_CheckOutOfMemory(&d->base, d->vec.data); - d->vec.capacity = new_cap; - } - d->vec.data[d->vec.size++] = item; -} - -static void upb_MtDecoder_PushOneof(upb_MtDecoder* d, upb_LayoutItem item) { - if (item.field_index == kUpb_LayoutItem_IndexSentinel) { +static void upb_MtDecoder_PushOneof(upb_MtDecoder* d, + upb_OneOfLayoutItem item) { + if (item.field_index == kUpb_OneOfLayoutItem_IndexSentinel) { upb_MdDecoder_ErrorJmp(&d->base, "Empty oneof"); } + if ((d->oneofs.size + 1) * sizeof(*d->oneofs.data) > + d->oneofs.buf_capacity_bytes) { + size_t new_cap = UPB_MAX(8, d->oneofs.size * 2) * sizeof(*d->oneofs.data); + d->oneofs.data = + upb_grealloc(d->oneofs.data, d->oneofs.buf_capacity_bytes, new_cap); + upb_MdDecoder_CheckOutOfMemory(&d->base, d->oneofs.data); + d->oneofs.buf_capacity_bytes = new_cap; + } item.field_index -= kOneofBase; - // Push oneof data. - item.type = kUpb_LayoutItemType_OneofField; - upb_MtDecoder_PushItem(d, item); - - // Push oneof case. - item.rep = kUpb_FieldRep_4Byte; // Field Number. - item.type = kUpb_LayoutItemType_OneofCase; - upb_MtDecoder_PushItem(d, item); + d->rep_counts_offsets[kUpb_OneOf_CaseFieldRep]++; + d->rep_counts_offsets[item.rep]++; + d->oneofs.data[d->oneofs.size++] = item; } static size_t upb_MtDecoder_SizeOfRep(upb_FieldRep rep, @@ -4931,7 +5565,7 @@ static size_t upb_MtDecoder_AlignOfRep(upb_FieldRep rep, static const char* upb_MtDecoder_DecodeOneofField(upb_MtDecoder* d, const char* ptr, char first_ch, - upb_LayoutItem* item) { + upb_OneOfLayoutItem* item) { uint32_t field_num; ptr = upb_MdDecoder_DecodeBase92Varint( &d->base, ptr, first_ch, kUpb_EncodedValue_MinOneofField, @@ -4967,8 +5601,8 @@ static const char* upb_MtDecoder_DecodeOneofField(upb_MtDecoder* d, static const char* upb_MtDecoder_DecodeOneofs(upb_MtDecoder* d, const char* ptr) { - upb_LayoutItem item = {.rep = 0, - .field_index = kUpb_LayoutItem_IndexSentinel}; + upb_OneOfLayoutItem item = { + .rep = 0, .field_index = kUpb_OneOfLayoutItem_IndexSentinel}; while (ptr < d->base.end) { char ch = *ptr++; if (ch == kUpb_EncodedValue_FieldSeparator) { @@ -4976,7 +5610,8 @@ static const char* upb_MtDecoder_DecodeOneofs(upb_MtDecoder* d, } else if (ch == kUpb_EncodedValue_OneofSeparator) { // End of oneof. upb_MtDecoder_PushOneof(d, item); - item.field_index = kUpb_LayoutItem_IndexSentinel; // Move to next oneof. + item.field_index = + kUpb_OneOfLayoutItem_IndexSentinel; // Move to next oneof. } else { ptr = upb_MtDecoder_DecodeOneofField(d, ptr, ch, &item); } @@ -5115,45 +5750,42 @@ static void upb_MtDecoder_ParseMessage(upb_MtDecoder* d, const char* data, upb_MtDecoder_AllocateSubs(d, sub_counts); } -static int upb_MtDecoder_CompareFields(const void* _a, const void* _b) { - const upb_LayoutItem* a = _a; - const upb_LayoutItem* b = _b; - // Currently we just sort by: - // 1. rep (smallest fields first) - // 2. type (oneof cases first) - // 2. field_index (smallest numbers first) - // The main goal of this is to reduce space lost to padding. - // Later we may have more subtle reasons to prefer a different ordering. - const int rep_bits = upb_Log2Ceiling(kUpb_FieldRep_Max); - const int type_bits = upb_Log2Ceiling(kUpb_LayoutItemType_Max); - const int idx_bits = (sizeof(a->field_index) * 8); - UPB_ASSERT(idx_bits + rep_bits + type_bits < 32); -#define UPB_COMBINE(rep, ty, idx) (((rep << type_bits) | ty) << idx_bits) | idx - uint32_t a_packed = UPB_COMBINE(a->rep, a->type, a->field_index); - uint32_t b_packed = UPB_COMBINE(b->rep, b->type, b->field_index); - UPB_ASSERT(a_packed != b_packed); -#undef UPB_COMBINE - return a_packed < b_packed ? -1 : 1; -} - -static bool upb_MtDecoder_SortLayoutItems(upb_MtDecoder* d) { - // Add items for all non-oneof fields (oneofs were already added). +static void upb_MtDecoder_CalculateAlignments(upb_MtDecoder* d) { + // Add alignment counts for non-oneof fields (oneofs were added already) int n = d->table->UPB_PRIVATE(field_count); for (int i = 0; i < n; i++) { upb_MiniTableField* f = &d->fields[i]; if (f->UPB_PRIVATE(offset) >= kOneofBase) continue; - upb_LayoutItem item = {.field_index = i, - .rep = f->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift, - .type = kUpb_LayoutItemType_Field}; - upb_MtDecoder_PushItem(d, item); + d->rep_counts_offsets[f->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift]++; } - if (d->vec.size) { - qsort(d->vec.data, d->vec.size, sizeof(*d->vec.data), - upb_MtDecoder_CompareFields); + // Reserve properly aligned space for each type of field representation + // present in this message. When we iterate over the fields, they will obtain + // their offset from within the region matching their alignment requirements. + size_t base = d->table->UPB_PRIVATE(size); + // Start with the lowest alignment requirement, going up, because: + // 1. If there are presence bits, we won't be aligned to start, but adding + // some lower-alignment fields may get us closer without wasting space to + // padding. + // 2. The allocator enforces 8 byte alignment, so moving intermediate padding + // to trailing padding doesn't save us anything. + for (upb_FieldRep rep = kUpb_FieldRep_1Byte; rep <= kUpb_FieldRep_Max; + rep++) { + uint16_t count = d->rep_counts_offsets[rep]; + if (count) { + base = UPB_ALIGN_UP(base, upb_MtDecoder_AlignOfRep(rep, d->platform)); + // This entry now tracks the base offset for this field representation + // type, instead of the count + d->rep_counts_offsets[rep] = base; + base += upb_MtDecoder_SizeOfRep(rep, d->platform) * count; + } } - - return true; + static const size_t max = UINT16_MAX; + if (base > max) { + upb_MdDecoder_ErrorJmp( + &d->base, "Message size exceeded maximum size of %zu bytes", max); + } + d->table->UPB_PRIVATE(size) = (uint16_t)base; } static size_t upb_MiniTable_DivideRoundUp(size_t n, size_t d) { @@ -5196,57 +5828,33 @@ static void upb_MtDecoder_AssignHasbits(upb_MtDecoder* d) { static size_t upb_MtDecoder_Place(upb_MtDecoder* d, upb_FieldRep rep) { size_t size = upb_MtDecoder_SizeOfRep(rep, d->platform); - size_t align = upb_MtDecoder_AlignOfRep(rep, d->platform); - size_t ret = UPB_ALIGN_UP(d->table->UPB_PRIVATE(size), align); - static const size_t max = UINT16_MAX; - size_t new_size = ret + size; - if (new_size > max) { - upb_MdDecoder_ErrorJmp( - &d->base, "Message size exceeded maximum size of %zu bytes", max); - } - d->table->UPB_PRIVATE(size) = new_size; - return ret; + size_t offset = d->rep_counts_offsets[rep]; + d->rep_counts_offsets[rep] += size; + return offset; } static void upb_MtDecoder_AssignOffsets(upb_MtDecoder* d) { - upb_LayoutItem* end = UPB_PTRADD(d->vec.data, d->vec.size); - - // Compute offsets. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - item->offset = upb_MtDecoder_Place(d, item->rep); + upb_MiniTableField* field_end = + UPB_PTRADD(d->fields, d->table->UPB_PRIVATE(field_count)); + for (upb_MiniTableField* field = d->fields; field < field_end; field++) { + if (field->UPB_PRIVATE(offset) >= kOneofBase) continue; + field->UPB_PRIVATE(offset) = + upb_MtDecoder_Place(d, field->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift); } - // Assign oneof case offsets. We must do these first, since assigning - // actual offsets will overwrite the links of the linked list. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - if (item->type != kUpb_LayoutItemType_OneofCase) continue; + upb_OneOfLayoutItem* oneof_end = UPB_PTRADD(d->oneofs.data, d->oneofs.size); + + for (upb_OneOfLayoutItem* item = d->oneofs.data; item < oneof_end; item++) { upb_MiniTableField* f = &d->fields[item->field_index]; + uint16_t case_offset = upb_MtDecoder_Place(d, kUpb_OneOf_CaseFieldRep); + uint16_t data_offset = upb_MtDecoder_Place(d, item->rep); while (true) { - f->presence = ~item->offset; - if (f->UPB_PRIVATE(offset) == kUpb_LayoutItem_IndexSentinel) break; - UPB_ASSERT(f->UPB_PRIVATE(offset) - kOneofBase < - d->table->UPB_PRIVATE(field_count)); - f = &d->fields[f->UPB_PRIVATE(offset) - kOneofBase]; - } - } - - // Assign offsets. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - upb_MiniTableField* f = &d->fields[item->field_index]; - switch (item->type) { - case kUpb_LayoutItemType_OneofField: - while (true) { - uint16_t next_offset = f->UPB_PRIVATE(offset); - f->UPB_PRIVATE(offset) = item->offset; - if (next_offset == kUpb_LayoutItem_IndexSentinel) break; - f = &d->fields[next_offset - kOneofBase]; - } - break; - case kUpb_LayoutItemType_Field: - f->UPB_PRIVATE(offset) = item->offset; - break; - default: - break; + f->presence = ~case_offset; + uint16_t next_offset = f->UPB_PRIVATE(offset); + f->UPB_PRIVATE(offset) = data_offset; + if (next_offset == kUpb_OneOfLayoutItem_IndexSentinel) break; + UPB_ASSERT(next_offset - kOneofBase < d->table->UPB_PRIVATE(field_count)); + f = &d->fields[next_offset - kOneofBase]; } } @@ -5300,11 +5908,8 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data, UPB_UNREACHABLE(); } - upb_LayoutItem* end = UPB_PTRADD(d->vec.data, d->vec.size); - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - if (item->type == kUpb_LayoutItemType_OneofCase) { - upb_MdDecoder_ErrorJmp(&d->base, "Map entry cannot have oneof"); - } + if (d->oneofs.size != 0) { + upb_MdDecoder_ErrorJmp(&d->base, "Map entry cannot have oneof"); } upb_MtDecoder_ValidateEntryField(d, &d->table->UPB_PRIVATE(fields)[0], 1); @@ -5346,7 +5951,7 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( decoder->table->UPB_PRIVATE(dense_below) = 0; decoder->table->UPB_PRIVATE(table_mask) = -1; decoder->table->UPB_PRIVATE(required_count) = 0; -#if UPB_TRACING_ENABLED +#ifdef UPB_TRACING_ENABLED // MiniTables built from MiniDescriptors will not be able to vend the message // name unless it is explicitly set with upb_MiniTable_SetFullName(). decoder->table->UPB_PRIVATE(full_name) = 0; @@ -5364,7 +5969,7 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( case kUpb_EncodedVersion_MessageV1: upb_MtDecoder_ParseMessage(decoder, data, len); upb_MtDecoder_AssignHasbits(decoder); - upb_MtDecoder_SortLayoutItems(decoder); + upb_MtDecoder_CalculateAlignments(decoder); upb_MtDecoder_AssignOffsets(decoder); break; @@ -5378,8 +5983,8 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( } done: - *buf = decoder->vec.data; - *buf_size = decoder->vec.capacity * sizeof(*decoder->vec.data); + *buf = decoder->oneofs.data; + *buf_size = decoder->oneofs.buf_capacity_bytes; return decoder->table; } @@ -5387,8 +5992,8 @@ static upb_MiniTable* upb_MtDecoder_BuildMiniTableWithBuf( upb_MtDecoder* const decoder, const char* const data, const size_t len, void** const buf, size_t* const buf_size) { if (UPB_SETJMP(decoder->base.err) != 0) { - *buf = decoder->vec.data; - *buf_size = decoder->vec.capacity * sizeof(*decoder->vec.data); + *buf = decoder->oneofs.data; + *buf_size = decoder->oneofs.buf_capacity_bytes; return NULL; } @@ -5404,10 +6009,10 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, upb_MtDecoder decoder = { .base = {.status = status}, .platform = platform, - .vec = + .oneofs = { .data = *buf, - .capacity = *buf_size / sizeof(*decoder.vec.data), + .buf_capacity_bytes = *buf_size, .size = 0, }, .arena = arena, @@ -5505,7 +6110,7 @@ upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, size_t size = 0; upb_MiniTable* ret = upb_MiniTable_BuildWithBuf(data, len, platform, arena, &buf, &size, status); - free(buf); + upb_gfree(buf); return ret; } @@ -5657,24 +6262,32 @@ upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena) { return r; } -UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, - const upb_MiniTableExtension* e) { +UPB_API upb_ExtensionRegistryStatus upb_ExtensionRegistry_Add( + upb_ExtensionRegistry* r, const upb_MiniTableExtension* e) { char buf[EXTREG_KEY_SIZE]; extreg_key(buf, e->UPB_PRIVATE(extendee), upb_MiniTableExtension_Number(e)); - if (upb_strtable_lookup2(&r->exts, buf, EXTREG_KEY_SIZE, NULL)) return false; - return upb_strtable_insert(&r->exts, buf, EXTREG_KEY_SIZE, - upb_value_constptr(e), r->arena); + + if (upb_strtable_lookup2(&r->exts, buf, EXTREG_KEY_SIZE, NULL)) { + return kUpb_ExtensionRegistryStatus_DuplicateEntry; + } + + if (!upb_strtable_insert(&r->exts, buf, EXTREG_KEY_SIZE, + upb_value_constptr(e), r->arena)) { + return kUpb_ExtensionRegistryStatus_OutOfMemory; + } + return kUpb_ExtensionRegistryStatus_Ok; } -bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, - const upb_MiniTableExtension** e, - size_t count) { +upb_ExtensionRegistryStatus upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistry* r, const upb_MiniTableExtension** e, size_t count) { const upb_MiniTableExtension** start = e; const upb_MiniTableExtension** end = UPB_PTRADD(e, count); + upb_ExtensionRegistryStatus status = kUpb_ExtensionRegistryStatus_Ok; for (; e < end; e++) { - if (!upb_ExtensionRegistry_Add(r, *e)) goto failure; + status = upb_ExtensionRegistry_Add(r, *e); + if (status != kUpb_ExtensionRegistryStatus_Ok) goto failure; } - return true; + return kUpb_ExtensionRegistryStatus_Ok; failure: // Back out the entries previously added. @@ -5685,7 +6298,8 @@ failure: upb_MiniTableExtension_Number(ext)); upb_strtable_remove2(&r->exts, buf, EXTREG_KEY_SIZE, NULL); } - return false; + UPB_ASSERT(status != kUpb_ExtensionRegistryStatus_Ok); + return status; } #ifdef UPB_LINKARR_DECLARE @@ -5698,7 +6312,9 @@ bool upb_ExtensionRegistry_AddAllLinkedExtensions(upb_ExtensionRegistry* r) { for (const upb_MiniTableExtension* p = start; p < stop; p++) { // Windows can introduce zero padding, so we have to skip zeroes. if (upb_MiniTableExtension_Number(p) != 0) { - if (!upb_ExtensionRegistry_Add(r, p)) return false; + if (upb_ExtensionRegistry_Add(r, p) != kUpb_ExtensionRegistryStatus_Ok) { + return false; + } } } return true; @@ -5719,7 +6335,6 @@ const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup( } -#include <inttypes.h> #include <stddef.h> #include <stdint.h> @@ -5737,21 +6352,30 @@ const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( } // Slow case: binary search - int lo = m->UPB_PRIVATE(dense_below); - int hi = m->UPB_PRIVATE(field_count) - 1; - while (lo <= hi) { - int mid = (lo + hi) / 2; - uint32_t num = m->UPB_PRIVATE(fields)[mid].UPB_PRIVATE(number); - if (num < number) { - lo = mid + 1; - continue; + uint32_t lo = m->UPB_PRIVATE(dense_below); + int32_t hi = m->UPB_PRIVATE(field_count) - 1; + const upb_MiniTableField* base = m->UPB_PRIVATE(fields); + while (hi >= (int32_t)lo) { + uint32_t mid = (hi + lo) / 2; + uint32_t num = base[mid].UPB_ONLYBITS(number); + // These comparison operations allow, on ARM machines, to fuse all these + // branches into one comparison followed by two CSELs to set the lo/hi + // values, followed by a BNE to continue or terminate the loop. Since binary + // search branches are generally unpredictable (50/50 in each direction), + // this is a good deal. We use signed for the high, as this decrement may + // underflow if mid is 0. + int32_t hi_mid = mid - 1; + uint32_t lo_mid = mid + 1; + if (num == number) { + return &base[mid]; } - if (num > number) { - hi = mid - 1; - continue; + if (UPB_UNPREDICTABLE(num < number)) { + lo = lo_mid; + } else { + hi = hi_mid; } - return &m->UPB_PRIVATE(fields)[mid]; } + return NULL; } @@ -6135,11 +6759,14 @@ static upb_Message* _upb_Decoder_ReuseSubMessage( upb_Message* existing = UPB_PRIVATE(_upb_TaggedMessagePtr_GetEmptyMessage)(tagged); upb_Message* promoted = _upb_Decoder_NewSubMessage(d, subs, field, target); - size_t size; - const char* unknown = upb_Message_GetUnknown(existing, &size); - upb_DecodeStatus status = upb_Decode(unknown, size, promoted, subl, d->extreg, - d->options, &d->arena); - if (status != kUpb_DecodeStatus_Ok) _upb_Decoder_ErrorJmp(d, status); + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView unknown; + while (upb_Message_NextUnknown(existing, &unknown, &iter)) { + upb_DecodeStatus status = + upb_Decode(unknown.data, unknown.size, promoted, subl, d->extreg, + d->options, &d->arena); + if (status != kUpb_DecodeStatus_Ok) _upb_Decoder_ErrorJmp(d, status); + } return promoted; } @@ -6213,6 +6840,7 @@ const char* _upb_Decoder_DecodeKnownGroup(upb_Decoder* d, const char* ptr, field->UPB_PRIVATE(number)); } +#define kUpb_Decoder_EncodeVarint32MaxSize 5 static char* upb_Decoder_EncodeVarint32(uint32_t val, char* ptr) { do { uint8_t byte = val & 0x7fU; @@ -6223,18 +6851,6 @@ static char* upb_Decoder_EncodeVarint32(uint32_t val, char* ptr) { return ptr; } -static void _upb_Decoder_AddUnknownVarints(upb_Decoder* d, upb_Message* msg, - uint32_t val1, uint32_t val2) { - char buf[20]; - char* end = buf; - end = upb_Decoder_EncodeVarint32(val1, end); - end = upb_Decoder_EncodeVarint32(val2, end); - - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, end - buf, &d->arena)) { - _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); - } -} - UPB_FORCEINLINE bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, const upb_MiniTableEnum* e, @@ -6249,9 +6865,17 @@ bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, const uint32_t tag = ((uint32_t)field->UPB_PRIVATE(number) << 3) | kUpb_WireType_Varint; upb_Message* unknown_msg = - field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension ? d->unknown_msg + field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension ? d->original_msg : msg; - _upb_Decoder_AddUnknownVarints(d, unknown_msg, tag, v); + char buf[2 * kUpb_Decoder_EncodeVarint32MaxSize]; + char* end = buf; + end = upb_Decoder_EncodeVarint32(tag, end); + end = upb_Decoder_EncodeVarint32(v, end); + + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(unknown_msg, buf, end - buf, + &d->arena, false)) { + _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); + } return false; } @@ -6509,10 +7133,7 @@ static const char* _upb_Decoder_DecodeToMap( ptr = _upb_Decoder_DecodeSubMessage(d, ptr, &ent.message, subs, field, val->size); - // check if ent had any unknown fields - size_t size; - upb_Message_GetUnknown(&ent.message, &size); - if (size != 0) { + if (upb_Message_HasUnknown(&ent.message)) { char* buf; size_t size; uint32_t tag = @@ -6522,8 +7143,16 @@ static const char* _upb_Decoder_DecodeToMap( if (status != kUpb_EncodeStatus_Ok) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } - _upb_Decoder_AddUnknownVarints(d, msg, tag, size); - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, size, &d->arena)) { + char delim_buf[2 * kUpb_Decoder_EncodeVarint32MaxSize]; + char* delim_end = delim_buf; + delim_end = upb_Decoder_EncodeVarint32(tag, delim_end); + delim_end = upb_Decoder_EncodeVarint32(size, delim_end); + upb_StringView unknown[] = { + {delim_buf, delim_end - delim_buf}, + {buf, size}, + }; + + if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 2)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } else { @@ -6670,7 +7299,7 @@ static void upb_Decoder_AddKnownMessageSetItem( } upb_Message* submsg = _upb_Decoder_NewSubMessage2( d, ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg), - &ext->ext->UPB_PRIVATE(field), (upb_TaggedMessagePtr*)&ext->data); + &ext->ext->UPB_PRIVATE(field), &ext->data.tagged_msg_val); upb_DecodeStatus status = upb_Decode( data, size, submsg, upb_MiniTableExtension_GetSubMessage(item_mt), d->extreg, d->options, &d->arena); @@ -6682,7 +7311,7 @@ static void upb_Decoder_AddUnknownMessageSetItem(upb_Decoder* d, uint32_t type_id, const char* message_data, uint32_t message_size) { - char buf[60]; + char buf[6 * kUpb_Decoder_EncodeVarint32MaxSize]; char* ptr = buf; ptr = upb_Decoder_EncodeVarint32(kStartItemTag, ptr); ptr = upb_Decoder_EncodeVarint32(kTypeIdTag, ptr); @@ -6693,12 +7322,12 @@ static void upb_Decoder_AddUnknownMessageSetItem(upb_Decoder* d, ptr = upb_Decoder_EncodeVarint32(kEndItemTag, ptr); char* end = ptr; - - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, split - buf, &d->arena) || - !UPB_PRIVATE(_upb_Message_AddUnknown)(msg, message_data, message_size, - &d->arena) || - !UPB_PRIVATE(_upb_Message_AddUnknown)(msg, split, end - split, - &d->arena)) { + upb_StringView unknown[] = { + {buf, split - buf}, + {message_data, message_size}, + {split, end - split}, + }; + if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 3)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } @@ -7023,8 +7652,8 @@ const char* _upb_Decoder_DecodeKnownField(upb_Decoder* d, const char* ptr, if (UPB_UNLIKELY(!ext)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } - d->unknown_msg = msg; - msg = (upb_Message*)&ext->data; + d->original_msg = msg; + msg = &ext->data.UPB_PRIVATE(ext_msg_val); if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) { ext_sub.UPB_PRIVATE(submsg) = &ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); @@ -7068,7 +7697,8 @@ static const char* _upb_Decoder_DecodeUnknownField(upb_Decoder* d, // Since unknown fields are the uncommon case, we do a little extra work here // to walk backwards through the buffer to find the field start. This frees // up a register in the fast paths (when the field is known), which leads to - // significant speedups in benchmarks. + // significant speedups in benchmarks. Note that ptr may point into the slop + // space, beyond the normal end of the input buffer. const char* start = ptr; if (wire_type == kUpb_WireType_Delimited) ptr += val.size; @@ -7094,15 +7724,21 @@ static const char* _upb_Decoder_DecodeUnknownField(upb_Decoder* d, start = _upb_Decoder_ReverseSkipVarint(start, tag); assert(start == d->debug_tagstart); + const char* input_start = + upb_EpsCopyInputStream_GetInputPtr(&d->input, start); if (wire_type == kUpb_WireType_StartGroup) { - d->unknown = start; - d->unknown_msg = msg; ptr = _upb_Decoder_DecodeUnknownGroup(d, ptr, field_number); - start = d->unknown; - d->unknown = NULL; } - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, start, ptr - start, - &d->arena)) { + // Normally, bounds checks for fixed or varint fields are performed after + // the field is parsed; it's OK for the field to overrun the end of the + // buffer, because it'll just read into slop space. However, because this + // path reads bytes from the input buffer rather than the patch buffer, + // bounds checks are needed before adding the unknown field. + _upb_Decoder_IsDone(d, &ptr); + const char* input_ptr = upb_EpsCopyInputStream_GetInputPtr(&d->input, ptr); + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, input_start, + input_ptr - input_start, + &d->arena, d->input.aliasing)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } else if (wire_type == kUpb_WireType_StartGroup) { @@ -7223,20 +7859,23 @@ static upb_DecodeStatus upb_Decoder_Decode(upb_Decoder* const decoder, return decoder->status; } +uint16_t upb_DecodeOptions_GetEffectiveMaxDepth(uint32_t options) { + uint16_t max_depth = upb_DecodeOptions_GetMaxDepth(options); + return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; +} + upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, const upb_MiniTable* mt, const upb_ExtensionRegistry* extreg, int options, upb_Arena* arena) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Decoder decoder; - unsigned depth = (unsigned)options >> 16; upb_EpsCopyInputStream_Init(&decoder.input, &buf, size, options & kUpb_DecodeOption_AliasString); decoder.extreg = extreg; - decoder.unknown = NULL; - decoder.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; + decoder.depth = upb_DecodeOptions_GetEffectiveMaxDepth(options); decoder.end_group = DECODE_NOGROUP; decoder.options = (uint16_t)options; decoder.missing_required = false; @@ -7317,6 +7956,7 @@ const char* upb_DecodeStatus_String(upb_DecodeStatus status) { #include <setjmp.h> #include <stdbool.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> @@ -7802,32 +8442,72 @@ static void encode_field(upb_encstate* e, const upb_Message* msg, } } -static void encode_msgset_item(upb_encstate* e, const upb_Extension* ext) { +static void encode_msgset_item(upb_encstate* e, + const upb_MiniTableExtension* ext, + const upb_MessageValue ext_val) { size_t size; encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_EndGroup); - encode_message(e, ext->data.msg_val, - upb_MiniTableExtension_GetSubMessage(ext->ext), &size); + encode_message(e, ext_val.msg_val, upb_MiniTableExtension_GetSubMessage(ext), + &size); encode_varint(e, size); encode_tag(e, kUpb_MsgSet_Message, kUpb_WireType_Delimited); - encode_varint(e, upb_MiniTableExtension_Number(ext->ext)); + encode_varint(e, upb_MiniTableExtension_Number(ext)); encode_tag(e, kUpb_MsgSet_TypeId, kUpb_WireType_Varint); encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_StartGroup); } -static void encode_ext(upb_encstate* e, const upb_Extension* ext, - bool is_message_set) { +static void encode_ext(upb_encstate* e, const upb_MiniTableExtension* ext, + upb_MessageValue ext_val, bool is_message_set) { if (UPB_UNLIKELY(is_message_set)) { - encode_msgset_item(e, ext); + encode_msgset_item(e, ext, ext_val); } else { upb_MiniTableSubInternal sub; - if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) { - sub.UPB_PRIVATE(submsg) = &ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); + if (upb_MiniTableField_IsSubMessage(&ext->UPB_PRIVATE(field))) { + sub.UPB_PRIVATE(submsg) = &ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); } else { - sub.UPB_PRIVATE(subenum) = - ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum); + sub.UPB_PRIVATE(subenum) = ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum); } - encode_field(e, (upb_Message*)&ext->data, &sub, - &ext->ext->UPB_PRIVATE(field)); + encode_field(e, &ext_val.UPB_PRIVATE(ext_msg_val), &sub, + &ext->UPB_PRIVATE(field)); + } +} + +static void encode_exts(upb_encstate* e, const upb_MiniTable* m, + const upb_Message* msg) { + if (m->UPB_PRIVATE(ext) == kUpb_ExtMode_NonExtendable) return; + + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return; + + /* Encode all extensions together. Unlike C++, we do not attempt to keep + * these in field number order relative to normal fields or even to each + * other. */ + uintptr_t iter = kUpb_Message_ExtensionBegin; + const upb_MiniTableExtension* ext; + upb_MessageValue ext_val; + if (!UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, &ext, &ext_val, + &iter)) { + // Message has no extensions. + return; + } + + if (e->options & kUpb_EncodeOption_Deterministic) { + _upb_sortedmap sorted; + if (!_upb_mapsorter_pushexts(&e->sorter, in, &sorted)) { + // TODO: b/378744096 - handle alloc failure + } + const upb_Extension* ext; + while (_upb_sortedmap_nextext(&e->sorter, &sorted, &ext)) { + encode_ext(e, ext->ext, ext->data, + m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); + } + _upb_mapsorter_popmap(&e->sorter, &sorted); + } else { + do { + encode_ext(e, ext, ext_val, + m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); + } while (UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, &ext, &ext_val, + &iter)); } } @@ -7844,38 +8524,27 @@ static void encode_message(upb_encstate* e, const upb_Message* msg, } if ((e->options & kUpb_EncodeOption_SkipUnknown) == 0) { - size_t unknown_size; - const char* unknown = upb_Message_GetUnknown(msg, &unknown_size); - - if (unknown) { - encode_bytes(e, unknown, unknown_size); + size_t unknown_size = 0; + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView unknown; + // Need to write in reverse order, but iteration is in-order; scan to + // reserve capacity up front, then write in-order + while (upb_Message_NextUnknown(msg, &unknown, &iter)) { + unknown_size += unknown.size; } - } - - if (m->UPB_PRIVATE(ext) != kUpb_ExtMode_NonExtendable) { - /* Encode all extensions together. Unlike C++, we do not attempt to keep - * these in field number order relative to normal fields or even to each - * other. */ - size_t ext_count; - const upb_Extension* ext = - UPB_PRIVATE(_upb_Message_Getexts)(msg, &ext_count); - if (ext_count) { - if (e->options & kUpb_EncodeOption_Deterministic) { - _upb_sortedmap sorted; - _upb_mapsorter_pushexts(&e->sorter, ext, ext_count, &sorted); - while (_upb_sortedmap_nextext(&e->sorter, &sorted, &ext)) { - encode_ext(e, ext, m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); - } - _upb_mapsorter_popmap(&e->sorter, &sorted); - } else { - const upb_Extension* end = ext + ext_count; - for (; ext != end; ext++) { - encode_ext(e, ext, m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); - } + if (unknown_size != 0) { + encode_reserve(e, unknown_size); + char* ptr = e->ptr; + iter = kUpb_Message_UnknownBegin; + while (upb_Message_NextUnknown(msg, &unknown, &iter)) { + memcpy(ptr, unknown.data, unknown.size); + ptr += unknown.size; } } } + encode_exts(e, m, msg); + if (upb_MiniTable_FieldCount(m)) { const upb_MiniTableField* f = &m->UPB_PRIVATE(fields)[m->UPB_PRIVATE(field_count)]; @@ -7924,19 +8593,23 @@ static upb_EncodeStatus upb_Encoder_Encode(upb_encstate* const encoder, return encoder->status; } +uint16_t upb_EncodeOptions_GetEffectiveMaxDepth(uint32_t options) { + uint16_t max_depth = upb_EncodeOptions_GetMaxDepth(options); + return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; +} + static upb_EncodeStatus _upb_Encode(const upb_Message* msg, const upb_MiniTable* l, int options, upb_Arena* arena, char** buf, size_t* size, bool prepend_len) { upb_encstate e; - unsigned depth = (unsigned)options >> 16; e.status = kUpb_EncodeStatus_Ok; e.arena = arena; e.buf = NULL; e.limit = NULL; e.ptr = NULL; - e.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; + e.depth = upb_EncodeOptions_GetEffectiveMaxDepth(options); e.options = options; _upb_mapsorter_init(&e.sorter); @@ -9046,16 +9719,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileDescriptorProto__subms static const upb_MiniTableField google_protobuf_FileDescriptorProto__fields[13] = { {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; @@ -9070,15 +9743,15 @@ const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init = { {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x003000003f00001a, &upb_prs_1bt}, - {0x003800003f000022, &upb_prm_1bt_max128b}, - {0x004000003f01002a, &upb_prm_1bt_max128b}, - {0x004800003f020032, &upb_prm_1bt_max64b}, - {0x005000003f03003a, &upb_prm_1bt_max128b}, + {0x004000003f00001a, &upb_prs_1bt}, + {0x004800003f000022, &upb_prm_1bt_max128b}, + {0x005000003f01002a, &upb_prm_1bt_max128b}, + {0x005800003f020032, &upb_prm_1bt_max64b}, + {0x006000003f03003a, &upb_prm_1bt_max128b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x006800003f000050, &upb_prv4_1bt}, - {0x007000003f000058, &upb_prv4_1bt}, + {0x007800003f000050, &upb_prv4_1bt}, + {0x008000003f000058, &upb_prv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -9234,16 +9907,16 @@ const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init = { const upb_MiniTable* google__protobuf__ExtensionRangeOptions_msg_init_ptr = &google__protobuf__ExtensionRangeOptions_msg_init; static const upb_MiniTableField google_protobuf_ExtensionRangeOptions_Declaration__fields[5] = { {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init = { NULL, &google_protobuf_ExtensionRangeOptions_Declaration__fields[0], - UPB_SIZE(40, 56), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(32, 48), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.ExtensionRangeOptions.Declaration", #endif @@ -9257,23 +9930,23 @@ static const upb_MiniTableSubInternal google_protobuf_FieldDescriptorProto__subm }; static const upb_MiniTableField google_protobuf_FieldDescriptorProto__fields[11] = { - {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init = { &google_protobuf_FieldDescriptorProto__submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], - UPB_SIZE(80, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(72, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldDescriptorProto", #endif @@ -9400,18 +10073,18 @@ static const upb_MiniTableSubInternal google_protobuf_MethodDescriptorProto__sub }; static const upb_MiniTableField google_protobuf_MethodDescriptorProto__fields[6] = { - {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init = { &google_protobuf_MethodDescriptorProto__submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], - UPB_SIZE(48, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(40, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.MethodDescriptorProto", #endif @@ -9427,16 +10100,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileOptions__submsgs[3] = static const upb_MiniTableField google_protobuf_FileOptions__fields[21] = { {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, @@ -9563,26 +10236,26 @@ static const upb_MiniTableSubInternal google_protobuf_FieldOptions__submsgs[8] = }; static const upb_MiniTableField google_protobuf_FieldOptions__fields[14] = { - {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldOptions_msg_init = { &google_protobuf_FieldOptions__submsgs[0], &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(56, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(48, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldOptions", #endif @@ -9785,15 +10458,15 @@ static const upb_MiniTableSubInternal google_protobuf_EnumValueOptions__submsgs[ static const upb_MiniTableField google_protobuf_EnumValueOptions__fields[5] = { {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__EnumValueOptions_msg_init = { &google_protobuf_EnumValueOptions__submsgs[0], &google_protobuf_EnumValueOptions__fields[0], - UPB_SIZE(32, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(24, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.EnumValueOptions", #endif @@ -9951,13 +10624,13 @@ static const upb_MiniTableSubInternal google_protobuf_UninterpretedOption__subms }; static const upb_MiniTableField google_protobuf_UninterpretedOption__fields[7] = { - {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { @@ -9970,7 +10643,7 @@ const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f000012, &upb_prm_1bt_max64b}, + {0x004000003f000012, &upb_prm_1bt_max64b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, }) }; @@ -9991,28 +10664,30 @@ const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init = { }; const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init_ptr = &google__protobuf__UninterpretedOption__NamePart_msg_init; -static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[6] = { +static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[7] = { {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__FieldPresence_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnumType_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__RepeatedFieldEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__Utf8Validation_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__MessageEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__JsonFormat_enum_init}, + {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init}, }; -static const upb_MiniTableField google_protobuf_FeatureSet__fields[6] = { +static const upb_MiniTableField google_protobuf_FeatureSet__fields[7] = { {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FeatureSet_msg_init = { &google_protobuf_FeatureSet__submsgs[0], &google_protobuf_FeatureSet__fields[0], - 40, 6, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(255), 0, + 40, 7, kUpb_ExtMode_Extendable, 7, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FeatureSet", #endif @@ -10090,10 +10765,10 @@ const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init = { const upb_MiniTable* google__protobuf__SourceCodeInfo_msg_init_ptr = &google__protobuf__SourceCodeInfo_msg_init; static const upb_MiniTableField google_protobuf_SourceCodeInfo_Location__fields[5] = { - {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; @@ -10106,8 +10781,8 @@ const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f00000a, &upb_ppv4_1bt}, - {0x001800003f000012, &upb_ppv4_1bt}, + {0x003000003f00000a, &upb_ppv4_1bt}, + {0x003800003f000012, &upb_ppv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -10144,8 +10819,8 @@ static const upb_MiniTableSubInternal google_protobuf_GeneratedCodeInfo_Annotati }; static const upb_MiniTableField google_protobuf_GeneratedCodeInfo_Annotation__fields[5] = { - {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, @@ -10160,7 +10835,7 @@ const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001800003f00000a, &upb_ppv4_1bt}, + {0x002800003f00000a, &upb_ppv4_1bt}, }) }; @@ -10192,6 +10867,15 @@ const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationSta }, }; +const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init = { + 64, + 0, + { + 0x7, + 0x0, + }, +}; + const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init = { 64, 0, @@ -10363,9 +11047,10 @@ static const upb_MiniTable *messages_layout[33] = { &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, }; -static const upb_MiniTableEnum *enums_layout[17] = { +static const upb_MiniTableEnum *enums_layout[18] = { &google__protobuf__Edition_enum_init, &google__protobuf__ExtensionRangeOptions__VerificationState_enum_init, + &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init, &google__protobuf__FeatureSet__EnumType_enum_init, &google__protobuf__FeatureSet__FieldPresence_enum_init, &google__protobuf__FeatureSet__JsonFormat_enum_init, @@ -10388,7 +11073,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = { enums_layout, NULL, 33, - 17, + 18, 0, }; @@ -10402,7 +11087,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = { * NO CHECKED-IN PROTOBUF GENCODE */ -static const char descriptor[12296] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', +static const char descriptor[12559] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', '[', '\n', '\021', 'F', 'i', 'l', 'e', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'S', 'e', 't', '\022', '8', '\n', '\004', 'f', 'i', 'l', 'e', '\030', '\001', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', @@ -10778,7 +11463,7 @@ static const char descriptor[12296] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '\n', '\010', 'N', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '\033', '\n', '\t', 'n', 'a', 'm', 'e', '_', 'p', 'a', 'r', 't', '\030', '\001', ' ', '\002', '(', '\t', 'R', '\010', 'n', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '!', '\n', '\014', 'i', 's', '_', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\030', '\002', ' ', '\002', '(', '\010', 'R', '\013', 'i', 's', 'E', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\"', -'\247', '\n', '\n', '\n', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '\022', '\221', '\001', '\n', '\016', 'f', 'i', 'e', 'l', 'd', '_', +'\256', '\014', '\n', '\n', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '\022', '\221', '\001', '\n', '\016', 'f', 'i', 'e', 'l', 'd', '_', 'p', 'r', 'e', 's', 'e', 'n', 'c', 'e', '\030', '\001', ' ', '\001', '(', '\016', '2', ')', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '.', 'F', 'i', 'e', 'l', 'd', 'P', 'r', 'e', 's', 'e', 'n', 'c', 'e', 'B', '?', '\210', '\001', '\001', '\230', '\001', '\004', '\230', '\001', '\001', '\242', '\001', '\r', '\022', '\010', 'E', 'X', @@ -10810,90 +11495,101 @@ static const char descriptor[12296] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '.', 'J', 's', 'o', 'n', 'F', 'o', 'r', 'm', 'a', 't', 'B', '9', '\210', '\001', '\001', '\230', '\001', '\003', '\230', '\001', '\006', '\230', '\001', '\001', '\242', '\001', '\027', '\022', '\022', 'L', 'E', 'G', 'A', 'C', 'Y', '_', 'B', 'E', 'S', 'T', '_', 'E', 'F', 'F', 'O', 'R', 'T', '\030', '\204', '\007', '\242', '\001', '\n', '\022', '\005', 'A', 'L', 'L', 'O', 'W', '\030', '\347', '\007', '\262', '\001', -'\003', '\010', '\350', '\007', 'R', '\n', 'j', 's', 'o', 'n', 'F', 'o', 'r', 'm', 'a', 't', '\"', '\\', '\n', '\r', 'F', 'i', 'e', 'l', 'd', -'P', 'r', 'e', 's', 'e', 'n', 'c', 'e', '\022', '\032', '\n', '\026', 'F', 'I', 'E', 'L', 'D', '_', 'P', 'R', 'E', 'S', 'E', 'N', 'C', -'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\014', '\n', '\010', 'E', 'X', 'P', 'L', 'I', 'C', 'I', 'T', '\020', '\001', -'\022', '\014', '\n', '\010', 'I', 'M', 'P', 'L', 'I', 'C', 'I', 'T', '\020', '\002', '\022', '\023', '\n', '\017', 'L', 'E', 'G', 'A', 'C', 'Y', '_', -'R', 'E', 'Q', 'U', 'I', 'R', 'E', 'D', '\020', '\003', '\"', '7', '\n', '\010', 'E', 'n', 'u', 'm', 'T', 'y', 'p', 'e', '\022', '\025', '\n', -'\021', 'E', 'N', 'U', 'M', '_', 'T', 'Y', 'P', 'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\010', '\n', '\004', 'O', -'P', 'E', 'N', '\020', '\001', '\022', '\n', '\n', '\006', 'C', 'L', 'O', 'S', 'E', 'D', '\020', '\002', '\"', 'V', '\n', '\025', 'R', 'e', 'p', 'e', -'a', 't', 'e', 'd', 'F', 'i', 'e', 'l', 'd', 'E', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '\022', '#', '\n', '\037', 'R', 'E', 'P', 'E', -'A', 'T', 'E', 'D', '_', 'F', 'I', 'E', 'L', 'D', '_', 'E', 'N', 'C', 'O', 'D', 'I', 'N', 'G', '_', 'U', 'N', 'K', 'N', 'O', -'W', 'N', '\020', '\000', '\022', '\n', '\n', '\006', 'P', 'A', 'C', 'K', 'E', 'D', '\020', '\001', '\022', '\014', '\n', '\010', 'E', 'X', 'P', 'A', 'N', -'D', 'E', 'D', '\020', '\002', '\"', 'I', '\n', '\016', 'U', 't', 'f', '8', 'V', 'a', 'l', 'i', 'd', 'a', 't', 'i', 'o', 'n', '\022', '\033', -'\n', '\027', 'U', 'T', 'F', '8', '_', 'V', 'A', 'L', 'I', 'D', 'A', 'T', 'I', 'O', 'N', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', -'\020', '\000', '\022', '\n', '\n', '\006', 'V', 'E', 'R', 'I', 'F', 'Y', '\020', '\002', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\003', '\"', -'\004', '\010', '\001', '\020', '\001', '\"', 'S', '\n', '\017', 'M', 'e', 's', 's', 'a', 'g', 'e', 'E', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '\022', -'\034', '\n', '\030', 'M', 'E', 'S', 'S', 'A', 'G', 'E', '_', 'E', 'N', 'C', 'O', 'D', 'I', 'N', 'G', '_', 'U', 'N', 'K', 'N', 'O', -'W', 'N', '\020', '\000', '\022', '\023', '\n', '\017', 'L', 'E', 'N', 'G', 'T', 'H', '_', 'P', 'R', 'E', 'F', 'I', 'X', 'E', 'D', '\020', '\001', -'\022', '\r', '\n', '\t', 'D', 'E', 'L', 'I', 'M', 'I', 'T', 'E', 'D', '\020', '\002', '\"', 'H', '\n', '\n', 'J', 's', 'o', 'n', 'F', 'o', -'r', 'm', 'a', 't', '\022', '\027', '\n', '\023', 'J', 'S', 'O', 'N', '_', 'F', 'O', 'R', 'M', 'A', 'T', '_', 'U', 'N', 'K', 'N', 'O', -'W', 'N', '\020', '\000', '\022', '\t', '\n', '\005', 'A', 'L', 'L', 'O', 'W', '\020', '\001', '\022', '\026', '\n', '\022', 'L', 'E', 'G', 'A', 'C', 'Y', -'_', 'B', 'E', 'S', 'T', '_', 'E', 'F', 'F', 'O', 'R', 'T', '\020', '\002', '*', '\006', '\010', '\350', '\007', '\020', '\213', 'N', '*', '\006', '\010', -'\213', 'N', '\020', '\220', 'N', '*', '\006', '\010', '\220', 'N', '\020', '\221', 'N', 'J', '\006', '\010', '\347', '\007', '\020', '\350', '\007', '\"', '\357', '\003', '\n', -'\022', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'D', 'e', 'f', 'a', 'u', 'l', 't', 's', '\022', 'X', '\n', '\010', 'd', 'e', -'f', 'a', 'u', 'l', 't', 's', '\030', '\001', ' ', '\003', '(', '\013', '2', '<', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', -'t', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'D', 'e', 'f', 'a', 'u', 'l', 't', 's', '.', -'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'D', 'e', 'f', 'a', 'u', 'l', 't', 'R', -'\010', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's', '\022', 'A', '\n', '\017', 'm', 'i', 'n', 'i', 'm', 'u', 'm', '_', 'e', 'd', 'i', 't', -'i', 'o', 'n', '\030', '\004', ' ', '\001', '(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', -'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\016', 'm', 'i', 'n', 'i', 'm', 'u', 'm', 'E', 'd', 'i', 't', 'i', 'o', -'n', '\022', 'A', '\n', '\017', 'm', 'a', 'x', 'i', 'm', 'u', 'm', '_', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\005', ' ', '\001', '(', -'\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', -'o', 'n', 'R', '\016', 'm', 'a', 'x', 'i', 'm', 'u', 'm', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\032', '\370', '\001', '\n', '\030', 'F', 'e', -'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'D', 'e', 'f', 'a', 'u', 'l', 't', '\022', '2', '\n', -'\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\003', ' ', '\001', '(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', -'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\022', -'N', '\n', '\024', 'o', 'v', 'e', 'r', 'r', 'i', 'd', 'a', 'b', 'l', 'e', '_', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\030', '\004', -' ', '\001', '(', '\013', '2', '\033', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', -'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'R', '\023', 'o', 'v', 'e', 'r', 'r', 'i', 'd', 'a', 'b', 'l', 'e', 'F', 'e', 'a', 't', -'u', 'r', 'e', 's', '\022', 'B', '\n', '\016', 'f', 'i', 'x', 'e', 'd', '_', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\030', '\005', ' ', -'\001', '(', '\013', '2', '\033', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', -'t', 'u', 'r', 'e', 'S', 'e', 't', 'R', '\r', 'f', 'i', 'x', 'e', 'd', 'F', 'e', 'a', 't', 'u', 'r', 'e', 's', 'J', '\004', '\010', -'\001', '\020', '\002', 'J', '\004', '\010', '\002', '\020', '\003', 'R', '\010', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\"', '\265', '\002', '\n', '\016', 'S', -'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', -'\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', -'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', -'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', -'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', -'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', -'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', -'d', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', '+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', -'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', '(', '\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', -'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', -'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\006', ' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', -'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '*', '\014', '\010', '\200', '\354', '\312', '\377', '\001', -'\020', '\201', '\354', '\312', '\377', '\001', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', -'n', 'f', 'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', -'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', -'d', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', -'o', 't', 'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', -'\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', -'s', 'o', 'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', -'F', 'i', 'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', '\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', -'n', '\022', '\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', 'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', -'m', 'a', 'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', -'t', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', -'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', -'t', 'i', 'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', -'\022', '\007', '\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002', '*', '\247', '\002', '\n', '\007', -'E', 'd', 'i', 't', 'i', 'o', 'n', '\022', '\023', '\n', '\017', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'U', 'N', 'K', 'N', 'O', 'W', -'N', '\020', '\000', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'L', 'E', 'G', 'A', 'C', 'Y', '\020', '\204', '\007', '\022', -'\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'P', 'R', 'O', 'T', 'O', '2', '\020', '\346', '\007', '\022', '\023', '\n', '\016', 'E', -'D', 'I', 'T', 'I', 'O', 'N', '_', 'P', 'R', 'O', 'T', 'O', '3', '\020', '\347', '\007', '\022', '\021', '\n', '\014', 'E', 'D', 'I', 'T', 'I', -'O', 'N', '_', '2', '0', '2', '3', '\020', '\350', '\007', '\022', '\021', '\n', '\014', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '0', '2', -'4', '\020', '\351', '\007', '\022', '\027', '\n', '\023', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '1', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', -'L', 'Y', '\020', '\001', '\022', '\027', '\n', '\023', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', -'L', 'Y', '\020', '\002', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '7', '_', 'T', 'E', 'S', -'T', '_', 'O', 'N', 'L', 'Y', '\020', '\235', '\215', '\006', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', -'9', '8', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\236', '\215', '\006', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', -'O', 'N', '_', '9', '9', '9', '9', '9', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\237', '\215', '\006', '\022', '\023', '\n', -'\013', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'M', 'A', 'X', '\020', '\377', '\377', '\377', '\377', '\007', 'B', '~', '\n', '\023', 'c', 'o', 'm', -'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', -'t', 'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', '-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', -'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', -'r', 'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', -'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n', +'\003', '\010', '\350', '\007', 'R', '\n', 'j', 's', 'o', 'n', 'F', 'o', 'r', 'm', 'a', 't', '\022', '\253', '\001', '\n', '\024', 'e', 'n', 'f', 'o', +'r', 'c', 'e', '_', 'n', 'a', 'm', 'i', 'n', 'g', '_', 's', 't', 'y', 'l', 'e', '\030', '\007', ' ', '\001', '(', '\016', '2', '.', '.', +'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', +'t', '.', 'E', 'n', 'f', 'o', 'r', 'c', 'e', 'N', 'a', 'm', 'i', 'n', 'g', 'S', 't', 'y', 'l', 'e', 'B', 'I', '\210', '\001', '\002', +'\230', '\001', '\001', '\230', '\001', '\002', '\230', '\001', '\003', '\230', '\001', '\004', '\230', '\001', '\005', '\230', '\001', '\006', '\230', '\001', '\007', '\230', '\001', '\010', '\230', +'\001', '\t', '\242', '\001', '\021', '\022', '\014', 'S', 'T', 'Y', 'L', 'E', '_', 'L', 'E', 'G', 'A', 'C', 'Y', '\030', '\204', '\007', '\242', '\001', '\016', +'\022', '\t', 'S', 'T', 'Y', 'L', 'E', '2', '0', '2', '4', '\030', '\351', '\007', '\262', '\001', '\003', '\010', '\351', '\007', 'R', '\022', 'e', 'n', 'f', +'o', 'r', 'c', 'e', 'N', 'a', 'm', 'i', 'n', 'g', 'S', 't', 'y', 'l', 'e', '\"', '\\', '\n', '\r', 'F', 'i', 'e', 'l', 'd', 'P', +'r', 'e', 's', 'e', 'n', 'c', 'e', '\022', '\032', '\n', '\026', 'F', 'I', 'E', 'L', 'D', '_', 'P', 'R', 'E', 'S', 'E', 'N', 'C', 'E', +'_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\014', '\n', '\010', 'E', 'X', 'P', 'L', 'I', 'C', 'I', 'T', '\020', '\001', '\022', +'\014', '\n', '\010', 'I', 'M', 'P', 'L', 'I', 'C', 'I', 'T', '\020', '\002', '\022', '\023', '\n', '\017', 'L', 'E', 'G', 'A', 'C', 'Y', '_', 'R', +'E', 'Q', 'U', 'I', 'R', 'E', 'D', '\020', '\003', '\"', '7', '\n', '\010', 'E', 'n', 'u', 'm', 'T', 'y', 'p', 'e', '\022', '\025', '\n', '\021', +'E', 'N', 'U', 'M', '_', 'T', 'Y', 'P', 'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\010', '\n', '\004', 'O', 'P', +'E', 'N', '\020', '\001', '\022', '\n', '\n', '\006', 'C', 'L', 'O', 'S', 'E', 'D', '\020', '\002', '\"', 'V', '\n', '\025', 'R', 'e', 'p', 'e', 'a', +'t', 'e', 'd', 'F', 'i', 'e', 'l', 'd', 'E', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '\022', '#', '\n', '\037', 'R', 'E', 'P', 'E', 'A', +'T', 'E', 'D', '_', 'F', 'I', 'E', 'L', 'D', '_', 'E', 'N', 'C', 'O', 'D', 'I', 'N', 'G', '_', 'U', 'N', 'K', 'N', 'O', 'W', +'N', '\020', '\000', '\022', '\n', '\n', '\006', 'P', 'A', 'C', 'K', 'E', 'D', '\020', '\001', '\022', '\014', '\n', '\010', 'E', 'X', 'P', 'A', 'N', 'D', +'E', 'D', '\020', '\002', '\"', 'I', '\n', '\016', 'U', 't', 'f', '8', 'V', 'a', 'l', 'i', 'd', 'a', 't', 'i', 'o', 'n', '\022', '\033', '\n', +'\027', 'U', 'T', 'F', '8', '_', 'V', 'A', 'L', 'I', 'D', 'A', 'T', 'I', 'O', 'N', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', +'\000', '\022', '\n', '\n', '\006', 'V', 'E', 'R', 'I', 'F', 'Y', '\020', '\002', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\003', '\"', '\004', +'\010', '\001', '\020', '\001', '\"', 'S', '\n', '\017', 'M', 'e', 's', 's', 'a', 'g', 'e', 'E', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '\022', '\034', +'\n', '\030', 'M', 'E', 'S', 'S', 'A', 'G', 'E', '_', 'E', 'N', 'C', 'O', 'D', 'I', 'N', 'G', '_', 'U', 'N', 'K', 'N', 'O', 'W', +'N', '\020', '\000', '\022', '\023', '\n', '\017', 'L', 'E', 'N', 'G', 'T', 'H', '_', 'P', 'R', 'E', 'F', 'I', 'X', 'E', 'D', '\020', '\001', '\022', +'\r', '\n', '\t', 'D', 'E', 'L', 'I', 'M', 'I', 'T', 'E', 'D', '\020', '\002', '\"', 'H', '\n', '\n', 'J', 's', 'o', 'n', 'F', 'o', 'r', +'m', 'a', 't', '\022', '\027', '\n', '\023', 'J', 'S', 'O', 'N', '_', 'F', 'O', 'R', 'M', 'A', 'T', '_', 'U', 'N', 'K', 'N', 'O', 'W', +'N', '\020', '\000', '\022', '\t', '\n', '\005', 'A', 'L', 'L', 'O', 'W', '\020', '\001', '\022', '\026', '\n', '\022', 'L', 'E', 'G', 'A', 'C', 'Y', '_', +'B', 'E', 'S', 'T', '_', 'E', 'F', 'F', 'O', 'R', 'T', '\020', '\002', '\"', 'W', '\n', '\022', 'E', 'n', 'f', 'o', 'r', 'c', 'e', 'N', +'a', 'm', 'i', 'n', 'g', 'S', 't', 'y', 'l', 'e', '\022', ' ', '\n', '\034', 'E', 'N', 'F', 'O', 'R', 'C', 'E', '_', 'N', 'A', 'M', +'I', 'N', 'G', '_', 'S', 'T', 'Y', 'L', 'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\r', '\n', '\t', 'S', 'T', +'Y', 'L', 'E', '2', '0', '2', '4', '\020', '\001', '\022', '\020', '\n', '\014', 'S', 'T', 'Y', 'L', 'E', '_', 'L', 'E', 'G', 'A', 'C', 'Y', +'\020', '\002', '*', '\006', '\010', '\350', '\007', '\020', '\213', 'N', '*', '\006', '\010', '\213', 'N', '\020', '\220', 'N', '*', '\006', '\010', '\220', 'N', '\020', '\221', +'N', 'J', '\006', '\010', '\347', '\007', '\020', '\350', '\007', '\"', '\357', '\003', '\n', '\022', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'D', +'e', 'f', 'a', 'u', 'l', 't', 's', '\022', 'X', '\n', '\010', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's', '\030', '\001', ' ', '\003', '(', '\013', +'2', '<', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', +'e', 'S', 'e', 't', 'D', 'e', 'f', 'a', 'u', 'l', 't', 's', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'E', 'd', +'i', 't', 'i', 'o', 'n', 'D', 'e', 'f', 'a', 'u', 'l', 't', 'R', '\010', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's', '\022', 'A', '\n', +'\017', 'm', 'i', 'n', 'i', 'm', 'u', 'm', '_', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\004', ' ', '\001', '(', '\016', '2', '\030', '.', +'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\016', +'m', 'i', 'n', 'i', 'm', 'u', 'm', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\022', 'A', '\n', '\017', 'm', 'a', 'x', 'i', 'm', 'u', 'm', +'_', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\005', ' ', '\001', '(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', +'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\016', 'm', 'a', 'x', 'i', 'm', 'u', 'm', 'E', +'d', 'i', 't', 'i', 'o', 'n', '\032', '\370', '\001', '\n', '\030', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'E', 'd', 'i', 't', +'i', 'o', 'n', 'D', 'e', 'f', 'a', 'u', 'l', 't', '\022', '2', '\n', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\003', ' ', '\001', +'(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', +'i', 'o', 'n', 'R', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\022', 'N', '\n', '\024', 'o', 'v', 'e', 'r', 'r', 'i', 'd', 'a', 'b', +'l', 'e', '_', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\030', '\004', ' ', '\001', '(', '\013', '2', '\033', '.', 'g', 'o', 'o', 'g', 'l', +'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'R', '\023', 'o', 'v', +'e', 'r', 'r', 'i', 'd', 'a', 'b', 'l', 'e', 'F', 'e', 'a', 't', 'u', 'r', 'e', 's', '\022', 'B', '\n', '\016', 'f', 'i', 'x', 'e', +'d', '_', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\030', '\005', ' ', '\001', '(', '\013', '2', '\033', '.', 'g', 'o', 'o', 'g', 'l', 'e', +'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'R', '\r', 'f', 'i', 'x', +'e', 'd', 'F', 'e', 'a', 't', 'u', 'r', 'e', 's', 'J', '\004', '\010', '\001', '\020', '\002', 'J', '\004', '\010', '\002', '\020', '\003', 'R', '\010', 'f', +'e', 'a', 't', 'u', 'r', 'e', 's', '\"', '\265', '\002', '\n', '\016', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', +'o', '\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', +'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', +'f', 'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', +'\010', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', +'\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', 'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', +'\001', 'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', +'t', 's', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', +'\022', '+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', +'(', '\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', +'e', 'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', 'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', +'\006', ' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', +'m', 'e', 'n', 't', 's', '*', '\014', '\010', '\200', '\354', '\312', '\377', '\001', '\020', '\201', '\354', '\312', '\377', '\001', '\"', '\320', '\002', '\n', '\021', 'G', +'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', +'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', +'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', +'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', +'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', +'\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', 's', 'o', 'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', +'\002', ' ', '\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', +'n', '\030', '\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022', '\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', +'(', '\005', 'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', +'2', '6', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', +'t', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', +'m', 'a', 'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', +'t', 'i', 'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007', '\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', +'\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002', '*', '\247', '\002', '\n', '\007', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\022', '\023', '\n', '\017', 'E', +'D', 'I', 'T', 'I', 'O', 'N', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', +'O', 'N', '_', 'L', 'E', 'G', 'A', 'C', 'Y', '\020', '\204', '\007', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'P', +'R', 'O', 'T', 'O', '2', '\020', '\346', '\007', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'P', 'R', 'O', 'T', 'O', +'3', '\020', '\347', '\007', '\022', '\021', '\n', '\014', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '0', '2', '3', '\020', '\350', '\007', '\022', '\021', +'\n', '\014', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '0', '2', '4', '\020', '\351', '\007', '\022', '\027', '\n', '\023', 'E', 'D', 'I', 'T', +'I', 'O', 'N', '_', '1', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\001', '\022', '\027', '\n', '\023', 'E', 'D', 'I', 'T', +'I', 'O', 'N', '_', '2', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\002', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', +'I', 'O', 'N', '_', '9', '9', '9', '9', '7', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\235', '\215', '\006', '\022', '\035', +'\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '8', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', +'\020', '\236', '\215', '\006', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '9', '_', 'T', 'E', 'S', +'T', '_', 'O', 'N', 'L', 'Y', '\020', '\237', '\215', '\006', '\022', '\023', '\n', '\013', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'M', 'A', 'X', +'\020', '\377', '\377', '\377', '\377', '\007', 'B', '~', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', +'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', +'-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', +'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', +'\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', +'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n', }; static _upb_DefPool_Init *deps[1] = { @@ -10904,7 +11600,7 @@ _upb_DefPool_Init google_protobuf_descriptor_proto_upbdefinit = { deps, &google_protobuf_descriptor_proto_upb_file_layout, "google/protobuf/descriptor.proto", - UPB_STRINGVIEW_INIT(descriptor, 12296) + UPB_STRINGVIEW_INIT(descriptor, 12559) }; /* @@ -11300,8 +11996,12 @@ uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed) { return Wyhash(p, n, seed, kWyhashSalt); } +// Returns a seed for upb's hash function. For now this is just a hard-coded +// constant, but we are going to randomize it soon. +static uint64_t _upb_Seed(void) { return 0x69835f69597ec1cc; } + static uint32_t _upb_Hash_NoSeed(const char* p, size_t n) { - return _upb_Hash(p, n, 0); + return _upb_Hash(p, n, _upb_Seed()); } static uint32_t strhash(upb_tabkey key) { @@ -11921,282 +12621,7 @@ int upb_Unicode_ToUTF8(uint32_t cp, char* out) { } -#include <stdlib.h> - - -// Must be last. - -typedef struct upb_UnknownFields upb_UnknownFields; - -typedef struct { - uint32_t tag; - union { - uint64_t varint; - uint64_t uint64; - uint32_t uint32; - upb_StringView delimited; - upb_UnknownFields* group; - } data; -} upb_UnknownField; - -struct upb_UnknownFields { - size_t size; - size_t capacity; - upb_UnknownField* fields; -}; - -typedef struct { - upb_EpsCopyInputStream stream; - upb_Arena* arena; - upb_UnknownField* tmp; - size_t tmp_size; - int depth; - upb_UnknownCompareResult status; - jmp_buf err; -} upb_UnknownField_Context; - -UPB_NORETURN static void upb_UnknownFields_OutOfMemory( - upb_UnknownField_Context* ctx) { - ctx->status = kUpb_UnknownCompareResult_OutOfMemory; - UPB_LONGJMP(ctx->err, 1); -} - -static void upb_UnknownFields_Grow(upb_UnknownField_Context* ctx, - upb_UnknownField** base, - upb_UnknownField** ptr, - upb_UnknownField** end) { - size_t old = (*ptr - *base); - size_t new = UPB_MAX(4, old * 2); - - *base = upb_Arena_Realloc(ctx->arena, *base, old * sizeof(**base), - new * sizeof(**base)); - if (!*base) upb_UnknownFields_OutOfMemory(ctx); - - *ptr = *base + old; - *end = *base + new; -} - -// We have to implement our own sort here, since qsort() is not an in-order -// sort. Here we use merge sort, the simplest in-order sort. -static void upb_UnknownFields_Merge(upb_UnknownField* arr, size_t start, - size_t mid, size_t end, - upb_UnknownField* tmp) { - memcpy(tmp, &arr[start], (end - start) * sizeof(*tmp)); - - upb_UnknownField* ptr1 = tmp; - upb_UnknownField* end1 = &tmp[mid - start]; - upb_UnknownField* ptr2 = &tmp[mid - start]; - upb_UnknownField* end2 = &tmp[end - start]; - upb_UnknownField* out = &arr[start]; - - while (ptr1 < end1 && ptr2 < end2) { - if (ptr1->tag <= ptr2->tag) { - *out++ = *ptr1++; - } else { - *out++ = *ptr2++; - } - } - - if (ptr1 < end1) { - memcpy(out, ptr1, (end1 - ptr1) * sizeof(*out)); - } else if (ptr2 < end2) { - memcpy(out, ptr1, (end2 - ptr2) * sizeof(*out)); - } -} - -static void upb_UnknownFields_SortRecursive(upb_UnknownField* arr, size_t start, - size_t end, upb_UnknownField* tmp) { - if (end - start > 1) { - size_t mid = start + ((end - start) / 2); - upb_UnknownFields_SortRecursive(arr, start, mid, tmp); - upb_UnknownFields_SortRecursive(arr, mid, end, tmp); - upb_UnknownFields_Merge(arr, start, mid, end, tmp); - } -} - -static void upb_UnknownFields_Sort(upb_UnknownField_Context* ctx, - upb_UnknownFields* fields) { - if (ctx->tmp_size < fields->size) { - const int oldsize = ctx->tmp_size * sizeof(*ctx->tmp); - ctx->tmp_size = UPB_MAX(8, ctx->tmp_size); - while (ctx->tmp_size < fields->size) ctx->tmp_size *= 2; - const int newsize = ctx->tmp_size * sizeof(*ctx->tmp); - ctx->tmp = upb_grealloc(ctx->tmp, oldsize, newsize); - } - upb_UnknownFields_SortRecursive(fields->fields, 0, fields->size, ctx->tmp); -} - -static upb_UnknownFields* upb_UnknownFields_DoBuild( - upb_UnknownField_Context* ctx, const char** buf) { - upb_UnknownField* arr_base = NULL; - upb_UnknownField* arr_ptr = NULL; - upb_UnknownField* arr_end = NULL; - const char* ptr = *buf; - uint32_t last_tag = 0; - bool sorted = true; - while (!upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr)) { - uint32_t tag; - ptr = upb_WireReader_ReadTag(ptr, &tag); - UPB_ASSERT(tag <= UINT32_MAX); - int wire_type = upb_WireReader_GetWireType(tag); - if (wire_type == kUpb_WireType_EndGroup) break; - if (tag < last_tag) sorted = false; - last_tag = tag; - - if (arr_ptr == arr_end) { - upb_UnknownFields_Grow(ctx, &arr_base, &arr_ptr, &arr_end); - } - upb_UnknownField* field = arr_ptr; - field->tag = tag; - arr_ptr++; - - switch (wire_type) { - case kUpb_WireType_Varint: - ptr = upb_WireReader_ReadVarint(ptr, &field->data.varint); - break; - case kUpb_WireType_64Bit: - ptr = upb_WireReader_ReadFixed64(ptr, &field->data.uint64); - break; - case kUpb_WireType_32Bit: - ptr = upb_WireReader_ReadFixed32(ptr, &field->data.uint32); - break; - case kUpb_WireType_Delimited: { - int size; - ptr = upb_WireReader_ReadSize(ptr, &size); - const char* s_ptr = ptr; - ptr = upb_EpsCopyInputStream_ReadStringAliased(&ctx->stream, &s_ptr, - size); - field->data.delimited.data = s_ptr; - field->data.delimited.size = size; - break; - } - case kUpb_WireType_StartGroup: - if (--ctx->depth == 0) { - ctx->status = kUpb_UnknownCompareResult_MaxDepthExceeded; - UPB_LONGJMP(ctx->err, 1); - } - field->data.group = upb_UnknownFields_DoBuild(ctx, &ptr); - ctx->depth++; - break; - default: - UPB_UNREACHABLE(); - } - } - - *buf = ptr; - upb_UnknownFields* ret = upb_Arena_Malloc(ctx->arena, sizeof(*ret)); - if (!ret) upb_UnknownFields_OutOfMemory(ctx); - ret->fields = arr_base; - ret->size = arr_ptr - arr_base; - ret->capacity = arr_end - arr_base; - if (!sorted) { - upb_UnknownFields_Sort(ctx, ret); - } - return ret; -} - -// Builds a upb_UnknownFields data structure from the binary data in buf. -static upb_UnknownFields* upb_UnknownFields_Build(upb_UnknownField_Context* ctx, - const char* ptr, - size_t size) { - upb_EpsCopyInputStream_Init(&ctx->stream, &ptr, size, true); - upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &ptr); - UPB_ASSERT(upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr) && - !upb_EpsCopyInputStream_IsError(&ctx->stream)); - return fields; -} - -// Compares two sorted upb_UnknownFields structures for equality. -static bool upb_UnknownFields_IsEqual(const upb_UnknownFields* uf1, - const upb_UnknownFields* uf2) { - if (uf1->size != uf2->size) return false; - for (size_t i = 0, n = uf1->size; i < n; i++) { - upb_UnknownField* f1 = &uf1->fields[i]; - upb_UnknownField* f2 = &uf2->fields[i]; - if (f1->tag != f2->tag) return false; - int wire_type = f1->tag & 7; - switch (wire_type) { - case kUpb_WireType_Varint: - if (f1->data.varint != f2->data.varint) return false; - break; - case kUpb_WireType_64Bit: - if (f1->data.uint64 != f2->data.uint64) return false; - break; - case kUpb_WireType_32Bit: - if (f1->data.uint32 != f2->data.uint32) return false; - break; - case kUpb_WireType_Delimited: - if (!upb_StringView_IsEqual(f1->data.delimited, f2->data.delimited)) { - return false; - } - break; - case kUpb_WireType_StartGroup: - if (!upb_UnknownFields_IsEqual(f1->data.group, f2->data.group)) { - return false; - } - break; - default: - UPB_UNREACHABLE(); - } - } - return true; -} - -static upb_UnknownCompareResult upb_UnknownField_DoCompare( - upb_UnknownField_Context* ctx, const char* buf1, size_t size1, - const char* buf2, size_t size2) { - upb_UnknownCompareResult ret; - // First build both unknown fields into a sorted data structure (similar - // to the UnknownFieldSet in C++). - upb_UnknownFields* uf1 = upb_UnknownFields_Build(ctx, buf1, size1); - upb_UnknownFields* uf2 = upb_UnknownFields_Build(ctx, buf2, size2); - - // Now perform the equality check on the sorted structures. - if (upb_UnknownFields_IsEqual(uf1, uf2)) { - ret = kUpb_UnknownCompareResult_Equal; - } else { - ret = kUpb_UnknownCompareResult_NotEqual; - } - return ret; -} - -static upb_UnknownCompareResult upb_UnknownField_Compare( - upb_UnknownField_Context* const ctx, const char* const buf1, - const size_t size1, const char* const buf2, const size_t size2) { - upb_UnknownCompareResult ret; - if (UPB_SETJMP(ctx->err) == 0) { - ret = upb_UnknownField_DoCompare(ctx, buf1, size1, buf2, size2); - } else { - ret = ctx->status; - UPB_ASSERT(ret != kUpb_UnknownCompareResult_Equal); - } - - upb_Arena_Free(ctx->arena); - upb_gfree(ctx->tmp); - return ret; -} - -upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - const char* buf1, size_t size1, const char* buf2, size_t size2, - int max_depth) { - if (size1 == 0 && size2 == 0) return kUpb_UnknownCompareResult_Equal; - if (size1 == 0 || size2 == 0) return kUpb_UnknownCompareResult_NotEqual; - if (memcmp(buf1, buf2, size1) == 0) return kUpb_UnknownCompareResult_Equal; - - upb_UnknownField_Context ctx = { - .arena = upb_Arena_New(), - .depth = max_depth, - .tmp = NULL, - .tmp_size = 0, - .status = kUpb_UnknownCompareResult_Equal, - }; - - if (!ctx.arena) return kUpb_UnknownCompareResult_OutOfMemory; - - return upb_UnknownField_Compare(&ctx, buf1, size1, buf2, size2); -} - - +#include <stdint.h> #include <string.h> @@ -12204,98 +12629,118 @@ upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( const struct upb_Message* msg, const upb_MiniTableExtension* e) { - size_t n; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &n); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return NULL; - // For now we use linear search exclusively to find extensions. - // If this becomes an issue due to messages with lots of extensions, - // we can introduce a table of some sort. - for (size_t i = 0; i < n; i++) { - if (ext[i].ext == e) { - return &ext[i]; + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + if (ext->ext == e) { + return ext; + } } } return NULL; } -const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)( - const struct upb_Message* msg, size_t* count) { - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - *count = (in->size - in->ext_begin) / sizeof(upb_Extension); - return UPB_PTR_AT(in, in->ext_begin, void); - } else { - *count = 0; - return NULL; - } -} - upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( struct upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* a) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e); if (ext) return ext; - if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(upb_Extension), a)) - return NULL; + + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, a)) return NULL; upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - in->ext_begin -= sizeof(upb_Extension); - ext = UPB_PTR_AT(in, in->ext_begin, void); + ext = upb_Arena_Malloc(a, sizeof(upb_Extension)); + if (!ext) return NULL; memset(ext, 0, sizeof(upb_Extension)); ext->ext = e; + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeExtension(ext); return ext; } +void upb_Message_ReplaceUnknownWithExtension(struct upb_Message* msg, + uintptr_t iter, + const upb_Extension* ext) { + UPB_ASSERT(iter != 0); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + UPB_ASSERT(in); + size_t index = iter - 1; + upb_TaggedAuxPtr tagged_ptr = in->aux_data[index]; + UPB_ASSERT(upb_TaggedAuxPtr_IsUnknown(tagged_ptr)); + in->aux_data[index] = upb_TaggedAuxPtr_MakeExtension(ext); +} #include <math.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> // Must be last. -const float kUpb_FltInfinity = (float)(1.0 / 0.0); -const double kUpb_Infinity = 1.0 / 0.0; -const double kUpb_NaN = 0.0 / 0.0; +// The latest win32 SDKs have an invalid definition of NAN. +// https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907 +// +// Unfortunately, the `0.0 / 0.0` workaround doesn't work in Clang under C23, so +// try __builtin_nan first, if that exists. +#ifdef _WIN32 +#ifdef __has_builtin +#if __has_builtin(__builtin_nan) +#define UPB_NAN __builtin_nan("0") +#endif +#if __has_builtin(__builtin_inf) +#define UPB_INFINITY __builtin_inf() +#endif +#endif +#ifndef UPB_NAN +#define UPB_NAN 0.0 / 0.0 +#endif +#ifndef UPB_INFINITY +#define UPB_INFINITY 1.0 / 0.0 +#endif +#else +// For !_WIN32, assume math.h works. +#define UPB_NAN NAN +#define UPB_INFINITY INFINITY +#endif -bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, - upb_Arena* a) { +const float kUpb_FltInfinity = UPB_INFINITY; +const double kUpb_Infinity = UPB_INFINITY; +const double kUpb_NaN = UPB_NAN; + +static size_t _upb_Message_SizeOfInternal(uint32_t count) { + return UPB_SIZEOF_FLEX(upb_Message_Internal, aux_data, count); +} + +bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, + upb_Arena* a) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); - const size_t overhead = sizeof(upb_Message_Internal); - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) { // No internal data, allocate from scratch. - size_t size = UPB_MAX(128, upb_Log2CeilingSize(need + overhead)); - in = upb_Arena_Malloc(a, size); + uint32_t capacity = 4; + in = upb_Arena_Malloc(a, _upb_Message_SizeOfInternal(capacity)); if (!in) return false; - - in->size = size; - in->unknown_end = overhead; - in->ext_begin = size; + in->size = 0; + in->capacity = capacity; UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); - } else if (in->ext_begin - in->unknown_end < need) { + } else if (in->capacity == in->size) { // Internal data is too small, reallocate. - size_t new_size = upb_Log2CeilingSize(in->size + need); - size_t ext_bytes = in->size - in->ext_begin; - size_t new_ext_begin = new_size - ext_bytes; - in = upb_Arena_Realloc(a, in, in->size, new_size); + uint32_t new_capacity = upb_RoundUpToPowerOfTwo(in->size + 1); + in = upb_Arena_Realloc(a, in, _upb_Message_SizeOfInternal(in->capacity), + _upb_Message_SizeOfInternal(new_capacity)); if (!in) return false; - - if (ext_bytes) { - // Need to move extension data to the end. - char* ptr = (char*)in; - memmove(ptr + new_ext_begin, ptr + in->ext_begin, ext_bytes); - } - in->ext_begin = new_ext_begin; - in->size = new_size; + in->capacity = new_capacity; UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); } - - UPB_ASSERT(in->ext_begin - in->unknown_end >= need); + UPB_ASSERT(in->capacity - in->size >= 1); return true; } -#if UPB_TRACING_ENABLED +#ifdef UPB_TRACING_ENABLED static void (*_message_trace_handler)(const upb_MiniTable*, const upb_Arena*); void upb_Message_LogNewMessage(const upb_MiniTable* m, const upb_Arena* arena) { @@ -12353,23 +12798,6 @@ bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg, return false; } -bool UPB_PRIVATE(_upb_Message_NextExtension)( - const upb_Message* msg, const upb_MiniTable* m, - const upb_MiniTableExtension** out_e, upb_MessageValue* out_v, - size_t* iter) { - size_t count; - const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - size_t i = *iter; - - if (++i < count) { - *out_e = exts[i].ext; - *out_v = exts[i].data; - *iter = i; - return true; - } - - return false; -} const char _kUpb_ToBase92[] = { ' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/', @@ -12952,9 +13380,15 @@ const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( return _upb_DefType_Unpack(v, UPB_DEFTYPE_FIELD); case UPB_DEFTYPE_MSG: { const upb_MessageDef* m = _upb_DefType_Unpack(v, UPB_DEFTYPE_MSG); - return _upb_MessageDef_InMessageSet(m) - ? upb_MessageDef_NestedExtension(m, 0) - : NULL; + if (_upb_MessageDef_InMessageSet(m)) { + for (int i = 0; i < upb_MessageDef_NestedExtensionCount(m); i++) { + const upb_FieldDef* ext = upb_MessageDef_NestedExtension(m, i); + if (upb_FieldDef_MessageSubDef(ext) == m) { + return ext; + } + } + } + return NULL; } default: break; @@ -14986,7 +15420,7 @@ bool upb_FileDef_Resolves(const upb_FileDef* f, const char* path) { return false; } -static char* strviewdup(upb_DefBuilder* ctx, upb_StringView view) { +static char* _strviewdup(upb_DefBuilder* ctx, upb_StringView view) { char* ret = upb_strdup2(view.data, view.size, _upb_DefBuilder_Arena(ctx)); if (!ret) _upb_DefBuilder_OomErr(ctx); return ret; @@ -15115,7 +15549,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, } upb_StringView name = UPB_DESC(FileDescriptorProto_name)(file_proto); - file->name = strviewdup(ctx, name); + file->name = _strviewdup(ctx, name); if (strlen(file->name) != name.size) { _upb_DefBuilder_Errf(ctx, "File name contained embedded NULL"); } @@ -15124,7 +15558,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, if (package.size) { _upb_DefBuilder_CheckIdentFull(ctx, package); - file->package = strviewdup(ctx, package); + file->package = _strviewdup(ctx, package); } else { file->package = NULL; } @@ -15258,9 +15692,16 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, } if (file->ext_count) { - bool ok = upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistryStatus status = upb_ExtensionRegistry_AddArray( _upb_DefPool_ExtReg(ctx->symtab), file->ext_layouts, file->ext_count); - if (!ok) _upb_DefBuilder_OomErr(ctx); + if (status != kUpb_ExtensionRegistryStatus_Ok) { + if (status == kUpb_ExtensionRegistryStatus_OutOfMemory) { + _upb_DefBuilder_OomErr(ctx); + } + + UPB_ASSERT(status == kUpb_ExtensionRegistryStatus_DuplicateEntry); + _upb_DefBuilder_Errf(ctx, "duplicate extension entry"); + } } } @@ -15597,7 +16038,7 @@ upb_StringView _upb_DefBuilder_MakeKey(upb_DefBuilder* ctx, upb_StringView key) { size_t need = key.size + sizeof(void*); if (ctx->tmp_buf_size < need) { - ctx->tmp_buf_size = UPB_MAX(64, upb_Log2Ceiling(need)); + ctx->tmp_buf_size = UPB_MAX(64, upb_RoundUpToPowerOfTwo(need)); ctx->tmp_buf = upb_Arena_Malloc(ctx->tmp_arena, ctx->tmp_buf_size); if (!ctx->tmp_buf) _upb_DefBuilder_OomErr(ctx); } @@ -15836,15 +16277,18 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, } if (ext_pool) { - // Return any extensions that are set. - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - if (i - n < count) { - ext += count - 1 - (i - n); - memcpy(out_val, &ext->data, sizeof(*out_val)); - *out_f = upb_DefPool_FindExtensionByMiniTable(ext_pool, ext->ext); - *iter = i; - return true; + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return false; + + for (; (i - n) < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i - n]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + memcpy(out_val, &ext->data, sizeof(*out_val)); + *out_f = upb_DefPool_FindExtensionByMiniTable(ext_pool, ext->ext); + *iter = i; + return true; + } } } @@ -15853,7 +16297,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, } bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, - int depth) { + const upb_DefPool* ext_pool, int depth) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); size_t iter = kUpb_Message_Begin; const upb_FieldDef* f; @@ -15864,7 +16308,7 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, _upb_Message_DiscardUnknown_shallow(msg); - while (upb_Message_Next(msg, m, NULL /*ext_pool*/, &f, &val, &iter)) { + while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { const upb_MessageDef* subm = upb_FieldDef_MessageSubDef(f); if (!subm) continue; if (upb_FieldDef_IsMap(f)) { @@ -15878,7 +16322,7 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, upb_MessageValue map_key, map_val; while (upb_Map_Next(map, &map_key, &map_val, &iter)) { if (!_upb_Message_DiscardUnknown((upb_Message*)map_val.msg_val, val_m, - depth)) { + ext_pool, depth)) { ret = false; } } @@ -15888,13 +16332,13 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, for (i = 0; i < n; i++) { upb_MessageValue elem = upb_Array_Get(arr, i); if (!_upb_Message_DiscardUnknown((upb_Message*)elem.msg_val, subm, - depth)) { + ext_pool, depth)) { ret = false; } } } else { if (!_upb_Message_DiscardUnknown((upb_Message*)val.msg_val, subm, - depth)) { + ext_pool, depth)) { ret = false; } } @@ -15904,8 +16348,8 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, } bool upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, - int maxdepth) { - return _upb_Message_DiscardUnknown(msg, m, maxdepth); + const upb_DefPool* ext_pool, int maxdepth) { + return _upb_Message_DiscardUnknown(msg, m, ext_pool, maxdepth); } @@ -17119,12 +17563,14 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_SIZE #undef UPB_PTR_AT +#undef UPB_SIZEOF_FLEX #undef UPB_MAPTYPE_STRING #undef UPB_EXPORT #undef UPB_INLINE #undef UPB_API #undef UPBC_API #undef UPB_API_INLINE +#undef UPB_API_INLINE_IF_NOT_GCC #undef UPB_ALIGN_UP #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC @@ -17133,6 +17579,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN @@ -17143,6 +17590,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASSUME #undef UPB_ASSERT #undef UPB_UNREACHABLE +#undef UPB_DEFAULT_MAX_BLOCK_SIZE #undef UPB_SETJMP #undef UPB_LONGJMP #undef UPB_PTRADD @@ -17156,6 +17604,12 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASAN #undef UPB_ASAN_GUARD_SIZE #undef UPB_CLANG_ASAN +#undef UPB_TSAN_PUBLISHED_MEMBER +#undef UPB_TSAN_INIT_PUBLISHED +#undef UPB_TSAN_CHECK_PUBLISHED +#undef UPB_TSAN_PUBLISH +#undef UPB_TSAN_CHECK_READ +#undef UPB_TSAN_CHECK_WRITE #undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN #undef UPB_DEPRECATED #undef UPB_GNUC_MIN @@ -17165,6 +17619,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_IS_GOOGLE3 #undef UPB_ATOMIC #undef UPB_USE_C11_ATOMICS +#undef UPB_USE_MSC_ATOMICS #undef UPB_PRIVATE #undef UPB_ONLYBITS #undef UPB_LINKARR_DECLARE @@ -17172,4 +17627,3 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_LINKARR_START #undef UPB_LINKARR_STOP #undef UPB_FUTURE_BREAKING_CHANGES -#undef UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT diff --git a/third_party/protobuf/php/ext/google/protobuf/php-upb.h b/third_party/protobuf/php/ext/google/protobuf/php-upb.h index fa4c27d3da7a9..6b82364bb92e5 100644 --- a/third_party/protobuf/php/ext/google/protobuf/php-upb.h +++ b/third_party/protobuf/php/ext/google/protobuf/php-upb.h @@ -23,9 +23,9 @@ */ #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(__cplusplus) && __cplusplus >= 201703L) || \ (defined(_MSC_VER) && _MSC_VER >= 1900)) -#error upb requires C99 or C++14 or MSVC >= 2015. +#error upb requires C99 or C++17 or MSVC >= 2015. #endif // Portable check for GCC minimum version: @@ -57,7 +57,14 @@ Error, UINTPTR_MAX is undefined /* If we always read/write as a consistent type to each address, this shouldn't * violate aliasing. */ -#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) +#define UPB_PTR_AT(msg, ofs, type) ((type *)((char *)(msg) + (ofs))) + +// A flexible array member may have lower alignment requirements than the struct +// overall - in that case, it can overlap with the trailing padding of the rest +// of the struct, and a naive sizeof(base) + sizeof(flex) * count calculation +// will not take into account that overlap, and allocate more than is required. +#define UPB_SIZEOF_FLEX(type, member, count) \ + UPB_MAX(sizeof(type), offsetof(type, member[count])) #define UPB_MAPTYPE_STRING 0 @@ -71,12 +78,19 @@ Error, UINTPTR_MAX is undefined // UPB_INLINE: inline if possible, emit standalone code if required. #ifdef __cplusplus #define UPB_INLINE inline -#elif defined (__GNUC__) || defined(__clang__) +#elif defined(__GNUC__) || defined(__clang__) #define UPB_INLINE static __inline__ #else #define UPB_INLINE static #endif +// UPB_INLINE_IF_NOT_GCC: because gcc can be very noisy at times. +#if defined(__GNUC__) && !defined(__clang__) +#define UPB_INLINE_IF_NOT_GCC static +#else +#define UPB_INLINE_IF_NOT_GCC UPB_INLINE +#endif + #ifdef UPB_BUILD_API #define UPB_API UPB_EXPORT #define UPB_API_INLINE UPB_EXPORT @@ -98,7 +112,13 @@ Error, UINTPTR_MAX is undefined #ifdef __clang__ #define UPB_ALIGN_OF(type) _Alignof(type) #else -#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) +#define UPB_ALIGN_OF(type) \ + offsetof( \ + struct { \ + char c; \ + type member; \ + }, \ + member) #endif #ifdef _MSC_VER @@ -109,7 +129,7 @@ Error, UINTPTR_MAX is undefined #endif // Hints to the compiler about likely/unlikely branches. -#if defined (__GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) #else @@ -117,18 +137,30 @@ Error, UINTPTR_MAX is undefined #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static #define UPB_NOINLINE __attribute__((noinline)) #define UPB_NORETURN __attribute__((__noreturn__)) -#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) +#define UPB_PRINTF(str, first_vararg) \ + __attribute__((format(printf, str, first_vararg))) #elif defined(_MSC_VER) #define UPB_NOINLINE #define UPB_FORCEINLINE static #define UPB_NORETURN __declspec(noreturn) #define UPB_PRINTF(str, first_vararg) -#else /* !defined(__GNUC__) */ +#else /* !defined(__GNUC__) */ #define UPB_FORCEINLINE static #define UPB_NOINLINE #define UPB_NORETURN @@ -143,11 +175,15 @@ Error, UINTPTR_MAX is undefined // UPB_ASSUME(): in release mode, we tell the compiler to assume this is true. #ifdef NDEBUG #ifdef __GNUC__ -#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() +#define UPB_ASSUME(expr) \ + if (!(expr)) __builtin_unreachable() #elif defined _MSC_VER -#define UPB_ASSUME(expr) if (!(expr)) __assume(0) +#define UPB_ASSUME(expr) \ + if (!(expr)) __assume(0) #else -#define UPB_ASSUME(expr) do {} while (false && (expr)) +#define UPB_ASSUME(expr) \ + do { \ + } while (false && (expr)) #endif #else #define UPB_ASSUME(expr) assert(expr) @@ -156,13 +192,19 @@ Error, UINTPTR_MAX is undefined /* UPB_ASSERT(): in release mode, we use the expression without letting it be * evaluated. This prevents "unused variable" warnings. */ #ifdef NDEBUG -#define UPB_ASSERT(expr) do {} while (false && (expr)) +#define UPB_ASSERT(expr) \ + do { \ + } while (false && (expr)) #else #define UPB_ASSERT(expr) assert(expr) #endif #if defined(__GNUC__) || defined(__clang__) -#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __builtin_unreachable(); \ + } while (0) #elif defined(_MSC_VER) #define UPB_UNREACHABLE() \ do { \ @@ -170,13 +212,26 @@ Error, UINTPTR_MAX is undefined __assume(0); \ } while (0) #else -#define UPB_UNREACHABLE() do { assert(0); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + } while (0) #endif -/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ -#ifdef __APPLE__ -#define UPB_SETJMP(buf) _setjmp(buf) -#define UPB_LONGJMP(buf, val) _longjmp(buf, val) +#ifdef __ANDROID__ +#define UPB_DEFAULT_MAX_BLOCK_SIZE 8192 +#else +#define UPB_DEFAULT_MAX_BLOCK_SIZE 32768 +#endif + +/* UPB_SETJMP() / UPB_LONGJMP() */ +// Android uses a custom libc that does not implement all of posix, but it has +// had sigsetjmp/siglongjmp forever on arm and since API 12 on x86. Apple has +// sigsetjmp, but does not define the posix feature test macro. +#if defined(__APPLE__) || defined(_POSIX_C_SOURCE) || defined(__ANDROID__) +// avoid setting/restoring signal mask, which involves costly syscalls +#define UPB_SETJMP(buf) sigsetjmp(buf, 0) +#define UPB_LONGJMP(buf, val) siglongjmp(buf, val) #elif defined(WASM_WAMR) #define UPB_SETJMP(buf) 0 #define UPB_LONGJMP(buf, val) abort() @@ -185,9 +240,23 @@ Error, UINTPTR_MAX is undefined #define UPB_LONGJMP(buf, val) longjmp(buf, val) #endif -#ifdef __GNUC__ +#if ((__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)) #define UPB_USE_C11_ATOMICS +#elif defined(__has_extension) +#if __has_extension(c_atomic) +#define UPB_USE_C11_ATOMICS +#endif +#elif defined(__GNUC__) +// GCC supported atomics as an extension before it supported __has_extension +#define UPB_USE_C11_ATOMICS +#elif defined(_MSC_VER) +#define UPB_USE_MSC_ATOMICS +#endif + +#if defined(UPB_USE_C11_ATOMICS) #define UPB_ATOMIC(T) _Atomic(T) +#elif defined(UPB_USE_MSC_ATOMICS) +#define UPB_ATOMIC(T) volatile T #else #define UPB_ATOMIC(T) T #endif @@ -275,7 +344,7 @@ Error, UINTPTR_MAX is undefined */ /* Due to preprocessor limitations, the conditional logic for setting - * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner. + * UPB_CLANG_ASAN below cannot be consolidated into a portable one-liner. * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html. */ #if defined(__has_feature) @@ -284,8 +353,14 @@ Error, UINTPTR_MAX is undefined #else #define UPB_CLANG_ASAN 0 #endif +#if __has_feature(thread_sanitizer) +#define UPB_CLANG_TSAN 1 +#else +#define UPB_CLANG_TSAN 0 +#endif #else #define UPB_CLANG_ASAN 0 +#define UPB_CLANG_TSAN 0 #endif #if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN @@ -294,10 +369,10 @@ Error, UINTPTR_MAX is undefined #ifdef __cplusplus extern "C" { #endif -void __asan_poison_memory_region(void const volatile *addr, size_t size); -void __asan_unpoison_memory_region(void const volatile *addr, size_t size); + void __asan_poison_memory_region(void const volatile *addr, size_t size); + void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #ifdef __cplusplus -} /* extern "C" */ +} /* extern "C" */ #endif #define UPB_POISON_MEMORY_REGION(addr, size) \ __asan_poison_memory_region((addr), (size)) @@ -306,10 +381,38 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #else #define UPB_ASAN 0 #define UPB_ASAN_GUARD_SIZE 0 -#define UPB_POISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) -#define UPB_UNPOISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) +#define UPB_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#define UPB_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#endif + +#if defined(__SANITIZE_THREAD__) || UPB_CLANG_TSAN +#define UPB_TSAN_PUBLISHED_MEMBER uintptr_t upb_tsan_safely_published; +#define UPB_TSAN_INIT_PUBLISHED(ptr) (ptr)->upb_tsan_safely_published = 0x5AFE +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + UPB_ASSERT((ptr)->upb_tsan_safely_published == 0x5AFE) +#define UPB_TSAN_PUBLISH 1 +#define UPB_TSAN_CHECK_READ(member) \ + __asm__ volatile("" ::"r"(*(char *)&(member))) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + char *write_upb_tsan_detect_race_ptr = (char *)&(member); \ + char write_upb_tsan_detect_race = *write_upb_tsan_detect_race_ptr; \ + __asm__ volatile("" : "+r"(write_upb_tsan_detect_race)); \ + *write_upb_tsan_detect_race_ptr = write_upb_tsan_detect_race; \ + } while (false) +#else +#define UPB_TSAN_PUBLISHED_MEMBER +#define UPB_TSAN_INIT_PUBLISHED(ptr) +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + do { \ + } while (false && (ptr)) +#define UPB_TSAN_PUBLISH 0 +#define UPB_TSAN_CHECK_READ(member) \ + do { \ + } while (false && (member)) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + } while (false && (member)) #endif /* Disable proto2 arena behavior (TEMPORARY) **********************************/ @@ -375,8 +478,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #if defined(__ELF__) || defined(__wasm__) -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("linkarr_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("linkarr_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name; \ extern type const __stop_linkarr_##name; \ @@ -387,8 +491,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #elif defined(__MACH__) /* As described in: https://stackoverflow.com/a/22366882 */ -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("__DATA,__la_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("__DATA,__la_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name __asm( \ "section$start$__DATA$__la_" #name); \ @@ -408,8 +513,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // Usage of __attribute__ here probably means this is Clang-specific, and would // not work on MSVC. -#define UPB_LINKARR_APPEND(name) \ - __declspec(allocate("la_" #name "$j")) __attribute__((retain, used)) +#define UPB_LINKARR_APPEND(name) \ + __declspec(allocate("la_" #name "$j")) \ + __attribute__((retain, used, no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ __declspec(allocate("la_" #name "$a")) type __start_linkarr_##name; \ __declspec(allocate("la_" #name "$z")) type __stop_linkarr_##name; \ @@ -430,10 +536,6 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // user code can be updated before upgrading versions of protobuf. #ifdef UPB_FUTURE_BREAKING_CHANGES -// Properly enforce closed enums in python. -// Owner: mkruskal@ -#define UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT 1 - #endif #ifndef UPB_BASE_STATUS_H_ @@ -486,7 +588,8 @@ void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, * to be freed. However the Arena does allow users to register cleanup * functions that will run when the arena is destroyed. * - * A upb_Arena is *not* thread-safe. + * A upb_Arena is *not* thread-safe, although some functions related to its + * managing its lifetime are, and are documented as such. * * You could write a thread-safe arena allocator that satisfies the * upb_alloc interface, but it would not be as efficient for the @@ -543,6 +646,11 @@ UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { alloc->func(alloc, ptr, 0, 0); } +UPB_INLINE void upb_free_sized(upb_alloc* alloc, void* ptr, size_t size) { + UPB_ASSERT(alloc); + alloc->func(alloc, ptr, size, 0); +} + // The global allocator used by upb. Uses the standard malloc()/free(). extern upb_alloc upb_alloc_global; @@ -583,7 +691,7 @@ UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } // // We need this because the decoder inlines a upb_Arena for performance but // the full struct is not visible outside of arena.c. Yes, I know, it's awful. -#define UPB_ARENA_SIZE_HACK 7 +#define UPB_ARENA_SIZE_HACK (9 + UPB_TSAN_PUBLISH) // LINT.IfChange(upb_Arena) @@ -603,16 +711,12 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(struct upb_Arena* des, void UPB_PRIVATE(_upb_Arena_SwapOut)(struct upb_Arena* des, const struct upb_Arena* src); -// Returns whether |ptr| was allocated directly by |a| (so care must be used -// with fused arenas). -UPB_API bool UPB_ONLYBITS(_upb_Arena_Contains)(const struct upb_Arena* a, - void* ptr); - UPB_INLINE size_t UPB_PRIVATE(_upb_ArenaHas)(const struct upb_Arena* a) { return (size_t)(a->UPB_ONLYBITS(end) - a->UPB_ONLYBITS(ptr)); } UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(struct upb_Arena * a, size_t size); size = UPB_ALIGN_MALLOC(size); @@ -634,6 +738,7 @@ UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) { UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr, size_t oldsize, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); oldsize = UPB_ALIGN_MALLOC(oldsize); size = UPB_ALIGN_MALLOC(size); bool is_most_recent_alloc = @@ -660,6 +765,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr, UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr, size_t oldsize, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); oldsize = UPB_ALIGN_MALLOC(oldsize); size = UPB_ALIGN_MALLOC(size); // Must be the last alloc. @@ -680,33 +786,67 @@ UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr, typedef struct upb_Arena upb_Arena; +typedef void upb_AllocCleanupFunc(upb_alloc* alloc); + #ifdef __cplusplus extern "C" { #endif -// Creates an arena from the given initial block (if any -- n may be 0). -// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this -// is a fixed-size arena and cannot grow. +// Creates an arena from the given initial block (if any -- mem may be NULL). If +// an initial block is specified, the arena's lifetime cannot be extended by +// |upb_Arena_IncRefFor| or |upb_Arena_Fuse|. Additional blocks will be +// allocated from |alloc|. If |alloc| is NULL, this is a fixed-size arena and +// cannot grow. If an initial block is specified, |n| is its length; if there is +// no initial block, |n| is a hint of the size that should be allocated for the +// first block of the arena, such that `upb_Arena_Malloc(hint)` will not require +// another call to |alloc|. UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc); UPB_API void upb_Arena_Free(upb_Arena* a); -UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); +// Sets the cleanup function for the upb_alloc used by the arena. Only one +// cleanup function can be set, which will be called after all blocks are +// freed. +UPB_API void upb_Arena_SetAllocCleanup(upb_Arena* a, + upb_AllocCleanupFunc* func); -bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner); -void upb_Arena_DecRefFor(upb_Arena* a, const void* owner); +// Fuses the lifetime of two arenas, such that no arenas that have been +// transitively fused together will be freed until all of them have reached a +// zero refcount. This operation is safe to use concurrently from multiple +// threads. +UPB_API bool upb_Arena_Fuse(const upb_Arena* a, const upb_Arena* b); -size_t upb_Arena_SpaceAllocated(upb_Arena* a, size_t* fused_count); -uint32_t upb_Arena_DebugRefCount(upb_Arena* a); +// This operation is safe to use concurrently from multiple threads. +UPB_API bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b); + +// Returns the upb_alloc used by the arena. +UPB_API upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a); + +// This operation is safe to use concurrently from multiple threads. +bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner); +// This operation is safe to use concurrently from multiple threads. +void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner); + +// This operation is safe to use concurrently from multiple threads. +uintptr_t upb_Arena_SpaceAllocated(const upb_Arena* a, size_t* fused_count); +// This operation is safe to use concurrently from multiple threads. +uint32_t upb_Arena_DebugRefCount(const upb_Arena* a); UPB_API_INLINE upb_Arena* upb_Arena_New(void) { return upb_Arena_Init(NULL, 0, &upb_alloc_global); } +UPB_API_INLINE upb_Arena* upb_Arena_NewSized(size_t size_hint) { + return upb_Arena_Init(NULL, size_hint, &upb_alloc_global); +} + UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size); UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, size_t size); +static const size_t UPB_PRIVATE(kUpbDefaultMaxBlockSize) = + UPB_DEFAULT_MAX_BLOCK_SIZE; + // Sets the maximum block size for all arenas. This is a global configuration // setting that will affect all existing and future arenas. If // upb_Arena_Malloc() is called with a size larger than this, we will exceed @@ -714,6 +854,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, // // This API is meant for experimentation only. It will likely be removed in // the future. +// This operation is safe to use concurrently from multiple threads. void upb_Arena_SetMaxBlockSize(size_t max); // Shrinks the last alloc from arena. @@ -752,18 +893,13 @@ extern "C" { // this invariant. #define kUpb_EpsCopyInputStream_SlopBytes 16 -enum { - kUpb_EpsCopyInputStream_NoAliasing = 0, - kUpb_EpsCopyInputStream_OnPatch = 1, - kUpb_EpsCopyInputStream_NoDelta = 2 -}; - typedef struct { const char* end; // Can read up to SlopBytes bytes beyond this. const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) - uintptr_t aliasing; + uintptr_t input_delta; // Diff between the original input pointer and patch int limit; // Submessage limit relative to end bool error; // To distinguish between EOF and error. + bool aliasing; char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; } upb_EpsCopyInputStream; @@ -789,17 +925,16 @@ UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, if (size <= kUpb_EpsCopyInputStream_SlopBytes) { memset(&e->patch, 0, 32); if (size) memcpy(&e->patch, *ptr, size); - e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch - : kUpb_EpsCopyInputStream_NoAliasing; + e->input_delta = (uintptr_t)*ptr - (uintptr_t)e->patch; *ptr = e->patch; e->end = *ptr + size; e->limit = 0; } else { e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; e->limit = kUpb_EpsCopyInputStream_SlopBytes; - e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta - : kUpb_EpsCopyInputStream_NoAliasing; + e->input_delta = 0; } + e->aliasing = enable_aliasing; e->limit_ptr = e->end; e->error = false; } @@ -942,7 +1077,7 @@ UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( // upb_EpsCopyInputStream_Init() when this stream was initialized. UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( upb_EpsCopyInputStream* e) { - return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; + return e->aliasing; } // Returns true if aliasing_enabled=true was passed to @@ -952,8 +1087,16 @@ UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( upb_EpsCopyInputStream* e, const char* ptr, size_t size) { // When EpsCopyInputStream supports streaming, this will need to become a // runtime check. - return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && - e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; + return e->aliasing && + upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size); +} + +// Returns a pointer into an input buffer that corresponds to the parsing +// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may +// be different if we are currently parsing out of the patch buffer. +UPB_INLINE const char* upb_EpsCopyInputStream_GetInputPtr( + upb_EpsCopyInputStream* e, const char* ptr) { + return (const char*)(((uintptr_t)ptr) + e->input_delta); } // Returns a pointer into an input buffer that corresponds to the parsing @@ -965,9 +1108,7 @@ UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( upb_EpsCopyInputStream* e, const char* ptr) { UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); - uintptr_t delta = - e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; - return (const char*)((uintptr_t)ptr + delta); + return upb_EpsCopyInputStream_GetInputPtr(e, ptr); } // Reads string data from the input, aliasing into the input buffer instead of @@ -1081,9 +1222,7 @@ UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( e->limit -= kUpb_EpsCopyInputStream_SlopBytes; e->limit_ptr = e->end + e->limit; UPB_ASSERT(ptr < e->limit_ptr); - if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { - e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; - } + e->input_delta = (uintptr_t)old_end - (uintptr_t)new_start; return callback(e, old_end, new_start); } else { UPB_ASSERT(overrun > e->limit); @@ -1142,36 +1281,7 @@ UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( #define UPB_MESSAGE_MESSAGE_H_ #include <stddef.h> - - -/* -** Our memory representation for parsing tables and messages themselves. -** Functions in this file are used by generated code and possibly reflection. -** -** The definitions in this file are internal to upb. -**/ - -#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_ -#define UPB_MESSAGE_INTERNAL_MESSAGE_H_ - -#include <stdlib.h> -#include <string.h> - - -#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ -#define UPB_MESSAGE_INTERNAL_EXTENSION_H_ - -#include <stddef.h> - - -// Users should include array.h or map.h instead. -// IWYU pragma: private, include "upb/message/array.h" - -#ifndef UPB_MESSAGE_VALUE_H_ -#define UPB_MESSAGE_VALUE_H_ - #include <stdint.h> -#include <string.h> #ifndef UPB_BASE_STRING_VIEW_H_ #define UPB_BASE_STRING_VIEW_H_ @@ -1212,6 +1322,16 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { return (a.size == b.size) && (!a.size || !memcmp(a.data, b.data, a.size)); } +// Compares StringViews following strcmp rules. +// Please note this comparison is neither unicode nor locale aware. +UPB_INLINE int upb_StringView_Compare(upb_StringView a, upb_StringView b) { + int result = memcmp(a.data, b.data, UPB_MIN(a.size, b.size)); + if (result == 0) { + return a.size - b.size; + } + return result; +} + // LINT.ThenChange( // GoogleInternalName1, // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string, @@ -1225,61 +1345,10 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { #endif /* UPB_BASE_STRING_VIEW_H_ */ -// Must be last. +#ifndef UPB_MESSAGE_ARRAY_H_ +#define UPB_MESSAGE_ARRAY_H_ -#ifdef __cplusplus -extern "C" { -#endif - -typedef union { - bool bool_val; - float float_val; - double double_val; - int32_t int32_val; - int64_t int64_val; - uint32_t uint32_val; - uint64_t uint64_val; - const struct upb_Array* array_val; - const struct upb_Map* map_val; - const struct upb_Message* msg_val; - upb_StringView str_val; - - // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of - // msg_val if unlinked sub-messages may possibly be in use. See the - // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more - // information. - uintptr_t tagged_msg_val; // upb_TaggedMessagePtr -} upb_MessageValue; - -UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) { - upb_MessageValue zero; - memset(&zero, 0, sizeof(zero)); - return zero; -} - -typedef union { - struct upb_Array* array; - struct upb_Map* map; - struct upb_Message* msg; -} upb_MutableMessageValue; - -UPB_API_INLINE upb_MutableMessageValue upb_MutableMessageValue_Zero(void) { - upb_MutableMessageValue zero; - memset(&zero, 0, sizeof(zero)); - return zero; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_VALUE_H_ */ - -#ifndef UPB_MINI_TABLE_EXTENSION_H_ -#define UPB_MINI_TABLE_EXTENSION_H_ - -#include <stdint.h> +#include <stddef.h> #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ @@ -1385,10 +1454,264 @@ UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType field_type) { #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ -#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ -#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ +#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_ +#define UPB_MESSAGE_INTERNAL_ARRAY_H_ + +#include <stdint.h> +#include <string.h> + + +// Must be last. + +#define _UPB_ARRAY_MASK_IMM 0x4 // Frozen/immutable bit. +#define _UPB_ARRAY_MASK_LG2 0x3 // Encoded elem size. +#define _UPB_ARRAY_MASK_ALL (_UPB_ARRAY_MASK_IMM | _UPB_ARRAY_MASK_LG2) + +#ifdef __cplusplus +extern "C" { +#endif + +// LINT.IfChange(upb_Array) + +// Our internal representation for repeated fields. +struct upb_Array { + // This is a tagged pointer. Bits #0 and #1 encode the elem size as follows: + // 0 maps to elem size 1 + // 1 maps to elem size 4 + // 2 maps to elem size 8 + // 3 maps to elem size 16 + // + // Bit #2 contains the frozen/immutable flag. + uintptr_t UPB_ONLYBITS(data); + + size_t UPB_ONLYBITS(size); // The number of elements in the array. + size_t UPB_PRIVATE(capacity); // Allocated storage. Measured in elements. +}; + +UPB_INLINE void UPB_PRIVATE(_upb_Array_ShallowFreeze)(struct upb_Array* arr) { + arr->UPB_ONLYBITS(data) |= _UPB_ARRAY_MASK_IMM; +} + +UPB_API_INLINE bool upb_Array_IsFrozen(const struct upb_Array* arr) { + return (arr->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_IMM) != 0; +} + +UPB_INLINE void UPB_PRIVATE(_upb_Array_SetTaggedPtr)(struct upb_Array* array, + void* data, size_t lg2) { + UPB_ASSERT(lg2 != 1); + UPB_ASSERT(lg2 <= 4); + const size_t bits = lg2 - (lg2 != 0); + array->UPB_ONLYBITS(data) = (uintptr_t)data | bits; +} + +UPB_INLINE size_t +UPB_PRIVATE(_upb_Array_ElemSizeLg2)(const struct upb_Array* array) { + const size_t bits = array->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_LG2; + const size_t lg2 = bits + (bits != 0); + return lg2; +} + +UPB_API_INLINE const void* upb_Array_DataPtr(const struct upb_Array* array) { + UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array); // Check assertions. + return (void*)(array->UPB_ONLYBITS(data) & ~(uintptr_t)_UPB_ARRAY_MASK_ALL); +} + +UPB_API_INLINE void* upb_Array_MutableDataPtr(struct upb_Array* array) { + return (void*)upb_Array_DataPtr(array); +} + +UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena, + size_t init_capacity, + int elem_size_lg2) { + UPB_ASSERT(elem_size_lg2 != 1); + UPB_ASSERT(elem_size_lg2 <= 4); + const size_t array_size = + UPB_ALIGN_UP(sizeof(struct upb_Array), UPB_MALLOC_ALIGN); + const size_t bytes = array_size + (init_capacity << elem_size_lg2); + struct upb_Array* array = (struct upb_Array*)upb_Arena_Malloc(arena, bytes); + if (!array) return NULL; + UPB_PRIVATE(_upb_Array_SetTaggedPtr) + (array, UPB_PTR_AT(array, array_size, void), elem_size_lg2); + array->UPB_ONLYBITS(size) = 0; + array->UPB_PRIVATE(capacity) = init_capacity; + return array; +} + +// Resizes the capacity of the array to be at least min_size. +bool UPB_PRIVATE(_upb_Array_Realloc)(struct upb_Array* array, size_t min_size, + upb_Arena* arena); + +UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size, + upb_Arena* arena) { + UPB_ASSERT(!upb_Array_IsFrozen(array)); + if (array->UPB_PRIVATE(capacity) < size) + return UPB_PRIVATE(_upb_Array_Realloc)(array, size, arena); + return true; +} + +// Resize without initializing new elements. +UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)( + struct upb_Array* array, size_t size, upb_Arena* arena) { + UPB_ASSERT(!upb_Array_IsFrozen(array)); + UPB_ASSERT(size <= array->UPB_ONLYBITS(size) || + arena); // Allow NULL arena when shrinking. + if (!upb_Array_Reserve(array, size, arena)) return false; + array->UPB_ONLYBITS(size) = size; + return true; +} + +// This function is intended for situations where elem_size is compile-time +// constant or a known expression of the form (1 << lg2), so that the expression +// i*elem_size does not result in an actual multiplication. +UPB_INLINE void UPB_PRIVATE(_upb_Array_Set)(struct upb_Array* array, size_t i, + const void* data, + size_t elem_size) { + UPB_ASSERT(!upb_Array_IsFrozen(array)); + UPB_ASSERT(i < array->UPB_ONLYBITS(size)); + UPB_ASSERT(elem_size == 1U << UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array)); + char* arr_data = (char*)upb_Array_MutableDataPtr(array); + memcpy(arr_data + (i * elem_size), data, elem_size); +} + +UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) { + return arr->UPB_ONLYBITS(size); +} + +// LINT.ThenChange(GoogleInternalName0) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#undef _UPB_ARRAY_MASK_IMM +#undef _UPB_ARRAY_MASK_LG2 +#undef _UPB_ARRAY_MASK_ALL + + +#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */ + +// Users should include array.h or map.h instead. +// IWYU pragma: private, include "upb/message/array.h" + +#ifndef UPB_MESSAGE_VALUE_H_ +#define UPB_MESSAGE_VALUE_H_ + +#include <stdint.h> +#include <string.h> + + +#ifndef UPB_MESSAGE_INTERNAL_TYPES_H_ +#define UPB_MESSAGE_INTERNAL_TYPES_H_ + +#include <stdint.h> + +// Must be last. + +#define UPB_OPAQUE(x) x##_opaque + +struct upb_Message { + union { + uintptr_t UPB_OPAQUE(internal); // tagged pointer, low bit == frozen + double d; // Forces same size for 32-bit/64-bit builds + }; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_INLINE void UPB_PRIVATE(_upb_Message_ShallowFreeze)( + struct upb_Message* msg) { + msg->UPB_OPAQUE(internal) |= 1ULL; +} + +UPB_API_INLINE bool upb_Message_IsFrozen(const struct upb_Message* msg) { + return (msg->UPB_OPAQUE(internal) & 1ULL) != 0; +} + +UPB_INLINE struct upb_Message_Internal* UPB_PRIVATE(_upb_Message_GetInternal)( + const struct upb_Message* msg) { + const uintptr_t tmp = msg->UPB_OPAQUE(internal) & ~1ULL; + return (struct upb_Message_Internal*)tmp; +} + +UPB_INLINE void UPB_PRIVATE(_upb_Message_SetInternal)( + struct upb_Message* msg, struct upb_Message_Internal* internal) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + msg->UPB_OPAQUE(internal) = (uintptr_t)internal; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#undef UPB_OPAQUE + + +#endif /* UPB_MESSAGE_INTERNAL_TYPES_H_ */ + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +typedef union { + bool bool_val; + float float_val; + double double_val; + int32_t int32_val; + int64_t int64_val; + uint32_t uint32_val; + uint64_t uint64_val; + const struct upb_Array* array_val; + const struct upb_Map* map_val; + const struct upb_Message* msg_val; + upb_StringView str_val; + + // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of + // msg_val if unlinked sub-messages may possibly be in use. See the + // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more + // information. + uintptr_t tagged_msg_val; // upb_TaggedMessagePtr + + // For an extension field, we are essentially treating ext->data (a + // upb_MessageValue) as if it were a message with one field that lives at + // offset 0. This works because upb_MessageValue is precisely one value that + // can hold any type of data. Recall that an extension can be of any type + // (scalar, repeated, or message). For a message extension, that will be a + // single upb_Message* at offset 0 of the upb_MessageValue. + struct upb_Message UPB_PRIVATE(ext_msg_val); +} upb_MessageValue; + +UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) { + upb_MessageValue zero; + memset(&zero, 0, sizeof(zero)); + return zero; +} + +typedef union { + struct upb_Array* array; + struct upb_Map* map; + struct upb_Message* msg; +} upb_MutableMessageValue; + +UPB_API_INLINE upb_MutableMessageValue upb_MutableMessageValue_Zero(void) { + upb_MutableMessageValue zero; + memset(&zero, 0, sizeof(zero)); + return zero; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_VALUE_H_ */ + +#ifndef UPB_MINI_TABLE_FIELD_H_ +#define UPB_MINI_TABLE_FIELD_H_ -#include <stddef.h> #include <stdint.h> @@ -1672,104 +1995,47 @@ UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_ElemSizeLg2)( #endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */ -#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ -#define UPB_MINI_TABLE_INTERNAL_SUB_H_ - // Must be last. -typedef union { - const struct upb_MiniTable* const* UPB_PRIVATE(submsg); - const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); -} upb_MiniTableSubInternal; - -union upb_MiniTableSub { - const struct upb_MiniTable* UPB_PRIVATE(submsg); - const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); -}; +typedef struct upb_MiniTableField upb_MiniTableField; #ifdef __cplusplus extern "C" { #endif -UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromEnum( - const struct upb_MiniTableEnum* subenum) { - union upb_MiniTableSub out; - out.UPB_PRIVATE(subenum) = subenum; - return out; -} +UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f); -UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromMessage( - const struct upb_MiniTable* submsg) { - union upb_MiniTableSub out; - out.UPB_PRIVATE(submsg) = submsg; - return out; -} +UPB_API_INLINE bool upb_MiniTableField_HasPresence(const upb_MiniTableField* f); -UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableSub_Enum( - const union upb_MiniTableSub sub) { - return sub.UPB_PRIVATE(subenum); -} +UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f); -UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableSub_Message( - const union upb_MiniTableSub sub) { - return sub.UPB_PRIVATE(submsg); -} +UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( + const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsExtension(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsSubMessage( + const upb_MiniTableField* f); + +UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f); + +UPB_API_INLINE upb_FieldType +upb_MiniTableField_Type(const upb_MiniTableField* f); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ - -// Must be last. - -struct upb_MiniTableExtension { - // Do not move this field. We need to be able to alias pointers. - struct upb_MiniTableField UPB_PRIVATE(field); - - const struct upb_MiniTable* UPB_PRIVATE(extendee); - union upb_MiniTableSub UPB_PRIVATE(sub); // NULL unless submsg or proto2 enum -}; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_API_INLINE upb_CType -upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) { - return upb_MiniTableField_CType(&e->UPB_PRIVATE(field)); -} - -UPB_API_INLINE uint32_t -upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) { - return e->UPB_PRIVATE(field).UPB_ONLYBITS(number); -} - -UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage( - const struct upb_MiniTableExtension* e) { - if (upb_MiniTableExtension_CType(e) != kUpb_CType_Message) { - return NULL; - } - return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub)); -} - -UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( - struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) { - e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m; -} - -UPB_INLINE upb_FieldRep UPB_PRIVATE(_upb_MiniTableExtension_GetRep)( - const struct upb_MiniTableExtension* e) { - return UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)); -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ +#endif /* UPB_MINI_TABLE_FIELD_H_ */ #ifndef UPB_MINI_TABLE_MESSAGE_H_ #define UPB_MINI_TABLE_MESSAGE_H_ @@ -1849,54 +2115,6 @@ UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e, #endif /* UPB_MINI_TABLE_ENUM_H_ */ -#ifndef UPB_MINI_TABLE_FIELD_H_ -#define UPB_MINI_TABLE_FIELD_H_ - -#include <stdint.h> - - -// Must be last. - -typedef struct upb_MiniTableField upb_MiniTableField; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_HasPresence(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( - const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsExtension(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsSubMessage( - const upb_MiniTableField* f); - -UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f); - -UPB_API_INLINE upb_FieldType -upb_MiniTableField_Type(const upb_MiniTableField* f); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MINI_TABLE_FIELD_H_ */ - #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ @@ -1904,6 +2122,56 @@ upb_MiniTableField_Type(const upb_MiniTableField* f); #include <stdint.h> +#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ +#define UPB_MINI_TABLE_INTERNAL_SUB_H_ + +// Must be last. + +typedef union { + const struct upb_MiniTable* const* UPB_PRIVATE(submsg); + const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); +} upb_MiniTableSubInternal; + +union upb_MiniTableSub { + const struct upb_MiniTable* UPB_PRIVATE(submsg); + const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); +}; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromEnum( + const struct upb_MiniTableEnum* subenum) { + union upb_MiniTableSub out; + out.UPB_PRIVATE(subenum) = subenum; + return out; +} + +UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromMessage( + const struct upb_MiniTable* submsg) { + union upb_MiniTableSub out; + out.UPB_PRIVATE(submsg) = submsg; + return out; +} + +UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableSub_Enum( + const union upb_MiniTableSub sub) { + return sub.UPB_PRIVATE(subenum); +} + +UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableSub_Message( + const union upb_MiniTableSub sub) { + return sub.UPB_PRIVATE(submsg); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ + // Must be last. struct upb_Decoder; @@ -2171,458 +2439,6 @@ bool upb_MiniTable_NextOneofField(const upb_MiniTable* m, // Must be last. -typedef struct upb_MiniTableExtension upb_MiniTableExtension; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_API_INLINE upb_CType -upb_MiniTableExtension_CType(const upb_MiniTableExtension* e); - -UPB_API_INLINE uint32_t -upb_MiniTableExtension_Number(const upb_MiniTableExtension* e); - -UPB_API_INLINE const upb_MiniTable* upb_MiniTableExtension_GetSubMessage( - const upb_MiniTableExtension* e); - -UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( - upb_MiniTableExtension* e, const upb_MiniTable* m); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MINI_TABLE_EXTENSION_H_ */ - -// Must be last. - -// The internal representation of an extension is self-describing: it contains -// enough information that we can serialize it to binary format without needing -// to look it up in a upb_ExtensionRegistry. -// -// This representation allocates 16 bytes to data on 64-bit platforms. -// This is rather wasteful for scalars (in the extreme case of bool, -// it wastes 15 bytes). We accept this because we expect messages to be -// the most common extension type. -typedef struct { - const upb_MiniTableExtension* ext; - upb_MessageValue data; -} upb_Extension; - -#ifdef __cplusplus -extern "C" { -#endif - -// Adds the given extension data to the given message. -// |ext| is copied into the message instance. -// This logically replaces any previously-added extension with this number. -upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( - struct upb_Message* msg, const upb_MiniTableExtension* ext, - upb_Arena* arena); - -// Returns an array of extensions for this message. -// Note: the array is ordered in reverse relative to the order of creation. -const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)( - const struct upb_Message* msg, size_t* count); - -// Returns an extension for a message with a given mini table, -// or NULL if no extension exists with this mini table. -const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( - const struct upb_Message* msg, const upb_MiniTableExtension* ext); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ - -// Must be last. - -#ifdef __cplusplus -extern "C" { -#endif - -extern const float kUpb_FltInfinity; -extern const double kUpb_Infinity; -extern const double kUpb_NaN; - -// Internal members of a upb_Message that track unknown fields and/or -// extensions. We can change this without breaking binary compatibility. - -typedef struct upb_Message_Internal { - // Total size of this structure, including the data that follows. - // Must be aligned to 8, which is alignof(upb_Extension) - uint32_t size; - - /* Offsets relative to the beginning of this structure. - * - * Unknown data grows forward from the beginning to unknown_end. - * Extension data grows backward from size to ext_begin. - * When the two meet, we're out of data and have to realloc. - * - * If we imagine that the final member of this struct is: - * char data[size - overhead]; // overhead = sizeof(upb_Message_Internal) - * - * Then we have: - * unknown data: data[0 .. (unknown_end - overhead)] - * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ - uint32_t unknown_end; - uint32_t ext_begin; - // Data follows, as if there were an array: - // char data[size - sizeof(upb_Message_Internal)]; -} upb_Message_Internal; - -#ifdef UPB_TRACING_ENABLED -UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, - const upb_Arena* arena); -UPB_API void upb_Message_SetNewMessageTraceHandler( - void (*handler)(const upb_MiniTable*, const upb_Arena*)); -#endif // UPB_TRACING_ENABLED - -// Inline version upb_Message_New(), for internal use. -UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m, - upb_Arena* a) { -#ifdef UPB_TRACING_ENABLED - upb_Message_LogNewMessage(m, a); -#endif // UPB_TRACING_ENABLED - - const int size = m->UPB_PRIVATE(size); - struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size); - if (UPB_UNLIKELY(!msg)) return NULL; - memset(msg, 0, size); - return msg; -} - -// Discards the unknown fields for this message only. -void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg); - -// Adds unknown data (serialized protobuf data) to the given message. -// The data is copied into the message instance. -bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg, - const char* data, size_t len, - upb_Arena* arena); - -bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, - upb_Arena* arena); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */ - -#ifndef UPB_MESSAGE_INTERNAL_TYPES_H_ -#define UPB_MESSAGE_INTERNAL_TYPES_H_ - -#include <stdint.h> - -// Must be last. - -#define UPB_OPAQUE(x) x##_opaque - -struct upb_Message { - union { - uintptr_t UPB_OPAQUE(internal); // tagged pointer, low bit == frozen - double d; // Forces same size for 32-bit/64-bit builds - }; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_INLINE void UPB_PRIVATE(_upb_Message_ShallowFreeze)( - struct upb_Message* msg) { - msg->UPB_OPAQUE(internal) |= 1ULL; -} - -UPB_API_INLINE bool upb_Message_IsFrozen(const struct upb_Message* msg) { - return (msg->UPB_OPAQUE(internal) & 1ULL) != 0; -} - -UPB_INLINE struct upb_Message_Internal* UPB_PRIVATE(_upb_Message_GetInternal)( - const struct upb_Message* msg) { - const uintptr_t tmp = msg->UPB_OPAQUE(internal) & ~1ULL; - return (struct upb_Message_Internal*)tmp; -} - -UPB_INLINE void UPB_PRIVATE(_upb_Message_SetInternal)( - struct upb_Message* msg, struct upb_Message_Internal* internal) { - UPB_ASSERT(!upb_Message_IsFrozen(msg)); - msg->UPB_OPAQUE(internal) = (uintptr_t)internal; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#undef UPB_OPAQUE - - -#endif /* UPB_MESSAGE_INTERNAL_TYPES_H_ */ - -// Must be last. - -typedef struct upb_Message upb_Message; - -#ifdef __cplusplus -extern "C" { -#endif - -// Creates a new message with the given mini_table on the given arena. -UPB_API upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* arena); - -// Returns a reference to the message's unknown data. -const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); - -// Removes partial unknown data from message. -void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); - -// Returns the number of extensions present in this message. -size_t upb_Message_ExtensionCount(const upb_Message* msg); - -// Mark a message and all of its descendents as frozen/immutable. -UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m); - -// Returns whether a message has been frozen. -UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg); - -#ifdef UPB_TRACING_ENABLED -UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, - const upb_Arena* arena); - -UPB_API void upb_Message_SetNewMessageTraceHandler( - void (*handler)(const upb_MiniTable* m, const upb_Arena* arena)); -#endif // UPB_TRACING_ENABLED - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_MESSAGE_H_ */ - -#ifndef UPB_REFLECTION_DEF_H_ -#define UPB_REFLECTION_DEF_H_ - -// IWYU pragma: begin_exports - -// IWYU pragma: private, include "upb/reflection/def.h" - -#ifndef UPB_REFLECTION_DEF_POOL_H_ -#define UPB_REFLECTION_DEF_POOL_H_ - - -// IWYU pragma: private, include "upb/reflection/def.h" - -// Declarations common to all public def types. - -#ifndef UPB_REFLECTION_COMMON_H_ -#define UPB_REFLECTION_COMMON_H_ - -#ifndef THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ -#define THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ - -// IWYU pragma: begin_exports - -#if defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 0 -// This header is checked in. -#elif UPB_BOOTSTRAP_STAGE == 1 -// This header is generated at build time by the bootstrapping process. -#else -// This is the normal header, generated by upb_c_proto_library(). -/* This file was generated by upb_generator from the input file: - * - * google/protobuf/descriptor.proto - * - * Do not edit -- your changes will be discarded when the file is - * regenerated. - * NO CHECKED-IN PROTOBUF GENCODE */ - -#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ -#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ - - -#ifndef UPB_GENERATED_CODE_SUPPORT_H_ -#define UPB_GENERATED_CODE_SUPPORT_H_ - -// IWYU pragma: begin_exports - -#ifndef UPB_BASE_UPCAST_H_ -#define UPB_BASE_UPCAST_H_ - -// Must be last. - -// This macro provides a way to upcast message pointers in a way that is -// somewhat more bulletproof than blindly casting a pointer. Example: -// -// typedef struct { -// upb_Message UPB_PRIVATE(base); -// } pkg_FooMessage; -// -// void f(pkg_FooMessage* msg) { -// upb_Decode(UPB_UPCAST(msg), ...); -// } - -#define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only) - - -#endif /* UPB_BASE_UPCAST_H_ */ - -#ifndef UPB_MESSAGE_ACCESSORS_H_ -#define UPB_MESSAGE_ACCESSORS_H_ - -#include <stdint.h> - - -#ifndef UPB_MESSAGE_ARRAY_H_ -#define UPB_MESSAGE_ARRAY_H_ - -#include <stddef.h> - - -#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_ -#define UPB_MESSAGE_INTERNAL_ARRAY_H_ - -#include <stdint.h> -#include <string.h> - - -// Must be last. - -#define _UPB_ARRAY_MASK_IMM 0x4 // Frozen/immutable bit. -#define _UPB_ARRAY_MASK_LG2 0x3 // Encoded elem size. -#define _UPB_ARRAY_MASK_ALL (_UPB_ARRAY_MASK_IMM | _UPB_ARRAY_MASK_LG2) - -#ifdef __cplusplus -extern "C" { -#endif - -// LINT.IfChange(upb_Array) - -// Our internal representation for repeated fields. -struct upb_Array { - // This is a tagged pointer. Bits #0 and #1 encode the elem size as follows: - // 0 maps to elem size 1 - // 1 maps to elem size 4 - // 2 maps to elem size 8 - // 3 maps to elem size 16 - // - // Bit #2 contains the frozen/immutable flag. - uintptr_t UPB_ONLYBITS(data); - - size_t UPB_ONLYBITS(size); // The number of elements in the array. - size_t UPB_PRIVATE(capacity); // Allocated storage. Measured in elements. -}; - -UPB_INLINE void UPB_PRIVATE(_upb_Array_ShallowFreeze)(struct upb_Array* arr) { - arr->UPB_ONLYBITS(data) |= _UPB_ARRAY_MASK_IMM; -} - -UPB_API_INLINE bool upb_Array_IsFrozen(const struct upb_Array* arr) { - return (arr->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_IMM) != 0; -} - -UPB_INLINE void UPB_PRIVATE(_upb_Array_SetTaggedPtr)(struct upb_Array* array, - void* data, size_t lg2) { - UPB_ASSERT(lg2 != 1); - UPB_ASSERT(lg2 <= 4); - const size_t bits = lg2 - (lg2 != 0); - array->UPB_ONLYBITS(data) = (uintptr_t)data | bits; -} - -UPB_INLINE size_t -UPB_PRIVATE(_upb_Array_ElemSizeLg2)(const struct upb_Array* array) { - const size_t bits = array->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_LG2; - const size_t lg2 = bits + (bits != 0); - return lg2; -} - -UPB_API_INLINE const void* upb_Array_DataPtr(const struct upb_Array* array) { - UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array); // Check assertions. - return (void*)(array->UPB_ONLYBITS(data) & ~(uintptr_t)_UPB_ARRAY_MASK_ALL); -} - -UPB_API_INLINE void* upb_Array_MutableDataPtr(struct upb_Array* array) { - return (void*)upb_Array_DataPtr(array); -} - -UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena, - size_t init_capacity, - int elem_size_lg2) { - UPB_ASSERT(elem_size_lg2 != 1); - UPB_ASSERT(elem_size_lg2 <= 4); - const size_t array_size = - UPB_ALIGN_UP(sizeof(struct upb_Array), UPB_MALLOC_ALIGN); - const size_t bytes = array_size + (init_capacity << elem_size_lg2); - struct upb_Array* array = (struct upb_Array*)upb_Arena_Malloc(arena, bytes); - if (!array) return NULL; - UPB_PRIVATE(_upb_Array_SetTaggedPtr) - (array, UPB_PTR_AT(array, array_size, void), elem_size_lg2); - array->UPB_ONLYBITS(size) = 0; - array->UPB_PRIVATE(capacity) = init_capacity; - return array; -} - -// Resizes the capacity of the array to be at least min_size. -bool UPB_PRIVATE(_upb_Array_Realloc)(struct upb_Array* array, size_t min_size, - upb_Arena* arena); - -UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size, - upb_Arena* arena) { - UPB_ASSERT(!upb_Array_IsFrozen(array)); - if (array->UPB_PRIVATE(capacity) < size) - return UPB_PRIVATE(_upb_Array_Realloc)(array, size, arena); - return true; -} - -// Resize without initializing new elements. -UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)( - struct upb_Array* array, size_t size, upb_Arena* arena) { - UPB_ASSERT(!upb_Array_IsFrozen(array)); - UPB_ASSERT(size <= array->UPB_ONLYBITS(size) || - arena); // Allow NULL arena when shrinking. - if (!upb_Array_Reserve(array, size, arena)) return false; - array->UPB_ONLYBITS(size) = size; - return true; -} - -// This function is intended for situations where elem_size is compile-time -// constant or a known expression of the form (1 << lg2), so that the expression -// i*elem_size does not result in an actual multiplication. -UPB_INLINE void UPB_PRIVATE(_upb_Array_Set)(struct upb_Array* array, size_t i, - const void* data, - size_t elem_size) { - UPB_ASSERT(!upb_Array_IsFrozen(array)); - UPB_ASSERT(i < array->UPB_ONLYBITS(size)); - UPB_ASSERT(elem_size == 1U << UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array)); - char* arr_data = (char*)upb_Array_MutableDataPtr(array); - memcpy(arr_data + (i * elem_size), data, elem_size); -} - -UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) { - return arr->UPB_ONLYBITS(size); -} - -// LINT.ThenChange(GoogleInternalName0) - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#undef _UPB_ARRAY_MASK_IMM -#undef _UPB_ARRAY_MASK_LG2 -#undef _UPB_ARRAY_MASK_ALL - - -#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */ - -// Must be last. - typedef struct upb_Array upb_Array; #ifdef __cplusplus @@ -2695,52 +2511,12 @@ UPB_API_INLINE bool upb_Array_IsFrozen(const upb_Array* arr); #endif /* UPB_MESSAGE_ARRAY_H_ */ -#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ -#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ +#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ +#define UPB_MESSAGE_INTERNAL_EXTENSION_H_ #include <stddef.h> -#include <stdint.h> -#include <string.h> -#ifndef UPB_BASE_INTERNAL_ENDIAN_H_ -#define UPB_BASE_INTERNAL_ENDIAN_H_ - -#include <stdint.h> - -// Must be last. - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_INLINE bool upb_IsLittleEndian(void) { - const int x = 1; - return *(char*)&x == 1; -} - -UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) { - if (upb_IsLittleEndian()) return val; - - return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | - ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); -} - -UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) { - if (upb_IsLittleEndian()) return val; - - const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32; - const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32)); - return hi | lo; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */ - #ifndef UPB_MESSAGE_INTERNAL_MAP_H_ #define UPB_MESSAGE_INTERNAL_MAP_H_ @@ -3123,14 +2899,13 @@ UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { } } -UPB_INLINE void* _upb_map_next(const struct upb_Map* map, size_t* iter) { +UPB_INLINE bool _upb_map_next(const struct upb_Map* map, size_t* iter) { upb_strtable_iter it; it.t = &map->table; it.index = *iter; upb_strtable_next(&it); *iter = it.index; - if (upb_strtable_done(&it)) return NULL; - return (void*)str_tabent(&it); + return !upb_strtable_done(&it); } UPB_INLINE void _upb_Map_Clear(struct upb_Map* map) { @@ -3201,6 +2976,578 @@ struct upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); #endif /* UPB_MESSAGE_INTERNAL_MAP_H_ */ +#ifndef UPB_MINI_TABLE_EXTENSION_H_ +#define UPB_MINI_TABLE_EXTENSION_H_ + +#include <stdint.h> + + +#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ +#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ + +#include <stddef.h> +#include <stdint.h> + + +// Must be last. + +struct upb_MiniTableExtension { + // Do not move this field. We need to be able to alias pointers. + struct upb_MiniTableField UPB_PRIVATE(field); + + const struct upb_MiniTable* UPB_PRIVATE(extendee); + union upb_MiniTableSub UPB_PRIVATE(sub); // NULL unless submsg or proto2 enum +}; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_API_INLINE upb_CType +upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) { + return upb_MiniTableField_CType(&e->UPB_PRIVATE(field)); +} + +UPB_API_INLINE uint32_t +upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) { + return e->UPB_PRIVATE(field).UPB_ONLYBITS(number); +} + +UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage( + const struct upb_MiniTableExtension* e) { + if (upb_MiniTableExtension_CType(e) != kUpb_CType_Message) { + return NULL; + } + return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub)); +} + +UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( + struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) { + e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m; +} + +UPB_INLINE upb_FieldRep UPB_PRIVATE(_upb_MiniTableExtension_GetRep)( + const struct upb_MiniTableExtension* e) { + return UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ + +// Must be last. + +typedef struct upb_MiniTableExtension upb_MiniTableExtension; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_API_INLINE upb_CType +upb_MiniTableExtension_CType(const upb_MiniTableExtension* e); + +UPB_API_INLINE uint32_t +upb_MiniTableExtension_Number(const upb_MiniTableExtension* e); + +UPB_API_INLINE const upb_MiniTable* upb_MiniTableExtension_GetSubMessage( + const upb_MiniTableExtension* e); + +UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( + upb_MiniTableExtension* e, const upb_MiniTable* m); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MINI_TABLE_EXTENSION_H_ */ + +// Must be last. + +// The internal representation of an extension is self-describing: it contains +// enough information that we can serialize it to binary format without needing +// to look it up in a upb_ExtensionRegistry. +// +// This representation allocates 16 bytes to data on 64-bit platforms. +// This is rather wasteful for scalars (in the extreme case of bool, +// it wastes 15 bytes). We accept this because we expect messages to be +// the most common extension type. +typedef struct { + const upb_MiniTableExtension* ext; + upb_MessageValue data; +} upb_Extension; + +#ifdef __cplusplus +extern "C" { +#endif + +// Adds the given extension data to the given message. +// |ext| is copied into the message instance. +// This logically replaces any previously-added extension with this number. +upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( + struct upb_Message* msg, const upb_MiniTableExtension* ext, + upb_Arena* arena); + +// Returns an extension for a message with a given mini table, +// or NULL if no extension exists with this mini table. +const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( + const struct upb_Message* msg, const upb_MiniTableExtension* ext); + +UPB_INLINE bool UPB_PRIVATE(_upb_Extension_IsEmpty)(const upb_Extension* ext) { + switch ( + UPB_PRIVATE(_upb_MiniTableField_Mode)(&ext->ext->UPB_PRIVATE(field))) { + case kUpb_FieldMode_Scalar: + return false; + case kUpb_FieldMode_Array: + return upb_Array_Size(ext->data.array_val) == 0; + case kUpb_FieldMode_Map: + return _upb_Map_Size(ext->data.map_val) == 0; + } + UPB_UNREACHABLE(); +} + +// Replaces the unknown field at iter with the provided extension. +void upb_Message_ReplaceUnknownWithExtension(struct upb_Message* msg, + uintptr_t iter, + const upb_Extension* ext); +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ + +/* +** Our memory representation for parsing tables and messages themselves. +** Functions in this file are used by generated code and possibly reflection. +** +** The definitions in this file are internal to upb. +**/ + +#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_ +#define UPB_MESSAGE_INTERNAL_MESSAGE_H_ + +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +extern const float kUpb_FltInfinity; +extern const double kUpb_Infinity; +extern const double kUpb_NaN; + +// Internal members of a upb_Message that track unknown fields and/or +// extensions. We can change this without breaking binary compatibility. + +typedef struct upb_TaggedAuxPtr { + uintptr_t ptr; +} upb_TaggedAuxPtr; + +UPB_INLINE bool upb_TaggedAuxPtr_IsNull(upb_TaggedAuxPtr ptr) { + return ptr.ptr == 0; +} + +UPB_INLINE bool upb_TaggedAuxPtr_IsExtension(upb_TaggedAuxPtr ptr) { + return ptr.ptr & 1; +} + +UPB_INLINE bool upb_TaggedAuxPtr_IsUnknown(upb_TaggedAuxPtr ptr) { + return (ptr.ptr != 0) && ((ptr.ptr & 1) == 0); +} + +UPB_INLINE upb_Extension* upb_TaggedAuxPtr_Extension(upb_TaggedAuxPtr ptr) { + UPB_ASSERT(upb_TaggedAuxPtr_IsExtension(ptr)); + return (upb_Extension*)(ptr.ptr & ~1ULL); +} + +UPB_INLINE upb_StringView* upb_TaggedAuxPtr_UnknownData(upb_TaggedAuxPtr ptr) { + UPB_ASSERT(!upb_TaggedAuxPtr_IsExtension(ptr)); + return (upb_StringView*)(ptr.ptr); +} + +UPB_INLINE upb_TaggedAuxPtr upb_TaggedAuxPtr_Null(void) { + upb_TaggedAuxPtr ptr; + ptr.ptr = 0; + return ptr; +} + +UPB_INLINE upb_TaggedAuxPtr +upb_TaggedAuxPtr_MakeExtension(const upb_Extension* e) { + upb_TaggedAuxPtr ptr; + ptr.ptr = (uintptr_t)e | 1; + return ptr; +} + +UPB_INLINE upb_TaggedAuxPtr +upb_TaggedAuxPtr_MakeUnknownData(const upb_StringView* sv) { + upb_TaggedAuxPtr ptr; + ptr.ptr = (uintptr_t)sv; + return ptr; +} + +typedef struct upb_Message_Internal { + // Total number of entries set in aux_data + uint32_t size; + uint32_t capacity; + // Tagged pointers to upb_StringView or upb_Extension + upb_TaggedAuxPtr aux_data[]; +} upb_Message_Internal; + +#ifdef UPB_TRACING_ENABLED +UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, + const upb_Arena* arena); +UPB_API void upb_Message_SetNewMessageTraceHandler( + void (*handler)(const upb_MiniTable*, const upb_Arena*)); +#endif // UPB_TRACING_ENABLED + +// Inline version upb_Message_New(), for internal use. +UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m, + upb_Arena* a) { +#ifdef UPB_TRACING_ENABLED + upb_Message_LogNewMessage(m, a); +#endif // UPB_TRACING_ENABLED + + const int size = m->UPB_PRIVATE(size); + struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size); + if (UPB_UNLIKELY(!msg)) return NULL; + memset(msg, 0, size); + return msg; +} + +// Discards the unknown fields for this message only. +void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg); + +// Adds unknown data (serialized protobuf data) to the given message. The data +// must represent one or more complete and well formed proto fields. +// If alias is set, will keep a view to the provided data; otherwise a copy is +// made. +bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg, + const char* data, size_t len, + upb_Arena* arena, bool alias); + +// Adds unknown data (serialized protobuf data) to the given message. +// The data is copied into the message instance. Data when concatenated together +// must represent one or more complete and well formed proto fields, but the +// individual spans may point only to partial fields. +bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg, + upb_Arena* arena, + upb_StringView data[], size_t count); + +// Ensures at least one slot is available in the aux_data of this message. +// Returns false if a reallocation is needed to satisfy the request, and fails. +bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, + upb_Arena* arena); + +#define kUpb_Message_UnknownBegin 0 +#define kUpb_Message_ExtensionBegin 0 + +UPB_INLINE bool upb_Message_NextUnknown(const struct upb_Message* msg, + upb_StringView* data, uintptr_t* iter) { + const upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + size_t i = *iter; + if (in) { + while (i < in->size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i++]; + if (upb_TaggedAuxPtr_IsUnknown(tagged_ptr)) { + *data = *upb_TaggedAuxPtr_UnknownData(tagged_ptr); + *iter = i; + return true; + } + } + } + data->size = 0; + data->data = NULL; + *iter = i; + return false; +} + +UPB_INLINE bool upb_Message_HasUnknown(const struct upb_Message* msg) { + upb_StringView data; + uintptr_t iter = kUpb_Message_UnknownBegin; + return upb_Message_NextUnknown(msg, &data, &iter); +} + +UPB_INLINE bool upb_Message_NextExtension(const struct upb_Message* msg, + const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, + uintptr_t* iter) { + const upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + uintptr_t i = *iter; + if (in) { + while (i < in->size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i++]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + + // Empty repeated fields or maps semantically don't exist. + if (UPB_PRIVATE(_upb_Extension_IsEmpty)(ext)) continue; + + *out_e = ext->ext; + *out_v = ext->data; + *iter = i; + return true; + } + } + } + *iter = i; + + return false; +} + +UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( + const struct upb_Message* msg, const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, uintptr_t* iter) { + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return false; + uintptr_t i = *iter; + uint32_t size = in->size; + while (i < size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[size - 1 - i]; + i++; + if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + continue; + } + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + + // Empty repeated fields or maps semantically don't exist. + if (UPB_PRIVATE(_upb_Extension_IsEmpty)(ext)) continue; + + *out_e = ext->ext; + *out_v = ext->data; + *iter = i; + return true; + } + *iter = i; + return false; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */ + +// Must be last. + +typedef struct upb_Message upb_Message; + +#ifdef __cplusplus +extern "C" { +#endif + +// Creates a new message with the given mini_table on the given arena. +UPB_API upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* arena); + +// +// Unknown data may be stored non-contiguously. Each segment stores a block of +// unknown fields. To iterate over segments: +// +// uintptr_t iter = kUpb_Message_UnknownBegin; +// upb_StringView data; +// while (upb_Message_NextUnknown(msg, &data, &iter)) { +// // Use data +// } +// Iterates in the order unknown fields were parsed. + +#define kUpb_Message_UnknownBegin 0 +#define kUpb_Message_ExtensionBegin 0 + +UPB_INLINE bool upb_Message_NextUnknown(const upb_Message* msg, + upb_StringView* data, uintptr_t* iter); + +UPB_INLINE bool upb_Message_HasUnknown(const upb_Message* msg); + +// Returns a reference to the message's unknown data. +const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); + +// Removes a segment of unknown data from the message, advancing to the next +// segment. Returns false if the removed segment was at the end of the last +// chunk. +// +// This must be done while iterating: +// +// uintptr_t iter = kUpb_Message_UnknownBegin; +// upb_StringView data; +// // Iterate chunks +// while (upb_Message_NextUnknown(msg, &data, &iter)) { +// // Iterate within a chunk, deleting ranges +// while (ShouldDeleteSubSegment(&data)) { +// // Data now points to the region to be deleted +// if (!upb_Message_DeleteUnknown(msg, &data, &iter)) return; +// // If DeleteUnknown returned true, then data now points to the +// // remaining unknown fields after the region that was just deleted. +// } +// } +// +// The range given in `data` must be contained inside the most recently +// returned region. +bool upb_Message_DeleteUnknown(upb_Message* msg, upb_StringView* data, + uintptr_t* iter); + +// Returns the number of extensions present in this message. +size_t upb_Message_ExtensionCount(const upb_Message* msg); + +// Iterates extensions in wire order +UPB_INLINE bool upb_Message_NextExtension(const upb_Message* msg, + const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, + uintptr_t* iter); + +// Iterates extensions in reverse wire order +UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( + const struct upb_Message* msg, const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, uintptr_t* iter); + +// Mark a message and all of its descendents as frozen/immutable. +UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m); + +// Returns whether a message has been frozen. +UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg); + +#ifdef UPB_TRACING_ENABLED +UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, + const upb_Arena* arena); + +UPB_API void upb_Message_SetNewMessageTraceHandler( + void (*handler)(const upb_MiniTable* m, const upb_Arena* arena)); +#endif // UPB_TRACING_ENABLED + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_MESSAGE_H_ */ + +#ifndef UPB_REFLECTION_DEF_H_ +#define UPB_REFLECTION_DEF_H_ + +// IWYU pragma: begin_exports + +// IWYU pragma: private, include "upb/reflection/def.h" + +#ifndef UPB_REFLECTION_DEF_POOL_H_ +#define UPB_REFLECTION_DEF_POOL_H_ + + +// IWYU pragma: private, include "upb/reflection/def.h" + +// Declarations common to all public def types. + +#ifndef UPB_REFLECTION_COMMON_H_ +#define UPB_REFLECTION_COMMON_H_ + +#ifndef THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ +#define THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ + +// IWYU pragma: begin_exports + +#if defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 0 +// This header is checked in. +#elif defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 1 +// This header is generated at build time by the bootstrapping process. +#else +// This is the normal header, generated by upb_c_proto_library(). +/* This file was generated by upb_generator from the input file: + * + * google/protobuf/descriptor.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. + * NO CHECKED-IN PROTOBUF GENCODE */ + +#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ +#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ + + +#ifndef UPB_GENERATED_CODE_SUPPORT_H_ +#define UPB_GENERATED_CODE_SUPPORT_H_ + +// IWYU pragma: begin_exports + +#ifndef UPB_BASE_UPCAST_H_ +#define UPB_BASE_UPCAST_H_ + +// Must be last. + +// This macro provides a way to upcast message pointers in a way that is +// somewhat more bulletproof than blindly casting a pointer. Example: +// +// typedef struct { +// upb_Message UPB_PRIVATE(base); +// } pkg_FooMessage; +// +// void f(pkg_FooMessage* msg) { +// upb_Decode(UPB_UPCAST(msg), ...); +// } + +#define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only) + + +#endif /* UPB_BASE_UPCAST_H_ */ + +#ifndef UPB_MESSAGE_ACCESSORS_H_ +#define UPB_MESSAGE_ACCESSORS_H_ + +#include <stdint.h> + + +#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ +#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ + +#include <stddef.h> +#include <stdint.h> +#include <string.h> + + +#ifndef UPB_BASE_INTERNAL_ENDIAN_H_ +#define UPB_BASE_INTERNAL_ENDIAN_H_ + +#include <stdint.h> + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_INLINE bool upb_IsLittleEndian(void) { + const int x = 1; + return *(char*)&x == 1; +} + +UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) { + if (upb_IsLittleEndian()) return val; + + return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | + ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); +} + +UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) { + if (upb_IsLittleEndian()) return val; + + const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32; + const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32)); + return hi | lo; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */ + #ifndef UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ #define UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ @@ -3381,7 +3728,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)( } } -UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( +UPB_INLINE_IF_NOT_GCC void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( const upb_MiniTableField* f, void* to, const void* from) { switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) { case kUpb_FieldRep_1Byte: @@ -3401,7 +3748,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( UPB_UNREACHABLE(); } -UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)( +UPB_INLINE_IF_NOT_GCC bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)( const upb_MiniTableField* f, const void* a, const void* b) { switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) { case kUpb_FieldRep_1Byte: @@ -4074,9 +4421,7 @@ UPB_API_INLINE void upb_Message_Clear(struct upb_Message* msg, memset(msg, 0, m->UPB_PRIVATE(size)); if (in) { // Reset the internal buffer to empty. - in->unknown_end = sizeof(upb_Message_Internal); - in->ext_begin = in->size; - UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); + in->size = 0; } } @@ -4100,11 +4445,15 @@ UPB_API_INLINE void upb_Message_ClearExtension( UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) return; - const upb_Extension* base = UPB_PTR_AT(in, in->ext_begin, upb_Extension); - upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e); - if (ext) { - *ext = *base; - in->ext_begin += sizeof(upb_Extension); + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + if (ext->ext == e) { + in->aux_data[i] = upb_TaggedAuxPtr_Null(); + return; + } + } } } @@ -4134,6 +4483,133 @@ UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( return upb_Array_MutableDataPtr(arr); } +UPB_API_INLINE bool upb_Message_GetExtensionBool( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + bool default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Bool); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_1Byte); + bool ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE double upb_Message_GetExtensionDouble( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + double default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Double); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + double ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE float upb_Message_GetExtensionFloat( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + float default_val) { + float ret; + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Float); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE int32_t upb_Message_GetExtensionInt32( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + int32_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int32 || + upb_MiniTableExtension_CType(e) == kUpb_CType_Enum); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + int32_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE int64_t upb_Message_GetExtensionInt64( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + int64_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int64); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + int64_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + uint32_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt32); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + uint32_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + uint64_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt64); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + uint64_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE upb_StringView upb_Message_GetExtensionString( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + upb_StringView default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_String || + upb_MiniTableExtension_CType(e) == kUpb_CType_Bytes); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_StringView); + upb_StringView ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE struct upb_Message* upb_Message_GetExtensionMessage( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + struct upb_Message* default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Message); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); + struct upb_Message* ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +// Repeated +UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray( + const struct upb_Message* msg, const upb_MiniTableExtension* e) { + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) == + kUpb_FieldRep_NativePointer); + UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field))); + UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0); + upb_Array* ret; + const upb_Array* default_val = NULL; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray( + struct upb_Message* msg, const upb_MiniTableExtension* e) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) == + kUpb_FieldRep_NativePointer); + UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field))); + UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0); + upb_Array* ret; + upb_Array* default_val = NULL; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + #ifdef __cplusplus } /* extern "C" */ #endif @@ -4437,6 +4913,47 @@ UPB_API_INLINE void upb_Message_SetBaseFieldUInt64(struct upb_Message* msg, const upb_MiniTableField* f, uint64_t value); +// Extension Getters /////////////////////////////////////////////////////////// +UPB_API_INLINE bool upb_Message_GetExtensionBool( + const upb_Message* msg, const upb_MiniTableExtension* f, bool default_val); + +UPB_API_INLINE double upb_Message_GetExtensionDouble( + const upb_Message* msg, const upb_MiniTableExtension* f, + double default_val); + +UPB_API_INLINE float upb_Message_GetExtensionFloat( + const upb_Message* msg, const upb_MiniTableExtension* f, float default_val); + +UPB_API_INLINE int32_t upb_Message_GetExtensionInt32( + const upb_Message* msg, const upb_MiniTableExtension* f, + int32_t default_val); + +UPB_API_INLINE int64_t upb_Message_GetExtensionInt64( + const upb_Message* msg, const upb_MiniTableExtension* f, + int64_t default_val); + +UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32( + const upb_Message* msg, const upb_MiniTableExtension* f, + uint32_t default_val); + +UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64( + const upb_Message* msg, const upb_MiniTableExtension* f, + uint64_t default_val); + +UPB_API_INLINE upb_StringView upb_Message_GetExtensionString( + const upb_Message* msg, const upb_MiniTableExtension* f, + upb_StringView default_val); + +UPB_API_INLINE upb_Message* upb_Message_GetExtensionMessage( + const upb_Message* msg, const upb_MiniTableExtension* f, + struct upb_Message* default_val); + +UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray( + const upb_Message* msg, const upb_MiniTableExtension* f); + +UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray( + upb_Message* msg, const upb_MiniTableExtension* f); + // Extension Setters /////////////////////////////////////////////////////////// UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg, @@ -4803,10 +5320,11 @@ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( } // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so -// it can be reused from call to call, avoiding repeated realloc()/free(). +// it can be reused from call to call, avoiding repeated +// upb_grealloc()/upb_gfree(). // -// The caller owns `*buf` both before and after the call, and must free() it -// when it is no longer in use. The function will realloc() `*buf` as +// The caller owns `*buf` both before and after the call, and must upb_gfree() +// it when it is no longer in use. The function will upb_grealloc() `*buf` as // necessary, updating `*size` accordingly. upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, upb_MiniTablePlatform platform, @@ -4823,6 +5341,9 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ +#include <stddef.h> +#include <stdint.h> + // Must be last. @@ -4866,21 +5387,25 @@ extern "C" { typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; +typedef enum { + kUpb_ExtensionRegistryStatus_Ok = 0, + kUpb_ExtensionRegistryStatus_DuplicateEntry = 1, + kUpb_ExtensionRegistryStatus_OutOfMemory = 2, +} upb_ExtensionRegistryStatus; + // Creates a upb_ExtensionRegistry in the given arena. // The arena must outlive any use of the extreg. UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); -UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, - const upb_MiniTableExtension* e); +UPB_API upb_ExtensionRegistryStatus upb_ExtensionRegistry_Add( + upb_ExtensionRegistry* r, const upb_MiniTableExtension* e); // Adds the given extension info for the array |e| of size |count| into the // registry. If there are any errors, the entire array is backed out. // The extensions must outlive the registry. // Possible errors include OOM or an extension number that already exists. -// TODO: There is currently no way to know the exact reason for failure. -bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, - const upb_MiniTableExtension** e, - size_t count); +upb_ExtensionRegistryStatus upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistry* r, const upb_MiniTableExtension** e, size_t count); #ifdef UPB_LINKARR_DECLARE @@ -5019,8 +5544,8 @@ extern "C" { #endif enum { - /* If set, strings will alias the input buffer instead of copying into the - * arena. */ + /* If set, strings and unknown fields will alias the input buffer instead of + * copying into the arena. */ kUpb_DecodeOption_AliasString = 1, /* If set, the parse will return failure if any message is missing any @@ -5096,6 +5621,8 @@ UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { return options >> 16; } +uint16_t upb_DecodeOptions_GetEffectiveMaxDepth(uint32_t options); + // Enforce an upper bound on recursion depth. UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) { uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); @@ -5196,6 +5723,8 @@ UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { return options >> 16; } +uint16_t upb_EncodeOptions_GetEffectiveMaxDepth(uint32_t options); + // Enforce an upper bound on recursion depth. UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); @@ -5452,6 +5981,7 @@ extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_ extern const upb_MiniTableEnum google__protobuf__Edition_enum_init; extern const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationState_enum_init; +extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__FieldPresence_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__JsonFormat_enum_init; @@ -5537,6 +6067,12 @@ typedef enum { google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 } google_protobuf_ExtensionRangeOptions_VerificationState; +typedef enum { + google_protobuf_FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + google_protobuf_FeatureSet_STYLE2024 = 1, + google_protobuf_FeatureSet_STYLE_LEGACY = 2 +} google_protobuf_FeatureSet_EnforceNamingStyle; + typedef enum { google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, google_protobuf_FeatureSet_OPEN = 1, @@ -5826,11 +6362,11 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_pro return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -5841,7 +6377,7 @@ UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -5849,7 +6385,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_ return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -5858,11 +6394,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_up return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5874,7 +6410,7 @@ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDes } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5883,7 +6419,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_up return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5893,11 +6429,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_ return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5909,7 +6445,7 @@ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_Fil } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5918,7 +6454,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5928,11 +6464,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5944,7 +6480,7 @@ UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_ } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5953,7 +6489,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_arr return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5963,11 +6499,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_a return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5979,7 +6515,7 @@ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_Fi } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5988,7 +6524,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5998,45 +6534,45 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_FileOptions* default_val = NULL; const google_protobuf_FileOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_SourceCodeInfo* default_val = NULL; const google_protobuf_SourceCodeInfo* ret; - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6047,7 +6583,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6055,7 +6591,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependen return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6064,11 +6600,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mut return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6079,7 +6615,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(co } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6087,7 +6623,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6096,19 +6632,19 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutab return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { @@ -6137,7 +6673,7 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_ upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6148,12 +6684,12 @@ UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependenc } } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6165,7 +6701,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protob return true; } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6177,12 +6713,12 @@ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto } } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6197,7 +6733,7 @@ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescripto return sub; } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6209,12 +6745,12 @@ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorP } } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6229,7 +6765,7 @@ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescr return sub; } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6241,12 +6777,12 @@ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescript } } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6261,7 +6797,7 @@ UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDe return sub; } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6273,12 +6809,12 @@ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptor } } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6293,7 +6829,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -6306,7 +6842,7 @@ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorPro return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -6319,7 +6855,7 @@ UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptor return sub; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6330,12 +6866,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependenc } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6347,7 +6883,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google return true; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6358,12 +6894,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency( } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6375,7 +6911,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p return true; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) { @@ -7461,67 +7997,67 @@ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(con return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } @@ -7530,19 +8066,19 @@ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(goo upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -7583,35 +8119,35 @@ UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_ return ptr; } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { @@ -7663,52 +8199,52 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) { const google_protobuf_FieldOptions* default_val = NULL; const google_protobuf_FieldOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) { @@ -7728,44 +8264,44 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { @@ -7781,15 +8317,15 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_Fi upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -7806,11 +8342,11 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -8562,51 +9098,51 @@ UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google return ptr; } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { @@ -8627,48 +9163,48 @@ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_p return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { @@ -8685,11 +9221,11 @@ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescripto return sub; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -8762,35 +9298,35 @@ UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) { int32_t default_val = 1; int32_t ret; - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) { @@ -8810,115 +9346,115 @@ UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) { bool default_val = true; bool ret; - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) { @@ -9095,11 +9631,11 @@ UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -9107,31 +9643,31 @@ UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileO upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -9480,67 +10016,67 @@ UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf return ptr; } UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { @@ -9560,75 +10096,75 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_Fi return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -9639,7 +10175,7 @@ UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -9647,7 +10183,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(cons return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -9656,11 +10192,11 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(go return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9672,7 +10208,7 @@ UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -9681,7 +10217,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -9691,45 +10227,45 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { const google_protobuf_FeatureSet* default_val = NULL; const google_protobuf_FeatureSet* ret; - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_feature_support(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_feature_support(const google_protobuf_FieldOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_feature_support(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9741,7 +10277,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Fie } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -9750,7 +10286,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_u return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -9761,19 +10297,19 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable } UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { @@ -9781,23 +10317,23 @@ UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOpt upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -9808,12 +10344,12 @@ UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf } } UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -9825,7 +10361,7 @@ UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOp return true; } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9837,12 +10373,12 @@ UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOp } } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -9857,7 +10393,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_F return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -9870,7 +10406,7 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutab return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_feature_support(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -9883,7 +10419,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_F return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9895,12 +10431,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -10511,44 +11047,44 @@ UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_feature_support(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_EnumValueOptions_feature_support(const google_protobuf_EnumValueOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_feature_support(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -10560,7 +11096,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Enu } } UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -10569,7 +11105,7 @@ UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_opti return arr; } UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -10597,11 +11133,11 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_m return sub; } UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_EnumValueOptions_set_feature_support(google_protobuf_EnumValueOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -10614,7 +11150,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_E return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -10626,12 +11162,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOption } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -11013,11 +11549,11 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_p return ptr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -11029,7 +11565,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_pro } } UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -11038,7 +11574,7 @@ UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array( return arr; } UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -11048,104 +11584,104 @@ UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_arra return arr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) { uint64_t default_val = (uint64_t)0ull; uint64_t ret; - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) { int64_t default_val = (int64_t)0ll; int64_t ret; - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) { double default_val = 0; double ret; - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -11157,12 +11693,12 @@ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_Uninte } } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -11177,27 +11713,27 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_ return sub; } UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -11411,6 +11947,22 @@ UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } +UPB_INLINE void google_protobuf_FeatureSet_clear_enforce_naming_style(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); +} +UPB_INLINE int32_t google_protobuf_FeatureSet_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, + &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); +} UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; @@ -11436,6 +11988,10 @@ UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_Featu const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } +UPB_INLINE void google_protobuf_FeatureSet_set_enforce_naming_style(google_protobuf_FeatureSet *msg, int32_t value) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_SetBaseField((upb_Message *)msg, &field, &value); +} /* google.protobuf.FeatureSetDefaults */ @@ -11842,11 +12398,11 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const goog return ptr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -11857,7 +12413,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -11865,7 +12421,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -11874,11 +12430,11 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -11889,7 +12445,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -11897,7 +12453,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -11906,35 +12462,35 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) { @@ -11971,7 +12527,7 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_ } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -11982,12 +12538,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -11999,7 +12555,7 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf return true; } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -12010,12 +12566,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -12027,11 +12583,11 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf return true; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { @@ -12205,11 +12761,11 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const return ptr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -12220,7 +12776,7 @@ UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(cons } } UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -12228,7 +12784,7 @@ UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_u return arr; } UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -12237,19 +12793,19 @@ UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable return arr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) { @@ -12302,7 +12858,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -12313,12 +12869,12 @@ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(go } } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -12330,7 +12886,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro return true; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { @@ -13021,7 +13577,6 @@ enum { upb_JsonDecode_IgnoreUnknown = 1 }; enum { kUpb_JsonDecodeResult_Ok = 0, - kUpb_JsonDecodeResult_OkWithEmptyStringNumerics = 1, kUpb_JsonDecodeResult_Error = 2, }; @@ -13194,7 +13749,9 @@ UPB_API bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, // Clears all unknown field data from this message and all submessages. UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg, - const upb_MessageDef* m, int maxdepth); + const upb_MessageDef* m, + const upb_DefPool* ext_pool, + int maxdepth); #ifdef __cplusplus } /* extern "C" */ @@ -13308,10 +13865,6 @@ UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) #define upb_Atomic_Store(addr, val, order) \ atomic_store_explicit(addr, val, order) -#define upb_Atomic_Add(addr, val, order) \ - atomic_fetch_add_explicit(addr, val, order) -#define upb_Atomic_Sub(addr, val, order) \ - atomic_fetch_sub_explicit(addr, val, order) #define upb_Atomic_Exchange(addr, val, order) \ atomic_exchange_explicit(addr, val, order) #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ @@ -13323,15 +13876,146 @@ UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, atomic_compare_exchange_weak_explicit(addr, expected, desired, \ success_order, failure_order) -#else // !UPB_USE_C11_ATOMICS +#elif defined(UPB_USE_MSC_ATOMICS) +#include <intrin.h> +#include <stdbool.h> +#include <stdint.h> + +#define upb_Atomic_Init(addr, val) (*(addr) = val) + +#if defined(_WIN64) +// MSVC, without C11 atomics, does not have any way in pure C to force +// load-acquire store-release behavior, so we hack it with exchanges. +#pragma intrinsic(_InterlockedExchange64) +#define upb_Atomic_Store(addr, val, order) \ + (void)_InterlockedExchange64((uint64_t volatile *)addr, (uint64_t)val) + +#pragma intrinsic(_InterlockedCompareExchange64) +static uintptr_t upb_Atomic_LoadMsc(uint64_t volatile *addr) { + // Compare exchange with an unlikely value reduces the risk of a spurious + // (but harmless) store + return _InterlockedCompareExchange64(addr, 0xDEADC0DEBAADF00D, + 0xDEADC0DEBAADF00D); +} +// If _Generic is available, use it to avoid emitting a "'uintptr_t' differs in +// levels of indirection from 'void *'" or -Wint-conversion compiler warning. +#if __STDC_VERSION__ >= 201112L +#define upb_Atomic_Load(addr, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: upb_Atomic_LoadMsc( \ + (uint64_t volatile *)(addr)), \ + default: (void *)upb_Atomic_LoadMsc((uint64_t volatile *)(addr))) + +#define upb_Atomic_Exchange(addr, val, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: _InterlockedExchange64( \ + (uint64_t volatile *)(addr), (uint64_t)val), \ + default: (void *)_InterlockedExchange64((uint64_t volatile *)addr, \ + (uint64_t)val)) +#else +// Compare exchange with an unlikely value reduces the risk of a spurious +// (but harmless) store +#define upb_Atomic_Load(addr, order) \ + (void *)upb_Atomic_LoadMsc((uint64_t volatile *)(addr)) + +#define upb_Atomic_Exchange(addr, val, order) \ + (void *)_InterlockedExchange64((uint64_t volatile *)addr, (uint64_t)val) +#endif + +#pragma intrinsic(_InterlockedCompareExchange64) +static bool upb_Atomic_CompareExchangeMscP(uint64_t volatile *addr, + uint64_t *expected, + uint64_t desired) { + uint64_t expect_val = *expected; + uint64_t actual_val = + _InterlockedCompareExchange64(addr, desired, expect_val); + if (expect_val != actual_val) { + *expected = actual_val; + return false; + } + return true; +} + +#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ + success_order, failure_order) \ + upb_Atomic_CompareExchangeMscP((uint64_t volatile *)addr, \ + (uint64_t *)expected, (uint64_t)desired) + +#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ + failure_order) \ + upb_Atomic_CompareExchangeMscP((uint64_t volatile *)addr, \ + (uint64_t *)expected, (uint64_t)desired) + +#else // 32 bit pointers +#pragma intrinsic(_InterlockedExchange) +#define upb_Atomic_Store(addr, val, order) \ + (void)_InterlockedExchange((uint32_t volatile *)addr, (uint32_t)val) + +#pragma intrinsic(_InterlockedCompareExchange) +static uintptr_t upb_Atomic_LoadMsc(uint32_t volatile *addr) { + // Compare exchange with an unlikely value reduces the risk of a spurious + // (but harmless) store + return _InterlockedCompareExchange(addr, 0xDEADC0DE, 0xDEADC0DE); +} +// If _Generic is available, use it to avoid emitting 'uintptr_t' differs in +// levels of indirection from 'void *' +#if __STDC_VERSION__ >= 201112L +#define upb_Atomic_Load(addr, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: upb_Atomic_LoadMsc( \ + (uint32_t volatile *)(addr)), \ + default: (void *)upb_Atomic_LoadMsc((uint32_t volatile *)(addr))) + +#define upb_Atomic_Exchange(addr, val, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: _InterlockedExchange( \ + (uint32_t volatile *)(addr), (uint32_t)val), \ + default: (void *)_InterlockedExchange64((uint32_t volatile *)addr, \ + (uint32_t)val)) +#else +#define upb_Atomic_Load(addr, order) \ + (void *)upb_Atomic_LoadMsc((uint32_t volatile *)(addr)) + +#define upb_Atomic_Exchange(addr, val, order) \ + (void *)_InterlockedExchange((uint32_t volatile *)addr, (uint32_t)val) +#endif + +#pragma intrinsic(_InterlockedCompareExchange) +static bool upb_Atomic_CompareExchangeMscP(uint32_t volatile *addr, + uint32_t *expected, + uint32_t desired) { + uint32_t expect_val = *expected; + uint32_t actual_val = _InterlockedCompareExchange(addr, desired, expect_val); + if (expect_val != actual_val) { + *expected = actual_val; + return false; + } + return true; +} + +#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ + success_order, failure_order) \ + upb_Atomic_CompareExchangeMscP((uint32_t volatile *)addr, \ + (uint32_t *)expected, (uint32_t)desired) + +#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ + failure_order) \ + upb_Atomic_CompareExchangeMscP((uint32_t volatile *)addr, \ + (uint32_t *)expected, (uint32_t)desired) +#endif + +#else // No atomics + +#if !defined(UPB_SUPPRESS_MISSING_ATOMICS) +// NOLINTNEXTLINE +#error Your compiler does not support atomic instructions, which UPB uses. If you do not use UPB on multiple threads, you can suppress this error by defining UPB_SUPPRESS_MISSING_ATOMICS. +#endif #include <string.h> #define upb_Atomic_Init(addr, val) (*addr = val) #define upb_Atomic_Load(addr, order) (*addr) #define upb_Atomic_Store(addr, val, order) (*(addr) = val) -#define upb_Atomic_Add(addr, val, order) (*(addr) += val) -#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { void* old; @@ -13385,9 +14069,10 @@ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr, extern "C" { #endif -const upb_MiniTableExtension* upb_Message_ExtensionByIndex( - const upb_Message* msg, size_t index); - +// Same as upb_Message_NextExtension but iterates in reverse wire order +bool upb_Message_NextExtensionReverse(const upb_Message* msg, + const upb_MiniTableExtension** result, + uintptr_t* iter); // Returns the minitable with the given field number, or NULL on failure. const upb_MiniTableExtension* upb_Message_FindExtensionByNumber( const upb_Message* msg, uint32_t field_number); @@ -13499,8 +14184,8 @@ UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, const struct upb_Map* map, _upb_sortedmap* sorted); -bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, - size_t count, _upb_sortedmap* sorted); +bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Message_Internal* in, + _upb_sortedmap* sorted); #ifdef __cplusplus } /* extern "C" */ @@ -13529,7 +14214,9 @@ UPB_INLINE int upb_Log2Ceiling(int x) { #endif } -UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } +UPB_INLINE int upb_RoundUpToPowerOfTwo(int x) { + return 1 << upb_Log2Ceiling(x); +} #ifdef __cplusplus } /* extern "C" */ @@ -13636,8 +14323,7 @@ typedef enum { } upb_UnknownCompareResult; upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - const char* buf1, size_t size1, const char* buf2, size_t size2, - int max_depth); + const upb_Message* msg1, const upb_Message* msg2, int max_depth); #ifdef __cplusplus } /* extern "C" */ @@ -13650,25 +14336,250 @@ upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( #define THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_ #include <stddef.h> +#include <stdint.h> // Must be last. #define kUpb_BaseField_Begin ((size_t)-1) -#define kUpb_Extension_Begin ((size_t)-1) - bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg, const upb_MiniTable* m, const upb_MiniTableField** out_f, upb_MessageValue* out_v, - size_t* iter); + uintptr_t* iter); -bool UPB_PRIVATE(_upb_Message_NextExtension)( - const upb_Message* msg, const upb_MiniTable* m, - const upb_MiniTableExtension** out_e, upb_MessageValue* out_v, - size_t* iter); #endif // THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_ +#ifndef UPB_WIRE_READER_H_ +#define UPB_WIRE_READER_H_ + + +#ifndef UPB_WIRE_INTERNAL_READER_H_ +#define UPB_WIRE_INTERNAL_READER_H_ + +// Must be last. + +#define kUpb_WireReader_WireTypeBits 3 +#define kUpb_WireReader_WireTypeMask 7 + +typedef struct { + const char* ptr; + uint64_t val; +} UPB_PRIVATE(_upb_WireReader_LongVarint); + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_PRIVATE(_upb_WireReader_LongVarint) +UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val); + +UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)( + const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) { + uint64_t byte = (uint8_t)*ptr; + if (UPB_LIKELY((byte & 0x80) == 0)) { + *val = (uint32_t)byte; + return ptr + 1; + } + const char* start = ptr; + UPB_PRIVATE(_upb_WireReader_LongVarint) + res = UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(ptr, byte); + if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || + res.val > maxval) { + return NULL; // Malformed. + } + *val = res.val; + return res.ptr; +} + +UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { + return tag >> kUpb_WireReader_WireTypeBits; +} + +UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { + return tag & kUpb_WireReader_WireTypeMask; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif // UPB_WIRE_INTERNAL_READER_H_ + +#ifndef UPB_WIRE_TYPES_H_ +#define UPB_WIRE_TYPES_H_ + +// A list of types as they are encoded on the wire. +typedef enum { + kUpb_WireType_Varint = 0, + kUpb_WireType_64Bit = 1, + kUpb_WireType_Delimited = 2, + kUpb_WireType_StartGroup = 3, + kUpb_WireType_EndGroup = 4, + kUpb_WireType_32Bit = 5 +} upb_WireType; + +#endif /* UPB_WIRE_TYPES_H_ */ + +// Must be last. + +// The upb_WireReader interface is suitable for general-purpose parsing of +// protobuf binary wire format. It is designed to be used along with +// upb_EpsCopyInputStream for buffering, and all parsing routines in this file +// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is +// available to read without any bounds checks. + +#ifdef __cplusplus +extern "C" { +#endif + +// Parses a tag into `tag`, and returns a pointer past the end of the tag, or +// NULL if there was an error in the tag data. +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, + uint32_t* tag) { + uint64_t val; + ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX); + if (!ptr) return NULL; + *tag = val; + return ptr; +} + +// Given a tag, returns the field number. +UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag); + +// Given a tag, returns the wire type. +UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag); + +UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, + uint64_t* val) { + return UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, val, 10, UINT64_MAX); +} + +// Skips data for a varint, returning a pointer past the end of the varint, or +// NULL if there was an error in the varint data. +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { + uint64_t val; + return upb_WireReader_ReadVarint(ptr, &val); +} + +// Reads a varint indicating the size of a delimited field into `size`, or +// NULL if there was an error in the varint data. +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { + uint64_t size64; + ptr = upb_WireReader_ReadVarint(ptr, &size64); + if (!ptr || size64 >= INT32_MAX) return NULL; + *size = size64; + return ptr; +} + +// Reads a fixed32 field, performing byte swapping if necessary. +// +// REQUIRES: there must be at least 4 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { + uint32_t uval; + memcpy(&uval, ptr, 4); + uval = upb_BigEndian32(uval); + memcpy(val, &uval, 4); + return ptr + 4; +} + +// Reads a fixed64 field, performing byte swapping if necessary. +// +// REQUIRES: there must be at least 4 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { + uint64_t uval; + memcpy(&uval, ptr, 8); + uval = upb_BigEndian64(uval); + memcpy(val, &uval, 8); + return ptr + 8; +} + +const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)( + const char* ptr, uint32_t tag, int depth_limit, + upb_EpsCopyInputStream* stream); + +// Skips data for a group, returning a pointer past the end of the group, or +// NULL if there was an error parsing the group. The `tag` argument should be +// the start group tag that begins the group. The `depth_limit` argument +// indicates how many levels of recursion the group is allowed to have before +// reporting a parse error (this limit exists to protect against stack +// overflow). +// +// TODO: evaluate how the depth_limit should be specified. Do users need +// control over this? +UPB_INLINE const char* upb_WireReader_SkipGroup( + const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { + return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, 100, stream); +} + +UPB_INLINE const char* _upb_WireReader_SkipValue( + const char* ptr, uint32_t tag, int depth_limit, + upb_EpsCopyInputStream* stream) { + switch (upb_WireReader_GetWireType(tag)) { + case kUpb_WireType_Varint: + return upb_WireReader_SkipVarint(ptr); + case kUpb_WireType_32Bit: + return ptr + 4; + case kUpb_WireType_64Bit: + return ptr + 8; + case kUpb_WireType_Delimited: { + int size; + ptr = upb_WireReader_ReadSize(ptr, &size); + if (!ptr) return NULL; + ptr += size; + return ptr; + } + case kUpb_WireType_StartGroup: + return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, depth_limit, + stream); + case kUpb_WireType_EndGroup: + return NULL; // Should be handled before now. + default: + return NULL; // Unknown wire type. + } +} + +// Skips data for a wire value of any type, returning a pointer past the end of +// the data, or NULL if there was an error parsing the group. The `tag` argument +// should be the tag that was just parsed. The `depth_limit` argument indicates +// how many levels of recursion a group is allowed to have before reporting a +// parse error (this limit exists to protect against stack overflow). +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +// +// TODO: evaluate how the depth_limit should be specified. Do users need +// control over this? +UPB_INLINE const char* upb_WireReader_SkipValue( + const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { + return _upb_WireReader_SkipValue(ptr, tag, 100, stream); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif // UPB_WIRE_READER_H_ + #ifndef UPB_MESSAGE_COPY_H_ #define UPB_MESSAGE_COPY_H_ @@ -14054,17 +14965,18 @@ enum { #ifndef UPB_WIRE_INTERNAL_DECODER_H_ #define UPB_WIRE_INTERNAL_DECODER_H_ +#include <stddef.h> + #include "utf8_range.h" // Must be last. -#define DECODE_NOGROUP (uint32_t) - 1 +#define DECODE_NOGROUP (uint32_t)-1 typedef struct upb_Decoder { upb_EpsCopyInputStream input; const upb_ExtensionRegistry* extreg; - const char* unknown; // Start of unknown data, preserve at buffer flip - upb_Message* unknown_msg; // Pointer to preserve data to + upb_Message* original_msg; // Pointer to preserve data to int depth; // Tracks recursion depth to bound stack usage. uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP. uint16_t options; @@ -14124,14 +15036,6 @@ UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { upb_Decoder* d = (upb_Decoder*)e; if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); - - if (d->unknown) { - if (!UPB_PRIVATE(_upb_Message_AddUnknown)( - d->unknown_msg, d->unknown, old_end - d->unknown, &d->arena)) { - _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); - } - d->unknown = new_start; - } return new_start; } @@ -14160,236 +15064,6 @@ UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { #endif /* UPB_WIRE_INTERNAL_DECODER_H_ */ - -#ifndef UPB_WIRE_READER_H_ -#define UPB_WIRE_READER_H_ - - -#ifndef UPB_WIRE_INTERNAL_READER_H_ -#define UPB_WIRE_INTERNAL_READER_H_ - -// Must be last. - -#define kUpb_WireReader_WireTypeBits 3 -#define kUpb_WireReader_WireTypeMask 7 - -typedef struct { - const char* ptr; - uint64_t val; -} UPB_PRIVATE(_upb_WireReader_LongVarint); - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_PRIVATE(_upb_WireReader_LongVarint) -UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val); - -UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)( - const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) { - uint64_t byte = (uint8_t)*ptr; - if (UPB_LIKELY((byte & 0x80) == 0)) { - *val = (uint32_t)byte; - return ptr + 1; - } - const char* start = ptr; - UPB_PRIVATE(_upb_WireReader_LongVarint) - res = UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(ptr, byte); - if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || - res.val > maxval) { - return NULL; // Malformed. - } - *val = res.val; - return res.ptr; -} - -UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { - return tag >> kUpb_WireReader_WireTypeBits; -} - -UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { - return tag & kUpb_WireReader_WireTypeMask; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif // UPB_WIRE_INTERNAL_READER_H_ - -#ifndef UPB_WIRE_TYPES_H_ -#define UPB_WIRE_TYPES_H_ - -// A list of types as they are encoded on the wire. -typedef enum { - kUpb_WireType_Varint = 0, - kUpb_WireType_64Bit = 1, - kUpb_WireType_Delimited = 2, - kUpb_WireType_StartGroup = 3, - kUpb_WireType_EndGroup = 4, - kUpb_WireType_32Bit = 5 -} upb_WireType; - -#endif /* UPB_WIRE_TYPES_H_ */ - -// Must be last. - -// The upb_WireReader interface is suitable for general-purpose parsing of -// protobuf binary wire format. It is designed to be used along with -// upb_EpsCopyInputStream for buffering, and all parsing routines in this file -// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is -// available to read without any bounds checks. - -#ifdef __cplusplus -extern "C" { -#endif - -// Parses a tag into `tag`, and returns a pointer past the end of the tag, or -// NULL if there was an error in the tag data. -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, - uint32_t* tag) { - uint64_t val; - ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX); - if (!ptr) return NULL; - *tag = val; - return ptr; -} - -// Given a tag, returns the field number. -UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag); - -// Given a tag, returns the wire type. -UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag); - -UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, - uint64_t* val) { - return UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, val, 10, UINT64_MAX); -} - -// Skips data for a varint, returning a pointer past the end of the varint, or -// NULL if there was an error in the varint data. -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { - uint64_t val; - return upb_WireReader_ReadVarint(ptr, &val); -} - -// Reads a varint indicating the size of a delimited field into `size`, or -// NULL if there was an error in the varint data. -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { - uint64_t size64; - ptr = upb_WireReader_ReadVarint(ptr, &size64); - if (!ptr || size64 >= INT32_MAX) return NULL; - *size = size64; - return ptr; -} - -// Reads a fixed32 field, performing byte swapping if necessary. -// -// REQUIRES: there must be at least 4 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { - uint32_t uval; - memcpy(&uval, ptr, 4); - uval = upb_BigEndian32(uval); - memcpy(val, &uval, 4); - return ptr + 4; -} - -// Reads a fixed64 field, performing byte swapping if necessary. -// -// REQUIRES: there must be at least 4 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { - uint64_t uval; - memcpy(&uval, ptr, 8); - uval = upb_BigEndian64(uval); - memcpy(val, &uval, 8); - return ptr + 8; -} - -const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)( - const char* ptr, uint32_t tag, int depth_limit, - upb_EpsCopyInputStream* stream); - -// Skips data for a group, returning a pointer past the end of the group, or -// NULL if there was an error parsing the group. The `tag` argument should be -// the start group tag that begins the group. The `depth_limit` argument -// indicates how many levels of recursion the group is allowed to have before -// reporting a parse error (this limit exists to protect against stack -// overflow). -// -// TODO: evaluate how the depth_limit should be specified. Do users need -// control over this? -UPB_INLINE const char* upb_WireReader_SkipGroup( - const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { - return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, 100, stream); -} - -UPB_INLINE const char* _upb_WireReader_SkipValue( - const char* ptr, uint32_t tag, int depth_limit, - upb_EpsCopyInputStream* stream) { - switch (upb_WireReader_GetWireType(tag)) { - case kUpb_WireType_Varint: - return upb_WireReader_SkipVarint(ptr); - case kUpb_WireType_32Bit: - return ptr + 4; - case kUpb_WireType_64Bit: - return ptr + 8; - case kUpb_WireType_Delimited: { - int size; - ptr = upb_WireReader_ReadSize(ptr, &size); - if (!ptr) return NULL; - ptr += size; - return ptr; - } - case kUpb_WireType_StartGroup: - return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, depth_limit, - stream); - case kUpb_WireType_EndGroup: - return NULL; // Should be handled before now. - default: - return NULL; // Unknown wire type. - } -} - -// Skips data for a wire value of any type, returning a pointer past the end of -// the data, or NULL if there was an error parsing the group. The `tag` argument -// should be the tag that was just parsed. The `depth_limit` argument indicates -// how many levels of recursion a group is allowed to have before reporting a -// parse error (this limit exists to protect against stack overflow). -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -// -// TODO: evaluate how the depth_limit should be specified. Do users need -// control over this? -UPB_INLINE const char* upb_WireReader_SkipValue( - const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { - return _upb_WireReader_SkipValue(ptr, tag, 100, stream); -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif // UPB_WIRE_READER_H_ /* This file was generated by upb_generator from the input file: * * google/protobuf/descriptor.proto @@ -15081,7 +15755,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, // features. This is used for feature resolution under Editions. // NOLINTBEGIN // clang-format off -#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\023\030\204\007\"\000*\014\010\001\020\002\030\002 \003(\0010\002\n\023\030\347\007\"\000*\014\010\002\020\001\030\001 \002(\0010\001\n\023\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\000 \346\007(\350\007" +#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\025\030\204\007\"\000*\016\010\001\020\002\030\002 \003(\0010\0028\002\n\025\030\347\007\"\000*\016\010\002\020\001\030\001 \002(\0010\0018\002\n\025\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\0028\002 \346\007(\350\007" // clang-format on // NOLINTEND @@ -15325,12 +15999,14 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_SIZE #undef UPB_PTR_AT +#undef UPB_SIZEOF_FLEX #undef UPB_MAPTYPE_STRING #undef UPB_EXPORT #undef UPB_INLINE #undef UPB_API #undef UPBC_API #undef UPB_API_INLINE +#undef UPB_API_INLINE_IF_NOT_GCC #undef UPB_ALIGN_UP #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC @@ -15339,6 +16015,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN @@ -15349,6 +16026,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASSUME #undef UPB_ASSERT #undef UPB_UNREACHABLE +#undef UPB_DEFAULT_MAX_BLOCK_SIZE #undef UPB_SETJMP #undef UPB_LONGJMP #undef UPB_PTRADD @@ -15362,6 +16040,12 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASAN #undef UPB_ASAN_GUARD_SIZE #undef UPB_CLANG_ASAN +#undef UPB_TSAN_PUBLISHED_MEMBER +#undef UPB_TSAN_INIT_PUBLISHED +#undef UPB_TSAN_CHECK_PUBLISHED +#undef UPB_TSAN_PUBLISH +#undef UPB_TSAN_CHECK_READ +#undef UPB_TSAN_CHECK_WRITE #undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN #undef UPB_DEPRECATED #undef UPB_GNUC_MIN @@ -15371,6 +16055,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_IS_GOOGLE3 #undef UPB_ATOMIC #undef UPB_USE_C11_ATOMICS +#undef UPB_USE_MSC_ATOMICS #undef UPB_PRIVATE #undef UPB_ONLYBITS #undef UPB_LINKARR_DECLARE @@ -15378,4 +16063,3 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_LINKARR_START #undef UPB_LINKARR_STOP #undef UPB_FUTURE_BREAKING_CHANGES -#undef UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT diff --git a/third_party/protobuf/php/ext/google/protobuf/protobuf.h b/third_party/protobuf/php/ext/google/protobuf/protobuf.h index 39f825e81620c..3bee72a04bd33 100644 --- a/third_party/protobuf/php/ext/google/protobuf/protobuf.h +++ b/third_party/protobuf/php/ext/google/protobuf/protobuf.h @@ -32,7 +32,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -#define PHP_PROTOBUF_VERSION "4.29.3" +#define PHP_PROTOBUF_VERSION "4.30.1" // ptr -> PHP object cache. This is a weak map that caches lazily-created // wrapper objects around upb types: diff --git a/third_party/protobuf/php/ext/google/protobuf/wkt.inc b/third_party/protobuf/php/ext/google/protobuf/wkt.inc index 799a48fd46567..a093995a61d3e 100644 --- a/third_party/protobuf/php/ext/google/protobuf/wkt.inc +++ b/third_party/protobuf/php/ext/google/protobuf/wkt.inc @@ -12,8 +12,8 @@ static void google_protobuf_empty_proto_AddDescriptor(); static void google_protobuf_field_mask_proto_AddDescriptor(); static void google_protobuf_source_context_proto_AddDescriptor(); static void google_protobuf_struct_proto_AddDescriptor(); -static void google_protobuf_type_proto_AddDescriptor(); static void google_protobuf_timestamp_proto_AddDescriptor(); +static void google_protobuf_type_proto_AddDescriptor(); static void google_protobuf_wrappers_proto_AddDescriptor(); /* google/protobuf/any.proto */ @@ -1497,16 +1497,137 @@ static void google_protobuf_NullValue_ModuleInit() { strlen("NULL_VALUE"), 0); } +/* google/protobuf/timestamp.proto */ + +zend_class_entry* GPBMetadata_Google_Protobuf_Timestamp_ce; + +const char google_protobuf_timestamp_proto_descriptor [239] = { +'\n', '\037', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'i', 'm', 'e', 's', 't', 'a', +'m', 'p', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', +'\"', '+', '\n', '\t', 'T', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', '\022', '\017', '\n', '\007', 's', 'e', 'c', 'o', 'n', 'd', 's', '\030', +'\001', ' ', '\001', '(', '\003', '\022', '\r', '\n', '\005', 'n', 'a', 'n', 'o', 's', '\030', '\002', ' ', '\001', '(', '\005', 'B', '\205', '\001', '\n', '\023', +'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\016', 'T', 'i', 'm', 'e', +'s', 't', 'a', 'm', 'p', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '2', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', +'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', +'w', 'n', '/', 't', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', +'\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', +'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +}; + +static void google_protobuf_timestamp_proto_AddDescriptor() { + if (DescriptorPool_HasFile("google/protobuf/timestamp.proto")) return; + DescriptorPool_AddDescriptor("google/protobuf/timestamp.proto", google_protobuf_timestamp_proto_descriptor, + sizeof(google_protobuf_timestamp_proto_descriptor)); +} + +static PHP_METHOD(GPBMetadata_Google_Protobuf_Timestamp, initOnce) { + google_protobuf_timestamp_proto_AddDescriptor(); +} + +static zend_function_entry GPBMetadata_Google_Protobuf_Timestamp_methods[] = { + PHP_ME(GPBMetadata_Google_Protobuf_Timestamp, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + ZEND_FE_END +}; + +static void GPBMetadata_Google_Protobuf_Timestamp_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Timestamp", + GPBMetadata_Google_Protobuf_Timestamp_methods); + + GPBMetadata_Google_Protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce); +} + +/* google_protobuf_Timestamp */ + +zend_class_entry* google_protobuf_Timestamp_ce; + +static PHP_METHOD(google_protobuf_Timestamp, __construct) { + google_protobuf_timestamp_proto_AddDescriptor(); + zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static PHP_METHOD(google_protobuf_Timestamp, getSeconds) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "seconds"); + zval ret; + Message_get(intern, f, &ret); + RETURN_COPY_VALUE(&ret); +} + +static PHP_METHOD(google_protobuf_Timestamp, setSeconds) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "seconds"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_COPY(getThis()); +} + +static PHP_METHOD(google_protobuf_Timestamp, getNanos) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "nanos"); + zval ret; + Message_get(intern, f, &ret); + RETURN_COPY_VALUE(&ret); +} + +static PHP_METHOD(google_protobuf_Timestamp, setNanos) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "nanos"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_COPY(getThis()); +} + +ZEND_BEGIN_ARG_INFO_EX(arginfo_timestamp_fromdatetime, 0, 0, 1) + ZEND_ARG_INFO(0, datetime) +ZEND_END_ARG_INFO() + +static zend_function_entry google_protobuf_Timestamp_phpmethods[] = { + PHP_ME(google_protobuf_Timestamp, __construct, arginfo_construct, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, getSeconds, arginfo_void, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, setSeconds, arginfo_setter, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, getNanos, arginfo_void, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, setNanos, arginfo_setter, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, fromDateTime, arginfo_timestamp_fromdatetime, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Timestamp, toDateTime, arginfo_void, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static void google_protobuf_Timestamp_ModuleInit() { + zend_class_entry tmp_ce; + + INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Timestamp", + google_protobuf_Timestamp_phpmethods); + + google_protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce); + google_protobuf_Timestamp_ce->ce_flags |= ZEND_ACC_FINAL; + google_protobuf_Timestamp_ce->create_object = Message_create; + zend_do_inheritance(google_protobuf_Timestamp_ce, message_ce); +} + /* google/protobuf/type.proto */ zend_class_entry* GPBMetadata_Google_Protobuf_Type_ce; -const char google_protobuf_type_proto_descriptor [1592] = { +const char google_protobuf_type_proto_descriptor [1647] = { '\n', '\032', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\032', '\031', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'a', 'n', 'y', '.', 'p', 'r', 'o', 't', 'o', '\032', '$', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 's', 'o', 'u', 'r', 'c', 'e', '_', 'c', 'o', 'n', -'t', 'e', 'x', 't', '.', 'p', 'r', 'o', 't', 'o', '\"', '\327', '\001', '\n', '\004', 'T', 'y', 'p', 'e', '\022', '\014', '\n', '\004', 'n', 'a', +'t', 'e', 'x', 't', '.', 'p', 'r', 'o', 't', 'o', '\"', '\350', '\001', '\n', '\004', 'T', 'y', 'p', 'e', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '&', '\n', '\006', 'f', 'i', 'e', 'l', 'd', 's', '\030', '\002', ' ', '\003', '(', '\013', '2', '\026', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', '\022', '\016', '\n', '\006', 'o', 'n', 'e', 'o', 'f', 's', '\030', '\003', ' ', '\003', '(', '\t', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', @@ -1515,57 +1636,59 @@ const char google_protobuf_type_proto_descriptor [1592] = { '\005', ' ', '\001', '(', '\013', '2', '\036', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', '\'', '\n', '\006', 's', 'y', 'n', 't', 'a', 'x', '\030', '\006', ' ', '\001', '(', '\016', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'y', 'n', -'t', 'a', 'x', '\"', '\325', '\005', '\n', '\005', 'F', 'i', 'e', 'l', 'd', '\022', ')', '\n', '\004', 'k', 'i', 'n', 'd', '\030', '\001', ' ', '\001', -'(', '\016', '2', '\033', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', -'d', '.', 'K', 'i', 'n', 'd', '\022', '7', '\n', '\013', 'c', 'a', 'r', 'd', 'i', 'n', 'a', 'l', 'i', 't', 'y', '\030', '\002', ' ', '\001', -'(', '\016', '2', '\"', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', -'d', '.', 'C', 'a', 'r', 'd', 'i', 'n', 'a', 'l', 'i', 't', 'y', '\022', '\016', '\n', '\006', 'n', 'u', 'm', 'b', 'e', 'r', '\030', '\003', -' ', '\001', '(', '\005', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\004', ' ', '\001', '(', '\t', '\022', '\020', '\n', '\010', 't', 'y', 'p', -'e', '_', 'u', 'r', 'l', '\030', '\006', ' ', '\001', '(', '\t', '\022', '\023', '\n', '\013', 'o', 'n', 'e', 'o', 'f', '_', 'i', 'n', 'd', 'e', -'x', '\030', '\007', ' ', '\001', '(', '\005', '\022', '\016', '\n', '\006', 'p', 'a', 'c', 'k', 'e', 'd', '\030', '\010', ' ', '\001', '(', '\010', '\022', '(', -'\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\t', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', -'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\021', '\n', '\t', 'j', 's', 'o', 'n', '_', 'n', -'a', 'm', 'e', '\030', '\n', ' ', '\001', '(', '\t', '\022', '\025', '\n', '\r', 'd', 'e', 'f', 'a', 'u', 'l', 't', '_', 'v', 'a', 'l', 'u', -'e', '\030', '\013', ' ', '\001', '(', '\t', '\"', '\310', '\002', '\n', '\004', 'K', 'i', 'n', 'd', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', -'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'D', 'O', 'U', 'B', 'L', 'E', '\020', -'\001', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'F', 'L', 'O', 'A', 'T', '\020', '\002', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', -'_', 'I', 'N', 'T', '6', '4', '\020', '\003', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'U', 'I', 'N', 'T', '6', '4', '\020', '\004', -'\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'I', 'N', 'T', '3', '2', '\020', '\005', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', -'F', 'I', 'X', 'E', 'D', '6', '4', '\020', '\006', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', 'F', 'I', 'X', 'E', 'D', '3', '2', -'\020', '\007', '\022', '\r', '\n', '\t', 'T', 'Y', 'P', 'E', '_', 'B', 'O', 'O', 'L', '\020', '\010', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', -'_', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\t', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'G', 'R', 'O', 'U', 'P', '\020', '\n', -'\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', 'M', 'E', 'S', 'S', 'A', 'G', 'E', '\020', '\013', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', -'E', '_', 'B', 'Y', 'T', 'E', 'S', '\020', '\014', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'U', 'I', 'N', 'T', '3', '2', '\020', -'\r', '\022', '\r', '\n', '\t', 'T', 'Y', 'P', 'E', '_', 'E', 'N', 'U', 'M', '\020', '\016', '\022', '\021', '\n', '\r', 'T', 'Y', 'P', 'E', '_', -'S', 'F', 'I', 'X', 'E', 'D', '3', '2', '\020', '\017', '\022', '\021', '\n', '\r', 'T', 'Y', 'P', 'E', '_', 'S', 'F', 'I', 'X', 'E', 'D', -'6', '4', '\020', '\020', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'S', 'I', 'N', 'T', '3', '2', '\020', '\021', '\022', '\017', '\n', '\013', -'T', 'Y', 'P', 'E', '_', 'S', 'I', 'N', 'T', '6', '4', '\020', '\022', '\"', 't', '\n', '\013', 'C', 'a', 'r', 'd', 'i', 'n', 'a', 'l', -'i', 't', 'y', '\022', '\027', '\n', '\023', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', -'N', '\020', '\000', '\022', '\030', '\n', '\024', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'O', 'P', 'T', 'I', 'O', 'N', -'A', 'L', '\020', '\001', '\022', '\030', '\n', '\024', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'E', 'Q', 'U', 'I', -'R', 'E', 'D', '\020', '\002', '\022', '\030', '\n', '\024', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'E', 'P', 'E', -'A', 'T', 'E', 'D', '\020', '\003', '\"', '\316', '\001', '\n', '\004', 'E', 'n', 'u', 'm', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', -' ', '\001', '(', '\t', '\022', '-', '\n', '\t', 'e', 'n', 'u', 'm', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\003', '(', '\013', '2', '\032', -'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'n', 'u', 'm', 'V', 'a', 'l', 'u', -'e', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\003', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', -'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '6', '\n', '\016', 's', 'o', 'u', -'r', 'c', 'e', '_', 'c', 'o', 'n', 't', 'e', 'x', 't', '\030', '\004', ' ', '\001', '(', '\013', '2', '\036', '.', 'g', 'o', 'o', 'g', 'l', -'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', -'\'', '\n', '\006', 's', 'y', 'n', 't', 'a', 'x', '\030', '\005', ' ', '\001', '(', '\016', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', -'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'y', 'n', 't', 'a', 'x', '\"', 'S', '\n', '\t', 'E', 'n', 'u', 'm', 'V', 'a', -'l', 'u', 'e', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '\016', '\n', '\006', 'n', 'u', 'm', 'b', -'e', 'r', '\030', '\002', ' ', '\001', '(', '\005', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', 's', '\030', '\003', ' ', '\003', '(', '\013', -'2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', -'\"', ';', '\n', '\006', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', -'#', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\001', '(', '\013', '2', '\024', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', -'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'A', 'n', 'y', '*', '.', '\n', '\006', 'S', 'y', 'n', 't', 'a', 'x', '\022', '\021', '\n', '\r', -'S', 'Y', 'N', 'T', 'A', 'X', '_', 'P', 'R', 'O', 'T', 'O', '2', '\020', '\000', '\022', '\021', '\n', '\r', 'S', 'Y', 'N', 'T', 'A', 'X', -'_', 'P', 'R', 'O', 'T', 'O', '3', '\020', '\001', 'B', '{', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', -'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\t', 'T', 'y', 'p', 'e', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '-', 'g', 'o', 'o', -'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', -'y', 'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', 't', 'y', 'p', 'e', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', -'B', '\252', '\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', -'n', 'o', 'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', +'t', 'a', 'x', '\022', '\017', '\n', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\007', ' ', '\001', '(', '\t', '\"', '\325', '\005', '\n', '\005', +'F', 'i', 'e', 'l', 'd', '\022', ')', '\n', '\004', 'k', 'i', 'n', 'd', '\030', '\001', ' ', '\001', '(', '\016', '2', '\033', '.', 'g', 'o', 'o', +'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', '.', 'K', 'i', 'n', 'd', '\022', '7', +'\n', '\013', 'c', 'a', 'r', 'd', 'i', 'n', 'a', 'l', 'i', 't', 'y', '\030', '\002', ' ', '\001', '(', '\016', '2', '\"', '.', 'g', 'o', 'o', +'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', '.', 'C', 'a', 'r', 'd', 'i', 'n', +'a', 'l', 'i', 't', 'y', '\022', '\016', '\n', '\006', 'n', 'u', 'm', 'b', 'e', 'r', '\030', '\003', ' ', '\001', '(', '\005', '\022', '\014', '\n', '\004', +'n', 'a', 'm', 'e', '\030', '\004', ' ', '\001', '(', '\t', '\022', '\020', '\n', '\010', 't', 'y', 'p', 'e', '_', 'u', 'r', 'l', '\030', '\006', ' ', +'\001', '(', '\t', '\022', '\023', '\n', '\013', 'o', 'n', 'e', 'o', 'f', '_', 'i', 'n', 'd', 'e', 'x', '\030', '\007', ' ', '\001', '(', '\005', '\022', +'\016', '\n', '\006', 'p', 'a', 'c', 'k', 'e', 'd', '\030', '\010', ' ', '\001', '(', '\010', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', 'o', 'n', +'s', '\030', '\t', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', +'.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\021', '\n', '\t', 'j', 's', 'o', 'n', '_', 'n', 'a', 'm', 'e', '\030', '\n', ' ', '\001', '(', +'\t', '\022', '\025', '\n', '\r', 'd', 'e', 'f', 'a', 'u', 'l', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\013', ' ', '\001', '(', '\t', '\"', +'\310', '\002', '\n', '\004', 'K', 'i', 'n', 'd', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', +'\000', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'D', 'O', 'U', 'B', 'L', 'E', '\020', '\001', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', +'E', '_', 'F', 'L', 'O', 'A', 'T', '\020', '\002', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'I', 'N', 'T', '6', '4', '\020', '\003', +'\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'U', 'I', 'N', 'T', '6', '4', '\020', '\004', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', +'_', 'I', 'N', 'T', '3', '2', '\020', '\005', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', 'F', 'I', 'X', 'E', 'D', '6', '4', '\020', +'\006', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', '_', 'F', 'I', 'X', 'E', 'D', '3', '2', '\020', '\007', '\022', '\r', '\n', '\t', 'T', 'Y', +'P', 'E', '_', 'B', 'O', 'O', 'L', '\020', '\010', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'S', 'T', 'R', 'I', 'N', 'G', '\020', +'\t', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'G', 'R', 'O', 'U', 'P', '\020', '\n', '\022', '\020', '\n', '\014', 'T', 'Y', 'P', 'E', +'_', 'M', 'E', 'S', 'S', 'A', 'G', 'E', '\020', '\013', '\022', '\016', '\n', '\n', 'T', 'Y', 'P', 'E', '_', 'B', 'Y', 'T', 'E', 'S', '\020', +'\014', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'U', 'I', 'N', 'T', '3', '2', '\020', '\r', '\022', '\r', '\n', '\t', 'T', 'Y', 'P', +'E', '_', 'E', 'N', 'U', 'M', '\020', '\016', '\022', '\021', '\n', '\r', 'T', 'Y', 'P', 'E', '_', 'S', 'F', 'I', 'X', 'E', 'D', '3', '2', +'\020', '\017', '\022', '\021', '\n', '\r', 'T', 'Y', 'P', 'E', '_', 'S', 'F', 'I', 'X', 'E', 'D', '6', '4', '\020', '\020', '\022', '\017', '\n', '\013', +'T', 'Y', 'P', 'E', '_', 'S', 'I', 'N', 'T', '3', '2', '\020', '\021', '\022', '\017', '\n', '\013', 'T', 'Y', 'P', 'E', '_', 'S', 'I', 'N', +'T', '6', '4', '\020', '\022', '\"', 't', '\n', '\013', 'C', 'a', 'r', 'd', 'i', 'n', 'a', 'l', 'i', 't', 'y', '\022', '\027', '\n', '\023', 'C', +'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\030', '\n', '\024', 'C', +'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'O', 'P', 'T', 'I', 'O', 'N', 'A', 'L', '\020', '\001', '\022', '\030', '\n', '\024', +'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'E', 'Q', 'U', 'I', 'R', 'E', 'D', '\020', '\002', '\022', '\030', '\n', +'\024', 'C', 'A', 'R', 'D', 'I', 'N', 'A', 'L', 'I', 'T', 'Y', '_', 'R', 'E', 'P', 'E', 'A', 'T', 'E', 'D', '\020', '\003', '\"', '\337', +'\001', '\n', '\004', 'E', 'n', 'u', 'm', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '-', '\n', '\t', +'e', 'n', 'u', 'm', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\003', '(', '\013', '2', '\032', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', +'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'n', 'u', 'm', 'V', 'a', 'l', 'u', 'e', '\022', '(', '\n', '\007', 'o', 'p', 't', +'i', 'o', 'n', 's', '\030', '\003', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', +'b', 'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\022', '6', '\n', '\016', 's', 'o', 'u', 'r', 'c', 'e', '_', 'c', 'o', 'n', 't', +'e', 'x', 't', '\030', '\004', ' ', '\001', '(', '\013', '2', '\036', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', +'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'n', 't', 'e', 'x', 't', '\022', '\'', '\n', '\006', 's', 'y', 'n', 't', 'a', +'x', '\030', '\005', ' ', '\001', '(', '\016', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', +'.', 'S', 'y', 'n', 't', 'a', 'x', '\022', '\017', '\n', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\006', ' ', '\001', '(', '\t', '\"', +'S', '\n', '\t', 'E', 'n', 'u', 'm', 'V', 'a', 'l', 'u', 'e', '\022', '\014', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', +'\t', '\022', '\016', '\n', '\006', 'n', 'u', 'm', 'b', 'e', 'r', '\030', '\002', ' ', '\001', '(', '\005', '\022', '(', '\n', '\007', 'o', 'p', 't', 'i', +'o', 'n', 's', '\030', '\003', ' ', '\003', '(', '\013', '2', '\027', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', +'u', 'f', '.', 'O', 'p', 't', 'i', 'o', 'n', '\"', ';', '\n', '\006', 'O', 'p', 't', 'i', 'o', 'n', '\022', '\014', '\n', '\004', 'n', 'a', +'m', 'e', '\030', '\001', ' ', '\001', '(', '\t', '\022', '#', '\n', '\005', 'v', 'a', 'l', 'u', 'e', '\030', '\002', ' ', '\001', '(', '\013', '2', '\024', +'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'A', 'n', 'y', '*', 'C', '\n', '\006', 'S', +'y', 'n', 't', 'a', 'x', '\022', '\021', '\n', '\r', 'S', 'Y', 'N', 'T', 'A', 'X', '_', 'P', 'R', 'O', 'T', 'O', '2', '\020', '\000', '\022', +'\021', '\n', '\r', 'S', 'Y', 'N', 'T', 'A', 'X', '_', 'P', 'R', 'O', 'T', 'O', '3', '\020', '\001', '\022', '\023', '\n', '\017', 'S', 'Y', 'N', +'T', 'A', 'X', '_', 'E', 'D', 'I', 'T', 'I', 'O', 'N', 'S', '\020', '\002', 'B', '{', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', +'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\t', 'T', 'y', 'p', 'e', 'P', 'r', 'o', 't', 'o', 'P', '\001', +'Z', '-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', +'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', 'w', 'n', '/', 't', 'y', 'p', 'e', 'p', 'b', '\370', '\001', '\001', +'\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', +'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', 'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', }; static void google_protobuf_type_proto_AddDescriptor() { @@ -1735,6 +1858,28 @@ static PHP_METHOD(google_protobuf_Type, setSyntax) { RETURN_COPY(getThis()); } +static PHP_METHOD(google_protobuf_Type, getEdition) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "edition"); + zval ret; + Message_get(intern, f, &ret); + RETURN_COPY_VALUE(&ret); +} + +static PHP_METHOD(google_protobuf_Type, setEdition) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "edition"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_COPY(getThis()); +} + static zend_function_entry google_protobuf_Type_phpmethods[] = { PHP_ME(google_protobuf_Type, __construct, arginfo_construct, ZEND_ACC_PUBLIC) PHP_ME(google_protobuf_Type, getName, arginfo_void, ZEND_ACC_PUBLIC) @@ -1749,6 +1894,8 @@ static zend_function_entry google_protobuf_Type_phpmethods[] = { PHP_ME(google_protobuf_Type, setSourceContext, arginfo_setter, ZEND_ACC_PUBLIC) PHP_ME(google_protobuf_Type, getSyntax, arginfo_void, ZEND_ACC_PUBLIC) PHP_ME(google_protobuf_Type, setSyntax, arginfo_setter, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, getEdition, arginfo_void, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Type, setEdition, arginfo_setter, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -2319,6 +2466,28 @@ static PHP_METHOD(google_protobuf_Enum, setSyntax) { RETURN_COPY(getThis()); } +static PHP_METHOD(google_protobuf_Enum, getEdition) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "edition"); + zval ret; + Message_get(intern, f, &ret); + RETURN_COPY_VALUE(&ret); +} + +static PHP_METHOD(google_protobuf_Enum, setEdition) { + Message* intern = (Message*)Z_OBJ_P(getThis()); + const upb_FieldDef *f = upb_MessageDef_FindFieldByName( + intern->desc->msgdef, "edition"); + zval *val; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) + == FAILURE) { + return; + } + Message_set(intern, f, val); + RETURN_COPY(getThis()); +} + static zend_function_entry google_protobuf_Enum_phpmethods[] = { PHP_ME(google_protobuf_Enum, __construct, arginfo_construct, ZEND_ACC_PUBLIC) PHP_ME(google_protobuf_Enum, getName, arginfo_void, ZEND_ACC_PUBLIC) @@ -2331,6 +2500,8 @@ static zend_function_entry google_protobuf_Enum_phpmethods[] = { PHP_ME(google_protobuf_Enum, setSourceContext, arginfo_setter, ZEND_ACC_PUBLIC) PHP_ME(google_protobuf_Enum, getSyntax, arginfo_void, ZEND_ACC_PUBLIC) PHP_ME(google_protobuf_Enum, setSyntax, arginfo_setter, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, getEdition, arginfo_void, ZEND_ACC_PUBLIC) + PHP_ME(google_protobuf_Enum, setEdition, arginfo_setter, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -2582,127 +2753,8 @@ static void google_protobuf_Syntax_ModuleInit() { strlen("SYNTAX_PROTO2"), 0); zend_declare_class_constant_long(google_protobuf_Syntax_ce, "SYNTAX_PROTO3", strlen("SYNTAX_PROTO3"), 1); -} - -/* google/protobuf/timestamp.proto */ - -zend_class_entry* GPBMetadata_Google_Protobuf_Timestamp_ce; - -const char google_protobuf_timestamp_proto_descriptor [239] = { -'\n', '\037', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'i', 'm', 'e', 's', 't', 'a', -'m', 'p', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', -'\"', '+', '\n', '\t', 'T', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', '\022', '\017', '\n', '\007', 's', 'e', 'c', 'o', 'n', 'd', 's', '\030', -'\001', ' ', '\001', '(', '\003', '\022', '\r', '\n', '\005', 'n', 'a', 'n', 'o', 's', '\030', '\002', ' ', '\001', '(', '\005', 'B', '\205', '\001', '\n', '\023', -'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\016', 'T', 'i', 'm', 'e', -'s', 't', 'a', 'm', 'p', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '2', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', -'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o', -'w', 'n', '/', 't', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', -'\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w', -'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3', -}; - -static void google_protobuf_timestamp_proto_AddDescriptor() { - if (DescriptorPool_HasFile("google/protobuf/timestamp.proto")) return; - DescriptorPool_AddDescriptor("google/protobuf/timestamp.proto", google_protobuf_timestamp_proto_descriptor, - sizeof(google_protobuf_timestamp_proto_descriptor)); -} - -static PHP_METHOD(GPBMetadata_Google_Protobuf_Timestamp, initOnce) { - google_protobuf_timestamp_proto_AddDescriptor(); -} - -static zend_function_entry GPBMetadata_Google_Protobuf_Timestamp_methods[] = { - PHP_ME(GPBMetadata_Google_Protobuf_Timestamp, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - ZEND_FE_END -}; - -static void GPBMetadata_Google_Protobuf_Timestamp_ModuleInit() { - zend_class_entry tmp_ce; - - INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Timestamp", - GPBMetadata_Google_Protobuf_Timestamp_methods); - - GPBMetadata_Google_Protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce); -} - -/* google_protobuf_Timestamp */ - -zend_class_entry* google_protobuf_Timestamp_ce; - -static PHP_METHOD(google_protobuf_Timestamp, __construct) { - google_protobuf_timestamp_proto_AddDescriptor(); - zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU); -} - -static PHP_METHOD(google_protobuf_Timestamp, getSeconds) { - Message* intern = (Message*)Z_OBJ_P(getThis()); - const upb_FieldDef *f = upb_MessageDef_FindFieldByName( - intern->desc->msgdef, "seconds"); - zval ret; - Message_get(intern, f, &ret); - RETURN_COPY_VALUE(&ret); -} - -static PHP_METHOD(google_protobuf_Timestamp, setSeconds) { - Message* intern = (Message*)Z_OBJ_P(getThis()); - const upb_FieldDef *f = upb_MessageDef_FindFieldByName( - intern->desc->msgdef, "seconds"); - zval *val; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) - == FAILURE) { - return; - } - Message_set(intern, f, val); - RETURN_COPY(getThis()); -} - -static PHP_METHOD(google_protobuf_Timestamp, getNanos) { - Message* intern = (Message*)Z_OBJ_P(getThis()); - const upb_FieldDef *f = upb_MessageDef_FindFieldByName( - intern->desc->msgdef, "nanos"); - zval ret; - Message_get(intern, f, &ret); - RETURN_COPY_VALUE(&ret); -} - -static PHP_METHOD(google_protobuf_Timestamp, setNanos) { - Message* intern = (Message*)Z_OBJ_P(getThis()); - const upb_FieldDef *f = upb_MessageDef_FindFieldByName( - intern->desc->msgdef, "nanos"); - zval *val; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val) - == FAILURE) { - return; - } - Message_set(intern, f, val); - RETURN_COPY(getThis()); -} - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timestamp_fromdatetime, 0, 0, 1) - ZEND_ARG_INFO(0, datetime) -ZEND_END_ARG_INFO() - -static zend_function_entry google_protobuf_Timestamp_phpmethods[] = { - PHP_ME(google_protobuf_Timestamp, __construct, arginfo_construct, ZEND_ACC_PUBLIC) - PHP_ME(google_protobuf_Timestamp, getSeconds, arginfo_void, ZEND_ACC_PUBLIC) - PHP_ME(google_protobuf_Timestamp, setSeconds, arginfo_setter, ZEND_ACC_PUBLIC) - PHP_ME(google_protobuf_Timestamp, getNanos, arginfo_void, ZEND_ACC_PUBLIC) - PHP_ME(google_protobuf_Timestamp, setNanos, arginfo_setter, ZEND_ACC_PUBLIC) - PHP_ME(google_protobuf_Timestamp, fromDateTime, arginfo_timestamp_fromdatetime, ZEND_ACC_PUBLIC) - PHP_ME(google_protobuf_Timestamp, toDateTime, arginfo_void, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static void google_protobuf_Timestamp_ModuleInit() { - zend_class_entry tmp_ce; - - INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Timestamp", - google_protobuf_Timestamp_phpmethods); - - google_protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce); - google_protobuf_Timestamp_ce->ce_flags |= ZEND_ACC_FINAL; - google_protobuf_Timestamp_ce->create_object = Message_create; - zend_do_inheritance(google_protobuf_Timestamp_ce, message_ce); + zend_declare_class_constant_long(google_protobuf_Syntax_ce, "SYNTAX_EDITIONS", + strlen("SYNTAX_EDITIONS"), 2); } /* google/protobuf/wrappers.proto */ @@ -3226,6 +3278,8 @@ static void WellKnownTypes_ModuleInit() { google_protobuf_Value_ModuleInit(); google_protobuf_ListValue_ModuleInit(); google_protobuf_NullValue_ModuleInit(); + GPBMetadata_Google_Protobuf_Timestamp_ModuleInit(); + google_protobuf_Timestamp_ModuleInit(); GPBMetadata_Google_Protobuf_Type_ModuleInit(); google_protobuf_Type_ModuleInit(); google_protobuf_Field_ModuleInit(); @@ -3235,8 +3289,6 @@ static void WellKnownTypes_ModuleInit() { google_protobuf_EnumValue_ModuleInit(); google_protobuf_Option_ModuleInit(); google_protobuf_Syntax_ModuleInit(); - GPBMetadata_Google_Protobuf_Timestamp_ModuleInit(); - google_protobuf_Timestamp_ModuleInit(); GPBMetadata_Google_Protobuf_Wrappers_ModuleInit(); google_protobuf_DoubleValue_ModuleInit(); google_protobuf_FloatValue_ModuleInit(); diff --git a/third_party/protobuf/php/internal_generated_files.bzl b/third_party/protobuf/php/internal_generated_files.bzl new file mode 100644 index 0000000000000..e84e658e2fce5 --- /dev/null +++ b/third_party/protobuf/php/internal_generated_files.bzl @@ -0,0 +1,99 @@ +"""This file lists the generated PHP files used for WKT and boostrapping.""" + +WKT_GENERATED_FILES = [ + "src/Google/Protobuf/Any.php", + "src/Google/Protobuf/Api.php", + "src/Google/Protobuf/BoolValue.php", + "src/Google/Protobuf/BytesValue.php", + "src/Google/Protobuf/DoubleValue.php", + "src/Google/Protobuf/Duration.php", + "src/Google/Protobuf/Enum.php", + "src/Google/Protobuf/EnumValue.php", + "src/Google/Protobuf/Field.php", + "src/Google/Protobuf/Field/Cardinality.php", + "src/Google/Protobuf/Field/Kind.php", + "src/Google/Protobuf/FieldMask.php", + "src/Google/Protobuf/FloatValue.php", + "src/Google/Protobuf/GPBEmpty.php", + "src/Google/Protobuf/Int32Value.php", + "src/Google/Protobuf/Int64Value.php", + "src/Google/Protobuf/ListValue.php", + "src/Google/Protobuf/Method.php", + "src/Google/Protobuf/Mixin.php", + "src/Google/Protobuf/NullValue.php", + "src/Google/Protobuf/Option.php", + "src/Google/Protobuf/SourceContext.php", + "src/Google/Protobuf/StringValue.php", + "src/Google/Protobuf/Struct.php", + "src/Google/Protobuf/Syntax.php", + "src/Google/Protobuf/Timestamp.php", + "src/Google/Protobuf/Type.php", + "src/Google/Protobuf/UInt32Value.php", + "src/Google/Protobuf/UInt64Value.php", + "src/Google/Protobuf/Value.php", + "src/GPBMetadata/Google/Protobuf/Any.php", + "src/GPBMetadata/Google/Protobuf/Api.php", + "src/GPBMetadata/Google/Protobuf/Duration.php", + "src/GPBMetadata/Google/Protobuf/FieldMask.php", + "src/GPBMetadata/Google/Protobuf/GPBEmpty.php", + "src/GPBMetadata/Google/Protobuf/SourceContext.php", + "src/GPBMetadata/Google/Protobuf/Struct.php", + "src/GPBMetadata/Google/Protobuf/Timestamp.php", + "src/GPBMetadata/Google/Protobuf/Type.php", + "src/GPBMetadata/Google/Protobuf/Wrappers.php", +] + +DESCRIPTOR_GENERATED_FILES = [ + "src/Google/Protobuf/Internal/DescriptorProto.php", + "src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php", + "src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php", + "src/Google/Protobuf/Internal/Edition.php", + "src/Google/Protobuf/Internal/EnumDescriptorProto.php", + "src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php", + "src/Google/Protobuf/Internal/EnumOptions.php", + "src/Google/Protobuf/Internal/EnumValueDescriptorProto.php", + "src/Google/Protobuf/Internal/EnumValueOptions.php", + "src/Google/Protobuf/Internal/ExtensionRangeOptions.php", + "src/Google/Protobuf/Internal/ExtensionRangeOptions/Declaration.php", + "src/Google/Protobuf/Internal/ExtensionRangeOptions/VerificationState.php", + "src/Google/Protobuf/Internal/FeatureSet.php", + "src/Google/Protobuf/Internal/FeatureSet/EnumType.php", + "src/Google/Protobuf/Internal/FeatureSet/EnforceNamingStyle.php", + "src/Google/Protobuf/Internal/FeatureSet/FieldPresence.php", + "src/Google/Protobuf/Internal/FeatureSet/JsonFormat.php", + "src/Google/Protobuf/Internal/FeatureSet/MessageEncoding.php", + "src/Google/Protobuf/Internal/FeatureSet/RepeatedFieldEncoding.php", + "src/Google/Protobuf/Internal/FeatureSet/Utf8Validation.php", + "src/Google/Protobuf/Internal/FeatureSetDefaults.php", + "src/Google/Protobuf/Internal/FeatureSetDefaults/FeatureSetEditionDefault.php", + "src/Google/Protobuf/Internal/FieldDescriptorProto.php", + "src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php", + "src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php", + "src/Google/Protobuf/Internal/FieldOptions.php", + "src/Google/Protobuf/Internal/FieldOptions/CType.php", + "src/Google/Protobuf/Internal/FieldOptions/EditionDefault.php", + "src/Google/Protobuf/Internal/FieldOptions/FeatureSupport.php", + "src/Google/Protobuf/Internal/FieldOptions/JSType.php", + "src/Google/Protobuf/Internal/FieldOptions/OptionRetention.php", + "src/Google/Protobuf/Internal/FieldOptions/OptionTargetType.php", + "src/Google/Protobuf/Internal/FileDescriptorProto.php", + "src/Google/Protobuf/Internal/FileDescriptorSet.php", + "src/Google/Protobuf/Internal/FileOptions.php", + "src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php", + "src/Google/Protobuf/Internal/GeneratedCodeInfo.php", + "src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php", + "src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation/Semantic.php", + "src/Google/Protobuf/Internal/MessageOptions.php", + "src/Google/Protobuf/Internal/MethodDescriptorProto.php", + "src/Google/Protobuf/Internal/MethodOptions.php", + "src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php", + "src/Google/Protobuf/Internal/OneofDescriptorProto.php", + "src/Google/Protobuf/Internal/OneofOptions.php", + "src/Google/Protobuf/Internal/ServiceDescriptorProto.php", + "src/Google/Protobuf/Internal/ServiceOptions.php", + "src/Google/Protobuf/Internal/SourceCodeInfo.php", + "src/Google/Protobuf/Internal/SourceCodeInfo/Location.php", + "src/Google/Protobuf/Internal/UninterpretedOption.php", + "src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php", + "src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php", +] diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Any.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Any.php index fbce4bfdb10f9..c9a2952010738 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Any.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Any.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/any.proto namespace GPBMetadata\Google\Protobuf; @@ -15,13 +16,7 @@ class Any return; } $pool->internalAddGeneratedFile( - ' -� -google/protobuf/any.protogoogle.protobuf"& -Any -type_url ( -value (Bv -com.google.protobufBAnyProtoPZ,google.golang.org/protobuf/types/known/anypb�GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xD4\x01\x0A\x19google/protobuf/any.proto\x12\x0Fgoogle.protobuf\"&\x0A\x03Any\x12\x10\x0A\x08type_url\x18\x01 \x01(\x09\x12\x0D\x0A\x05value\x18\x02 \x01(\x0CBv\x0A\x13com.google.protobufB\x08AnyProtoP\x01Z,google.golang.org/protobuf/types/known/anypb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Api.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Api.php index 75e0ec6318056..4485d3d0b3406 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Api.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Api.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/api.proto namespace GPBMetadata\Google\Protobuf; @@ -17,29 +18,7 @@ class Api \GPBMetadata\Google\Protobuf\SourceContext::initOnce(); \GPBMetadata\Google\Protobuf\Type::initOnce(); $pool->internalAddGeneratedFile( - ' -� -google/protobuf/api.protogoogle.protobufgoogle/protobuf/type.proto"� -Api -name ( ( -methods (2.google.protobuf.Method( -options (2.google.protobuf.Option -version ( 6 -source_context (2.google.protobuf.SourceContext& -mixins (2.google.protobuf.Mixin\' -syntax (2.google.protobuf.Syntax"� -Method -name ( -request_type_url ( -request_streaming ( -response_type_url ( -response_streaming (( -options (2.google.protobuf.Option\' -syntax (2.google.protobuf.Syntax"# -Mixin -name ( -root ( Bv -com.google.protobufBApiProtoPZ,google.golang.org/protobuf/types/known/apipb�GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xC9\x05\x0A\x19google/protobuf/api.proto\x12\x0Fgoogle.protobuf\x1A\x1Agoogle/protobuf/type.proto\"\x81\x02\x0A\x03Api\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12(\x0A\x07methods\x18\x02 \x03(\x0B2\x17.google.protobuf.Method\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\x12\x0F\x0A\x07version\x18\x04 \x01(\x09\x126\x0A\x0Esource_context\x18\x05 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12&\x0A\x06mixins\x18\x06 \x03(\x0B2\x16.google.protobuf.Mixin\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"\xD5\x01\x0A\x06Method\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x18\x0A\x10request_type_url\x18\x02 \x01(\x09\x12\x19\x0A\x11request_streaming\x18\x03 \x01(\x08\x12\x19\x0A\x11response_type_url\x18\x04 \x01(\x09\x12\x1A\x0A\x12response_streaming\x18\x05 \x01(\x08\x12(\x0A\x07options\x18\x06 \x03(\x0B2\x17.google.protobuf.Option\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"#\x0A\x05Mixin\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x0C\x0A\x04root\x18\x02 \x01(\x09Bv\x0A\x13com.google.protobufB\x08ApiProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Duration.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Duration.php index 5d8023e4db9e6..29e02a84517a1 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Duration.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Duration.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/duration.proto namespace GPBMetadata\Google\Protobuf; @@ -15,13 +16,7 @@ class Duration return; } $pool->internalAddGeneratedFile( - ' -� -google/protobuf/duration.protogoogle.protobuf"* -Duration -seconds ( -nanos (B� -com.google.protobufB DurationProtoPZ1google.golang.org/protobuf/types/known/durationpb��GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xEB\x01\x0A\x1Egoogle/protobuf/duration.proto\x12\x0Fgoogle.protobuf\"*\x0A\x08Duration\x12\x0F\x0A\x07seconds\x18\x01 \x01(\x03\x12\x0D\x0A\x05nanos\x18\x02 \x01(\x05B\x83\x01\x0A\x13com.google.protobufB\x0DDurationProtoP\x01Z1google.golang.org/protobuf/types/known/durationpb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/FieldMask.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/FieldMask.php index f31bcc0012450..394e41043a758 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/FieldMask.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/FieldMask.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/field_mask.proto namespace GPBMetadata\Google\Protobuf; @@ -15,12 +16,7 @@ class FieldMask return; } $pool->internalAddGeneratedFile( - ' -� - google/protobuf/field_mask.protogoogle.protobuf" - FieldMask -paths ( B� -com.google.protobufBFieldMaskProtoPZ2google.golang.org/protobuf/types/known/fieldmaskpb��GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xDF\x01\x0A google/protobuf/field_mask.proto\x12\x0Fgoogle.protobuf\"\x1A\x0A\x09FieldMask\x12\x0D\x0A\x05paths\x18\x01 \x03(\x09B\x85\x01\x0A\x13com.google.protobufB\x0EFieldMaskProtoP\x01Z2google.golang.org/protobuf/types/known/fieldmaskpb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php index 5e42536f270c9..2842d0e9928e9 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/empty.proto namespace GPBMetadata\Google\Protobuf; @@ -15,12 +16,7 @@ class GPBEmpty return; } $pool->internalAddGeneratedFile( - ' -� -google/protobuf/empty.protogoogle.protobuf" -EmptyB} -com.google.protobufB -EmptyProtoPZ.google.golang.org/protobuf/types/known/emptypb��GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xBE\x01\x0A\x1Bgoogle/protobuf/empty.proto\x12\x0Fgoogle.protobuf\"\x07\x0A\x05EmptyB}\x0A\x13com.google.protobufB\x0AEmptyProtoP\x01Z.google.golang.org/protobuf/types/known/emptypb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php index 4247c09546d3a..e51f2952387ff 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace GPBMetadata\Google\Protobuf\Internal; @@ -31,7 +32,7 @@ class Descriptor ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.FileOptions') ->optional('source_code_info', \Google\Protobuf\Internal\GPBType::MESSAGE, 9, 'google.protobuf.internal.SourceCodeInfo') ->optional('syntax', \Google\Protobuf\Internal\GPBType::STRING, 12) - ->optional('edition', \Google\Protobuf\Internal\GPBType::STRING, 13) + ->optional('edition', \Google\Protobuf\Internal\GPBType::ENUM, 14, 'google.protobuf.internal.Edition') ->finalizeToPool(); $pool->addMessage('google.protobuf.internal.DescriptorProto', \Google\Protobuf\Internal\DescriptorProto::class) @@ -60,6 +61,22 @@ class Descriptor $pool->addMessage('google.protobuf.internal.ExtensionRangeOptions', \Google\Protobuf\Internal\ExtensionRangeOptions::class) ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->repeated('declaration', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.ExtensionRangeOptions.Declaration') + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 50, 'google.protobuf.internal.FeatureSet') + ->optional('verification', \Google\Protobuf\Internal\GPBType::ENUM, 3, 'google.protobuf.internal.ExtensionRangeOptions.VerificationState') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.ExtensionRangeOptions.Declaration', \Google\Protobuf\Internal\ExtensionRangeOptions\Declaration::class) + ->optional('number', \Google\Protobuf\Internal\GPBType::INT32, 1) + ->optional('full_name', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->optional('type', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('reserved', \Google\Protobuf\Internal\GPBType::BOOL, 5) + ->optional('repeated', \Google\Protobuf\Internal\GPBType::BOOL, 6) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.ExtensionRangeOptions.VerificationState', \Google\Protobuf\Internal\VerificationState::class) + ->value("DECLARATION", 0) + ->value("UNVERIFIED", 1) ->finalizeToPool(); $pool->addMessage('google.protobuf.internal.FieldDescriptorProto', \Google\Protobuf\Internal\FieldDescriptorProto::class) @@ -99,8 +116,8 @@ class Descriptor $pool->addEnum('google.protobuf.internal.FieldDescriptorProto.Label', \Google\Protobuf\Internal\Label::class) ->value("LABEL_OPTIONAL", 1) - ->value("LABEL_REQUIRED", 2) ->value("LABEL_REPEATED", 3) + ->value("LABEL_REQUIRED", 2) ->finalizeToPool(); $pool->addMessage('google.protobuf.internal.OneofDescriptorProto', \Google\Protobuf\Internal\OneofDescriptorProto::class) @@ -153,7 +170,6 @@ class Descriptor ->optional('cc_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 16) ->optional('java_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 17) ->optional('py_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 18) - ->optional('php_generic_services', \Google\Protobuf\Internal\GPBType::BOOL, 42) ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 23) ->optional('cc_enable_arenas', \Google\Protobuf\Internal\GPBType::BOOL, 31) ->optional('objc_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 36) @@ -163,6 +179,7 @@ class Descriptor ->optional('php_namespace', \Google\Protobuf\Internal\GPBType::STRING, 41) ->optional('php_metadata_namespace', \Google\Protobuf\Internal\GPBType::STRING, 44) ->optional('ruby_package', \Google\Protobuf\Internal\GPBType::STRING, 45) + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 50, 'google.protobuf.internal.FeatureSet') ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); @@ -178,6 +195,7 @@ class Descriptor ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) ->optional('map_entry', \Google\Protobuf\Internal\GPBType::BOOL, 7) ->optional('deprecated_legacy_json_field_conflicts', \Google\Protobuf\Internal\GPBType::BOOL, 11) + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 12, 'google.protobuf.internal.FeatureSet') ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); @@ -189,9 +207,27 @@ class Descriptor ->optional('unverified_lazy', \Google\Protobuf\Internal\GPBType::BOOL, 15) ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) ->optional('weak', \Google\Protobuf\Internal\GPBType::BOOL, 10) + ->optional('debug_redact', \Google\Protobuf\Internal\GPBType::BOOL, 16) + ->optional('retention', \Google\Protobuf\Internal\GPBType::ENUM, 17, 'google.protobuf.internal.FieldOptions.OptionRetention') + ->repeated('targets', \Google\Protobuf\Internal\GPBType::ENUM, 19, 'google.protobuf.internal.FieldOptions.OptionTargetType') + ->repeated('edition_defaults', \Google\Protobuf\Internal\GPBType::MESSAGE, 20, 'google.protobuf.internal.FieldOptions.EditionDefault') + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 21, 'google.protobuf.internal.FeatureSet') + ->optional('feature_support', \Google\Protobuf\Internal\GPBType::MESSAGE, 22, 'google.protobuf.internal.FieldOptions.FeatureSupport') ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); + $pool->addMessage('google.protobuf.internal.FieldOptions.EditionDefault', \Google\Protobuf\Internal\FieldOptions\EditionDefault::class) + ->optional('edition', \Google\Protobuf\Internal\GPBType::ENUM, 3, 'google.protobuf.internal.Edition') + ->optional('value', \Google\Protobuf\Internal\GPBType::STRING, 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FieldOptions.FeatureSupport', \Google\Protobuf\Internal\FieldOptions\FeatureSupport::class) + ->optional('edition_introduced', \Google\Protobuf\Internal\GPBType::ENUM, 1, 'google.protobuf.internal.Edition') + ->optional('edition_deprecated', \Google\Protobuf\Internal\GPBType::ENUM, 2, 'google.protobuf.internal.Edition') + ->optional('deprecation_warning', \Google\Protobuf\Internal\GPBType::STRING, 3) + ->optional('edition_removed', \Google\Protobuf\Internal\GPBType::ENUM, 4, 'google.protobuf.internal.Edition') + ->finalizeToPool(); + $pool->addEnum('google.protobuf.internal.FieldOptions.CType', \Google\Protobuf\Internal\CType::class) ->value("STRING", 0) ->value("CORD", 1) @@ -204,7 +240,27 @@ class Descriptor ->value("JS_NUMBER", 2) ->finalizeToPool(); + $pool->addEnum('google.protobuf.internal.FieldOptions.OptionRetention', \Google\Protobuf\Internal\OptionRetention::class) + ->value("RETENTION_UNKNOWN", 0) + ->value("RETENTION_RUNTIME", 1) + ->value("RETENTION_SOURCE", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FieldOptions.OptionTargetType', \Google\Protobuf\Internal\OptionTargetType::class) + ->value("TARGET_TYPE_UNKNOWN", 0) + ->value("TARGET_TYPE_FILE", 1) + ->value("TARGET_TYPE_EXTENSION_RANGE", 2) + ->value("TARGET_TYPE_MESSAGE", 3) + ->value("TARGET_TYPE_FIELD", 4) + ->value("TARGET_TYPE_ONEOF", 5) + ->value("TARGET_TYPE_ENUM", 6) + ->value("TARGET_TYPE_ENUM_ENTRY", 7) + ->value("TARGET_TYPE_SERVICE", 8) + ->value("TARGET_TYPE_METHOD", 9) + ->finalizeToPool(); + $pool->addMessage('google.protobuf.internal.OneofOptions', \Google\Protobuf\Internal\OneofOptions::class) + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.FeatureSet') ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); @@ -212,15 +268,20 @@ class Descriptor ->optional('allow_alias', \Google\Protobuf\Internal\GPBType::BOOL, 2) ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 3) ->optional('deprecated_legacy_json_field_conflicts', \Google\Protobuf\Internal\GPBType::BOOL, 6) + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 7, 'google.protobuf.internal.FeatureSet') ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); $pool->addMessage('google.protobuf.internal.EnumValueOptions', \Google\Protobuf\Internal\EnumValueOptions::class) ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 1) + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 2, 'google.protobuf.internal.FeatureSet') + ->optional('debug_redact', \Google\Protobuf\Internal\GPBType::BOOL, 3) + ->optional('feature_support', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.FieldOptions.FeatureSupport') ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); $pool->addMessage('google.protobuf.internal.ServiceOptions', \Google\Protobuf\Internal\ServiceOptions::class) + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 34, 'google.protobuf.internal.FeatureSet') ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 33) ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); @@ -228,6 +289,7 @@ class Descriptor $pool->addMessage('google.protobuf.internal.MethodOptions', \Google\Protobuf\Internal\MethodOptions::class) ->optional('deprecated', \Google\Protobuf\Internal\GPBType::BOOL, 33) ->optional('idempotency_level', \Google\Protobuf\Internal\GPBType::ENUM, 34, 'google.protobuf.internal.MethodOptions.IdempotencyLevel') + ->optional('features', \Google\Protobuf\Internal\GPBType::MESSAGE, 35, 'google.protobuf.internal.FeatureSet') ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') ->finalizeToPool(); @@ -252,6 +314,71 @@ class Descriptor ->required('is_extension', \Google\Protobuf\Internal\GPBType::BOOL, 2) ->finalizeToPool(); + $pool->addMessage('google.protobuf.internal.FeatureSet', \Google\Protobuf\Internal\FeatureSet::class) + ->optional('field_presence', \Google\Protobuf\Internal\GPBType::ENUM, 1, 'google.protobuf.internal.FeatureSet.FieldPresence') + ->optional('enum_type', \Google\Protobuf\Internal\GPBType::ENUM, 2, 'google.protobuf.internal.FeatureSet.EnumType') + ->optional('repeated_field_encoding', \Google\Protobuf\Internal\GPBType::ENUM, 3, 'google.protobuf.internal.FeatureSet.RepeatedFieldEncoding') + ->optional('utf8_validation', \Google\Protobuf\Internal\GPBType::ENUM, 4, 'google.protobuf.internal.FeatureSet.Utf8Validation') + ->optional('message_encoding', \Google\Protobuf\Internal\GPBType::ENUM, 5, 'google.protobuf.internal.FeatureSet.MessageEncoding') + ->optional('json_format', \Google\Protobuf\Internal\GPBType::ENUM, 6, 'google.protobuf.internal.FeatureSet.JsonFormat') + ->optional('enforce_naming_style', \Google\Protobuf\Internal\GPBType::ENUM, 7, 'google.protobuf.internal.FeatureSet.EnforceNamingStyle') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FeatureSet.FieldPresence', \Google\Protobuf\Internal\FieldPresence::class) + ->value("FIELD_PRESENCE_UNKNOWN", 0) + ->value("EXPLICIT", 1) + ->value("IMPLICIT", 2) + ->value("LEGACY_REQUIRED", 3) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FeatureSet.EnumType', \Google\Protobuf\Internal\EnumType::class) + ->value("ENUM_TYPE_UNKNOWN", 0) + ->value("OPEN", 1) + ->value("CLOSED", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FeatureSet.RepeatedFieldEncoding', \Google\Protobuf\Internal\RepeatedFieldEncoding::class) + ->value("REPEATED_FIELD_ENCODING_UNKNOWN", 0) + ->value("PACKED", 1) + ->value("EXPANDED", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FeatureSet.Utf8Validation', \Google\Protobuf\Internal\Utf8Validation::class) + ->value("UTF8_VALIDATION_UNKNOWN", 0) + ->value("VERIFY", 2) + ->value("NONE", 3) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FeatureSet.MessageEncoding', \Google\Protobuf\Internal\MessageEncoding::class) + ->value("MESSAGE_ENCODING_UNKNOWN", 0) + ->value("LENGTH_PREFIXED", 1) + ->value("DELIMITED", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FeatureSet.JsonFormat', \Google\Protobuf\Internal\JsonFormat::class) + ->value("JSON_FORMAT_UNKNOWN", 0) + ->value("ALLOW", 1) + ->value("LEGACY_BEST_EFFORT", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.FeatureSet.EnforceNamingStyle', \Google\Protobuf\Internal\EnforceNamingStyle::class) + ->value("ENFORCE_NAMING_STYLE_UNKNOWN", 0) + ->value("STYLE2024", 1) + ->value("STYLE_LEGACY", 2) + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FeatureSetDefaults', \Google\Protobuf\Internal\FeatureSetDefaults::class) + ->repeated('defaults', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.FeatureSetDefaults.FeatureSetEditionDefault') + ->optional('minimum_edition', \Google\Protobuf\Internal\GPBType::ENUM, 4, 'google.protobuf.internal.Edition') + ->optional('maximum_edition', \Google\Protobuf\Internal\GPBType::ENUM, 5, 'google.protobuf.internal.Edition') + ->finalizeToPool(); + + $pool->addMessage('google.protobuf.internal.FeatureSetDefaults.FeatureSetEditionDefault', \Google\Protobuf\Internal\FeatureSetDefaults\FeatureSetEditionDefault::class) + ->optional('edition', \Google\Protobuf\Internal\GPBType::ENUM, 3, 'google.protobuf.internal.Edition') + ->optional('overridable_features', \Google\Protobuf\Internal\GPBType::MESSAGE, 4, 'google.protobuf.internal.FeatureSet') + ->optional('fixed_features', \Google\Protobuf\Internal\GPBType::MESSAGE, 5, 'google.protobuf.internal.FeatureSet') + ->finalizeToPool(); + $pool->addMessage('google.protobuf.internal.SourceCodeInfo', \Google\Protobuf\Internal\SourceCodeInfo::class) ->repeated('location', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.SourceCodeInfo.Location') ->finalizeToPool(); @@ -273,6 +400,28 @@ class Descriptor ->optional('source_file', \Google\Protobuf\Internal\GPBType::STRING, 2) ->optional('begin', \Google\Protobuf\Internal\GPBType::INT32, 3) ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 4) + ->optional('semantic', \Google\Protobuf\Internal\GPBType::ENUM, 5, 'google.protobuf.internal.GeneratedCodeInfo.Annotation.Semantic') + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.GeneratedCodeInfo.Annotation.Semantic', \Google\Protobuf\Internal\Semantic::class) + ->value("NONE", 0) + ->value("SET", 1) + ->value("ALIAS", 2) + ->finalizeToPool(); + + $pool->addEnum('google.protobuf.internal.Edition', \Google\Protobuf\Internal\Edition::class) + ->value("EDITION_UNKNOWN", 0) + ->value("EDITION_LEGACY", 900) + ->value("EDITION_PROTO2", 998) + ->value("EDITION_PROTO3", 999) + ->value("EDITION_2023", 1000) + ->value("EDITION_2024", 1001) + ->value("EDITION_1_TEST_ONLY", 1) + ->value("EDITION_2_TEST_ONLY", 2) + ->value("EDITION_99997_TEST_ONLY", 99997) + ->value("EDITION_99998_TEST_ONLY", 99998) + ->value("EDITION_99999_TEST_ONLY", 99999) + ->value("EDITION_MAX", 2147483647) ->finalizeToPool(); $pool->finish(); diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/SourceContext.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/SourceContext.php index 797732d9f3261..8d1566c05a83d 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/SourceContext.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/SourceContext.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/source_context.proto namespace GPBMetadata\Google\Protobuf; @@ -15,12 +16,7 @@ class SourceContext return; } $pool->internalAddGeneratedFile( - ' -� -$google/protobuf/source_context.protogoogle.protobuf"" - SourceContext - file_name ( B� -com.google.protobufBSourceContextProtoPZ6google.golang.org/protobuf/types/known/sourcecontextpb�GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xF0\x01\x0A\$google/protobuf/source_context.proto\x12\x0Fgoogle.protobuf\"\"\x0A\x0DSourceContext\x12\x11\x0A\x09file_name\x18\x01 \x01(\x09B\x8A\x01\x0A\x13com.google.protobufB\x12SourceContextProtoP\x01Z6google.golang.org/protobuf/types/known/sourcecontextpb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Struct.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Struct.php index 888a81adee4075a2c04ab9805212f7c132174f4e..6fad5d9a83462a43c8385478e396555025e61bc0 100644 GIT binary patch literal 1600 zcmaJ>{ZHF45dA%Wg$HaZ(@2{J3N2$((xwH`HPu#_G(|#b>ISREi4tckoA}>%=X}r* zwo1*1^WMAXyYqeg9N)*<KABKK6JOF5Sw0eZPf46aG72J2mf3nu6B0xZG2=AR2^qO$ z<}Qdcx>~#e>dYm>OJ{iPjE=5mWd7A%xc1GMOq|)!9XS9<qbv#NfP_&La@tnPpxRDl zk_A#%@0uq32b#uyK*?lof1%P}`O^0$isQ}E4RFpiE#Q8dl5dKu{m}^g;%v!TKvL;T zxE-+cjtM52&)IL-&;?ohJf%QwV%M1nB#Q(=f-3^rIwZL!Vh`d75^zCYy6~=qq>1pk zH==2fuvkXP9H4_iNM)5tTxlH^VNs5)Nh|j_7&J^?5ZDpjjZR2HWtNC@<r@W_swd^_ z=o2e^SgTbPb_`W&RY0WedE1WVZO0DWkMn0^_`hO!TcZoOagNCg1j+Y6=nMsnT%^;> ztAKE`Tv{{AS1Bx=A&|huY{A9u?&~k)^qj4a6~hrSc?6n;F2QZbuCJpZyZB^oC_<|U z21e+kjkg8j<fqRwT41{9LSbxBF?tOnw+J2psH-G#pAK3m_j#fKsNX5{Es=44w;M!l zRRwV{h}8%(1BTMM1P#!^6dS!lZz!^dB~5CI&$f+MDR6w42x}Cx+G&56QWU*oEukfA zgyV{ERuS5zCkO!NvxYyZ@G6z3ja}w7t+c9qahBGVdUd5{zNWx<&KH)xOxE#+iIulk zwp_nLVp87~?t7{@uQej3z2RF$dJmt<9_v^2LRAng`_h`-Os99Z*7OEe4BR00<>@$& zYnU)7U#g>~oo7Z3vN^mPKib842qW%`P>+)Ec{Iw$n5ONGh<=G;OvXz%!FhYC#<b8A z{!JK{-qyl?#g1|&YGUf;#MHl2&aY8uftsMw>8Xip?o~tLLq2<UM%6#ZltShc=}CLi Fw7+3(5a$2@ delta 522 zcmX@W)5ST#d1FcgBbz$cKNc>Ti8(TQLj39Z`RO^SdId%KCHYCEX-X}OTx`K5MWx9l zLdINdX_=`xDa8_u3d|bZM#_`zS;Xu0+`wY4c_l@aQm$OwNL(RqF6QjiN}zH^4Nf6d zF4nTdoYGVYCLovFNK6mSD!nj}tQC_5qtYuzE><v4$bgG0uQVqo9-<Ru5TB70vd+n= z%>3~TLSkGzd8N5YsYOtgAUha6z~aRvMVWc&P;q9EQ-I<kTwF={`7m=?fTA2gQGG5R zplYCBp{iMd;@n2!Kz~YzGl1NZlUWRtV*|@cP3~lou4iy!<6_Cq%u7)+=Hm1Ls)0CO zjf)NJZdicf@UoUP7pEW4lMqdOTwH#kK0fhbjy|ET0t`;|T*AruxyW7y#fuX+BvJxE z@x&CsIJt_|(D(-<<02+z_W-9=Omgm!cm&G>)$4_)=Hz(i<(KD$R2HNbC$WJe*jRn? HA66FtlWvwD diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Timestamp.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Timestamp.php index 09437271a91c0..fd4eaacc9d0bb 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Timestamp.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Timestamp.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/timestamp.proto namespace GPBMetadata\Google\Protobuf; @@ -15,13 +16,7 @@ class Timestamp return; } $pool->internalAddGeneratedFile( - ' -� -google/protobuf/timestamp.protogoogle.protobuf"+ - Timestamp -seconds ( -nanos (B� -com.google.protobufBTimestampProtoPZ2google.golang.org/protobuf/types/known/timestamppb��GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xEF\x01\x0A\x1Fgoogle/protobuf/timestamp.proto\x12\x0Fgoogle.protobuf\"+\x0A\x09Timestamp\x12\x0F\x0A\x07seconds\x18\x01 \x01(\x03\x12\x0D\x0A\x05nanos\x18\x02 \x01(\x05B\x85\x01\x0A\x13com.google.protobufB\x0ETimestampProtoP\x01Z2google.golang.org/protobuf/types/known/timestamppb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Type.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Type.php index 7d0bfbb533a2af7e63c43fd4b02e5bf41c61ac3c..6bec20ded3c2eae7b6d520581f644a993fc37885 100644 GIT binary patch literal 3575 zcmbtXZExa65dO}u*yf@(sTvLfA%QflY-}h>VpA}^OJxZ;uyDROHnL4iddh$A%y`!? z*hD8K5&@QHo_U|~{`&jo%ck~$4Y|)lC+17`_`>2ZoNdA&4i<sO9=EF%57{Dk-nbqQ z>x^k8Gfa!=+Q|9=L=BVm|Iqulx^^})*mz=EraBw2p>Fg|O$R^}Y{Lcbv2_rvJ^qoH zf%Rkjvf*|5R;&5WGmkdTg0taRz2~vBbYjOIl7u}*TR`HvR$F*Z6fp}VYu{=N{x;i3 z&t0%6c4BxtcB8rLyRqwd?tkFS4O=;0#6hr(U2XkE>;^tV0n=ablT(&(BKCL_fb%zO z-v)c+$2{~M&(?Uf2;EH_gkymAdTSo1QN)vzQ=t~=+!Z@XZ0z+)M&7VE-15A3#zG!% zL;srWMuOM$ll?}7Y{h@+^)iPt`8TDel%akAuI=J#d5Xu`Z?5oOSuRs&2T&I$sd;GZ zk-cju_D*ZVdq4TyR1T-#-ZjqwHAoOiNkF>cSh0`y#gb~8FA`%Dunh|JE1+m5${KB~ z5J4*pXtc4$;EZq#!6)#qi>M!kSZC#OZy5>DIf7aUQo+1tr@m)jeSm0`2Z$~y0-pyf zNzqCvNDp#BTpE|b1}jgZ+9`?@U6vG?1V>FB!JrqzAS}K}-6A5rL{vyL^8F;uj$ZuO z*$JLb%A=#_WrL;?O?i`E@g;O#;0uz=l%$LK(JlanFATs%8oE<)(tdJ%jAb!9q+Tt# zLDKcxMB@BXP^b$hT)NPjZu}ycD20?~U^+U$(=Uh>lId@sA9*OqD49eCZcx&zN{f=2 zl@=fy!oDjUc=K)O3BD}KR2*>HlAcfz!6aL9nUXA;Qh8c&FgBmKjNMflb%<p1{6NKZ z5tWs8Il)=Q0gLRa?$;>r=eaggQf1NunP6?nSI*Xp=l?j~R(745gF{91G1nMwtcbSE zCg_s^>st?FeLgd84fB&B&f&LYSO__lFq%12?;s!~3g#ACQX$CT&QvUc0Hqa(kzsXU zVi5;qqC(9q4?$?YSQ0gWXdylNATqV*&tUXf*HT5$(8yASNqL~aNs}gg?vg{QY2FDz zN;UjAC<J9{O-9C0KtzJlIh9yDoS3t5roF<Fdwn`phBCCOute5g!lFJ{`c$w$OOUNa zQ!sF;JK#ozJGwEu7aXV!V<PKLBY&q9xReDH90bYeVpJ=vndYoPB?llW3yh9fMz%C8 znqvGkTYY7sjSS^(WIa?DEe$s)_GUW|HOJP-1Ti?rq7n8~V<-Bbv(ZGy2qG4PgfDEQ z67NJG>xz|PTQr0*Ei$Za9mZS2Ah+~eOY$sH(&%y!%eVF3o>WR>7WMok=D?welx@m) z?!avRzHbL+yYwA9FhAmtphalZbqn!;!>TpX%+1QAKxNN$3QH;5a5QZW%=_<+?$Ncd zv6Ei_-(%nhA$U=$4BCa1i*~6p;Bob5>3t{vP?7ci^ue%{&vUw0$U!OEx*CL|JKsp~ zox(m4On7gBhLZ#9T>X{+nk~5F>{|!}uhGSaNxFlK;al_XGw~d_4m`(S*Mo3fywgM< zpZwropYAuCM|(HG_Qa-xmjW)(&TGL_JbcB~hhFJJy6V*BRj2-md)_V5pz;V<8XdYS cwT{v!?O&2>L++Mw@P<Li<TCJDd#%;}2gdD+Gynhq literal 2205 zcmb7FTTkOw5N@vE2?S%dU5iSq(<~}sRe}_%trSYDgqSD-;xuu(%PLaj*e6*RV_UY< zlCJnEed%L=NuT;w^{@1?bB<Y)%YwGN1kZfm+~>@<-+OO8cupGBp}rnclMJUMd`pSv zyP<2iHW^MvBkB{wz4k1d`Xxf@Dru=2QR+?Y3#10_#5ZV#j9qtZ(*sUK(m^=&Xo-IT zIQlgWJl&wA(XL(4P&f5Z?>9K3-)63maRgx4dJqr|neYw>{&|z3Z5bp8^$>q{tYBa{ zR%q$A^()4DOh&pLP$Vv6M-#^gE!QE8pgIOE?vcnQ!|r%4=5|aLW9T=Xkot~p_v<t; ze9H@6zm3pJWlY1kNK8`PyK~FTStC-6Vysk_f;=XnKcTbU3Grz-@tq?cH#2Y>|JQ${ zLj9^UtyJz4y5~R2>hcbqxR}~a_+dV;$NqQLUG`PejFUaZwin~@Sg^bB+Zt>?+;3?k z(na0J&Tj84f}^1s7*R|Su<%a;(yaH=8l>68$O)1t3euO59a+>i135`j#a#Kb(t`QY zDN{>%$hr=7M}eF|oFElp#r4<-1ag`apDqzqu9sdyem)>MgPwEcXG?^+QcC?@$Ocm< z)NkZ067uC`4_&S<{GEYJ6y+YIuPn#px#i2BFL~go(iuXeZy;yrzG>k&THzG4XD$j4 zFi!4~tP;-TdPse&M5369>zT$cK@wq=?dD+O+dOPR+JYRf94?nhZ{!tDLL<1bSJaeO z@q2Z)oWkSf+yvpLz;y<^hroS)3hO2v=@UB~{H)s(D(9HE@MjXzJXI0aw9B?K=(WyT z>Z_LciL?PZE~%@%+PNYoFe%`I({r_|iOKl8+0tHqEv8~ZFA}6@0f%KVgLy|jPMfcl zI#ROp62z=X>mYC^HB~(qS7V!9t<!8ZL?O1>=%~H62(g6=rQ5AG6fqYgYL}YQ71v@D zEG%@f9=lLly$dlfZNfVD*yUj%Vq-ysk&3aEZe(S1PJjrh5JGNt1fIgyNwrgNwyNh% z?Q*8BGCY}8sBNvOA_xn-py?<-^qL)|j-_7Gw3VucnpEL0Tv-KYEgrFGW%og#D2-Yj zZSD5b+%n#eY#3%oi>+?%1AFw~rm~s-Uz^HS`;krUf^Z+${6loVR%{hBA0Kw%2(otx z%v*d8nfEnfSv*;)5kB}YN|23S5jGgz%a&GsJ!p4SO)cY^EQk)pMC~1H;k8~gRTJ3L z%5QBu@n-+-2_3t(?u<*WKb}9_!NHZ|{^IZ>?hXG<Bz{k(@G$+6eAeJcyY&8OmtIlZ jK4VyBJ{V^C#XsDQ55`x~^_w}C4<1U6jBeU3+yeXuWdD7~ diff --git a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Wrappers.php b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Wrappers.php index e7ea1a3b95162..49f84252b6879 100644 --- a/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Wrappers.php +++ b/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Wrappers.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace GPBMetadata\Google\Protobuf; @@ -15,32 +16,7 @@ class Wrappers return; } $pool->internalAddGeneratedFile( - ' -� -google/protobuf/wrappers.protogoogle.protobuf" -DoubleValue -value (" - -FloatValue -value (" - -Int64Value -value (" -UInt64Value -value (" - -Int32Value -value (" -UInt32Value -value ( " - BoolValue -value (" -StringValue -value ( " - -BytesValue -value (B� -com.google.protobufB WrappersProtoPZ1google.golang.org/protobuf/types/known/wrapperspb��GPB�Google.Protobuf.WellKnownTypesbproto3' + "\x0A\xC7\x03\x0A\x1Egoogle/protobuf/wrappers.proto\x12\x0Fgoogle.protobuf\"\x1C\x0A\x0BDoubleValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x01\"\x1B\x0A\x0AFloatValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x02\"\x1B\x0A\x0AInt64Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x03\"\x1C\x0A\x0BUInt64Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x04\"\x1B\x0A\x0AInt32Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x05\"\x1C\x0A\x0BUInt32Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x0D\"\x1A\x0A\x09BoolValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x08\"\x1C\x0A\x0BStringValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x09\"\x1B\x0A\x0ABytesValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x0CB\x83\x01\x0A\x13com.google.protobufB\x0DWrappersProtoP\x01Z1google.golang.org/protobuf/types/known/wrapperspb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" , true); static::$is_initialized = true; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Any.php b/third_party/protobuf/php/src/Google/Protobuf/Any.php index feea41aad9c36..2f245ca2f6130 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Any.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Any.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/any.proto namespace Google\Protobuf; @@ -32,7 +33,7 @@ use Google\Protobuf\Internal\GPBUtil; * if (any.isSameTypeAs(Foo.getDefaultInstance())) { * foo = any.unpack(Foo.getDefaultInstance()); * } - * Example 3: Pack and unpack a message in Python. + * Example 3: Pack and unpack a message in Python. * foo = Foo(...) * any = Any() * any.Pack(foo) @@ -40,7 +41,7 @@ use Google\Protobuf\Internal\GPBUtil; * if any.Is(Foo.DESCRIPTOR): * any.Unpack(foo) * ... - * Example 4: Pack and unpack a message in Go + * Example 4: Pack and unpack a message in Go * foo := &pb.Foo{...} * any, err := anypb.New(foo) * if err != nil { @@ -57,25 +58,26 @@ use Google\Protobuf\Internal\GPBUtil; * in the type URL, for example "foo.bar.com/x/y.z" will yield type * name "y.z". * JSON + * ==== * The JSON representation of an `Any` value uses the regular * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: + * additional field `\@type` which contains the type URL. Example: * package google.profile; * message Person { * string first_name = 1; * string last_name = 2; * } * { - * "@type": "type.googleapis.com/google.profile.Person", + * "\@type": "type.googleapis.com/google.profile.Person", * "firstName": <string>, * "lastName": <string> * } * If the embedded message type is well-known and has a custom JSON * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` + * `value` which holds the custom JSON in addition to the `\@type` * field. Example (for message [google.protobuf.Duration][]): * { - * "@type": "type.googleapis.com/google.protobuf.Duration", + * "\@type": "type.googleapis.com/google.protobuf.Duration", * "value": "1.212s" * } * @@ -104,7 +106,8 @@ class Any extends \Google\Protobuf\Internal\AnyBase * breaking changes.) * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. * @@ -145,7 +148,8 @@ class Any extends \Google\Protobuf\Internal\AnyBase * breaking changes.) * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. * @type string $value @@ -178,7 +182,8 @@ class Any extends \Google\Protobuf\Internal\AnyBase * breaking changes.) * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. * @@ -211,7 +216,8 @@ class Any extends \Google\Protobuf\Internal\AnyBase * breaking changes.) * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. * diff --git a/third_party/protobuf/php/src/Google/Protobuf/Api.php b/third_party/protobuf/php/src/Google/Protobuf/Api.php index 3784263cbf8d2..f39e81aab63f8 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Api.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Api.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/api.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/BoolValue.php b/third_party/protobuf/php/src/Google/Protobuf/BoolValue.php index ecdbf4dcc2656..c0096c36ac78c 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/BoolValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/BoolValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `bool`. * The JSON representation for `BoolValue` is JSON `true` and `false`. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.BoolValue</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/BytesValue.php b/third_party/protobuf/php/src/Google/Protobuf/BytesValue.php index 1582e14acd903..574eed0380295 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/BytesValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/BytesValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `bytes`. * The JSON representation for `BytesValue` is JSON string. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.BytesValue</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/DoubleValue.php b/third_party/protobuf/php/src/Google/Protobuf/DoubleValue.php index b72399f460d68..740dddd9e9865 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/DoubleValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/DoubleValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `double`. * The JSON representation for `DoubleValue` is JSON number. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.DoubleValue</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/Duration.php b/third_party/protobuf/php/src/Google/Protobuf/Duration.php index 531cd50b57915..f63169b121de1 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Duration.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Duration.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/duration.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Enum.php b/third_party/protobuf/php/src/Google/Protobuf/Enum.php index 185e54e03c3e4..4befa14de5cb3 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Enum.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Enum.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf; @@ -45,6 +46,12 @@ class Enum extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code> */ protected $syntax = 0; + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field <code>string edition = 6;</code> + */ + protected $edition = ''; /** * Constructor. @@ -62,6 +69,8 @@ class Enum extends \Google\Protobuf\Internal\Message * The source context. * @type int $syntax * The source syntax. + * @type string $edition + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. * } */ public function __construct($data = NULL) { @@ -209,5 +218,31 @@ class Enum extends \Google\Protobuf\Internal\Message return $this; } + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field <code>string edition = 6;</code> + * @return string + */ + public function getEdition() + { + return $this->edition; + } + + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field <code>string edition = 6;</code> + * @param string $var + * @return $this + */ + public function setEdition($var) + { + GPBUtil::checkString($var, True); + $this->edition = $var; + + return $this; + } + } diff --git a/third_party/protobuf/php/src/Google/Protobuf/EnumValue.php b/third_party/protobuf/php/src/Google/Protobuf/EnumValue.php index 93c20f967c238..3914d285d47d7 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/EnumValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/EnumValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Field.php b/third_party/protobuf/php/src/Google/Protobuf/Field.php index ddae570c2b27b..c2b635c60d957 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Field.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Field.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Field/Cardinality.php b/third_party/protobuf/php/src/Google/Protobuf/Field/Cardinality.php index a42219957696e..72a11e37f6727 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Field/Cardinality.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Field/Cardinality.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf\Field; @@ -66,6 +67,3 @@ class Cardinality } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Cardinality::class, \Google\Protobuf\Field_Cardinality::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Field/Kind.php b/third_party/protobuf/php/src/Google/Protobuf/Field/Kind.php index 2d8dd77c1cb46..bcbfcdd19b22c 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Field/Kind.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Field/Kind.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf\Field; @@ -171,6 +172,3 @@ class Kind } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Kind::class, \Google\Protobuf\Field_Kind::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/FieldMask.php b/third_party/protobuf/php/src/Google/Protobuf/FieldMask.php index a8e5243f83079..2661c307046b6 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/FieldMask.php +++ b/third_party/protobuf/php/src/Google/Protobuf/FieldMask.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/field_mask.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/FloatValue.php b/third_party/protobuf/php/src/Google/Protobuf/FloatValue.php index 4285358d5e8c7..7bfa1aeecb602 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/FloatValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/FloatValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `float`. * The JSON representation for `FloatValue` is JSON number. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.FloatValue</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/GPBEmpty.php b/third_party/protobuf/php/src/Google/Protobuf/GPBEmpty.php index 4db69238bf618..24db6dc6770f6 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/GPBEmpty.php +++ b/third_party/protobuf/php/src/Google/Protobuf/GPBEmpty.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/empty.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Int32Value.php b/third_party/protobuf/php/src/Google/Protobuf/Int32Value.php index cfd73cdc90f50..58622cfa0b339 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Int32Value.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Int32Value.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `int32`. * The JSON representation for `Int32Value` is JSON number. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.Int32Value</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/Int64Value.php b/third_party/protobuf/php/src/Google/Protobuf/Int64Value.php index 143474fcd7cff..437cfba0ed61b 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Int64Value.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Int64Value.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `int64`. * The JSON representation for `Int64Value` is JSON string. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.Int64Value</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorPool.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorPool.php index 621e2e6b17335..4f01180d78c30 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorPool.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorPool.php @@ -20,6 +20,7 @@ class DescriptorPool private static $pool; // Map from message names to sub-maps, which are maps from field numbers to // field descriptors. + private $unique_descs = []; private $class_to_desc = []; private $class_to_enum_desc = []; private $proto_to_class = []; @@ -71,6 +72,8 @@ class DescriptorPool { $this->proto_to_class[$descriptor->getFullName()] = $descriptor->getClass(); + $this->unique_descs[$descriptor->getFullName()] = + $descriptor; $this->class_to_desc[$descriptor->getClass()] = $descriptor; $this->class_to_desc[$descriptor->getLegacyClass()] = $descriptor; $this->class_to_desc[$descriptor->getPreviouslyUnreservedClass()] = $descriptor; @@ -163,7 +166,7 @@ class DescriptorPool public function finish() { - foreach ($this->class_to_desc as $klass => $desc) { + foreach ($this->unique_descs as $klass => $desc) { $this->crossLink($desc); } unset($desc); diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto.php index 2937c5a7c5da4..6ce36334f9e54 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php index 43c33c4a91034..387c6c78b1432 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\DescriptorProto; @@ -156,6 +157,3 @@ class ExtensionRange extends \Google\Protobuf\Internal\Message } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ExtensionRange::class, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php index f099cc345abe0..63ff8604810ce 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\DescriptorProto; @@ -123,6 +124,3 @@ class ReservedRange extends \Google\Protobuf\Internal\Message } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ReservedRange::class, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php deleted file mode 100644 index c928fbe5b1d04..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\DescriptorProto\ExtensionRange instead. - * @deprecated - */ - class DescriptorProto_ExtensionRange {} -} -class_exists(DescriptorProto\ExtensionRange::class); -@trigger_error('Google\Protobuf\Internal\DescriptorProto_ExtensionRange is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\DescriptorProto\ExtensionRange instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php deleted file mode 100644 index e49e945f9745a..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\DescriptorProto\ReservedRange instead. - * @deprecated - */ - class DescriptorProto_ReservedRange {} -} -class_exists(DescriptorProto\ReservedRange::class); -@trigger_error('Google\Protobuf\Internal\DescriptorProto_ReservedRange is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\DescriptorProto\ReservedRange instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/Edition.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/Edition.php new file mode 100644 index 0000000000000..7493ee1b8a624 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/Edition.php @@ -0,0 +1,122 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal; + +use UnexpectedValueException; + +/** + * The full set of known editions. + * + * Protobuf type <code>google.protobuf.Edition</code> + */ +class Edition +{ + /** + * A placeholder for an unknown edition value. + * + * Generated from protobuf enum <code>EDITION_UNKNOWN = 0;</code> + */ + const EDITION_UNKNOWN = 0; + /** + * A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + * + * Generated from protobuf enum <code>EDITION_LEGACY = 900;</code> + */ + const EDITION_LEGACY = 900; + /** + * Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + * + * Generated from protobuf enum <code>EDITION_PROTO2 = 998;</code> + */ + const EDITION_PROTO2 = 998; + /** + * Generated from protobuf enum <code>EDITION_PROTO3 = 999;</code> + */ + const EDITION_PROTO3 = 999; + /** + * Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + * + * Generated from protobuf enum <code>EDITION_2023 = 1000;</code> + */ + const EDITION_2023 = 1000; + /** + * Generated from protobuf enum <code>EDITION_2024 = 1001;</code> + */ + const EDITION_2024 = 1001; + /** + * Placeholder editions for testing feature resolution. These should not be + * used or relied on outside of tests. + * + * Generated from protobuf enum <code>EDITION_1_TEST_ONLY = 1;</code> + */ + const EDITION_1_TEST_ONLY = 1; + /** + * Generated from protobuf enum <code>EDITION_2_TEST_ONLY = 2;</code> + */ + const EDITION_2_TEST_ONLY = 2; + /** + * Generated from protobuf enum <code>EDITION_99997_TEST_ONLY = 99997;</code> + */ + const EDITION_99997_TEST_ONLY = 99997; + /** + * Generated from protobuf enum <code>EDITION_99998_TEST_ONLY = 99998;</code> + */ + const EDITION_99998_TEST_ONLY = 99998; + /** + * Generated from protobuf enum <code>EDITION_99999_TEST_ONLY = 99999;</code> + */ + const EDITION_99999_TEST_ONLY = 99999; + /** + * Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + * + * Generated from protobuf enum <code>EDITION_MAX = 2147483647;</code> + */ + const EDITION_MAX = 2147483647; + + private static $valueToName = [ + self::EDITION_UNKNOWN => 'EDITION_UNKNOWN', + self::EDITION_LEGACY => 'EDITION_LEGACY', + self::EDITION_PROTO2 => 'EDITION_PROTO2', + self::EDITION_PROTO3 => 'EDITION_PROTO3', + self::EDITION_2023 => 'EDITION_2023', + self::EDITION_2024 => 'EDITION_2024', + self::EDITION_1_TEST_ONLY => 'EDITION_1_TEST_ONLY', + self::EDITION_2_TEST_ONLY => 'EDITION_2_TEST_ONLY', + self::EDITION_99997_TEST_ONLY => 'EDITION_99997_TEST_ONLY', + self::EDITION_99998_TEST_ONLY => 'EDITION_99998_TEST_ONLY', + self::EDITION_99999_TEST_ONLY => 'EDITION_99999_TEST_ONLY', + self::EDITION_MAX => 'EDITION_MAX', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php index cb2a42ae37517..d0d22a2022dae 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php index 7282fccb0788c..8c33acc3d51c8 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\EnumDescriptorProto; @@ -125,6 +126,3 @@ class EnumReservedRange extends \Google\Protobuf\Internal\Message } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(EnumReservedRange::class, \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php deleted file mode 100644 index b1b59ed91f48b..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange instead. - * @deprecated - */ - class EnumDescriptorProto_EnumReservedRange {} -} -class_exists(EnumDescriptorProto\EnumReservedRange::class); -@trigger_error('Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumOptions.php index 80cb7f275a288..71a952f85129b 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -43,6 +44,15 @@ class EnumOptions extends \Google\Protobuf\Internal\Message * @deprecated */ protected $deprecated_legacy_json_field_conflicts = null; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 7;</code> + */ + protected $features = null; /** * The parser stores options it doesn't recognize here. See above. * @@ -71,6 +81,11 @@ class EnumOptions extends \Google\Protobuf\Internal\Message * well. * TODO Remove this legacy behavior once downstream teams have * had time to migrate. + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. See above. * } @@ -174,13 +189,17 @@ class EnumOptions extends \Google\Protobuf\Internal\Message */ public function getDeprecatedLegacyJsonFieldConflicts() { - @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + if (isset($this->deprecated_legacy_json_field_conflicts)) { + @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + } return isset($this->deprecated_legacy_json_field_conflicts) ? $this->deprecated_legacy_json_field_conflicts : false; } public function hasDeprecatedLegacyJsonFieldConflicts() { - @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + if (isset($this->deprecated_legacy_json_field_conflicts)) { + @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + } return isset($this->deprecated_legacy_json_field_conflicts); } @@ -212,6 +231,48 @@ class EnumOptions extends \Google\Protobuf\Internal\Message return $this; } + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 7;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 7;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + /** * The parser stores options it doesn't recognize here. See above. * diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php index 0feaea6f182f4..822e1de59bdde 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueOptions.php index 2db7fceea6406..76af9882aca34 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -24,6 +25,29 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>optional bool deprecated = 1 [default = false];</code> */ protected $deprecated = null; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 2;</code> + */ + protected $features = null; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + * + * Generated from protobuf field <code>optional bool debug_redact = 3 [default = false];</code> + */ + protected $debug_redact = null; + /** + * Information about the support window of a feature value. + * + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4;</code> + */ + protected $feature_support = null; /** * The parser stores options it doesn't recognize here. See above. * @@ -42,6 +66,17 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message * Depending on the target platform, this can emit Deprecated annotations * for the enum value, or it will be completely ignored; in the very least, * this is a formalization for deprecating enum values. + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * @type bool $debug_redact + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + * @type \Google\Protobuf\Internal\FieldOptions\FeatureSupport $feature_support + * Information about the support window of a feature value. * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. See above. * } @@ -93,6 +128,124 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message return $this; } + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 2;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 2;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + * + * Generated from protobuf field <code>optional bool debug_redact = 3 [default = false];</code> + * @return bool + */ + public function getDebugRedact() + { + return isset($this->debug_redact) ? $this->debug_redact : false; + } + + public function hasDebugRedact() + { + return isset($this->debug_redact); + } + + public function clearDebugRedact() + { + unset($this->debug_redact); + } + + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + * + * Generated from protobuf field <code>optional bool debug_redact = 3 [default = false];</code> + * @param bool $var + * @return $this + */ + public function setDebugRedact($var) + { + GPBUtil::checkBool($var); + $this->debug_redact = $var; + + return $this; + } + + /** + * Information about the support window of a feature value. + * + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4;</code> + * @return \Google\Protobuf\Internal\FieldOptions\FeatureSupport|null + */ + public function getFeatureSupport() + { + return $this->feature_support; + } + + public function hasFeatureSupport() + { + return isset($this->feature_support); + } + + public function clearFeatureSupport() + { + unset($this->feature_support); + } + + /** + * Information about the support window of a feature value. + * + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4;</code> + * @param \Google\Protobuf\Internal\FieldOptions\FeatureSupport $var + * @return $this + */ + public function setFeatureSupport($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions\FeatureSupport::class); + $this->feature_support = $var; + + return $this; + } + /** * The parser stores options it doesn't recognize here. See above. * diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php index 245173c3d0e5f..2a969afb47737 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -21,6 +22,28 @@ class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> */ private $uninterpreted_option; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + * + * Generated from protobuf field <code>repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE];</code> + */ + private $declaration; + /** + * Any features defined in the specific edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 50;</code> + */ + protected $features = null; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + * + * Generated from protobuf field <code>optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE];</code> + */ + protected $verification = null; /** * Constructor. @@ -30,6 +53,16 @@ class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message * * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. See above. + * @type array<\Google\Protobuf\Internal\ExtensionRangeOptions\Declaration>|\Google\Protobuf\Internal\RepeatedField $declaration + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * @type int $verification + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. * } */ public function __construct($data = NULL) { @@ -63,5 +96,111 @@ class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message return $this; } + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + * + * Generated from protobuf field <code>repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE];</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeclaration() + { + return $this->declaration; + } + + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + * + * Generated from protobuf field <code>repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE];</code> + * @param array<\Google\Protobuf\Internal\ExtensionRangeOptions\Declaration>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeclaration($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ExtensionRangeOptions\Declaration::class); + $this->declaration = $arr; + + return $this; + } + + /** + * Any features defined in the specific edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 50;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 50;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + * + * Generated from protobuf field <code>optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE];</code> + * @return int + */ + public function getVerification() + { + return isset($this->verification) ? $this->verification : 0; + } + + public function hasVerification() + { + return isset($this->verification); + } + + public function clearVerification() + { + unset($this->verification); + } + + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + * + * Generated from protobuf field <code>optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE];</code> + * @param int $var + * @return $this + */ + public function setVerification($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\ExtensionRangeOptions\VerificationState::class); + $this->verification = $var; + + return $this; + } + } diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/Declaration.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/Declaration.php new file mode 100644 index 0000000000000..6e54295e2e197 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/Declaration.php @@ -0,0 +1,278 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\ExtensionRangeOptions; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>google.protobuf.ExtensionRangeOptions.Declaration</code> + */ +class Declaration extends \Google\Protobuf\Internal\Message +{ + /** + * The extension number declared within the extension range. + * + * Generated from protobuf field <code>optional int32 number = 1;</code> + */ + protected $number = null; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + * + * Generated from protobuf field <code>optional string full_name = 2;</code> + */ + protected $full_name = null; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + * + * Generated from protobuf field <code>optional string type = 3;</code> + */ + protected $type = null; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + * + * Generated from protobuf field <code>optional bool reserved = 5;</code> + */ + protected $reserved = null; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + * + * Generated from protobuf field <code>optional bool repeated = 6;</code> + */ + protected $repeated = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $number + * The extension number declared within the extension range. + * @type string $full_name + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + * @type string $type + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + * @type bool $reserved + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + * @type bool $repeated + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * The extension number declared within the extension range. + * + * Generated from protobuf field <code>optional int32 number = 1;</code> + * @return int + */ + public function getNumber() + { + return isset($this->number) ? $this->number : 0; + } + + public function hasNumber() + { + return isset($this->number); + } + + public function clearNumber() + { + unset($this->number); + } + + /** + * The extension number declared within the extension range. + * + * Generated from protobuf field <code>optional int32 number = 1;</code> + * @param int $var + * @return $this + */ + public function setNumber($var) + { + GPBUtil::checkInt32($var); + $this->number = $var; + + return $this; + } + + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + * + * Generated from protobuf field <code>optional string full_name = 2;</code> + * @return string + */ + public function getFullName() + { + return isset($this->full_name) ? $this->full_name : ''; + } + + public function hasFullName() + { + return isset($this->full_name); + } + + public function clearFullName() + { + unset($this->full_name); + } + + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + * + * Generated from protobuf field <code>optional string full_name = 2;</code> + * @param string $var + * @return $this + */ + public function setFullName($var) + { + GPBUtil::checkString($var, True); + $this->full_name = $var; + + return $this; + } + + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + * + * Generated from protobuf field <code>optional string type = 3;</code> + * @return string + */ + public function getType() + { + return isset($this->type) ? $this->type : ''; + } + + public function hasType() + { + return isset($this->type); + } + + public function clearType() + { + unset($this->type); + } + + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + * + * Generated from protobuf field <code>optional string type = 3;</code> + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + * + * Generated from protobuf field <code>optional bool reserved = 5;</code> + * @return bool + */ + public function getReserved() + { + return isset($this->reserved) ? $this->reserved : false; + } + + public function hasReserved() + { + return isset($this->reserved); + } + + public function clearReserved() + { + unset($this->reserved); + } + + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + * + * Generated from protobuf field <code>optional bool reserved = 5;</code> + * @param bool $var + * @return $this + */ + public function setReserved($var) + { + GPBUtil::checkBool($var); + $this->reserved = $var; + + return $this; + } + + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + * + * Generated from protobuf field <code>optional bool repeated = 6;</code> + * @return bool + */ + public function getRepeated() + { + return isset($this->repeated) ? $this->repeated : false; + } + + public function hasRepeated() + { + return isset($this->repeated); + } + + public function clearRepeated() + { + unset($this->repeated); + } + + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + * + * Generated from protobuf field <code>optional bool repeated = 6;</code> + * @param bool $var + * @return $this + */ + public function setRepeated($var) + { + GPBUtil::checkBool($var); + $this->repeated = $var; + + return $this; + } + +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/VerificationState.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/VerificationState.php new file mode 100644 index 0000000000000..a995d4b19102e --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/ExtensionRangeOptions/VerificationState.php @@ -0,0 +1,53 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\ExtensionRangeOptions; + +use UnexpectedValueException; + +/** + * The verification state of the extension range. + * + * Protobuf type <code>google.protobuf.ExtensionRangeOptions.VerificationState</code> + */ +class VerificationState +{ + /** + * All the extensions of the range must be declared. + * + * Generated from protobuf enum <code>DECLARATION = 0;</code> + */ + const DECLARATION = 0; + /** + * Generated from protobuf enum <code>UNVERIFIED = 1;</code> + */ + const UNVERIFIED = 1; + + private static $valueToName = [ + self::DECLARATION => 'DECLARATION', + self::UNVERIFIED => 'UNVERIFIED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet.php new file mode 100644 index 0000000000000..bf0b989ae1a03 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet.php @@ -0,0 +1,300 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. + * + * Generated from protobuf message <code>google.protobuf.FeatureSet</code> + */ +class FeatureSet extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + */ + protected $field_presence = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + */ + protected $enum_type = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + */ + protected $repeated_field_encoding = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + */ + protected $utf8_validation = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + */ + protected $message_encoding = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + */ + protected $json_format = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = {</code> + */ + protected $enforce_naming_style = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $field_presence + * @type int $enum_type + * @type int $repeated_field_encoding + * @type int $utf8_validation + * @type int $message_encoding + * @type int $json_format + * @type int $enforce_naming_style + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @return int + */ + public function getFieldPresence() + { + return isset($this->field_presence) ? $this->field_presence : 0; + } + + public function hasFieldPresence() + { + return isset($this->field_presence); + } + + public function clearFieldPresence() + { + unset($this->field_presence); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @param int $var + * @return $this + */ + public function setFieldPresence($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FeatureSet\FieldPresence::class); + $this->field_presence = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @return int + */ + public function getEnumType() + { + return isset($this->enum_type) ? $this->enum_type : 0; + } + + public function hasEnumType() + { + return isset($this->enum_type); + } + + public function clearEnumType() + { + unset($this->enum_type); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @param int $var + * @return $this + */ + public function setEnumType($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FeatureSet\EnumType::class); + $this->enum_type = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @return int + */ + public function getRepeatedFieldEncoding() + { + return isset($this->repeated_field_encoding) ? $this->repeated_field_encoding : 0; + } + + public function hasRepeatedFieldEncoding() + { + return isset($this->repeated_field_encoding); + } + + public function clearRepeatedFieldEncoding() + { + unset($this->repeated_field_encoding); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @param int $var + * @return $this + */ + public function setRepeatedFieldEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FeatureSet\RepeatedFieldEncoding::class); + $this->repeated_field_encoding = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @return int + */ + public function getUtf8Validation() + { + return isset($this->utf8_validation) ? $this->utf8_validation : 0; + } + + public function hasUtf8Validation() + { + return isset($this->utf8_validation); + } + + public function clearUtf8Validation() + { + unset($this->utf8_validation); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @param int $var + * @return $this + */ + public function setUtf8Validation($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FeatureSet\Utf8Validation::class); + $this->utf8_validation = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @return int + */ + public function getMessageEncoding() + { + return isset($this->message_encoding) ? $this->message_encoding : 0; + } + + public function hasMessageEncoding() + { + return isset($this->message_encoding); + } + + public function clearMessageEncoding() + { + unset($this->message_encoding); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @param int $var + * @return $this + */ + public function setMessageEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FeatureSet\MessageEncoding::class); + $this->message_encoding = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @return int + */ + public function getJsonFormat() + { + return isset($this->json_format) ? $this->json_format : 0; + } + + public function hasJsonFormat() + { + return isset($this->json_format); + } + + public function clearJsonFormat() + { + unset($this->json_format); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = {</code> + * @param int $var + * @return $this + */ + public function setJsonFormat($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FeatureSet\JsonFormat::class); + $this->json_format = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = {</code> + * @return int + */ + public function getEnforceNamingStyle() + { + return isset($this->enforce_naming_style) ? $this->enforce_naming_style : 0; + } + + public function hasEnforceNamingStyle() + { + return isset($this->enforce_naming_style); + } + + public function clearEnforceNamingStyle() + { + unset($this->enforce_naming_style); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = {</code> + * @param int $var + * @return $this + */ + public function setEnforceNamingStyle($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FeatureSet\EnforceNamingStyle::class); + $this->enforce_naming_style = $var; + + return $this; + } + +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnforceNamingStyle.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnforceNamingStyle.php new file mode 100644 index 0000000000000..8fbb98b82dd19 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnforceNamingStyle.php @@ -0,0 +1,54 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSet; + +use UnexpectedValueException; + +/** + * Protobuf type <code>google.protobuf.FeatureSet.EnforceNamingStyle</code> + */ +class EnforceNamingStyle +{ + /** + * Generated from protobuf enum <code>ENFORCE_NAMING_STYLE_UNKNOWN = 0;</code> + */ + const ENFORCE_NAMING_STYLE_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>STYLE2024 = 1;</code> + */ + const STYLE2024 = 1; + /** + * Generated from protobuf enum <code>STYLE_LEGACY = 2;</code> + */ + const STYLE_LEGACY = 2; + + private static $valueToName = [ + self::ENFORCE_NAMING_STYLE_UNKNOWN => 'ENFORCE_NAMING_STYLE_UNKNOWN', + self::STYLE2024 => 'STYLE2024', + self::STYLE_LEGACY => 'STYLE_LEGACY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnumType.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnumType.php new file mode 100644 index 0000000000000..81e7a083fda10 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/EnumType.php @@ -0,0 +1,54 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSet; + +use UnexpectedValueException; + +/** + * Protobuf type <code>google.protobuf.FeatureSet.EnumType</code> + */ +class EnumType +{ + /** + * Generated from protobuf enum <code>ENUM_TYPE_UNKNOWN = 0;</code> + */ + const ENUM_TYPE_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>OPEN = 1;</code> + */ + const OPEN = 1; + /** + * Generated from protobuf enum <code>CLOSED = 2;</code> + */ + const CLOSED = 2; + + private static $valueToName = [ + self::ENUM_TYPE_UNKNOWN => 'ENUM_TYPE_UNKNOWN', + self::OPEN => 'OPEN', + self::CLOSED => 'CLOSED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/FieldPresence.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/FieldPresence.php new file mode 100644 index 0000000000000..d992f059b72de --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/FieldPresence.php @@ -0,0 +1,59 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSet; + +use UnexpectedValueException; + +/** + * Protobuf type <code>google.protobuf.FeatureSet.FieldPresence</code> + */ +class FieldPresence +{ + /** + * Generated from protobuf enum <code>FIELD_PRESENCE_UNKNOWN = 0;</code> + */ + const FIELD_PRESENCE_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>EXPLICIT = 1;</code> + */ + const EXPLICIT = 1; + /** + * Generated from protobuf enum <code>IMPLICIT = 2;</code> + */ + const IMPLICIT = 2; + /** + * Generated from protobuf enum <code>LEGACY_REQUIRED = 3;</code> + */ + const LEGACY_REQUIRED = 3; + + private static $valueToName = [ + self::FIELD_PRESENCE_UNKNOWN => 'FIELD_PRESENCE_UNKNOWN', + self::EXPLICIT => 'EXPLICIT', + self::IMPLICIT => 'IMPLICIT', + self::LEGACY_REQUIRED => 'LEGACY_REQUIRED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/JsonFormat.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/JsonFormat.php new file mode 100644 index 0000000000000..c88e840313c17 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/JsonFormat.php @@ -0,0 +1,54 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSet; + +use UnexpectedValueException; + +/** + * Protobuf type <code>google.protobuf.FeatureSet.JsonFormat</code> + */ +class JsonFormat +{ + /** + * Generated from protobuf enum <code>JSON_FORMAT_UNKNOWN = 0;</code> + */ + const JSON_FORMAT_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>ALLOW = 1;</code> + */ + const ALLOW = 1; + /** + * Generated from protobuf enum <code>LEGACY_BEST_EFFORT = 2;</code> + */ + const LEGACY_BEST_EFFORT = 2; + + private static $valueToName = [ + self::JSON_FORMAT_UNKNOWN => 'JSON_FORMAT_UNKNOWN', + self::ALLOW => 'ALLOW', + self::LEGACY_BEST_EFFORT => 'LEGACY_BEST_EFFORT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/MessageEncoding.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/MessageEncoding.php new file mode 100644 index 0000000000000..6827fe3cebaba --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/MessageEncoding.php @@ -0,0 +1,54 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSet; + +use UnexpectedValueException; + +/** + * Protobuf type <code>google.protobuf.FeatureSet.MessageEncoding</code> + */ +class MessageEncoding +{ + /** + * Generated from protobuf enum <code>MESSAGE_ENCODING_UNKNOWN = 0;</code> + */ + const MESSAGE_ENCODING_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>LENGTH_PREFIXED = 1;</code> + */ + const LENGTH_PREFIXED = 1; + /** + * Generated from protobuf enum <code>DELIMITED = 2;</code> + */ + const DELIMITED = 2; + + private static $valueToName = [ + self::MESSAGE_ENCODING_UNKNOWN => 'MESSAGE_ENCODING_UNKNOWN', + self::LENGTH_PREFIXED => 'LENGTH_PREFIXED', + self::DELIMITED => 'DELIMITED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/RepeatedFieldEncoding.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/RepeatedFieldEncoding.php new file mode 100644 index 0000000000000..f3ea0c843841b --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/RepeatedFieldEncoding.php @@ -0,0 +1,54 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSet; + +use UnexpectedValueException; + +/** + * Protobuf type <code>google.protobuf.FeatureSet.RepeatedFieldEncoding</code> + */ +class RepeatedFieldEncoding +{ + /** + * Generated from protobuf enum <code>REPEATED_FIELD_ENCODING_UNKNOWN = 0;</code> + */ + const REPEATED_FIELD_ENCODING_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>PACKED = 1;</code> + */ + const PACKED = 1; + /** + * Generated from protobuf enum <code>EXPANDED = 2;</code> + */ + const EXPANDED = 2; + + private static $valueToName = [ + self::REPEATED_FIELD_ENCODING_UNKNOWN => 'REPEATED_FIELD_ENCODING_UNKNOWN', + self::PACKED => 'PACKED', + self::EXPANDED => 'EXPANDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/Utf8Validation.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/Utf8Validation.php new file mode 100644 index 0000000000000..8286c45c605df --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSet/Utf8Validation.php @@ -0,0 +1,54 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSet; + +use UnexpectedValueException; + +/** + * Protobuf type <code>google.protobuf.FeatureSet.Utf8Validation</code> + */ +class Utf8Validation +{ + /** + * Generated from protobuf enum <code>UTF8_VALIDATION_UNKNOWN = 0;</code> + */ + const UTF8_VALIDATION_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>VERIFY = 2;</code> + */ + const VERIFY = 2; + /** + * Generated from protobuf enum <code>NONE = 3;</code> + */ + const NONE = 3; + + private static $valueToName = [ + self::UTF8_VALIDATION_UNKNOWN => 'UTF8_VALIDATION_UNKNOWN', + self::VERIFY => 'VERIFY', + self::NONE => 'NONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults.php new file mode 100644 index 0000000000000..765c292a2615e --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults.php @@ -0,0 +1,162 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + * + * Generated from protobuf message <code>google.protobuf.FeatureSetDefaults</code> + */ +class FeatureSetDefaults extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1;</code> + */ + private $defaults; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition minimum_edition = 4;</code> + */ + protected $minimum_edition = null; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition maximum_edition = 5;</code> + */ + protected $maximum_edition = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Protobuf\Internal\FeatureSetDefaults\FeatureSetEditionDefault>|\Google\Protobuf\Internal\RepeatedField $defaults + * @type int $minimum_edition + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + * @type int $maximum_edition + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field <code>repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1;</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDefaults() + { + return $this->defaults; + } + + /** + * Generated from protobuf field <code>repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1;</code> + * @param array<\Google\Protobuf\Internal\FeatureSetDefaults\FeatureSetEditionDefault>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDefaults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FeatureSetDefaults\FeatureSetEditionDefault::class); + $this->defaults = $arr; + + return $this; + } + + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition minimum_edition = 4;</code> + * @return int + */ + public function getMinimumEdition() + { + return isset($this->minimum_edition) ? $this->minimum_edition : 0; + } + + public function hasMinimumEdition() + { + return isset($this->minimum_edition); + } + + public function clearMinimumEdition() + { + unset($this->minimum_edition); + } + + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition minimum_edition = 4;</code> + * @param int $var + * @return $this + */ + public function setMinimumEdition($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); + $this->minimum_edition = $var; + + return $this; + } + + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition maximum_edition = 5;</code> + * @return int + */ + public function getMaximumEdition() + { + return isset($this->maximum_edition) ? $this->maximum_edition : 0; + } + + public function hasMaximumEdition() + { + return isset($this->maximum_edition); + } + + public function clearMaximumEdition() + { + unset($this->maximum_edition); + } + + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition maximum_edition = 5;</code> + * @param int $var + * @return $this + */ + public function setMaximumEdition($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); + $this->maximum_edition = $var; + + return $this; + } + +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults/FeatureSetEditionDefault.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults/FeatureSetEditionDefault.php new file mode 100644 index 0000000000000..1b6259a5d94f6 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FeatureSetDefaults/FeatureSetEditionDefault.php @@ -0,0 +1,164 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FeatureSetDefaults; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + * + * Generated from protobuf message <code>google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault</code> + */ +class FeatureSetEditionDefault extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 3;</code> + */ + protected $edition = null; + /** + * Defaults of features that can be overridden in this edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet overridable_features = 4;</code> + */ + protected $overridable_features = null; + /** + * Defaults of features that can't be overridden in this edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet fixed_features = 5;</code> + */ + protected $fixed_features = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $edition + * @type \Google\Protobuf\Internal\FeatureSet $overridable_features + * Defaults of features that can be overridden in this edition. + * @type \Google\Protobuf\Internal\FeatureSet $fixed_features + * Defaults of features that can't be overridden in this edition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 3;</code> + * @return int + */ + public function getEdition() + { + return isset($this->edition) ? $this->edition : 0; + } + + public function hasEdition() + { + return isset($this->edition); + } + + public function clearEdition() + { + unset($this->edition); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 3;</code> + * @param int $var + * @return $this + */ + public function setEdition($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); + $this->edition = $var; + + return $this; + } + + /** + * Defaults of features that can be overridden in this edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet overridable_features = 4;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getOverridableFeatures() + { + return $this->overridable_features; + } + + public function hasOverridableFeatures() + { + return isset($this->overridable_features); + } + + public function clearOverridableFeatures() + { + unset($this->overridable_features); + } + + /** + * Defaults of features that can be overridden in this edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet overridable_features = 4;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setOverridableFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->overridable_features = $var; + + return $this; + } + + /** + * Defaults of features that can't be overridden in this edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet fixed_features = 5;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFixedFeatures() + { + return $this->fixed_features; + } + + public function hasFixedFeatures() + { + return isset($this->fixed_features); + } + + public function clearFixedFeatures() + { + unset($this->fixed_features); + } + + /** + * Defaults of features that can't be overridden in this edition. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet fixed_features = 5;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFixedFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->fixed_features = $var; + + return $this; + } + +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php index 5e99bff173c93..e493f53eb4dbd 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -85,12 +86,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still * indicates the semantic detail of whether the user wrote "optional" or not. @@ -144,12 +145,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message * @type bool $proto3_optional * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still * indicates the semantic detail of whether the user wrote "optional" or not. @@ -540,12 +541,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still * indicates the semantic detail of whether the user wrote "optional" or not. @@ -578,12 +579,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message /** * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still * indicates the semantic detail of whether the user wrote "optional" or not. diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php index a54b228f1bfb3..eb091e397f04f 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\FieldDescriptorProto; @@ -17,19 +18,23 @@ class Label * Generated from protobuf enum <code>LABEL_OPTIONAL = 1;</code> */ const LABEL_OPTIONAL = 1; - /** - * Generated from protobuf enum <code>LABEL_REQUIRED = 2;</code> - */ - const LABEL_REQUIRED = 2; /** * Generated from protobuf enum <code>LABEL_REPEATED = 3;</code> */ const LABEL_REPEATED = 3; + /** + * The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + * + * Generated from protobuf enum <code>LABEL_REQUIRED = 2;</code> + */ + const LABEL_REQUIRED = 2; private static $valueToName = [ self::LABEL_OPTIONAL => 'LABEL_OPTIONAL', - self::LABEL_REQUIRED => 'LABEL_REQUIRED', self::LABEL_REPEATED => 'LABEL_REPEATED', + self::LABEL_REQUIRED => 'LABEL_REQUIRED', ]; public static function name($value) @@ -53,6 +58,3 @@ class Label } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Label::class, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php index 6072e9990fb30..80c8395ba4ab8 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\FieldDescriptorProto; @@ -58,9 +59,10 @@ class Type const TYPE_STRING = 9; /** * Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 + * Group type is deprecated and not supported after google.protobuf. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. * * Generated from protobuf enum <code>TYPE_GROUP = 10;</code> */ @@ -148,6 +150,3 @@ class Type } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Type::class, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php deleted file mode 100644 index 218a846e1e764..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\FieldDescriptorProto\Label instead. - * @deprecated - */ - class FieldDescriptorProto_Label {} -} -class_exists(FieldDescriptorProto\Label::class); -@trigger_error('Google\Protobuf\Internal\FieldDescriptorProto_Label is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldDescriptorProto\Label instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php deleted file mode 100644 index fd8d449a57205..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\FieldDescriptorProto\Type instead. - * @deprecated - */ - class FieldDescriptorProto_Type {} -} -class_exists(FieldDescriptorProto\Type::class); -@trigger_error('Google\Protobuf\Internal\FieldDescriptorProto_Type is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldDescriptorProto\Type instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions.php index 6f1d54b7ee245..69b96b2596f81 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -16,10 +17,13 @@ use Google\Protobuf\Internal\GPBUtil; class FieldOptions extends \Google\Protobuf\Internal\Message { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. * * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code> */ @@ -28,8 +32,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * The packed option can be enabled for repeated primitive fields to enable * a more efficient representation on the wire. Rather than repeatedly * writing the tag and type for each element, the entire array is encoded as - * a single length-prefixed blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. * * Generated from protobuf field <code>optional bool packed = 2;</code> */ @@ -64,18 +70,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * interface is not affected by this option; const methods remain safe to * call from multiple threads concurrently, while non-const methods continue * to require exclusive access. - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * As of May 2022, lazy verifies the contents of the byte stream during - * parsing. An invalid byte stream will cause the overall parsing to fail. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). * * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code> */ @@ -103,6 +102,38 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>optional bool weak = 10 [default = false];</code> */ protected $weak = null; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + * + * Generated from protobuf field <code>optional bool debug_redact = 16 [default = false];</code> + */ + protected $debug_redact = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.OptionRetention retention = 17;</code> + */ + protected $retention = null; + /** + * Generated from protobuf field <code>repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19;</code> + */ + private $targets; + /** + * Generated from protobuf field <code>repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20;</code> + */ + private $edition_defaults; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 21;</code> + */ + protected $features = null; + /** + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22;</code> + */ + protected $feature_support = null; /** * The parser stores options it doesn't recognize here. See above. * @@ -117,16 +148,21 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type int $ctype + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. * @type bool $packed * The packed option can be enabled for repeated primitive fields to enable * a more efficient representation on the wire. Rather than repeatedly * writing the tag and type for each element, the entire array is encoded as - * a single length-prefixed blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. * @type int $jstype * The jstype option determines the JavaScript type used for values of the * field. The option is permitted only for 64 bit integral and fixed types @@ -153,18 +189,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * interface is not affected by this option; const methods remain safe to * call from multiple threads concurrently, while non-const methods continue * to require exclusive access. - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * As of May 2022, lazy verifies the contents of the byte stream during - * parsing. An invalid byte stream will cause the overall parsing to fail. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). * @type bool $unverified_lazy * unverified_lazy does no correctness checks on the byte stream. This should * only be used where lazy with verification is prohibitive for performance @@ -176,6 +205,18 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * is a formalization for deprecating fields. * @type bool $weak * For Google-internal migration only. Do not use. + * @type bool $debug_redact + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + * @type int $retention + * @type array<int>|\Google\Protobuf\Internal\RepeatedField $targets + * @type array<\Google\Protobuf\Internal\FieldOptions\EditionDefault>|\Google\Protobuf\Internal\RepeatedField $edition_defaults + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * @type \Google\Protobuf\Internal\FieldOptions\FeatureSupport $feature_support * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. See above. * } @@ -186,10 +227,13 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. * * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code> * @return int @@ -210,10 +254,13 @@ class FieldOptions extends \Google\Protobuf\Internal\Message } /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. * * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code> * @param int $var @@ -231,8 +278,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * The packed option can be enabled for repeated primitive fields to enable * a more efficient representation on the wire. Rather than repeatedly * writing the tag and type for each element, the entire array is encoded as - * a single length-prefixed blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. * * Generated from protobuf field <code>optional bool packed = 2;</code> * @return bool @@ -257,7 +306,9 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * a more efficient representation on the wire. Rather than repeatedly * writing the tag and type for each element, the entire array is encoded as * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. * * Generated from protobuf field <code>optional bool packed = 2;</code> * @param bool $var @@ -340,18 +391,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * interface is not affected by this option; const methods remain safe to * call from multiple threads concurrently, while non-const methods continue * to require exclusive access. - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * As of May 2022, lazy verifies the contents of the byte stream during - * parsing. An invalid byte stream will cause the overall parsing to fail. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). * * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code> * @return bool @@ -386,18 +430,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * interface is not affected by this option; const methods remain safe to * call from multiple threads concurrently, while non-const methods continue * to require exclusive access. - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * As of May 2022, lazy verifies the contents of the byte stream during - * parsing. An invalid byte stream will cause the overall parsing to fail. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). * * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code> * @param bool $var @@ -529,6 +566,194 @@ class FieldOptions extends \Google\Protobuf\Internal\Message return $this; } + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + * + * Generated from protobuf field <code>optional bool debug_redact = 16 [default = false];</code> + * @return bool + */ + public function getDebugRedact() + { + return isset($this->debug_redact) ? $this->debug_redact : false; + } + + public function hasDebugRedact() + { + return isset($this->debug_redact); + } + + public function clearDebugRedact() + { + unset($this->debug_redact); + } + + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + * + * Generated from protobuf field <code>optional bool debug_redact = 16 [default = false];</code> + * @param bool $var + * @return $this + */ + public function setDebugRedact($var) + { + GPBUtil::checkBool($var); + $this->debug_redact = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.OptionRetention retention = 17;</code> + * @return int + */ + public function getRetention() + { + return isset($this->retention) ? $this->retention : 0; + } + + public function hasRetention() + { + return isset($this->retention); + } + + public function clearRetention() + { + unset($this->retention); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.OptionRetention retention = 17;</code> + * @param int $var + * @return $this + */ + public function setRetention($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions\OptionRetention::class); + $this->retention = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19;</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargets() + { + return $this->targets; + } + + /** + * Generated from protobuf field <code>repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19;</code> + * @param array<int>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Protobuf\Internal\FieldOptions\OptionTargetType::class); + $this->targets = $arr; + + return $this; + } + + /** + * Generated from protobuf field <code>repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20;</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEditionDefaults() + { + return $this->edition_defaults; + } + + /** + * Generated from protobuf field <code>repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20;</code> + * @param array<\Google\Protobuf\Internal\FieldOptions\EditionDefault>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEditionDefaults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldOptions\EditionDefault::class); + $this->edition_defaults = $arr; + + return $this; + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 21;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 21;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22;</code> + * @return \Google\Protobuf\Internal\FieldOptions\FeatureSupport|null + */ + public function getFeatureSupport() + { + return $this->feature_support; + } + + public function hasFeatureSupport() + { + return isset($this->feature_support); + } + + public function clearFeatureSupport() + { + unset($this->feature_support); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22;</code> + * @param \Google\Protobuf\Internal\FieldOptions\FeatureSupport $var + * @return $this + */ + public function setFeatureSupport($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions\FeatureSupport::class); + $this->feature_support = $var; + + return $this; + } + /** * The parser stores options it doesn't recognize here. See above. * diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/CType.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/CType.php index ba9eb4adb8f9a..a248777291ff3 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/CType.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/CType.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\FieldOptions; @@ -18,6 +19,13 @@ class CType */ const STRING = 0; /** + * The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + * * Generated from protobuf enum <code>CORD = 1;</code> */ const CORD = 1; @@ -53,6 +61,3 @@ class CType } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(CType::class, \Google\Protobuf\Internal\FieldOptions_CType::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/EditionDefault.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/EditionDefault.php new file mode 100644 index 0000000000000..5acc9938afe56 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/EditionDefault.php @@ -0,0 +1,115 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FieldOptions; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>google.protobuf.FieldOptions.EditionDefault</code> + */ +class EditionDefault extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 3;</code> + */ + protected $edition = null; + /** + * Textproto value. + * + * Generated from protobuf field <code>optional string value = 2;</code> + */ + protected $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $edition + * @type string $value + * Textproto value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 3;</code> + * @return int + */ + public function getEdition() + { + return isset($this->edition) ? $this->edition : 0; + } + + public function hasEdition() + { + return isset($this->edition); + } + + public function clearEdition() + { + unset($this->edition); + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 3;</code> + * @param int $var + * @return $this + */ + public function setEdition($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); + $this->edition = $var; + + return $this; + } + + /** + * Textproto value. + * + * Generated from protobuf field <code>optional string value = 2;</code> + * @return string + */ + public function getValue() + { + return isset($this->value) ? $this->value : ''; + } + + public function hasValue() + { + return isset($this->value); + } + + public function clearValue() + { + unset($this->value); + } + + /** + * Textproto value. + * + * Generated from protobuf field <code>optional string value = 2;</code> + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/FeatureSupport.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/FeatureSupport.php new file mode 100644 index 0000000000000..63dfa7eebfb39 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/FeatureSupport.php @@ -0,0 +1,236 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FieldOptions; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Information about the support window of a feature. + * + * Generated from protobuf message <code>google.protobuf.FieldOptions.FeatureSupport</code> + */ +class FeatureSupport extends \Google\Protobuf\Internal\Message +{ + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_introduced = 1;</code> + */ + protected $edition_introduced = null; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_deprecated = 2;</code> + */ + protected $edition_deprecated = null; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + * + * Generated from protobuf field <code>optional string deprecation_warning = 3;</code> + */ + protected $deprecation_warning = null; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_removed = 4;</code> + */ + protected $edition_removed = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $edition_introduced + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + * @type int $edition_deprecated + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + * @type string $deprecation_warning + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + * @type int $edition_removed + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_introduced = 1;</code> + * @return int + */ + public function getEditionIntroduced() + { + return isset($this->edition_introduced) ? $this->edition_introduced : 0; + } + + public function hasEditionIntroduced() + { + return isset($this->edition_introduced); + } + + public function clearEditionIntroduced() + { + unset($this->edition_introduced); + } + + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_introduced = 1;</code> + * @param int $var + * @return $this + */ + public function setEditionIntroduced($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); + $this->edition_introduced = $var; + + return $this; + } + + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_deprecated = 2;</code> + * @return int + */ + public function getEditionDeprecated() + { + return isset($this->edition_deprecated) ? $this->edition_deprecated : 0; + } + + public function hasEditionDeprecated() + { + return isset($this->edition_deprecated); + } + + public function clearEditionDeprecated() + { + unset($this->edition_deprecated); + } + + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_deprecated = 2;</code> + * @param int $var + * @return $this + */ + public function setEditionDeprecated($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); + $this->edition_deprecated = $var; + + return $this; + } + + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + * + * Generated from protobuf field <code>optional string deprecation_warning = 3;</code> + * @return string + */ + public function getDeprecationWarning() + { + return isset($this->deprecation_warning) ? $this->deprecation_warning : ''; + } + + public function hasDeprecationWarning() + { + return isset($this->deprecation_warning); + } + + public function clearDeprecationWarning() + { + unset($this->deprecation_warning); + } + + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + * + * Generated from protobuf field <code>optional string deprecation_warning = 3;</code> + * @param string $var + * @return $this + */ + public function setDeprecationWarning($var) + { + GPBUtil::checkString($var, True); + $this->deprecation_warning = $var; + + return $this; + } + + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_removed = 4;</code> + * @return int + */ + public function getEditionRemoved() + { + return isset($this->edition_removed) ? $this->edition_removed : 0; + } + + public function hasEditionRemoved() + { + return isset($this->edition_removed); + } + + public function clearEditionRemoved() + { + unset($this->edition_removed); + } + + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + * + * Generated from protobuf field <code>optional .google.protobuf.Edition edition_removed = 4;</code> + * @param int $var + * @return $this + */ + public function setEditionRemoved($var) + { + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); + $this->edition_removed = $var; + + return $this; + } + +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php index 175a4330bbc1f..5ecc06bd98844 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\FieldOptions; @@ -57,6 +58,3 @@ class JSType } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(JSType::class, \Google\Protobuf\Internal\FieldOptions_JSType::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionRetention.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionRetention.php new file mode 100644 index 0000000000000..7bc16d4b2d243 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionRetention.php @@ -0,0 +1,56 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FieldOptions; + +use UnexpectedValueException; + +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * + * Protobuf type <code>google.protobuf.FieldOptions.OptionRetention</code> + */ +class OptionRetention +{ + /** + * Generated from protobuf enum <code>RETENTION_UNKNOWN = 0;</code> + */ + const RETENTION_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>RETENTION_RUNTIME = 1;</code> + */ + const RETENTION_RUNTIME = 1; + /** + * Generated from protobuf enum <code>RETENTION_SOURCE = 2;</code> + */ + const RETENTION_SOURCE = 2; + + private static $valueToName = [ + self::RETENTION_UNKNOWN => 'RETENTION_UNKNOWN', + self::RETENTION_RUNTIME => 'RETENTION_RUNTIME', + self::RETENTION_SOURCE => 'RETENTION_SOURCE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionTargetType.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionTargetType.php new file mode 100644 index 0000000000000..f633cdd18cce5 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions/OptionTargetType.php @@ -0,0 +1,93 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\FieldOptions; + +use UnexpectedValueException; + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. + * + * Protobuf type <code>google.protobuf.FieldOptions.OptionTargetType</code> + */ +class OptionTargetType +{ + /** + * Generated from protobuf enum <code>TARGET_TYPE_UNKNOWN = 0;</code> + */ + const TARGET_TYPE_UNKNOWN = 0; + /** + * Generated from protobuf enum <code>TARGET_TYPE_FILE = 1;</code> + */ + const TARGET_TYPE_FILE = 1; + /** + * Generated from protobuf enum <code>TARGET_TYPE_EXTENSION_RANGE = 2;</code> + */ + const TARGET_TYPE_EXTENSION_RANGE = 2; + /** + * Generated from protobuf enum <code>TARGET_TYPE_MESSAGE = 3;</code> + */ + const TARGET_TYPE_MESSAGE = 3; + /** + * Generated from protobuf enum <code>TARGET_TYPE_FIELD = 4;</code> + */ + const TARGET_TYPE_FIELD = 4; + /** + * Generated from protobuf enum <code>TARGET_TYPE_ONEOF = 5;</code> + */ + const TARGET_TYPE_ONEOF = 5; + /** + * Generated from protobuf enum <code>TARGET_TYPE_ENUM = 6;</code> + */ + const TARGET_TYPE_ENUM = 6; + /** + * Generated from protobuf enum <code>TARGET_TYPE_ENUM_ENTRY = 7;</code> + */ + const TARGET_TYPE_ENUM_ENTRY = 7; + /** + * Generated from protobuf enum <code>TARGET_TYPE_SERVICE = 8;</code> + */ + const TARGET_TYPE_SERVICE = 8; + /** + * Generated from protobuf enum <code>TARGET_TYPE_METHOD = 9;</code> + */ + const TARGET_TYPE_METHOD = 9; + + private static $valueToName = [ + self::TARGET_TYPE_UNKNOWN => 'TARGET_TYPE_UNKNOWN', + self::TARGET_TYPE_FILE => 'TARGET_TYPE_FILE', + self::TARGET_TYPE_EXTENSION_RANGE => 'TARGET_TYPE_EXTENSION_RANGE', + self::TARGET_TYPE_MESSAGE => 'TARGET_TYPE_MESSAGE', + self::TARGET_TYPE_FIELD => 'TARGET_TYPE_FIELD', + self::TARGET_TYPE_ONEOF => 'TARGET_TYPE_ONEOF', + self::TARGET_TYPE_ENUM => 'TARGET_TYPE_ENUM', + self::TARGET_TYPE_ENUM_ENTRY => 'TARGET_TYPE_ENUM_ENTRY', + self::TARGET_TYPE_SERVICE => 'TARGET_TYPE_SERVICE', + self::TARGET_TYPE_METHOD => 'TARGET_TYPE_METHOD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_CType.php deleted file mode 100644 index 4d18783ee2ebb..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_CType.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\FieldOptions\CType instead. - * @deprecated - */ - class FieldOptions_CType {} -} -class_exists(FieldOptions\CType::class); -@trigger_error('Google\Protobuf\Internal\FieldOptions_CType is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldOptions\CType instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php deleted file mode 100644 index 9db07822212db..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\FieldOptions\JSType instead. - * @deprecated - */ - class FieldOptions_JSType {} -} -class_exists(FieldOptions\JSType::class); -@trigger_error('Google\Protobuf\Internal\FieldOptions_JSType is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldOptions\JSType instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorProto.php index d4c7f6bb8dd9b..b01cf6e3072c3 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -83,14 +84,20 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * The syntax of the proto file. * The supported values are "proto2", "proto3", and "editions". * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * * Generated from protobuf field <code>optional string syntax = 12;</code> */ protected $syntax = null; /** - * The edition of the proto file, which is an opaque string. + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * - * Generated from protobuf field <code>optional string edition = 13;</code> + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 14;</code> */ protected $edition = null; @@ -126,8 +133,14 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * The syntax of the proto file. * The supported values are "proto2", "proto3", and "editions". * If `edition` is present, this value must be "editions". - * @type string $edition - * The edition of the proto file, which is an opaque string. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * @type int $edition + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * } */ public function __construct($data = NULL) { @@ -457,6 +470,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * The syntax of the proto file. * The supported values are "proto2", "proto3", and "editions". * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * * Generated from protobuf field <code>optional string syntax = 12;</code> * @return string @@ -480,6 +496,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message * The syntax of the proto file. * The supported values are "proto2", "proto3", and "editions". * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * * Generated from protobuf field <code>optional string syntax = 12;</code> * @param string $var @@ -494,14 +513,17 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * The edition of the proto file, which is an opaque string. + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * - * Generated from protobuf field <code>optional string edition = 13;</code> - * @return string + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 14;</code> + * @return int */ public function getEdition() { - return isset($this->edition) ? $this->edition : ''; + return isset($this->edition) ? $this->edition : 0; } public function hasEdition() @@ -515,15 +537,18 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message } /** - * The edition of the proto file, which is an opaque string. + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * - * Generated from protobuf field <code>optional string edition = 13;</code> - * @param string $var + * Generated from protobuf field <code>optional .google.protobuf.Edition edition = 14;</code> + * @param int $var * @return $this */ public function setEdition($var) { - GPBUtil::checkString($var, True); + GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); $this->edition = $var; return $this; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorSet.php index 1dae6fb3e3648..6337846661b16 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorSet.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions.php index 43931be809778..a130d5a67afac 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -53,12 +54,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message */ protected $java_generate_equals_and_hash = null; /** - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. * * Generated from protobuf field <code>optional bool java_string_check_utf8 = 27 [default = false];</code> */ @@ -99,10 +102,6 @@ class FileOptions extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>optional bool py_generic_services = 18 [default = false];</code> */ protected $py_generic_services = null; - /** - * Generated from protobuf field <code>optional bool php_generic_services = 42 [default = false];</code> - */ - protected $php_generic_services = null; /** * Is this file deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -172,6 +171,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>optional string ruby_package = 45;</code> */ protected $ruby_package = null; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 50;</code> + */ + protected $features = null; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -207,12 +215,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message * @type bool $java_generate_equals_and_hash * This option does nothing. * @type bool $java_string_check_utf8 - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. * @type int $optimize_for * @type string $go_package * Sets the Go package where structs generated from this .proto will be @@ -232,7 +242,6 @@ class FileOptions extends \Google\Protobuf\Internal\Message * explicitly set them to true. * @type bool $java_generic_services * @type bool $py_generic_services - * @type bool $php_generic_services * @type bool $deprecated * Is this file deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -266,6 +275,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message * Use this option to change the package of ruby generated classes. Default * is empty. When this option is not set, the package name will be used for * determining the ruby package. + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -417,13 +431,17 @@ class FileOptions extends \Google\Protobuf\Internal\Message */ public function getJavaGenerateEqualsAndHash() { - @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + if (isset($this->java_generate_equals_and_hash)) { + @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + } return isset($this->java_generate_equals_and_hash) ? $this->java_generate_equals_and_hash : false; } public function hasJavaGenerateEqualsAndHash() { - @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + if (isset($this->java_generate_equals_and_hash)) { + @trigger_error('java_generate_equals_and_hash is deprecated.', E_USER_DEPRECATED); + } return isset($this->java_generate_equals_and_hash); } @@ -451,12 +469,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. * * Generated from protobuf field <code>optional bool java_string_check_utf8 = 27 [default = false];</code> * @return bool @@ -477,12 +497,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message } /** - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. * * Generated from protobuf field <code>optional bool java_string_check_utf8 = 27 [default = false];</code> * @param bool $var @@ -688,38 +710,6 @@ class FileOptions extends \Google\Protobuf\Internal\Message return $this; } - /** - * Generated from protobuf field <code>optional bool php_generic_services = 42 [default = false];</code> - * @return bool - */ - public function getPhpGenericServices() - { - return isset($this->php_generic_services) ? $this->php_generic_services : false; - } - - public function hasPhpGenericServices() - { - return isset($this->php_generic_services); - } - - public function clearPhpGenericServices() - { - unset($this->php_generic_services); - } - - /** - * Generated from protobuf field <code>optional bool php_generic_services = 42 [default = false];</code> - * @param bool $var - * @return $this - */ - public function setPhpGenericServices($var) - { - GPBUtil::checkBool($var); - $this->php_generic_services = $var; - - return $this; - } - /** * Is this file deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -1074,6 +1064,48 @@ class FileOptions extends \Google\Protobuf\Internal\Message return $this; } + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 50;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 50;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php index 0df27b53359dd..2ffe8b2faedf9 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\FileOptions; @@ -59,6 +60,3 @@ class OptimizeMode } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(OptimizeMode::class, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php deleted file mode 100644 index 8926e63baa01f..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\FileOptions\OptimizeMode instead. - * @deprecated - */ - class FileOptions_OptimizeMode {} -} -class_exists(FileOptions\OptimizeMode::class); -@trigger_error('Google\Protobuf\Internal\FileOptions_OptimizeMode is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FileOptions\OptimizeMode instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php index a1db269bf9394..0fe4a433b65af 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php index b1ef4ee95dd44..6a3b60c103213 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\GeneratedCodeInfo; @@ -250,6 +251,3 @@ class Annotation extends \Google\Protobuf\Internal\Message } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Annotation::class, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation/Semantic.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation/Semantic.php new file mode 100644 index 0000000000000..7d3907629a3c0 --- /dev/null +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation/Semantic.php @@ -0,0 +1,63 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal\GeneratedCodeInfo\Annotation; + +use UnexpectedValueException; + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + * + * Protobuf type <code>google.protobuf.GeneratedCodeInfo.Annotation.Semantic</code> + */ +class Semantic +{ + /** + * There is no effect or the effect is indescribable. + * + * Generated from protobuf enum <code>NONE = 0;</code> + */ + const NONE = 0; + /** + * The element is set or otherwise mutated. + * + * Generated from protobuf enum <code>SET = 1;</code> + */ + const SET = 1; + /** + * An alias to the element is returned. + * + * Generated from protobuf enum <code>ALIAS = 2;</code> + */ + const ALIAS = 2; + + private static $valueToName = [ + self::NONE => 'NONE', + self::SET => 'SET', + self::ALIAS => 'ALIAS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php deleted file mode 100644 index e36f1e573de4f..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\GeneratedCodeInfo\Annotation instead. - * @deprecated - */ - class GeneratedCodeInfo_Annotation {} -} -class_exists(GeneratedCodeInfo\Annotation::class); -@trigger_error('Google\Protobuf\Internal\GeneratedCodeInfo_Annotation is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\GeneratedCodeInfo\Annotation instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/Message.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/Message.php index 31e2f29d300e7..eb91f35f295dd 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/Message.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/Message.php @@ -1255,6 +1255,18 @@ class Message $tmp_value, $value_field, $ignore_unknown); + + // Mapped unknown enum string values should be silently + // ignored if ignore_unknown is set. + if ($value_field->getType() == GPBType::ENUM && + is_string($tmp_value) && + is_null( + $value_field->getEnumType()->getValueByName($tmp_value) + ) && + $ignore_unknown) { + continue; + } + self::kvUpdateHelper($field, $proto_key, $proto_value); } } else if ($field->isRepeated()) { @@ -1270,6 +1282,16 @@ class Message $tmp, $field, $ignore_unknown); + + // Repeated unknown enum string values should be silently + // ignored if ignore_unknown is set. + if ($field->getType() == GPBType::ENUM && + is_string($tmp) && + is_null($field->getEnumType()->getValueByName($tmp)) && + $ignore_unknown) { + continue; + } + self::appendHelper($field, $proto_value); } } else { diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/MessageOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/MessageOptions.php index bb01aa4ba93dc..23ba7b4a25db9 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/MessageOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/MessageOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -53,9 +54,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message */ protected $deprecated = null; /** - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. * Whether the message is an automatically generated map entry type for the * maps field. * For maps fields: @@ -71,6 +69,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * use a native map in the target language to hold the keys and values. * The reflection APIs in such implementations still need to work as * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. * * Generated from protobuf field <code>optional bool map_entry = 7;</code> */ @@ -89,6 +90,15 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * @deprecated */ protected $deprecated_legacy_json_field_conflicts = null; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 12;</code> + */ + protected $features = null; /** * The parser stores options it doesn't recognize here. See above. * @@ -128,9 +138,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * for the message, or it will be completely ignored; in the very least, * this is a formalization for deprecating messages. * @type bool $map_entry - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. * Whether the message is an automatically generated map entry type for the * maps field. * For maps fields: @@ -146,6 +153,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * use a native map in the target language to hold the keys and values. * The reflection APIs in such implementations still need to work as * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. * @type bool $deprecated_legacy_json_field_conflicts * Enable the legacy handling of JSON field name conflicts. This lowercases * and strips underscored from the fields before comparison in proto3 only. @@ -155,6 +165,11 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * to the change in behavior for JSON field name conflicts. * TODO This is legacy behavior we plan to remove once downstream * teams have had time to migrate. + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. See above. * } @@ -311,9 +326,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. * Whether the message is an automatically generated map entry type for the * maps field. * For maps fields: @@ -329,6 +341,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * use a native map in the target language to hold the keys and values. * The reflection APIs in such implementations still need to work as * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. * * Generated from protobuf field <code>optional bool map_entry = 7;</code> * @return bool @@ -349,9 +364,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message } /** - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. * Whether the message is an automatically generated map entry type for the * maps field. * For maps fields: @@ -367,6 +379,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message * use a native map in the target language to hold the keys and values. * The reflection APIs in such implementations still need to work as * if the field is a repeated message field. + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. * * Generated from protobuf field <code>optional bool map_entry = 7;</code> * @param bool $var @@ -396,13 +411,17 @@ class MessageOptions extends \Google\Protobuf\Internal\Message */ public function getDeprecatedLegacyJsonFieldConflicts() { - @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + if (isset($this->deprecated_legacy_json_field_conflicts)) { + @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + } return isset($this->deprecated_legacy_json_field_conflicts) ? $this->deprecated_legacy_json_field_conflicts : false; } public function hasDeprecatedLegacyJsonFieldConflicts() { - @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + if (isset($this->deprecated_legacy_json_field_conflicts)) { + @trigger_error('deprecated_legacy_json_field_conflicts is deprecated.', E_USER_DEPRECATED); + } return isset($this->deprecated_legacy_json_field_conflicts); } @@ -436,6 +455,48 @@ class MessageOptions extends \Google\Protobuf\Internal\Message return $this; } + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 12;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 12;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + /** * The parser stores options it doesn't recognize here. See above. * diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php index 96efb02d24a10..93276e3930c85 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions.php index 87af45167a2d5..da27df21aa3c5 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -28,6 +29,15 @@ class MethodOptions extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code> */ protected $idempotency_level = null; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 35;</code> + */ + protected $features = null; /** * The parser stores options it doesn't recognize here. See above. * @@ -47,6 +57,11 @@ class MethodOptions extends \Google\Protobuf\Internal\Message * for the method, or it will be completely ignored; in the very least, * this is a formalization for deprecating methods. * @type int $idempotency_level + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. See above. * } @@ -130,6 +145,48 @@ class MethodOptions extends \Google\Protobuf\Internal\Message return $this; } + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 35;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 35;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + /** * The parser stores options it doesn't recognize here. See above. * diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php index ce3c062c691df..ce99b8c70f9ed 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\MethodOptions; @@ -59,6 +60,3 @@ class IdempotencyLevel } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(IdempotencyLevel::class, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php deleted file mode 100644 index a2913114559ad..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\MethodOptions\IdempotencyLevel instead. - * @deprecated - */ - class MethodOptions_IdempotencyLevel {} -} -class_exists(MethodOptions\IdempotencyLevel::class); -@trigger_error('Google\Protobuf\Internal\MethodOptions_IdempotencyLevel is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\MethodOptions\IdempotencyLevel instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php index 3cb9f25c212d2..da55bb4f42c50 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofOptions.php index b44d194573516..2d94ac48985b9 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -15,6 +16,15 @@ use Google\Protobuf\Internal\GPBUtil; */ class OneofOptions extends \Google\Protobuf\Internal\Message { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 1;</code> + */ + protected $features = null; /** * The parser stores options it doesn't recognize here. See above. * @@ -28,6 +38,11 @@ class OneofOptions extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. See above. * } @@ -37,6 +52,48 @@ class OneofOptions extends \Google\Protobuf\Internal\Message parent::__construct($data); } + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 1;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 1;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + /** * The parser stores options it doesn't recognize here. See above. * diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php index e322e2abf105f..bcc44f0e23243 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceOptions.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceOptions.php index 8ac27ee80447c..56b44585a2cb2 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceOptions.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceOptions.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; @@ -15,6 +16,15 @@ use Google\Protobuf\Internal\GPBUtil; */ class ServiceOptions extends \Google\Protobuf\Internal\Message { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 34;</code> + */ + protected $features = null; /** * Is this service deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -37,6 +47,11 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * + * @type \Google\Protobuf\Internal\FeatureSet $features + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. * @type bool $deprecated * Is this service deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -51,6 +66,48 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message parent::__construct($data); } + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 34;</code> + * @return \Google\Protobuf\Internal\FeatureSet|null + */ + public function getFeatures() + { + return $this->features; + } + + public function hasFeatures() + { + return isset($this->features); + } + + public function clearFeatures() + { + unset($this->features); + } + + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + * + * Generated from protobuf field <code>optional .google.protobuf.FeatureSet features = 34;</code> + * @param \Google\Protobuf\Internal\FeatureSet $var + * @return $this + */ + public function setFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); + $this->features = $var; + + return $this; + } + /** * Is this service deprecated? * Depending on the target platform, this can emit Deprecated annotations diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo.php index 0005bc6696755..d6419f5a96543 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php index 032be39214a43..5253dbc4ffd39 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\SourceCodeInfo; @@ -19,7 +20,7 @@ class Location extends \Google\Protobuf\Internal\Message * Identifies which part of the FileDescriptorProto was defined at this * location. * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition occurs. + * the root FileDescriptorProto to the place where the definition appears. * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: @@ -81,11 +82,11 @@ class Location extends \Google\Protobuf\Internal\Message * // both. * // Detached comment for corge paragraph 2. * optional string corge = 5; - * /* Block comment attached + * /* Block comment attached * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ + * * will be removed. {@*} + * /* Block comment attached to + * * grault. {@*} * optional int32 grault = 6; * // ignored detached comments. * @@ -111,7 +112,7 @@ class Location extends \Google\Protobuf\Internal\Message * Identifies which part of the FileDescriptorProto was defined at this * location. * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition occurs. + * the root FileDescriptorProto to the place where the definition appears. * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: @@ -165,11 +166,11 @@ class Location extends \Google\Protobuf\Internal\Message * // both. * // Detached comment for corge paragraph 2. * optional string corge = 5; - * /* Block comment attached + * /* Block comment attached * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ + * * will be removed. {@*} + * /* Block comment attached to + * * grault. {@*} * optional int32 grault = 6; * // ignored detached comments. * @type string $trailing_comments @@ -185,7 +186,7 @@ class Location extends \Google\Protobuf\Internal\Message * Identifies which part of the FileDescriptorProto was defined at this * location. * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition occurs. + * the root FileDescriptorProto to the place where the definition appears. * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: @@ -216,7 +217,7 @@ class Location extends \Google\Protobuf\Internal\Message * Identifies which part of the FileDescriptorProto was defined at this * location. * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition occurs. + * the root FileDescriptorProto to the place where the definition appears. * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: @@ -311,11 +312,11 @@ class Location extends \Google\Protobuf\Internal\Message * // both. * // Detached comment for corge paragraph 2. * optional string corge = 5; - * /* Block comment attached + * /* Block comment attached * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ + * * will be removed. {@*} + * /* Block comment attached to + * * grault. {@*} * optional int32 grault = 6; * // ignored detached comments. * @@ -367,11 +368,11 @@ class Location extends \Google\Protobuf\Internal\Message * // both. * // Detached comment for corge paragraph 2. * optional string corge = 5; - * /* Block comment attached + * /* Block comment attached * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ + * * will be removed. {@*} + * /* Block comment attached to + * * grault. {@*} * optional int32 grault = 6; * // ignored detached comments. * @@ -443,6 +444,3 @@ class Location extends \Google\Protobuf\Internal\Message } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Location::class, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php deleted file mode 100644 index 1346492d25c9e..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\SourceCodeInfo\Location instead. - * @deprecated - */ - class SourceCodeInfo_Location {} -} -class_exists(SourceCodeInfo\Location::class); -@trigger_error('Google\Protobuf\Internal\SourceCodeInfo_Location is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\SourceCodeInfo\Location instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption.php index a1cdca5734d51..156534e4f2247 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php index 2debf83a6295f..784a9cff9e804 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto namespace Google\Protobuf\Internal\UninterpretedOption; @@ -111,6 +112,3 @@ class NamePart extends \Google\Protobuf\Internal\Message } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(NamePart::class, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php deleted file mode 100644 index 9750eb010d645..0000000000000 --- a/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -if (false) { - /** - * This class is deprecated. Use Google\Protobuf\Internal\UninterpretedOption\NamePart instead. - * @deprecated - */ - class UninterpretedOption_NamePart {} -} -class_exists(UninterpretedOption\NamePart::class); -@trigger_error('Google\Protobuf\Internal\UninterpretedOption_NamePart is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\UninterpretedOption\NamePart instead', E_USER_DEPRECATED); - diff --git a/third_party/protobuf/php/src/Google/Protobuf/ListValue.php b/third_party/protobuf/php/src/Google/Protobuf/ListValue.php index 891283c2b2be3..af0845f4b4daf 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/ListValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/ListValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/struct.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Method.php b/third_party/protobuf/php/src/Google/Protobuf/Method.php index eda00bf61122a..6c92edf677e98 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Method.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Method.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/api.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Mixin.php b/third_party/protobuf/php/src/Google/Protobuf/Mixin.php index 4f7bf844ccfe1..f01a4d24f1897 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Mixin.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Mixin.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/api.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/NullValue.php b/third_party/protobuf/php/src/Google/Protobuf/NullValue.php index 61569f8a36f74..2c40d97b60d19 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/NullValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/NullValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/struct.proto namespace Google\Protobuf; @@ -9,7 +10,7 @@ use UnexpectedValueException; /** * `NullValue` is a singleton enumeration to represent the null value for the * `Value` type union. - * The JSON representation for `NullValue` is JSON `null`. + * The JSON representation for `NullValue` is JSON `null`. * * Protobuf type <code>google.protobuf.NullValue</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/Option.php b/third_party/protobuf/php/src/Google/Protobuf/Option.php index 31249e5131145..aeb8368916b25 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Option.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Option.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/SourceContext.php b/third_party/protobuf/php/src/Google/Protobuf/SourceContext.php index 8b3ea11220cd5..cdb5670e48daf 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/SourceContext.php +++ b/third_party/protobuf/php/src/Google/Protobuf/SourceContext.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/source_context.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/StringValue.php b/third_party/protobuf/php/src/Google/Protobuf/StringValue.php index ad98316b22475..807fef57ac90c 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/StringValue.php +++ b/third_party/protobuf/php/src/Google/Protobuf/StringValue.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `string`. * The JSON representation for `StringValue` is JSON string. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.StringValue</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/Struct.php b/third_party/protobuf/php/src/Google/Protobuf/Struct.php index 0456541cbd2c9..38c608908975b 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Struct.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Struct.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/struct.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/src/Google/Protobuf/Syntax.php b/third_party/protobuf/php/src/Google/Protobuf/Syntax.php index 10952bfd42cea..90a75b7e55593 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Syntax.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Syntax.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf; @@ -25,10 +26,17 @@ class Syntax * Generated from protobuf enum <code>SYNTAX_PROTO3 = 1;</code> */ const SYNTAX_PROTO3 = 1; + /** + * Syntax `editions`. + * + * Generated from protobuf enum <code>SYNTAX_EDITIONS = 2;</code> + */ + const SYNTAX_EDITIONS = 2; private static $valueToName = [ self::SYNTAX_PROTO2 => 'SYNTAX_PROTO2', self::SYNTAX_PROTO3 => 'SYNTAX_PROTO3', + self::SYNTAX_EDITIONS => 'SYNTAX_EDITIONS', ]; public static function name($value) diff --git a/third_party/protobuf/php/src/Google/Protobuf/Timestamp.php b/third_party/protobuf/php/src/Google/Protobuf/Timestamp.php index a12f48520bf2f..489e21d36e29e 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Timestamp.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Timestamp.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/timestamp.proto namespace Google\Protobuf; @@ -73,7 +74,7 @@ use Google\Protobuf\Internal\GPBUtil; * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() * ) to obtain a formatter capable of generating timestamps in this format. * * Generated from protobuf message <code>google.protobuf.Timestamp</code> diff --git a/third_party/protobuf/php/src/Google/Protobuf/Type.php b/third_party/protobuf/php/src/Google/Protobuf/Type.php index d4af7dfecbaec..6167ba4484b68 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Type.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Type.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/type.proto namespace Google\Protobuf; @@ -51,6 +52,12 @@ class Type extends \Google\Protobuf\Internal\Message * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 6;</code> */ protected $syntax = 0; + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field <code>string edition = 7;</code> + */ + protected $edition = ''; /** * Constructor. @@ -70,6 +77,8 @@ class Type extends \Google\Protobuf\Internal\Message * The source context. * @type int $syntax * The source syntax. + * @type string $edition + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. * } */ public function __construct($data = NULL) { @@ -243,5 +252,31 @@ class Type extends \Google\Protobuf\Internal\Message return $this; } + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field <code>string edition = 7;</code> + * @return string + */ + public function getEdition() + { + return $this->edition; + } + + /** + * The source edition string, only valid when syntax is SYNTAX_EDITIONS. + * + * Generated from protobuf field <code>string edition = 7;</code> + * @param string $var + * @return $this + */ + public function setEdition($var) + { + GPBUtil::checkString($var, True); + $this->edition = $var; + + return $this; + } + } diff --git a/third_party/protobuf/php/src/Google/Protobuf/UInt32Value.php b/third_party/protobuf/php/src/Google/Protobuf/UInt32Value.php index ae5fc5b42c8d1..a71db921744f4 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/UInt32Value.php +++ b/third_party/protobuf/php/src/Google/Protobuf/UInt32Value.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `uint32`. * The JSON representation for `UInt32Value` is JSON number. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.UInt32Value</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/UInt64Value.php b/third_party/protobuf/php/src/Google/Protobuf/UInt64Value.php index aa9686726b935..3b41fe81348f3 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/UInt64Value.php +++ b/third_party/protobuf/php/src/Google/Protobuf/UInt64Value.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/wrappers.proto namespace Google\Protobuf; @@ -11,6 +12,8 @@ use Google\Protobuf\Internal\GPBUtil; /** * Wrapper message for `uint64`. * The JSON representation for `UInt64Value` is JSON string. + * Not recommended for use in new APIs, but still useful for legacy APIs and + * has no plan to be removed. * * Generated from protobuf message <code>google.protobuf.UInt64Value</code> */ diff --git a/third_party/protobuf/php/src/Google/Protobuf/Value.php b/third_party/protobuf/php/src/Google/Protobuf/Value.php index dcc0bdf7c4297..710f39fdf1d9b 100644 --- a/third_party/protobuf/php/src/Google/Protobuf/Value.php +++ b/third_party/protobuf/php/src/Google/Protobuf/Value.php @@ -1,5 +1,6 @@ <?php # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/struct.proto namespace Google\Protobuf; diff --git a/third_party/protobuf/php/tests/EncodeDecodeTest.php b/third_party/protobuf/php/tests/EncodeDecodeTest.php index abf95cca00dbc..ebe497ff7ebe9 100644 --- a/third_party/protobuf/php/tests/EncodeDecodeTest.php +++ b/third_party/protobuf/php/tests/EncodeDecodeTest.php @@ -205,6 +205,68 @@ class EncodeDecodeTest extends TestBase $this->assertSame("a", $m->getRepeatedField()[0]->getValue()); } + public function testDecodeEnumMapWithUnknownStringValueThrows() + { + $this->expectException(Exception::class); + + $m = new TestMessage(); + $m->mergeFromJsonString( + "{\"map_int32_enum\":{ + \"1\": \"ONE\", + \"2\": \"UNKNOWN_ENUM\", + \"3\": \"ZERO\" + }}" + ); + } + + public function testDecodeEnumMapWithUnknownStringValueIgnored() + { + $m = new TestMessage(); + $m->mergeFromJsonString( + "{\"map_int32_enum\":{ + \"1\": \"ONE\", + \"2\": \"UNKNOWN_ENUM\", + \"3\": \"ZERO\" + }}", + true + ); + + $this->assertSame(TestEnum::ONE, $m->getMapInt32Enum()["1"]); + $this->assertSame(TestEnum::ZERO, $m->getMapInt32Enum()["3"]); + $this->assertFalse($m->getMapInt32Enum()->offsetExists(2)); + } + + public function testDecodeRepeatedEnumWithUnknownStringValueThrows() + { + $this->expectException(Exception::class); + + $m = new TestMessage(); + $m->mergeFromJsonString( + "{\"repeated_enum\":[ + \"ONE\", + \"UNKNOWN_ENUM\", + \"ZERO\" + ]}" + ); + } + + public function testDecodeRepeatedEnumWithUnknownStringValueIgnored() + { + $m = new TestMessage(); + $m->mergeFromJsonString( + "{\"repeated_enum\":[ + \"ONE\", + \"UNKNOWN_ENUM\", + \"ZERO\" + ]}", + true + ); + + $this->assertSame(2, count($m->getRepeatedEnum())); + $this->assertSame(TestEnum::ONE, $m->getRepeatedEnum()[0]); + $this->assertSame(TestEnum::ZERO, $m->getRepeatedEnum()[1]); + } + public function testDecodeMapStringValue() { $m = new TestStringValue(); diff --git a/third_party/protobuf/php/tests/WellKnownTest.php b/third_party/protobuf/php/tests/WellKnownTest.php index 486c65ffca8e1..13c213919d4fc 100644 --- a/third_party/protobuf/php/tests/WellKnownTest.php +++ b/third_party/protobuf/php/tests/WellKnownTest.php @@ -416,4 +416,44 @@ class WellKnownTest extends TestBase { ['\Google\Protobuf\Syntax'], ]; } + + /** + * @dataProvider optionalFieldsDataProvider + */ + public function testReflectionProperty($property, $default) + { + $testMessage = new TestMessage(); + + $functionName = implode('', array_map('ucwords', explode('_', $property))); + + $reflectionProperty = new \ReflectionProperty($testMessage, $property); + + self::assertFalse(call_user_func([$testMessage, 'has'.$functionName])); + self::assertEquals($default, call_user_func([$testMessage, 'get'.$functionName])); + self::assertNull($reflectionProperty->getValue($testMessage)); + } + + public function optionalFieldsDataProvider() + { + return [ + ['true_optional_int32', 0], + ['true_optional_int64', 0], + ['true_optional_uint32', 0], + ['true_optional_uint64', 0], + ['true_optional_sint32', 0], + ['true_optional_sint64', 0], + ['true_optional_fixed32', 0], + ['true_optional_fixed64', 0], + ['true_optional_sfixed32', 0], + ['true_optional_sfixed64', 0], + ['true_optional_float', 0.0], + ['true_optional_double', 0.0], + ['true_optional_bool', false], + ['true_optional_string', ''], + ['true_optional_bytes', ''], + ['true_optional_enum', null], + ['true_optional_message', null], + ['true_optional_included_message', null], + ]; + } } diff --git a/third_party/protobuf/pkg/BUILD.bazel b/third_party/protobuf/pkg/BUILD.bazel index 99f0cab0d7270..0c2c00894bc41 100644 --- a/third_party/protobuf/pkg/BUILD.bazel +++ b/third_party/protobuf/pkg/BUILD.bazel @@ -110,6 +110,7 @@ gen_file_lists( # Libraries: ":protobuf": "libprotobuf", ":protobuf_lite": "libprotobuf_lite", + ":protoc_public": "libprotoc_public", ":protoc": "libprotoc", ":upb": "libupb", ":protoc-gen-upb": "protoc-gen-upb", @@ -209,6 +210,25 @@ cc_dist_library( ], ) +cc_dist_library( + name = "protoc_public", + dist_deps = [ + ":protobuf", + ":protobuf_lite", + ], + tags = ["manual"], + deps = [ + "//src/google/protobuf/compiler:command_line_interface", + "//src/google/protobuf/compiler/cpp:names", + "//src/google/protobuf/compiler/csharp:names", + "//src/google/protobuf/compiler/java:names", + "//src/google/protobuf/compiler/objectivec:names", + "//src/google/protobuf/compiler/php:names", + # TODO Make this private once gRPC migrates off it. + "//src/google/protobuf/compiler/php", + ], +) + cc_dist_library( name = "upb", tags = ["manual"], @@ -218,6 +238,7 @@ cc_dist_library( "//upb/message:compare", "//upb/message:copy", "//upb/text", + "//upb/text:debug", "//upb/util:def_to_proto", "//upb/util:required_fields", "//upb/wire:byte_size", diff --git a/third_party/protobuf/proto_sources.gni b/third_party/protobuf/proto_sources.gni index 4d1537dd3e1c5..46bc5522ab5c2 100644 --- a/third_party/protobuf/proto_sources.gni +++ b/third_party/protobuf/proto_sources.gni @@ -342,7 +342,6 @@ pyproto_sources = [ "$_python_dir/proto_json.py", "$_python_dir/reflection.py", "$_python_dir/runtime_version.py", - "$_python_dir/service.py", "$_python_dir/service_reflection.py", "$_python_dir/symbol_database.py", "$_python_dir/text_encoding.py", @@ -353,7 +352,6 @@ pyproto_sources = [ pyproto_internal_sources = [ "$_python_dir/internal/__init__.py", - "$_python_dir/internal/_parameterized.py", "$_python_dir/internal/api_implementation.py", "$_python_dir/internal/builder.py", "$_python_dir/internal/containers.py", diff --git a/third_party/protobuf/protobuf.bzl b/third_party/protobuf/protobuf.bzl index c8d32a604f2f3..4c8a5d525247a 100644 --- a/third_party/protobuf/protobuf.bzl +++ b/third_party/protobuf/protobuf.bzl @@ -89,17 +89,21 @@ def _proto_gen_impl(ctx): if source_dir: has_sources = any([src.is_source for src in srcs]) if has_sources: - import_flags += ["-I" + source_dir] + import_flags.append("-I" + source_dir) else: - import_flags += ["-I."] + import_flags.append("-I.") has_generated = any([not src.is_source for src in srcs]) if has_generated: - import_flags += ["-I" + gen_dir] + import_flags.append("-I" + gen_dir) if ctx.attr.includes: for include in ctx.attr.includes: - import_flags += ["-I" + _GetPath(ctx, include)] + if include == ".": + # This is effectively source_dir, which has already been handled, + # and may be generated incorrectly here. + continue + import_flags.append("-I" + _GetPath(ctx, include)) import_flags = depset(direct = import_flags) @@ -156,7 +160,7 @@ def _proto_gen_impl(ctx): outs.extend(_RubyOuts([src.basename])) # Otherwise, rely on user-supplied outs. - args += [("--%s_out=" + path_tpl) % (lang, gen_dir)] + args.append(("--%s_out=" + path_tpl) % (lang, gen_dir)) if ctx.attr.outs: outs.extend(ctx.attr.outs) @@ -177,8 +181,8 @@ def _proto_gen_impl(ctx): if ctx.attr.plugin_options: outdir = ",".join(ctx.attr.plugin_options) + ":" + outdir - args += [("--plugin=protoc-gen-%s=" + path_tpl) % (lang, plugin.path)] - args += ["--%s_out=%s" % (lang, outdir)] + args.append(("--plugin=protoc-gen-%s=" + path_tpl) % (lang, plugin.path)) + args.append("--%s_out=%s" % (lang, outdir)) tools.append(plugin) if not in_gen_dir: @@ -572,9 +576,9 @@ def internal_py_proto_library( **kargs): """Bazel rule to create a Python protobuf library from proto source files - NOTE: the rule is only an internal workaround to generate protos. The - interface may change and the rule may be removed when bazel has introduced - the native rule. + NOTE: the rule is is only an internal workaround to generate protos. It is deprecated and will + be removed in the next minor release. Users should migrate to the py_proto_library rule from + rules_python instead. Args: name: the name of the py_proto_library. @@ -634,24 +638,6 @@ def internal_py_proto_library( **kargs ) -def py_proto_library( - *args, - **kwargs): - """Deprecated alias for use before Bazel 5.3. - - Args: - *args: the name of the py_proto_library. - **kwargs: other keyword arguments that are passed to py_library. - - Deprecated: - This is provided for backwards compatibility only. Bazel 5.3 will - introduce support for py_proto_library, which should be used instead. - """ - print("The py_proto_library macro is deprecated and will be removed in the " - + "30.x release. switch to the rule defined by rules_python or the one " - + "in bazel/py_proto_library.bzl.") - internal_py_proto_library(*args, **kwargs) - def _source_proto_library( name, srcs = [], diff --git a/third_party/protobuf/protobuf_deps.bzl b/third_party/protobuf/protobuf_deps.bzl index 3ada3d45f5b4c..86b343dbbda59 100644 --- a/third_party/protobuf/protobuf_deps.bzl +++ b/third_party/protobuf/protobuf_deps.bzl @@ -5,15 +5,27 @@ and sets up the repositories protobuf needs: ``` http_archive( - name = "protobuf", + name = "com_google_protobuf", strip_prefix = "protobuf-VERSION", sha256 = ..., url = ..., ) -load("@protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() + +load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies") + +rules_java_dependencies() + +load("@rules_java//java:repositories.bzl", "rules_java_toolchains") + +rules_java_toolchains() + +load("@rules_python//python:repositories.bzl", "py_repositories") + +py_repositories() ``` """ @@ -23,18 +35,11 @@ load("//python/dist:python_downloads.bzl", "python_nuget_package", "python_sourc load("//python/dist:system_python.bzl", "system_python") PROTOBUF_MAVEN_ARTIFACTS = [ - "com.google.caliper:caliper:1.0-beta-3", "com.google.code.findbugs:jsr305:3.0.2", "com.google.code.gson:gson:2.8.9", "com.google.errorprone:error_prone_annotations:2.5.1", "com.google.j2objc:j2objc-annotations:2.8", "com.google.guava:guava:32.0.1-jre", - "com.google.guava:guava-testlib:32.0.1-jre", - "com.google.truth:truth:1.1.2", - "junit:junit:4.13.2", - "org.mockito:mockito-core:4.3.1", - "biz.aQute.bnd:biz.aQute.bndlib:6.4.0", - "info.picocli:picocli:4.6.3", ] def _github_archive(repo, commit, **kwargs): @@ -48,6 +53,14 @@ def _github_archive(repo, commit, **kwargs): def protobuf_deps(): """Loads common dependencies needed to compile the protobuf library.""" + if not native.existing_rule("bazel_features"): + http_archive( + name = "bazel_features", + sha256 = "95fb3cfd11466b4cad6565e3647a76f89886d875556a4b827c021525cb2482bb", + strip_prefix = "bazel_features-1.10.0", + url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.10.0/bazel_features-v1.10.0.tar.gz", + ) + if not native.existing_rule("bazel_skylib"): http_archive( name = "bazel_skylib", @@ -58,20 +71,18 @@ def protobuf_deps(): ], ) - if not native.existing_rule("com_google_absl"): + if not native.existing_rule("abseil-cpp"): _github_archive( - name = "com_google_absl", + name = "abseil-cpp", repo = "https://github.com/abseil/abseil-cpp", - # TODO: use Layout::WithStaticSizes in SerialArenaChunk when we update - # abseil to new release. - commit = "4a2c63365eff8823a5221db86ef490e828306f9d", # Abseil LTS 20240116.0 - sha256 = "f49929d22751bf70dd61922fb1fd05eb7aec5e7a7f870beece79a6e28f0a06c1", + commit = "9ac7062b1860d895fb5a8cbf58c3e9ef8f674b5f", # Abseil LTS 20250127 + sha256 = "d8ae9aa794a571ee39c77085ee69f1d4ac276212a7d99734974d95df7baa8d13", ) if not native.existing_rule("zlib"): http_archive( name = "zlib", - build_file = Label("//:third_party/zlib.BUILD"), + build_file = Label("//third_party:zlib.BUILD"), sha256 = "38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32", strip_prefix = "zlib-1.3.1", urls = [ @@ -84,9 +95,9 @@ def protobuf_deps(): _github_archive( name = "jsoncpp", repo = "https://github.com/open-source-parsers/jsoncpp", - commit = "5defb4ed1a4293b8e2bf641e16b156fb9de498cc", # 1.9.5 - sha256 = "a03d3136ff6dd092143bba8d3ded641e87b44e6c0b1f632b368f6cc8587524b5", - build_file = Label("//:third_party/jsoncpp.BUILD"), + commit = "89e2973c754a9c02a49974d839779b151e95afd6", # 1.9.6 + sha256 = "02f0804596c1e18c064d890ac9497fa17d585e822fcacf07ff8a8aa0b344a7bd", + build_file = Label("//third_party:jsoncpp.BUILD"), ) if not native.existing_rule("rules_cc"): @@ -100,8 +111,10 @@ def protobuf_deps(): if not native.existing_rule("rules_java"): http_archive( name = "rules_java", - url = "https://github.com/bazelbuild/rules_java/releases/download/7.12.2/rules_java-7.12.2.tar.gz", - sha256 = "a9690bc00c538246880d5c83c233e4deb83fe885f54c21bb445eb8116a180b83", + urls = [ + "https://github.com/bazelbuild/rules_java/releases/download/8.6.1/rules_java-8.6.1.tar.gz", + ], + sha256 = "c5bc17e17bb62290b1fd8fdd847a2396d3459f337a7e07da7769b869b488ec26", ) if not native.existing_rule("rules_shell"): @@ -118,15 +131,15 @@ def protobuf_deps(): if not native.existing_rule("rules_python"): http_archive( name = "rules_python", - sha256 = "d70cd72a7a4880f0000a6346253414825c19cdd40a28289bdf67b8e6480edff8", - strip_prefix = "rules_python-0.28.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.28.0/rules_python-0.28.0.tar.gz", + sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07", + strip_prefix = "rules_python-1.0.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz", ) if not native.existing_rule("system_python"): system_python( name = "system_python", - minimum_python_version = "3.8", + minimum_python_version = "3.9", ) if not native.existing_rule("rules_jvm_external"): @@ -150,15 +163,15 @@ def protobuf_deps(): if not native.existing_rule("build_bazel_rules_apple"): http_archive( name = "build_bazel_rules_apple", - sha256 = "9c4f1e1ec4fdfeac5bddb07fa0e872c398e3d8eb0ac596af9c463f9123ace292", - url = "https://github.com/bazelbuild/rules_apple/releases/download/3.2.1/rules_apple.3.2.1.tar.gz", + sha256 = "b892911288715b354e05b9a6fe9009635f7155991f24f27e779fe80d435c92bc", + url = "https://github.com/bazelbuild/rules_apple/releases/download/3.13.0/rules_apple.3.13.0.tar.gz", ) if not native.existing_rule("build_bazel_apple_support"): http_archive( name = "build_bazel_apple_support", - sha256 = "100d12617a84ebc7ee7a10ecf3b3e2fdadaebc167ad93a21f820a6cb60158ead", - url = "https://github.com/bazelbuild/apple_support/releases/download/1.12.0/apple_support.1.12.0.tar.gz", + sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80", + url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz", ) if not native.existing_rule("rules_kotlin"): @@ -180,16 +193,8 @@ def protobuf_deps(): # Python Downloads python_source_archive( - name = "python-3.8.0", - sha256 = "f1069ad3cae8e7ec467aa98a6565a62a48ef196cb8f1455a245a08db5e1792df", - ) - python_nuget_package( - name = "nuget_python_i686_3.8.0", - sha256 = "87a6481f5eef30b42ac12c93f06f73bd0b8692f26313b76a6615d1641c4e7bca", - ) - python_nuget_package( - name = "nuget_python_x86-64_3.8.0", - sha256 = "96c61321ce90dd053c8a04f305a5f6cc6d91350b862db34440e4a4f069b708a0", + name = "python-3.9.0", + sha256 = "df796b2dc8ef085edae2597a41c1c0a63625ebd92487adaef2fed22b567873e8", ) python_nuget_package( name = "nuget_python_i686_3.9.0", diff --git a/third_party/protobuf/protobuf_version.bzl b/third_party/protobuf/protobuf_version.bzl index b5c458a9aa0c4..6267795d6b05d 100644 --- a/third_party/protobuf/protobuf_version.bzl +++ b/third_party/protobuf/protobuf_version.bzl @@ -1,7 +1,8 @@ """ Contains version numbers to be used in other bzl files """ -PROTOC_VERSION = "29.3" -PROTOBUF_JAVA_VERSION = "4.29.3" -PROTOBUF_PYTHON_VERSION = "5.29.3" -PROTOBUF_PHP_VERSION = "4.29.3" -PROTOBUF_RUBY_VERSION = "4.29.3" +PROTOC_VERSION = "30.1" +PROTOBUF_JAVA_VERSION = "4.30.1" +PROTOBUF_PYTHON_VERSION = "6.30.1" +PROTOBUF_PHP_VERSION = "4.30.1" +PROTOBUF_RUBY_VERSION = "4.30.1" +PROTOBUF_RUST_VERSION = "4.30.1" PROTOBUF_PREVIOUS_RELEASE = "28.0-rc1" diff --git a/third_party/protobuf/protos/BUILD b/third_party/protobuf/protos/BUILD deleted file mode 100644 index 51cb3dc81e0f3..0000000000000 --- a/third_party/protobuf/protos/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2009-2021, Google LLC -# All rights reserved. -# -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file or at -# https://developers.google.com/open-source/licenses/bsd diff --git a/third_party/protobuf/protos/protos.h b/third_party/protobuf/protos/protos.h deleted file mode 100644 index 0302e7b7aa286..0000000000000 --- a/third_party/protobuf/protos/protos.h +++ /dev/null @@ -1,9 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2023 Google LLC. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd -#ifndef UPB_PROTOS_PROTOS_H_ -#define UPB_PROTOS_PROTOS_H_ -#endif diff --git a/third_party/protobuf/python/BUILD.bazel b/third_party/protobuf/python/BUILD.bazel index 6131ab92c909b..3a13a97e376ba 100644 --- a/third_party/protobuf/python/BUILD.bazel +++ b/third_party/protobuf/python/BUILD.bazel @@ -7,7 +7,6 @@ load("@bazel_skylib//lib:selects.bzl", "selects") load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag") -load("@rules_pkg//pkg:mappings.bzl", "pkg_files") load("//python:build_targets.bzl", "build_targets") load("//python:py_extension.bzl", "py_extension") load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS") @@ -22,7 +21,7 @@ package( ) LIMITED_API_FLAG_SELECT = { - ":limited_api_3.8": ["-DPy_LIMITED_API=0x03080000"], + ":limited_api_3.9": ["-DPy_LIMITED_API=0x03090000"], ":limited_api_3.10": ["-DPy_LIMITED_API=0x030a0000"], "//conditions:default": [], } @@ -37,7 +36,6 @@ string_flag( build_setting_default = "system", values = [ "system", - "38", "39", "310", "311", @@ -45,39 +43,13 @@ string_flag( ) config_setting( - name = "limited_api_3.8", + name = "limited_api_3.9", flag_values = { ":limited_api": "True", - ":python_version": "38", + ":python_version": "39", }, ) -config_setting( - name = "full_api_3.8_win32", - flag_values = { - ":limited_api": "False", - ":python_version": "38", - }, - values = {"cpu": "win32"}, -) - -config_setting( - name = "full_api_3.8_win64", - flag_values = { - ":limited_api": "False", - ":python_version": "38", - }, - values = {"cpu": "win64"}, -) - -selects.config_setting_group( - name = "full_api_3.8", - match_any = [ - ":full_api_3.8_win32", - ":full_api_3.8_win64", - ], -) - config_setting( name = "full_api_3.9_win32", flag_values = { diff --git a/third_party/protobuf/python/build_targets.bzl b/third_party/protobuf/python/build_targets.bzl index ee765ab4c60be..b62d5f05db9cf 100644 --- a/third_party/protobuf/python/build_targets.bzl +++ b/third_party/protobuf/python/build_targets.bzl @@ -1,11 +1,14 @@ -# Protobuf Python runtime -# -# See also code generation logic under /src/google/protobuf/compiler/python. -# -# Most users should depend upon public aliases in the root: -# //:protobuf_python -# //:well_known_types_py_pb2 +""" +Protobuf Python runtime +See also code generation logic under /src/google/protobuf/compiler/python. + +Most users should depend upon public aliases in the root: + //:protobuf_python + //:well_known_types_py_pb2 +""" + +load("@bazel_skylib//lib:selects.bzl", "selects") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_python//python:defs.bzl", "py_library") load("//:protobuf.bzl", "internal_py_proto_library") @@ -76,6 +79,13 @@ def build_targets(name): copts = COPTS + [ "-DPYTHON_PROTO2_CPP_IMPL_V2", ], + linkopts = selects.with_or({ + ( + "//python/dist:osx_x86_64", + "//python/dist:osx_aarch64", + ): ["-Wl,-undefined,dynamic_lookup"], + "//conditions:default": [], + }), linkshared = 1, linkstatic = 1, tags = [ @@ -110,6 +120,13 @@ def build_targets(name): "//conditions:default": [], ":allow_oversize_protos": ["-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1"], }), + linkopts = selects.with_or({ + ( + "//python/dist:osx_x86_64", + "//python/dist:osx_aarch64", + ): ["-Wl,-undefined,dynamic_lookup"], + "//conditions:default": [], + }), includes = ["."], linkshared = 1, linkstatic = 1, @@ -129,11 +146,12 @@ def build_targets(name): "//src/google/protobuf/io:tokenizer", "//src/google/protobuf/stubs:lite", "//src/google/protobuf/util:differencer", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", ] + select({ "//conditions:default": [], ":use_fast_cpp_protos": ["@system_python//:python_headers"], @@ -433,9 +451,15 @@ def build_targets(name): native.cc_library( name = "proto_api", + srcs = ["google/protobuf/proto_api.cc"], hdrs = ["google/protobuf/proto_api.h"], + strip_include_prefix = "/python", visibility = ["//visibility:public"], deps = [ + "//src/google/protobuf", + "//src/google/protobuf/io", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/status", "@system_python//:python_headers", ], ) @@ -463,7 +487,7 @@ def build_targets(name): conformance_test( name = "conformance_test_cpp", env = {"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": "cpp"}, - failure_list = "//conformance:failure_list_python.txt", + failure_list = "//conformance:failure_list_python_cpp.txt", target_compatible_with = select({ "@system_python//:none": ["@platforms//:incompatible"], ":use_fast_cpp_protos": [], diff --git a/third_party/protobuf/python/convert.c b/third_party/protobuf/python/convert.c index 809f8608a43f9..03f521b5d613f 100644 --- a/third_party/protobuf/python/convert.c +++ b/third_party/protobuf/python/convert.c @@ -180,12 +180,7 @@ static bool PyUpb_PyToUpbEnum(PyObject* obj, const upb_EnumDef* e, } else { int32_t i32; if (!PyUpb_GetInt32(obj, &i32)) return false; -#ifdef UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT if (upb_EnumDef_IsClosed(e) && !upb_EnumDef_CheckNumber(e, i32)) { -#else - if (upb_FileDef_Syntax(upb_EnumDef_File(e)) == kUpb_Syntax_Proto2 && - !upb_EnumDef_CheckNumber(e, i32)) { -#endif PyErr_Format(PyExc_ValueError, "invalid enumerator %d", (int)i32); return false; } @@ -222,15 +217,15 @@ bool PyUpb_PyToUpb(PyObject* obj, const upb_FieldDef* f, upb_MessageValue* val, case kUpb_CType_UInt64: return PyUpb_GetUint64(obj, &val->uint64_val); case kUpb_CType_Float: - if (PyUpb_IsNumpyNdarray(obj, f)) return false; + if (!PyFloat_Check(obj) && PyUpb_IsNumpyNdarray(obj, f)) return false; val->float_val = PyFloat_AsDouble(obj); return !PyErr_Occurred(); case kUpb_CType_Double: - if (PyUpb_IsNumpyNdarray(obj, f)) return false; + if (!PyFloat_Check(obj) && PyUpb_IsNumpyNdarray(obj, f)) return false; val->double_val = PyFloat_AsDouble(obj); return !PyErr_Occurred(); case kUpb_CType_Bool: - if (PyUpb_IsNumpyNdarray(obj, f)) return false; + if (!PyBool_Check(obj) && PyUpb_IsNumpyNdarray(obj, f)) return false; val->bool_val = PyLong_AsLong(obj); return !PyErr_Occurred(); case kUpb_CType_Bytes: { diff --git a/third_party/protobuf/python/descriptor.c b/third_party/protobuf/python/descriptor.c index ebd384e929a3e..da78bf4b47462 100644 --- a/third_party/protobuf/python/descriptor.c +++ b/third_party/protobuf/python/descriptor.c @@ -23,8 +23,10 @@ // This representation is used by all concrete descriptors. typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyObject* pool; // We own a ref. + // clang-format on const void* def; // Type depends on the class. Kept alive by "pool". PyObject* options; // NULL if not present or not cached. PyObject* features; // NULL if not present or not cached. @@ -1525,6 +1527,12 @@ static PyObject* PyUpb_MethodDescriptor_GetServerStreaming(PyObject* self, return PyBool_FromLong(upb_MethodDef_ServerStreaming(m) ? 1 : 0); } +static PyObject* PyUpb_MethodDescriptor_GetHasOptions(PyObject* _self, + void* closure) { + PyUpb_DescriptorBase* self = (void*)_self; + return PyBool_FromLong(upb_MethodDef_HasOptions(self->def)); +} + static PyObject* PyUpb_MethodDescriptor_GetOptions(PyObject* _self, PyObject* args) { PyUpb_DescriptorBase* self = (void*)_self; @@ -1563,6 +1571,8 @@ static PyGetSetDef PyUpb_MethodDescriptor_Getters[] = { "Client streaming", NULL}, {"server_streaming", PyUpb_MethodDescriptor_GetServerStreaming, NULL, "Server streaming", NULL}, + {"has_options", PyUpb_MethodDescriptor_GetHasOptions, NULL, "Has Options"}, + {NULL}}; static PyMethodDef PyUpb_MethodDescriptor_Methods[] = { @@ -1752,6 +1762,12 @@ static PyObject* PyUpb_ServiceDescriptor_GetMethodsByName(PyObject* _self, return PyUpb_ByNameMap_New(&funcs, self->def, self->pool); } +static PyObject* PyUpb_ServiceDescriptor_GetHasOptions(PyObject* _self, + void* closure) { + PyUpb_DescriptorBase* self = (void*)_self; + return PyBool_FromLong(upb_ServiceDef_HasOptions(self->def)); +} + static PyObject* PyUpb_ServiceDescriptor_GetOptions(PyObject* _self, PyObject* args) { PyUpb_DescriptorBase* self = (void*)_self; @@ -1797,6 +1813,7 @@ static PyGetSetDef PyUpb_ServiceDescriptor_Getters[] = { {"methods", PyUpb_ServiceDescriptor_GetMethods, NULL, "Methods", NULL}, {"methods_by_name", PyUpb_ServiceDescriptor_GetMethodsByName, NULL, "Methods by name", NULL}, + {"has_options", PyUpb_ServiceDescriptor_GetHasOptions, NULL, "Has Options"}, {NULL}}; static PyMethodDef PyUpb_ServiceDescriptor_Methods[] = { diff --git a/third_party/protobuf/python/descriptor_containers.c b/third_party/protobuf/python/descriptor_containers.c index 05751a0f894f1..47a00e4d9b2af 100644 --- a/third_party/protobuf/python/descriptor_containers.c +++ b/third_party/protobuf/python/descriptor_containers.c @@ -29,8 +29,10 @@ err: // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD const PyUpb_ByNameMap_Funcs* funcs; + // clang-format on const void* parent; // upb_MessageDef*, upb_DefPool*, etc. PyObject* parent_obj; // Python object that keeps parent alive, we own a ref. int index; // Current iterator index. @@ -89,8 +91,10 @@ static PyType_Spec PyUpb_ByNameIterator_Spec = { // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD const PyUpb_ByNumberMap_Funcs* funcs; + // clang-format on const void* parent; // upb_MessageDef*, upb_DefPool*, etc. PyObject* parent_obj; // Python object that keeps parent alive, we own a ref. int index; // Current iterator index. @@ -149,8 +153,10 @@ static PyType_Spec PyUpb_ByNumberIterator_Spec = { // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD const PyUpb_GenericSequence_Funcs* funcs; + // clang-format on const void* parent; // upb_MessageDef*, upb_DefPool*, etc. PyObject* parent_obj; // Python object that keeps parent alive, we own a ref. } PyUpb_GenericSequence; @@ -342,8 +348,10 @@ static PyType_Spec PyUpb_GenericSequence_Spec = { // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD const PyUpb_ByNameMap_Funcs* funcs; + // clang-format on const void* parent; // upb_MessageDef*, upb_DefPool*, etc. PyObject* parent_obj; // Python object that keeps parent alive, we own a ref. } PyUpb_ByNameMap; @@ -556,8 +564,10 @@ static PyType_Spec PyUpb_ByNameMap_Spec = { // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD const PyUpb_ByNumberMap_Funcs* funcs; + // clang-format on const void* parent; // upb_MessageDef*, upb_DefPool*, etc. PyObject* parent_obj; // Python object that keeps parent alive, we own a ref. } PyUpb_ByNumberMap; diff --git a/third_party/protobuf/python/descriptor_pool.c b/third_party/protobuf/python/descriptor_pool.c index cb79f899583f9..1b0e449b6a96c 100644 --- a/third_party/protobuf/python/descriptor_pool.c +++ b/third_party/protobuf/python/descriptor_pool.c @@ -22,8 +22,10 @@ // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD upb_DefPool* symtab; + // clang-format on PyObject* db; // The DescriptorDatabase underlying this pool. May be NULL. } PyUpb_DescriptorPool; diff --git a/third_party/protobuf/python/dist/BUILD.bazel b/third_party/protobuf/python/dist/BUILD.bazel index 764fc7054d670..e7d32cb1f4c5f 100644 --- a/third_party/protobuf/python/dist/BUILD.bazel +++ b/third_party/protobuf/python/dist/BUILD.bazel @@ -7,7 +7,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//lib:selects.bzl", "selects") -load("@pip_deps//:requirements.bzl", "requirement") +load("@protobuf_pip_deps//:requirements.bzl", "requirement") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("@rules_python//python:packaging.bzl", "py_wheel") @@ -84,6 +84,27 @@ config_setting( }, ) +# s390x support is community-maintained and not officially supported. We do not +# publish s390x wheels. +config_setting( + name = "linux_s390x_release_unused", + flag_values = { + "//toolchain:release": "True", + }, + values = {"cpu": "linux-s390x"}, +) + +config_setting( + name = "linux_s390x_local_unused", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:s390x", + ], + flag_values = { + "//toolchain:release": "False", + }, +) + config_setting( name = "osx_x86_64_release", flag_values = { @@ -283,7 +304,7 @@ genrule( srcs = [":source_tarball"], outs = ["protobuf-%s.tar.gz" % PROTOBUF_PYTHON_VERSION], cmd = """ - export PYTHONPATH=$$PWD/external/pip_deps_setuptools/site-packages + export PYTHONPATH=$$PWD/external/protobuf_pip_deps_setuptools/site-packages set -eux tar -xzvf $(location :source_tarball) cd protobuf/ @@ -301,7 +322,6 @@ genrule( py_wheel( name = "binary_wheel", abi = select({ - "//python:full_api_3.8": "cp38", "//python:full_api_3.9": "cp39", "//conditions:default": "abi3", }), @@ -310,11 +330,11 @@ py_wheel( classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ], distribution = "protobuf", extra_distinfo_files = { @@ -327,17 +347,18 @@ py_wheel( ":linux_x86_64_release": "manylinux2014_x86_64", ":linux_aarch64_local": "linux_aarch64", ":linux_aarch64_release": "manylinux2014_aarch64", + ":linux_s390x_local_unused": "linux_s390x", + ":linux_s390x_release_unused": "manylinux2014_s390x", ":osx_universal2": "macosx_10_9_universal2", ":osx_aarch64": "macosx_11_0_arm64", ":windows_x86_32": "win32", ":windows_x86_64": "win_amd64", "//conditions:default": "any", }), - python_requires = ">=3.8", + python_requires = ">=3.9", # LINT.IfChange(python_tag) python_tag = selects.with_or({ - ("//python:limited_api_3.8", "//python:full_api_3.8"): "cp38", - "//python:full_api_3.9": "cp39", + ("//python:limited_api_3.9", "//python:full_api_3.9"): "cp39", "//python:limited_api_3.10": "cp310", "//conditions:default": "cp" + SYSTEM_PYTHON_VERSION, }), @@ -371,11 +392,11 @@ py_wheel( classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ], distribution = "protobuf", extra_distinfo_files = { @@ -384,7 +405,7 @@ py_wheel( homepage = "https://developers.google.com/protocol-buffers/", license = "3-Clause BSD License", platform = "any", - python_requires = ">=3.8", + python_requires = ">=3.9", python_tag = "py3", strip_path_prefixes = [ "python/", @@ -425,8 +446,8 @@ py_wheel( "//:python_common_test_protos", "//:python_specific_test_protos", "//:python_test_srcs", - "//python/pb_unit_tests:test_files", "//src/google/protobuf:testdata", + "@com_google_absl_py//absl/testing:parameterized", ], ) @@ -440,7 +461,6 @@ py_dist( # Windows needs version-specific wheels until 3.10. # LINT.IfChange(full_api_version) full_api_versions = [ - "38", "39", ], # LINT.ThenChange(:python_tag) @@ -454,9 +474,9 @@ py_dist( limited_api_wheels = { "win32": "310", "win64": "310", - "linux-x86_64": "38", - "linux-aarch_64": "38", - "osx-universal2": "38", + "linux-x86_64": "39", + "linux-aarch_64": "39", + "osx-universal2": "39", }, # LINT.ThenChange(:python_tag) pure_python_wheel = ":pure_python_wheel", diff --git a/third_party/protobuf/python/dist/dist.bzl b/third_party/protobuf/python/dist/dist.bzl index 061125ede6376..7c9095e2659ec 100644 --- a/third_party/protobuf/python/dist/dist.bzl +++ b/third_party/protobuf/python/dist/dist.bzl @@ -29,6 +29,7 @@ def _get_suffix(limited_api, python_version, cpu): "linux-aarch_64": "aarch64-linux-gnu", "linux-x86_64": "x86_64-linux-gnu", "k8": "x86_64-linux-gnu", + "s390x": "s390x-linux-gnu", } return ".cpython-{}-{}.{}".format( diff --git a/third_party/protobuf/python/dist/setup.py b/third_party/protobuf/python/dist/setup.py index 3ace6a88185da..4a92a4de17ae2 100755 --- a/third_party/protobuf/python/dist/setup.py +++ b/third_party/protobuf/python/dist/setup.py @@ -12,7 +12,7 @@ import glob import os import sys -from setuptools import setup, Extension, find_packages +from setuptools import setup, Extension, find_namespace_packages def GetVersion(): @@ -53,14 +53,13 @@ setup( classifiers=[ 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', ], - namespace_packages=['google'], - packages=find_packages(), + packages=find_namespace_packages(include=['google*']), install_requires=[], ext_modules=[ Extension( @@ -74,5 +73,5 @@ setup( extra_link_args=extra_link_args, ) ], - python_requires='>=3.8', + python_requires='>=3.9', ) diff --git a/third_party/protobuf/python/dist/system_python.bzl b/third_party/protobuf/python/dist/system_python.bzl index 9367dd00fd1e6..390bf3c2a643c 100644 --- a/third_party/protobuf/python/dist/system_python.bzl +++ b/third_party/protobuf/python/dist/system_python.bzl @@ -242,7 +242,7 @@ def _system_python_impl(repository_ctx): # Pip dependencies can optionally be specified using a wrapper around rules_python's repository rules: # load("@system_python//:pip.bzl", "pip_install") # pip_install( -# name="pip_deps", +# name="protobuf_pip_deps", # requirements = "@com_google_protobuf//python:requirements.txt", # ) # An optional argument `requirements_overrides` takes a dictionary mapping python versions to alternate @@ -266,6 +266,6 @@ system_python = repository_rule( implementation = _system_python_impl, local = True, attrs = { - "minimum_python_version": attr.string(default = "3.8"), + "minimum_python_version": attr.string(default = "3.9"), }, ) diff --git a/third_party/protobuf/python/docs/requirements.txt b/third_party/protobuf/python/docs/requirements.txt index 784c889b4c4c0..2b449d590ab12 100644 --- a/third_party/protobuf/python/docs/requirements.txt +++ b/third_party/protobuf/python/docs/requirements.txt @@ -1,5 +1,5 @@ googleapis-common-protos==1.56.1 -jinja2==3.0.0 +jinja2==3.1.5 sphinx==3.0.4 sphinx_rtd_theme==0.4.3 sphinxcontrib-napoleon==0.7 diff --git a/third_party/protobuf/python/extension_dict.c b/third_party/protobuf/python/extension_dict.c index 34e1f9bd291a3..9c2a039b73972 100644 --- a/third_party/protobuf/python/extension_dict.c +++ b/third_party/protobuf/python/extension_dict.c @@ -16,8 +16,10 @@ // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyObject* msg; // Owning ref to our parent pessage. + // clang-format on } PyUpb_ExtensionDict; PyObject* PyUpb_ExtensionDict_New(PyObject* msg) { @@ -168,8 +170,10 @@ static PyType_Spec PyUpb_ExtensionDict_Spec = { // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyObject* msg; + // clang-format on size_t iter; } PyUpb_ExtensionIterator; diff --git a/third_party/protobuf/python/google/protobuf/__init__.py b/third_party/protobuf/python/google/protobuf/__init__.py index 92052b2806770..cf28114a785af 100755 --- a/third_party/protobuf/python/google/protobuf/__init__.py +++ b/third_party/protobuf/python/google/protobuf/__init__.py @@ -7,4 +7,4 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '5.29.3' +__version__ = '6.30.1' diff --git a/third_party/protobuf/python/google/protobuf/compiler/plugin_pb2.py b/third_party/protobuf/python/google/protobuf/compiler/plugin_pb2.py index 28012f66e56c2..692eecbe85b72 100644 --- a/third_party/protobuf/python/google/protobuf/compiler/plugin_pb2.py +++ b/third_party/protobuf/python/google/protobuf/compiler/plugin_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/compiler/plugin.proto -# Protobuf Python Version: 5.29.3 +# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -11,9 +11,9 @@ from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 5, - 29, - 3, + 6, + 30, + 1, '', 'google/protobuf/compiler/plugin.proto' ) diff --git a/third_party/protobuf/python/google/protobuf/descriptor_database.py b/third_party/protobuf/python/google/protobuf/descriptor_database.py index 46a893e3167a4..eeb8599372827 100644 --- a/third_party/protobuf/python/google/protobuf/descriptor_database.py +++ b/third_party/protobuf/python/google/protobuf/descriptor_database.py @@ -52,14 +52,24 @@ class DescriptorDatabase(object): for name in _ExtractSymbols(message, package): self._AddSymbol(name, file_desc_proto) for enum in file_desc_proto.enum_type: - self._AddSymbol(('.'.join((package, enum.name))), file_desc_proto) + self._AddSymbol( + ('.'.join((package, enum.name)) if package else enum.name), + file_desc_proto, + ) for enum_value in enum.value: self._file_desc_protos_by_symbol[ - '.'.join((package, enum_value.name))] = file_desc_proto + '.'.join((package, enum_value.name)) if package else enum_value.name + ] = file_desc_proto for extension in file_desc_proto.extension: - self._AddSymbol(('.'.join((package, extension.name))), file_desc_proto) + self._AddSymbol( + ('.'.join((package, extension.name)) if package else extension.name), + file_desc_proto, + ) for service in file_desc_proto.service: - self._AddSymbol(('.'.join((package, service.name))), file_desc_proto) + self._AddSymbol( + ('.'.join((package, service.name)) if package else service.name), + file_desc_proto, + ) def FindFileByName(self, name): """Finds the file descriptor proto by file name. @@ -102,6 +112,14 @@ class DescriptorDatabase(object): Raises: KeyError if no file contains the specified symbol. """ + if symbol.count('.') == 1 and symbol[0] == '.': + symbol = symbol.lstrip('.') + warnings.warn( + 'Please remove the leading "." when ' + 'FindFileContainingSymbol, this will turn to error ' + 'in 2026 Jan.', + RuntimeWarning, + ) try: return self._file_desc_protos_by_symbol[symbol] except KeyError: diff --git a/third_party/protobuf/python/google/protobuf/descriptor_pb2.py b/third_party/protobuf/python/google/protobuf/descriptor_pb2.py index 95da615f0d1f1..79a8c3ad74d01 100644 --- a/third_party/protobuf/python/google/protobuf/descriptor_pb2.py +++ b/third_party/protobuf/python/google/protobuf/descriptor_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: google/protobuf/descriptor.proto -# Protobuf Python Version: 5.29.3 +# Protobuf Python Version: 6.30.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -11,9 +11,9 @@ from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, - 5, - 29, - 3, + 6, + 30, + 1, '', 'google/protobuf/descriptor.proto' ) @@ -32,10 +32,10 @@ if not _descriptor._USE_C_DESCRIPTORS: edition='EDITION_PROTO2', serialized_options=b'\n\023com.google.protobufB\020DescriptorProtosH\001Z-google.golang.org/protobuf/types/descriptorpb\370\001\001\242\002\003GPB\252\002\032Google.Protobuf.Reflection', create_key=_descriptor._internal_create_key, - serialized_pb=b'\n google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"U\n\x11\x46ileDescriptorSet\x12\x32\n\x04\x66ile\x18\x01 \x03(\x0b\x32$.google.protobuf.FileDescriptorProto*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x86\x04\n\x13\x46ileDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07package\x18\x02 \x01(\t\x12\x12\n\ndependency\x18\x03 \x03(\t\x12\x19\n\x11public_dependency\x18\n \x03(\x05\x12\x17\n\x0fweak_dependency\x18\x0b \x03(\x05\x12\x36\n\x0cmessage_type\x18\x04 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x05 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12\x38\n\x07service\x18\x06 \x03(\x0b\x32\'.google.protobuf.ServiceDescriptorProto\x12\x38\n\textension\x18\x07 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12-\n\x07options\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.FileOptions\x12\x39\n\x10source_code_info\x18\t \x01(\x0b\x32\x1f.google.protobuf.SourceCodeInfo\x12\x0e\n\x06syntax\x18\x0c \x01(\t\x12)\n\x07\x65\x64ition\x18\x0e \x01(\x0e\x32\x18.google.protobuf.Edition\"\xa9\x05\n\x0f\x44\x65scriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x34\n\x05\x66ield\x18\x02 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x38\n\textension\x18\x06 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x35\n\x0bnested_type\x18\x03 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x04 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12H\n\x0f\x65xtension_range\x18\x05 \x03(\x0b\x32/.google.protobuf.DescriptorProto.ExtensionRange\x12\x39\n\noneof_decl\x18\x08 \x03(\x0b\x32%.google.protobuf.OneofDescriptorProto\x12\x30\n\x07options\x18\x07 \x01(\x0b\x32\x1f.google.protobuf.MessageOptions\x12\x46\n\x0ereserved_range\x18\t \x03(\x0b\x32..google.protobuf.DescriptorProto.ReservedRange\x12\x15\n\rreserved_name\x18\n \x03(\t\x1a\x65\n\x0e\x45xtensionRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\x12\x37\n\x07options\x18\x03 \x01(\x0b\x32&.google.protobuf.ExtensionRangeOptions\x1a+\n\rReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"\xe5\x03\n\x15\x45xtensionRangeOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x12L\n\x0b\x64\x65\x63laration\x18\x02 \x03(\x0b\x32\x32.google.protobuf.ExtensionRangeOptions.DeclarationB\x03\x88\x01\x02\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12_\n\x0cverification\x18\x03 \x01(\x0e\x32\x38.google.protobuf.ExtensionRangeOptions.VerificationState:\nUNVERIFIEDB\x03\x88\x01\x02\x1ah\n\x0b\x44\x65\x63laration\x12\x0e\n\x06number\x18\x01 \x01(\x05\x12\x11\n\tfull_name\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x10\n\x08reserved\x18\x05 \x01(\x08\x12\x10\n\x08repeated\x18\x06 \x01(\x08J\x04\x08\x04\x10\x05\"4\n\x11VerificationState\x12\x0f\n\x0b\x44\x45\x43LARATION\x10\x00\x12\x0e\n\nUNVERIFIED\x10\x01*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xd5\x05\n\x14\x46ieldDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x03 \x01(\x05\x12:\n\x05label\x18\x04 \x01(\x0e\x32+.google.protobuf.FieldDescriptorProto.Label\x12\x38\n\x04type\x18\x05 \x01(\x0e\x32*.google.protobuf.FieldDescriptorProto.Type\x12\x11\n\ttype_name\x18\x06 \x01(\t\x12\x10\n\x08\x65xtendee\x18\x02 \x01(\t\x12\x15\n\rdefault_value\x18\x07 \x01(\t\x12\x13\n\x0boneof_index\x18\t \x01(\x05\x12\x11\n\tjson_name\x18\n \x01(\t\x12.\n\x07options\x18\x08 \x01(\x0b\x32\x1d.google.protobuf.FieldOptions\x12\x17\n\x0fproto3_optional\x18\x11 \x01(\x08\"\xb6\x02\n\x04Type\x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\x05Label\x12\x12\n\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REPEATED\x10\x03\x12\x12\n\x0eLABEL_REQUIRED\x10\x02\"T\n\x14OneofDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x07options\x18\x02 \x01(\x0b\x32\x1d.google.protobuf.OneofOptions\"\xa4\x02\n\x13\x45numDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x03(\x0b\x32).google.protobuf.EnumValueDescriptorProto\x12-\n\x07options\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.EnumOptions\x12N\n\x0ereserved_range\x18\x04 \x03(\x0b\x32\x36.google.protobuf.EnumDescriptorProto.EnumReservedRange\x12\x15\n\rreserved_name\x18\x05 \x03(\t\x1a/\n\x11\x45numReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"l\n\x18\x45numValueDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\x05\x12\x32\n\x07options\x18\x03 \x01(\x0b\x32!.google.protobuf.EnumValueOptions\"\x90\x01\n\x16ServiceDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x36\n\x06method\x18\x02 \x03(\x0b\x32&.google.protobuf.MethodDescriptorProto\x12\x30\n\x07options\x18\x03 \x01(\x0b\x32\x1f.google.protobuf.ServiceOptions\"\xc1\x01\n\x15MethodDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ninput_type\x18\x02 \x01(\t\x12\x13\n\x0boutput_type\x18\x03 \x01(\t\x12/\n\x07options\x18\x04 \x01(\x0b\x32\x1e.google.protobuf.MethodOptions\x12\x1f\n\x10\x63lient_streaming\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x10server_streaming\x18\x06 \x01(\x08:\x05\x66\x61lse\"\xcb\x06\n\x0b\x46ileOptions\x12\x14\n\x0cjava_package\x18\x01 \x01(\t\x12\x1c\n\x14java_outer_classname\x18\x08 \x01(\t\x12\"\n\x13java_multiple_files\x18\n \x01(\x08:\x05\x66\x61lse\x12)\n\x1djava_generate_equals_and_hash\x18\x14 \x01(\x08\x42\x02\x18\x01\x12%\n\x16java_string_check_utf8\x18\x1b \x01(\x08:\x05\x66\x61lse\x12\x46\n\x0coptimize_for\x18\t \x01(\x0e\x32).google.protobuf.FileOptions.OptimizeMode:\x05SPEED\x12\x12\n\ngo_package\x18\x0b \x01(\t\x12\"\n\x13\x63\x63_generic_services\x18\x10 \x01(\x08:\x05\x66\x61lse\x12$\n\x15java_generic_services\x18\x11 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13py_generic_services\x18\x12 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x10\x63\x63_enable_arenas\x18\x1f \x01(\x08:\x04true\x12\x19\n\x11objc_class_prefix\x18$ \x01(\t\x12\x18\n\x10\x63sharp_namespace\x18% \x01(\t\x12\x14\n\x0cswift_prefix\x18\' \x01(\t\x12\x18\n\x10php_class_prefix\x18( \x01(\t\x12\x15\n\rphp_namespace\x18) \x01(\t\x12\x1e\n\x16php_metadata_namespace\x18, \x01(\t\x12\x14\n\x0cruby_package\x18- \x01(\t\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\":\n\x0cOptimizeMode\x12\t\n\x05SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02\x12\x10\n\x0cLITE_RUNTIME\x10\x03*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08*\x10+J\x04\x08&\x10\'R\x14php_generic_services\"\xe7\x02\n\x0eMessageOptions\x12&\n\x17message_set_wire_format\x18\x01 \x01(\x08:\x05\x66\x61lse\x12.\n\x1fno_standard_descriptor_accessor\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x11\n\tmap_entry\x18\x07 \x01(\x08\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x0b \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x0c \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xa3\x0b\n\x0c\x46ieldOptions\x12:\n\x05\x63type\x18\x01 \x01(\x0e\x32#.google.protobuf.FieldOptions.CType:\x06STRING\x12\x0e\n\x06packed\x18\x02 \x01(\x08\x12?\n\x06jstype\x18\x06 \x01(\x0e\x32$.google.protobuf.FieldOptions.JSType:\tJS_NORMAL\x12\x13\n\x04lazy\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x0funverified_lazy\x18\x0f \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x13\n\x04weak\x18\n \x01(\x08:\x05\x66\x61lse\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x10 \x01(\x08:\x05\x66\x61lse\x12@\n\tretention\x18\x11 \x01(\x0e\x32-.google.protobuf.FieldOptions.OptionRetention\x12?\n\x07targets\x18\x13 \x03(\x0e\x32..google.protobuf.FieldOptions.OptionTargetType\x12\x46\n\x10\x65\x64ition_defaults\x18\x14 \x03(\x0b\x32,.google.protobuf.FieldOptions.EditionDefault\x12-\n\x08\x66\x65\x61tures\x18\x15 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x16 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x1aJ\n\x0e\x45\x64itionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\r\n\x05value\x18\x02 \x01(\t\x1a\xcc\x01\n\x0e\x46\x65\x61tureSupport\x12\x34\n\x12\x65\x64ition_introduced\x18\x01 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x34\n\x12\x65\x64ition_deprecated\x18\x02 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x1b\n\x13\x64\x65precation_warning\x18\x03 \x01(\t\x12\x31\n\x0f\x65\x64ition_removed\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\"/\n\x05\x43Type\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x43ORD\x10\x01\x12\x10\n\x0cSTRING_PIECE\x10\x02\"5\n\x06JSType\x12\r\n\tJS_NORMAL\x10\x00\x12\r\n\tJS_STRING\x10\x01\x12\r\n\tJS_NUMBER\x10\x02\"U\n\x0fOptionRetention\x12\x15\n\x11RETENTION_UNKNOWN\x10\x00\x12\x15\n\x11RETENTION_RUNTIME\x10\x01\x12\x14\n\x10RETENTION_SOURCE\x10\x02\"\x8c\x02\n\x10OptionTargetType\x12\x17\n\x13TARGET_TYPE_UNKNOWN\x10\x00\x12\x14\n\x10TARGET_TYPE_FILE\x10\x01\x12\x1f\n\x1bTARGET_TYPE_EXTENSION_RANGE\x10\x02\x12\x17\n\x13TARGET_TYPE_MESSAGE\x10\x03\x12\x15\n\x11TARGET_TYPE_FIELD\x10\x04\x12\x15\n\x11TARGET_TYPE_ONEOF\x10\x05\x12\x14\n\x10TARGET_TYPE_ENUM\x10\x06\x12\x1a\n\x16TARGET_TYPE_ENUM_ENTRY\x10\x07\x12\x17\n\x13TARGET_TYPE_SERVICE\x10\x08\x12\x16\n\x12TARGET_TYPE_METHOD\x10\t*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x12\x10\x13\"\x8d\x01\n\x0cOneofOptions\x12-\n\x08\x66\x65\x61tures\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xf6\x01\n\x0b\x45numOptions\x12\x13\n\x0b\x61llow_alias\x18\x02 \x01(\x08\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x06 \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x07 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x05\x10\x06\"\x90\x02\n\x10\x45numValueOptions\x12\x19\n\ndeprecated\x18\x01 \x01(\x08:\x05\x66\x61lse\x12-\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x04 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xaa\x01\n\x0eServiceOptions\x12-\n\x08\x66\x65\x61tures\x18\" \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xdc\x02\n\rMethodOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12_\n\x11idempotency_level\x18\" \x01(\x0e\x32/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UNKNOWN\x12-\n\x08\x66\x65\x61tures\x18# \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"P\n\x10IdempotencyLevel\x12\x17\n\x13IDEMPOTENCY_UNKNOWN\x10\x00\x12\x13\n\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n\nIDEMPOTENT\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9e\x02\n\x13UninterpretedOption\x12;\n\x04name\x18\x02 \x03(\x0b\x32-.google.protobuf.UninterpretedOption.NamePart\x12\x18\n\x10identifier_value\x18\x03 \x01(\t\x12\x1a\n\x12positive_int_value\x18\x04 \x01(\x04\x12\x1a\n\x12negative_int_value\x18\x05 \x01(\x03\x12\x14\n\x0c\x64ouble_value\x18\x06 \x01(\x01\x12\x14\n\x0cstring_value\x18\x07 \x01(\x0c\x12\x17\n\x0f\x61ggregate_value\x18\x08 \x01(\t\x1a\x33\n\x08NamePart\x12\x11\n\tname_part\x18\x01 \x02(\t\x12\x14\n\x0cis_extension\x18\x02 \x02(\x08\"\xc9\t\n\nFeatureSet\x12\x82\x01\n\x0e\x66ield_presence\x18\x01 \x01(\x0e\x32).google.protobuf.FeatureSet.FieldPresenceB?\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPLICIT\x18\x84\x07\xa2\x01\r\x12\x08IMPLICIT\x18\xe7\x07\xa2\x01\r\x12\x08\x45XPLICIT\x18\xe8\x07\xb2\x01\x03\x08\xe8\x07\x12\x62\n\tenum_type\x18\x02 \x01(\x0e\x32$.google.protobuf.FeatureSet.EnumTypeB)\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\x0b\x12\x06\x43LOSED\x18\x84\x07\xa2\x01\t\x12\x04OPEN\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12\x81\x01\n\x17repeated_field_encoding\x18\x03 \x01(\x0e\x32\x31.google.protobuf.FeatureSet.RepeatedFieldEncodingB-\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPANDED\x18\x84\x07\xa2\x01\x0b\x12\x06PACKED\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12n\n\x0futf8_validation\x18\x04 \x01(\x0e\x32*.google.protobuf.FeatureSet.Utf8ValidationB)\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\t\x12\x04NONE\x18\x84\x07\xa2\x01\x0b\x12\x06VERIFY\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12m\n\x10message_encoding\x18\x05 \x01(\x0e\x32+.google.protobuf.FeatureSet.MessageEncodingB&\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x14\x12\x0fLENGTH_PREFIXED\x18\x84\x07\xb2\x01\x03\x08\xe8\x07\x12v\n\x0bjson_format\x18\x06 \x01(\x0e\x32&.google.protobuf.FeatureSet.JsonFormatB9\x88\x01\x01\x98\x01\x03\x98\x01\x06\x98\x01\x01\xa2\x01\x17\x12\x12LEGACY_BEST_EFFORT\x18\x84\x07\xa2\x01\n\x12\x05\x41LLOW\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\"\\\n\rFieldPresence\x12\x1a\n\x16\x46IELD_PRESENCE_UNKNOWN\x10\x00\x12\x0c\n\x08\x45XPLICIT\x10\x01\x12\x0c\n\x08IMPLICIT\x10\x02\x12\x13\n\x0fLEGACY_REQUIRED\x10\x03\"7\n\x08\x45numType\x12\x15\n\x11\x45NUM_TYPE_UNKNOWN\x10\x00\x12\x08\n\x04OPEN\x10\x01\x12\n\n\x06\x43LOSED\x10\x02\"V\n\x15RepeatedFieldEncoding\x12#\n\x1fREPEATED_FIELD_ENCODING_UNKNOWN\x10\x00\x12\n\n\x06PACKED\x10\x01\x12\x0c\n\x08\x45XPANDED\x10\x02\"I\n\x0eUtf8Validation\x12\x1b\n\x17UTF8_VALIDATION_UNKNOWN\x10\x00\x12\n\n\x06VERIFY\x10\x02\x12\x08\n\x04NONE\x10\x03\"\x04\x08\x01\x10\x01\"S\n\x0fMessageEncoding\x12\x1c\n\x18MESSAGE_ENCODING_UNKNOWN\x10\x00\x12\x13\n\x0fLENGTH_PREFIXED\x10\x01\x12\r\n\tDELIMITED\x10\x02\"H\n\nJsonFormat\x12\x17\n\x13JSON_FORMAT_UNKNOWN\x10\x00\x12\t\n\x05\x41LLOW\x10\x01\x12\x16\n\x12LEGACY_BEST_EFFORT\x10\x02*\x06\x08\xe8\x07\x10\x8bN*\x06\x08\x8bN\x10\x90N*\x06\x08\x90N\x10\x91NJ\x06\x08\xe7\x07\x10\xe8\x07\"\x98\x03\n\x12\x46\x65\x61tureSetDefaults\x12N\n\x08\x64\x65\x66\x61ults\x18\x01 \x03(\x0b\x32<.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault\x12\x31\n\x0fminimum_edition\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x31\n\x0fmaximum_edition\x18\x05 \x01(\x0e\x32\x18.google.protobuf.Edition\x1a\xcb\x01\n\x18\x46\x65\x61tureSetEditionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x39\n\x14overridable_features\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x33\n\x0e\x66ixed_features\x18\x05 \x01(\x0b\x32\x1b.google.protobuf.FeatureSetJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x08\x66\x65\x61tures\"\xe3\x01\n\x0eSourceCodeInfo\x12:\n\x08location\x18\x01 \x03(\x0b\x32(.google.protobuf.SourceCodeInfo.Location\x1a\x86\x01\n\x08Location\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x10\n\x04span\x18\x02 \x03(\x05\x42\x02\x10\x01\x12\x18\n\x10leading_comments\x18\x03 \x01(\t\x12\x19\n\x11trailing_comments\x18\x04 \x01(\t\x12!\n\x19leading_detached_comments\x18\x06 \x03(\t*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x9c\x02\n\x11GeneratedCodeInfo\x12\x41\n\nannotation\x18\x01 \x03(\x0b\x32-.google.protobuf.GeneratedCodeInfo.Annotation\x1a\xc3\x01\n\nAnnotation\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bsource_file\x18\x02 \x01(\t\x12\r\n\x05\x62\x65gin\x18\x03 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x05\x12H\n\x08semantic\x18\x05 \x01(\x0e\x32\x36.google.protobuf.GeneratedCodeInfo.Annotation.Semantic\"(\n\x08Semantic\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03SET\x10\x01\x12\t\n\x05\x41LIAS\x10\x02*\xa7\x02\n\x07\x45\x64ition\x12\x13\n\x0f\x45\x44ITION_UNKNOWN\x10\x00\x12\x13\n\x0e\x45\x44ITION_LEGACY\x10\x84\x07\x12\x13\n\x0e\x45\x44ITION_PROTO2\x10\xe6\x07\x12\x13\n\x0e\x45\x44ITION_PROTO3\x10\xe7\x07\x12\x11\n\x0c\x45\x44ITION_2023\x10\xe8\x07\x12\x11\n\x0c\x45\x44ITION_2024\x10\xe9\x07\x12\x17\n\x13\x45\x44ITION_1_TEST_ONLY\x10\x01\x12\x17\n\x13\x45\x44ITION_2_TEST_ONLY\x10\x02\x12\x1d\n\x17\x45\x44ITION_99997_TEST_ONLY\x10\x9d\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99998_TEST_ONLY\x10\x9e\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99999_TEST_ONLY\x10\x9f\x8d\x06\x12\x13\n\x0b\x45\x44ITION_MAX\x10\xff\xff\xff\xff\x07\x42~\n\x13\x63om.google.protobufB\x10\x44\x65scriptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.Reflection' + serialized_pb=b'\n google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"U\n\x11\x46ileDescriptorSet\x12\x32\n\x04\x66ile\x18\x01 \x03(\x0b\x32$.google.protobuf.FileDescriptorProto*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x86\x04\n\x13\x46ileDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07package\x18\x02 \x01(\t\x12\x12\n\ndependency\x18\x03 \x03(\t\x12\x19\n\x11public_dependency\x18\n \x03(\x05\x12\x17\n\x0fweak_dependency\x18\x0b \x03(\x05\x12\x36\n\x0cmessage_type\x18\x04 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x05 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12\x38\n\x07service\x18\x06 \x03(\x0b\x32\'.google.protobuf.ServiceDescriptorProto\x12\x38\n\textension\x18\x07 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12-\n\x07options\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.FileOptions\x12\x39\n\x10source_code_info\x18\t \x01(\x0b\x32\x1f.google.protobuf.SourceCodeInfo\x12\x0e\n\x06syntax\x18\x0c \x01(\t\x12)\n\x07\x65\x64ition\x18\x0e \x01(\x0e\x32\x18.google.protobuf.Edition\"\xa9\x05\n\x0f\x44\x65scriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x34\n\x05\x66ield\x18\x02 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x38\n\textension\x18\x06 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x35\n\x0bnested_type\x18\x03 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x04 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12H\n\x0f\x65xtension_range\x18\x05 \x03(\x0b\x32/.google.protobuf.DescriptorProto.ExtensionRange\x12\x39\n\noneof_decl\x18\x08 \x03(\x0b\x32%.google.protobuf.OneofDescriptorProto\x12\x30\n\x07options\x18\x07 \x01(\x0b\x32\x1f.google.protobuf.MessageOptions\x12\x46\n\x0ereserved_range\x18\t \x03(\x0b\x32..google.protobuf.DescriptorProto.ReservedRange\x12\x15\n\rreserved_name\x18\n \x03(\t\x1a\x65\n\x0e\x45xtensionRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\x12\x37\n\x07options\x18\x03 \x01(\x0b\x32&.google.protobuf.ExtensionRangeOptions\x1a+\n\rReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"\xe5\x03\n\x15\x45xtensionRangeOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x12L\n\x0b\x64\x65\x63laration\x18\x02 \x03(\x0b\x32\x32.google.protobuf.ExtensionRangeOptions.DeclarationB\x03\x88\x01\x02\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12_\n\x0cverification\x18\x03 \x01(\x0e\x32\x38.google.protobuf.ExtensionRangeOptions.VerificationState:\nUNVERIFIEDB\x03\x88\x01\x02\x1ah\n\x0b\x44\x65\x63laration\x12\x0e\n\x06number\x18\x01 \x01(\x05\x12\x11\n\tfull_name\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x10\n\x08reserved\x18\x05 \x01(\x08\x12\x10\n\x08repeated\x18\x06 \x01(\x08J\x04\x08\x04\x10\x05\"4\n\x11VerificationState\x12\x0f\n\x0b\x44\x45\x43LARATION\x10\x00\x12\x0e\n\nUNVERIFIED\x10\x01*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xd5\x05\n\x14\x46ieldDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x03 \x01(\x05\x12:\n\x05label\x18\x04 \x01(\x0e\x32+.google.protobuf.FieldDescriptorProto.Label\x12\x38\n\x04type\x18\x05 \x01(\x0e\x32*.google.protobuf.FieldDescriptorProto.Type\x12\x11\n\ttype_name\x18\x06 \x01(\t\x12\x10\n\x08\x65xtendee\x18\x02 \x01(\t\x12\x15\n\rdefault_value\x18\x07 \x01(\t\x12\x13\n\x0boneof_index\x18\t \x01(\x05\x12\x11\n\tjson_name\x18\n \x01(\t\x12.\n\x07options\x18\x08 \x01(\x0b\x32\x1d.google.protobuf.FieldOptions\x12\x17\n\x0fproto3_optional\x18\x11 \x01(\x08\"\xb6\x02\n\x04Type\x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\x05Label\x12\x12\n\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REPEATED\x10\x03\x12\x12\n\x0eLABEL_REQUIRED\x10\x02\"T\n\x14OneofDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x07options\x18\x02 \x01(\x0b\x32\x1d.google.protobuf.OneofOptions\"\xa4\x02\n\x13\x45numDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x03(\x0b\x32).google.protobuf.EnumValueDescriptorProto\x12-\n\x07options\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.EnumOptions\x12N\n\x0ereserved_range\x18\x04 \x03(\x0b\x32\x36.google.protobuf.EnumDescriptorProto.EnumReservedRange\x12\x15\n\rreserved_name\x18\x05 \x03(\t\x1a/\n\x11\x45numReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"l\n\x18\x45numValueDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\x05\x12\x32\n\x07options\x18\x03 \x01(\x0b\x32!.google.protobuf.EnumValueOptions\"\x90\x01\n\x16ServiceDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x36\n\x06method\x18\x02 \x03(\x0b\x32&.google.protobuf.MethodDescriptorProto\x12\x30\n\x07options\x18\x03 \x01(\x0b\x32\x1f.google.protobuf.ServiceOptions\"\xc1\x01\n\x15MethodDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ninput_type\x18\x02 \x01(\t\x12\x13\n\x0boutput_type\x18\x03 \x01(\t\x12/\n\x07options\x18\x04 \x01(\x0b\x32\x1e.google.protobuf.MethodOptions\x12\x1f\n\x10\x63lient_streaming\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x10server_streaming\x18\x06 \x01(\x08:\x05\x66\x61lse\"\xcb\x06\n\x0b\x46ileOptions\x12\x14\n\x0cjava_package\x18\x01 \x01(\t\x12\x1c\n\x14java_outer_classname\x18\x08 \x01(\t\x12\"\n\x13java_multiple_files\x18\n \x01(\x08:\x05\x66\x61lse\x12)\n\x1djava_generate_equals_and_hash\x18\x14 \x01(\x08\x42\x02\x18\x01\x12%\n\x16java_string_check_utf8\x18\x1b \x01(\x08:\x05\x66\x61lse\x12\x46\n\x0coptimize_for\x18\t \x01(\x0e\x32).google.protobuf.FileOptions.OptimizeMode:\x05SPEED\x12\x12\n\ngo_package\x18\x0b \x01(\t\x12\"\n\x13\x63\x63_generic_services\x18\x10 \x01(\x08:\x05\x66\x61lse\x12$\n\x15java_generic_services\x18\x11 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13py_generic_services\x18\x12 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x10\x63\x63_enable_arenas\x18\x1f \x01(\x08:\x04true\x12\x19\n\x11objc_class_prefix\x18$ \x01(\t\x12\x18\n\x10\x63sharp_namespace\x18% \x01(\t\x12\x14\n\x0cswift_prefix\x18\' \x01(\t\x12\x18\n\x10php_class_prefix\x18( \x01(\t\x12\x15\n\rphp_namespace\x18) \x01(\t\x12\x1e\n\x16php_metadata_namespace\x18, \x01(\t\x12\x14\n\x0cruby_package\x18- \x01(\t\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\":\n\x0cOptimizeMode\x12\t\n\x05SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02\x12\x10\n\x0cLITE_RUNTIME\x10\x03*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08*\x10+J\x04\x08&\x10\'R\x14php_generic_services\"\xe7\x02\n\x0eMessageOptions\x12&\n\x17message_set_wire_format\x18\x01 \x01(\x08:\x05\x66\x61lse\x12.\n\x1fno_standard_descriptor_accessor\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x11\n\tmap_entry\x18\x07 \x01(\x08\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x0b \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x0c \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xa3\x0b\n\x0c\x46ieldOptions\x12:\n\x05\x63type\x18\x01 \x01(\x0e\x32#.google.protobuf.FieldOptions.CType:\x06STRING\x12\x0e\n\x06packed\x18\x02 \x01(\x08\x12?\n\x06jstype\x18\x06 \x01(\x0e\x32$.google.protobuf.FieldOptions.JSType:\tJS_NORMAL\x12\x13\n\x04lazy\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x0funverified_lazy\x18\x0f \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x13\n\x04weak\x18\n \x01(\x08:\x05\x66\x61lse\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x10 \x01(\x08:\x05\x66\x61lse\x12@\n\tretention\x18\x11 \x01(\x0e\x32-.google.protobuf.FieldOptions.OptionRetention\x12?\n\x07targets\x18\x13 \x03(\x0e\x32..google.protobuf.FieldOptions.OptionTargetType\x12\x46\n\x10\x65\x64ition_defaults\x18\x14 \x03(\x0b\x32,.google.protobuf.FieldOptions.EditionDefault\x12-\n\x08\x66\x65\x61tures\x18\x15 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x16 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x1aJ\n\x0e\x45\x64itionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\r\n\x05value\x18\x02 \x01(\t\x1a\xcc\x01\n\x0e\x46\x65\x61tureSupport\x12\x34\n\x12\x65\x64ition_introduced\x18\x01 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x34\n\x12\x65\x64ition_deprecated\x18\x02 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x1b\n\x13\x64\x65precation_warning\x18\x03 \x01(\t\x12\x31\n\x0f\x65\x64ition_removed\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\"/\n\x05\x43Type\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x43ORD\x10\x01\x12\x10\n\x0cSTRING_PIECE\x10\x02\"5\n\x06JSType\x12\r\n\tJS_NORMAL\x10\x00\x12\r\n\tJS_STRING\x10\x01\x12\r\n\tJS_NUMBER\x10\x02\"U\n\x0fOptionRetention\x12\x15\n\x11RETENTION_UNKNOWN\x10\x00\x12\x15\n\x11RETENTION_RUNTIME\x10\x01\x12\x14\n\x10RETENTION_SOURCE\x10\x02\"\x8c\x02\n\x10OptionTargetType\x12\x17\n\x13TARGET_TYPE_UNKNOWN\x10\x00\x12\x14\n\x10TARGET_TYPE_FILE\x10\x01\x12\x1f\n\x1bTARGET_TYPE_EXTENSION_RANGE\x10\x02\x12\x17\n\x13TARGET_TYPE_MESSAGE\x10\x03\x12\x15\n\x11TARGET_TYPE_FIELD\x10\x04\x12\x15\n\x11TARGET_TYPE_ONEOF\x10\x05\x12\x14\n\x10TARGET_TYPE_ENUM\x10\x06\x12\x1a\n\x16TARGET_TYPE_ENUM_ENTRY\x10\x07\x12\x17\n\x13TARGET_TYPE_SERVICE\x10\x08\x12\x16\n\x12TARGET_TYPE_METHOD\x10\t*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x12\x10\x13\"\x8d\x01\n\x0cOneofOptions\x12-\n\x08\x66\x65\x61tures\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xf6\x01\n\x0b\x45numOptions\x12\x13\n\x0b\x61llow_alias\x18\x02 \x01(\x08\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x06 \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x07 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x05\x10\x06\"\x90\x02\n\x10\x45numValueOptions\x12\x19\n\ndeprecated\x18\x01 \x01(\x08:\x05\x66\x61lse\x12-\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x04 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xaa\x01\n\x0eServiceOptions\x12-\n\x08\x66\x65\x61tures\x18\" \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xdc\x02\n\rMethodOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12_\n\x11idempotency_level\x18\" \x01(\x0e\x32/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UNKNOWN\x12-\n\x08\x66\x65\x61tures\x18# \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"P\n\x10IdempotencyLevel\x12\x17\n\x13IDEMPOTENCY_UNKNOWN\x10\x00\x12\x13\n\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n\nIDEMPOTENT\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9e\x02\n\x13UninterpretedOption\x12;\n\x04name\x18\x02 \x03(\x0b\x32-.google.protobuf.UninterpretedOption.NamePart\x12\x18\n\x10identifier_value\x18\x03 \x01(\t\x12\x1a\n\x12positive_int_value\x18\x04 \x01(\x04\x12\x1a\n\x12negative_int_value\x18\x05 \x01(\x03\x12\x14\n\x0c\x64ouble_value\x18\x06 \x01(\x01\x12\x14\n\x0cstring_value\x18\x07 \x01(\x0c\x12\x17\n\x0f\x61ggregate_value\x18\x08 \x01(\t\x1a\x33\n\x08NamePart\x12\x11\n\tname_part\x18\x01 \x02(\t\x12\x14\n\x0cis_extension\x18\x02 \x02(\x08\"\xbc\x0b\n\nFeatureSet\x12\x82\x01\n\x0e\x66ield_presence\x18\x01 \x01(\x0e\x32).google.protobuf.FeatureSet.FieldPresenceB?\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPLICIT\x18\x84\x07\xa2\x01\r\x12\x08IMPLICIT\x18\xe7\x07\xa2\x01\r\x12\x08\x45XPLICIT\x18\xe8\x07\xb2\x01\x03\x08\xe8\x07\x12\x62\n\tenum_type\x18\x02 \x01(\x0e\x32$.google.protobuf.FeatureSet.EnumTypeB)\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\x0b\x12\x06\x43LOSED\x18\x84\x07\xa2\x01\t\x12\x04OPEN\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12\x81\x01\n\x17repeated_field_encoding\x18\x03 \x01(\x0e\x32\x31.google.protobuf.FeatureSet.RepeatedFieldEncodingB-\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPANDED\x18\x84\x07\xa2\x01\x0b\x12\x06PACKED\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12n\n\x0futf8_validation\x18\x04 \x01(\x0e\x32*.google.protobuf.FeatureSet.Utf8ValidationB)\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\t\x12\x04NONE\x18\x84\x07\xa2\x01\x0b\x12\x06VERIFY\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12m\n\x10message_encoding\x18\x05 \x01(\x0e\x32+.google.protobuf.FeatureSet.MessageEncodingB&\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x14\x12\x0fLENGTH_PREFIXED\x18\x84\x07\xb2\x01\x03\x08\xe8\x07\x12v\n\x0bjson_format\x18\x06 \x01(\x0e\x32&.google.protobuf.FeatureSet.JsonFormatB9\x88\x01\x01\x98\x01\x03\x98\x01\x06\x98\x01\x01\xa2\x01\x17\x12\x12LEGACY_BEST_EFFORT\x18\x84\x07\xa2\x01\n\x12\x05\x41LLOW\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12\x97\x01\n\x14\x65nforce_naming_style\x18\x07 \x01(\x0e\x32..google.protobuf.FeatureSet.EnforceNamingStyleBI\x88\x01\x02\x98\x01\x01\x98\x01\x02\x98\x01\x03\x98\x01\x04\x98\x01\x05\x98\x01\x06\x98\x01\x07\x98\x01\x08\x98\x01\t\xa2\x01\x11\x12\x0cSTYLE_LEGACY\x18\x84\x07\xa2\x01\x0e\x12\tSTYLE2024\x18\xe9\x07\xb2\x01\x03\x08\xe9\x07\"\\\n\rFieldPresence\x12\x1a\n\x16\x46IELD_PRESENCE_UNKNOWN\x10\x00\x12\x0c\n\x08\x45XPLICIT\x10\x01\x12\x0c\n\x08IMPLICIT\x10\x02\x12\x13\n\x0fLEGACY_REQUIRED\x10\x03\"7\n\x08\x45numType\x12\x15\n\x11\x45NUM_TYPE_UNKNOWN\x10\x00\x12\x08\n\x04OPEN\x10\x01\x12\n\n\x06\x43LOSED\x10\x02\"V\n\x15RepeatedFieldEncoding\x12#\n\x1fREPEATED_FIELD_ENCODING_UNKNOWN\x10\x00\x12\n\n\x06PACKED\x10\x01\x12\x0c\n\x08\x45XPANDED\x10\x02\"I\n\x0eUtf8Validation\x12\x1b\n\x17UTF8_VALIDATION_UNKNOWN\x10\x00\x12\n\n\x06VERIFY\x10\x02\x12\x08\n\x04NONE\x10\x03\"\x04\x08\x01\x10\x01\"S\n\x0fMessageEncoding\x12\x1c\n\x18MESSAGE_ENCODING_UNKNOWN\x10\x00\x12\x13\n\x0fLENGTH_PREFIXED\x10\x01\x12\r\n\tDELIMITED\x10\x02\"H\n\nJsonFormat\x12\x17\n\x13JSON_FORMAT_UNKNOWN\x10\x00\x12\t\n\x05\x41LLOW\x10\x01\x12\x16\n\x12LEGACY_BEST_EFFORT\x10\x02\"W\n\x12\x45nforceNamingStyle\x12 \n\x1c\x45NFORCE_NAMING_STYLE_UNKNOWN\x10\x00\x12\r\n\tSTYLE2024\x10\x01\x12\x10\n\x0cSTYLE_LEGACY\x10\x02*\x06\x08\xe8\x07\x10\x8bN*\x06\x08\x8bN\x10\x90N*\x06\x08\x90N\x10\x91NJ\x06\x08\xe7\x07\x10\xe8\x07\"\x98\x03\n\x12\x46\x65\x61tureSetDefaults\x12N\n\x08\x64\x65\x66\x61ults\x18\x01 \x03(\x0b\x32<.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault\x12\x31\n\x0fminimum_edition\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x31\n\x0fmaximum_edition\x18\x05 \x01(\x0e\x32\x18.google.protobuf.Edition\x1a\xcb\x01\n\x18\x46\x65\x61tureSetEditionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x39\n\x14overridable_features\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x33\n\x0e\x66ixed_features\x18\x05 \x01(\x0b\x32\x1b.google.protobuf.FeatureSetJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x08\x66\x65\x61tures\"\xe3\x01\n\x0eSourceCodeInfo\x12:\n\x08location\x18\x01 \x03(\x0b\x32(.google.protobuf.SourceCodeInfo.Location\x1a\x86\x01\n\x08Location\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x10\n\x04span\x18\x02 \x03(\x05\x42\x02\x10\x01\x12\x18\n\x10leading_comments\x18\x03 \x01(\t\x12\x19\n\x11trailing_comments\x18\x04 \x01(\t\x12!\n\x19leading_detached_comments\x18\x06 \x03(\t*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x9c\x02\n\x11GeneratedCodeInfo\x12\x41\n\nannotation\x18\x01 \x03(\x0b\x32-.google.protobuf.GeneratedCodeInfo.Annotation\x1a\xc3\x01\n\nAnnotation\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bsource_file\x18\x02 \x01(\t\x12\r\n\x05\x62\x65gin\x18\x03 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x05\x12H\n\x08semantic\x18\x05 \x01(\x0e\x32\x36.google.protobuf.GeneratedCodeInfo.Annotation.Semantic\"(\n\x08Semantic\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03SET\x10\x01\x12\t\n\x05\x41LIAS\x10\x02*\xa7\x02\n\x07\x45\x64ition\x12\x13\n\x0f\x45\x44ITION_UNKNOWN\x10\x00\x12\x13\n\x0e\x45\x44ITION_LEGACY\x10\x84\x07\x12\x13\n\x0e\x45\x44ITION_PROTO2\x10\xe6\x07\x12\x13\n\x0e\x45\x44ITION_PROTO3\x10\xe7\x07\x12\x11\n\x0c\x45\x44ITION_2023\x10\xe8\x07\x12\x11\n\x0c\x45\x44ITION_2024\x10\xe9\x07\x12\x17\n\x13\x45\x44ITION_1_TEST_ONLY\x10\x01\x12\x17\n\x13\x45\x44ITION_2_TEST_ONLY\x10\x02\x12\x1d\n\x17\x45\x44ITION_99997_TEST_ONLY\x10\x9d\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99998_TEST_ONLY\x10\x9e\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99999_TEST_ONLY\x10\x9f\x8d\x06\x12\x13\n\x0b\x45\x44ITION_MAX\x10\xff\xff\xff\xff\x07\x42~\n\x13\x63om.google.protobufB\x10\x44\x65scriptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.Reflection' ) else: - DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"U\n\x11\x46ileDescriptorSet\x12\x32\n\x04\x66ile\x18\x01 \x03(\x0b\x32$.google.protobuf.FileDescriptorProto*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x86\x04\n\x13\x46ileDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07package\x18\x02 \x01(\t\x12\x12\n\ndependency\x18\x03 \x03(\t\x12\x19\n\x11public_dependency\x18\n \x03(\x05\x12\x17\n\x0fweak_dependency\x18\x0b \x03(\x05\x12\x36\n\x0cmessage_type\x18\x04 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x05 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12\x38\n\x07service\x18\x06 \x03(\x0b\x32\'.google.protobuf.ServiceDescriptorProto\x12\x38\n\textension\x18\x07 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12-\n\x07options\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.FileOptions\x12\x39\n\x10source_code_info\x18\t \x01(\x0b\x32\x1f.google.protobuf.SourceCodeInfo\x12\x0e\n\x06syntax\x18\x0c \x01(\t\x12)\n\x07\x65\x64ition\x18\x0e \x01(\x0e\x32\x18.google.protobuf.Edition\"\xa9\x05\n\x0f\x44\x65scriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x34\n\x05\x66ield\x18\x02 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x38\n\textension\x18\x06 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x35\n\x0bnested_type\x18\x03 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x04 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12H\n\x0f\x65xtension_range\x18\x05 \x03(\x0b\x32/.google.protobuf.DescriptorProto.ExtensionRange\x12\x39\n\noneof_decl\x18\x08 \x03(\x0b\x32%.google.protobuf.OneofDescriptorProto\x12\x30\n\x07options\x18\x07 \x01(\x0b\x32\x1f.google.protobuf.MessageOptions\x12\x46\n\x0ereserved_range\x18\t \x03(\x0b\x32..google.protobuf.DescriptorProto.ReservedRange\x12\x15\n\rreserved_name\x18\n \x03(\t\x1a\x65\n\x0e\x45xtensionRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\x12\x37\n\x07options\x18\x03 \x01(\x0b\x32&.google.protobuf.ExtensionRangeOptions\x1a+\n\rReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"\xe5\x03\n\x15\x45xtensionRangeOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x12L\n\x0b\x64\x65\x63laration\x18\x02 \x03(\x0b\x32\x32.google.protobuf.ExtensionRangeOptions.DeclarationB\x03\x88\x01\x02\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12_\n\x0cverification\x18\x03 \x01(\x0e\x32\x38.google.protobuf.ExtensionRangeOptions.VerificationState:\nUNVERIFIEDB\x03\x88\x01\x02\x1ah\n\x0b\x44\x65\x63laration\x12\x0e\n\x06number\x18\x01 \x01(\x05\x12\x11\n\tfull_name\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x10\n\x08reserved\x18\x05 \x01(\x08\x12\x10\n\x08repeated\x18\x06 \x01(\x08J\x04\x08\x04\x10\x05\"4\n\x11VerificationState\x12\x0f\n\x0b\x44\x45\x43LARATION\x10\x00\x12\x0e\n\nUNVERIFIED\x10\x01*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xd5\x05\n\x14\x46ieldDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x03 \x01(\x05\x12:\n\x05label\x18\x04 \x01(\x0e\x32+.google.protobuf.FieldDescriptorProto.Label\x12\x38\n\x04type\x18\x05 \x01(\x0e\x32*.google.protobuf.FieldDescriptorProto.Type\x12\x11\n\ttype_name\x18\x06 \x01(\t\x12\x10\n\x08\x65xtendee\x18\x02 \x01(\t\x12\x15\n\rdefault_value\x18\x07 \x01(\t\x12\x13\n\x0boneof_index\x18\t \x01(\x05\x12\x11\n\tjson_name\x18\n \x01(\t\x12.\n\x07options\x18\x08 \x01(\x0b\x32\x1d.google.protobuf.FieldOptions\x12\x17\n\x0fproto3_optional\x18\x11 \x01(\x08\"\xb6\x02\n\x04Type\x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\x05Label\x12\x12\n\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REPEATED\x10\x03\x12\x12\n\x0eLABEL_REQUIRED\x10\x02\"T\n\x14OneofDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x07options\x18\x02 \x01(\x0b\x32\x1d.google.protobuf.OneofOptions\"\xa4\x02\n\x13\x45numDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x03(\x0b\x32).google.protobuf.EnumValueDescriptorProto\x12-\n\x07options\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.EnumOptions\x12N\n\x0ereserved_range\x18\x04 \x03(\x0b\x32\x36.google.protobuf.EnumDescriptorProto.EnumReservedRange\x12\x15\n\rreserved_name\x18\x05 \x03(\t\x1a/\n\x11\x45numReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"l\n\x18\x45numValueDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\x05\x12\x32\n\x07options\x18\x03 \x01(\x0b\x32!.google.protobuf.EnumValueOptions\"\x90\x01\n\x16ServiceDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x36\n\x06method\x18\x02 \x03(\x0b\x32&.google.protobuf.MethodDescriptorProto\x12\x30\n\x07options\x18\x03 \x01(\x0b\x32\x1f.google.protobuf.ServiceOptions\"\xc1\x01\n\x15MethodDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ninput_type\x18\x02 \x01(\t\x12\x13\n\x0boutput_type\x18\x03 \x01(\t\x12/\n\x07options\x18\x04 \x01(\x0b\x32\x1e.google.protobuf.MethodOptions\x12\x1f\n\x10\x63lient_streaming\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x10server_streaming\x18\x06 \x01(\x08:\x05\x66\x61lse\"\xcb\x06\n\x0b\x46ileOptions\x12\x14\n\x0cjava_package\x18\x01 \x01(\t\x12\x1c\n\x14java_outer_classname\x18\x08 \x01(\t\x12\"\n\x13java_multiple_files\x18\n \x01(\x08:\x05\x66\x61lse\x12)\n\x1djava_generate_equals_and_hash\x18\x14 \x01(\x08\x42\x02\x18\x01\x12%\n\x16java_string_check_utf8\x18\x1b \x01(\x08:\x05\x66\x61lse\x12\x46\n\x0coptimize_for\x18\t \x01(\x0e\x32).google.protobuf.FileOptions.OptimizeMode:\x05SPEED\x12\x12\n\ngo_package\x18\x0b \x01(\t\x12\"\n\x13\x63\x63_generic_services\x18\x10 \x01(\x08:\x05\x66\x61lse\x12$\n\x15java_generic_services\x18\x11 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13py_generic_services\x18\x12 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x10\x63\x63_enable_arenas\x18\x1f \x01(\x08:\x04true\x12\x19\n\x11objc_class_prefix\x18$ \x01(\t\x12\x18\n\x10\x63sharp_namespace\x18% \x01(\t\x12\x14\n\x0cswift_prefix\x18\' \x01(\t\x12\x18\n\x10php_class_prefix\x18( \x01(\t\x12\x15\n\rphp_namespace\x18) \x01(\t\x12\x1e\n\x16php_metadata_namespace\x18, \x01(\t\x12\x14\n\x0cruby_package\x18- \x01(\t\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\":\n\x0cOptimizeMode\x12\t\n\x05SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02\x12\x10\n\x0cLITE_RUNTIME\x10\x03*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08*\x10+J\x04\x08&\x10\'R\x14php_generic_services\"\xe7\x02\n\x0eMessageOptions\x12&\n\x17message_set_wire_format\x18\x01 \x01(\x08:\x05\x66\x61lse\x12.\n\x1fno_standard_descriptor_accessor\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x11\n\tmap_entry\x18\x07 \x01(\x08\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x0b \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x0c \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xa3\x0b\n\x0c\x46ieldOptions\x12:\n\x05\x63type\x18\x01 \x01(\x0e\x32#.google.protobuf.FieldOptions.CType:\x06STRING\x12\x0e\n\x06packed\x18\x02 \x01(\x08\x12?\n\x06jstype\x18\x06 \x01(\x0e\x32$.google.protobuf.FieldOptions.JSType:\tJS_NORMAL\x12\x13\n\x04lazy\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x0funverified_lazy\x18\x0f \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x13\n\x04weak\x18\n \x01(\x08:\x05\x66\x61lse\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x10 \x01(\x08:\x05\x66\x61lse\x12@\n\tretention\x18\x11 \x01(\x0e\x32-.google.protobuf.FieldOptions.OptionRetention\x12?\n\x07targets\x18\x13 \x03(\x0e\x32..google.protobuf.FieldOptions.OptionTargetType\x12\x46\n\x10\x65\x64ition_defaults\x18\x14 \x03(\x0b\x32,.google.protobuf.FieldOptions.EditionDefault\x12-\n\x08\x66\x65\x61tures\x18\x15 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x16 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x1aJ\n\x0e\x45\x64itionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\r\n\x05value\x18\x02 \x01(\t\x1a\xcc\x01\n\x0e\x46\x65\x61tureSupport\x12\x34\n\x12\x65\x64ition_introduced\x18\x01 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x34\n\x12\x65\x64ition_deprecated\x18\x02 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x1b\n\x13\x64\x65precation_warning\x18\x03 \x01(\t\x12\x31\n\x0f\x65\x64ition_removed\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\"/\n\x05\x43Type\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x43ORD\x10\x01\x12\x10\n\x0cSTRING_PIECE\x10\x02\"5\n\x06JSType\x12\r\n\tJS_NORMAL\x10\x00\x12\r\n\tJS_STRING\x10\x01\x12\r\n\tJS_NUMBER\x10\x02\"U\n\x0fOptionRetention\x12\x15\n\x11RETENTION_UNKNOWN\x10\x00\x12\x15\n\x11RETENTION_RUNTIME\x10\x01\x12\x14\n\x10RETENTION_SOURCE\x10\x02\"\x8c\x02\n\x10OptionTargetType\x12\x17\n\x13TARGET_TYPE_UNKNOWN\x10\x00\x12\x14\n\x10TARGET_TYPE_FILE\x10\x01\x12\x1f\n\x1bTARGET_TYPE_EXTENSION_RANGE\x10\x02\x12\x17\n\x13TARGET_TYPE_MESSAGE\x10\x03\x12\x15\n\x11TARGET_TYPE_FIELD\x10\x04\x12\x15\n\x11TARGET_TYPE_ONEOF\x10\x05\x12\x14\n\x10TARGET_TYPE_ENUM\x10\x06\x12\x1a\n\x16TARGET_TYPE_ENUM_ENTRY\x10\x07\x12\x17\n\x13TARGET_TYPE_SERVICE\x10\x08\x12\x16\n\x12TARGET_TYPE_METHOD\x10\t*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x12\x10\x13\"\x8d\x01\n\x0cOneofOptions\x12-\n\x08\x66\x65\x61tures\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xf6\x01\n\x0b\x45numOptions\x12\x13\n\x0b\x61llow_alias\x18\x02 \x01(\x08\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x06 \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x07 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x05\x10\x06\"\x90\x02\n\x10\x45numValueOptions\x12\x19\n\ndeprecated\x18\x01 \x01(\x08:\x05\x66\x61lse\x12-\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x04 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xaa\x01\n\x0eServiceOptions\x12-\n\x08\x66\x65\x61tures\x18\" \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xdc\x02\n\rMethodOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12_\n\x11idempotency_level\x18\" \x01(\x0e\x32/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UNKNOWN\x12-\n\x08\x66\x65\x61tures\x18# \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"P\n\x10IdempotencyLevel\x12\x17\n\x13IDEMPOTENCY_UNKNOWN\x10\x00\x12\x13\n\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n\nIDEMPOTENT\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9e\x02\n\x13UninterpretedOption\x12;\n\x04name\x18\x02 \x03(\x0b\x32-.google.protobuf.UninterpretedOption.NamePart\x12\x18\n\x10identifier_value\x18\x03 \x01(\t\x12\x1a\n\x12positive_int_value\x18\x04 \x01(\x04\x12\x1a\n\x12negative_int_value\x18\x05 \x01(\x03\x12\x14\n\x0c\x64ouble_value\x18\x06 \x01(\x01\x12\x14\n\x0cstring_value\x18\x07 \x01(\x0c\x12\x17\n\x0f\x61ggregate_value\x18\x08 \x01(\t\x1a\x33\n\x08NamePart\x12\x11\n\tname_part\x18\x01 \x02(\t\x12\x14\n\x0cis_extension\x18\x02 \x02(\x08\"\xc9\t\n\nFeatureSet\x12\x82\x01\n\x0e\x66ield_presence\x18\x01 \x01(\x0e\x32).google.protobuf.FeatureSet.FieldPresenceB?\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPLICIT\x18\x84\x07\xa2\x01\r\x12\x08IMPLICIT\x18\xe7\x07\xa2\x01\r\x12\x08\x45XPLICIT\x18\xe8\x07\xb2\x01\x03\x08\xe8\x07\x12\x62\n\tenum_type\x18\x02 \x01(\x0e\x32$.google.protobuf.FeatureSet.EnumTypeB)\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\x0b\x12\x06\x43LOSED\x18\x84\x07\xa2\x01\t\x12\x04OPEN\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12\x81\x01\n\x17repeated_field_encoding\x18\x03 \x01(\x0e\x32\x31.google.protobuf.FeatureSet.RepeatedFieldEncodingB-\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPANDED\x18\x84\x07\xa2\x01\x0b\x12\x06PACKED\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12n\n\x0futf8_validation\x18\x04 \x01(\x0e\x32*.google.protobuf.FeatureSet.Utf8ValidationB)\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\t\x12\x04NONE\x18\x84\x07\xa2\x01\x0b\x12\x06VERIFY\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12m\n\x10message_encoding\x18\x05 \x01(\x0e\x32+.google.protobuf.FeatureSet.MessageEncodingB&\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x14\x12\x0fLENGTH_PREFIXED\x18\x84\x07\xb2\x01\x03\x08\xe8\x07\x12v\n\x0bjson_format\x18\x06 \x01(\x0e\x32&.google.protobuf.FeatureSet.JsonFormatB9\x88\x01\x01\x98\x01\x03\x98\x01\x06\x98\x01\x01\xa2\x01\x17\x12\x12LEGACY_BEST_EFFORT\x18\x84\x07\xa2\x01\n\x12\x05\x41LLOW\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\"\\\n\rFieldPresence\x12\x1a\n\x16\x46IELD_PRESENCE_UNKNOWN\x10\x00\x12\x0c\n\x08\x45XPLICIT\x10\x01\x12\x0c\n\x08IMPLICIT\x10\x02\x12\x13\n\x0fLEGACY_REQUIRED\x10\x03\"7\n\x08\x45numType\x12\x15\n\x11\x45NUM_TYPE_UNKNOWN\x10\x00\x12\x08\n\x04OPEN\x10\x01\x12\n\n\x06\x43LOSED\x10\x02\"V\n\x15RepeatedFieldEncoding\x12#\n\x1fREPEATED_FIELD_ENCODING_UNKNOWN\x10\x00\x12\n\n\x06PACKED\x10\x01\x12\x0c\n\x08\x45XPANDED\x10\x02\"I\n\x0eUtf8Validation\x12\x1b\n\x17UTF8_VALIDATION_UNKNOWN\x10\x00\x12\n\n\x06VERIFY\x10\x02\x12\x08\n\x04NONE\x10\x03\"\x04\x08\x01\x10\x01\"S\n\x0fMessageEncoding\x12\x1c\n\x18MESSAGE_ENCODING_UNKNOWN\x10\x00\x12\x13\n\x0fLENGTH_PREFIXED\x10\x01\x12\r\n\tDELIMITED\x10\x02\"H\n\nJsonFormat\x12\x17\n\x13JSON_FORMAT_UNKNOWN\x10\x00\x12\t\n\x05\x41LLOW\x10\x01\x12\x16\n\x12LEGACY_BEST_EFFORT\x10\x02*\x06\x08\xe8\x07\x10\x8bN*\x06\x08\x8bN\x10\x90N*\x06\x08\x90N\x10\x91NJ\x06\x08\xe7\x07\x10\xe8\x07\"\x98\x03\n\x12\x46\x65\x61tureSetDefaults\x12N\n\x08\x64\x65\x66\x61ults\x18\x01 \x03(\x0b\x32<.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault\x12\x31\n\x0fminimum_edition\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x31\n\x0fmaximum_edition\x18\x05 \x01(\x0e\x32\x18.google.protobuf.Edition\x1a\xcb\x01\n\x18\x46\x65\x61tureSetEditionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x39\n\x14overridable_features\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x33\n\x0e\x66ixed_features\x18\x05 \x01(\x0b\x32\x1b.google.protobuf.FeatureSetJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x08\x66\x65\x61tures\"\xe3\x01\n\x0eSourceCodeInfo\x12:\n\x08location\x18\x01 \x03(\x0b\x32(.google.protobuf.SourceCodeInfo.Location\x1a\x86\x01\n\x08Location\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x10\n\x04span\x18\x02 \x03(\x05\x42\x02\x10\x01\x12\x18\n\x10leading_comments\x18\x03 \x01(\t\x12\x19\n\x11trailing_comments\x18\x04 \x01(\t\x12!\n\x19leading_detached_comments\x18\x06 \x03(\t*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x9c\x02\n\x11GeneratedCodeInfo\x12\x41\n\nannotation\x18\x01 \x03(\x0b\x32-.google.protobuf.GeneratedCodeInfo.Annotation\x1a\xc3\x01\n\nAnnotation\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bsource_file\x18\x02 \x01(\t\x12\r\n\x05\x62\x65gin\x18\x03 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x05\x12H\n\x08semantic\x18\x05 \x01(\x0e\x32\x36.google.protobuf.GeneratedCodeInfo.Annotation.Semantic\"(\n\x08Semantic\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03SET\x10\x01\x12\t\n\x05\x41LIAS\x10\x02*\xa7\x02\n\x07\x45\x64ition\x12\x13\n\x0f\x45\x44ITION_UNKNOWN\x10\x00\x12\x13\n\x0e\x45\x44ITION_LEGACY\x10\x84\x07\x12\x13\n\x0e\x45\x44ITION_PROTO2\x10\xe6\x07\x12\x13\n\x0e\x45\x44ITION_PROTO3\x10\xe7\x07\x12\x11\n\x0c\x45\x44ITION_2023\x10\xe8\x07\x12\x11\n\x0c\x45\x44ITION_2024\x10\xe9\x07\x12\x17\n\x13\x45\x44ITION_1_TEST_ONLY\x10\x01\x12\x17\n\x13\x45\x44ITION_2_TEST_ONLY\x10\x02\x12\x1d\n\x17\x45\x44ITION_99997_TEST_ONLY\x10\x9d\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99998_TEST_ONLY\x10\x9e\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99999_TEST_ONLY\x10\x9f\x8d\x06\x12\x13\n\x0b\x45\x44ITION_MAX\x10\xff\xff\xff\xff\x07\x42~\n\x13\x63om.google.protobufB\x10\x44\x65scriptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.Reflection') + DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"U\n\x11\x46ileDescriptorSet\x12\x32\n\x04\x66ile\x18\x01 \x03(\x0b\x32$.google.protobuf.FileDescriptorProto*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x86\x04\n\x13\x46ileDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07package\x18\x02 \x01(\t\x12\x12\n\ndependency\x18\x03 \x03(\t\x12\x19\n\x11public_dependency\x18\n \x03(\x05\x12\x17\n\x0fweak_dependency\x18\x0b \x03(\x05\x12\x36\n\x0cmessage_type\x18\x04 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x05 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12\x38\n\x07service\x18\x06 \x03(\x0b\x32\'.google.protobuf.ServiceDescriptorProto\x12\x38\n\textension\x18\x07 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12-\n\x07options\x18\x08 \x01(\x0b\x32\x1c.google.protobuf.FileOptions\x12\x39\n\x10source_code_info\x18\t \x01(\x0b\x32\x1f.google.protobuf.SourceCodeInfo\x12\x0e\n\x06syntax\x18\x0c \x01(\t\x12)\n\x07\x65\x64ition\x18\x0e \x01(\x0e\x32\x18.google.protobuf.Edition\"\xa9\x05\n\x0f\x44\x65scriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x34\n\x05\x66ield\x18\x02 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x38\n\textension\x18\x06 \x03(\x0b\x32%.google.protobuf.FieldDescriptorProto\x12\x35\n\x0bnested_type\x18\x03 \x03(\x0b\x32 .google.protobuf.DescriptorProto\x12\x37\n\tenum_type\x18\x04 \x03(\x0b\x32$.google.protobuf.EnumDescriptorProto\x12H\n\x0f\x65xtension_range\x18\x05 \x03(\x0b\x32/.google.protobuf.DescriptorProto.ExtensionRange\x12\x39\n\noneof_decl\x18\x08 \x03(\x0b\x32%.google.protobuf.OneofDescriptorProto\x12\x30\n\x07options\x18\x07 \x01(\x0b\x32\x1f.google.protobuf.MessageOptions\x12\x46\n\x0ereserved_range\x18\t \x03(\x0b\x32..google.protobuf.DescriptorProto.ReservedRange\x12\x15\n\rreserved_name\x18\n \x03(\t\x1a\x65\n\x0e\x45xtensionRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\x12\x37\n\x07options\x18\x03 \x01(\x0b\x32&.google.protobuf.ExtensionRangeOptions\x1a+\n\rReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"\xe5\x03\n\x15\x45xtensionRangeOptions\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x12L\n\x0b\x64\x65\x63laration\x18\x02 \x03(\x0b\x32\x32.google.protobuf.ExtensionRangeOptions.DeclarationB\x03\x88\x01\x02\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12_\n\x0cverification\x18\x03 \x01(\x0e\x32\x38.google.protobuf.ExtensionRangeOptions.VerificationState:\nUNVERIFIEDB\x03\x88\x01\x02\x1ah\n\x0b\x44\x65\x63laration\x12\x0e\n\x06number\x18\x01 \x01(\x05\x12\x11\n\tfull_name\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x10\n\x08reserved\x18\x05 \x01(\x08\x12\x10\n\x08repeated\x18\x06 \x01(\x08J\x04\x08\x04\x10\x05\"4\n\x11VerificationState\x12\x0f\n\x0b\x44\x45\x43LARATION\x10\x00\x12\x0e\n\nUNVERIFIED\x10\x01*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xd5\x05\n\x14\x46ieldDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x03 \x01(\x05\x12:\n\x05label\x18\x04 \x01(\x0e\x32+.google.protobuf.FieldDescriptorProto.Label\x12\x38\n\x04type\x18\x05 \x01(\x0e\x32*.google.protobuf.FieldDescriptorProto.Type\x12\x11\n\ttype_name\x18\x06 \x01(\t\x12\x10\n\x08\x65xtendee\x18\x02 \x01(\t\x12\x15\n\rdefault_value\x18\x07 \x01(\t\x12\x13\n\x0boneof_index\x18\t \x01(\x05\x12\x11\n\tjson_name\x18\n \x01(\t\x12.\n\x07options\x18\x08 \x01(\x0b\x32\x1d.google.protobuf.FieldOptions\x12\x17\n\x0fproto3_optional\x18\x11 \x01(\x08\"\xb6\x02\n\x04Type\x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\x05Label\x12\x12\n\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REPEATED\x10\x03\x12\x12\n\x0eLABEL_REQUIRED\x10\x02\"T\n\x14OneofDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x07options\x18\x02 \x01(\x0b\x32\x1d.google.protobuf.OneofOptions\"\xa4\x02\n\x13\x45numDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x03(\x0b\x32).google.protobuf.EnumValueDescriptorProto\x12-\n\x07options\x18\x03 \x01(\x0b\x32\x1c.google.protobuf.EnumOptions\x12N\n\x0ereserved_range\x18\x04 \x03(\x0b\x32\x36.google.protobuf.EnumDescriptorProto.EnumReservedRange\x12\x15\n\rreserved_name\x18\x05 \x03(\t\x1a/\n\x11\x45numReservedRange\x12\r\n\x05start\x18\x01 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x05\"l\n\x18\x45numValueDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06number\x18\x02 \x01(\x05\x12\x32\n\x07options\x18\x03 \x01(\x0b\x32!.google.protobuf.EnumValueOptions\"\x90\x01\n\x16ServiceDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x36\n\x06method\x18\x02 \x03(\x0b\x32&.google.protobuf.MethodDescriptorProto\x12\x30\n\x07options\x18\x03 \x01(\x0b\x32\x1f.google.protobuf.ServiceOptions\"\xc1\x01\n\x15MethodDescriptorProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ninput_type\x18\x02 \x01(\t\x12\x13\n\x0boutput_type\x18\x03 \x01(\t\x12/\n\x07options\x18\x04 \x01(\x0b\x32\x1e.google.protobuf.MethodOptions\x12\x1f\n\x10\x63lient_streaming\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1f\n\x10server_streaming\x18\x06 \x01(\x08:\x05\x66\x61lse\"\xcb\x06\n\x0b\x46ileOptions\x12\x14\n\x0cjava_package\x18\x01 \x01(\t\x12\x1c\n\x14java_outer_classname\x18\x08 \x01(\t\x12\"\n\x13java_multiple_files\x18\n \x01(\x08:\x05\x66\x61lse\x12)\n\x1djava_generate_equals_and_hash\x18\x14 \x01(\x08\x42\x02\x18\x01\x12%\n\x16java_string_check_utf8\x18\x1b \x01(\x08:\x05\x66\x61lse\x12\x46\n\x0coptimize_for\x18\t \x01(\x0e\x32).google.protobuf.FileOptions.OptimizeMode:\x05SPEED\x12\x12\n\ngo_package\x18\x0b \x01(\t\x12\"\n\x13\x63\x63_generic_services\x18\x10 \x01(\x08:\x05\x66\x61lse\x12$\n\x15java_generic_services\x18\x11 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13py_generic_services\x18\x12 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x17 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x10\x63\x63_enable_arenas\x18\x1f \x01(\x08:\x04true\x12\x19\n\x11objc_class_prefix\x18$ \x01(\t\x12\x18\n\x10\x63sharp_namespace\x18% \x01(\t\x12\x14\n\x0cswift_prefix\x18\' \x01(\t\x12\x18\n\x10php_class_prefix\x18( \x01(\t\x12\x15\n\rphp_namespace\x18) \x01(\t\x12\x1e\n\x16php_metadata_namespace\x18, \x01(\t\x12\x14\n\x0cruby_package\x18- \x01(\t\x12-\n\x08\x66\x65\x61tures\x18\x32 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\":\n\x0cOptimizeMode\x12\t\n\x05SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02\x12\x10\n\x0cLITE_RUNTIME\x10\x03*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08*\x10+J\x04\x08&\x10\'R\x14php_generic_services\"\xe7\x02\n\x0eMessageOptions\x12&\n\x17message_set_wire_format\x18\x01 \x01(\x08:\x05\x66\x61lse\x12.\n\x1fno_standard_descriptor_accessor\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x11\n\tmap_entry\x18\x07 \x01(\x08\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x0b \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x0c \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xa3\x0b\n\x0c\x46ieldOptions\x12:\n\x05\x63type\x18\x01 \x01(\x0e\x32#.google.protobuf.FieldOptions.CType:\x06STRING\x12\x0e\n\x06packed\x18\x02 \x01(\x08\x12?\n\x06jstype\x18\x06 \x01(\x0e\x32$.google.protobuf.FieldOptions.JSType:\tJS_NORMAL\x12\x13\n\x04lazy\x18\x05 \x01(\x08:\x05\x66\x61lse\x12\x1e\n\x0funverified_lazy\x18\x0f \x01(\x08:\x05\x66\x61lse\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x13\n\x04weak\x18\n \x01(\x08:\x05\x66\x61lse\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x10 \x01(\x08:\x05\x66\x61lse\x12@\n\tretention\x18\x11 \x01(\x0e\x32-.google.protobuf.FieldOptions.OptionRetention\x12?\n\x07targets\x18\x13 \x03(\x0e\x32..google.protobuf.FieldOptions.OptionTargetType\x12\x46\n\x10\x65\x64ition_defaults\x18\x14 \x03(\x0b\x32,.google.protobuf.FieldOptions.EditionDefault\x12-\n\x08\x66\x65\x61tures\x18\x15 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x16 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\x1aJ\n\x0e\x45\x64itionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\r\n\x05value\x18\x02 \x01(\t\x1a\xcc\x01\n\x0e\x46\x65\x61tureSupport\x12\x34\n\x12\x65\x64ition_introduced\x18\x01 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x34\n\x12\x65\x64ition_deprecated\x18\x02 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x1b\n\x13\x64\x65precation_warning\x18\x03 \x01(\t\x12\x31\n\x0f\x65\x64ition_removed\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\"/\n\x05\x43Type\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x43ORD\x10\x01\x12\x10\n\x0cSTRING_PIECE\x10\x02\"5\n\x06JSType\x12\r\n\tJS_NORMAL\x10\x00\x12\r\n\tJS_STRING\x10\x01\x12\r\n\tJS_NUMBER\x10\x02\"U\n\x0fOptionRetention\x12\x15\n\x11RETENTION_UNKNOWN\x10\x00\x12\x15\n\x11RETENTION_RUNTIME\x10\x01\x12\x14\n\x10RETENTION_SOURCE\x10\x02\"\x8c\x02\n\x10OptionTargetType\x12\x17\n\x13TARGET_TYPE_UNKNOWN\x10\x00\x12\x14\n\x10TARGET_TYPE_FILE\x10\x01\x12\x1f\n\x1bTARGET_TYPE_EXTENSION_RANGE\x10\x02\x12\x17\n\x13TARGET_TYPE_MESSAGE\x10\x03\x12\x15\n\x11TARGET_TYPE_FIELD\x10\x04\x12\x15\n\x11TARGET_TYPE_ONEOF\x10\x05\x12\x14\n\x10TARGET_TYPE_ENUM\x10\x06\x12\x1a\n\x16TARGET_TYPE_ENUM_ENTRY\x10\x07\x12\x17\n\x13TARGET_TYPE_SERVICE\x10\x08\x12\x16\n\x12TARGET_TYPE_METHOD\x10\t*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x04\x10\x05J\x04\x08\x12\x10\x13\"\x8d\x01\n\x0cOneofOptions\x12-\n\x08\x66\x65\x61tures\x18\x01 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xf6\x01\n\x0b\x45numOptions\x12\x13\n\x0b\x61llow_alias\x18\x02 \x01(\x08\x12\x19\n\ndeprecated\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x32\n&deprecated_legacy_json_field_conflicts\x18\x06 \x01(\x08\x42\x02\x18\x01\x12-\n\x08\x66\x65\x61tures\x18\x07 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\x05\x10\x06\"\x90\x02\n\x10\x45numValueOptions\x12\x19\n\ndeprecated\x18\x01 \x01(\x08:\x05\x66\x61lse\x12-\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x1b\n\x0c\x64\x65\x62ug_redact\x18\x03 \x01(\x08:\x05\x66\x61lse\x12\x45\n\x0f\x66\x65\x61ture_support\x18\x04 \x01(\x0b\x32,.google.protobuf.FieldOptions.FeatureSupport\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xaa\x01\n\x0eServiceOptions\x12-\n\x08\x66\x65\x61tures\x18\" \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xdc\x02\n\rMethodOptions\x12\x19\n\ndeprecated\x18! \x01(\x08:\x05\x66\x61lse\x12_\n\x11idempotency_level\x18\" \x01(\x0e\x32/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UNKNOWN\x12-\n\x08\x66\x65\x61tures\x18# \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x43\n\x14uninterpreted_option\x18\xe7\x07 \x03(\x0b\x32$.google.protobuf.UninterpretedOption\"P\n\x10IdempotencyLevel\x12\x17\n\x13IDEMPOTENCY_UNKNOWN\x10\x00\x12\x13\n\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n\nIDEMPOTENT\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9e\x02\n\x13UninterpretedOption\x12;\n\x04name\x18\x02 \x03(\x0b\x32-.google.protobuf.UninterpretedOption.NamePart\x12\x18\n\x10identifier_value\x18\x03 \x01(\t\x12\x1a\n\x12positive_int_value\x18\x04 \x01(\x04\x12\x1a\n\x12negative_int_value\x18\x05 \x01(\x03\x12\x14\n\x0c\x64ouble_value\x18\x06 \x01(\x01\x12\x14\n\x0cstring_value\x18\x07 \x01(\x0c\x12\x17\n\x0f\x61ggregate_value\x18\x08 \x01(\t\x1a\x33\n\x08NamePart\x12\x11\n\tname_part\x18\x01 \x02(\t\x12\x14\n\x0cis_extension\x18\x02 \x02(\x08\"\xbc\x0b\n\nFeatureSet\x12\x82\x01\n\x0e\x66ield_presence\x18\x01 \x01(\x0e\x32).google.protobuf.FeatureSet.FieldPresenceB?\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPLICIT\x18\x84\x07\xa2\x01\r\x12\x08IMPLICIT\x18\xe7\x07\xa2\x01\r\x12\x08\x45XPLICIT\x18\xe8\x07\xb2\x01\x03\x08\xe8\x07\x12\x62\n\tenum_type\x18\x02 \x01(\x0e\x32$.google.protobuf.FeatureSet.EnumTypeB)\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\x0b\x12\x06\x43LOSED\x18\x84\x07\xa2\x01\t\x12\x04OPEN\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12\x81\x01\n\x17repeated_field_encoding\x18\x03 \x01(\x0e\x32\x31.google.protobuf.FeatureSet.RepeatedFieldEncodingB-\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\r\x12\x08\x45XPANDED\x18\x84\x07\xa2\x01\x0b\x12\x06PACKED\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12n\n\x0futf8_validation\x18\x04 \x01(\x0e\x32*.google.protobuf.FeatureSet.Utf8ValidationB)\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\t\x12\x04NONE\x18\x84\x07\xa2\x01\x0b\x12\x06VERIFY\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12m\n\x10message_encoding\x18\x05 \x01(\x0e\x32+.google.protobuf.FeatureSet.MessageEncodingB&\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x14\x12\x0fLENGTH_PREFIXED\x18\x84\x07\xb2\x01\x03\x08\xe8\x07\x12v\n\x0bjson_format\x18\x06 \x01(\x0e\x32&.google.protobuf.FeatureSet.JsonFormatB9\x88\x01\x01\x98\x01\x03\x98\x01\x06\x98\x01\x01\xa2\x01\x17\x12\x12LEGACY_BEST_EFFORT\x18\x84\x07\xa2\x01\n\x12\x05\x41LLOW\x18\xe7\x07\xb2\x01\x03\x08\xe8\x07\x12\x97\x01\n\x14\x65nforce_naming_style\x18\x07 \x01(\x0e\x32..google.protobuf.FeatureSet.EnforceNamingStyleBI\x88\x01\x02\x98\x01\x01\x98\x01\x02\x98\x01\x03\x98\x01\x04\x98\x01\x05\x98\x01\x06\x98\x01\x07\x98\x01\x08\x98\x01\t\xa2\x01\x11\x12\x0cSTYLE_LEGACY\x18\x84\x07\xa2\x01\x0e\x12\tSTYLE2024\x18\xe9\x07\xb2\x01\x03\x08\xe9\x07\"\\\n\rFieldPresence\x12\x1a\n\x16\x46IELD_PRESENCE_UNKNOWN\x10\x00\x12\x0c\n\x08\x45XPLICIT\x10\x01\x12\x0c\n\x08IMPLICIT\x10\x02\x12\x13\n\x0fLEGACY_REQUIRED\x10\x03\"7\n\x08\x45numType\x12\x15\n\x11\x45NUM_TYPE_UNKNOWN\x10\x00\x12\x08\n\x04OPEN\x10\x01\x12\n\n\x06\x43LOSED\x10\x02\"V\n\x15RepeatedFieldEncoding\x12#\n\x1fREPEATED_FIELD_ENCODING_UNKNOWN\x10\x00\x12\n\n\x06PACKED\x10\x01\x12\x0c\n\x08\x45XPANDED\x10\x02\"I\n\x0eUtf8Validation\x12\x1b\n\x17UTF8_VALIDATION_UNKNOWN\x10\x00\x12\n\n\x06VERIFY\x10\x02\x12\x08\n\x04NONE\x10\x03\"\x04\x08\x01\x10\x01\"S\n\x0fMessageEncoding\x12\x1c\n\x18MESSAGE_ENCODING_UNKNOWN\x10\x00\x12\x13\n\x0fLENGTH_PREFIXED\x10\x01\x12\r\n\tDELIMITED\x10\x02\"H\n\nJsonFormat\x12\x17\n\x13JSON_FORMAT_UNKNOWN\x10\x00\x12\t\n\x05\x41LLOW\x10\x01\x12\x16\n\x12LEGACY_BEST_EFFORT\x10\x02\"W\n\x12\x45nforceNamingStyle\x12 \n\x1c\x45NFORCE_NAMING_STYLE_UNKNOWN\x10\x00\x12\r\n\tSTYLE2024\x10\x01\x12\x10\n\x0cSTYLE_LEGACY\x10\x02*\x06\x08\xe8\x07\x10\x8bN*\x06\x08\x8bN\x10\x90N*\x06\x08\x90N\x10\x91NJ\x06\x08\xe7\x07\x10\xe8\x07\"\x98\x03\n\x12\x46\x65\x61tureSetDefaults\x12N\n\x08\x64\x65\x66\x61ults\x18\x01 \x03(\x0b\x32<.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault\x12\x31\n\x0fminimum_edition\x18\x04 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x31\n\x0fmaximum_edition\x18\x05 \x01(\x0e\x32\x18.google.protobuf.Edition\x1a\xcb\x01\n\x18\x46\x65\x61tureSetEditionDefault\x12)\n\x07\x65\x64ition\x18\x03 \x01(\x0e\x32\x18.google.protobuf.Edition\x12\x39\n\x14overridable_features\x18\x04 \x01(\x0b\x32\x1b.google.protobuf.FeatureSet\x12\x33\n\x0e\x66ixed_features\x18\x05 \x01(\x0b\x32\x1b.google.protobuf.FeatureSetJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x08\x66\x65\x61tures\"\xe3\x01\n\x0eSourceCodeInfo\x12:\n\x08location\x18\x01 \x03(\x0b\x32(.google.protobuf.SourceCodeInfo.Location\x1a\x86\x01\n\x08Location\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x10\n\x04span\x18\x02 \x03(\x05\x42\x02\x10\x01\x12\x18\n\x10leading_comments\x18\x03 \x01(\t\x12\x19\n\x11trailing_comments\x18\x04 \x01(\t\x12!\n\x19leading_detached_comments\x18\x06 \x03(\t*\x0c\x08\x80\xec\xca\xff\x01\x10\x81\xec\xca\xff\x01\"\x9c\x02\n\x11GeneratedCodeInfo\x12\x41\n\nannotation\x18\x01 \x03(\x0b\x32-.google.protobuf.GeneratedCodeInfo.Annotation\x1a\xc3\x01\n\nAnnotation\x12\x10\n\x04path\x18\x01 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bsource_file\x18\x02 \x01(\t\x12\r\n\x05\x62\x65gin\x18\x03 \x01(\x05\x12\x0b\n\x03\x65nd\x18\x04 \x01(\x05\x12H\n\x08semantic\x18\x05 \x01(\x0e\x32\x36.google.protobuf.GeneratedCodeInfo.Annotation.Semantic\"(\n\x08Semantic\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03SET\x10\x01\x12\t\n\x05\x41LIAS\x10\x02*\xa7\x02\n\x07\x45\x64ition\x12\x13\n\x0f\x45\x44ITION_UNKNOWN\x10\x00\x12\x13\n\x0e\x45\x44ITION_LEGACY\x10\x84\x07\x12\x13\n\x0e\x45\x44ITION_PROTO2\x10\xe6\x07\x12\x13\n\x0e\x45\x44ITION_PROTO3\x10\xe7\x07\x12\x11\n\x0c\x45\x44ITION_2023\x10\xe8\x07\x12\x11\n\x0c\x45\x44ITION_2024\x10\xe9\x07\x12\x17\n\x13\x45\x44ITION_1_TEST_ONLY\x10\x01\x12\x17\n\x13\x45\x44ITION_2_TEST_ONLY\x10\x02\x12\x1d\n\x17\x45\x44ITION_99997_TEST_ONLY\x10\x9d\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99998_TEST_ONLY\x10\x9e\x8d\x06\x12\x1d\n\x17\x45\x44ITION_99999_TEST_ONLY\x10\x9f\x8d\x06\x12\x13\n\x0b\x45\x44ITION_MAX\x10\xff\xff\xff\xff\x07\x42~\n\x13\x63om.google.protobufB\x10\x44\x65scriptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.Reflection') _globals = globals() if not _descriptor._USE_C_DESCRIPTORS: @@ -642,6 +642,34 @@ if not _descriptor._USE_C_DESCRIPTORS: ) _sym_db.RegisterEnumDescriptor(_FEATURESET_JSONFORMAT) + _FEATURESET_ENFORCENAMINGSTYLE = _descriptor.EnumDescriptor( + name='EnforceNamingStyle', + full_name='google.protobuf.FeatureSet.EnforceNamingStyle', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='ENFORCE_NAMING_STYLE_UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STYLE2024', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STYLE_LEGACY', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + ) + _sym_db.RegisterEnumDescriptor(_FEATURESET_ENFORCENAMINGSTYLE) + _GENERATEDCODEINFO_ANNOTATION_SEMANTIC = _descriptor.EnumDescriptor( name='Semantic', full_name='google.protobuf.GeneratedCodeInfo.Annotation.Semantic', @@ -2317,6 +2345,13 @@ if not _descriptor._USE_C_DESCRIPTORS: message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=b'\210\001\001\230\001\003\230\001\006\230\001\001\242\001\027\022\022LEGACY_BEST_EFFORT\030\204\007\242\001\n\022\005ALLOW\030\347\007\262\001\003\010\350\007', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='enforce_naming_style', full_name='google.protobuf.FeatureSet.enforce_naming_style', index=6, + number=7, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\210\001\002\230\001\001\230\001\002\230\001\003\230\001\004\230\001\005\230\001\006\230\001\007\230\001\010\230\001\t\242\001\021\022\014STYLE_LEGACY\030\204\007\242\001\016\022\tSTYLE2024\030\351\007\262\001\003\010\351\007', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -2328,6 +2363,7 @@ if not _descriptor._USE_C_DESCRIPTORS: _FEATURESET_UTF8VALIDATION, _FEATURESET_MESSAGEENCODING, _FEATURESET_JSONFORMAT, + _FEATURESET_ENFORCENAMINGSTYLE, ], serialized_options=None, is_extendable=True, @@ -2676,12 +2712,14 @@ if not _descriptor._USE_C_DESCRIPTORS: _FEATURESET.fields_by_name['utf8_validation'].enum_type = _FEATURESET_UTF8VALIDATION _FEATURESET.fields_by_name['message_encoding'].enum_type = _FEATURESET_MESSAGEENCODING _FEATURESET.fields_by_name['json_format'].enum_type = _FEATURESET_JSONFORMAT + _FEATURESET.fields_by_name['enforce_naming_style'].enum_type = _FEATURESET_ENFORCENAMINGSTYLE _FEATURESET_FIELDPRESENCE.containing_type = _FEATURESET _FEATURESET_ENUMTYPE.containing_type = _FEATURESET _FEATURESET_REPEATEDFIELDENCODING.containing_type = _FEATURESET _FEATURESET_UTF8VALIDATION.containing_type = _FEATURESET _FEATURESET_MESSAGEENCODING.containing_type = _FEATURESET _FEATURESET_JSONFORMAT.containing_type = _FEATURESET + _FEATURESET_ENFORCENAMINGSTYLE.containing_type = _FEATURESET _FEATURESETDEFAULTS_FEATURESETEDITIONDEFAULT.fields_by_name['edition'].enum_type = _EDITION _FEATURESETDEFAULTS_FEATURESETEDITIONDEFAULT.fields_by_name['overridable_features'].message_type = _FEATURESET _FEATURESETDEFAULTS_FEATURESETEDITIONDEFAULT.fields_by_name['fixed_features'].message_type = _FEATURESET @@ -2909,6 +2947,7 @@ if not _descriptor._USE_C_DESCRIPTORS: _FEATURESET.fields[3]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _FEATURESET.fields[4]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _FEATURESET.fields[5]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) + _FEATURESET.fields[6]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _FEATURESETDEFAULTS._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _FEATURESETDEFAULTS.fields[0]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _FEATURESETDEFAULTS.fields[1]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) @@ -3015,6 +3054,10 @@ if not _descriptor._USE_C_DESCRIPTORS: _FEATURESET_JSONFORMAT.values[0]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _FEATURESET_JSONFORMAT.values[1]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _FEATURESET_JSONFORMAT.values[2]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) + _FEATURESET_ENFORCENAMINGSTYLE._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) + _FEATURESET_ENFORCENAMINGSTYLE.values[0]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) + _FEATURESET_ENFORCENAMINGSTYLE.values[1]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) + _FEATURESET_ENFORCENAMINGSTYLE.values[2]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _GENERATEDCODEINFO_ANNOTATION_SEMANTIC._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _GENERATEDCODEINFO_ANNOTATION_SEMANTIC.values[0]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) _GENERATEDCODEINFO_ANNOTATION_SEMANTIC.values[1]._features = _ResolvedFeatures(field_presence=_FEATURESET_FIELDPRESENCE.values_by_name["EXPLICIT"].number,enum_type=_FEATURESET_ENUMTYPE.values_by_name["CLOSED"].number,repeated_field_encoding=_FEATURESET_REPEATEDFIELDENCODING.values_by_name["EXPANDED"].number,utf8_validation=_FEATURESET_UTF8VALIDATION.values_by_name["NONE"].number,message_encoding=_FEATURESET_MESSAGEENCODING.values_by_name["LENGTH_PREFIXED"].number,json_format=_FEATURESET_JSONFORMAT.values_by_name["LEGACY_BEST_EFFORT"].number) @@ -3060,14 +3103,16 @@ if not _descriptor._USE_C_DESCRIPTORS: _globals['_FEATURESET'].fields_by_name['message_encoding']._serialized_options = b'\210\001\001\230\001\004\230\001\001\242\001\024\022\017LENGTH_PREFIXED\030\204\007\262\001\003\010\350\007' _globals['_FEATURESET'].fields_by_name['json_format']._loaded_options = None _globals['_FEATURESET'].fields_by_name['json_format']._serialized_options = b'\210\001\001\230\001\003\230\001\006\230\001\001\242\001\027\022\022LEGACY_BEST_EFFORT\030\204\007\242\001\n\022\005ALLOW\030\347\007\262\001\003\010\350\007' + _globals['_FEATURESET'].fields_by_name['enforce_naming_style']._loaded_options = None + _globals['_FEATURESET'].fields_by_name['enforce_naming_style']._serialized_options = b'\210\001\002\230\001\001\230\001\002\230\001\003\230\001\004\230\001\005\230\001\006\230\001\007\230\001\010\230\001\t\242\001\021\022\014STYLE_LEGACY\030\204\007\242\001\016\022\tSTYLE2024\030\351\007\262\001\003\010\351\007' _globals['_SOURCECODEINFO_LOCATION'].fields_by_name['path']._loaded_options = None _globals['_SOURCECODEINFO_LOCATION'].fields_by_name['path']._serialized_options = b'\020\001' _globals['_SOURCECODEINFO_LOCATION'].fields_by_name['span']._loaded_options = None _globals['_SOURCECODEINFO_LOCATION'].fields_by_name['span']._serialized_options = b'\020\001' _globals['_GENERATEDCODEINFO_ANNOTATION'].fields_by_name['path']._loaded_options = None _globals['_GENERATEDCODEINFO_ANNOTATION'].fields_by_name['path']._serialized_options = b'\020\001' - _globals['_EDITION']._serialized_start=9687 - _globals['_EDITION']._serialized_end=9982 + _globals['_EDITION']._serialized_start=9930 + _globals['_EDITION']._serialized_end=10225 _globals['_FILEDESCRIPTORSET']._serialized_start=53 _globals['_FILEDESCRIPTORSET']._serialized_end=138 _globals['_FILEDESCRIPTORPROTO']._serialized_start=141 @@ -3139,31 +3184,33 @@ if not _descriptor._USE_C_DESCRIPTORS: _globals['_UNINTERPRETEDOPTION_NAMEPART']._serialized_start=7477 _globals['_UNINTERPRETEDOPTION_NAMEPART']._serialized_end=7528 _globals['_FEATURESET']._serialized_start=7531 - _globals['_FEATURESET']._serialized_end=8756 - _globals['_FEATURESET_FIELDPRESENCE']._serialized_start=8253 - _globals['_FEATURESET_FIELDPRESENCE']._serialized_end=8345 - _globals['_FEATURESET_ENUMTYPE']._serialized_start=8347 - _globals['_FEATURESET_ENUMTYPE']._serialized_end=8402 - _globals['_FEATURESET_REPEATEDFIELDENCODING']._serialized_start=8404 - _globals['_FEATURESET_REPEATEDFIELDENCODING']._serialized_end=8490 - _globals['_FEATURESET_UTF8VALIDATION']._serialized_start=8492 - _globals['_FEATURESET_UTF8VALIDATION']._serialized_end=8565 - _globals['_FEATURESET_MESSAGEENCODING']._serialized_start=8567 - _globals['_FEATURESET_MESSAGEENCODING']._serialized_end=8650 - _globals['_FEATURESET_JSONFORMAT']._serialized_start=8652 - _globals['_FEATURESET_JSONFORMAT']._serialized_end=8724 - _globals['_FEATURESETDEFAULTS']._serialized_start=8759 - _globals['_FEATURESETDEFAULTS']._serialized_end=9167 - _globals['_FEATURESETDEFAULTS_FEATURESETEDITIONDEFAULT']._serialized_start=8964 - _globals['_FEATURESETDEFAULTS_FEATURESETEDITIONDEFAULT']._serialized_end=9167 - _globals['_SOURCECODEINFO']._serialized_start=9170 - _globals['_SOURCECODEINFO']._serialized_end=9397 - _globals['_SOURCECODEINFO_LOCATION']._serialized_start=9249 - _globals['_SOURCECODEINFO_LOCATION']._serialized_end=9383 - _globals['_GENERATEDCODEINFO']._serialized_start=9400 - _globals['_GENERATEDCODEINFO']._serialized_end=9684 - _globals['_GENERATEDCODEINFO_ANNOTATION']._serialized_start=9489 - _globals['_GENERATEDCODEINFO_ANNOTATION']._serialized_end=9684 - _globals['_GENERATEDCODEINFO_ANNOTATION_SEMANTIC']._serialized_start=9644 - _globals['_GENERATEDCODEINFO_ANNOTATION_SEMANTIC']._serialized_end=9684 + _globals['_FEATURESET']._serialized_end=8999 + _globals['_FEATURESET_FIELDPRESENCE']._serialized_start=8407 + _globals['_FEATURESET_FIELDPRESENCE']._serialized_end=8499 + _globals['_FEATURESET_ENUMTYPE']._serialized_start=8501 + _globals['_FEATURESET_ENUMTYPE']._serialized_end=8556 + _globals['_FEATURESET_REPEATEDFIELDENCODING']._serialized_start=8558 + _globals['_FEATURESET_REPEATEDFIELDENCODING']._serialized_end=8644 + _globals['_FEATURESET_UTF8VALIDATION']._serialized_start=8646 + _globals['_FEATURESET_UTF8VALIDATION']._serialized_end=8719 + _globals['_FEATURESET_MESSAGEENCODING']._serialized_start=8721 + _globals['_FEATURESET_MESSAGEENCODING']._serialized_end=8804 + _globals['_FEATURESET_JSONFORMAT']._serialized_start=8806 + _globals['_FEATURESET_JSONFORMAT']._serialized_end=8878 + _globals['_FEATURESET_ENFORCENAMINGSTYLE']._serialized_start=8880 + _globals['_FEATURESET_ENFORCENAMINGSTYLE']._serialized_end=8967 + _globals['_FEATURESETDEFAULTS']._serialized_start=9002 + _globals['_FEATURESETDEFAULTS']._serialized_end=9410 + _globals['_FEATURESETDEFAULTS_FEATURESETEDITIONDEFAULT']._serialized_start=9207 + _globals['_FEATURESETDEFAULTS_FEATURESETEDITIONDEFAULT']._serialized_end=9410 + _globals['_SOURCECODEINFO']._serialized_start=9413 + _globals['_SOURCECODEINFO']._serialized_end=9640 + _globals['_SOURCECODEINFO_LOCATION']._serialized_start=9492 + _globals['_SOURCECODEINFO_LOCATION']._serialized_end=9626 + _globals['_GENERATEDCODEINFO']._serialized_start=9643 + _globals['_GENERATEDCODEINFO']._serialized_end=9927 + _globals['_GENERATEDCODEINFO_ANNOTATION']._serialized_start=9732 + _globals['_GENERATEDCODEINFO_ANNOTATION']._serialized_end=9927 + _globals['_GENERATEDCODEINFO_ANNOTATION_SEMANTIC']._serialized_start=9887 + _globals['_GENERATEDCODEINFO_ANNOTATION_SEMANTIC']._serialized_end=9927 # @@protoc_insertion_point(module_scope) diff --git a/third_party/protobuf/python/google/protobuf/internal/_parameterized.py b/third_party/protobuf/python/google/protobuf/internal/_parameterized.py deleted file mode 100755 index 4cb2cb1f7a450..0000000000000 --- a/third_party/protobuf/python/google/protobuf/internal/_parameterized.py +++ /dev/null @@ -1,420 +0,0 @@ -#! /usr/bin/env python -# -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file or at -# https://developers.google.com/open-source/licenses/bsd - -"""Adds support for parameterized tests to Python's unittest TestCase class. - -A parameterized test is a method in a test case that is invoked with different -argument tuples. - -A simple example: - - class AdditionExample(_parameterized.TestCase): - @_parameterized.parameters( - (1, 2, 3), - (4, 5, 9), - (1, 1, 3)) - def testAddition(self, op1, op2, result): - self.assertEqual(result, op1 + op2) - - -Each invocation is a separate test case and properly isolated just -like a normal test method, with its own setUp/tearDown cycle. In the -example above, there are three separate testcases, one of which will -fail due to an assertion error (1 + 1 != 3). - -Parameters for individual test cases can be tuples (with positional parameters) -or dictionaries (with named parameters): - - class AdditionExample(_parameterized.TestCase): - @_parameterized.parameters( - {'op1': 1, 'op2': 2, 'result': 3}, - {'op1': 4, 'op2': 5, 'result': 9}, - ) - def testAddition(self, op1, op2, result): - self.assertEqual(result, op1 + op2) - -If a parameterized test fails, the error message will show the -original test name (which is modified internally) and the arguments -for the specific invocation, which are part of the string returned by -the shortDescription() method on test cases. - -The id method of the test, used internally by the unittest framework, -is also modified to show the arguments. To make sure that test names -stay the same across several invocations, object representations like - - >>> class Foo(object): - ... pass - >>> repr(Foo()) - '<__main__.Foo object at 0x23d8610>' - -are turned into '<__main__.Foo>'. For even more descriptive names, -especially in test logs, you can use the named_parameters decorator. In -this case, only tuples are supported, and the first parameters has to -be a string (or an object that returns an apt name when converted via -str()): - - class NamedExample(_parameterized.TestCase): - @_parameterized.named_parameters( - ('Normal', 'aa', 'aaa', True), - ('EmptyPrefix', '', 'abc', True), - ('BothEmpty', '', '', True)) - def testStartsWith(self, prefix, string, result): - self.assertEqual(result, strings.startswith(prefix)) - -Named tests also have the benefit that they can be run individually -from the command line: - - $ testmodule.py NamedExample.testStartsWithNormal - . - -------------------------------------------------------------------- - Ran 1 test in 0.000s - - OK - -Parameterized Classes -===================== -If invocation arguments are shared across test methods in a single -TestCase class, instead of decorating all test methods -individually, the class itself can be decorated: - - @_parameterized.parameters( - (1, 2, 3) - (4, 5, 9)) - class ArithmeticTest(_parameterized.TestCase): - def testAdd(self, arg1, arg2, result): - self.assertEqual(arg1 + arg2, result) - - def testSubtract(self, arg2, arg2, result): - self.assertEqual(result - arg1, arg2) - -Inputs from Iterables -===================== -If parameters should be shared across several test cases, or are dynamically -created from other sources, a single non-tuple iterable can be passed into -the decorator. This iterable will be used to obtain the test cases: - - class AdditionExample(_parameterized.TestCase): - @_parameterized.parameters( - c.op1, c.op2, c.result for c in testcases - ) - def testAddition(self, op1, op2, result): - self.assertEqual(result, op1 + op2) - - -Single-Argument Test Methods -============================ -If a test method takes only one argument, the single argument does not need to -be wrapped into a tuple: - - class NegativeNumberExample(_parameterized.TestCase): - @_parameterized.parameters( - -1, -3, -4, -5 - ) - def testIsNegative(self, arg): - self.assertTrue(IsNegative(arg)) -""" - -__author__ = 'tmarek@google.com (Torsten Marek)' - -import functools -import re -import types -import unittest -import uuid - -try: - # Since python 3 - import collections.abc as collections_abc -except ImportError: - # Won't work after python 3.8 - import collections as collections_abc - -ADDR_RE = re.compile(r'\<([a-zA-Z0-9_\-\.]+) object at 0x[a-fA-F0-9]+\>') -_SEPARATOR = uuid.uuid1().hex -_FIRST_ARG = object() -_ARGUMENT_REPR = object() - - -def _CleanRepr(obj): - return ADDR_RE.sub(r'<\1>', repr(obj)) - - -# Helper function formerly from the unittest module, removed from it in -# Python 2.7. -def _StrClass(cls): - return '%s.%s' % (cls.__module__, cls.__name__) - - -def _NonStringIterable(obj): - return (isinstance(obj, collections_abc.Iterable) and - not isinstance(obj, str)) - - -def _FormatParameterList(testcase_params): - if isinstance(testcase_params, collections_abc.Mapping): - return ', '.join('%s=%s' % (argname, _CleanRepr(value)) - for argname, value in testcase_params.items()) - elif _NonStringIterable(testcase_params): - return ', '.join(map(_CleanRepr, testcase_params)) - else: - return _FormatParameterList((testcase_params,)) - - -class _ParameterizedTestIter(object): - """Callable and iterable class for producing new test cases.""" - - def __init__(self, test_method, testcases, naming_type): - """Returns concrete test functions for a test and a list of parameters. - - The naming_type is used to determine the name of the concrete - functions as reported by the unittest framework. If naming_type is - _FIRST_ARG, the testcases must be tuples, and the first element must - have a string representation that is a valid Python identifier. - - Args: - test_method: The decorated test method. - testcases: (list of tuple/dict) A list of parameter - tuples/dicts for individual test invocations. - naming_type: The test naming type, either _NAMED or _ARGUMENT_REPR. - """ - self._test_method = test_method - self.testcases = testcases - self._naming_type = naming_type - - def __call__(self, *args, **kwargs): - raise RuntimeError('You appear to be running a parameterized test case ' - 'without having inherited from parameterized.' - 'TestCase. This is bad because none of ' - 'your test cases are actually being run.') - - def __iter__(self): - test_method = self._test_method - naming_type = self._naming_type - - def MakeBoundParamTest(testcase_params): - @functools.wraps(test_method) - def BoundParamTest(self): - if isinstance(testcase_params, collections_abc.Mapping): - test_method(self, **testcase_params) - elif _NonStringIterable(testcase_params): - test_method(self, *testcase_params) - else: - test_method(self, testcase_params) - - if naming_type is _FIRST_ARG: - # Signal the metaclass that the name of the test function is unique - # and descriptive. - BoundParamTest.__x_use_name__ = True - BoundParamTest.__name__ += str(testcase_params[0]) - testcase_params = testcase_params[1:] - elif naming_type is _ARGUMENT_REPR: - # __x_extra_id__ is used to pass naming information to the __new__ - # method of TestGeneratorMetaclass. - # The metaclass will make sure to create a unique, but nondescriptive - # name for this test. - BoundParamTest.__x_extra_id__ = '(%s)' % ( - _FormatParameterList(testcase_params),) - else: - raise RuntimeError('%s is not a valid naming type.' % (naming_type,)) - - BoundParamTest.__doc__ = '%s(%s)' % ( - BoundParamTest.__name__, _FormatParameterList(testcase_params)) - if test_method.__doc__: - BoundParamTest.__doc__ += '\n%s' % (test_method.__doc__,) - return BoundParamTest - return (MakeBoundParamTest(c) for c in self.testcases) - - -def _IsSingletonList(testcases): - """True iff testcases contains only a single non-tuple element.""" - return len(testcases) == 1 and not isinstance(testcases[0], tuple) - - -def _ModifyClass(class_object, testcases, naming_type): - assert not getattr(class_object, '_id_suffix', None), ( - 'Cannot add parameters to %s,' - ' which already has parameterized methods.' % (class_object,)) - class_object._id_suffix = id_suffix = {} - # We change the size of __dict__ while we iterate over it, - # which Python 3.x will complain about, so use copy(). - for name, obj in class_object.__dict__.copy().items(): - if (name.startswith(unittest.TestLoader.testMethodPrefix) - and isinstance(obj, types.FunctionType)): - delattr(class_object, name) - methods = {} - _UpdateClassDictForParamTestCase( - methods, id_suffix, name, - _ParameterizedTestIter(obj, testcases, naming_type)) - for name, meth in methods.items(): - setattr(class_object, name, meth) - - -def _ParameterDecorator(naming_type, testcases): - """Implementation of the parameterization decorators. - - Args: - naming_type: The naming type. - testcases: Testcase parameters. - - Returns: - A function for modifying the decorated object. - """ - def _Apply(obj): - if isinstance(obj, type): - _ModifyClass( - obj, - list(testcases) if not isinstance(testcases, collections_abc.Sequence) - else testcases, - naming_type) - return obj - else: - return _ParameterizedTestIter(obj, testcases, naming_type) - - if _IsSingletonList(testcases): - assert _NonStringIterable(testcases[0]), ( - 'Single parameter argument must be a non-string iterable') - testcases = testcases[0] - - return _Apply - - -def parameters(*testcases): # pylint: disable=invalid-name - """A decorator for creating parameterized tests. - - See the module docstring for a usage example. - Args: - *testcases: Parameters for the decorated method, either a single - iterable, or a list of tuples/dicts/objects (for tests - with only one argument). - - Returns: - A test generator to be handled by TestGeneratorMetaclass. - """ - return _ParameterDecorator(_ARGUMENT_REPR, testcases) - - -def named_parameters(*testcases): # pylint: disable=invalid-name - """A decorator for creating parameterized tests. - - See the module docstring for a usage example. The first element of - each parameter tuple should be a string and will be appended to the - name of the test method. - - Args: - *testcases: Parameters for the decorated method, either a single - iterable, or a list of tuples. - - Returns: - A test generator to be handled by TestGeneratorMetaclass. - """ - return _ParameterDecorator(_FIRST_ARG, testcases) - - -class TestGeneratorMetaclass(type): - """Metaclass for test cases with test generators. - - A test generator is an iterable in a testcase that produces callables. These - callables must be single-argument methods. These methods are injected into - the class namespace and the original iterable is removed. If the name of the - iterable conforms to the test pattern, the injected methods will be picked - up as tests by the unittest framework. - - In general, it is supposed to be used in conjunction with the - parameters decorator. - """ - - def __new__(mcs, class_name, bases, dct): - dct['_id_suffix'] = id_suffix = {} - for name, obj in dct.copy().items(): - if (name.startswith(unittest.TestLoader.testMethodPrefix) and - _NonStringIterable(obj)): - iterator = iter(obj) - dct.pop(name) - _UpdateClassDictForParamTestCase(dct, id_suffix, name, iterator) - - return type.__new__(mcs, class_name, bases, dct) - - -def _UpdateClassDictForParamTestCase(dct, id_suffix, name, iterator): - """Adds individual test cases to a dictionary. - - Args: - dct: The target dictionary. - id_suffix: The dictionary for mapping names to test IDs. - name: The original name of the test case. - iterator: The iterator generating the individual test cases. - """ - for idx, func in enumerate(iterator): - assert callable(func), 'Test generators must yield callables, got %r' % ( - func,) - if getattr(func, '__x_use_name__', False): - new_name = func.__name__ - else: - new_name = '%s%s%d' % (name, _SEPARATOR, idx) - assert new_name not in dct, ( - 'Name of parameterized test case "%s" not unique' % (new_name,)) - dct[new_name] = func - id_suffix[new_name] = getattr(func, '__x_extra_id__', '') - - -class TestCase(unittest.TestCase, metaclass=TestGeneratorMetaclass): - """Base class for test cases using the parameters decorator.""" - - def _OriginalName(self): - return self._testMethodName.split(_SEPARATOR)[0] - - def __str__(self): - return '%s (%s)' % (self._OriginalName(), _StrClass(self.__class__)) - - def id(self): # pylint: disable=invalid-name - """Returns the descriptive ID of the test. - - This is used internally by the unittesting framework to get a name - for the test to be used in reports. - - Returns: - The test id. - """ - return '%s.%s%s' % (_StrClass(self.__class__), - self._OriginalName(), - self._id_suffix.get(self._testMethodName, '')) - - -def CoopTestCase(other_base_class): - """Returns a new base class with a cooperative metaclass base. - - This enables the TestCase to be used in combination - with other base classes that have custom metaclasses, such as - mox.MoxTestBase. - - Only works with metaclasses that do not override type.__new__. - - Example: - - import google3 - import mox - - from google.protobuf.internal import _parameterized - - class ExampleTest(parameterized.CoopTestCase(mox.MoxTestBase)): - ... - - Args: - other_base_class: (class) A test case base class. - - Returns: - A new class object. - """ - metaclass = type( - 'CoopMetaclass', - (other_base_class.__metaclass__, - TestGeneratorMetaclass), {}) - return metaclass( - 'CoopTestCase', - (other_base_class, TestCase), {}) diff --git a/third_party/protobuf/python/google/protobuf/internal/any_test.py b/third_party/protobuf/python/google/protobuf/internal/any_test.py index 74d74ef80f17e..a964e900a1a4a 100644 --- a/third_party/protobuf/python/google/protobuf/internal/any_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/any_test.py @@ -31,7 +31,7 @@ class AnyTest(unittest.TestCase): def test_type_name(self): all_types = unittest_pb2.TestAllTypes() any_msg = any.pack(all_types) - self.assertEqual(any.type_name(any_msg), 'protobuf_unittest.TestAllTypes') + self.assertEqual(any.type_name(any_msg), 'proto2_unittest.TestAllTypes') def test_is_type(self): all_types = unittest_pb2.TestAllTypes() diff --git a/third_party/protobuf/python/google/protobuf/internal/builder.py b/third_party/protobuf/python/google/protobuf/internal/builder.py index 4c0f2873d809f..9859e490e6415 100644 --- a/third_party/protobuf/python/google/protobuf/internal/builder.py +++ b/third_party/protobuf/python/google/protobuf/internal/builder.py @@ -54,12 +54,13 @@ def BuildTopDescriptorsAndMessages(file_des, module_name, module): module: Generated _pb2 module """ - def BuildMessage(msg_des): + def BuildMessage(msg_des, prefix): create_dict = {} for (name, nested_msg) in msg_des.nested_types_by_name.items(): - create_dict[name] = BuildMessage(nested_msg) + create_dict[name] = BuildMessage(nested_msg, prefix + msg_des.name + '.') create_dict['DESCRIPTOR'] = msg_des create_dict['__module__'] = module_name + create_dict['__qualname__'] = prefix + msg_des.name message_class = _reflection.GeneratedProtocolMessageType( msg_des.name, (_message.Message,), create_dict) _sym_db.RegisterMessage(message_class) @@ -83,7 +84,7 @@ def BuildTopDescriptorsAndMessages(file_des, module_name, module): # Build messages. for (name, msg_des) in file_des.message_types_by_name.items(): - module[name] = BuildMessage(msg_des) + module[name] = BuildMessage(msg_des, '') def AddHelpersToExtensions(file_des): diff --git a/third_party/protobuf/python/google/protobuf/internal/containers.py b/third_party/protobuf/python/google/protobuf/internal/containers.py index 23357816f63a6..7298bc5c7a33d 100755 --- a/third_party/protobuf/python/google/protobuf/internal/containers.py +++ b/third_party/protobuf/python/google/protobuf/internal/containers.py @@ -412,6 +412,13 @@ class ScalarMap(MutableMapping[_K, _V]): def __repr__(self) -> str: return repr(self._values) + def setdefault(self, key: _K, value: Optional[_V] = None) -> _V: + if value == None: + raise ValueError('The value for scalar map setdefault must be set.') + if key not in self._values: + self.__setitem__(key, value) + return self[key] + def MergeFrom(self, other: 'ScalarMap[_K, _V]') -> None: self._values.update(other._values) self._message_listener.Modified() @@ -526,6 +533,12 @@ class MessageMap(MutableMapping[_K, _V]): def __repr__(self) -> str: return repr(self._values) + def setdefault(self, key: _K, value: Optional[_V] = None) -> _V: + raise NotImplementedError( + 'Set message map value directly is not supported, call' + ' my_map[key].foo = 5' + ) + def MergeFrom(self, other: 'MessageMap[_K, _V]') -> None: # pylint: disable=protected-access for key in other._values: diff --git a/third_party/protobuf/python/google/protobuf/internal/decoder.py b/third_party/protobuf/python/google/protobuf/internal/decoder.py index dcde1d9420c9a..91a4c7541e3dc 100755 --- a/third_party/protobuf/python/google/protobuf/internal/decoder.py +++ b/third_party/protobuf/python/google/protobuf/internal/decoder.py @@ -58,6 +58,7 @@ we repeatedly read a tag, look up the corresponding decoder, and invoke it. __author__ = 'kenton@google.com (Kenton Varda)' import math +import numbers import struct from google.protobuf import message @@ -71,6 +72,27 @@ from google.protobuf.internal import wire_format _DecodeError = message.DecodeError +def IsDefaultScalarValue(value): + """Returns whether or not a scalar value is the default value of its type. + + Specifically, this should be used to determine presence of implicit-presence + fields, where we disallow custom defaults. + + Args: + value: A scalar value to check. + + Returns: + True if the value is equivalent to a default value, False otherwise. + """ + if isinstance(value, numbers.Number) and math.copysign(1.0, value) < 0: + # Special case for negative zero, where "truthiness" fails to give the right + # answer. + return False + + # Normally, we can just use Python's boolean conversion. + return not value + + def _VarintDecoder(mask, result_type): """Return an encoder for a basic varint value (does not include tag). @@ -168,6 +190,19 @@ def ReadTag(buffer, pos): return tag_bytes, pos +def DecodeTag(tag_bytes): + """Decode a tag from the bytes. + + Args: + tag_bytes: the bytes of the tag + + Returns: + Tuple[int, int] of the tag field number and wire type. + """ + (tag, _) = _DecodeVarint(tag_bytes, 0) + return wire_format.UnpackTag(tag) + + # -------------------------------------------------------------------- @@ -224,7 +259,7 @@ def _SimpleDecoder(wire_type, decode_value): (new_value, pos) = decode_value(buffer, pos) if pos > end: raise _DecodeError('Truncated message.') - if clear_if_default and not new_value: + if clear_if_default and IsDefaultScalarValue(new_value): field_dict.pop(key, None) else: field_dict[key] = new_value @@ -465,7 +500,7 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default, (enum_value, pos) = _DecodeSignedVarint32(buffer, pos) if pos > end: raise _DecodeError('Truncated message.') - if clear_if_default and not enum_value: + if clear_if_default and IsDefaultScalarValue(enum_value): field_dict.pop(key, None) return pos # pylint: disable=protected-access @@ -560,7 +595,7 @@ def StringDecoder(field_number, is_repeated, is_packed, key, new_default, new_pos = pos + size if new_pos > end: raise _DecodeError('Truncated string.') - if clear_if_default and not size: + if clear_if_default and IsDefaultScalarValue(size): field_dict.pop(key, None) else: field_dict[key] = _ConvertToUnicode(buffer[pos:new_pos]) @@ -601,7 +636,7 @@ def BytesDecoder(field_number, is_repeated, is_packed, key, new_default, new_pos = pos + size if new_pos > end: raise _DecodeError('Truncated string.') - if clear_if_default and not size: + if clear_if_default and IsDefaultScalarValue(size): field_dict.pop(key, None) else: field_dict[key] = buffer[pos:new_pos].tobytes() @@ -730,7 +765,6 @@ def MessageSetItemDecoder(descriptor): local_ReadTag = ReadTag local_DecodeVarint = _DecodeVarint - local_SkipField = SkipField def DecodeItem(buffer, pos, end, message, field_dict): """Decode serialized message set to its value and new position. @@ -762,9 +796,10 @@ def MessageSetItemDecoder(descriptor): elif tag_bytes == item_end_tag_bytes: break else: - pos = SkipField(buffer, pos, end, tag_bytes) + field_number, wire_type = DecodeTag(tag_bytes) + _, pos = _DecodeUnknownField(buffer, pos, end, field_number, wire_type) if pos == -1: - raise _DecodeError('Missing group end tag.') + raise _DecodeError('Unexpected end-group tag.') if pos > end: raise _DecodeError('Truncated message.') @@ -822,9 +857,10 @@ def UnknownMessageSetItemDecoder(): elif tag_bytes == item_end_tag_bytes: break else: - pos = SkipField(buffer, pos, end, tag_bytes) + field_number, wire_type = DecodeTag(tag_bytes) + _, pos = _DecodeUnknownField(buffer, pos, end, field_number, wire_type) if pos == -1: - raise _DecodeError('Missing group end tag.') + raise _DecodeError('Unexpected end-group tag.') if pos > end: raise _DecodeError('Truncated message.') @@ -882,30 +918,6 @@ def MapDecoder(field_descriptor, new_default, is_message_map): return DecodeMap -# -------------------------------------------------------------------- -# Optimization is not as heavy here because calls to SkipField() are rare, -# except for handling end-group tags. - -def _SkipVarint(buffer, pos, end): - """Skip a varint value. Returns the new position.""" - # Previously ord(buffer[pos]) raised IndexError when pos is out of range. - # With this code, ord(b'') raises TypeError. Both are handled in - # python_message.py to generate a 'Truncated message' error. - while ord(buffer[pos:pos+1].tobytes()) & 0x80: - pos += 1 - pos += 1 - if pos > end: - raise _DecodeError('Truncated message.') - return pos - -def _SkipFixed64(buffer, pos, end): - """Skip a fixed64 value. Returns the new position.""" - - pos += 8 - if pos > end: - raise _DecodeError('Truncated message.') - return pos - def _DecodeFixed64(buffer, pos): """Decode a fixed64.""" @@ -913,25 +925,11 @@ def _DecodeFixed64(buffer, pos): return (struct.unpack('<Q', buffer[pos:new_pos])[0], new_pos) -def _SkipLengthDelimited(buffer, pos, end): - """Skip a length-delimited value. Returns the new position.""" +def _DecodeFixed32(buffer, pos): + """Decode a fixed32.""" - (size, pos) = _DecodeVarint(buffer, pos) - pos += size - if pos > end: - raise _DecodeError('Truncated message.') - return pos - - -def _SkipGroup(buffer, pos, end): - """Skip sub-group. Returns the new position.""" - - while 1: - (tag_bytes, pos) = ReadTag(buffer, pos) - new_pos = SkipField(buffer, pos, end, tag_bytes) - if new_pos == -1: - return pos - pos = new_pos + new_pos = pos + 4 + return (struct.unpack('<I', buffer[pos:new_pos])[0], new_pos) def _DecodeUnknownFieldSet(buffer, pos, end_pos=None): @@ -944,14 +942,16 @@ def _DecodeUnknownFieldSet(buffer, pos, end_pos=None): field_number, wire_type = wire_format.UnpackTag(tag) if wire_type == wire_format.WIRETYPE_END_GROUP: break - (data, pos) = _DecodeUnknownField(buffer, pos, wire_type) + (data, pos) = _DecodeUnknownField( + buffer, pos, end_pos, field_number, wire_type + ) # pylint: disable=protected-access unknown_field_set._add(field_number, wire_type, data) return (unknown_field_set, pos) -def _DecodeUnknownField(buffer, pos, wire_type): +def _DecodeUnknownField(buffer, pos, end_pos, field_number, wire_type): """Decode a unknown field. Returns the UnknownField and new position.""" if wire_type == wire_format.WIRETYPE_VARINT: @@ -965,72 +965,19 @@ def _DecodeUnknownField(buffer, pos, wire_type): data = buffer[pos:pos+size].tobytes() pos += size elif wire_type == wire_format.WIRETYPE_START_GROUP: - (data, pos) = _DecodeUnknownFieldSet(buffer, pos) + end_tag_bytes = encoder.TagBytes( + field_number, wire_format.WIRETYPE_END_GROUP + ) + data, pos = _DecodeUnknownFieldSet(buffer, pos, end_pos) + # Check end tag. + if buffer[pos - len(end_tag_bytes) : pos] != end_tag_bytes: + raise _DecodeError('Missing group end tag.') elif wire_type == wire_format.WIRETYPE_END_GROUP: return (0, -1) else: raise _DecodeError('Wrong wire type in tag.') - return (data, pos) - - -def _EndGroup(buffer, pos, end): - """Skipping an END_GROUP tag returns -1 to tell the parent loop to break.""" - - return -1 - - -def _SkipFixed32(buffer, pos, end): - """Skip a fixed32 value. Returns the new position.""" - - pos += 4 - if pos > end: + if pos > end_pos: raise _DecodeError('Truncated message.') - return pos - -def _DecodeFixed32(buffer, pos): - """Decode a fixed32.""" - - new_pos = pos + 4 - return (struct.unpack('<I', buffer[pos:new_pos])[0], new_pos) - - -def _RaiseInvalidWireType(buffer, pos, end): - """Skip function for unknown wire types. Raises an exception.""" - - raise _DecodeError('Tag had invalid wire type.') - -def _FieldSkipper(): - """Constructs the SkipField function.""" - - WIRETYPE_TO_SKIPPER = [ - _SkipVarint, - _SkipFixed64, - _SkipLengthDelimited, - _SkipGroup, - _EndGroup, - _SkipFixed32, - _RaiseInvalidWireType, - _RaiseInvalidWireType, - ] - - wiretype_mask = wire_format.TAG_TYPE_MASK - - def SkipField(buffer, pos, end, tag_bytes): - """Skips a field with the specified tag. - - |pos| should point to the byte immediately after the tag. - - Returns: - The new position (after the tag value), or -1 if the tag is an end-group - tag (in which case the calling loop should break). - """ - - # The wire type is always in the first byte since varints are little-endian. - wire_type = ord(tag_bytes[0:1]) & wiretype_mask - return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end) - - return SkipField - -SkipField = _FieldSkipper() + return (data, pos) diff --git a/third_party/protobuf/python/google/protobuf/internal/decoder_test.py b/third_party/protobuf/python/google/protobuf/internal/decoder_test.py index f801b6e76fd8b..aa683ad140966 100644 --- a/third_party/protobuf/python/google/protobuf/internal/decoder_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/decoder_test.py @@ -11,8 +11,14 @@ import io import unittest +from google.protobuf import message +from google.protobuf.internal import api_implementation from google.protobuf.internal import decoder +from google.protobuf.internal import message_set_extensions_pb2 from google.protobuf.internal import testing_refleaks +from google.protobuf.internal import wire_format + +from absl.testing import parameterized _INPUT_BYTES = b'\x84r\x12' @@ -20,7 +26,7 @@ _EXPECTED = (14596, 18) @testing_refleaks.TestCase -class DecoderTest(unittest.TestCase): +class DecoderTest(parameterized.TestCase): def test_decode_varint_bytes(self): (size, pos) = decoder._DecodeVarint(_INPUT_BYTES, 0) @@ -33,7 +39,7 @@ class DecoderTest(unittest.TestCase): def test_decode_varint_bytes_empty(self): with self.assertRaises(IndexError) as context: - (size, pos) = decoder._DecodeVarint(b'', 0) + decoder._DecodeVarint(b'', 0) self.assertIn('index out of range', str(context.exception)) def test_decode_varint_bytesio(self): @@ -50,7 +56,87 @@ class DecoderTest(unittest.TestCase): def test_decode_varint_bytesio_empty(self): input_io = io.BytesIO(b'') size = decoder._DecodeVarint(input_io) - self.assertEqual(size, None) + self.assertIsNone(size) + + def test_decode_unknown_group_field(self): + data = memoryview(b'\013\020\003\014\040\005') + parsed, pos = decoder._DecodeUnknownField( + data, 1, len(data), 1, wire_format.WIRETYPE_START_GROUP + ) + + self.assertEqual(pos, 4) + self.assertEqual(len(parsed), 1) + self.assertEqual(parsed[0].field_number, 2) + self.assertEqual(parsed[0].data, 3) + + def test_decode_unknown_group_field_nested(self): + data = memoryview(b'\013\023\013\030\004\014\024\014\050\006') + parsed, pos = decoder._DecodeUnknownField( + data, 1, len(data), 1, wire_format.WIRETYPE_START_GROUP + ) + + self.assertEqual(pos, 8) + self.assertEqual(len(parsed), 1) + self.assertEqual(parsed[0].field_number, 2) + self.assertEqual(len(parsed[0].data), 1) + self.assertEqual(parsed[0].data[0].field_number, 1) + self.assertEqual(len(parsed[0].data[0].data), 1) + self.assertEqual(parsed[0].data[0].data[0].field_number, 3) + self.assertEqual(parsed[0].data[0].data[0].data, 4) + + def test_decode_unknown_mismatched_end_group(self): + self.assertRaisesRegex( + message.DecodeError, + 'Missing group end tag.*', + decoder._DecodeUnknownField, + memoryview(b'\013\024'), + 1, + 2, + 1, + wire_format.WIRETYPE_START_GROUP, + ) + + def test_decode_unknown_mismatched_end_group_nested(self): + self.assertRaisesRegex( + message.DecodeError, + 'Missing group end tag.*', + decoder._DecodeUnknownField, + memoryview(b'\013\023\034\024\014'), + 1, + 5, + 1, + wire_format.WIRETYPE_START_GROUP, + ) + + def test_decode_message_set_unknown_mismatched_end_group(self): + proto = message_set_extensions_pb2.TestMessageSet() + self.assertRaisesRegex( + message.DecodeError, + 'Unexpected end-group tag.' + if api_implementation.Type() == 'python' + else '.*', + proto.ParseFromString, + b'\013\054\014', + ) + + def test_unknown_message_set_decoder_mismatched_end_group(self): + # This behavior isn't actually reachable in practice, but it's good to + # test anyway. + decode = decoder.UnknownMessageSetItemDecoder() + self.assertRaisesRegex( + message.DecodeError, + 'Unexpected end-group tag.', + decode, + memoryview(b'\054\014'), + ) + + @parameterized.parameters(int(0), float(0.0), False, '') + def test_default_scalar(self, value): + self.assertTrue(decoder.IsDefaultScalarValue(value)) + + @parameterized.parameters(int(1), float(-0.0), float(1.0), True, 'a') + def test_not_default_scalar(self, value): + self.assertFalse(decoder.IsDefaultScalarValue(value)) if __name__ == '__main__': diff --git a/third_party/protobuf/python/google/protobuf/internal/descriptor_database_test.py b/third_party/protobuf/python/google/protobuf/internal/descriptor_database_test.py index 77afa0bedb241..83106aca9937d 100644 --- a/third_party/protobuf/python/google/protobuf/internal/descriptor_database_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/descriptor_database_test.py @@ -56,8 +56,26 @@ class DescriptorDatabaseTest(unittest.TestCase): 'google.protobuf.python.internal.Factory2Enum.FACTORY_2_VALUE_0')) self.assertEqual(file_desc_proto, db.FindFileContainingSymbol( 'google.protobuf.python.internal.FACTORY_2_VALUE_0')) - self.assertEqual(file_desc_proto2, db.FindFileContainingSymbol( - '.NO_PACKAGE_VALUE_0')) + self.assertEqual( + file_desc_proto2, db.FindFileContainingSymbol('NO_PACKAGE_VALUE_0') + ) + self.assertEqual( + file_desc_proto2, db.FindFileContainingSymbol('.NO_PACKAGE_VALUE_0') + ) + self.assertEqual( + file_desc_proto2, db.FindFileContainingSymbol('NoPackageMessage') + ) + self.assertEqual( + file_desc_proto2, db.FindFileContainingSymbol('.NoPackageMessage') + ) + self.assertEqual( + file_desc_proto2, + db.FindFileContainingSymbol('NoPackageEnum'), + ) + self.assertEqual( + file_desc_proto2, + db.FindFileContainingSymbol('.NoPackageEnum'), + ) # Can find top level extension. self.assertEqual(file_desc_proto, db.FindFileContainingSymbol( 'google.protobuf.python.internal.another_field')) @@ -70,15 +88,20 @@ class DescriptorDatabaseTest(unittest.TestCase): unittest_pb2.DESCRIPTOR.serialized_pb) db.Add(file_desc_proto2) self.assertEqual(file_desc_proto2, db.FindFileContainingSymbol( - 'protobuf_unittest.TestService')) + 'proto2_unittest.TestService')) # Non-existent field under a valid top level symbol can also be # found. The behavior is the same with protobuf C++. self.assertEqual(file_desc_proto2, db.FindFileContainingSymbol( - 'protobuf_unittest.TestAllTypes.none_field')) + 'proto2_unittest.TestAllTypes.none_field')) - with self.assertRaisesRegex(KeyError, r'\'protobuf_unittest\.NoneMessage\''): - db.FindFileContainingSymbol('protobuf_unittest.NoneMessage') + with self.assertRaisesRegex(KeyError, r'\'proto2_unittest\.NoneMessage\''): + db.FindFileContainingSymbol('proto2_unittest.NoneMessage') + + with self.assertRaises(KeyError): + db.FindFileContainingSymbol( + '.google.protobuf.python.internal.FACTORY_2_VALUE_0' + ) def testConflictRegister(self): db = descriptor_database.DescriptorDatabase() diff --git a/third_party/protobuf/python/google/protobuf/internal/descriptor_pool_test.py b/third_party/protobuf/python/google/protobuf/internal/descriptor_pool_test.py index 89aa15b3a47f0..7d9bd9015d636 100644 --- a/third_party/protobuf/python/google/protobuf/internal/descriptor_pool_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/descriptor_pool_test.py @@ -97,7 +97,7 @@ class DescriptorPoolTestBase(object): file_desc4.name) file_desc5 = self.pool.FindFileContainingSymbol( - 'protobuf_unittest.TestService') + 'proto2_unittest.TestService') self.assertIsInstance(file_desc5, descriptor.FileDescriptor) self.assertEqual('google/protobuf/unittest.proto', file_desc5.name) @@ -107,7 +107,7 @@ class DescriptorPoolTestBase(object): assert descriptor_pool.Default().FindFileContainingSymbol( 'google.protobuf.python.internal.another_field') assert descriptor_pool.Default().FindFileContainingSymbol( - 'protobuf_unittest.TestService') + 'proto2_unittest.TestService') # Can find field. file_desc6 = self.pool.FindFileContainingSymbol( @@ -125,7 +125,7 @@ class DescriptorPoolTestBase(object): # Can find nested Enum value. file_desc8 = self.pool.FindFileContainingSymbol( - 'protobuf_unittest.TestAllTypes.FOO') + 'proto2_unittest.TestAllTypes.FOO') self.assertIsInstance(file_desc8, descriptor.FileDescriptor) self.assertEqual('google/protobuf/unittest.proto', file_desc8.name) @@ -404,15 +404,15 @@ class DescriptorPoolTestBase(object): 'google.protobuf.python.internal.Factory1Message.list_value') def testFindService(self): - service = self.pool.FindServiceByName('protobuf_unittest.TestService') - self.assertEqual(service.full_name, 'protobuf_unittest.TestService') + service = self.pool.FindServiceByName('proto2_unittest.TestService') + self.assertEqual(service.full_name, 'proto2_unittest.TestService') with self.assertRaises(KeyError): self.pool.FindServiceByName('Does not exist') - method = self.pool.FindMethodByName('protobuf_unittest.TestService.Foo') + method = self.pool.FindMethodByName('proto2_unittest.TestService.Foo') self.assertIs(method.containing_service, service) with self.assertRaises(KeyError): - self.pool.FindMethodByName('protobuf_unittest.TestService.Doesnotexist') + self.pool.FindMethodByName('proto2_unittest.TestService.Doesnotexist') def testUserDefinedDB(self): db = descriptor_database.DescriptorDatabase() @@ -653,24 +653,24 @@ class DefaultDescriptorPoolTest(DescriptorPoolTestBase, unittest.TestCase): self.pool.FindFileByName('google/protobuf/unittest.proto'), unittest_pb2.DESCRIPTOR) self.assertIs( - self.pool.FindMessageTypeByName('protobuf_unittest.TestAllTypes'), + self.pool.FindMessageTypeByName('proto2_unittest.TestAllTypes'), unittest_pb2.TestAllTypes.DESCRIPTOR) self.assertIs( self.pool.FindFieldByName( - 'protobuf_unittest.TestAllTypes.optional_int32'), + 'proto2_unittest.TestAllTypes.optional_int32'), unittest_pb2.TestAllTypes.DESCRIPTOR.fields_by_name['optional_int32']) self.assertIs( - self.pool.FindEnumTypeByName('protobuf_unittest.ForeignEnum'), + self.pool.FindEnumTypeByName('proto2_unittest.ForeignEnum'), unittest_pb2.ForeignEnum.DESCRIPTOR) self.assertIs( self.pool.FindExtensionByName( - 'protobuf_unittest.optional_int32_extension'), + 'proto2_unittest.optional_int32_extension'), unittest_pb2.DESCRIPTOR.extensions_by_name['optional_int32_extension']) self.assertIs( - self.pool.FindOneofByName('protobuf_unittest.TestAllTypes.oneof_field'), + self.pool.FindOneofByName('proto2_unittest.TestAllTypes.oneof_field'), unittest_pb2.TestAllTypes.DESCRIPTOR.oneofs_by_name['oneof_field']) self.assertIs( - self.pool.FindServiceByName('protobuf_unittest.TestService'), + self.pool.FindServiceByName('proto2_unittest.TestService'), unittest_pb2.DESCRIPTOR.services_by_name['TestService']) @@ -718,6 +718,87 @@ class SecondaryDescriptorFromDescriptorDB(DescriptorPoolTestBase, no_package_pb2.DESCRIPTOR.serialized_pb)) self.pool = descriptor_pool.DescriptorPool(descriptor_db=self.db) + # TODO: b/387527786 - This is a helper function for testErrorCollector to + # capture some of the nonconformant, C++-specific behavior. + def assertCppErrorCollectorCorrect(self): + self.assertEqual(api_implementation.Type(), 'cpp') + error_msg = ( + 'Invalid proto descriptor for file "error_file":\\n ' + 'collector.ErrorMessage.nested_message_field: "SubMessage" ' + 'is not defined.\\n collector.ErrorMessage.MyOneof: Oneof ' + "must have at least one field.\\n'" + ) + with self.assertRaises(KeyError) as exc: + self.pool.FindMessageTypeByName('collector.ErrorMessage') + self.assertEqual( + str(exc.exception), + "'Couldn\\'t build file for message collector.ErrorMessage\\n" + + error_msg, + ) + + with self.assertRaises(KeyError) as exc: + self.pool.FindFieldByName('collector.ErrorMessage.nested_message_field') + self.assertEqual( + str(exc.exception), + "'Couldn\\'t build file for field" + ' collector.ErrorMessage.nested_message_field\\n' + + error_msg, + ) + + with self.assertRaises(KeyError) as exc: + self.pool.FindEnumTypeByName('collector.MyEnum') + self.assertEqual( + str(exc.exception), + "'Couldn\\'t build file for enum collector.MyEnum\\n" + error_msg, + ) + + with self.assertRaises(KeyError) as exc: + self.pool.FindFileContainingSymbol('collector.MyEnumValue') + self.assertEqual( + str(exc.exception), + "'Couldn\\'t build file for symbol collector.MyEnumValue\\n" + + error_msg, + ) + + with self.assertRaises(KeyError) as exc: + self.pool.FindOneofByName('collector.ErrorMessage.MyOneof') + self.assertEqual( + str(exc.exception), + "'Couldn\\'t build file for oneof collector.ErrorMessage.MyOneof\\n" + + error_msg, + ) + + # TODO: b/387527786 - This is a helper function for testErrorCollector to + # capture some of the nonconformant, UPB-specific behavior. + def assertUpbErrorCollectorCorrect(self): + self.assertEqual(api_implementation.Type(), 'upb') + # Nonconformance: compared with C++, UPB will have less descriptive + # error messages, and raise TypeError instead of KeyError. + error_msg = ( + "Couldn't build proto file into descriptor pool: " + "couldn't resolve name 'SubMessage'" + ) + + with self.assertRaises(TypeError) as exc: + self.pool.FindMessageTypeByName('collector.ErrorMessage') + self.assertEqual(str(exc.exception), error_msg) + + with self.assertRaises(TypeError) as exc: + self.pool.FindFieldByName('collector.ErrorMessage.nested_message_field') + self.assertEqual(str(exc.exception), error_msg) + + with self.assertRaises(TypeError) as exc: + self.pool.FindEnumTypeByName('collector.MyEnum') + self.assertEqual(str(exc.exception), error_msg) + + with self.assertRaises(TypeError) as exc: + self.pool.FindFileContainingSymbol('collector.MyEnumValue') + self.assertEqual(str(exc.exception), error_msg) + + with self.assertRaises(TypeError) as exc: + self.pool.FindOneofByName('collector.ErrorMessage.MyOneof') + self.assertEqual(str(exc.exception), error_msg) + def testErrorCollector(self): file_proto = descriptor_pb2.FileDescriptorProto() file_proto.package = 'collector' @@ -739,11 +820,20 @@ class SecondaryDescriptorFromDescriptorDB(DescriptorPoolTestBase, enum_value.number = 0 self.db.Add(file_proto) - self.assertRaisesRegex(KeyError, 'SubMessage', - self.pool.FindMessageTypeByName, - 'collector.ErrorMessage') - self.assertRaisesRegex(KeyError, 'SubMessage', self.pool.FindFileByName, - 'error_file') + # Nonconformance: UPB will raise a TypeError whereas other implementations + # will raise KeyError when SubMessage cannot be indexed. + # TODO: b/387527786 - Fix this nonconformance between (cpp+python)/upb. + error_type = TypeError if api_implementation.Type() == 'upb' else KeyError + self.assertRaisesRegex( + error_type, + 'SubMessage', + self.pool.FindMessageTypeByName, + 'collector.ErrorMessage', + ) + self.assertRaisesRegex( + error_type, 'SubMessage', self.pool.FindFileByName, 'error_file' + ) + with self.assertRaises(KeyError) as exc: self.pool.FindFileByName('none_file') self.assertIn(str(exc.exception), ('\'none_file\'', @@ -755,36 +845,12 @@ class SecondaryDescriptorFromDescriptorDB(DescriptorPoolTestBase, # called the first time, a KeyError will be raised but call the find # method later will return a descriptor which is not build. # TODO: fix pure python to revert the load if file can not be build + # TODO: b/387527786 - Fix this nonconformance between python/cpp/upb. if api_implementation.Type() != 'python': - error_msg = ('Invalid proto descriptor for file "error_file":\\n ' - 'collector.ErrorMessage.nested_message_field: "SubMessage" ' - 'is not defined.\\n collector.ErrorMessage.MyOneof: Oneof ' - 'must have at least one field.\\n\'') - with self.assertRaises(KeyError) as exc: - self.pool.FindMessageTypeByName('collector.ErrorMessage') - self.assertEqual(str(exc.exception), '\'Couldn\\\'t build file for ' - 'message collector.ErrorMessage\\n' + error_msg) - - with self.assertRaises(KeyError) as exc: - self.pool.FindFieldByName('collector.ErrorMessage.nested_message_field') - self.assertEqual(str(exc.exception), '\'Couldn\\\'t build file for field' - ' collector.ErrorMessage.nested_message_field\\n' - + error_msg) - - with self.assertRaises(KeyError) as exc: - self.pool.FindEnumTypeByName('collector.MyEnum') - self.assertEqual(str(exc.exception), '\'Couldn\\\'t build file for enum' - ' collector.MyEnum\\n' + error_msg) - - with self.assertRaises(KeyError) as exc: - self.pool.FindFileContainingSymbol('collector.MyEnumValue') - self.assertEqual(str(exc.exception), '\'Couldn\\\'t build file for symbol' - ' collector.MyEnumValue\\n' + error_msg) - - with self.assertRaises(KeyError) as exc: - self.pool.FindOneofByName('collector.ErrorMessage.MyOneof') - self.assertEqual(str(exc.exception), '\'Couldn\\\'t build file for oneof' - ' collector.ErrorMessage.MyOneof\\n' + error_msg) + if api_implementation.Type() == 'cpp': + self.assertCppErrorCollectorCorrect() + else: + self.assertUpbErrorCollectorCorrect() class ProtoFile(object): @@ -965,20 +1031,20 @@ class AddDescriptorTest(unittest.TestCase): pool = descriptor_pool.DescriptorPool() pool._AddDescriptor(unittest_pb2.TestAllTypes.DESCRIPTOR) self.assertEqual( - 'protobuf_unittest.TestAllTypes', + 'proto2_unittest.TestAllTypes', pool.FindMessageTypeByName( - prefix + 'protobuf_unittest.TestAllTypes').full_name) + prefix + 'proto2_unittest.TestAllTypes').full_name) # AddDescriptor is not recursive. with self.assertRaises(KeyError): pool.FindMessageTypeByName( - prefix + 'protobuf_unittest.TestAllTypes.NestedMessage') + prefix + 'proto2_unittest.TestAllTypes.NestedMessage') pool._AddDescriptor(unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR) self.assertEqual( - 'protobuf_unittest.TestAllTypes.NestedMessage', + 'proto2_unittest.TestAllTypes.NestedMessage', pool.FindMessageTypeByName( - prefix + 'protobuf_unittest.TestAllTypes.NestedMessage').full_name) + prefix + 'proto2_unittest.TestAllTypes.NestedMessage').full_name) # Files are implicitly also indexed when messages are added. self.assertEqual( @@ -989,7 +1055,7 @@ class AddDescriptorTest(unittest.TestCase): self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileContainingSymbol( - prefix + 'protobuf_unittest.TestAllTypes.NestedMessage').name) + prefix + 'proto2_unittest.TestAllTypes.NestedMessage').name) @unittest.skipIf(api_implementation.Type() != 'python', 'Only pure python allows _Add*()') @@ -1003,19 +1069,19 @@ class AddDescriptorTest(unittest.TestCase): pool.AddSerializedFile(unittest_import_pb2.DESCRIPTOR.serialized_pb) pool.AddSerializedFile(unittest_pb2.DESCRIPTOR.serialized_pb) self.assertEqual( - 'protobuf_unittest.ForeignEnum', + 'proto2_unittest.ForeignEnum', pool.FindEnumTypeByName( - prefix + 'protobuf_unittest.ForeignEnum').full_name) + prefix + 'proto2_unittest.ForeignEnum').full_name) # AddEnumDescriptor is not recursive. with self.assertRaises(KeyError): pool.FindEnumTypeByName( - prefix + 'protobuf_unittest.ForeignEnum.NestedEnum') + prefix + 'proto2_unittest.ForeignEnum.NestedEnum') self.assertEqual( - 'protobuf_unittest.TestAllTypes.NestedEnum', + 'proto2_unittest.TestAllTypes.NestedEnum', pool.FindEnumTypeByName( - prefix + 'protobuf_unittest.TestAllTypes.NestedEnum').full_name) + prefix + 'proto2_unittest.TestAllTypes.NestedEnum').full_name) # Files are implicitly also indexed when enums are added. self.assertEqual( @@ -1026,7 +1092,7 @@ class AddDescriptorTest(unittest.TestCase): self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileContainingSymbol( - prefix + 'protobuf_unittest.TestAllTypes.NestedEnum').name) + prefix + 'proto2_unittest.TestAllTypes.NestedEnum').name) @unittest.skipIf(api_implementation.Type() != 'python', 'Only pure python allows _Add*()') @@ -1039,11 +1105,11 @@ class AddDescriptorTest(unittest.TestCase): def testService(self): pool = descriptor_pool.DescriptorPool() with self.assertRaises(KeyError): - pool.FindServiceByName('protobuf_unittest.TestService') + pool.FindServiceByName('proto2_unittest.TestService') pool._AddServiceDescriptor(unittest_pb2._TESTSERVICE) self.assertEqual( - 'protobuf_unittest.TestService', - pool.FindServiceByName('protobuf_unittest.TestService').full_name) + 'proto2_unittest.TestService', + pool.FindServiceByName('proto2_unittest.TestService').full_name) @unittest.skipIf(api_implementation.Type() != 'python', 'Only pure python allows _Add*()') @@ -1059,7 +1125,7 @@ class AddDescriptorTest(unittest.TestCase): # be explicitly registered. with self.assertRaises(KeyError): pool.FindFileContainingSymbol( - 'protobuf_unittest.TestAllTypes') + 'proto2_unittest.TestAllTypes') def testEmptyDescriptorPool(self): # Check that an empty DescriptorPool() contains no messages. diff --git a/third_party/protobuf/python/google/protobuf/internal/descriptor_test.py b/third_party/protobuf/python/google/protobuf/internal/descriptor_test.py index 7c6ad14714bda..fa9960f31be97 100755 --- a/third_party/protobuf/python/google/protobuf/internal/descriptor_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/descriptor_test.py @@ -22,7 +22,7 @@ from google.protobuf.internal import test_proto2_pb2 from google.protobuf.internal import test_util from google.protobuf.internal import testing_refleaks -from google.protobuf.internal import _parameterized +from absl.testing import parameterized from google.protobuf import unittest_custom_options_pb2 from google.protobuf import unittest_features_pb2 from google.protobuf import unittest_import_pb2 @@ -38,7 +38,7 @@ name: 'TestEmptyMessage' TEST_FILE_DESCRIPTOR_DEBUG = """syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; message NestedMessage { enum ForeignEnum { @@ -54,7 +54,7 @@ message ResponseMessage { } service DescriptorTestService { - rpc CallMethod(.protobuf_unittest.NestedMessage) returns (.protobuf_unittest.ResponseMessage); + rpc CallMethod(.proto2_unittest.NestedMessage) returns (.proto2_unittest.ResponseMessage); } """ @@ -69,7 +69,7 @@ class DescriptorTest(unittest.TestCase): def setUp(self): file_proto = descriptor_pb2.FileDescriptorProto( name='some/filename/some.proto', - package='protobuf_unittest') + package='proto2_unittest') message_proto = file_proto.message_type.add( name='NestedMessage') message_proto.field.add( @@ -88,8 +88,8 @@ class DescriptorTest(unittest.TestCase): service_proto = file_proto.service.add(name='DescriptorTestService') method_proto = service_proto.method.add( name='CallMethod', - input_type='.protobuf_unittest.NestedMessage', - output_type='.protobuf_unittest.ResponseMessage') + input_type='.proto2_unittest.NestedMessage', + output_type='.proto2_unittest.ResponseMessage') # Note: Calling DescriptorPool.Add() multiple times with the same file only # works if the input is canonical; in particular, all type names must be @@ -236,13 +236,6 @@ class DescriptorTest(unittest.TestCase): def testContainingServiceFixups(self): self.assertEqual(self.my_service, self.my_method.containing_service) - @unittest.skipIf( - api_implementation.Type() == 'python', - 'GetDebugString is only available with the cpp implementation', - ) - def testGetDebugString(self): - self.assertEqual(self.my_file.GetDebugString(), TEST_FILE_DESCRIPTOR_DEBUG) - def testGetOptions(self): self.assertEqual(self.my_enum.GetOptions(), descriptor_pb2.EnumOptions()) @@ -296,6 +289,7 @@ class DescriptorTest(unittest.TestCase): service_options = service_descriptor.GetOptions() service_opt1 = unittest_custom_options_pb2.service_opt1 self.assertEqual(-9876543210, service_options.Extensions[service_opt1]) + self.assertTrue(method_descriptor.has_options) method_options = method_descriptor.GetOptions() method_opt1 = unittest_custom_options_pb2.method_opt1 self.assertEqual(unittest_custom_options_pb2.METHODOPT1_VAL2, @@ -538,7 +532,7 @@ class DescriptorTest(unittest.TestCase): def testFileDescriptor(self): self.assertEqual(self.my_file.name, 'some/filename/some.proto') - self.assertEqual(self.my_file.package, 'protobuf_unittest') + self.assertEqual(self.my_file.package, 'proto2_unittest') self.assertEqual(self.my_file.pool, self.pool) self.assertFalse(self.my_file.has_options) file_proto = descriptor_pb2.FileDescriptorProto() @@ -550,7 +544,8 @@ class DescriptorTest(unittest.TestCase): @unittest.skipIf( api_implementation.Type() == 'python', - 'Immutability of descriptors is only enforced in v2 implementation') + 'Immutability of descriptors is only enforced in c++ and upb backends', + ) def testImmutableCppDescriptor(self): file_descriptor = unittest_pb2.DESCRIPTOR message_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR @@ -575,8 +570,19 @@ class DescriptorTest(unittest.TestCase): enum_descriptor.has_options = False with self.assertRaises(AttributeError) as e: message_descriptor.has_options = True - self.assertEqual('attribute is not writable: has_options', - str(e.exception)) + + if api_implementation.Type() == 'cpp': + self.assertEqual( + 'attribute is not writable: has_options', str(e.exception) + ) + else: + self.assertEqual(api_implementation.Type(), 'upb') + self.assertEqual( + "attribute 'has_options' of " + "'google._upb._message.Descriptor' " + 'objects is not writable', + str(e.exception), + ) def testDefault(self): message_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR @@ -604,7 +610,7 @@ class GeneratedDescriptorTest(unittest.TestCase): # Basic properties self.assertEqual(message_descriptor.name, 'TestAllTypes') self.assertEqual(message_descriptor.full_name, - 'protobuf_unittest.TestAllTypes') + 'proto2_unittest.TestAllTypes') # Test equality and hashability self.assertEqual(message_descriptor, message_descriptor) self.assertEqual(message_descriptor.fields[0].containing_type, @@ -628,7 +634,7 @@ class GeneratedDescriptorTest(unittest.TestCase): self.assertEqual(field_descriptor.name, 'optional_int32') self.assertEqual(field_descriptor.camelcase_name, 'optionalInt32') self.assertEqual(field_descriptor.full_name, - 'protobuf_unittest.TestAllTypes.optional_int32') + 'proto2_unittest.TestAllTypes.optional_int32') self.assertEqual(field_descriptor.containing_type.name, 'TestAllTypes') self.assertEqual(field_descriptor.file, unittest_pb2.DESCRIPTOR) # Test equality and hashability @@ -787,6 +793,7 @@ class GeneratedDescriptorTest(unittest.TestCase): self.assertIs(service_descriptor.file, unittest_pb2.DESCRIPTOR) self.assertEqual(service_descriptor.index, 0) self.CheckDescriptorMapping(service_descriptor.methods_by_name) + self.assertFalse(service_descriptor.has_options) def testOneofDescriptor(self): message_descriptor = unittest_pb2.TestAllTypes.DESCRIPTOR @@ -794,7 +801,7 @@ class GeneratedDescriptorTest(unittest.TestCase): self.assertFalse(oneof_descriptor.has_options) self.assertEqual(message_descriptor, oneof_descriptor.containing_type) self.assertEqual('oneof_field', oneof_descriptor.name) - self.assertEqual('protobuf_unittest.TestAllTypes.oneof_field', + self.assertEqual('proto2_unittest.TestAllTypes.oneof_field', oneof_descriptor.full_name) self.assertEqual(0, oneof_descriptor.index) @@ -857,7 +864,7 @@ class DescriptorCopyToProtoTest(unittest.TestCase): number: 1 label: 1 # Optional type: 11 # TYPE_MESSAGE - type_name: '.protobuf_unittest.TestAllTypes.NestedMessage' + type_name: '.proto2_unittest.TestAllTypes.NestedMessage' > """ @@ -922,7 +929,7 @@ class DescriptorCopyToProtoTest(unittest.TestCase): number: 3 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: ".protobuf_unittest.TestAllTypes.NestedMessage" + type_name: ".proto2_unittest.TestAllTypes.NestedMessage" options { deprecated: true } @@ -942,7 +949,7 @@ class DescriptorCopyToProtoTest(unittest.TestCase): number: 5 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: ".protobuf_unittest.TestDeprecatedFields" + type_name: ".proto2_unittest.TestDeprecatedFields" } oneof_decl { name: "oneof_fields" @@ -993,7 +1000,7 @@ class DescriptorCopyToProtoTest(unittest.TestCase): def testCopyToProto_FileDescriptor(self): UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII = (""" name: 'google/protobuf/unittest_import.proto' - package: 'protobuf_unittest_import' + package: 'proto2_unittest_import' dependency: 'google/protobuf/unittest_import_public.proto' message_type: < name: 'ImportMessage' @@ -1054,13 +1061,13 @@ class DescriptorCopyToProtoTest(unittest.TestCase): name: 'TestService' method: < name: 'Foo' - input_type: '.protobuf_unittest.FooRequest' - output_type: '.protobuf_unittest.FooResponse' + input_type: '.proto2_unittest.FooRequest' + output_type: '.proto2_unittest.FooResponse' > method: < name: 'Bar' - input_type: '.protobuf_unittest.BarRequest' - output_type: '.protobuf_unittest.BarResponse' + input_type: '.proto2_unittest.BarRequest' + output_type: '.proto2_unittest.BarResponse' > """ self._InternalTestCopyToProto( @@ -1071,8 +1078,8 @@ class DescriptorCopyToProtoTest(unittest.TestCase): def testCopyToProto_MethodDescriptor(self): expected_ascii = """ name: 'Foo' - input_type: '.protobuf_unittest.FooRequest' - output_type: '.protobuf_unittest.FooResponse' + input_type: '.proto2_unittest.FooRequest' + output_type: '.proto2_unittest.FooResponse' """ method_descriptor = unittest_pb2.TestService.DESCRIPTOR.FindMethodByName( 'Foo') @@ -1226,9 +1233,9 @@ class MakeDescriptorTest(unittest.TestCase): @testing_refleaks.TestCase -class FeaturesTest(_parameterized.TestCase): +class FeaturesTest(parameterized.TestCase): - @_parameterized.named_parameters([ + @parameterized.named_parameters([ ('File', lambda: descriptor_pb2.DESCRIPTOR), ('Message', lambda: descriptor_pb2.FeatureSet.DESCRIPTOR), ( @@ -1394,7 +1401,7 @@ class FeatureInheritanceTest(unittest.TestCase): super(FeatureInheritanceTest, self).setUp() self.file_proto = descriptor_pb2.FileDescriptorProto( name='some/filename/some.proto', - package='protobuf_unittest', + package='proto2_unittest', edition=descriptor_pb2.Edition.EDITION_2023, syntax='editions', ) @@ -1403,7 +1410,7 @@ class FeatureInheritanceTest(unittest.TestCase): number=10, type=descriptor_pb2.FieldDescriptorProto.TYPE_INT32, label=descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL, - extendee='.protobuf_unittest.TopMessage', + extendee='.proto2_unittest.TopMessage', ) self.top_enum_proto = self.file_proto.enum_type.add(name='TopEnum') self.enum_value_proto = self.top_enum_proto.value.add( @@ -1422,7 +1429,7 @@ class FeatureInheritanceTest(unittest.TestCase): number=11, type=descriptor_pb2.FieldDescriptorProto.TYPE_INT32, label=descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL, - extendee='.protobuf_unittest.TopMessage', + extendee='.proto2_unittest.TopMessage', ) self.nested_message_proto = self.top_message_proto.nested_type.add( name='NestedMessage' @@ -1443,8 +1450,8 @@ class FeatureInheritanceTest(unittest.TestCase): self.service_proto = self.file_proto.service.add(name='TestService') self.method_proto = self.service_proto.method.add( name='CallMethod', - input_type='.protobuf_unittest.TopMessage', - output_type='.protobuf_unittest.TopMessage', + input_type='.proto2_unittest.TopMessage', + output_type='.proto2_unittest.TopMessage', ) def BuildPool(self): @@ -1481,11 +1488,11 @@ class FeatureInheritanceTest(unittest.TestCase): ret.file = ret.pool.AddSerializedFile(self.file_proto.SerializeToString()) ret.top_message = ret.pool.FindMessageTypeByName( - 'protobuf_unittest.TopMessage' + 'proto2_unittest.TopMessage' ) - ret.top_enum = ret.pool.FindEnumTypeByName('protobuf_unittest.TopEnum') + ret.top_enum = ret.pool.FindEnumTypeByName('proto2_unittest.TopEnum') ret.top_extension = ret.pool.FindExtensionByName( - 'protobuf_unittest.top_extension' + 'proto2_unittest.top_extension' ) ret.nested_message = ret.top_message.nested_types_by_name['NestedMessage'] ret.nested_enum = ret.top_message.enum_types_by_name['NestedEnum'] @@ -1496,7 +1503,7 @@ class FeatureInheritanceTest(unittest.TestCase): ret.oneof = ret.top_message.oneofs_by_name['Oneof'] ret.oneof_field = ret.top_message.fields_by_name['oneof_field'] ret.enum_value = ret.top_enum.values_by_name['TOP_VALUE'] - ret.service = ret.pool.FindServiceByName('protobuf_unittest.TestService') + ret.service = ret.pool.FindServiceByName('proto2_unittest.TestService') ret.method = ret.service.methods_by_name['CallMethod'] return ret diff --git a/third_party/protobuf/python/google/protobuf/internal/field_mask_test.py b/third_party/protobuf/python/google/protobuf/internal/field_mask_test.py index ef286f8ba5d0b..fe49c8ee36924 100644 --- a/third_party/protobuf/python/google/protobuf/internal/field_mask_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/field_mask_test.py @@ -323,7 +323,7 @@ class FieldMaskTest(unittest.TestCase): with self.assertRaises(ValueError) as e: mask.MergeMessage(src, dst) self.assertEqual('Error: Field optional_int32 in message ' - 'protobuf_unittest.TestAllTypes is not a singular ' + 'proto2_unittest.TestAllTypes is not a singular ' 'message field and cannot have sub-fields.', str(e.exception)) diff --git a/third_party/protobuf/python/google/protobuf/internal/generator_test.py b/third_party/protobuf/python/google/protobuf/internal/generator_test.py index d11cb8d033350..5b5c7c913fe6b 100644 --- a/third_party/protobuf/python/google/protobuf/internal/generator_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/generator_test.py @@ -19,7 +19,6 @@ __author__ = 'robinson@google.com (Will Robinson)' import unittest from google.protobuf.internal import test_bad_identifiers_pb2 -from google.protobuf import service from google.protobuf import symbol_database from google.protobuf import unittest_import_pb2 from google.protobuf import unittest_import_public_pb2 @@ -241,21 +240,21 @@ class GeneratorTest(unittest.TestCase): def testPackage(self): self.assertEqual( unittest_pb2.TestAllTypes.DESCRIPTOR.file.package, - 'protobuf_unittest') + 'proto2_unittest') desc = unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR - self.assertEqual(desc.file.package, 'protobuf_unittest') + self.assertEqual(desc.file.package, 'proto2_unittest') self.assertEqual( unittest_import_pb2.ImportMessage.DESCRIPTOR.file.package, - 'protobuf_unittest_import') + 'proto2_unittest_import') self.assertEqual( - unittest_pb2._FOREIGNENUM.file.package, 'protobuf_unittest') + unittest_pb2._FOREIGNENUM.file.package, 'proto2_unittest') self.assertEqual( unittest_pb2._TESTALLTYPES_NESTEDENUM.file.package, - 'protobuf_unittest') + 'proto2_unittest') self.assertEqual( unittest_import_pb2._IMPORTENUM.file.package, - 'protobuf_unittest_import') + 'proto2_unittest_import') def testExtensionRange(self): self.assertEqual( @@ -270,7 +269,7 @@ class GeneratorTest(unittest.TestCase): def testFileDescriptor(self): self.assertEqual(unittest_pb2.DESCRIPTOR.name, 'google/protobuf/unittest.proto') - self.assertEqual(unittest_pb2.DESCRIPTOR.package, 'protobuf_unittest') + self.assertEqual(unittest_pb2.DESCRIPTOR.package, 'proto2_unittest') self.assertFalse(unittest_pb2.DESCRIPTOR.serialized_pb is None) self.assertEqual(unittest_pb2.DESCRIPTOR.dependencies, [unittest_import_pb2.DESCRIPTOR]) @@ -283,12 +282,6 @@ class GeneratorTest(unittest.TestCase): self.assertTrue(hasattr(unittest_no_generic_services_pb2, "FOO")) self.assertTrue(hasattr(unittest_no_generic_services_pb2, "test_extension")) - # Make sure unittest_no_generic_services_pb2 has no services subclassing - # Proto2 Service class. - if hasattr(unittest_no_generic_services_pb2, "TestService"): - self.assertFalse(issubclass(unittest_no_generic_services_pb2.TestService, - service.Service)) - def testMessageTypesByName(self): file_type = unittest_pb2.DESCRIPTOR self.assertEqual( @@ -379,31 +372,31 @@ class SymbolDatabaseRegistrationTest(unittest.TestCase): def testGetSymbol(self): self.assertEqual( unittest_pb2.TestAllTypes, symbol_database.Default().GetSymbol( - 'protobuf_unittest.TestAllTypes')) + 'proto2_unittest.TestAllTypes')) self.assertEqual( unittest_pb2.TestAllTypes.NestedMessage, symbol_database.Default().GetSymbol( - 'protobuf_unittest.TestAllTypes.NestedMessage')) + 'proto2_unittest.TestAllTypes.NestedMessage')) with self.assertRaises(KeyError): - symbol_database.Default().GetSymbol('protobuf_unittest.NestedMessage') + symbol_database.Default().GetSymbol('proto2_unittest.NestedMessage') self.assertEqual( unittest_pb2.TestAllTypes.OptionalGroup, symbol_database.Default().GetSymbol( - 'protobuf_unittest.TestAllTypes.OptionalGroup')) + 'proto2_unittest.TestAllTypes.OptionalGroup')) self.assertEqual( unittest_pb2.TestAllTypes.RepeatedGroup, symbol_database.Default().GetSymbol( - 'protobuf_unittest.TestAllTypes.RepeatedGroup')) + 'proto2_unittest.TestAllTypes.RepeatedGroup')) def testEnums(self): self.assertEqual( - 'protobuf_unittest.ForeignEnum', + 'proto2_unittest.ForeignEnum', symbol_database.Default().pool.FindEnumTypeByName( - 'protobuf_unittest.ForeignEnum').full_name) + 'proto2_unittest.ForeignEnum').full_name) self.assertEqual( - 'protobuf_unittest.TestAllTypes.NestedEnum', + 'proto2_unittest.TestAllTypes.NestedEnum', symbol_database.Default().pool.FindEnumTypeByName( - 'protobuf_unittest.TestAllTypes.NestedEnum').full_name) + 'proto2_unittest.TestAllTypes.NestedEnum').full_name) def testFindFileByName(self): self.assertEqual( diff --git a/third_party/protobuf/python/google/protobuf/internal/json_format_test.py b/third_party/protobuf/python/google/protobuf/internal/json_format_test.py index f7a124dcaef6b..9e78a8ca74024 100644 --- a/third_party/protobuf/python/google/protobuf/internal/json_format_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/json_format_test.py @@ -203,10 +203,10 @@ class JsonFormatTest(JsonFormatBase): message_dict = json_format.MessageToDict(message) golden_dict = { 'messageSet': { - '[protobuf_unittest.TestMessageSetExtension1.message_set_extension]': { + '[proto2_unittest.TestMessageSetExtension1.message_set_extension]': { 'i': 23, }, - '[protobuf_unittest.TestMessageSetExtension2.message_set_extension]': { + '[proto2_unittest.TestMessageSetExtension2.message_set_extension]': { 'str': 'foo', }, }, @@ -223,7 +223,7 @@ class JsonFormatTest(JsonFormatBase): message.Extensions[ext].value = 'stuff' message_dict = json_format.MessageToDict(message) expected_dict = { - '[protobuf_unittest.TestExtension.ext]': { + '[proto2_unittest.TestExtension.ext]': { 'value': 'stuff', }, } @@ -237,8 +237,8 @@ class JsonFormatTest(JsonFormatBase): message.message_set.Extensions[ext1].i = 23 message.message_set.Extensions[ext2].str = 'foo' message_text = json_format.MessageToJson(message) - ext1_text = 'protobuf_unittest.TestMessageSetExtension1.message_set_extension' - ext2_text = 'protobuf_unittest.TestMessageSetExtension2.message_set_extension' + ext1_text = 'proto2_unittest.TestMessageSetExtension1.message_set_extension' + ext2_text = 'proto2_unittest.TestMessageSetExtension2.message_set_extension' golden_text = ( '{"messageSet": {' ' "[%s]": {' @@ -321,6 +321,15 @@ class JsonFormatTest(JsonFormatBase): json_format.Parse('{"int32Value": 1.0}', message) self.assertEqual(message.int32_value, 1) + def testIntegersRepresentedAsFloatStrings(self): + message = json_format_proto3_pb2.TestMessage() + json_format.Parse('{"int32Value": "-2.147483648e9"}', message) + self.assertEqual(message.int32_value, -2147483648) + json_format.Parse('{"int32Value": "1e5"}', message) + self.assertEqual(message.int32_value, 100000) + json_format.Parse('{"int32Value": "1.0"}', message) + self.assertEqual(message.int32_value, 1) + def testMapFields(self): message = json_format_proto3_pb2.TestNestedMap() self.assertEqual( @@ -597,8 +606,8 @@ class JsonFormatTest(JsonFormatBase): parsed_message = json_format_proto3_pb2.TestStruct() self.CheckParseBack(message, parsed_message) # check for regression; this used to raise - parsed_message.value['empty_struct'] - parsed_message.value['empty_list'] + _ = parsed_message.value['empty_struct'] + _ = parsed_message.value['empty_list'] def testValueMessage(self): message = json_format_proto3_pb2.TestValue() @@ -761,7 +770,7 @@ class JsonFormatTest(JsonFormatBase): ) self.assertEqual( 'Can not find message descriptor by type_url:' - ' type.googleapis.com/protobuf_unittest.OneString', + ' type.googleapis.com/proto2_unittest.OneString', str(cm.exception), ) @@ -1013,7 +1022,7 @@ class JsonFormatTest(JsonFormatBase): self.assertRaisesRegex( json_format.ParseError, 'Failed to parse optionalNestedEnum field: Invalid enum value 12345 ' - 'for enum type protobuf_unittest.TestAllTypes.NestedEnum at ' + 'for enum type proto2_unittest.TestAllTypes.NestedEnum at ' 'TestAllTypes.optionalNestedEnum.', json_format.Parse, '{"optionalNestedEnum": 12345}', @@ -1053,7 +1062,7 @@ class JsonFormatTest(JsonFormatBase): def testParseUnknownEnumStringValue_ExtensionField_Proto2(self): message = json_format_pb2.TestMessageWithExtension() text = """ - {"[protobuf_unittest.TestExtension.enum_ext]": "UNKNOWN_STRING_VALUE"} + {"[proto2_unittest.TestExtension.enum_ext]": "UNKNOWN_STRING_VALUE"} """ json_format.Parse(text, message, ignore_unknown_fields=True) @@ -1063,7 +1072,7 @@ class JsonFormatTest(JsonFormatBase): def testParseUnknownEnumStringValue_ExtensionFieldWithoutIgnore_Proto2(self): message = json_format_pb2.TestMessageWithExtension() text = """ - {"[protobuf_unittest.TestExtension.enum_ext]": "UNKNOWN_STRING_VALUE"} + {"[proto2_unittest.TestExtension.enum_ext]": "UNKNOWN_STRING_VALUE"} """ self.assertRaisesRegex( json_format.ParseError, @@ -1167,6 +1176,16 @@ class JsonFormatTest(JsonFormatBase): 'Failed to parse int32Value field: ' "Couldn't parse integer: 1.5 at TestMessage.int32Value.", ) + self.CheckError( + '{"int32Value": "1.5"}', + 'Failed to parse int32Value field: ' + 'Couldn\'t parse non-integer string: "1.5" at TestMessage.int32Value.', + ) + self.CheckError( + '{"int32Value": "foo"}', + 'Failed to parse int32Value field: invalid literal for int\(\) with' + " base 10: 'foo'.", + ) self.CheckError( '{"int32Value": 012345}', (r'Failed to load JSON: Expecting \'?,\'? delimiter: ' r'line 1.'), @@ -1530,6 +1549,30 @@ class JsonFormatTest(JsonFormatBase): json_format.ParseDict(js_dict, message) self.assertEqual(expected, message.int32_value) + def testParseDictAcceptsPairValueTuples(self): + expected = [1, 2, 3] + js_dict = {'repeatedInt32Value': (1, 2, 3)} + message = json_format_proto3_pb2.TestMessage() + json_format.ParseDict(js_dict, message) + self.assertEqual(expected, message.repeated_int32_value) + + def testParseDictAcceptsRepeatedValueTuples(self): + expected = json_format_proto3_pb2.TestListValue( + repeated_value=[ + struct_pb2.ListValue( + values=[ + struct_pb2.Value(number_value=4), + struct_pb2.Value(number_value=5), + ] + ), + struct_pb2.ListValue(values=[struct_pb2.Value(number_value=6)]), + ] + ) + js_dict = {'repeated_value': ((4, 5), (6,))} + message = json_format_proto3_pb2.TestListValue() + json_format.ParseDict(js_dict, message) + self.assertEqual(expected, message) + def testParseDictAnyDescriptorPoolMissingType(self): # Confirm that ParseDict does not raise ParseError with default pool js_dict = { @@ -1558,6 +1601,28 @@ class JsonFormatTest(JsonFormatBase): 'TestAny.any_value.', ) + def testParseDictNestedAnyDescriptorPoolMissingType(self): + # Confirm that ParseDict nondestructive with empty pool + js_dict = { + '@type': 'type.googleapis.com/google.protobuf.Any', + 'value': { + '@type': 'type.googleapis.com/proto2_unittest.TestAny', + 'any_value': { + '@type': 'type.googleapis.com/UnknownMessageType', + }, + }, + } + js_dict_copy = json.loads(json.dumps(js_dict)) + with self.assertRaises(json_format.ParseError) as cm: + json_format.ParseDict(js_dict_copy, any_pb2.Any()) + self.assertEqual( + str(cm.exception), + 'Failed to parse any_value field: Can not find message descriptor by' + ' type_url: type.googleapis.com/UnknownMessageType at' + ' Any.value.any_value.', + ) + self.assertEqual(js_dict, js_dict_copy) + def testParseDictUnknownValueType(self): class UnknownClass(object): diff --git a/third_party/protobuf/python/google/protobuf/internal/message_factory_test.py b/third_party/protobuf/python/google/protobuf/internal/message_factory_test.py index 09467cf72df48..5c9e4bf8ea6b5 100644 --- a/third_party/protobuf/python/google/protobuf/internal/message_factory_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/message_factory_test.py @@ -179,19 +179,39 @@ class MessageFactoryTest(unittest.TestCase): type_name='Duplicate', extendee='Container', ) - pool.Add(f) - with self.assertRaises(Exception) as cm: - message_factory.GetMessageClassesForFiles([f.name], pool) + if api_implementation.Type() == 'upb': + with self.assertRaisesRegex( + TypeError, + "Couldn't build proto file into descriptor pool: " + 'duplicate extension entry', + ): + pool.Add(f) + else: + # TODO: b/381131694 - Ensure conformance between upb/c++/python. + # C++ and pure Python implementations should raise an error when adding a + # duplicate extension number. There doesn't seem to be a benefit to failing + # only when GetMessageClassesForFiles is called. + pool.Add(f) - self.assertIn(str(cm.exception), - ['Extensions ' - '"google.protobuf.python.internal.Duplicate.extension_field" and' - ' "google.protobuf.python.internal.Extension.extension_field"' - ' both try to extend message type' - ' "google.protobuf.python.internal.Container"' - ' with field number 2.', - 'Double registration of Extensions']) + with self.assertRaises(Exception) as cm: + message_factory.GetMessageClassesForFiles([f.name], pool) + + self.assertIn( + str(cm.exception), + [ + ( + 'Extensions' + ' "google.protobuf.python.internal.Duplicate.extension_field"' + ' and' + ' "google.protobuf.python.internal.Extension.extension_field"' + ' both try to extend message type' + ' "google.protobuf.python.internal.Container" with field' + ' number 2.' + ), + 'Double registration of Extensions', + ], + ) def testExtensionValueInDifferentFile(self): # Add Container message. diff --git a/third_party/protobuf/python/google/protobuf/internal/message_set_extensions.proto b/third_party/protobuf/python/google/protobuf/internal/message_set_extensions.proto index 17330522e9471..33db0585bdcf8 100644 --- a/third_party/protobuf/python/google/protobuf/internal/message_set_extensions.proto +++ b/third_party/protobuf/python/google/protobuf/internal/message_set_extensions.proto @@ -19,6 +19,9 @@ message TestMessageSet { } message TestMessageSetExtension1 { + extend TestMessageSet { + optional TestExtension first_extension = 2534113; + } extend TestMessageSet { optional TestMessageSetExtension1 message_set_extension = 98418603; } @@ -36,6 +39,10 @@ message TestMessageSetExtension3 { optional string text = 35; } +message TestExtension { + optional string str = 1; +} + extend TestMessageSet { optional TestMessageSetExtension3 message_set_extension3 = 98418655; } diff --git a/third_party/protobuf/python/google/protobuf/internal/message_test.py b/third_party/protobuf/python/google/protobuf/internal/message_test.py index 3a9852b57058e..f8382085b9a00 100755 --- a/third_party/protobuf/python/google/protobuf/internal/message_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/message_test.py @@ -40,7 +40,7 @@ from google.protobuf.internal import test_util from google.protobuf.internal import testing_refleaks from google.protobuf import descriptor from google.protobuf import message -from google.protobuf.internal import _parameterized +from absl.testing import parameterized from google.protobuf import map_proto2_unittest_pb2 from google.protobuf import map_unittest_pb2 from google.protobuf import unittest_pb2 @@ -50,7 +50,7 @@ UCS2_MAXUNICODE = 65535 warnings.simplefilter('error', DeprecationWarning) -@_parameterized.named_parameters(('_proto2', unittest_pb2), +@parameterized.named_parameters(('_proto2', unittest_pb2), ('_proto3', unittest_proto3_arena_pb2)) @testing_refleaks.TestCase class MessageTest(unittest.TestCase): @@ -69,16 +69,23 @@ class MessageTest(unittest.TestCase): msg = message_module.TestAllTypes() self.assertRaises(TypeError, msg.FromString, 0) self.assertRaises(Exception, msg.FromString, '0') - # TODO: Fix cpp extension to raise error instead of warning. - # b/27494216 + + # Unexpected end group tag. end_tag = encoder.TagBytes(1, 4) - if (api_implementation.Type() == 'python' or - api_implementation.Type() == 'upb'): - with self.assertRaises(message.DecodeError) as context: - msg.FromString(end_tag) - if api_implementation.Type() == 'python': - # Only pure-Python has an error message this specific. - self.assertEqual('Unexpected end-group tag.', str(context.exception)) + with self.assertRaises(message.DecodeError) as context: + msg.FromString(end_tag) + if api_implementation.Type() != 'upb': + # upb raises a less specific exception. + self.assertRegex(str(context.exception), 'Unexpected end-group tag.*') + + # Unmatched start group tag. + start_tag = encoder.TagBytes(2, 3) + with self.assertRaises(message.DecodeError): + msg.FromString(start_tag) + + # Mismatched end group tag. + with self.assertRaises(message.DecodeError): + msg.FromString(start_tag + end_tag) # Field number 0 is illegal. self.assertRaises(message.DecodeError, msg.FromString, b'\3\4') @@ -353,7 +360,12 @@ class MessageTest(unittest.TestCase): def testFloatPrinting(self, message_module): message = message_module.TestAllTypes() message.optional_float = 2.0 - self.assertEqual(str(message), 'optional_float: 2.0\n') + # Python/C++ customizes the C++ TextFormat to always print trailing ".0" for + # floats. upb doesn't do this, it matches C++ TextFormat. + if api_implementation.Type() == 'upb': + self.assertEqual(str(message), 'optional_float: 2\n') + else: + self.assertEqual(str(message), 'optional_float: 2.0\n') def testFloatNanPrinting(self, message_module): message = message_module.TestAllTypes() @@ -1046,6 +1058,13 @@ class MessageTest(unittest.TestCase): m.repeated_string.extend(empty_value) self.assertSequenceEqual([], m.repeated_string) + def testExtendWithNoLen(self, message_module): + """ Test extending repeated fields with iterables but no len""" + m = message_module.TestAllTypes() + self.assertSequenceEqual([], m.repeated_int32) + m.repeated_int32.extend(i for i in range(2)) + self.assertSequenceEqual([0, 1], m.repeated_int32) + def testExtendInt32WithPythonList(self, message_module): """Test extending repeated int32 fields with python lists.""" m = message_module.TestAllTypes() @@ -1056,6 +1075,8 @@ class MessageTest(unittest.TestCase): self.assertSequenceEqual([0, 1, 2], m.repeated_int32) m.repeated_int32.extend([3, 4]) self.assertSequenceEqual([0, 1, 2, 3, 4], m.repeated_int32) + with self.assertRaises(TypeError): + m.repeated_int32.extend([5, 6, 'hi', 7]) def testExtendFloatWithPythonList(self, message_module): """Test extending repeated float fields with python lists.""" @@ -1263,6 +1284,31 @@ class MessageTest(unittest.TestCase): self.assertEqual(bool, type(m.repeated_bool[0])) self.assertEqual(True, m.repeated_bool[0]) + def testDir(self, message_module): + m = message_module.TestAllTypes() + attributes = dir(m) + self.assertGreaterEqual(len(attributes), 124) + + attribute_set = set(attributes) + self.assertIn('DESCRIPTOR', attributes) + self.assertIn('oneof_string', attribute_set) + self.assertIn('optional_double', attribute_set) + self.assertIn('repeated_float', attribute_set) + + class_attributes = dir(type(m)) + for attr in class_attributes: + if attr != 'Extensions': + self.assertIn(attr, attribute_set) + + def testAllAttributeFromDirAccessible(self, message_module): + m = message_module.TestAllTypes() + attributes = dir(m) + for attribute in attributes: + try: + getattr(m, attribute) + except AttributeError: + self.fail(f'Attribute {attribute} is not accessible.') + def testEquality(self, message_module): m = message_module.TestAllTypes() m2 = message_module.TestAllTypes() @@ -1337,6 +1383,18 @@ class MessageTest(unittest.TestCase): self.assertIn('oneof_bytes', m) self.assertNotIn('oneof_string', m) + def testMessageClassName(self, message_module): + m = message_module.TestAllTypes() + self.assertEqual('TestAllTypes', type(m).__name__) + self.assertEqual('TestAllTypes', m.__class__.__qualname__) + + nested = message_module.TestAllTypes.NestedMessage() + self.assertEqual('NestedMessage', type(nested).__name__) + self.assertEqual('NestedMessage', nested.__class__.__name__) + self.assertEqual( + 'TestAllTypes.NestedMessage', nested.__class__.__qualname__ + ) + # Class to test proto2-only features (required, extensions, etc.) @testing_refleaks.TestCase @@ -1411,22 +1469,14 @@ class Proto2Test(unittest.TestCase): """Assigning an invalid enum number is not allowed for closed enums.""" m = unittest_pb2.TestAllTypes() - # TODO Enable these once upb's behavior is made conformant. - if api_implementation.Type() != 'upb': - # Can not assign unknown enum to closed enums. - with self.assertRaises(ValueError) as _: - m.optional_nested_enum = 1234567 - self.assertRaises(ValueError, m.repeated_nested_enum.append, 1234567) - # Assignment is a different code path than append for the C++ impl. - m.repeated_nested_enum.append(2) - m.repeated_nested_enum[0] = 2 - with self.assertRaises(ValueError): - m.repeated_nested_enum[0] = 123456 - else: + # Can not assign unknown enum to closed enums. + with self.assertRaises(ValueError) as _: m.optional_nested_enum = 1234567 - m.repeated_nested_enum.append(1234567) - m.repeated_nested_enum.append(2) - m.repeated_nested_enum[0] = 2 + self.assertRaises(ValueError, m.repeated_nested_enum.append, 1234567) + # Assignment is a different code path than append for the C++ impl. + m.repeated_nested_enum.append(2) + m.repeated_nested_enum[0] = 2 + with self.assertRaises(ValueError): m.repeated_nested_enum[0] = 123456 # Unknown enum value can be parsed but is ignored. @@ -1650,7 +1700,8 @@ class Proto2Test(unittest.TestCase): doc = pydoc.html.document(unittest_pb2.TestAllTypes, 'message') self.assertIn('class TestAllTypes', doc) self.assertIn('SerializePartialToString', doc) - self.assertIn('repeated_float', doc) + if api_implementation.Type() != 'upb': + self.assertIn('repeated_float', doc) base = unittest_pb2.TestAllTypes.__bases__[0] self.assertRaises(AttributeError, getattr, base, '_extensions_by_name') @@ -1738,13 +1789,29 @@ class Proto3Test(unittest.TestCase): message_proto2 = unittest_pb2.TestAllTypes() message_proto2.optional_int32 = 0 message_proto2.optional_string = '' + message_proto2.optional_float = 0.0 message_proto2.optional_bytes = b'' - self.assertEqual(len(message_proto2.ListFields()), 3) + self.assertEqual(len(message_proto2.ListFields()), 4) message_proto3 = unittest_proto3_arena_pb2.TestAllTypes() message_proto3.ParseFromString(message_proto2.SerializeToString()) self.assertEqual(len(message_proto3.ListFields()), 0) + def testProto3ParserKeepsNonDefaultScalar(self): + message_proto2 = unittest_pb2.TestAllTypes() + message_proto2.optional_int32 = 1 + message_proto2.optional_string = '\0' + message_proto2.optional_float = -0.0 + message_proto2.optional_double = -0.0 + message_proto2.optional_bytes = b'\0' + self.assertEqual(len(message_proto2.ListFields()), 5) + serialized = message_proto2.SerializeToString() + + message_proto3 = unittest_proto3_arena_pb2.TestAllTypes() + message_proto3.ParseFromString(serialized) + self.assertEqual(len(message_proto3.ListFields()), 5) + self.assertEqual(message_proto3.SerializeToString(), serialized) + def testProto3Optional(self): msg = test_proto3_optional_pb2.TestProto3Optional() self.assertFalse(msg.HasField('optional_int32')) @@ -1900,6 +1967,26 @@ class Proto3Test(unittest.TestCase): self.assertEqual(msg1.map_int32_int32, msg2.map_int32_int32) + def testScalarMapSetdefault(self): + msg = map_unittest_pb2.TestMap() + value = msg.map_int32_int32.setdefault(123, 888) + self.assertEqual(value, 888) + self.assertEqual(msg.map_int32_int32[123], 888) + value = msg.map_int32_int32.setdefault(123, 777) + self.assertEqual(value, 888) + + with self.assertRaises(ValueError): + value = msg.map_int32_int32.setdefault(1001) + self.assertNotIn(1001, msg.map_int32_int32) + with self.assertRaises(TypeError): + value = msg.map_int32_int32.setdefault() + with self.assertRaises(TypeError): + value = msg.map_int32_int32.setdefault(1, 2, 3) + with self.assertRaises(TypeError): + value = msg.map_int32_int32.setdefault("1", 2) + with self.assertRaises(TypeError): + value = msg.map_int32_int32.setdefault(1, "2") + def testMessageMapComparison(self): msg1 = map_unittest_pb2.TestMap() msg2 = map_unittest_pb2.TestMap() @@ -1907,6 +1994,14 @@ class Proto3Test(unittest.TestCase): self.assertEqual(msg1.map_int32_foreign_message, msg2.map_int32_foreign_message) + def testMessageMapSetdefault(self): + msg = map_unittest_pb2.TestMap() + msg.map_int32_foreign_message[123].c = 888 + with self.assertRaises(NotImplementedError): + msg.map_int32_foreign_message.setdefault( + 1, msg.map_int32_foreign_message[123] + ) + def testMapGet(self): # Need to test that get() properly returns the default, even though the dict # has defaultdict-like semantics. @@ -2218,15 +2313,17 @@ class Proto3Test(unittest.TestCase): with self.assertRaisesRegex( TypeError, r'Parameter to MergeFrom\(\) must be instance of same class: expected ' - r'.+TestMap got int\.'): + r'.+TestMap.+got.+int.+', + ): msg.MergeFrom(1) def testCopyFromBadType(self): msg = map_unittest_pb2.TestMap() with self.assertRaisesRegex( TypeError, - r'Parameter to [A-Za-z]*From\(\) must be instance of same class: ' - r'expected .+TestMap got int\.'): + r'Parameter to (Copy|Merge)From\(\) must be instance of same class: ' + r'expected .+TestMap.+got.+int.+', + ): msg.CopyFrom(1) def testIntegerMapWithLongs(self): @@ -2327,11 +2424,11 @@ class Proto3Test(unittest.TestCase): int32_foreign_keys = list(msg.map_int32_foreign_message.keys()) keys = [] - for key in msg.map_string_string: + for key in list(msg.map_string_string.keys()): keys.append(key) msg.map_string_string[key] = '000' - self.assertEqual(keys, string_string_keys) - self.assertEqual(keys, list(msg.map_string_string.keys())) + self.assertCountEqual(keys, string_string_keys) + self.assertCountEqual(keys, list(msg.map_string_string.keys())) keys = [] for key in msg.map_int32_foreign_message: @@ -2453,6 +2550,10 @@ class Proto3Test(unittest.TestCase): msg2 = map_unittest_pb2.TestMap( map_string_foreign_message=msg1.map_string_foreign_message) self.assertEqual(42, msg2.map_string_foreign_message['test'].c) + msg3 = map_unittest_pb2.TestMap( + map_string_foreign_message={'test': dict(c=42)} + ) + self.assertEqual(42, msg3.map_string_foreign_message['test'].c) def testMapFieldRaisesCorrectError(self): # Should raise a TypeError when given a non-iterable. @@ -2495,10 +2596,6 @@ class Proto3Test(unittest.TestCase): msg = map_unittest_pb2.TestMap() msg.map_int32_all_types[2].optional_string = 'bar' - if api_implementation.Type() == 'cpp': - # Need to keep the map reference because of b/27942626. - # TODO: Remove it. - unused_map = msg.map_int32_all_types # pylint: disable=unused-variable msg_value = msg.map_int32_all_types[2] msg.Clear() diff --git a/third_party/protobuf/python/google/protobuf/internal/more_messages.proto b/third_party/protobuf/python/google/protobuf/internal/more_messages.proto index 6ce788c927e01..0c0505f620153 100644 --- a/third_party/protobuf/python/google/protobuf/internal/more_messages.proto +++ b/third_party/protobuf/python/google/protobuf/internal/more_messages.proto @@ -13,10 +13,6 @@ syntax = "proto2"; package google.protobuf.internal; -import "google/protobuf/duration.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - // A message where tag numbers are listed out of order, to allow us to test our // canonicalization of serialized output, which should always be in tag order. // We also mix in some extensions for extra fun. diff --git a/third_party/protobuf/python/google/protobuf/internal/numpy/BUILD.bazel b/third_party/protobuf/python/google/protobuf/internal/numpy/BUILD.bazel index ffdc4e565cdb9..6799b799e9529 100644 --- a/third_party/protobuf/python/google/protobuf/internal/numpy/BUILD.bazel +++ b/third_party/protobuf/python/google/protobuf/internal/numpy/BUILD.bazel @@ -1,7 +1,7 @@ # Protobuf python numpy Tests -# This is removed from other tests to keep numpy (and @pip_deps) as a test-only dependency +# This is removed from other tests to keep numpy (and @protobuf_pip_deps) as a test-only dependency -load("@pip_deps//:requirements.bzl", "requirement") +load("@protobuf_pip_deps//:requirements.bzl", "requirement") load("//python:internal.bzl", "internal_py_test") # TODO: b/278896688 - Remove this target and replace with py_library @@ -15,7 +15,6 @@ internal_py_test( srcs = ["numpy_test.py"], visibility = [ "//python:__pkg__", - "//python/pb_unit_tests:__pkg__", ], deps = [ requirement("numpy"), diff --git a/third_party/protobuf/python/google/protobuf/internal/proto_builder_test.py b/third_party/protobuf/python/google/protobuf/internal/proto_builder_test.py index fcb4a027269ef..a594eec8a0600 100644 --- a/third_party/protobuf/python/google/protobuf/internal/proto_builder_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/proto_builder_test.py @@ -15,6 +15,7 @@ from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pool from google.protobuf import proto_builder from google.protobuf import text_format +from google.protobuf.internal import api_implementation class ProtoBuilderTest(unittest.TestCase): @@ -70,13 +71,29 @@ class ProtoBuilderTest(unittest.TestCase): 'foo%d' % i: descriptor_pb2.FieldDescriptorProto.TYPE_INT64 for i in range(num_fields) } + if api_implementation.Type() == 'upb': + with self.assertRaisesRegex( + TypeError, "Couldn't build proto file into descriptor pool" + ): + proto_cls = proto_builder.MakeSimpleProtoClass( + fields, + full_name=( + 'net.proto2.python.public.proto_builder_test.LargeProtoTest' + ), + ) + return + proto_cls = proto_builder.MakeSimpleProtoClass( fields, - full_name='net.proto2.python.public.proto_builder_test.LargeProtoTest') + full_name='net.proto2.python.public.proto_builder_test.LargeProtoTest', + ) reserved_field_numbers = set( - range(descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER, - descriptor.FieldDescriptor.LAST_RESERVED_FIELD_NUMBER + 1)) + range( + descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER, + descriptor.FieldDescriptor.LAST_RESERVED_FIELD_NUMBER + 1, + ) + ) proto_field_numbers = set(proto_cls.DESCRIPTOR.fields_by_number) self.assertFalse(reserved_field_numbers.intersection(proto_field_numbers)) diff --git a/third_party/protobuf/python/google/protobuf/internal/proto_test.py b/third_party/protobuf/python/google/protobuf/internal/proto_test.py index b3351a498fa42..15727d94116f2 100644 --- a/third_party/protobuf/python/google/protobuf/internal/proto_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/proto_test.py @@ -13,16 +13,19 @@ import unittest from google.protobuf import proto from google.protobuf.internal import encoder +from google.protobuf.internal import test_proto2_pb2 from google.protobuf.internal import test_util from google.protobuf.internal import testing_refleaks -from google.protobuf.internal import _parameterized +from absl.testing import parameterized from google.protobuf import unittest_pb2 from google.protobuf import unittest_proto3_arena_pb2 -@_parameterized.named_parameters(('_proto2', unittest_pb2), - ('_proto3', unittest_proto3_arena_pb2)) +@parameterized.named_parameters( + ('_proto2', unittest_pb2), + ('_proto3', unittest_proto3_arena_pb2), +) @testing_refleaks.TestCase class ProtoTest(unittest.TestCase): @@ -74,12 +77,49 @@ class ProtoTest(unittest.TestCase): str(context.exception), ) + def test_byte_size(self, message_module): + msg = message_module.TestAllTypes() + self.assertEqual(0, proto.byte_size(msg)) + msg.optional_int32 = 123 + self.assertEqual(2, proto.byte_size(msg)) + + def test_clear_message(self, message_module): + msg = message_module.TestAllTypes() + msg.oneof_uint32 = 11 + msg.repeated_nested_message.add(bb=1) + proto.clear_message(msg) + self.assertIsNone(msg.WhichOneof('oneof_field')) + self.assertEqual(0, len(msg.repeated_nested_message)) + + def test_clear_field(self, message_module): + msg = message_module.TestAllTypes() + msg.optional_int32 = 123 + self.assertEqual(123, msg.optional_int32) + proto.clear_field(msg, 'optional_int32') + self.assertEqual(0, msg.optional_int32) + + +class SelfFieldTest(unittest.TestCase): + + def test_pytype_allows_unset_self_field(self): + self.assertEqual( + test_proto2_pb2.MessageWithSelfField(something=123).something, 123 + ) + + def test_pytype_allows_unset_self_and_self_underscore_field(self): + self.assertEqual( + test_proto2_pb2.MessageWithSelfAndSelfUnderscoreField( + something=123 + ).something, + 123, + ) + _EXPECTED_PROTO3 = b'\x04r\x02hi\x06\x08\x01r\x02hi\x06\x08\x02r\x02hi' _EXPECTED_PROTO2 = b'\x06\x08\x00r\x02hi\x06\x08\x01r\x02hi\x06\x08\x02r\x02hi' -@_parameterized.named_parameters( +@parameterized.named_parameters( ('_proto2', unittest_pb2, _EXPECTED_PROTO2), ('_proto3', unittest_proto3_arena_pb2, _EXPECTED_PROTO3), ) diff --git a/third_party/protobuf/python/google/protobuf/internal/proto_text_test.py b/third_party/protobuf/python/google/protobuf/internal/proto_text_test.py new file mode 100644 index 0000000000000..e862d1c928466 --- /dev/null +++ b/third_party/protobuf/python/google/protobuf/internal/proto_text_test.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Protocol Buffers - Google's data interchange format +# Copyright 2008 Google Inc. All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd + +"""Tests Pythonic protobuf APIs for text format""" + +import unittest + +from google.protobuf import proto_text + +from absl.testing import parameterized +from google.protobuf import unittest_pb2 +from google.protobuf import unittest_proto3_arena_pb2 + + +@parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) +class ProtoTextTest(unittest.TestCase): + + def test_simple_serialize(self, message_module): + msg = message_module.TestAllTypes() + msg.optional_int32 = 101 + expected = 'optional_int32: 101\n' + self.assertEqual(expected, proto_text.serialize(msg)) + + def test_simpor_parse(self, message_module): + text = 'optional_int32: 123' + msg = proto_text.parse(message_module.TestAllTypes, text) + self.assertEqual(123, msg.optional_int32) # pytype: disable=attribute-error + + +if __name__ == '__main__': + unittest.main() diff --git a/third_party/protobuf/python/google/protobuf/internal/python_edition_defaults.py b/third_party/protobuf/python/google/protobuf/internal/python_edition_defaults.py index cf1feb4ab1fbe..30a250d28fc7b 100755 --- a/third_party/protobuf/python/google/protobuf/internal/python_edition_defaults.py +++ b/third_party/protobuf/python/google/protobuf/internal/python_edition_defaults.py @@ -2,4 +2,4 @@ This file contains the serialized FeatureSetDefaults object corresponding to the Pure Python runtime. This is used for feature resolution under Editions. """ -_PROTOBUF_INTERNAL_PYTHON_EDITION_DEFAULTS = b"\n\023\030\204\007\"\000*\014\010\001\020\002\030\002 \003(\0010\002\n\023\030\347\007\"\000*\014\010\002\020\001\030\001 \002(\0010\001\n\023\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\000 \346\007(\350\007" +_PROTOBUF_INTERNAL_PYTHON_EDITION_DEFAULTS = b"\n\025\030\204\007\"\000*\016\010\001\020\002\030\002 \003(\0010\0028\002\n\025\030\347\007\"\000*\016\010\002\020\001\030\001 \002(\0010\0018\002\n\025\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\0028\002 \346\007(\350\007" diff --git a/third_party/protobuf/python/google/protobuf/internal/python_message.py b/third_party/protobuf/python/google/protobuf/internal/python_message.py index 1f90168809445..23ac28e36d2e0 100755 --- a/third_party/protobuf/python/google/protobuf/internal/python_message.py +++ b/third_party/protobuf/python/google/protobuf/internal/python_message.py @@ -29,6 +29,7 @@ __author__ = 'robinson@google.com (Will Robinson)' import datetime from io import BytesIO +import math import struct import sys import warnings @@ -522,7 +523,11 @@ def _AddInitMethod(message_descriptor, cls): if _IsMapField(field): if _IsMessageMapField(field): for key in field_value: - field_copy[key].MergeFrom(field_value[key]) + item_value = field_value[key] + if isinstance(item_value, dict): + field_copy[key].__init__(**item_value) + else: + field_copy[key].MergeFrom(item_value) else: field_copy.update(field_value) else: @@ -716,14 +721,14 @@ def _AddPropertiesForNonRepeatedScalarField(field, cls): def field_setter(self, new_value): # pylint: disable=protected-access - # Testing the value for truthiness captures all of the proto3 defaults - # (0, 0.0, enum 0, and False). + # Testing the value for truthiness captures all of the implicit presence + # defaults (0, 0.0, enum 0, and False), except for -0.0. try: new_value = type_checker.CheckValue(new_value) except TypeError as e: raise TypeError( 'Cannot set %s to %.1024r: %s' % (field.full_name, new_value, e)) - if not field.has_presence and not new_value: + if not field.has_presence and decoder.IsDefaultScalarValue(new_value): self._fields.pop(field, None) else: self._fields[field] = new_value @@ -1192,8 +1197,6 @@ def _AddMergeFromStringMethod(message_descriptor, cls): return length # Return this for legacy reasons. cls.MergeFromString = MergeFromString - local_ReadTag = decoder.ReadTag - local_SkipField = decoder.SkipField fields_by_tag = cls._fields_by_tag message_set_decoders_by_tag = cls._message_set_decoders_by_tag @@ -1215,7 +1218,7 @@ def _AddMergeFromStringMethod(message_descriptor, cls): self._Modified() field_dict = self._fields while pos != end: - (tag_bytes, new_pos) = local_ReadTag(buffer, pos) + (tag_bytes, new_pos) = decoder.ReadTag(buffer, pos) field_decoder, field_des = message_set_decoders_by_tag.get( tag_bytes, (None, None) ) @@ -1226,23 +1229,17 @@ def _AddMergeFromStringMethod(message_descriptor, cls): if field_des is None: if not self._unknown_fields: # pylint: disable=protected-access self._unknown_fields = [] # pylint: disable=protected-access - # pylint: disable=protected-access - (tag, _) = decoder._DecodeVarint(tag_bytes, 0) - field_number, wire_type = wire_format.UnpackTag(tag) + field_number, wire_type = decoder.DecodeTag(tag_bytes) if field_number == 0: raise message_mod.DecodeError('Field number 0 is illegal.') - # TODO: remove old_pos. - old_pos = new_pos (data, new_pos) = decoder._DecodeUnknownField( - buffer, new_pos, wire_type) # pylint: disable=protected-access - if new_pos == -1: - return pos - # TODO: remove _unknown_fields. - new_pos = local_SkipField(buffer, old_pos, end, tag_bytes) + buffer, new_pos, end, field_number, wire_type + ) # pylint: disable=protected-access if new_pos == -1: return pos self._unknown_fields.append( - (tag_bytes, buffer[old_pos:new_pos].tobytes())) + (tag_bytes, buffer[pos + len(tag_bytes) : new_pos].tobytes()) + ) pos = new_pos else: _MaybeAddDecoder(cls, field_des) diff --git a/third_party/protobuf/python/google/protobuf/internal/reflection_cpp_test.py b/third_party/protobuf/python/google/protobuf/internal/reflection_cpp_test.py index 71e7b18cdd9ee..bb053f781e7b0 100644 --- a/third_party/protobuf/python/google/protobuf/internal/reflection_cpp_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/reflection_cpp_test.py @@ -12,12 +12,12 @@ import copy import unittest from google.protobuf.internal import testing_refleaks -from google.protobuf.internal import _parameterized +from absl.testing import parameterized from google.protobuf import unittest_pb2 from google.protobuf import unittest_proto3_arena_pb2 -@_parameterized.named_parameters( +@parameterized.named_parameters( ('_proto2', unittest_pb2), ('_proto3', unittest_proto3_arena_pb2) ) @testing_refleaks.TestCase diff --git a/third_party/protobuf/python/google/protobuf/internal/reflection_test.py b/third_party/protobuf/python/google/protobuf/internal/reflection_test.py index 9640c0b3330f2..d70bf7e8b21bb 100755 --- a/third_party/protobuf/python/google/protobuf/internal/reflection_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/reflection_test.py @@ -32,7 +32,7 @@ from google.protobuf.internal import more_messages_pb2 from google.protobuf.internal import test_util from google.protobuf.internal import testing_refleaks from google.protobuf.internal import wire_format -from google.protobuf.internal import _parameterized +from absl.testing import parameterized from google.protobuf import unittest_import_pb2 from google.protobuf import unittest_mset_pb2 from google.protobuf import unittest_pb2 @@ -87,7 +87,7 @@ class _MiniDecoder(object): return self._pos == len(self._bytes) -@_parameterized.named_parameters( +@parameterized.named_parameters( ('_proto2', unittest_pb2), ('_proto3', unittest_proto3_arena_pb2)) @testing_refleaks.TestCase @@ -266,12 +266,6 @@ class ReflectionTest(unittest.TestCase): self.assertFalse(proto1.HasField('optional_nested_message')) def testDisconnectingLazyNestedMessage(self, message_module): - # This test exercises releasing a nested message that is lazy. This test - # only exercises real code in the C++ implementation as Python does not - # support lazy parsing, but the current C++ implementation results in - # memory corruption and a crash. - if api_implementation.Type() != 'python': - return proto = message_module.TestAllTypes() proto.optional_lazy_message.bb = 5 proto.ClearField('optional_lazy_message') @@ -1519,11 +1513,6 @@ class Proto2ReflectionTest(unittest.TestCase): @testing_refleaks.SkipReferenceLeakChecker('MakeDescriptor is not repeatable') def testDescriptorProtoSupport(self): - # Hand written descriptors/reflection are only supported by the pure-Python - # implementation of the API. - if api_implementation.Type() != 'python': - return - def AddDescriptorField(proto, field_name, field_type): AddDescriptorField.field_index += 1 new_field = proto.field.add() @@ -1607,6 +1596,11 @@ class Proto2ReflectionTest(unittest.TestCase): del extendee_proto.Extensions[extension_int32] self.assertEqual(len(extendee_proto.Extensions), 0) + @unittest.skipIf( + api_implementation.Type() == 'upb', + 'This test relies on a specific iteration order for extensions, ' + 'which is not reasonable to guarantee.', + ) def testExtensionIter(self): extendee_proto = more_extensions_pb2.ExtendedMessage() @@ -1750,7 +1744,7 @@ class Proto2ReflectionTest(unittest.TestCase): unittest_pb2.TestAllExtensions.DESCRIPTOR, 1)) self.assertIs( pool.FindExtensionByName( - 'protobuf_unittest.optional_int32_extension').containing_type, + 'proto2_unittest.optional_int32_extension').containing_type, unittest_pb2.TestAllExtensions.DESCRIPTOR) # Make sure extensions haven't been registered into types that shouldn't # have any. @@ -1909,22 +1903,13 @@ class Proto2ReflectionTest(unittest.TestCase): self.assertEqual(333, ext2[2].bb) def testCopyFromBadType(self): - # The python implementation doesn't raise an exception in this - # case. In theory it should. - if api_implementation.Type() == 'python': - return proto1 = unittest_pb2.TestAllTypes() proto2 = unittest_pb2.TestAllExtensions() self.assertRaises(TypeError, proto1.CopyFrom, proto2) def testClear(self): proto = unittest_pb2.TestAllTypes() - # C++ implementation does not support lazy fields right now so leave it - # out for now. - if api_implementation.Type() == 'python': - test_util.SetAllFields(proto) - else: - test_util.SetAllNonLazyFields(proto) + test_util.SetAllFields(proto) # Clear the message. proto.Clear() self.assertEqual(proto.ByteSize(), 0) @@ -2488,13 +2473,9 @@ class ByteSizeTest(unittest.TestCase): self.assertEqual(2, len(repeated_nested_message)) del repeated_nested_message[0:1] - # TODO: Fix cpp extension bug when delete repeated message. - if api_implementation.Type() == 'python': - self.assertEqual(1, len(repeated_nested_message)) + self.assertEqual(1, len(repeated_nested_message)) del repeated_nested_message[-1] - # TODO: Fix cpp extension bug when delete repeated message. - if api_implementation.Type() == 'python': - self.assertEqual(0, len(repeated_nested_message)) + self.assertEqual(0, len(repeated_nested_message)) def testRepeatedGroups(self): # 2-byte START_GROUP plus 2-byte END_GROUP. @@ -2569,12 +2550,11 @@ class ByteSizeTest(unittest.TestCase): self.proto.ClearField('optional_foreign_message') self.assertEqual(0, self.proto.ByteSize()) - if api_implementation.Type() == 'python': - # This is only possible in pure-Python implementation of the API. - child = self.proto.optional_foreign_message - self.proto.ClearField('optional_foreign_message') - child.c = 128 - self.assertEqual(0, self.proto.ByteSize()) + # This is only possible in pure-Python implementation of the API. + child = self.proto.optional_foreign_message + self.proto.ClearField('optional_foreign_message') + child.c = 128 + self.assertEqual(0, self.proto.ByteSize()) # Test within extension. extension = more_extensions_pb2.optional_message_extension @@ -2740,6 +2720,11 @@ class SerializationTest(unittest.TestCase): self.assertRaises(message.DecodeError, unknown_fields._InternalParse, serialized, 0, truncation_point) + @unittest.skipIf( + api_implementation.Type() == 'upb', + 'This test relies on a specific iteration order for extensions, ' + 'which is not reasonable to guarantee.', + ) def testCanonicalSerializationOrder(self): proto = more_messages_pb2.OutOfOrderFields() # These are also their tag numbers. Even though we're setting these in @@ -2765,6 +2750,11 @@ class SerializationTest(unittest.TestCase): self.assertEqual((5, wire_format.WIRETYPE_VARINT), ReadTag()) self.assertEqual(5, d.ReadSInt32()) + @unittest.skipIf( + api_implementation.Type() == 'upb', + 'This test relies on a specific iteration order for extensions, ' + 'which is not reasonable to guarantee.', + ) def testCanonicalSerializationOrderSameAsCpp(self): # Copy of the same test we use for C++. proto = unittest_pb2.TestFieldOrderings() @@ -2933,7 +2923,7 @@ class SerializationTest(unittest.TestCase): self._CheckRaises( message.EncodeError, proto.SerializeToString, - 'Message protobuf_unittest.TestRequired is missing required fields: ' + 'Message proto2_unittest.TestRequired is missing required fields: ' 'a,b,c') # Shouldn't raise exceptions. partial = proto.SerializePartialToString() @@ -2948,7 +2938,7 @@ class SerializationTest(unittest.TestCase): self._CheckRaises( message.EncodeError, proto.SerializeToString, - 'Message protobuf_unittest.TestRequired is missing required fields: b,c') + 'Message proto2_unittest.TestRequired is missing required fields: b,c') # Shouldn't raise exceptions. partial = proto.SerializePartialToString() @@ -2956,7 +2946,7 @@ class SerializationTest(unittest.TestCase): self._CheckRaises( message.EncodeError, proto.SerializeToString, - 'Message protobuf_unittest.TestRequired is missing required fields: c') + 'Message proto2_unittest.TestRequired is missing required fields: c') # Shouldn't raise exceptions. partial = proto.SerializePartialToString() @@ -2989,7 +2979,7 @@ class SerializationTest(unittest.TestCase): self._CheckRaises( message.EncodeError, proto.SerializeToString, - 'Message protobuf_unittest.TestRequiredForeign ' + 'Message proto2_unittest.TestRequiredForeign ' 'is missing required fields: ' 'optional_message.b,optional_message.c') @@ -3002,7 +2992,7 @@ class SerializationTest(unittest.TestCase): self._CheckRaises( message.EncodeError, proto.SerializeToString, - 'Message protobuf_unittest.TestRequiredForeign is missing required fields: ' + 'Message proto2_unittest.TestRequiredForeign is missing required fields: ' 'repeated_message[0].b,repeated_message[0].c,' 'repeated_message[1].a,repeated_message[1].c') @@ -3141,19 +3131,40 @@ class SerializationTest(unittest.TestCase): def testFieldProperties(self): cls = unittest_pb2.TestAllTypes - self.assertIs(cls.optional_int32.DESCRIPTOR, - cls.DESCRIPTOR.fields_by_name['optional_int32']) - self.assertEqual(cls.OPTIONAL_INT32_FIELD_NUMBER, - cls.optional_int32.DESCRIPTOR.number) - self.assertIs(cls.optional_nested_message.DESCRIPTOR, - cls.DESCRIPTOR.fields_by_name['optional_nested_message']) - self.assertEqual(cls.OPTIONAL_NESTED_MESSAGE_FIELD_NUMBER, - cls.optional_nested_message.DESCRIPTOR.number) - self.assertIs(cls.repeated_int32.DESCRIPTOR, - cls.DESCRIPTOR.fields_by_name['repeated_int32']) - self.assertEqual(cls.REPEATED_INT32_FIELD_NUMBER, - cls.repeated_int32.DESCRIPTOR.number) + if api_implementation.Type() == 'upb': + # Class accessors are not implemented in upb. + with self.assertRaises(AttributeError) as e: + # Try to access the descriptor of the field 'optional_int32' + cls.optional_int32.DESCRIPTOR + self.assertEquals('optional_int32', str(e.exception)) + else: + self.assertIs( + cls.optional_int32.DESCRIPTOR, + cls.DESCRIPTOR.fields_by_name['optional_int32'], + ) + self.assertEqual( + cls.OPTIONAL_INT32_FIELD_NUMBER, cls.optional_int32.DESCRIPTOR.number + ) + self.assertIs( + cls.optional_nested_message.DESCRIPTOR, + cls.DESCRIPTOR.fields_by_name['optional_nested_message'], + ) + self.assertEqual( + cls.OPTIONAL_NESTED_MESSAGE_FIELD_NUMBER, + cls.optional_nested_message.DESCRIPTOR.number, + ) + self.assertIs( + cls.repeated_int32.DESCRIPTOR, + cls.DESCRIPTOR.fields_by_name['repeated_int32'], + ) + self.assertEqual( + cls.REPEATED_INT32_FIELD_NUMBER, cls.repeated_int32.DESCRIPTOR.number + ) + @unittest.skipIf( + api_implementation.Type() == 'upb', + 'Class accessors are not implemented in upb: see testFieldProperties.', + ) def testFieldDataDescriptor(self): msg = unittest_pb2.TestAllTypes() msg.optional_int32 = 42 @@ -3277,7 +3288,8 @@ class ClassAPITest(unittest.TestCase): @unittest.skipIf( api_implementation.Type() != 'python', - 'C++ implementation requires a call to MakeDescriptor()') + 'C++ and upb implementations require a call to MakeDescriptor()', + ) @testing_refleaks.SkipReferenceLeakChecker('MakeClass is not repeatable') def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor( @@ -3371,13 +3383,6 @@ class ClassAPITest(unittest.TestCase): # conflicting message descriptors. def testParsingFlatClassWithExplicitClassDeclaration(self): """Test that the generated class can parse a flat message.""" - # TODO: This test fails with cpp implementation in the call - # of six.with_metaclass(). The other two callsites of with_metaclass - # in this file are both excluded from cpp test, so it might be expected - # to fail. Need someone more familiar with the python code to take a - # look at this. - if api_implementation.Type() != 'python': - return file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('A')) msg_descriptor = descriptor.MakeDescriptor( diff --git a/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py b/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py index 1a809d5e39688..ca9e70a3807ad 100644 --- a/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py @@ -13,21 +13,21 @@ __author__ = 'petar@google.com (Petar Petrov)' import unittest from google.protobuf import service_reflection -from google.protobuf import service from google.protobuf import unittest_pb2 class FooUnitTest(unittest.TestCase): def testService(self): - class MockRpcChannel(service.RpcChannel): + + class MockRpcChannel: def CallMethod(self, method, controller, request, response, callback): self.method = method self.controller = controller self.request = request callback(response) - class MockRpcController(service.RpcController): + class MockRpcController: def SetFailed(self, msg): self.failure_message = msg @@ -81,7 +81,8 @@ class FooUnitTest(unittest.TestCase): self.assertEqual(True, srvc.bar_called) def testServiceStub(self): - class MockRpcChannel(service.RpcChannel): + + class MockRpcChannel: def CallMethod(self, method, controller, request, response_class, callback): self.method = method diff --git a/third_party/protobuf/python/google/protobuf/internal/symbol_database_test.py b/third_party/protobuf/python/google/protobuf/internal/symbol_database_test.py index 45cc979667397..c71b7600c82af 100644 --- a/third_party/protobuf/python/google/protobuf/internal/symbol_database_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/symbol_database_test.py @@ -35,64 +35,57 @@ class SymbolDatabaseTest(unittest.TestCase): db.RegisterServiceDescriptor(unittest_pb2._TESTSERVICE) return db - def testGetMessages(self): - messages = self._Database().GetMessages( - ['google/protobuf/unittest.proto']) - self.assertTrue( - unittest_pb2.TestAllTypes is - messages['protobuf_unittest.TestAllTypes']) - def testGetSymbol(self): self.assertEqual( unittest_pb2.TestAllTypes, self._Database().GetSymbol( - 'protobuf_unittest.TestAllTypes')) + 'proto2_unittest.TestAllTypes')) self.assertEqual( unittest_pb2.TestAllTypes.NestedMessage, self._Database().GetSymbol( - 'protobuf_unittest.TestAllTypes.NestedMessage')) + 'proto2_unittest.TestAllTypes.NestedMessage')) self.assertEqual( unittest_pb2.TestAllTypes.OptionalGroup, self._Database().GetSymbol( - 'protobuf_unittest.TestAllTypes.OptionalGroup')) + 'proto2_unittest.TestAllTypes.OptionalGroup')) self.assertEqual( unittest_pb2.TestAllTypes.RepeatedGroup, self._Database().GetSymbol( - 'protobuf_unittest.TestAllTypes.RepeatedGroup')) + 'proto2_unittest.TestAllTypes.RepeatedGroup')) def testEnums(self): # Check registration of types in the pool. self.assertEqual( - 'protobuf_unittest.ForeignEnum', + 'proto2_unittest.ForeignEnum', self._Database().pool.FindEnumTypeByName( - 'protobuf_unittest.ForeignEnum').full_name) + 'proto2_unittest.ForeignEnum').full_name) self.assertEqual( - 'protobuf_unittest.TestAllTypes.NestedEnum', + 'proto2_unittest.TestAllTypes.NestedEnum', self._Database().pool.FindEnumTypeByName( - 'protobuf_unittest.TestAllTypes.NestedEnum').full_name) + 'proto2_unittest.TestAllTypes.NestedEnum').full_name) def testFindMessageTypeByName(self): self.assertEqual( - 'protobuf_unittest.TestAllTypes', + 'proto2_unittest.TestAllTypes', self._Database().pool.FindMessageTypeByName( - 'protobuf_unittest.TestAllTypes').full_name) + 'proto2_unittest.TestAllTypes').full_name) self.assertEqual( - 'protobuf_unittest.TestAllTypes.NestedMessage', + 'proto2_unittest.TestAllTypes.NestedMessage', self._Database().pool.FindMessageTypeByName( - 'protobuf_unittest.TestAllTypes.NestedMessage').full_name) + 'proto2_unittest.TestAllTypes.NestedMessage').full_name) def testFindServiceByName(self): self.assertEqual( - 'protobuf_unittest.TestService', + 'proto2_unittest.TestService', self._Database().pool.FindServiceByName( - 'protobuf_unittest.TestService').full_name) + 'proto2_unittest.TestService').full_name) def testFindFileContainingSymbol(self): # Lookup based on either enum or message. self.assertEqual( 'google/protobuf/unittest.proto', self._Database().pool.FindFileContainingSymbol( - 'protobuf_unittest.TestAllTypes.NestedEnum').name) + 'proto2_unittest.TestAllTypes.NestedEnum').name) self.assertEqual( 'google/protobuf/unittest.proto', self._Database().pool.FindFileContainingSymbol( - 'protobuf_unittest.TestAllTypes').name) + 'proto2_unittest.TestAllTypes').name) def testFindFileByName(self): self.assertEqual( diff --git a/third_party/protobuf/python/google/protobuf/internal/test_proto2.proto b/third_party/protobuf/python/google/protobuf/internal/test_proto2.proto index 9c1022eacb26d..94fd50c8cadba 100644 --- a/third_party/protobuf/python/google/protobuf/internal/test_proto2.proto +++ b/third_party/protobuf/python/google/protobuf/internal/test_proto2.proto @@ -37,3 +37,14 @@ message TestProto2 { repeated int32 repeated_int32 = 22; repeated NestedMessage repeated_nested_message = 23; } + +message MessageWithSelfField { + optional int32 something = 1; + optional int32 self = 2; +} + +message MessageWithSelfAndSelfUnderscoreField { + optional int32 something = 1; + optional int32 self = 2; + optional int32 self_ = 3 [json_name = "self_underscore"]; +} diff --git a/third_party/protobuf/python/google/protobuf/internal/test_util.py b/third_party/protobuf/python/google/protobuf/internal/test_util.py index 46059fe1eba24..dda8e9cc096a0 100755 --- a/third_party/protobuf/python/google/protobuf/internal/test_util.py +++ b/third_party/protobuf/python/google/protobuf/internal/test_util.py @@ -33,7 +33,7 @@ except NameError: # This is used to gate several fields/features that only exist # for the protobuf_unittest version of the message. def IsProto2(message): - return message.DESCRIPTOR.full_name == 'protobuf_unittest.TestAllTypes' + return message.DESCRIPTOR.full_name == 'proto2_unittest.TestAllTypes' def SetAllNonLazyFields(message): diff --git a/third_party/protobuf/python/google/protobuf/internal/testing_refleaks.py b/third_party/protobuf/python/google/protobuf/internal/testing_refleaks.py index ca0f0b96d140a..a05ecf29f557e 100644 --- a/third_party/protobuf/python/google/protobuf/internal/testing_refleaks.py +++ b/third_party/protobuf/python/google/protobuf/internal/testing_refleaks.py @@ -37,6 +37,9 @@ class LocalTestResult(unittest.TestResult): def addSkip(self, test, reason): pass + def addDuration(self, test, duration): + pass + class ReferenceLeakCheckerMixin(object): """A mixin class for TestCase, which checks reference counts.""" @@ -59,7 +62,7 @@ class ReferenceLeakCheckerMixin(object): super(ReferenceLeakCheckerMixin, self).run(result=result) super(ReferenceLeakCheckerMixin, self).run(result=result) - oldrefcount = 0 + oldrefcount = 0 # pylint: disable=unused-variable but needed for refcounts. local_result = LocalTestResult(result) num_flakes = 0 diff --git a/third_party/protobuf/python/google/protobuf/internal/text_format_test.py b/third_party/protobuf/python/google/protobuf/internal/text_format_test.py index af29054ac51f1..a2f8645d768f2 100644 --- a/third_party/protobuf/python/google/protobuf/internal/text_format_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/text_format_test.py @@ -26,7 +26,7 @@ from google.protobuf.internal import test_proto3_optional_pb2 from google.protobuf.internal import test_util from google.protobuf import descriptor_pool from google.protobuf import text_format -from google.protobuf.internal import _parameterized +from absl.testing import parameterized from google.protobuf import any_test_pb2 from google.protobuf import map_unittest_pb2 from google.protobuf import unittest_mset_pb2 @@ -75,7 +75,7 @@ class TextFormatBase(unittest.TestCase): return text -@_parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) +@parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) class TextFormatMessageToStringTests(TextFormatBase): def testPrintExotic(self, message_module): @@ -493,7 +493,7 @@ class TextFormatMessageToStringTests(TextFormatBase): ' type: TYPE_STRING\n' ' options {\n' ' ctype: CORD\n' - ' [protobuf_unittest.field_opt1]: 8765432109\n' + ' [proto2_unittest.field_opt1]: 8765432109\n' ' }\n' '}\n' 'field {\n' @@ -508,10 +508,10 @@ class TextFormatMessageToStringTests(TextFormatBase): ' number: 3\n' ' label: LABEL_REPEATED\n' ' type: TYPE_MESSAGE\n' - ' type_name: ".protobuf_unittest.TestMessageWithCustomOptions.' + ' type_name: ".proto2_unittest.TestMessageWithCustomOptions.' 'MapFieldEntry"\n' ' options {\n' - ' [protobuf_unittest.field_opt1]: 12345\n' + ' [proto2_unittest.field_opt1]: 12345\n' ' }\n' '}\n' 'nested_type {\n' @@ -542,21 +542,21 @@ class TextFormatMessageToStringTests(TextFormatBase): ' name: "ANENUM_VAL2"\n' ' number: 2\n' ' options {\n' - ' [protobuf_unittest.enum_value_opt1]: 123\n' + ' [proto2_unittest.enum_value_opt1]: 123\n' ' }\n' ' }\n' ' options {\n' - ' [protobuf_unittest.enum_opt1]: -789\n' + ' [proto2_unittest.enum_opt1]: -789\n' ' }\n' '}\n' 'options {\n' ' message_set_wire_format: false\n' - ' [protobuf_unittest.message_opt1]: -56\n' + ' [proto2_unittest.message_opt1]: -56\n' '}\n' 'oneof_decl {\n' ' name: "AnOneof"\n' ' options {\n' - ' [protobuf_unittest.oneof_opt1]: -99\n' + ' [proto2_unittest.oneof_opt1]: -99\n' ' }\n' '}\n') self.assertEqual(expected_text, @@ -610,7 +610,7 @@ class TextFormatMessageToStringTests(TextFormatBase): as_one_line=True)) -@_parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) +@parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) class TextFormatMessageToTextBytesTests(TextFormatBase): def testMessageToBytes(self, message_module): @@ -676,7 +676,7 @@ class TextFormatMessageToTextBytesTests(TextFormatBase): parsed_message.repeated_string[0])) -@_parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) +@parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) class TextFormatParserTests(TextFormatBase): def testParseAllFields(self, message_module): @@ -979,6 +979,20 @@ class TextFormatParserTests(TextFormatBase): r'have multiple "optional_int32" fields.'), text_format.Parse, text, message) + def testParseDuplicateNegativeZero(self, message_module): + message = message_module.TestAllTypes() + text = 'optional_double: -0.0 optional_double: 3' + self.assertRaisesRegex( + text_format.ParseError, + ( + r'1:40 : Message type "\w+.TestAllTypes" should not ' + r'have multiple "optional_double" fields.' + ), + text_format.Parse, + text, + message, + ) + def testParseExistingScalarInMessage(self, message_module): message = message_module.TestAllTypes(optional_int32=42) text = 'optional_int32: 67' @@ -988,7 +1002,7 @@ class TextFormatParserTests(TextFormatBase): text_format.Parse, text, message) -@_parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) +@parameterized.parameters(unittest_pb2, unittest_proto3_arena_pb2) class TextFormatMergeTests(TextFormatBase): def testMergeDuplicateScalarsInText(self, message_module): @@ -1126,33 +1140,33 @@ class OnlyWorksWithProto2RightNowTests(TextFormatBase): ' oo: 0\n' ' bb: 1\n' '}\n' - '[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] {\n' + '[proto2_unittest.TestExtensionOrderings2.test_ext_orderings2] {\n' ' my_string: "ext_str2"\n' '}\n' - '[protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] {\n' + '[proto2_unittest.TestExtensionOrderings1.test_ext_orderings1] {\n' ' my_string: "ext_str1"\n' '}\n' - '[protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3' + '[proto2_unittest.TestExtensionOrderings2.TestExtensionOrderings3' '.test_ext_orderings3] {\n' ' my_string: "ext_str3"\n' '}\n' - '[protobuf_unittest.my_extension_string]: "ext_str0"\n') + '[proto2_unittest.my_extension_string]: "ext_str0"\n') # By default, print in field number order. self.CompareToGoldenText( self.RemoveRedundantZeros(text_format.MessageToString(message)), 'my_int: 101\n' 'my_string: "str"\n' - '[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] {\n' + '[proto2_unittest.TestExtensionOrderings2.test_ext_orderings2] {\n' ' my_string: "ext_str2"\n' '}\n' - '[protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] {\n' + '[proto2_unittest.TestExtensionOrderings1.test_ext_orderings1] {\n' ' my_string: "ext_str1"\n' '}\n' - '[protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3' + '[proto2_unittest.TestExtensionOrderings2.TestExtensionOrderings3' '.test_ext_orderings3] {\n' ' my_string: "ext_str3"\n' '}\n' - '[protobuf_unittest.my_extension_string]: "ext_str0"\n' + '[proto2_unittest.my_extension_string]: "ext_str0"\n' 'my_float: 111\n' 'optional_nested_message {\n' ' bb: 1\n' @@ -1179,6 +1193,73 @@ class OnlyWorksWithProto2RightNowTests(TextFormatBase): test_util.SetAllFields(message) self.assertEqual(message, parsed_message) + def testPrintMapEmptyKeys(self): + message = map_unittest_pb2.TestMap() + + message.map_int32_int32[0] = 123 + message.map_int64_int64[0] = 2**33 + message.map_uint32_uint32[0] = 123 + message.map_uint64_uint64[0] = 2**33 + message.map_string_string[''] = 'world' + message.map_int32_foreign_message[0].c = 111 + self.CompareToGoldenText( + text_format.MessageToString(message), + 'map_int32_int32 {\n' + ' value: 123\n' + '}\n' + 'map_int64_int64 {\n' + ' value: 8589934592\n' + '}\n' + 'map_uint32_uint32 {\n' + ' value: 123\n' + '}\n' + 'map_uint64_uint64 {\n' + ' value: 8589934592\n' + '}\n' + 'map_string_string {\n' + ' value: "world"\n' + '}\n' + 'map_int32_foreign_message {\n' + ' value {\n' + ' c: 111\n' + ' }\n' + '}\n', + ) + + def testPrintMapEmptyValues(self): + message = map_unittest_pb2.TestMap() + + message.map_int32_int32[-123] = 0 + message.map_int64_int64[-(2**33)] = 0 + message.map_uint32_uint32[123] = 0 + message.map_uint64_uint64[2**33] = 0 + message.map_string_string['hello'] = '' + message.map_int32_foreign_message[111].c = 0 + self.CompareToGoldenText( + text_format.MessageToString(message), + 'map_int32_int32 {\n' + ' key: -123\n' + '}\n' + 'map_int64_int64 {\n' + ' key: -8589934592\n' + '}\n' + 'map_uint32_uint32 {\n' + ' key: 123\n' + '}\n' + 'map_uint64_uint64 {\n' + ' key: 8589934592\n' + '}\n' + 'map_string_string {\n' + ' key: "hello"\n' + '}\n' + 'map_int32_foreign_message {\n' + ' key: 111\n' + ' value {\n' + ' c: 0\n' + ' }\n' + '}\n', + ) + def testPrintMap(self): message = map_unittest_pb2.TestMap() @@ -1327,10 +1408,10 @@ class Proto2Tests(TextFormatBase): message.message_set.Extensions[ext2].str = 'foo' self.CompareToGoldenText( text_format.MessageToString(message), 'message_set {\n' - ' [protobuf_unittest.TestMessageSetExtension1] {\n' + ' [proto2_unittest.TestMessageSetExtension1] {\n' ' i: 23\n' ' }\n' - ' [protobuf_unittest.TestMessageSetExtension2] {\n' + ' [proto2_unittest.TestMessageSetExtension2] {\n' ' str: \"foo\"\n' ' }\n' '}\n') @@ -1344,6 +1425,23 @@ class Proto2Tests(TextFormatBase): ' text: \"bar\"\n' '}\n') + def testMessageSetExtensionNotFirst(self): + desc = message_set_extensions_pb2.TestMessageSetExtension1.DESCRIPTOR + self.assertEqual('first_extension', desc.extensions[0].name) + self.assertEqual('message_set_extension', desc.extensions[1].name) + message = message_set_extensions_pb2.TestMessageSet() + ext = ( + message_set_extensions_pb2.TestMessageSetExtension1.message_set_extension + ) + message.Extensions[ext].i = 123 + expected_str = ( + '[google.protobuf.internal.TestMessageSetExtension1] {\n i: 123\n}\n' + ) + self.CompareToGoldenText(text_format.MessageToString(message), expected_str) + parsed = message_set_extensions_pb2.TestMessageSet() + text_format.Parse(expected_str, parsed) + self.CompareToGoldenText(text_format.MessageToString(parsed), expected_str) + def testPrintMessageSetByFieldNumber(self): out = text_format.TextWriter(False) message = unittest_mset_pb2.TestMessageSetContainer() @@ -1371,10 +1469,10 @@ class Proto2Tests(TextFormatBase): self.CompareToGoldenText( text_format.MessageToString(message, as_one_line=True), 'message_set {' - ' [protobuf_unittest.TestMessageSetExtension1] {' + ' [proto2_unittest.TestMessageSetExtension1] {' ' i: 23' ' }' - ' [protobuf_unittest.TestMessageSetExtension2] {' + ' [proto2_unittest.TestMessageSetExtension2] {' ' str: \"foo\"' ' }' ' }') @@ -1388,10 +1486,10 @@ class Proto2Tests(TextFormatBase): message = unittest_mset_pb2.TestMessageSetContainer() text = ('message_set {\n' - ' [protobuf_unittest.TestMessageSetExtension1] {\n' + ' [proto2_unittest.TestMessageSetExtension1] {\n' ' i: 23\n' ' }\n' - ' [protobuf_unittest.TestMessageSetExtension2] {\n' + ' [proto2_unittest.TestMessageSetExtension2] {\n' ' str: \"foo\"\n' ' }\n' '}\n') @@ -1606,10 +1704,10 @@ class Proto2Tests(TextFormatBase): # Parse known extension correctly. message = unittest_mset_pb2.TestMessageSetContainer() text = ('message_set {\n' - ' [protobuf_unittest.TestMessageSetExtension1] {\n' + ' [proto2_unittest.TestMessageSetExtension1] {\n' ' i: 23\n' ' }\n' - ' [protobuf_unittest.TestMessageSetExtension2] {\n' + ' [proto2_unittest.TestMessageSetExtension2] {\n' ' str: \"foo\"\n' ' }\n' '}\n') @@ -1626,7 +1724,7 @@ class Proto2Tests(TextFormatBase): ' [unknown_extension] {\n' ' str: "string"\n' ' any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string"\n' ' }\n' ' }\n' @@ -1644,7 +1742,7 @@ class Proto2Tests(TextFormatBase): ' [unknown_extension] {\n' ' str: "string"\n' ' any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string"\n' ' }\n' ' }\n' @@ -1679,7 +1777,7 @@ class Proto2Tests(TextFormatBase): message = unittest_pb2.TestAllTypes() self.assertRaisesRegex( text_format.ParseError, - ('1:2 : Message type "protobuf_unittest.TestAllTypes" does not have ' + ('1:2 : Message type "proto2_unittest.TestAllTypes" does not have ' 'extensions.'), text_format.Parse, text, message) def testParseNumericUnknownEnum(self): @@ -1693,32 +1791,32 @@ class Proto2Tests(TextFormatBase): def testMergeDuplicateExtensionScalars(self): message = unittest_pb2.TestAllExtensions() - text = ('[protobuf_unittest.optional_int32_extension]: 42 ' - '[protobuf_unittest.optional_int32_extension]: 67') + text = ('[proto2_unittest.optional_int32_extension]: 42 ' + '[proto2_unittest.optional_int32_extension]: 67') text_format.Merge(text, message) self.assertEqual(67, message.Extensions[unittest_pb2.optional_int32_extension]) def testParseDuplicateExtensionScalars(self): message = unittest_pb2.TestAllExtensions() - text = ('[protobuf_unittest.optional_int32_extension]: 42 ' - '[protobuf_unittest.optional_int32_extension]: 67') + text = ('[proto2_unittest.optional_int32_extension]: 42 ' + '[proto2_unittest.optional_int32_extension]: 67') self.assertRaisesRegex( text_format.ParseError, - ('1:96 : Message type "protobuf_unittest.TestAllExtensions" ' + ('1:92 : Message type "proto2_unittest.TestAllExtensions" ' 'should not have multiple ' - '"protobuf_unittest.optional_int32_extension" extensions.'), + '"proto2_unittest.optional_int32_extension" extensions.'), text_format.Parse, text, message) def testParseDuplicateExtensionMessages(self): message = unittest_pb2.TestAllExtensions() - text = ('[protobuf_unittest.optional_nested_message_extension]: {} ' - '[protobuf_unittest.optional_nested_message_extension]: {}') + text = ('[proto2_unittest.optional_nested_message_extension]: {} ' + '[proto2_unittest.optional_nested_message_extension]: {}') self.assertRaisesRegex( text_format.ParseError, - ('1:114 : Message type "protobuf_unittest.TestAllExtensions" ' + ('1:110 : Message type "proto2_unittest.TestAllExtensions" ' 'should not have multiple ' - '"protobuf_unittest.optional_nested_message_extension" extensions.'), + '"proto2_unittest.optional_nested_message_extension" extensions.'), text_format.Parse, text, message) def testParseGroupNotClosed(self): @@ -1794,11 +1892,37 @@ class Proto3Tests(unittest.TestCase): text_format.MessageToString(message, descriptor_pool=descriptor_pool.Default()), 'any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string"\n' ' }\n' '}\n') + def testPrintStructInAny(self): + packed_message = struct_pb2.Struct() + packed_message['name'] = 'Jim' + message = any_test_pb2.TestAny() + message.any_value.Pack(packed_message) + print( + text_format.MessageToString( + message, descriptor_pool=descriptor_pool.Default() + ) + ) + self.assertEqual( + text_format.MessageToString( + message, descriptor_pool=descriptor_pool.Default() + ), + 'any_value {\n' + ' [type.googleapis.com/google.protobuf.Struct] {\n' + ' fields {\n' + ' key: "name"\n' + ' value {\n' + ' string_value: "Jim"\n' + ' }\n' + ' }\n' + ' }\n' + '}\n', + ) + def testTopAnyMessage(self): packed_msg = unittest_pb2.OneString() msg = any_pb2.Any() @@ -1817,12 +1941,12 @@ class Proto3Tests(unittest.TestCase): self.assertEqual( text_format.MessageToString(message), 'repeated_any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string0"\n' ' }\n' '}\n' 'repeated_any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string1"\n' ' }\n' '}\n') @@ -1836,7 +1960,7 @@ class Proto3Tests(unittest.TestCase): self.assertEqual( text_format.MessageToString(message, descriptor_pool=empty_pool), 'any_value {\n' - ' type_url: "type.googleapis.com/protobuf_unittest.OneString"\n' + ' type_url: "type.googleapis.com/proto2_unittest.OneString"\n' ' value: "\\n\\006string"\n' '}\n') @@ -1849,7 +1973,7 @@ class Proto3Tests(unittest.TestCase): text_format.MessageToString(message, pointy_brackets=True), 'any_value <\n' - ' [type.googleapis.com/protobuf_unittest.OneString] <\n' + ' [type.googleapis.com/proto2_unittest.OneString] <\n' ' data: "string"\n' ' >\n' '>\n') @@ -1863,7 +1987,7 @@ class Proto3Tests(unittest.TestCase): text_format.MessageToString(message, as_one_line=True), 'any_value {' - ' [type.googleapis.com/protobuf_unittest.OneString]' + ' [type.googleapis.com/proto2_unittest.OneString]' ' { data: "string" } ' '}') @@ -1878,7 +2002,7 @@ class Proto3Tests(unittest.TestCase): pointy_brackets=True, descriptor_pool=descriptor_pool.Default()), 'any_value <' - ' [type.googleapis.com/protobuf_unittest.OneString]' + ' [type.googleapis.com/proto2_unittest.OneString]' ' < data: "string" > ' '>') @@ -1892,7 +2016,7 @@ class Proto3Tests(unittest.TestCase): text = text_format.MessageToString(message) self.assertEqual( text, 'any_value {\n' - ' type_url: "protobuf_unittest.OneString"\n' + ' type_url: "proto2_unittest.OneString"\n' ' value: "\\n\\006string"\n' '}\n') @@ -1911,7 +2035,7 @@ class Proto3Tests(unittest.TestCase): def testMergeExpandedAny(self): message = any_test_pb2.TestAny() text = ('any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string"\n' ' }\n' '}\n') @@ -1928,12 +2052,12 @@ class Proto3Tests(unittest.TestCase): def testMergeExpandedAnyRepeated(self): message = any_test_pb2.TestAny() text = ('repeated_any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string0"\n' ' }\n' '}\n' 'repeated_any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string1"\n' ' }\n' '}\n') @@ -1947,7 +2071,7 @@ class Proto3Tests(unittest.TestCase): def testMergeExpandedAnyPointyBrackets(self): message = any_test_pb2.TestAny() text = ('any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] <\n' + ' [type.googleapis.com/proto2_unittest.OneString] <\n' ' data: "string"\n' ' >\n' '}\n') @@ -1959,19 +2083,19 @@ class Proto3Tests(unittest.TestCase): def testMergeAlternativeUrl(self): message = any_test_pb2.TestAny() text = ('any_value {\n' - ' [type.otherapi.com/protobuf_unittest.OneString] {\n' + ' [type.otherapi.com/proto2_unittest.OneString] {\n' ' data: "string"\n' ' }\n' '}\n') text_format.Merge(text, message) packed_message = unittest_pb2.OneString() - self.assertEqual('type.otherapi.com/protobuf_unittest.OneString', + self.assertEqual('type.otherapi.com/proto2_unittest.OneString', message.any_value.type_url) def testMergeExpandedAnyDescriptorPoolMissingType(self): message = any_test_pb2.TestAny() text = ('any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string"\n' ' }\n' '}\n') @@ -1980,11 +2104,11 @@ class Proto3Tests(unittest.TestCase): text_format.Merge(text, message, descriptor_pool=empty_pool) self.assertEqual( str(e.exception), - 'Type protobuf_unittest.OneString not found in descriptor pool') + 'Type proto2_unittest.OneString not found in descriptor pool') def testMergeUnexpandedAny(self): text = ('any_value {\n' - ' type_url: "type.googleapis.com/protobuf_unittest.OneString"\n' + ' type_url: "type.googleapis.com/proto2_unittest.OneString"\n' ' value: "\\n\\006string"\n' '}\n') message = any_test_pb2.TestAny() @@ -1996,7 +2120,7 @@ class Proto3Tests(unittest.TestCase): def testMergeMissingAnyEndToken(self): message = any_test_pb2.TestAny() text = ('any_value {\n' - ' [type.googleapis.com/protobuf_unittest.OneString] {\n' + ' [type.googleapis.com/proto2_unittest.OneString] {\n' ' data: "string"\n') with self.assertRaises(text_format.ParseError) as e: text_format.Merge(text, message) @@ -2031,84 +2155,241 @@ class Proto3Tests(unittest.TestCase): self.assertEqual(text_format.MessageToString(msg2), text) -class TokenizerTest(unittest.TestCase): +def _CreateConsumeLiteralToken(expected_literal): + def _Consume(tokenizer): + tokenizer.Consume(expected_literal) + return expected_literal - def testSimpleTokenCases(self): - text = ('identifier1:"string1"\n \n\n' - 'identifier2 : \n \n123 \n identifier3 :\'string\'\n' - 'identifiER_4 : 1.1e+2 ID5:-0.23 ID6:\'aaaa\\\'bbbb\'\n' - 'ID7 : "aa\\"bb"\n\n\n\n ID8: {A:inf B:-inf C:true D:false}\n' - 'ID9: 22 ID10: -111111111111111111 ID11: -22\n' - 'ID12: 2222222222222222222 ID13: 1.23456f ID14: 1.2e+2f ' - 'false_bool: 0 true_BOOL:t \n true_bool1: 1 false_BOOL1:f ' - 'False_bool: False True_bool: True X:iNf Y:-inF Z:nAN') + return (_Consume, expected_literal) + + +class TokenizerTest(parameterized.TestCase): + + @parameterized.named_parameters([ + dict( + testcase_name='_string_double_quotes', + text='identifier1:"string1"\n', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'identifier1'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeString, 'string1'), + ], + ), + dict( + testcase_name='_integer', + text='identifier2 : \n \n123 ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'identifier2'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeInteger, 123), + ], + ), + dict( + testcase_name='_string_single_quotes', + text="\n identifier3:'string'\n", + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'identifier3'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeString, 'string'), + ], + ), + dict( + testcase_name='_float_exponent', + text='identifiER_4 : 1.1e+2 ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'identifiER_4'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, 1.1e2), + ], + ), + dict( + testcase_name='_float', + text='ID5:-0.23', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID5'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, -0.23), + ], + ), + dict( + testcase_name='_escape_single_quote', + text="ID6:'aaaa\\'bbbb'\n", + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID6'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeString, "aaaa'bbbb"), + ], + ), + dict( + testcase_name='_escape_double_quote', + text='ID7 : "aa\\"bb"\n\n\n\n ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID7'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeString, 'aa"bb'), + ], + ), + dict( + testcase_name='_submessage', + text='ID8: {A:inf B:-inf C:true D:false}\n', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID8'), + _CreateConsumeLiteralToken(':'), + _CreateConsumeLiteralToken('{'), + (text_format.Tokenizer.ConsumeIdentifier, 'A'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, float('inf')), + (text_format.Tokenizer.ConsumeIdentifier, 'B'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, float('-inf')), + (text_format.Tokenizer.ConsumeIdentifier, 'C'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, True), + (text_format.Tokenizer.ConsumeIdentifier, 'D'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, False), + _CreateConsumeLiteralToken('}'), + ], + ), + dict( + testcase_name='_large_negative_integer', + text='ID10: -111111111111111111 ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID10'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeInteger, -111111111111111111), + ], + ), + dict( + testcase_name='_negative_integer', + text='ID11: -22\n', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID11'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeInteger, -22), + ], + ), + dict( + testcase_name='_large_integer', + text='ID12: 2222222222222222222 ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID12'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeInteger, 2222222222222222222), + ], + ), + dict( + testcase_name='_float_suffix', + text='ID13: 1.23456f ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID13'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, 1.23456), + ], + ), + dict( + testcase_name='_float_capital_suffix', + text='ID13: 1.23456F ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID13'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, 1.23456), + ], + ), + dict( + testcase_name='_float_exponent_suffix', + text='ID14: 1.2e+2f ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'ID14'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, 1.2e2), + ], + ), + dict( + testcase_name='_bool_zero', + text='false_bool: 0 ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'false_bool'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, False), + ], + ), + dict( + testcase_name='_bool_t', + text='true_BOOL:t ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'true_BOOL'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, True), + ], + ), + dict( + testcase_name='_bool_one', + text='true_bool1: 1 ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'true_bool1'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, True), + ], + ), + dict( + testcase_name='_bool_f', + text='false_BOOL1:f ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'false_BOOL1'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, False), + ], + ), + dict( + testcase_name='_bool_false', + text='False_bool: False ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'False_bool'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, False), + ], + ), + dict( + testcase_name='_bool_true', + text='True_bool: True ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'True_bool'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeBool, True), + ], + ), + dict( + testcase_name='_float_inf', + text='X:iNf ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'X'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, float('inf')), + ], + ), + dict( + testcase_name='_float_negative_inf', + text='Y:-inF ', + expected=[ + (text_format.Tokenizer.ConsumeIdentifier, 'Y'), + _CreateConsumeLiteralToken(':'), + (text_format.Tokenizer.ConsumeFloat, float('-inf')), + ], + ), + ]) + def testSimpleTokenCases(self, text, expected): + consume_functions, expected_tokens = zip(*expected) tokenizer = text_format.Tokenizer(text.splitlines()) - methods = [(tokenizer.ConsumeIdentifier, 'identifier1'), ':', - (tokenizer.ConsumeString, 'string1'), - (tokenizer.ConsumeIdentifier, 'identifier2'), ':', - (tokenizer.ConsumeInteger, 123), - (tokenizer.ConsumeIdentifier, 'identifier3'), ':', - (tokenizer.ConsumeString, 'string'), - (tokenizer.ConsumeIdentifier, 'identifiER_4'), ':', - (tokenizer.ConsumeFloat, 1.1e+2), - (tokenizer.ConsumeIdentifier, 'ID5'), ':', - (tokenizer.ConsumeFloat, -0.23), - (tokenizer.ConsumeIdentifier, 'ID6'), ':', - (tokenizer.ConsumeString, 'aaaa\'bbbb'), - (tokenizer.ConsumeIdentifier, 'ID7'), ':', - (tokenizer.ConsumeString, 'aa\"bb'), - (tokenizer.ConsumeIdentifier, 'ID8'), ':', '{', - (tokenizer.ConsumeIdentifier, 'A'), ':', - (tokenizer.ConsumeFloat, float('inf')), - (tokenizer.ConsumeIdentifier, 'B'), ':', - (tokenizer.ConsumeFloat, -float('inf')), - (tokenizer.ConsumeIdentifier, 'C'), ':', - (tokenizer.ConsumeBool, True), - (tokenizer.ConsumeIdentifier, 'D'), ':', - (tokenizer.ConsumeBool, False), '}', - (tokenizer.ConsumeIdentifier, 'ID9'), ':', - (tokenizer.ConsumeInteger, 22), - (tokenizer.ConsumeIdentifier, 'ID10'), ':', - (tokenizer.ConsumeInteger, -111111111111111111), - (tokenizer.ConsumeIdentifier, 'ID11'), ':', - (tokenizer.ConsumeInteger, -22), - (tokenizer.ConsumeIdentifier, 'ID12'), ':', - (tokenizer.ConsumeInteger, 2222222222222222222), - (tokenizer.ConsumeIdentifier, 'ID13'), ':', - (tokenizer.ConsumeFloat, 1.23456), - (tokenizer.ConsumeIdentifier, 'ID14'), ':', - (tokenizer.ConsumeFloat, 1.2e+2), - (tokenizer.ConsumeIdentifier, 'false_bool'), ':', - (tokenizer.ConsumeBool, False), - (tokenizer.ConsumeIdentifier, 'true_BOOL'), ':', - (tokenizer.ConsumeBool, True), - (tokenizer.ConsumeIdentifier, 'true_bool1'), ':', - (tokenizer.ConsumeBool, True), - (tokenizer.ConsumeIdentifier, 'false_BOOL1'), ':', - (tokenizer.ConsumeBool, False), - (tokenizer.ConsumeIdentifier, 'False_bool'), ':', - (tokenizer.ConsumeBool, False), - (tokenizer.ConsumeIdentifier, 'True_bool'), ':', - (tokenizer.ConsumeBool, True), - (tokenizer.ConsumeIdentifier, 'X'), ':', - (tokenizer.ConsumeFloat, float('inf')), - (tokenizer.ConsumeIdentifier, 'Y'), ':', - (tokenizer.ConsumeFloat, float('-inf')), - (tokenizer.ConsumeIdentifier, 'Z'), ':', - (tokenizer.ConsumeFloat, float('nan'))] + tokens = [consume(tokenizer) for consume in consume_functions] - i = 0 - while not tokenizer.AtEnd(): - m = methods[i] - if isinstance(m, str): - token = tokenizer.token - self.assertEqual(token, m) - tokenizer.NextToken() - elif isinstance(m[1], float) and math.isnan(m[1]): - self.assertTrue(math.isnan(m[0]())) - else: - self.assertEqual(m[1], m[0]()) - i += 1 + self.assertTrue(tokenizer.AtEnd()) + self.assertEqual(tokens, [token for token in expected_tokens]) + + def testConsumeNan(self): + tokenizer = text_format.Tokenizer(['nAN']) + token = tokenizer.ConsumeFloat() + self.assertTrue(math.isnan(token), 'Expected NaN, got %s' % token) def testConsumeAbstractIntegers(self): # This test only tests the failures in the integer parsing methods as well @@ -2187,6 +2468,17 @@ class TokenizerTest(unittest.TestCase): self.assertEqual(1, tokenizer.ConsumeInteger()) self.assertTrue(tokenizer.AtEnd()) + @parameterized.parameters('00', '09', '01.123', '-00', '-09', '-01.234') + def testConsumeOctalFloats(self, text): + """Test rejection of for octal-formatted floats.""" + tokenizer = text_format.Tokenizer([text]) + + self.assertRaisesRegex( + text_format.ParseError, + 'Invalid octal float: %s' % text, + tokenizer.ConsumeFloat, + ) + def testConsumeByteString(self): text = '"string1\'' tokenizer = text_format.Tokenizer(text.splitlines()) @@ -2304,7 +2596,7 @@ class TokenizerTest(unittest.TestCase): def testGroupName(self): grp = unittest_pb2.TestGroupExtension() grp.Extensions[unittest_pb2.TestNestedExtension.optionalgroup_extension].a = 6 - self.assertEqual('[protobuf_unittest.TestNestedExtension.optionalgroup_extension] {\n a: 6\n}\n', str(grp)) + self.assertEqual('[proto2_unittest.TestNestedExtension.optionalgroup_extension] {\n a: 6\n}\n', str(grp)) msg = unittest_pb2.TestAllTypes( repeatedgroup=[unittest_pb2.TestAllTypes.RepeatedGroup(a=1)]) @@ -2409,7 +2701,7 @@ class TokenizerTest(unittest.TestCase): text_format.Parse('NotGroupLikeScope { b:1 }', msg) # Tests for pretty printer functionality. -@_parameterized.parameters((unittest_pb2), (unittest_proto3_arena_pb2)) +@parameterized.parameters((unittest_pb2), (unittest_proto3_arena_pb2)) class PrettyPrinterTest(TextFormatBase): def testPrettyPrintNoMatch(self, message_module): @@ -2597,7 +2889,7 @@ class OptionalColonMessageToStringTest(unittest.TestCase): message, force_colon=True) expected = ('any_value: {\n' - ' [type.googleapis.com/protobuf_unittest.OneString]: {\n' + ' [type.googleapis.com/proto2_unittest.OneString]: {\n' ' data: "string"\n' ' }\n' '}\n') diff --git a/third_party/protobuf/python/google/protobuf/internal/type_checkers.py b/third_party/protobuf/python/google/protobuf/internal/type_checkers.py index 04ccc98500185..0a932944acbd2 100755 --- a/third_party/protobuf/python/google/protobuf/internal/type_checkers.py +++ b/third_party/protobuf/python/google/protobuf/internal/type_checkers.py @@ -231,6 +231,7 @@ class Uint64ValueChecker(IntValueChecker): # The max 4 bytes float is about 3.4028234663852886e+38 _FLOAT_MAX = float.fromhex('0x1.fffffep+127') _FLOAT_MIN = -_FLOAT_MAX +_MAX_FLOAT_AS_DOUBLE_ROUNDED = 3.4028235677973366e38 _INF = float('inf') _NEG_INF = float('-inf') @@ -269,8 +270,12 @@ class FloatValueChecker(DoubleValueChecker): converted_value = super().CheckValue(proposed_value) # This inf rounding matches the C++ proto SafeDoubleToFloat logic. if converted_value > _FLOAT_MAX: + if converted_value <= _MAX_FLOAT_AS_DOUBLE_ROUNDED: + return _FLOAT_MAX return _INF if converted_value < _FLOAT_MIN: + if converted_value >= -_MAX_FLOAT_AS_DOUBLE_ROUNDED: + return _FLOAT_MIN return _NEG_INF return TruncateToFourByteFloat(converted_value) diff --git a/third_party/protobuf/python/google/protobuf/internal/unknown_fields_test.py b/third_party/protobuf/python/google/protobuf/internal/unknown_fields_test.py index 33ad766537994..7494bfd3b90d9 100755 --- a/third_party/protobuf/python/google/protobuf/internal/unknown_fields_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/unknown_fields_test.py @@ -13,6 +13,9 @@ __author__ = 'bohdank@google.com (Bohdan Koval)' import sys import unittest +from google.protobuf import descriptor +from google.protobuf import text_format +from google.protobuf import unknown_fields from google.protobuf.internal import api_implementation from google.protobuf.internal import encoder from google.protobuf.internal import message_set_extensions_pb2 @@ -21,8 +24,7 @@ from google.protobuf.internal import test_util from google.protobuf.internal import testing_refleaks from google.protobuf.internal import type_checkers from google.protobuf.internal import wire_format -from google.protobuf import descriptor -from google.protobuf import unknown_fields + from google.protobuf import map_unittest_pb2 from google.protobuf import unittest_mset_pb2 from google.protobuf import unittest_pb2 @@ -142,6 +144,17 @@ class UnknownFieldsTest(unittest.TestCase): b'', msg.map_int32_all_types[1].optional_nested_message.SerializeToString()) + def testUnknownFieldsInExtension(self): + msg = message_set_extensions_pb2.TestMessageSet() + ext3 = message_set_extensions_pb2.message_set_extension3 + sub_message = unittest_pb2.TestAllTypes() + sub_message.optional_string = 'discard' + msg.Extensions[ext3].ParseFromString(sub_message.SerializeToString()) + msg.DiscardUnknownFields() + self.assertNotIn( + 'discard', text_format.MessageToString(msg, print_unknown_fields=True) + ) + @testing_refleaks.TestCase class UnknownFieldsAccessorsTest(unittest.TestCase): diff --git a/third_party/protobuf/python/google/protobuf/internal/well_known_types.py b/third_party/protobuf/python/google/protobuf/internal/well_known_types.py index bbc63f494960c..0d95b4b98230b 100644 --- a/third_party/protobuf/python/google/protobuf/internal/well_known_types.py +++ b/third_party/protobuf/python/google/protobuf/internal/well_known_types.py @@ -26,7 +26,7 @@ from typing import Union FieldMask = field_mask.FieldMask -_TIMESTAMPFOMAT = '%Y-%m-%dT%H:%M:%S' +_TIMESTAMPFORMAT = '%Y-%m-%dT%H:%M:%S' _NANOS_PER_SECOND = 1000000000 _NANOS_PER_MILLISECOND = 1000000 _NANOS_PER_MICROSECOND = 1000 @@ -68,7 +68,7 @@ class Any(object): def TypeName(self): """Returns the protobuf type name of the inner message.""" # Only last part is to be used: b/25630112 - return self.type_url.split('/')[-1] + return self.type_url.rpartition('/')[2] def Is(self, descriptor): """Checks if this Any represents the given protobuf type.""" @@ -142,7 +142,7 @@ class Timestamp(object): raise ValueError( 'time data \'{0}\' does not match format \'%Y-%m-%dT%H:%M:%S\', ' 'lowercase \'t\' is not accepted'.format(second_value)) - date_object = datetime.datetime.strptime(second_value, _TIMESTAMPFOMAT) + date_object = datetime.datetime.strptime(second_value, _TIMESTAMPFORMAT) td = date_object - datetime.datetime(1970, 1, 1) seconds = td.seconds + td.days * _SECONDS_PER_DAY if len(nano_value) > 9: diff --git a/third_party/protobuf/python/google/protobuf/internal/well_known_types_test.py b/third_party/protobuf/python/google/protobuf/internal/well_known_types_test.py index 1a6a97c1c6dbb..683c2a5eee389 100644 --- a/third_party/protobuf/python/google/protobuf/internal/well_known_types_test.py +++ b/third_party/protobuf/python/google/protobuf/internal/well_known_types_test.py @@ -23,7 +23,7 @@ from google.protobuf import any_pb2 from google.protobuf import duration_pb2 from google.protobuf import struct_pb2 from google.protobuf import timestamp_pb2 -from google.protobuf.internal import _parameterized +from absl.testing import parameterized from google.protobuf import unittest_pb2 try: @@ -38,7 +38,7 @@ except ImportError: has_zoneinfo = False -class TimeUtilTestBase(_parameterized.TestCase): +class TimeUtilTestBase(parameterized.TestCase): def CheckTimestampConversion(self, message, text): self.assertEqual(text, message.ToJsonString()) @@ -270,7 +270,7 @@ class TimeUtilTest(TimeUtilTestBase): self.assertEqual(naive_min_datetime, ts.ToDatetime()) # Two hours after the Unix Epoch, around the world. - @_parameterized.named_parameters( + @parameterized.named_parameters( ('London', [1970, 1, 1, 2], datetime.timezone.utc), ('Tokyo', [1970, 1, 1, 11], _TZ_JAPAN), ('LA', [1969, 12, 31, 18], _TZ_PACIFIC), @@ -355,7 +355,7 @@ class TimeUtilTest(TimeUtilTestBase): ) # Two hours after the Unix Epoch, around the world. - @_parameterized.named_parameters( + @parameterized.named_parameters( ('London', [1970, 1, 1, 2], datetime.timezone.utc), ('Tokyo', [1970, 1, 1, 11], _TZ_JAPAN), ('LA', [1969, 12, 31, 18], _TZ_PACIFIC), @@ -368,7 +368,7 @@ class TimeUtilTest(TimeUtilTestBase): self.assertEqual(0, msg.optional_timestamp.nanos) # Two hours after the Unix Epoch, around the world. - @_parameterized.named_parameters( + @parameterized.named_parameters( ('London', [1970, 1, 1, 2], datetime.timezone.utc), ('Tokyo', [1970, 1, 1, 11], _TZ_JAPAN), ('LA', [1969, 12, 31, 18], _TZ_PACIFIC), @@ -387,7 +387,7 @@ class TimeUtilTest(TimeUtilTestBase): self.assertEqual(7200, msg2.optional_timestamp.seconds) self.assertEqual(0, msg2.optional_timestamp.nanos) - @_parameterized.named_parameters( + @parameterized.named_parameters( ( 'tz_aware_min_dt', datetime.datetime(1, 1, 1, tzinfo=datetime.timezone.utc), @@ -426,7 +426,7 @@ class TimeUtilTest(TimeUtilTestBase): self.assertEqual(expected_sec, new_msg3.optional_timestamp.seconds) self.assertEqual(expected_nano, new_msg3.optional_timestamp.nanos) - @_parameterized.named_parameters( + @parameterized.named_parameters( ( 'test1', datetime.datetime(999, 1, 1, tzinfo=datetime.timezone.utc), @@ -593,7 +593,7 @@ class TimeUtilTest(TimeUtilTestBase): with self.assertRaises(TypeError): 123 - msg.optional_duration - @_parameterized.named_parameters( + @parameterized.named_parameters( ('test1', -1999999, -1, -999999000), ('test2', 1999999, 1, 999999000) ) def testDurationAssignment(self, microseconds, expected_sec, expected_nano): @@ -604,7 +604,7 @@ class TimeUtilTest(TimeUtilTestBase): self.assertEqual(expected_sec, message.optional_duration.seconds) self.assertEqual(expected_nano, message.optional_duration.nanos) - @_parameterized.named_parameters( + @parameterized.named_parameters( ('test1', -1999999, -1, -999999000), ('test2', 1999999, 1, 999999000) ) def testDurationCreation(self, microseconds, expected_sec, expected_nano): @@ -616,7 +616,7 @@ class TimeUtilTest(TimeUtilTestBase): self.assertEqual(expected_sec, message.optional_duration.seconds) self.assertEqual(expected_nano, message.optional_duration.nanos) - @_parameterized.named_parameters( + @parameterized.named_parameters( ( 'tz_aware_min_dt', datetime.datetime(1, 1, 1, tzinfo=datetime.timezone.utc), @@ -655,7 +655,7 @@ class TimeUtilTest(TimeUtilTestBase): self.assertEqual(expected_sec, msg3.optional_timestamp.seconds) self.assertEqual(expected_nano, msg3.optional_timestamp.nanos) - @_parameterized.named_parameters( + @parameterized.named_parameters( ( 'test1', datetime.datetime(999, 1, 1, tzinfo=datetime.timezone.utc), diff --git a/third_party/protobuf/python/google/protobuf/json_format.py b/third_party/protobuf/python/google/protobuf/json_format.py index 2a6bba9391bd3..3eafd132159ec 100644 --- a/third_party/protobuf/python/google/protobuf/json_format.py +++ b/third_party/protobuf/python/google/protobuf/json_format.py @@ -497,6 +497,7 @@ def ParseDict( _INT_OR_FLOAT = (int, float) +_LIST_LIKE = (list, tuple) class _Parser(object): @@ -638,7 +639,7 @@ class _Parser(object): ) elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED: message.ClearField(field.name) - if not isinstance(value, list): + if not isinstance(value, _LIST_LIKE): raise ParseError( 'repeated field {0} must be in [] which is {1} at {2}'.format( name, value, path @@ -733,8 +734,10 @@ class _Parser(object): )(self) else: del value['@type'] - self._ConvertFieldValuePair(value, sub_message, path) - value['@type'] = type_url + try: + self._ConvertFieldValuePair(value, sub_message, path) + finally: + value['@type'] = type_url # Sets Any message message.value = sub_message.SerializeToString() message.type_url = type_url @@ -752,8 +755,8 @@ class _Parser(object): """Convert a JSON representation into Value message.""" if isinstance(value, dict): self._ConvertStructMessage(value, message.struct_value, path) - elif isinstance(value, list): - self._ConvertListValueMessage(value, message.list_value, path) + elif isinstance(value, _LIST_LIKE): + self._ConvertListOrTupleValueMessage(value, message.list_value, path) elif value is None: message.null_value = 0 elif isinstance(value, bool): @@ -769,9 +772,9 @@ class _Parser(object): ) ) - def _ConvertListValueMessage(self, value, message, path): + def _ConvertListOrTupleValueMessage(self, value, message, path): """Convert a JSON representation into ListValue message.""" - if not isinstance(value, list): + if not isinstance(value, _LIST_LIKE): raise ParseError( 'ListValue must be in [] which is {0} at {1}'.format(value, path) ) @@ -971,7 +974,20 @@ def _ConvertInteger(value): 'Bool value {0} is not acceptable for integer field'.format(value) ) - return int(value) + try: + return int(value) + except ValueError as e: + # Attempt to parse as an integer-valued float. + try: + f = float(value) + except ValueError: + # Raise the original exception for the int parse. + raise e # pylint: disable=raise-missing-from + if not f.is_integer(): + raise ParseError( + 'Couldn\'t parse non-integer string: "{0}"'.format(value) + ) from e + return int(f) def _ConvertFloat(value, field): @@ -1052,7 +1068,7 @@ _WKTJSONMETHODS = { ], 'google.protobuf.ListValue': [ '_ListValueMessageToJsonObject', - '_ConvertListValueMessage', + '_ConvertListOrTupleValueMessage', ], 'google.protobuf.Struct': [ '_StructMessageToJsonObject', diff --git a/third_party/protobuf/python/google/protobuf/message.py b/third_party/protobuf/python/google/protobuf/message.py index ae9cb147e326f..d48f4f409d055 100755 --- a/third_party/protobuf/python/google/protobuf/message.py +++ b/third_party/protobuf/python/google/protobuf/message.py @@ -13,6 +13,9 @@ __author__ = 'robinson@google.com (Will Robinson)' +_INCONSISTENT_MESSAGE_ATTRIBUTES = ('Extensions',) + + class Error(Exception): """Base error type for this module.""" pass @@ -56,6 +59,29 @@ class Message(object): clone.MergeFrom(self) return clone + def __dir__(self): + """Provides the list of all accessible Message attributes.""" + message_attributes = set(super().__dir__()) + + # TODO: Remove this once the UPB implementation is improved. + # The UPB proto implementation currently doesn't provide proto fields as + # attributes and they have to added. + if self.DESCRIPTOR is not None: + for field in self.DESCRIPTOR.fields: + message_attributes.add(field.name) + + # The Fast C++ proto implementation provides inaccessible attributes that + # have to be removed. + for attribute in _INCONSISTENT_MESSAGE_ATTRIBUTES: + if attribute not in message_attributes: + continue + try: + getattr(self, attribute) + except AttributeError: + message_attributes.remove(attribute) + + return sorted(message_attributes) + def __eq__(self, other_msg): """Recursively compares two messages by value and structure.""" raise NotImplementedError diff --git a/third_party/protobuf/python/google/protobuf/message_factory.py b/third_party/protobuf/python/google/protobuf/message_factory.py index 05e330d076869..9b64ff05b846c 100644 --- a/third_party/protobuf/python/google/protobuf/message_factory.py +++ b/third_party/protobuf/python/google/protobuf/message_factory.py @@ -142,69 +142,6 @@ class MessageFactory(object): """Initializes a new factory.""" self.pool = pool or descriptor_pool.DescriptorPool() - def GetPrototype(self, descriptor): - """Obtains a proto2 message class based on the passed in descriptor. - - Passing a descriptor with a fully qualified name matching a previous - invocation will cause the same class to be returned. - - Args: - descriptor: The descriptor to build from. - - Returns: - A class describing the passed in descriptor. - """ - warnings.warn( - 'MessageFactory class is deprecated. Please use ' - 'GetMessageClass() instead of MessageFactory.GetPrototype. ' - 'MessageFactory class will be removed after 2024.', - stacklevel=2, - ) - return GetMessageClass(descriptor) - - def CreatePrototype(self, descriptor): - """Builds a proto2 message class based on the passed in descriptor. - - Don't call this function directly, it always creates a new class. Call - GetMessageClass() instead. - - Args: - descriptor: The descriptor to build from. - - Returns: - A class describing the passed in descriptor. - """ - warnings.warn( - 'Directly call CreatePrototype is wrong. Please use ' - 'GetMessageClass() method instead. Directly use ' - 'CreatePrototype will raise error after July 2023.', - stacklevel=2, - ) - return _InternalCreateMessageClass(descriptor) - - def GetMessages(self, files): - """Gets all the messages from a specified file. - - This will find and resolve dependencies, failing if the descriptor - pool cannot satisfy them. - - Args: - files: The file names to extract messages from. - - Returns: - A dictionary mapping proto names to the message classes. This will include - any dependent messages as well as any messages defined in the same file as - a specified message. - """ - warnings.warn( - 'MessageFactory class is deprecated. Please use ' - 'GetMessageClassesForFiles() instead of ' - 'MessageFactory.GetMessages(). MessageFactory class ' - 'will be removed after 2024.', - stacklevel=2, - ) - return GetMessageClassesForFiles(files, self.pool) - def GetMessages(file_protos, pool=None): """Builds a dictionary of all the messages available in a set of files. diff --git a/third_party/protobuf/python/google/protobuf/proto.py b/third_party/protobuf/python/google/protobuf/proto.py index df0a0d02d98c8..1e6291c3ae4a6 100644 --- a/third_party/protobuf/python/google/protobuf/proto.py +++ b/third_party/protobuf/python/google/protobuf/proto.py @@ -8,7 +8,7 @@ """Contains the Nextgen Pythonic protobuf APIs.""" import io -from typing import Type, TypeVar +from typing import Text, Type, TypeVar from google.protobuf.internal import decoder from google.protobuf.internal import encoder @@ -114,3 +114,40 @@ def parse_length_prefixed( '{2}.'.format(size, parsed_size, message.DESCRIPTOR.name) ) return message + + +def byte_size(message: Message) -> int: + """Returns the serialized size of this message. + + Args: + message: A proto message. + + Returns: + int: The number of bytes required to serialize this message. + """ + return message.ByteSize() + + +def clear_message(message: Message) -> None: + """Clears all data that was set in the message. + + Args: + message: The proto message to be cleared. + """ + message.Clear() + + +def clear_field(message: Message, field_name: Text) -> None: + """Clears the contents of a given field. + + Inside a oneof group, clears the field set. If the name neither refers to a + defined field or oneof group, :exc:`ValueError` is raised. + + Args: + message: The proto message. + field_name (str): The name of the field to be cleared. + + Raises: + ValueError: if the `field_name` is not a member of this message. + """ + message.ClearField(field_name) diff --git a/third_party/protobuf/python/google/protobuf/proto_api.cc b/third_party/protobuf/python/google/protobuf/proto_api.cc new file mode 100644 index 0000000000000..299c03a56a529 --- /dev/null +++ b/third_party/protobuf/python/google/protobuf/proto_api.cc @@ -0,0 +1,142 @@ +#include "google/protobuf/proto_api.h" + +#include <Python.h> + +#include <memory> +#include <string> + +#include "absl/log/absl_check.h" +#include "google/protobuf/io/zero_copy_stream_impl_lite.h" +#include "google/protobuf/message.h" +namespace google { +namespace protobuf { +namespace python { + +PythonMessageMutator::PythonMessageMutator(Message* owned_msg, Message* message, + PyObject* py_msg) + : owned_msg_(owned_msg), message_(message), py_msg_(py_msg) { + ABSL_DCHECK(py_msg != nullptr); + ABSL_DCHECK(message != nullptr); + Py_INCREF(py_msg_); +} + +PythonMessageMutator::PythonMessageMutator(PythonMessageMutator&& other) + : owned_msg_(other.owned_msg_ == nullptr ? nullptr + : other.owned_msg_.release()), + message_(other.message_), + py_msg_(other.py_msg_) { + other.message_ = nullptr; + other.py_msg_ = nullptr; +} + +PythonMessageMutator::~PythonMessageMutator() { + if (py_msg_ == nullptr) { + return; + } + + // PyErr_Occurred check is required because PyObject_CallMethod need this + // check. + if (!PyErr_Occurred() && owned_msg_ != nullptr) { + std::string wire; + message_->SerializeToString(&wire); + PyObject* py_wire = PyBytes_FromStringAndSize( + wire.data(), static_cast<Py_ssize_t>(wire.size())); + PyObject* parse = + PyObject_CallMethod(py_msg_, "ParseFromString", "O", py_wire); + Py_DECREF(py_wire); + if (parse != nullptr) { + Py_DECREF(parse); + } + } + Py_DECREF(py_msg_); +} + +PythonMessageMutator PyProto_API::CreatePythonMessageMutator( + Message* owned_msg, Message* msg, PyObject* py_msg) const { + return PythonMessageMutator(owned_msg, msg, py_msg); +} + +PythonConstMessagePointer::PythonConstMessagePointer(Message* owned_msg, + const Message* message, + PyObject* py_msg) + : owned_msg_(owned_msg), message_(message), py_msg_(py_msg) { + ABSL_DCHECK(py_msg != nullptr); + ABSL_DCHECK(message != nullptr); + Py_INCREF(py_msg_); +} + +PythonConstMessagePointer::PythonConstMessagePointer( + PythonConstMessagePointer&& other) + : owned_msg_(other.owned_msg_ == nullptr ? nullptr + : other.owned_msg_.release()), + message_(other.message_), + py_msg_(other.py_msg_) { + other.message_ = nullptr; + other.py_msg_ = nullptr; +} + +bool PythonConstMessagePointer::NotChanged() { + ABSL_DCHECK(!PyErr_Occurred()); + if (owned_msg_ == nullptr) { + return false; + } + + PyObject* py_serialized_pb( + PyObject_CallMethod(py_msg_, "SerializeToString", nullptr)); + if (py_serialized_pb == nullptr) { + PyErr_Format(PyExc_ValueError, "Fail to serialize py_msg"); + return false; + } + char* data; + Py_ssize_t len; + if (PyBytes_AsStringAndSize(py_serialized_pb, &data, &len) < 0) { + Py_DECREF(py_serialized_pb); + PyErr_Format(PyExc_ValueError, "Fail to get bytes from serialized data"); + return false; + } + + // Even if serialize python message deterministic above, the + // serialize result may still diff between languages. So parse to + // another c++ message for compare. + std::unique_ptr<google::protobuf::Message> parsed_msg(owned_msg_->New()); + parsed_msg->ParseFromArray(data, static_cast<int>(len)); + std::string wire_other; + google::protobuf::io::StringOutputStream stream_other(&wire_other); + google::protobuf::io::CodedOutputStream output_other(&stream_other); + output_other.SetSerializationDeterministic(true); + parsed_msg->SerializeToCodedStream(&output_other); + + std::string wire; + google::protobuf::io::StringOutputStream stream(&wire); + google::protobuf::io::CodedOutputStream output(&stream); + output.SetSerializationDeterministic(true); + owned_msg_->SerializeToCodedStream(&output); + + if (wire == wire_other) { + Py_DECREF(py_serialized_pb); + return true; + } + PyErr_Format(PyExc_ValueError, "pymessage has been changed"); + Py_DECREF(py_serialized_pb); + return false; +} + +PythonConstMessagePointer::~PythonConstMessagePointer() { + if (py_msg_ == nullptr) { + ABSL_DCHECK(message_ == nullptr); + ABSL_DCHECK(owned_msg_ == nullptr); + return; + } + ABSL_DCHECK(owned_msg_ != nullptr); + ABSL_DCHECK(NotChanged()); + Py_DECREF(py_msg_); +} + +PythonConstMessagePointer PyProto_API::CreatePythonConstMessagePointer( + Message* owned_msg, const Message* msg, PyObject* py_msg) const { + return PythonConstMessagePointer(owned_msg, msg, py_msg); +} + +} // namespace python +} // namespace protobuf +} // namespace google diff --git a/third_party/protobuf/python/google/protobuf/proto_api.h b/third_party/protobuf/python/google/protobuf/proto_api.h index 558fff084f180..96cac8288cb63 100644 --- a/third_party/protobuf/python/google/protobuf/proto_api.h +++ b/third_party/protobuf/python/google/protobuf/proto_api.h @@ -17,21 +17,29 @@ // PyProtoAPICapsuleName(), 0)); // if (!py_proto_api) { ...handle ImportError... } // Then use the methods of the returned class: -// py_proto_api->GetMessagePointer(...); +// py_proto_api->GetConstMessagePointer(...); #ifndef GOOGLE_PROTOBUF_PYTHON_PROTO_API_H__ #define GOOGLE_PROTOBUF_PYTHON_PROTO_API_H__ +#include <cstddef> +#include <string> #define PY_SSIZE_T_CLEAN #include <Python.h> +#include "absl/status/status.h" #include "google/protobuf/descriptor_database.h" #include "google/protobuf/message.h" +PyObject* pymessage_mutate_const(PyObject* self, PyObject* args); + namespace google { namespace protobuf { namespace python { +class PythonMessageMutator; +class PythonConstMessagePointer; + // Note on the implementation: // This API is designed after // https://docs.python.org/3/extending/extending.html#providing-a-c-api-for-an-extension-module @@ -45,8 +53,33 @@ struct PyProto_API { // Operations on Messages. + // Returns a PythonMessageMutator which the python message has been cleared. + // This API works with UPB, Cpp Extension and Pure Python. + // Side-effect: The message will definitely be cleared. *When* the message + // gets cleared is undefined (C++ will clear it up-front, python/upb will + // clear it on destruction). Nothing should rely on the python message + // during the lifetime of this object. + // User should not hold onto the returned PythonMessageMutator while + // calling back into Python. + // Warning: there is a risk of deadlock with Python/C++ if users use the + // returned message->GetDescriptor()->file->pool() + virtual absl::StatusOr<PythonMessageMutator> GetClearedMessageMutator( + PyObject* msg) const = 0; + + // Returns a PythonConstMessagePointer. For UPB and Pure Python, it points + // to a new c++ message copied from python message. For cpp extension, it + // points the internal c++ message. + // User should not hold onto the returned PythonConstMessagePointer + // while calling back into Python. + virtual absl::StatusOr<PythonConstMessagePointer> GetConstMessagePointer( + PyObject* msg) const = 0; + // If the passed object is a Python Message, returns its internal pointer. // Otherwise, returns NULL with an exception set. + // TODO: Remove deprecated GetMessagePointer(). + [[deprecated( + "GetMessagePointer() only work with Cpp Extension, " + "please migrate to GetConstMessagePointer().")]] virtual const Message* GetMessagePointer(PyObject* msg) const = 0; // If the passed object is a Python Message, returns a mutable pointer. @@ -54,6 +87,10 @@ struct PyProto_API { // This function will succeed only if there are no other Python objects // pointing to the message, like submessages or repeated containers. // With the current implementation, only empty messages are in this case. + // TODO: Remove deprecated GetMutableMessagePointer(). + [[deprecated( + "GetMutableMessagePointer() only work with Cpp Extension, " + "please migrate to GetClearedMessageMutator().")]] virtual Message* GetMutableMessagePointer(PyObject* msg) const = 0; // If the passed object is a Python Message Descriptor, returns its internal @@ -107,6 +144,59 @@ struct PyProto_API { // can work and return their Python counterparts. virtual PyObject* DescriptorPool_FromPool( const google::protobuf::DescriptorPool* pool) const = 0; + + protected: + PythonMessageMutator CreatePythonMessageMutator(Message* owned_msg, + Message* msg, + PyObject* py_msg) const; + PythonConstMessagePointer CreatePythonConstMessagePointer( + Message* owned_msg, const Message* msg, PyObject* py_msg) const; +}; + +// User should not hold onto this object while calling back into Python +class PythonMessageMutator { + public: + PythonMessageMutator(PythonMessageMutator&& other); + ~PythonMessageMutator(); + + Message* get() { return message_; } + Message* operator->() { return message_; } + const Message& operator*() { return *message_; } + + private: + friend struct google::protobuf::python::PyProto_API; + PythonMessageMutator(Message* owned_msg, Message* message, PyObject* py_msg); + // owned_msg_ is set for UPB/Pure Python. Cpp + // Extension should not set owned_msg_. + // owned_msg_ is a new Message for UPB/Pure Python. + // owned_msg_ is nullptr for Cpp Extension. + std::unique_ptr<Message> owned_msg_; + // message_ points to owned_msg_ for UPB/Pure Python. + // message_ points to in-place Message* for Cpp Extension. + Message* message_; + // py_msg_ points to the python message. message_ content will be serialized + // to py_msg_ at destructor for UPB/Pure Python, CPP Extension won't. + PyObject* py_msg_; +}; + +class PythonConstMessagePointer { + public: + PythonConstMessagePointer(PythonConstMessagePointer&& other); + ~PythonConstMessagePointer(); + + const Message& get() { return *message_; } + + private: + friend struct google::protobuf::python::PyProto_API; + PythonConstMessagePointer(Message* owned_msg, const Message* message, + PyObject* py_msg); + + friend PyObject* ::pymessage_mutate_const(PyObject* self, PyObject* args); + // Check if the const message has been changed. + bool NotChanged(); + std::unique_ptr<Message> owned_msg_; + const Message* message_; + PyObject* py_msg_; }; inline const char* PyProtoAPICapsuleName() { diff --git a/third_party/protobuf/python/google/protobuf/proto_text.py b/third_party/protobuf/python/google/protobuf/proto_text.py new file mode 100644 index 0000000000000..169fb4fce21f9 --- /dev/null +++ b/third_party/protobuf/python/google/protobuf/proto_text.py @@ -0,0 +1,129 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2025 Google Inc. All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd + +"""Contains the Nextgen Pythonic Protobuf Text Format APIs.""" +from typing import AnyStr, Callable, Optional, Text, Type, Union + +from google.protobuf import text_format +from google.protobuf.descriptor_pool import DescriptorPool +from google.protobuf.message import Message + +_MsgFormatter = Callable[[Message, Union[int, bool], bool], Optional[Text]] + + +def serialize( + message: Message, + as_utf8: bool = True, + as_one_line: bool = False, + use_short_repeated_primitives: bool = False, + pointy_brackets: bool = False, + use_index_order: bool = False, + float_format: Optional[str] = None, + double_format: Optional[str] = None, + use_field_number: bool = False, + descriptor_pool: Optional[DescriptorPool] = None, + indent: int = 0, + message_formatter: Optional[_MsgFormatter] = None, + print_unknown_fields: bool = False, + force_colon: bool = False, +) -> str: + """Convert protobuf message to text format. + + Double values can be formatted compactly with 15 digits of + precision (which is the most that IEEE 754 "double" can guarantee) + using double_format='.15g'. To ensure that converting to text and back to a + proto will result in an identical value, double_format='.17g' should be used. + + Args: + message: The protocol buffers message. + as_utf8: Return unescaped Unicode for non-ASCII characters. + as_one_line: Don't introduce newlines between fields. + use_short_repeated_primitives: Use short repeated format for primitives. + pointy_brackets: If True, use angle brackets instead of curly braces for + nesting. + use_index_order: If True, fields of a proto message will be printed using + the order defined in source code instead of the field number, extensions + will be printed at the end of the message and their relative order is + determined by the extension number. By default, use the field number + order. + float_format (str): If set, use this to specify float field formatting (per + the "Format Specification Mini-Language"); otherwise, shortest float that + has same value in wire will be printed. Also affect double field if + double_format is not set but float_format is set. + double_format (str): If set, use this to specify double field formatting + (per the "Format Specification Mini-Language"); if it is not set but + float_format is set, use float_format. Otherwise, use ``str()`` + use_field_number: If True, print field numbers instead of names. + descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types. + indent (int): The initial indent level, in terms of spaces, for pretty + print. + message_formatter (function(message, indent, as_one_line) -> unicode|None): + Custom formatter for selected sub-messages (usually based on message + type). Use to pretty print parts of the protobuf for easier diffing. + print_unknown_fields: If True, unknown fields will be printed. + force_colon: If set, a colon will be added after the field name even if the + field is a proto message. + + Returns: + str: A string of the text formatted protocol buffer message. + """ + return text_format.MessageToString( + message=message, + as_utf8=as_utf8, + as_one_line=as_one_line, + use_short_repeated_primitives=use_short_repeated_primitives, + pointy_brackets=pointy_brackets, + use_index_order=use_index_order, + float_format=float_format, + double_format=double_format, + use_field_number=use_field_number, + descriptor_pool=descriptor_pool, + indent=indent, + message_formatter=message_formatter, + print_unknown_fields=print_unknown_fields, + force_colon=force_colon, + ) + + +def parse( + message_class: Type[Message], + text: AnyStr, + allow_unknown_extension: bool = False, + allow_field_number: bool = False, + descriptor_pool: Optional[DescriptorPool] = None, + allow_unknown_field: bool = False, +) -> Message: + """Parses a text representation of a protocol message into a message. + + Args: + message_class: The message meta class. + text (str): Message text representation. + message (Message): A protocol buffer message to merge into. + allow_unknown_extension: if True, skip over missing extensions and keep + parsing + allow_field_number: if True, both field number and field name are allowed. + descriptor_pool (DescriptorPool): Descriptor pool used to resolve Any types. + allow_unknown_field: if True, skip over unknown field and keep parsing. + Avoid to use this option if possible. It may hide some errors (e.g. + spelling error on field name) + + Returns: + Message: A new message passed from text. + + Raises: + ParseError: On text parsing problems. + """ + new_message = message_class() + text_format.Parse( + text=text, + message=new_message, + allow_unknown_extension=allow_unknown_extension, + allow_field_number=allow_field_number, + descriptor_pool=descriptor_pool, + allow_unknown_field=allow_unknown_field, + ) + return new_message diff --git a/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc b/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc index c4b9f5e2dda5a..490c762a95b5e 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc +++ b/third_party/protobuf/python/google/protobuf/pyext/descriptor.cc @@ -1512,15 +1512,6 @@ static int SetHasOptions(PyFileDescriptor *self, PyObject *value, return CheckCalledFromGeneratedFile("has_options"); } -static PyObject* GetDebugString(PyFileDescriptor* self) { - PyErr_Warn(nullptr, - "GetDebugString() API is deprecated. This API only " - "exists in protobuf c++ and does not exists in pure python, upb " - "or any other languages. GetDebugString() for python cpp " - "extension will be removed in Jan 2025"); - return PyString_FromCppString(_GetDescriptor(self)->DebugString()); -} - static PyObject* GetOptions(PyFileDescriptor *self) { return GetOrBuildOptions(_GetDescriptor(self)); } @@ -1569,7 +1560,6 @@ static PyGetSetDef Getters[] = { }; static PyMethodDef Methods[] = { - {"GetDebugString", (PyCFunction)GetDebugString, METH_NOARGS}, {"GetOptions", (PyCFunction)GetOptions, METH_NOARGS}, {"_GetFeatures", (PyCFunction)GetFeatures, METH_NOARGS}, {"CopyToProto", (PyCFunction)CopyToProto, METH_O}, @@ -1842,6 +1832,15 @@ static PyObject* FindMethodByName(PyBaseDescriptor *self, PyObject* arg) { return PyMethodDescriptor_FromDescriptor(method_descriptor); } +static PyObject* GetHasOptions(PyBaseDescriptor* self, void* closure) { + const ServiceOptions& options = _GetDescriptor(self)->options(); + if (&options != &ServiceOptions::default_instance()) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } +} + static PyObject* GetOptions(PyBaseDescriptor *self) { return GetOrBuildOptions(_GetDescriptor(self)); } @@ -1863,6 +1862,7 @@ static PyGetSetDef Getters[] = { {"methods", (getter)GetMethods, nullptr, "Methods", nullptr}, {"methods_by_name", (getter)GetMethodsByName, nullptr, "Methods by name", nullptr}, + {"has_options", (getter)GetHasOptions, nullptr}, {nullptr}, }; @@ -1973,6 +1973,15 @@ static PyObject* GetServerStreaming(PyBaseDescriptor* self, void* closure) { return PyBool_FromLong(_GetDescriptor(self)->server_streaming() ? 1 : 0); } +static PyObject* GetHasOptions(PyBaseDescriptor* self, void* closure) { + const MethodOptions& options = _GetDescriptor(self)->options(); + if (&options != &MethodOptions::default_instance()) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } +} + static PyObject* GetOptions(PyBaseDescriptor *self) { return GetOrBuildOptions(_GetDescriptor(self)); } @@ -1997,6 +2006,7 @@ static PyGetSetDef Getters[] = { "Client streaming", nullptr}, {"server_streaming", (getter)GetServerStreaming, nullptr, "Server streaming", nullptr}, + {"has_options", (getter)GetHasOptions, nullptr}, {nullptr}, }; diff --git a/third_party/protobuf/python/google/protobuf/pyext/descriptor_pool.h b/third_party/protobuf/python/google/protobuf/pyext/descriptor_pool.h index b2ce55ce5100b..929a73a51ce60 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/descriptor_pool.h +++ b/third_party/protobuf/python/google/protobuf/pyext/descriptor_pool.h @@ -32,10 +32,12 @@ struct CMessageClass; // "Methods" that interacts with this DescriptorPool are in the cdescriptor_pool // namespace. typedef struct PyDescriptorPool { - PyObject_HEAD; + // clang-format off + PyObject_HEAD // The C++ pool containing Descriptors. const DescriptorPool* pool; + // clang-format on // True if we should free the pointer above. bool is_owned; @@ -70,7 +72,6 @@ typedef struct PyDescriptorPool { absl::flat_hash_map<const void*, PyObject*>* descriptor_features; } PyDescriptorPool; - extern PyTypeObject PyDescriptorPool_Type; namespace cdescriptor_pool { diff --git a/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc b/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc index 3f0d72237030f..1d4d51ed2fec5 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc +++ b/third_party/protobuf/python/google/protobuf/pyext/extension_dict.cc @@ -15,6 +15,7 @@ #include <vector> #include "google/protobuf/descriptor.pb.h" +#include "absl/strings/string_view.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/message.h" @@ -24,7 +25,6 @@ #include "google/protobuf/pyext/repeated_composite_container.h" #include "google/protobuf/pyext/repeated_scalar_container.h" #include "google/protobuf/pyext/scoped_pyobject_ptr.h" -#include "absl/strings/string_view.h" #define PyString_AsStringAndSize(ob, charpp, sizep) \ (PyUnicode_Check(ob) \ @@ -66,8 +66,10 @@ static Py_ssize_t len(ExtensionDict* self) { } struct ExtensionIterator { - PyObject_HEAD; + // clang-format off + PyObject_HEAD Py_ssize_t index; + // clang-format on std::vector<const FieldDescriptor*> fields; // Owned reference, to keep the FieldDescriptors alive. @@ -131,8 +133,8 @@ PyObject* subscript(ExtensionDict* self, PyObject* key) { if (descriptor->label() != FieldDescriptor::LABEL_REPEATED && descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { // TODO: consider building the class on the fly! - ContainerBase* sub_message = cmessage::InternalGetSubMessage( - self->parent, descriptor); + ContainerBase* sub_message = + cmessage::InternalGetSubMessage(self->parent, descriptor); if (sub_message == nullptr) { return nullptr; } @@ -156,7 +158,7 @@ PyObject* subscript(ExtensionDict* self, PyObject* key) { cmessage::GetFactoryForMessage(self->parent), descriptor->message_type()); ScopedPyObjectPtr message_class_handler( - reinterpret_cast<PyObject*>(message_class)); + reinterpret_cast<PyObject*>(message_class)); if (message_class == nullptr) { return nullptr; } @@ -168,8 +170,8 @@ PyObject* subscript(ExtensionDict* self, PyObject* key) { (*self->parent->composite_fields)[descriptor] = py_container; return py_container->AsPyObject(); } else { - ContainerBase* py_container = repeated_scalar_container::NewContainer( - self->parent, descriptor); + ContainerBase* py_container = + repeated_scalar_container::NewContainer(self->parent, descriptor); if (py_container == nullptr) { return nullptr; } @@ -196,7 +198,8 @@ int ass_subscript(ExtensionDict* self, PyObject* key, PyObject* value) { if (descriptor->label() != FieldDescriptor::LABEL_OPTIONAL || descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - PyErr_SetString(PyExc_TypeError, "Extension is repeated and/or composite " + PyErr_SetString(PyExc_TypeError, + "Extension is repeated and/or composite " "type"); return -1; } @@ -207,6 +210,21 @@ int ass_subscript(ExtensionDict* self, PyObject* key, PyObject* value) { return 0; } +static const FieldDescriptor* FindMessageSetExtension( + const Descriptor* message_descriptor) { + for (int i = 0; i < message_descriptor->extension_count(); i++) { + const FieldDescriptor* extension = message_descriptor->extension(i); + if (extension->is_extension() && + extension->containing_type()->options().message_set_wire_format() && + extension->type() == FieldDescriptor::TYPE_MESSAGE && + extension->label() == FieldDescriptor::LABEL_OPTIONAL && + extension->message_type() == message_descriptor) { + return extension; + } + } + return nullptr; +} + PyObject* _FindExtensionByName(ExtensionDict* self, PyObject* arg) { char* name; Py_ssize_t name_size; @@ -221,14 +239,8 @@ PyObject* _FindExtensionByName(ExtensionDict* self, PyObject* arg) { // Is is the name of a message set extension? const Descriptor* message_descriptor = pool->pool->FindMessageTypeByName(absl::string_view(name, name_size)); - if (message_descriptor && message_descriptor->extension_count() > 0) { - const FieldDescriptor* extension = message_descriptor->extension(0); - if (extension->is_extension() && - extension->containing_type()->options().message_set_wire_format() && - extension->type() == FieldDescriptor::TYPE_MESSAGE && - extension->label() == FieldDescriptor::LABEL_OPTIONAL) { - message_extension = extension; - } + if (message_descriptor) { + message_extension = FindMessageSetExtension(message_descriptor); } } if (message_extension == nullptr) { @@ -283,7 +295,7 @@ static int Contains(PyObject* _self, PyObject* key) { return 0; } -ExtensionDict* NewExtensionDict(CMessage *parent) { +ExtensionDict* NewExtensionDict(CMessage* parent) { ExtensionDict* self = reinterpret_cast<ExtensionDict*>( PyType_GenericAlloc(&ExtensionDict_Type, 0)); if (self == nullptr) { @@ -329,12 +341,12 @@ static PySequenceMethods SeqMethods = { }; static PyMappingMethods MpMethods = { - (lenfunc)len, /* mp_length */ - (binaryfunc)subscript, /* mp_subscript */ - (objobjargproc)ass_subscript,/* mp_ass_subscript */ + (lenfunc)len, /* mp_length */ + (binaryfunc)subscript, /* mp_subscript */ + (objobjargproc)ass_subscript, /* mp_ass_subscript */ }; -#define EDMETHOD(name, args, doc) { #name, (PyCFunction)name, args, doc } +#define EDMETHOD(name, args, doc) {#name, (PyCFunction)name, args, doc} static PyMethodDef Methods[] = { EDMETHOD(_FindExtensionByName, METH_O, "Finds an extension by name."), EDMETHOD(_FindExtensionByNumber, METH_O, diff --git a/third_party/protobuf/python/google/protobuf/pyext/extension_dict.h b/third_party/protobuf/python/google/protobuf/pyext/extension_dict.h index f5052da6448ed..00bcacf144877 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/extension_dict.h +++ b/third_party/protobuf/python/google/protobuf/pyext/extension_dict.h @@ -25,10 +25,12 @@ class FieldDescriptor; namespace python { typedef struct ExtensionDict { - PyObject_HEAD; + // clang-format off + PyObject_HEAD // Strong, owned reference to the parent message. Never NULL. CMessage* parent; + // clang-format on } ExtensionDict; extern PyTypeObject ExtensionDict_Type; @@ -37,7 +39,7 @@ extern PyTypeObject ExtensionIterator_Type; namespace extension_dict { // Builds an Extensions dict for a specific message. -ExtensionDict* NewExtensionDict(CMessage *parent); +ExtensionDict* NewExtensionDict(CMessage* parent); } // namespace extension_dict } // namespace python diff --git a/third_party/protobuf/python/google/protobuf/pyext/field.h b/third_party/protobuf/python/google/protobuf/pyext/field.h index 9f77176c3085b..0da9ba82c0cb6 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/field.h +++ b/third_party/protobuf/python/google/protobuf/pyext/field.h @@ -20,10 +20,12 @@ namespace python { // A data descriptor that represents a field in a Message class. struct PyMessageFieldProperty { - PyObject_HEAD; + // clang-format off + PyObject_HEAD // This pointer is owned by the same pool as the Message class it belongs to. const FieldDescriptor* field_descriptor; + // clang-format on }; extern PyTypeObject* CFieldProperty_Type; diff --git a/third_party/protobuf/python/google/protobuf/pyext/map_container.cc b/third_party/protobuf/python/google/protobuf/pyext/map_container.cc index 90c01228ccf49..02ff6b1316ab1 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/map_container.cc +++ b/third_party/protobuf/python/google/protobuf/pyext/map_container.cc @@ -32,7 +32,7 @@ class MapReflectionFriend { // Methods that are in common between the map types. static PyObject* Contains(PyObject* _self, PyObject* key); static Py_ssize_t Length(PyObject* _self); - static PyObject* GetIterator(PyObject *_self); + static PyObject* GetIterator(PyObject* _self); static PyObject* IterNext(PyObject* _self); static PyObject* MergeFrom(PyObject* _self, PyObject* arg); @@ -46,9 +46,11 @@ class MapReflectionFriend { }; struct MapIterator { - PyObject_HEAD; + // clang-format off + PyObject_HEAD std::unique_ptr<::google::protobuf::MapIterator> iter; + // clang-format on // A pointer back to the container, so we can notice changes to the version. // We own a ref on this. @@ -80,7 +82,7 @@ Message* MapContainer::GetMutableMessage() { // Consumes a reference on the Python string object. static bool PyStringToSTL(PyObject* py_string, std::string* stl_string) { - char *value; + char* value; Py_ssize_t value_len; if (!py_string) { @@ -134,9 +136,8 @@ static bool PythonToMapKey(MapContainer* self, PyObject* obj, MapKey* key, break; } default: - PyErr_Format( - PyExc_SystemError, "Type %d cannot be a map key", - field_descriptor->cpp_type()); + PyErr_Format(PyExc_SystemError, "Type %d cannot be a map key", + field_descriptor->cpp_type()); return false; } return true; @@ -159,9 +160,8 @@ static PyObject* MapKeyToPython(MapContainer* self, const MapKey& key) { case FieldDescriptor::CPPTYPE_STRING: return ToStringObject(field_descriptor, key.GetStringValue()); default: - PyErr_Format( - PyExc_SystemError, "Couldn't convert type %d to value", - field_descriptor->cpp_type()); + PyErr_Format(PyExc_SystemError, "Couldn't convert type %d to value", + field_descriptor->cpp_type()); return nullptr; } } @@ -191,9 +191,8 @@ PyObject* MapValueRefToPython(MapContainer* self, const MapValueRef& value) { case FieldDescriptor::CPPTYPE_ENUM: return PyLong_FromLong(value.GetEnumValue()); default: - PyErr_Format( - PyExc_SystemError, "Couldn't convert type %d to value", - field_descriptor->cpp_type()); + PyErr_Format(PyExc_SystemError, "Couldn't convert type %d to value", + field_descriptor->cpp_type()); return nullptr; } } @@ -269,9 +268,9 @@ static bool PythonToMapValueRef(MapContainer* self, PyObject* obj, break; } default: - PyErr_Format( - PyExc_SystemError, "Setting value to a field of unknown type %d", - field_descriptor->cpp_type()); + PyErr_Format(PyExc_SystemError, + "Setting value to a field of unknown type %d", + field_descriptor->cpp_type()); return false; } } @@ -320,8 +319,8 @@ PyObject* MapReflectionFriend::MergeFrom(PyObject* _self, PyObject* arg) { const Message* other_message = other_map->parent->message; const Reflection* reflection = message->GetReflection(); const Reflection* other_reflection = other_message->GetReflection(); - internal::MapFieldBase* field = reflection->MutableMapData( - message, self->parent_field_descriptor); + internal::MapFieldBase* field = + reflection->MutableMapData(message, self->parent_field_descriptor); const internal::MapFieldBase* other_field = other_reflection->GetMapData( *other_message, other_map->parent_field_descriptor); field->MergeFrom(*other_field); @@ -359,8 +358,7 @@ MapContainer* NewScalarMapContainer( PyObject* obj(PyType_GenericAlloc(ScalarMapContainer_Type, 0)); if (obj == nullptr) { - PyErr_Format(PyExc_RuntimeError, - "Could not allocate new container."); + PyErr_Format(PyExc_RuntimeError, "Could not allocate new container."); return nullptr; } @@ -438,6 +436,35 @@ int MapReflectionFriend::ScalarMapSetItem(PyObject* _self, PyObject* key, } } +static PyObject* ScalarMapSetdefault(PyObject* self, PyObject* args) { + PyObject* key = nullptr; + PyObject* default_value = Py_None; + + if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &default_value)) { + return nullptr; + } + + if (default_value == Py_None) { + PyErr_Format(PyExc_ValueError, + "The value for scalar map setdefault must be set."); + return nullptr; + } + + ScopedPyObjectPtr is_present(MapReflectionFriend::Contains(self, key)); + if (is_present == nullptr) { + return nullptr; + } + if (PyObject_IsTrue(is_present.get())) { + return MapReflectionFriend::ScalarMapGetItem(self, key); + } + + if (MapReflectionFriend::ScalarMapSetItem(self, key, default_value) < 0) { + return nullptr; + } + Py_INCREF(default_value); + return default_value; +} + static PyObject* ScalarMapGet(PyObject* self, PyObject* args, PyObject* kwargs) { static const char* kwlist[] = {"key", "default", nullptr}; @@ -477,10 +504,9 @@ PyObject* MapReflectionFriend::ScalarMapToStr(PyObject* _self) { MapContainer* self = GetMap(_self); Message* message = self->GetMutableMessage(); const Reflection* reflection = message->GetReflection(); - for (google::protobuf::MapIterator it = reflection->MapBegin( - message, self->parent_field_descriptor); - it != reflection->MapEnd(message, self->parent_field_descriptor); - ++it) { + for (google::protobuf::MapIterator it = + reflection->MapBegin(message, self->parent_field_descriptor); + it != reflection->MapEnd(message, self->parent_field_descriptor); ++it) { key.reset(MapKeyToPython(self, it.GetKey())); if (key == nullptr) { return nullptr; @@ -499,7 +525,7 @@ PyObject* MapReflectionFriend::ScalarMapToStr(PyObject* _self) { static void ScalarMapDealloc(PyObject* _self) { MapContainer* self = GetMap(_self); self->RemoveFromParentCache(); - PyTypeObject *type = Py_TYPE(_self); + PyTypeObject* type = Py_TYPE(_self); type->tp_free(_self); if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { // With Python3, the Map class is not static, and must be managed. @@ -512,6 +538,8 @@ static PyMethodDef ScalarMapMethods[] = { "Tests whether a key is a member of the map."}, {"clear", (PyCFunction)Clear, METH_NOARGS, "Removes all elements from the map."}, + {"setdefault", (PyCFunction)ScalarMapSetdefault, METH_VARARGS, + "If the key does not exist, insert the key, with the specified value"}, {"get", (PyCFunction)ScalarMapGet, METH_VARARGS | METH_KEYWORDS, "Gets the value for the given key if present, or otherwise a default"}, {"GetEntryClass", (PyCFunction)GetEntryClass, METH_NOARGS, @@ -624,8 +652,7 @@ int MapReflectionFriend::MessageMapSetItem(PyObject* _self, PyObject* key, } // Delete key from map. - reflection->DeleteMapValue(message, self->parent_field_descriptor, - map_key); + reflection->DeleteMapValue(message, self->parent_field_descriptor, map_key); return 0; } else { PyErr_Format(PyExc_KeyError, "Key not present in map"); @@ -666,10 +693,9 @@ PyObject* MapReflectionFriend::MessageMapToStr(PyObject* _self) { MessageMapContainer* self = GetMessageMap(_self); Message* message = self->GetMutableMessage(); const Reflection* reflection = message->GetReflection(); - for (google::protobuf::MapIterator it = reflection->MapBegin( - message, self->parent_field_descriptor); - it != reflection->MapEnd(message, self->parent_field_descriptor); - ++it) { + for (google::protobuf::MapIterator it = + reflection->MapBegin(message, self->parent_field_descriptor); + it != reflection->MapEnd(message, self->parent_field_descriptor); ++it) { key.reset(MapKeyToPython(self, it.GetKey())); if (key == nullptr) { return nullptr; @@ -685,6 +711,12 @@ PyObject* MapReflectionFriend::MessageMapToStr(PyObject* _self) { return PyObject_Repr(dict.get()); } +static PyObject* MessageMapSetdefault(PyObject* self, PyObject* args) { + PyErr_Format(PyExc_NotImplementedError, + "Set message map value directly is not supported."); + return nullptr; +} + PyObject* MessageMapGet(PyObject* self, PyObject* args, PyObject* kwargs) { static const char* kwlist[] = {"key", "default", nullptr}; PyObject* key; @@ -716,7 +748,7 @@ static void MessageMapDealloc(PyObject* _self) { MessageMapContainer* self = GetMessageMap(_self); self->RemoveFromParentCache(); Py_DECREF(self->message_class); - PyTypeObject *type = Py_TYPE(_self); + PyTypeObject* type = Py_TYPE(_self); type->tp_free(_self); if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { // With Python3, the Map class is not static, and must be managed. @@ -729,6 +761,8 @@ static PyMethodDef MessageMapMethods[] = { "Tests whether the map contains this element."}, {"clear", (PyCFunction)Clear, METH_NOARGS, "Removes all elements from the map."}, + {"setdefault", (PyCFunction)MessageMapSetdefault, METH_VARARGS, + "setdefault is disallowed in MessageMap."}, {"get", (PyCFunction)MessageMapGet, METH_VARARGS | METH_KEYWORDS, "Gets the value for the given key if present, or otherwise a default"}, {"get_or_create", MapReflectionFriend::MessageMapGetItem, METH_O, @@ -767,7 +801,7 @@ static MapIterator* GetIter(PyObject* obj) { return reinterpret_cast<MapIterator*>(obj); } -PyObject* MapReflectionFriend::GetIterator(PyObject *_self) { +PyObject* MapReflectionFriend::GetIterator(PyObject* _self) { MapContainer* self = GetMap(_self); ScopedPyObjectPtr obj(PyType_GenericAlloc(&MapIterator_Type, 0)); @@ -800,12 +834,10 @@ PyObject* MapReflectionFriend::IterNext(PyObject* _self) { // This won't catch mutations to the map performed by MergeFrom(); no easy way // to address that. if (self->version != self->container->version) { - return PyErr_Format(PyExc_RuntimeError, - "Map modified during iteration."); + return PyErr_Format(PyExc_RuntimeError, "Map modified during iteration."); } if (self->parent != self->container->parent) { - return PyErr_Format(PyExc_RuntimeError, - "Map cleared during iteration."); + return PyErr_Format(PyExc_RuntimeError, "Map cleared during iteration."); } if (self->iter.get() == nullptr) { diff --git a/third_party/protobuf/python/google/protobuf/pyext/message.cc b/third_party/protobuf/python/google/protobuf/pyext/message.cc index c3fcff542aead..6d656fc38c94c 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/message.cc +++ b/third_party/protobuf/python/google/protobuf/pyext/message.cc @@ -491,7 +491,7 @@ void OutOfRangeError(PyObject* arg) { template <class RangeType, class ValueType> bool VerifyIntegerCastAndRange(PyObject* arg, ValueType value) { - if (PROTOBUF_PREDICT_FALSE(value == -1 && PyErr_Occurred())) { + if (ABSL_PREDICT_FALSE(value == -1 && PyErr_Occurred())) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) { // Replace it with the same ValueError as pure python protos instead of // the default one. @@ -500,7 +500,7 @@ bool VerifyIntegerCastAndRange(PyObject* arg, ValueType value) { } // Otherwise propagate existing error. return false; } - if (PROTOBUF_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value))) { + if (ABSL_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value))) { OutOfRangeError(arg); return false; } @@ -514,7 +514,7 @@ bool CheckAndGetInteger(PyObject* arg, T* value) { // This definition includes everything with a valid __index__() implementation // and shouldn't cast the net too wide. if (!strcmp(Py_TYPE(arg)->tp_name, "numpy.ndarray") || - PROTOBUF_PREDICT_FALSE(!PyIndex_Check(arg))) { + ABSL_PREDICT_FALSE(!PyIndex_Check(arg))) { FormatTypeError(arg, "int"); return false; } @@ -558,7 +558,7 @@ template bool CheckAndGetInteger<uint64_t>(PyObject*, uint64_t*); bool CheckAndGetDouble(PyObject* arg, double* value) { *value = PyFloat_AsDouble(arg); if (!strcmp(Py_TYPE(arg)->tp_name, "numpy.ndarray") || - PROTOBUF_PREDICT_FALSE(*value == -1 && PyErr_Occurred())) { + ABSL_PREDICT_FALSE(*value == -1 && PyErr_Occurred())) { FormatTypeError(arg, "int, float"); return false; } @@ -1001,17 +1001,32 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) { if (source_value.get() == nullptr || dest_value.get() == nullptr) { return -1; } - ScopedPyObjectPtr ok(PyObject_CallMethod( - dest_value.get(), "MergeFrom", "O", source_value.get())); - if (ok.get() == nullptr) { + if (!PyObject_TypeCheck(dest_value.get(), CMessage_Type)) { + PyErr_Format(PyExc_SystemError, + "Unexpectedly, a map of messages contains a " + "non-message value: %s", + Py_TYPE(dest_value.get())->tp_name); return -1; } + CMessage* target_message = + reinterpret_cast<CMessage*>(dest_value.get()); + if (PyDict_Check(source_value.get())) { + if (InitAttributes(target_message, nullptr, source_value.get()) < + 0) { + return -1; + } + } else { + ScopedPyObjectPtr ok(PyObject_CallMethod( + dest_value.get(), "MergeFrom", "O", source_value.get())); + if (ok.get() == nullptr) { + return -1; + } + } } } else { - ScopedPyObjectPtr function_return; - function_return.reset( + ScopedPyObjectPtr ok( PyObject_CallMethod(map.get(), "update", "O", value)); - if (function_return.get() == nullptr) { + if (ok.get() == nullptr) { return -1; } } @@ -1111,33 +1126,29 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) { return -1; } } - } else { - if (PyObject_TypeCheck(value, CMessage_Type)) { - ScopedPyObjectPtr merged(MergeFrom(cmessage, value)); - if (merged == nullptr) { - return -1; - } - } else { - if (descriptor->message_type()->well_known_type() != - Descriptor::WELLKNOWNTYPE_UNSPECIFIED && - PyObject_HasAttrString(reinterpret_cast<PyObject*>(cmessage), - "_internal_assign")) { - AssureWritable(cmessage); - ScopedPyObjectPtr ok( - PyObject_CallMethod(reinterpret_cast<PyObject*>(cmessage), - "_internal_assign", "O", value)); - if (ok.get() == nullptr) { - return -1; - } - } else { - PyErr_Format(PyExc_TypeError, - "Parameter to initialize message field must be " - "dict or instance of same class: expected %s got %s.", - std::string(descriptor->full_name()).c_str(), - Py_TYPE(value)->tp_name); - return -1; - } + } else if (PyObject_TypeCheck(value, CMessage_Type)) { + ScopedPyObjectPtr merged(MergeFrom(cmessage, value)); + if (merged == nullptr) { + return -1; } + } else if (descriptor->message_type()->well_known_type() != + Descriptor::WELLKNOWNTYPE_UNSPECIFIED && + PyObject_HasAttrString(reinterpret_cast<PyObject*>(cmessage), + "_internal_assign")) { + AssureWritable(cmessage); + ScopedPyObjectPtr ok( + PyObject_CallMethod(reinterpret_cast<PyObject*>(cmessage), + "_internal_assign", "O", value)); + if (ok.get() == nullptr) { + return -1; + } + } else { + PyErr_Format(PyExc_TypeError, + "Parameter to initialize message field must be " + "dict or instance of same class: expected %s got %s.", + std::string(descriptor->full_name()).c_str(), + Py_TYPE(value)->tp_name); + return -1; } } else { ScopedPyObjectPtr new_val; @@ -1900,10 +1911,9 @@ static PyObject* MergeFromString(CMessage* self, PyObject* arg) { // ctx has an explicit limit set (length of string_view), so we have to // check we ended at that limit. if (!ctx.EndedAtLimit()) { - // TODO: Raise error and return NULL instead. - // b/27494216 - PyErr_Warn(nullptr, "Unexpected end-group tag: Not all data was converted"); - return PyLong_FromLong(data.len - ctx.BytesUntilLimit(ptr)); + PyErr_Format(DecodeError_class, + "Unexpected end-group tag: Not all data was converted"); + return nullptr; } return PyLong_FromLong(data.len); } diff --git a/third_party/protobuf/python/google/protobuf/pyext/message.h b/third_party/protobuf/python/google/protobuf/pyext/message.h index e5ce28c70b1e0..2a4689296b118 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/message.h +++ b/third_party/protobuf/python/google/protobuf/pyext/message.h @@ -48,7 +48,8 @@ struct CMessageClass; // don't store any data, and always refer to their parent message. struct ContainerBase { - PyObject_HEAD; + // clang-format off + PyObject_HEAD // Strong reference to a parent message object. For a CMessage there are three // cases: @@ -59,6 +60,7 @@ struct ContainerBase { // For all other types: repeated containers, maps, it always point to a // valid parent CMessage. struct CMessage* parent; + // clang-format on // If this object belongs to a parent message, describes which field it comes // from. @@ -139,9 +141,7 @@ struct CMessageClass { // This reference must stay alive until all message pointers are destructed. PyMessageFactory* py_message_factory; - PyObject* AsPyObject() { - return reinterpret_cast<PyObject*>(this); - } + PyObject* AsPyObject() { return reinterpret_cast<PyObject*>(this); } }; extern PyTypeObject* CMessageClass_Type; @@ -162,20 +162,18 @@ const FieldDescriptor* GetExtensionDescriptor(PyObject* extension); // submessage as the result is cached in composite_fields. // // Corresponds to reflection api method GetMessage. -CMessage* InternalGetSubMessage( - CMessage* self, const FieldDescriptor* field_descriptor); +CMessage* InternalGetSubMessage(CMessage* self, + const FieldDescriptor* field_descriptor); // Deletes a range of items in a repeated field (following a // removal in a RepeatedCompositeContainer). // // Corresponds to reflection api method RemoveLast. -int DeleteRepeatedField(CMessage* self, - const FieldDescriptor* field_descriptor, +int DeleteRepeatedField(CMessage* self, const FieldDescriptor* field_descriptor, PyObject* slice); // Sets the specified scalar value to the message. -int InternalSetScalar(CMessage* self, - const FieldDescriptor* field_descriptor, +int InternalSetScalar(CMessage* self, const FieldDescriptor* field_descriptor, PyObject* value); // Sets the specified scalar value to the message. Requires it is not a Oneof. @@ -250,7 +248,6 @@ PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg); } // namespace cmessage - /* Is 64bit */ #define IS_64BIT (SIZEOF_LONG == 8) @@ -302,18 +299,15 @@ PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg); #define FULL_MODULE_NAME "google.protobuf.pyext._message" void FormatTypeError(PyObject* arg, const char* expected_types); -template<class T> +template <class T> bool CheckAndGetInteger(PyObject* arg, T* value); bool CheckAndGetDouble(PyObject* arg, double* value); bool CheckAndGetFloat(PyObject* arg, float* value); bool CheckAndGetBool(PyObject* arg, bool* value); PyObject* CheckString(PyObject* arg, const FieldDescriptor* descriptor); -bool CheckAndSetString( - PyObject* arg, Message* message, - const FieldDescriptor* descriptor, - const Reflection* reflection, - bool append, - int index); +bool CheckAndSetString(PyObject* arg, Message* message, + const FieldDescriptor* descriptor, + const Reflection* reflection, bool append, int index); PyObject* ToStringObject(const FieldDescriptor* descriptor, absl::string_view value); @@ -331,7 +325,7 @@ Message* PyMessage_GetMutableMessagePointer(PyObject* msg); PyObject* PyMessage_NewMessageOwnedExternally(Message* message, PyObject* py_message_factory); -bool InitProto2MessageModule(PyObject *m); +bool InitProto2MessageModule(PyObject* m); // These are referenced by repeated_scalar_container, and must // be explicitly instantiated. diff --git a/third_party/protobuf/python/google/protobuf/pyext/message_module.cc b/third_party/protobuf/python/google/protobuf/pyext/message_module.cc index c3beb8253de65..fbebaf491d40f 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/message_module.cc +++ b/third_party/protobuf/python/google/protobuf/pyext/message_module.cc @@ -4,21 +4,267 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd +#include <cstdint> +#include <string> #define PY_SSIZE_T_CLEAN #include <Python.h> +#include "google/protobuf/descriptor.pb.h" +#include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/str_cat.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/descriptor_database.h" +#include "google/protobuf/dynamic_message.h" #include "google/protobuf/message_lite.h" +#include "google/protobuf/proto_api.h" #include "google/protobuf/pyext/descriptor.h" #include "google/protobuf/pyext/descriptor_pool.h" #include "google/protobuf/pyext/message.h" #include "google/protobuf/pyext/message_factory.h" -#include "google/protobuf/proto_api.h" +#include "google/protobuf/stubs/status_macros.h" + +// Must be included last. +#include "google/protobuf/port_def.inc" namespace { +class ProtoAPIDescriptorDatabase : public google::protobuf::DescriptorDatabase { + public: + ProtoAPIDescriptorDatabase() { + PyObject* descriptor_pool = + PyImport_ImportModule("google.protobuf.descriptor_pool"); + if (descriptor_pool == nullptr) { + ABSL_LOG(ERROR) + << "Failed to import google.protobuf.descriptor_pool module."; + } + + pool_ = PyObject_CallMethod(descriptor_pool, "Default", nullptr); + if (pool_ == nullptr) { + ABSL_LOG(ERROR) << "Failed to get python Default pool."; + } + Py_DECREF(descriptor_pool); + }; + + ~ProtoAPIDescriptorDatabase() { + // Objects of this class are meant to be `static`ally initialized and + // never destroyed. This is a commonly used approach, because the order + // in which destructors of static objects run is unpredictable. In + // particular, it is possible that the Python interpreter may have been + // finalized already. + ABSL_DLOG(ERROR) << "MEANT TO BE UNREACHABLE."; + }; + + bool FindFileByName(const std::string& filename, + google::protobuf::FileDescriptorProto* output) override { + PyObject* pyfile_name = + PyUnicode_FromStringAndSize(filename.data(), filename.size()); + if (pyfile_name == nullptr) { + PyErr_Format(PyExc_TypeError, "Fail to convert proto file name"); + return false; + } + + PyObject* pyfile = + PyObject_CallMethod(pool_, "FindFileByName", "O", pyfile_name); + Py_DECREF(pyfile_name); + if (pyfile == nullptr) { + PyErr_Format(PyExc_TypeError, "Default python pool fail to find %s", + filename.data()); + return false; + } + + PyObject* pyfile_serialized = + PyObject_GetAttrString(pyfile, "serialized_pb"); + Py_DECREF(pyfile); + if (pyfile_serialized == nullptr) { + PyErr_Format(PyExc_TypeError, + "Python file has no attribute 'serialized_pb'"); + return false; + } + + bool ok = output->ParseFromArray( + reinterpret_cast<uint8_t*>(PyBytes_AS_STRING(pyfile_serialized)), + PyBytes_GET_SIZE(pyfile_serialized)); + if (!ok) { + ABSL_LOG(ERROR) << "Failed to parse descriptor for " << filename; + } + Py_DECREF(pyfile_serialized); + return ok; + } + + bool FindFileContainingSymbol(const std::string& symbol_name, + google::protobuf::FileDescriptorProto* output) override { + return false; + } + + bool FindFileContainingExtension( + const std::string& containing_type, int field_number, + google::protobuf::FileDescriptorProto* output) override { + return false; + } + + PyObject* pool() { return pool_; } + + private: + PyObject* pool_; +}; + +absl::StatusOr<const google::protobuf::Descriptor*> FindMessageDescriptor( + PyObject* pyfile, const char* descriptor_full_name) { + static auto* database = new ProtoAPIDescriptorDatabase(); + static auto* pool = new google::protobuf::DescriptorPool(database); + PyObject* pyfile_name = PyObject_GetAttrString(pyfile, "name"); + if (pyfile_name == nullptr) { + return absl::InvalidArgumentError("FileDescriptor has no attribute 'name'"); + } + PyObject* pyfile_pool = PyObject_GetAttrString(pyfile, "pool"); + if (pyfile_pool == nullptr) { + Py_DECREF(pyfile_name); + return absl::InvalidArgumentError("FileDescriptor has no attribute 'pool'"); + } + // Check the file descriptor is from generated pool. + bool is_from_generated_pool = database->pool() == pyfile_pool; + Py_DECREF(pyfile_pool); + const char* pyfile_name_char_ptr = PyUnicode_AsUTF8(pyfile_name); + if (pyfile_name_char_ptr == nullptr) { + Py_DECREF(pyfile_name); + return absl::InvalidArgumentError( + "FileDescriptor 'name' PyUnicode_AsUTF8() failure."); + } + if (!is_from_generated_pool) { + std::string error_msg = absl::StrCat(pyfile_name_char_ptr, + " is not from generated pool"); + Py_DECREF(pyfile_name); + return absl::InvalidArgumentError(error_msg); + } + const google::protobuf::FileDescriptor* file_descriptor = + pool->FindFileByName(pyfile_name_char_ptr); + Py_DECREF(pyfile_name); + if (file_descriptor == nullptr) { + // Already checked the file is from generated pool above, this + // error should never be reached. + ABSL_DLOG(ERROR) << "MEANT TO BE UNREACHABLE."; + std::string error_msg = absl::StrCat("Fail to find/build file ", + pyfile_name_char_ptr); + return absl::InternalError(error_msg); + } + + const google::protobuf::Descriptor* descriptor = + pool->FindMessageTypeByName(descriptor_full_name); + if (descriptor == nullptr) { + return absl::InternalError("Fail to find descriptor by name."); + } + return descriptor; +} + +google::protobuf::DynamicMessageFactory* GetFactory() { + static google::protobuf::DynamicMessageFactory* factory = + new google::protobuf::DynamicMessageFactory; + return factory; +} + +absl::StatusOr<google::protobuf::Message*> CreateNewMessage(PyObject* py_msg) { + PyObject* pyd = PyObject_GetAttrString(py_msg, "DESCRIPTOR"); + if (pyd == nullptr) { + return absl::InvalidArgumentError("py_msg has no attribute 'DESCRIPTOR'"); + } + + PyObject* fn = PyObject_GetAttrString(pyd, "full_name"); + if (fn == nullptr) { + return absl::InvalidArgumentError( + "DESCRIPTOR has no attribute 'full_name'"); + } + + const char* descriptor_full_name = PyUnicode_AsUTF8(fn); + if (descriptor_full_name == nullptr) { + return absl::InternalError("Fail to convert descriptor full name"); + } + + PyObject* pyfile = PyObject_GetAttrString(pyd, "file"); + Py_DECREF(pyd); + if (pyfile == nullptr) { + return absl::InvalidArgumentError("DESCRIPTOR has no attribute 'file'"); + } + auto gen_d = google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName( + descriptor_full_name); + if (gen_d) { + Py_DECREF(pyfile); + Py_DECREF(fn); + return google::protobuf::MessageFactory::generated_factory() + ->GetPrototype(gen_d) + ->New(); + } + auto d = FindMessageDescriptor(pyfile, descriptor_full_name); + Py_DECREF(pyfile); + RETURN_IF_ERROR(d.status()); + Py_DECREF(fn); + return GetFactory()->GetPrototype(*d)->New(); +} + +bool CopyToOwnedMsg(google::protobuf::Message** copy, const google::protobuf::Message& message) { + *copy = message.New(); + std::string wire; + message.SerializeToString(&wire); + (*copy)->ParseFromArray(wire.data(), wire.size()); + return true; +} + // C++ API. Clients get at this via proto_api.h struct ApiImplementation : google::protobuf::python::PyProto_API { + absl::StatusOr<google::protobuf::python::PythonMessageMutator> GetClearedMessageMutator( + PyObject* py_msg) const override { + if (PyObject_TypeCheck(py_msg, google::protobuf::python::CMessage_Type)) { + google::protobuf::Message* message = + google::protobuf::python::PyMessage_GetMutableMessagePointer(py_msg); + if (message == nullptr) { + return absl::InternalError( + "Fail to get message pointer. The message " + "may already had a reference."); + } + message->Clear(); + return CreatePythonMessageMutator(nullptr, message, py_msg); + } + + auto msg = CreateNewMessage(py_msg); + RETURN_IF_ERROR(msg.status()); + return CreatePythonMessageMutator(*msg, *msg, py_msg); + } + + absl::StatusOr<google::protobuf::python::PythonConstMessagePointer> + GetConstMessagePointer(PyObject* py_msg) const override { + if (PyObject_TypeCheck(py_msg, google::protobuf::python::CMessage_Type)) { + const google::protobuf::Message* message = + google::protobuf::python::PyMessage_GetMessagePointer(py_msg); + google::protobuf::Message* owned_msg = nullptr; + ABSL_DCHECK(CopyToOwnedMsg(&owned_msg, *message)); + return CreatePythonConstMessagePointer(owned_msg, message, py_msg); + } + auto msg = CreateNewMessage(py_msg); + RETURN_IF_ERROR(msg.status()); + PyObject* serialized_pb( + PyObject_CallMethod(py_msg, "SerializeToString", nullptr)); + if (serialized_pb == nullptr) { + return absl::InternalError("Fail to serialize py_msg"); + } + char* data; + Py_ssize_t len; + if (PyBytes_AsStringAndSize(serialized_pb, &data, &len) < 0) { + Py_DECREF(serialized_pb); + return absl::InternalError( + "Fail to get bytes from py_msg serialized data"); + } + if (!(*msg)->ParseFromArray(data, len)) { + Py_DECREF(serialized_pb); + return absl::InternalError( + "Couldn't parse py_message to google::protobuf::Message*!"); + } + Py_DECREF(serialized_pb); + return CreatePythonConstMessagePointer(*msg, *msg, py_msg); + } + const google::protobuf::Message* GetMessagePointer(PyObject* msg) const override { return google::protobuf::python::PyMessage_GetMessagePointer(msg); } @@ -109,3 +355,5 @@ PyMODINIT_FUNC PyInit__message() { return m; } + +#include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/python/google/protobuf/pyext/unknown_field_set.h b/third_party/protobuf/python/google/protobuf/pyext/unknown_field_set.h index e9826f45bd9d1..520a2c775b63f 100644 --- a/third_party/protobuf/python/google/protobuf/pyext/unknown_field_set.h +++ b/third_party/protobuf/python/google/protobuf/pyext/unknown_field_set.h @@ -26,9 +26,11 @@ namespace python { struct CMessage; struct PyUnknownFieldSet { - PyObject_HEAD; + // clang-format off + PyObject_HEAD // If parent is nullptr, it is a top UnknownFieldSet. PyUnknownFieldSet* parent; + // clang-format on // Top UnknownFieldSet owns fields pointer. Sub UnknownFieldSet // does not own fields pointer. @@ -36,10 +38,12 @@ struct PyUnknownFieldSet { }; struct PyUnknownField { - PyObject_HEAD; + // clang-format off + PyObject_HEAD // Every Python PyUnknownField holds a reference to its parent // PyUnknownFieldSet in order to keep it alive. PyUnknownFieldSet* parent; + // clang-format on // The UnknownField index in UnknownFieldSet. Py_ssize_t index; diff --git a/third_party/protobuf/python/google/protobuf/reflection.py b/third_party/protobuf/python/google/protobuf/reflection.py index 0943c2fe8dc19..a29f41a0527c7 100644 --- a/third_party/protobuf/python/google/protobuf/reflection.py +++ b/third_party/protobuf/python/google/protobuf/reflection.py @@ -34,52 +34,3 @@ from google.protobuf import symbol_database GeneratedProtocolMessageType = message_factory._GENERATED_PROTOCOL_MESSAGE_TYPE MESSAGE_CLASS_CACHE = {} - - -# Deprecated. Please NEVER use reflection.ParseMessage(). -def ParseMessage(descriptor, byte_str): - """Generate a new Message instance from this Descriptor and a byte string. - - DEPRECATED: ParseMessage is deprecated because it is using MakeClass(). - Please use MessageFactory.GetMessageClass() instead. - - Args: - descriptor: Protobuf Descriptor object - byte_str: Serialized protocol buffer byte string - - Returns: - Newly created protobuf Message object. - """ - warnings.warn( - 'reflection.ParseMessage() is deprecated. Please use ' - 'MessageFactory.GetMessageClass() and message.ParseFromString() instead. ' - 'reflection.ParseMessage() will be removed in Jan 2025.', - stacklevel=2, - ) - result_class = MakeClass(descriptor) - new_msg = result_class() - new_msg.ParseFromString(byte_str) - return new_msg - - -# Deprecated. Please NEVER use reflection.MakeClass(). -def MakeClass(descriptor): - """Construct a class object for a protobuf described by descriptor. - - DEPRECATED: use MessageFactory.GetMessageClass() instead. - - Args: - descriptor: A descriptor.Descriptor object describing the protobuf. - Returns: - The Message class object described by the descriptor. - """ - warnings.warn( - 'reflection.MakeClass() is deprecated. Please use ' - 'MessageFactory.GetMessageClass() instead. ' - 'reflection.MakeClass() will be removed in Jan 2025.', - stacklevel=2, - ) - # Original implementation leads to duplicate message classes, which won't play - # well with extensions. Message factory info is also missing. - # Redirect to message_factory. - return message_factory.GetMessageClass(descriptor) diff --git a/third_party/protobuf/python/google/protobuf/runtime_version.py b/third_party/protobuf/python/google/protobuf/runtime_version.py index 524ad1fe9033c..d4367acc42de3 100644 --- a/third_party/protobuf/python/google/protobuf/runtime_version.py +++ b/third_party/protobuf/python/google/protobuf/runtime_version.py @@ -27,9 +27,9 @@ class Domain(Enum): # the Protobuf release process. Do not edit them manually. # These OSS versions are not stripped to avoid merging conflicts. OSS_DOMAIN = Domain.PUBLIC -OSS_MAJOR = 5 -OSS_MINOR = 29 -OSS_PATCH = 3 +OSS_MAJOR = 6 +OSS_MINOR = 30 +OSS_PATCH = 1 OSS_SUFFIX = '' DOMAIN = OSS_DOMAIN diff --git a/third_party/protobuf/python/google/protobuf/service.py b/third_party/protobuf/python/google/protobuf/service.py deleted file mode 100644 index 38b8217919cbf..0000000000000 --- a/third_party/protobuf/python/google/protobuf/service.py +++ /dev/null @@ -1,213 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file or at -# https://developers.google.com/open-source/licenses/bsd - -"""DEPRECATED: Declares the RPC service interfaces. - -This module declares the abstract interfaces underlying proto2 RPC -services. These are intended to be independent of any particular RPC -implementation, so that proto2 services can be used on top of a variety -of implementations. Starting with version 2.3.0, RPC implementations should -not try to build on these, but should instead provide code generator plugins -which generate code specific to the particular RPC implementation. This way -the generated code can be more appropriate for the implementation in use -and can avoid unnecessary layers of indirection. -""" - -__author__ = 'petar@google.com (Petar Petrov)' - -import warnings - -warnings.warn( - 'google.protobuf.service module is deprecated. RPC implementations ' - 'should provide code generator plugins which generate code specific to ' - 'the RPC implementation. service.py will be removed in Jan 2025', - stacklevel=2, -) - -class RpcException(Exception): - """Exception raised on failed blocking RPC method call.""" - pass - - -class Service(object): - - """Abstract base interface for protocol-buffer-based RPC services. - - Services themselves are abstract classes (implemented either by servers or as - stubs), but they subclass this base interface. The methods of this - interface can be used to call the methods of the service without knowing - its exact type at compile time (analogous to the Message interface). - """ - - def GetDescriptor(): - """Retrieves this service's descriptor.""" - raise NotImplementedError - - def CallMethod(self, method_descriptor, rpc_controller, - request, done): - """Calls a method of the service specified by method_descriptor. - - If "done" is None then the call is blocking and the response - message will be returned directly. Otherwise the call is asynchronous - and "done" will later be called with the response value. - - In the blocking case, RpcException will be raised on error. - - Preconditions: - - * method_descriptor.service == GetDescriptor - * request is of the exact same classes as returned by - GetRequestClass(method). - * After the call has started, the request must not be modified. - * "rpc_controller" is of the correct type for the RPC implementation being - used by this Service. For stubs, the "correct type" depends on the - RpcChannel which the stub is using. - - Postconditions: - - * "done" will be called when the method is complete. This may be - before CallMethod() returns or it may be at some point in the future. - * If the RPC failed, the response value passed to "done" will be None. - Further details about the failure can be found by querying the - RpcController. - """ - raise NotImplementedError - - def GetRequestClass(self, method_descriptor): - """Returns the class of the request message for the specified method. - - CallMethod() requires that the request is of a particular subclass of - Message. GetRequestClass() gets the default instance of this required - type. - - Example: - method = service.GetDescriptor().FindMethodByName("Foo") - request = stub.GetRequestClass(method)() - request.ParseFromString(input) - service.CallMethod(method, request, callback) - """ - raise NotImplementedError - - def GetResponseClass(self, method_descriptor): - """Returns the class of the response message for the specified method. - - This method isn't really needed, as the RpcChannel's CallMethod constructs - the response protocol message. It's provided anyway in case it is useful - for the caller to know the response type in advance. - """ - raise NotImplementedError - - -class RpcController(object): - - """An RpcController mediates a single method call. - - The primary purpose of the controller is to provide a way to manipulate - settings specific to the RPC implementation and to find out about RPC-level - errors. The methods provided by the RpcController interface are intended - to be a "least common denominator" set of features which we expect all - implementations to support. Specific implementations may provide more - advanced features (e.g. deadline propagation). - """ - - # Client-side methods below - - def Reset(self): - """Resets the RpcController to its initial state. - - After the RpcController has been reset, it may be reused in - a new call. Must not be called while an RPC is in progress. - """ - raise NotImplementedError - - def Failed(self): - """Returns true if the call failed. - - After a call has finished, returns true if the call failed. The possible - reasons for failure depend on the RPC implementation. Failed() must not - be called before a call has finished. If Failed() returns true, the - contents of the response message are undefined. - """ - raise NotImplementedError - - def ErrorText(self): - """If Failed is true, returns a human-readable description of the error.""" - raise NotImplementedError - - def StartCancel(self): - """Initiate cancellation. - - Advises the RPC system that the caller desires that the RPC call be - canceled. The RPC system may cancel it immediately, may wait awhile and - then cancel it, or may not even cancel the call at all. If the call is - canceled, the "done" callback will still be called and the RpcController - will indicate that the call failed at that time. - """ - raise NotImplementedError - - # Server-side methods below - - def SetFailed(self, reason): - """Sets a failure reason. - - Causes Failed() to return true on the client side. "reason" will be - incorporated into the message returned by ErrorText(). If you find - you need to return machine-readable information about failures, you - should incorporate it into your response protocol buffer and should - NOT call SetFailed(). - """ - raise NotImplementedError - - def IsCanceled(self): - """Checks if the client cancelled the RPC. - - If true, indicates that the client canceled the RPC, so the server may - as well give up on replying to it. The server should still call the - final "done" callback. - """ - raise NotImplementedError - - def NotifyOnCancel(self, callback): - """Sets a callback to invoke on cancel. - - Asks that the given callback be called when the RPC is canceled. The - callback will always be called exactly once. If the RPC completes without - being canceled, the callback will be called after completion. If the RPC - has already been canceled when NotifyOnCancel() is called, the callback - will be called immediately. - - NotifyOnCancel() must be called no more than once per request. - """ - raise NotImplementedError - - -class RpcChannel(object): - - """Abstract interface for an RPC channel. - - An RpcChannel represents a communication line to a service which can be used - to call that service's methods. The service may be running on another - machine. Normally, you should not use an RpcChannel directly, but instead - construct a stub {@link Service} wrapping it. Example: - - Example: - RpcChannel channel = rpcImpl.Channel("remotehost.example.com:1234") - RpcController controller = rpcImpl.Controller() - MyService service = MyService_Stub(channel) - service.MyMethod(controller, request, callback) - """ - - def CallMethod(self, method_descriptor, rpc_controller, - request, response_class, done): - """Calls the method identified by the descriptor. - - Call the given method of the remote service. The signature of this - procedure looks the same as Service.CallMethod(), but the requirements - are less strict in one important way: the request object doesn't have to - be of any specific class as long as its descriptor is method.input_type. - """ - raise NotImplementedError diff --git a/third_party/protobuf/python/google/protobuf/symbol_database.py b/third_party/protobuf/python/google/protobuf/symbol_database.py index 1941e8112d577..a538d5d6da750 100644 --- a/third_party/protobuf/python/google/protobuf/symbol_database.py +++ b/third_party/protobuf/python/google/protobuf/symbol_database.py @@ -51,24 +51,6 @@ class SymbolDatabase(): """Initializes a new SymbolDatabase.""" self.pool = pool or descriptor_pool.DescriptorPool() - def GetPrototype(self, descriptor): - warnings.warn('SymbolDatabase.GetPrototype() is deprecated. Please ' - 'use message_factory.GetMessageClass() instead. ' - 'SymbolDatabase.GetPrototype() will be removed soon.') - return message_factory.GetMessageClass(descriptor) - - def CreatePrototype(self, descriptor): - warnings.warn('Directly call CreatePrototype() is wrong. Please use ' - 'message_factory.GetMessageClass() instead. ' - 'SymbolDatabase.CreatePrototype() will be removed soon.') - return message_factory._InternalCreateMessageClass(descriptor) - - def GetMessages(self, files): - warnings.warn('SymbolDatabase.GetMessages() is deprecated. Please use ' - 'message_factory.GetMessageClassedForFiles() instead. ' - 'SymbolDatabase.GetMessages() will be removed soon.') - return message_factory.GetMessageClassedForFiles(files, self.pool) - def RegisterMessage(self, message): """Registers the given message type in the local database. diff --git a/third_party/protobuf/python/google/protobuf/text_format.py b/third_party/protobuf/python/google/protobuf/text_format.py index 7e17b43e0c915..e8e1a30d722b0 100644 --- a/third_party/protobuf/python/google/protobuf/text_format.py +++ b/third_party/protobuf/python/google/protobuf/text_format.py @@ -42,6 +42,7 @@ _INTEGER_CHECKERS = (type_checkers.Uint32ValueChecker(), type_checkers.Int64ValueChecker()) _FLOAT_INFINITY = re.compile('-?inf(?:inity)?f?$', re.IGNORECASE) _FLOAT_NAN = re.compile('nanf?$', re.IGNORECASE) +_FLOAT_OCTAL_PREFIX = re.compile('-?0[0-9]+') _QUOTES = frozenset(("'", '"')) _ANY_FULL_TYPE_NAME = 'google.protobuf.Any' _DEBUG_STRING_SILENT_MARKER = '\t ' @@ -430,7 +431,7 @@ class _Printer(object): return False packed_message = _BuildMessageFromTypeName(message.TypeName(), self.descriptor_pool) - if packed_message: + if packed_message is not None: packed_message.MergeFromString(message.value) colon = ':' if self.force_colon else '' self.out.write('%s[%s]%s ' % (self.indent * ' ', message.type_url, colon)) @@ -1165,7 +1166,9 @@ class _Parser(object): else: # For field that doesn't represent presence, try best effort to # check multiple scalars by compare to default values. - duplicate_error = bool(getattr(message, field.name)) + duplicate_error = not decoder.IsDefaultScalarValue( + getattr(message, field.name) + ) if duplicate_error: raise tokenizer.ParseErrorPreviousToken( @@ -1789,6 +1792,8 @@ def ParseFloat(text): Raises: ValueError: If a floating point number couldn't be parsed. """ + if _FLOAT_OCTAL_PREFIX.match(text): + raise ValueError('Invalid octal float: %s' % text) try: # Assume Python compatible syntax. return float(text) @@ -1804,7 +1809,7 @@ def ParseFloat(text): else: # assume '1.0f' format try: - return float(text.rstrip('f')) + return float(text.rstrip('fF')) except ValueError: raise ValueError("Couldn't parse float: %s" % text) diff --git a/third_party/protobuf/python/google/protobuf/unknown_fields.py b/third_party/protobuf/python/google/protobuf/unknown_fields.py index 9b1e549324308..6c16a2d30ced6 100644 --- a/third_party/protobuf/python/google/protobuf/unknown_fields.py +++ b/third_party/protobuf/python/google/protobuf/unknown_fields.py @@ -72,13 +72,12 @@ else: InternalAdd(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED, data) else: for tag_bytes, buffer in unknown_fields: - # pylint: disable=protected-access - (tag, _) = decoder._DecodeVarint(tag_bytes, 0) - field_number, wire_type = wire_format.UnpackTag(tag) + field_number, wire_type = decoder.DecodeTag(tag_bytes) if field_number == 0: raise RuntimeError('Field number 0 is illegal.') (data, _) = decoder._DecodeUnknownField( - memoryview(buffer), 0, wire_type) + memoryview(buffer), 0, len(buffer), field_number, wire_type + ) InternalAdd(field_number, wire_type, data) def __getitem__(self, index): diff --git a/third_party/protobuf/python/internal.bzl b/third_party/protobuf/python/internal.bzl index dbd16a2885509..c9be66e1076e3 100644 --- a/third_party/protobuf/python/internal.bzl +++ b/third_party/protobuf/python/internal.bzl @@ -45,6 +45,7 @@ def _internal_copy_files_impl(ctx): mnemonic = "InternalCopyFile", progress_message = "Copying files", use_default_shell_env = True, + toolchain = None, ) else: @@ -65,6 +66,7 @@ def _internal_copy_files_impl(ctx): mnemonic = "InternalCopyFile", progress_message = "Copying files", use_default_shell_env = True, + toolchain = None, ) return [ @@ -127,7 +129,10 @@ def internal_py_test(deps = [], **kwargs): """ py_test( imports = ["."], - deps = deps + ["//python:python_test_lib"], + deps = deps + [ + "//python:python_test_lib", + "@com_google_absl_py//absl/testing:parameterized", + ], target_compatible_with = select({ "@system_python//:supported": [], "//conditions:default": ["@platforms//:incompatible"], diff --git a/third_party/protobuf/python/map.c b/third_party/protobuf/python/map.c index 1e2b3806b6a40..671e1b9c93582 100644 --- a/third_party/protobuf/python/map.c +++ b/third_party/protobuf/python/map.c @@ -18,8 +18,10 @@ // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyObject* arena; + // clang-format on // The field descriptor (upb_FieldDef*). // The low bit indicates whether the container is reified (see ptr below). // - low bit set: repeated field is a stub (empty map, no underlying data). @@ -217,6 +219,48 @@ static PyObject* PyUpb_MapContainer_Clear(PyObject* _self, PyObject* key) { Py_RETURN_NONE; } +static PyObject* PyUpb_ScalarMapContainer_Setdefault(PyObject* _self, + PyObject* args) { + PyObject* key; + PyObject* default_value = Py_None; + + if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &default_value)) { + return NULL; + } + + if (default_value == Py_None) { + PyErr_Format(PyExc_ValueError, + "The value for scalar map setdefault must be set."); + return NULL; + } + + PyUpb_MapContainer* self = (PyUpb_MapContainer*)_self; + upb_Map* map = PyUpb_MapContainer_EnsureReified(_self); + const upb_FieldDef* f = PyUpb_MapContainer_GetField(self); + const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(f); + const upb_FieldDef* key_f = upb_MessageDef_Field(entry_m, 0); + const upb_FieldDef* val_f = upb_MessageDef_Field(entry_m, 1); + upb_MessageValue u_key, u_val; + if (!PyUpb_PyToUpb(key, key_f, &u_key, NULL)) return NULL; + if (upb_Map_Get(map, u_key, &u_val)) { + return PyUpb_UpbToPy(u_val, val_f, self->arena); + } + + upb_Arena* arena = PyUpb_Arena_Get(self->arena); + if (!PyUpb_PyToUpb(default_value, val_f, &u_val, arena)) return NULL; + if (!PyUpb_MapContainer_Set(self, map, u_key, u_val, arena)) return NULL; + + Py_INCREF(default_value); + return default_value; +} + +static PyObject* PyUpb_MessageMapContainer_Setdefault(PyObject* self, + PyObject* args) { + PyErr_Format(PyExc_NotImplementedError, + "Set message map value directly is not supported."); + return NULL; +} + static PyObject* PyUpb_MapContainer_Get(PyObject* _self, PyObject* args, PyObject* kwargs) { PyUpb_MapContainer* self = (PyUpb_MapContainer*)_self; @@ -331,6 +375,9 @@ PyObject* PyUpb_MapContainer_GetOrCreateWrapper(upb_Map* map, static PyMethodDef PyUpb_ScalarMapContainer_Methods[] = { {"clear", PyUpb_MapContainer_Clear, METH_NOARGS, "Removes all elements from the map."}, + {"setdefault", (PyCFunction)PyUpb_ScalarMapContainer_Setdefault, + METH_VARARGS, + "If the key does not exist, insert the key, with the specified value"}, {"get", (PyCFunction)PyUpb_MapContainer_Get, METH_VARARGS | METH_KEYWORDS, "Gets the value for the given key if present, or otherwise a default"}, {"GetEntryClass", PyUpb_MapContainer_GetEntryClass, METH_NOARGS, @@ -373,6 +420,8 @@ static PyType_Spec PyUpb_ScalarMapContainer_Spec = { static PyMethodDef PyUpb_MessageMapContainer_Methods[] = { {"clear", PyUpb_MapContainer_Clear, METH_NOARGS, "Removes all elements from the map."}, + {"setdefault", (PyCFunction)PyUpb_MessageMapContainer_Setdefault, + METH_VARARGS, "setdefault is disallowed in MessageMap."}, {"get", (PyCFunction)PyUpb_MapContainer_Get, METH_VARARGS | METH_KEYWORDS, "Gets the value for the given key if present, or otherwise a default"}, {"get_or_create", PyUpb_MapContainer_Subscript, METH_O, @@ -410,8 +459,10 @@ static PyType_Spec PyUpb_MessageMapContainer_Spec = { // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyUpb_MapContainer* map; // We own a reference. + // clang-format on size_t iter; int version; } PyUpb_MapIterator; @@ -480,8 +531,8 @@ bool PyUpb_Map_Init(PyObject* m) { PyObject* base = GetMutableMappingBase(); if (!base) return false; - const char* methods[] = {"keys", "items", "values", "__eq__", "__ne__", - "pop", "popitem", "update", "setdefault", NULL}; + const char* methods[] = {"keys", "items", "values", "__eq__", "__ne__", + "pop", "popitem", "update", NULL}; state->message_map_container_type = PyUpb_AddClassWithRegister( m, &PyUpb_MessageMapContainer_Spec, base, methods); diff --git a/third_party/protobuf/python/message.c b/third_party/protobuf/python/message.c index 5ad1b06ebbd92..3fe7480a6f60c 100644 --- a/third_party/protobuf/python/message.c +++ b/third_party/protobuf/python/message.c @@ -12,8 +12,10 @@ #include "python/extension_dict.h" #include "python/map.h" #include "python/repeated.h" +#include "upb/base/string_view.h" #include "upb/message/compare.h" #include "upb/message/copy.h" +#include "upb/message/message.h" #include "upb/reflection/def.h" #include "upb/reflection/message.h" #include "upb/text/encode.h" @@ -177,8 +179,10 @@ err: // The parent may also be non-present, in which case a mutation will trigger a // chain reaction. typedef struct PyUpb_Message { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyObject* arena; + // clang-format on uintptr_t def; // Tagged, low bit 1 == upb_FieldDef*, else upb_MessageDef* union { // when def is msgdef, the data for this msg. @@ -314,9 +318,14 @@ static bool PyUpb_Message_LookupName(PyUpb_Message* self, PyObject* py_name, static bool PyUpb_Message_InitMessageMapEntry(PyObject* dst, PyObject* src) { if (!src || !dst) return false; - PyObject* ok = PyObject_CallMethod(dst, "CopyFrom", "O", src); - if (!ok) return false; - Py_DECREF(ok); + if (PyDict_Check(src)) { + bool ok = PyUpb_Message_InitAttributes(dst, NULL, src) >= 0; + if (!ok) return false; + } else { + PyObject* ok = PyObject_CallMethod(dst, "CopyFrom", "O", src); + if (!ok) return false; + Py_DECREF(ok); + } return true; } @@ -575,9 +584,7 @@ static bool PyUpb_Message_IsEmpty(const upb_Message* msg, upb_MessageValue val; if (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) return false; - size_t len; - (void)upb_Message_GetUnknown(msg, &len); - return len == 0; + return !upb_Message_HasUnknown(msg); } static bool PyUpb_Message_IsEqual(PyUpb_Message* m1, PyObject* _m2) { @@ -1482,7 +1489,8 @@ static PyObject* PyUpb_Message_DiscardUnknownFields(PyUpb_Message* self, PyObject* arg) { PyUpb_Message_EnsureReified(self); const upb_MessageDef* msgdef = _PyUpb_Message_GetMsgdef(self); - upb_Message_DiscardUnknown(self->ptr.msg, msgdef, 64); + const upb_DefPool* ext_pool = upb_FileDef_Pool(upb_MessageDef_File(msgdef)); + upb_Message_DiscardUnknown(self->ptr.msg, msgdef, ext_pool, 64); Py_RETURN_NONE; } diff --git a/third_party/protobuf/python/pb_unit_tests/BUILD b/third_party/protobuf/python/pb_unit_tests/BUILD deleted file mode 100644 index 38905afc8751a..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/BUILD +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2009-2021, Google LLC -# All rights reserved. -# -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file or at -# https://developers.google.com/open-source/licenses/bsd - -load(":pyproto_test_wrapper.bzl", "pyproto_test_wrapper") - -package(default_applicable_licenses = ["//:license"]) - -licenses(["notice"]) - -pyproto_test_wrapper(name = "descriptor_pool_test") - -pyproto_test_wrapper(name = "descriptor_test") - -pyproto_test_wrapper(name = "generator_test") - -pyproto_test_wrapper(name = "message_factory_test") - -pyproto_test_wrapper(name = "proto_builder_test") - -pyproto_test_wrapper(name = "message_test") - -pyproto_test_wrapper(name = "reflection_test") - -filegroup( - name = "test_files", - srcs = glob(["*.py"]), - visibility = [ - "//python/dist:__pkg__", # Scheuklappen: keep - ], -) diff --git a/third_party/protobuf/python/pb_unit_tests/README.md b/third_party/protobuf/python/pb_unit_tests/README.md deleted file mode 100644 index 669f0674da88d..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/README.md +++ /dev/null @@ -1,11 +0,0 @@ - -# Protobuf Unit Tests - -This directory contains wrappers around the Python unit tests defined in -the protobuf repo. Python+upb is intended to be a drop-in replacement for -protobuf Python, so we should be able to pass the same set of unit tests. - -Our wrappers contain exclusion lists for tests we know we are not currently -passing. Ideally these exclusion lists will become empty once Python+upb is -fully implemented. However there may be a few edge cases that we decide -are not worth matching with perfect parity. diff --git a/third_party/protobuf/python/pb_unit_tests/descriptor_pool_test_wrapper.py b/third_party/protobuf/python/pb_unit_tests/descriptor_pool_test_wrapper.py deleted file mode 100644 index 6397250fa8f09..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/descriptor_pool_test_wrapper.py +++ /dev/null @@ -1,37 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -import unittest -from google.protobuf.internal.descriptor_pool_test import * - -SecondaryDescriptorFromDescriptorDB.testErrorCollector.__unittest_expecting_failure__ = True - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/third_party/protobuf/python/pb_unit_tests/descriptor_test_wrapper.py b/third_party/protobuf/python/pb_unit_tests/descriptor_test_wrapper.py deleted file mode 100644 index b2be7cd3b306a..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/descriptor_test_wrapper.py +++ /dev/null @@ -1,41 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -from google.protobuf.internal.descriptor_test import * -import unittest - -# We pass this test, but the error message is slightly different. -# Our error message is better. -NewDescriptorTest.testImmutableCppDescriptor.__unittest_expecting_failure__ = True - -DescriptorTest.testGetDebugString.__unittest_expecting_failure__ = True - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/third_party/protobuf/python/pb_unit_tests/generator_test_wrapper.py b/third_party/protobuf/python/pb_unit_tests/generator_test_wrapper.py deleted file mode 100644 index 9ffc27f0d3c5c..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/generator_test_wrapper.py +++ /dev/null @@ -1,35 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -from google.protobuf.internal.generator_test import * -import unittest - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/third_party/protobuf/python/pb_unit_tests/message_factory_test_wrapper.py b/third_party/protobuf/python/pb_unit_tests/message_factory_test_wrapper.py deleted file mode 100644 index 4e3a7ba410dfb..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/message_factory_test_wrapper.py +++ /dev/null @@ -1,37 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -from google.protobuf.internal.message_factory_test import * -import unittest - -MessageFactoryTest.testDuplicateExtensionNumber.__unittest_expecting_failure__ = True - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/third_party/protobuf/python/pb_unit_tests/message_test_wrapper.py b/third_party/protobuf/python/pb_unit_tests/message_test_wrapper.py deleted file mode 100644 index 78f35853ab3a6..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/message_test_wrapper.py +++ /dev/null @@ -1,48 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -from google.protobuf.internal.message_test import * -import unittest - -# Python/C++ customizes the C++ TextFormat to always print trailing ".0" for -# floats. upb doesn't do this, it matches C++ TextFormat. -MessageTest.testFloatPrinting_proto2.__unittest_expecting_failure__ = True -MessageTest.testFloatPrinting_proto3.__unittest_expecting_failure__ = True - -# For these tests we are throwing the correct error, only the text of the error -# message is a mismatch. For technical reasons around the limited API, matching -# the existing error message exactly is not feasible. -Proto3Test.testCopyFromBadType.__unittest_expecting_failure__ = True -Proto3Test.testMergeFromBadType.__unittest_expecting_failure__ = True - -Proto2Test.test_documentation.__unittest_expecting_failure__ = True - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/third_party/protobuf/python/pb_unit_tests/proto_builder_test_wrapper.py b/third_party/protobuf/python/pb_unit_tests/proto_builder_test_wrapper.py deleted file mode 100644 index 468d13e66251c..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/proto_builder_test_wrapper.py +++ /dev/null @@ -1,37 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -from google.protobuf.internal.proto_builder_test import * -import unittest - -ProtoBuilderTest.testMakeLargeProtoClass.__unittest_expecting_failure__ = True - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/third_party/protobuf/python/pb_unit_tests/pyproto_test_wrapper.bzl b/third_party/protobuf/python/pb_unit_tests/pyproto_test_wrapper.bzl deleted file mode 100644 index 1e2b5daa2db5f..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/pyproto_test_wrapper.bzl +++ /dev/null @@ -1,24 +0,0 @@ -"""Wrapper for another py_test to run with upb, possibly with a set of expected failures.""" - -load("@rules_python//python:py_test.bzl", "py_test") - -def pyproto_test_wrapper(name, deps = []): - src = name + "_wrapper.py" - py_test( - name = name, - srcs = [src], - legacy_create_init = False, - main = src, - data = ["//src/google/protobuf:testdata"], - deps = [ - "//python:_message", - "//:python_common_test_protos", - "//:python_specific_test_protos", - "//:python_test_srcs", - "//:python_srcs", - ] + deps, - target_compatible_with = select({ - "@system_python//:supported": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - ) diff --git a/third_party/protobuf/python/pb_unit_tests/reflection_test_wrapper.py b/third_party/protobuf/python/pb_unit_tests/reflection_test_wrapper.py deleted file mode 100644 index 7572f7c0e5699..0000000000000 --- a/third_party/protobuf/python/pb_unit_tests/reflection_test_wrapper.py +++ /dev/null @@ -1,53 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -from google.protobuf.internal.reflection_test import * -import unittest - -# These tests depend on a specific iteration order for extensions, which is not -# reasonable to guarantee. -Proto2ReflectionTest.testExtensionIter.__unittest_expecting_failure__ = True - -# These tests depend on a specific serialization order for extensions, which is -# not reasonable to guarantee. -SerializationTest.testCanonicalSerializationOrder.__unittest_expecting_failure__ = True -SerializationTest.testCanonicalSerializationOrderSameAsCpp.__unittest_expecting_failure__ = True - -# This test relies on the internal implementation using Python descriptors. -# This is an implementation detail that users should not depend on. -SerializationTest.testFieldDataDescriptor.__unittest_expecting_failure__ = True - -SerializationTest.testFieldProperties.__unittest_expecting_failure__ = True - -# TODO Python Docker image on MacOS failing. -ClassAPITest.testParsingNestedClass.__unittest_skip__ = True - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/third_party/protobuf/python/protobuf.c b/third_party/protobuf/python/protobuf.c index 88e478d3c1c4a..12b5f44937980 100644 --- a/third_party/protobuf/python/protobuf.c +++ b/third_party/protobuf/python/protobuf.c @@ -199,8 +199,10 @@ PyObject* PyUpb_ObjCache_Get(const void* key) { // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD upb_Arena* arena; + // clang-format on } PyUpb_Arena; #ifdef __GLIBC__ @@ -399,7 +401,7 @@ bool PyUpb_IndexToRange(PyObject* index, Py_ssize_t size, Py_ssize_t* i, // Module Entry Point // ----------------------------------------------------------------------------- -__attribute__((visibility("default"))) PyMODINIT_FUNC PyInit__message(void) { +PyMODINIT_FUNC PyInit__message(void) { PyObject* m = PyModule_Create(&module_def); if (!m) return NULL; diff --git a/third_party/protobuf/python/protobuf_distutils/setup.py b/third_party/protobuf/python/protobuf_distutils/setup.py index e7a499803b9ee..818a5eef1c25b 100644 --- a/third_party/protobuf/python/protobuf_distutils/setup.py +++ b/third_party/protobuf/python/protobuf_distutils/setup.py @@ -30,11 +30,11 @@ setup( # These Python versions should match the protobuf package: 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Topic :: Software Development :: Code Generators', ], description=( diff --git a/third_party/protobuf/python/py_extension.bzl b/third_party/protobuf/python/py_extension.bzl index 2741cdf6ec312..2afae61df73b4 100644 --- a/third_party/protobuf/python/py_extension.bzl +++ b/third_party/protobuf/python/py_extension.bzl @@ -21,16 +21,14 @@ def py_extension(name, srcs, copts, deps = [], **kwargs): ( "//python/dist:osx_x86_64", "//python/dist:osx_aarch64", - ): ["-undefined", "dynamic_lookup"], + ): ["-Wl,-undefined,dynamic_lookup"], "//python/dist:windows_x86_32": ["-static-libgcc"], "//conditions:default": [], }), linkshared = True, linkstatic = True, deps = deps + select({ - "//python:limited_api_3.8": ["@python-3.8.0//:python_headers"], - "//python:full_api_3.8_win32": ["@nuget_python_i686_3.8.0//:python_full_api"], - "//python:full_api_3.8_win64": ["@nuget_python_x86-64_3.8.0//:python_full_api"], + "//python:limited_api_3.9": ["@python-3.9.0//:python_headers"], "//python:full_api_3.9_win32": ["@nuget_python_i686_3.9.0//:python_full_api"], "//python:full_api_3.9_win64": ["@nuget_python_x86-64_3.9.0//:python_full_api"], "//python:limited_api_3.10_win32": ["@nuget_python_i686_3.10.0//:python_limited_api"], diff --git a/third_party/protobuf/python/python_version_test.py b/third_party/protobuf/python/python_version_test.py index f851526a65100..a3730f3680261 100644 --- a/third_party/protobuf/python/python_version_test.py +++ b/third_party/protobuf/python/python_version_test.py @@ -4,7 +4,7 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd -"""Test that Kokoro is using the expected version of python.""" +"""Test that test runner is using the expected version of python.""" import os import sys @@ -18,7 +18,7 @@ class PythonVersionTest(unittest.TestCase): exp = os.getenv('KOKORO_PYTHON_VERSION', '') if not exp: - print('No kokoro python version found, skipping check', file=sys.stderr) + print('No system python version found, skipping check', file=sys.stderr) return self.assertTrue( sys.version.startswith(exp), diff --git a/third_party/protobuf/python/repeated.c b/third_party/protobuf/python/repeated.c index 7940b4d36fcc4..c0e39c079e458 100644 --- a/third_party/protobuf/python/repeated.c +++ b/third_party/protobuf/python/repeated.c @@ -18,8 +18,10 @@ static PyObject* PyUpb_RepeatedScalarContainer_Append(PyObject* _self, // Wrapper for a repeated field. typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyObject* arena; + // clang-format on // The field descriptor (PyObject*). // The low bit indicates whether the container is reified (see ptr below). // - low bit set: repeated field is a stub (no underlying data). @@ -179,15 +181,32 @@ PyObject* PyUpb_RepeatedContainer_Extend(PyObject* _self, PyObject* value) { bool submsg = upb_FieldDef_IsSubMessage(f); PyObject* e; - while ((e = PyIter_Next(it))) { - PyObject* ret; - if (submsg) { - ret = PyUpb_RepeatedCompositeContainer_Append(_self, e); - } else { - ret = PyUpb_RepeatedScalarContainer_Append(_self, e); + if (submsg) { + while ((e = PyIter_Next(it))) { + PyObject* ret = PyUpb_RepeatedCompositeContainer_Append(_self, e); + Py_XDECREF(ret); + Py_DECREF(e); + } + } else { + upb_Arena* arena = PyUpb_Arena_Get(self->arena); + Py_ssize_t size = PyObject_Size(value); + if (size < 0) { + // Some iterables may not have len. Size() will return -1 and + // set an error in such cases. + PyErr_Clear(); + } else { + upb_Array_Reserve(arr, start_size + size, arena); + } + while ((e = PyIter_Next(it))) { + upb_MessageValue msgval; + if (!PyUpb_PyToUpb(e, f, &msgval, arena)) { + assert(PyErr_Occurred()); + Py_DECREF(e); + break; + } + upb_Array_Append(arr, msgval, arena); + Py_DECREF(e); } - Py_XDECREF(ret); - Py_DECREF(e); } Py_DECREF(it); diff --git a/third_party/protobuf/python/requirements.txt b/third_party/protobuf/python/requirements.txt index dd0ac27ce2ee1..95c86012b1ef4 100644 --- a/third_party/protobuf/python/requirements.txt +++ b/third_party/protobuf/python/requirements.txt @@ -1,2 +1,3 @@ -numpy<=1.26.1 +numpy<=2.1.0 setuptools<=70.3.0 +absl-py==2.* diff --git a/third_party/protobuf/python/unknown_fields.c b/third_party/protobuf/python/unknown_fields.c index 8017bd89433af..f962e262fc55f 100644 --- a/third_party/protobuf/python/unknown_fields.c +++ b/third_party/protobuf/python/unknown_fields.c @@ -9,6 +9,7 @@ #include "python/message.h" #include "python/protobuf.h" +#include "upb/message/message.h" #include "upb/wire/eps_copy_input_stream.h" #include "upb/wire/reader.h" #include "upb/wire/types.h" @@ -18,8 +19,10 @@ // ----------------------------------------------------------------------------- typedef struct { - PyObject_HEAD; + // clang-format off + PyObject_HEAD PyObject* fields; + // clang-format on } PyUpb_UnknownFieldSet; static void PyUpb_UnknownFieldSet_Dealloc(PyObject* _self) { @@ -32,6 +35,7 @@ PyUpb_UnknownFieldSet* PyUpb_UnknownFieldSet_NewBare(void) { PyUpb_ModuleState* s = PyUpb_ModuleState_Get(); PyUpb_UnknownFieldSet* self = (void*)PyType_GenericAlloc(s->unknown_fields_type, 0); + self->fields = PyList_New(0); return self; } @@ -118,7 +122,6 @@ err: static const char* PyUpb_UnknownFieldSet_BuildMessageSet( PyUpb_UnknownFieldSet* self, upb_EpsCopyInputStream* stream, const char* ptr) { - self->fields = PyList_New(0); while (!upb_EpsCopyInputStream_IsDone(stream, &ptr)) { uint32_t tag; ptr = upb_WireReader_ReadTag(ptr, &tag); @@ -135,7 +138,6 @@ static const char* PyUpb_UnknownFieldSet_BuildMessageSet( err: Py_DECREF(self->fields); - self->fields = NULL; return NULL; } @@ -199,7 +201,6 @@ static const char* PyUpb_UnknownFieldSet_Build(PyUpb_UnknownFieldSet* self, const char* ptr, int group_number) { PyUpb_ModuleState* s = PyUpb_ModuleState_Get(); - self->fields = PyList_New(0); while (!upb_EpsCopyInputStream_IsDone(stream, &ptr)) { uint32_t tag; ptr = upb_WireReader_ReadTag(ptr, &tag); @@ -228,7 +229,6 @@ static const char* PyUpb_UnknownFieldSet_Build(PyUpb_UnknownFieldSet* self, err: Py_DECREF(self->fields); - self->fields = NULL; return NULL; } @@ -246,24 +246,25 @@ static PyObject* PyUpb_UnknownFieldSet_New(PyTypeObject* type, PyObject* args, upb_Message* msg = PyUpb_Message_GetIfReified(py_msg); if (!msg) return &self->ob_base; - size_t size; - const char* ptr = upb_Message_GetUnknown(msg, &size); - if (size == 0) return &self->ob_base; + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView view; + while (upb_Message_NextUnknown(msg, &view, &iter)) { + const char* ptr = view.data; + upb_EpsCopyInputStream stream; + upb_EpsCopyInputStream_Init(&stream, &ptr, view.size, true); + const upb_MessageDef* msgdef = PyUpb_Message_GetMsgdef(py_msg); - upb_EpsCopyInputStream stream; - upb_EpsCopyInputStream_Init(&stream, &ptr, size, true); - const upb_MessageDef* msgdef = PyUpb_Message_GetMsgdef(py_msg); + bool ok; + if (upb_MessageDef_IsMessageSet(msgdef)) { + ok = PyUpb_UnknownFieldSet_BuildMessageSet(self, &stream, ptr) != NULL; + } else { + ok = PyUpb_UnknownFieldSet_Build(self, &stream, ptr, -1) != NULL; + } - bool ok; - if (upb_MessageDef_IsMessageSet(msgdef)) { - ok = PyUpb_UnknownFieldSet_BuildMessageSet(self, &stream, ptr) != NULL; - } else { - ok = PyUpb_UnknownFieldSet_Build(self, &stream, ptr, -1) != NULL; - } - - if (!ok) { - Py_DECREF(&self->ob_base); - return NULL; + if (!ok) { + Py_DECREF(&self->ob_base); + return NULL; + } } return &self->ob_base; diff --git a/third_party/protobuf/regenerate_stale_files.sh b/third_party/protobuf/regenerate_stale_files.sh index b7322b5c708ab..863a514948c8b 100755 --- a/third_party/protobuf/regenerate_stale_files.sh +++ b/third_party/protobuf/regenerate_stale_files.sh @@ -13,12 +13,15 @@ cd $(dirname -- "$0") readonly BazelBin="${BAZEL:-bazel} ${BAZEL_STARTUP_FLAGS}" STALENESS_TESTS=( + "csharp:generated_csharp_defaults_staleness_test" "java/core:generated_java_defaults_staleness_test" "upb/reflection:bootstrap_upb_defaults_staleness_test" + "cmake:test_dependencies_staleness" "src:cmake_lists_staleness_test" "src/google/protobuf:well_known_types_staleness_test" "objectivec:well_known_types_staleness_test" "php:test_amalgamation_staleness" + "php:proto_staleness_test" "ruby/ext/google/protobuf_c:test_amalgamation_staleness" "upb/cmake:test_generated_files" "upb/reflection:descriptor_upb_proto_staleness_test" diff --git a/third_party/protobuf/ruby/.gitignore b/third_party/protobuf/ruby/.gitignore index 555af6ccb08b7..9ff054588096e 100644 --- a/third_party/protobuf/ruby/.gitignore +++ b/third_party/protobuf/ruby/.gitignore @@ -9,5 +9,7 @@ tmp/ tests/google/ ext/google/protobuf_c/third_party/utf8_range/utf8_range.h ext/google/protobuf_c/third_party/utf8_range/utf8_range.c +ext/google/protobuf_c/third_party/utf8_range/utf8_range_sse.inc +ext/google/protobuf_c/third_party/utf8_range/utf8_range_neon.inc ext/google/protobuf_c/third_party/utf8_range/LICENSE lib/google/protobuf/*_pb.rb \ No newline at end of file diff --git a/third_party/protobuf/ruby/Gemfile.lock b/third_party/protobuf/ruby/Gemfile.lock new file mode 100644 index 0000000000000..3a3b8fb843188 --- /dev/null +++ b/third_party/protobuf/ruby/Gemfile.lock @@ -0,0 +1,48 @@ +PATH + remote: . + specs: + google-protobuf (4.30.0-java) + ffi (~> 1) + ffi-compiler (~> 1) + rake (>= 13) + +GEM + remote: https://rubygems.org/ + specs: + bigdecimal (3.1.8) + bigdecimal (3.1.8-java) + ffi (1.17.1) + ffi (1.17.1-java) + ffi-compiler (1.3.2) + ffi (>= 1.15.5) + rake + power_assert (2.0.5) + rake (13.2.1) + rake-compiler (1.1.9) + rake + test-unit (3.6.7) + power_assert + +PLATFORMS + aarch64-linux + arm-linux + arm64-darwin + arm64-linux + java + x64-mingw-ucrt + x64-mingw32 + x86-linux + x86-mingw32 + x86_64-darwin + x86_64-linux + +DEPENDENCIES + bigdecimal + ffi (~> 1) + ffi-compiler (~> 1) + google-protobuf! + rake-compiler (~> 1.1.0) + test-unit (~> 3.0, >= 3.0.9) + +BUNDLED WITH + 2.4.10 diff --git a/third_party/protobuf/ruby/README.md b/third_party/protobuf/ruby/README.md index c7c71b733a811..fd5fc3085977b 100644 --- a/third_party/protobuf/ruby/README.md +++ b/third_party/protobuf/ruby/README.md @@ -51,15 +51,14 @@ puts MyTestMessage.encode_json(mymessage) Installation from Source (Building Gem) --------------------------------------- - Protocol Buffers has a new experimental backend that uses the [ffi](https://github.com/ffi/ffi) gem to provide a unified C-based implementation across Ruby interpreters based on -[UPB](https://github.com/protocolbuffers/upb). For now, use of the FFI -implementation is opt-in. If any of the following are true, the traditional -platform-native implementations (MRI-ruby based on CRuby, Java based on JRuby) -are used instead of the new FFI-based implementation: 1. `ffi` and +[UPB](https://github.com/protocolbuffers/protobuf/tree/main/upb). For now, use +of the FFI implementation is opt-in. If any of the following are true, the +traditional platform-native implementations (MRI-ruby based on CRuby, Java based +on JRuby) are used instead of the new FFI-based implementation: 1. `ffi` and `ffi-compiler` gems are not installed 2. `PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION` environment variable has a value other than `FFI` (case-insensitive). 3. FFI is unable to load the native library at runtime. diff --git a/third_party/protobuf/ruby/Rakefile b/third_party/protobuf/ruby/Rakefile index 33fb568a39828..fde98a91fe374 100644 --- a/third_party/protobuf/ruby/Rakefile +++ b/third_party/protobuf/ruby/Rakefile @@ -81,7 +81,7 @@ task :copy_third_party do # We need utf8_range in-tree. utf8_root = '../third_party/utf8_range' %w[ - utf8_range.h utf8_range.c LICENSE + utf8_range.h utf8_range.c utf8_range_sse.inc utf8_range_neon.inc LICENSE ].each do |file| FileUtils.cp File.join(utf8_root, file), "ext/google/protobuf_c/third_party/utf8_range" diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/BUILD.bazel b/third_party/protobuf/ruby/ext/google/protobuf_c/BUILD.bazel index ed91b2ccb6787..33c42bd17717c 100644 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/BUILD.bazel +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/BUILD.bazel @@ -118,7 +118,7 @@ apple_binary( "-undefined,dynamic_lookup", "-multiply_defined,suppress", ], - minimum_os_version = "10.11", + minimum_os_version = "11.0", platform_type = "macos", tags = ["manual"], deps = [ @@ -133,7 +133,7 @@ apple_binary( "-undefined,dynamic_lookup", "-multiply_defined,suppress", ], - minimum_os_version = "10.11", + minimum_os_version = "11.0", platform_type = "macos", tags = ["manual"], deps = [ diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/convert.c b/third_party/protobuf/ruby/ext/google/protobuf_c/convert.c index 2b2244b0dcca6..d2b70941eb4ad 100644 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/convert.c +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/convert.c @@ -112,16 +112,9 @@ VALUE Convert_CheckStringUtf8(VALUE str) { // not mean that it is *valid* UTF-8. We have to check separately // whether it is valid. if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) { - // TODO: For now - // we only warn for this case. We will remove the warning and throw an - // exception below in the 30.x release - - rb_warn( - "String is invalid UTF-8. This will be an error in a future " - "version."); - // VALUE exc = rb_const_get_at( - // rb_cEncoding, rb_intern("InvalidByteSequenceError")); - // rb_raise(exc, "String is invalid UTF-8"); + VALUE exc = rb_const_get_at( + rb_cEncoding, rb_intern("InvalidByteSequenceError")); + rb_raise(exc, "String is invalid UTF-8"); } } else { // Note: this will not duplicate underlying string data unless diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/defs.c b/third_party/protobuf/ruby/ext/google/protobuf_c/defs.c index d933049dda114..7a5b022196cc6 100644 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/defs.c +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/defs.c @@ -146,8 +146,8 @@ VALUE DescriptorPool_add_serialized_file(VALUE _self, * call-seq: * DescriptorPool.lookup(name) => descriptor * - * Finds a Descriptor, EnumDescriptor or FieldDescriptor by name and returns it, - * or nil if none exists with the given name. + * Finds a Descriptor, EnumDescriptor, FieldDescriptor or ServiceDescriptor by + * name and returns it, or nil if none exists with the given name. */ static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) { DescriptorPool* self = ruby_to_DescriptorPool(_self); @@ -451,6 +451,27 @@ static VALUE Descriptor_options(VALUE _self) { return message_options; } +/* + * call-seq: + * Descriptor.to_proto => DescriptorProto + * + * Returns the `DescriptorProto` of this `Descriptor`. + */ +static VALUE Descriptor_to_proto(VALUE _self) { + Descriptor* self = ruby_to_Descriptor(_self); + upb_Arena* arena = upb_Arena_New(); + google_protobuf_DescriptorProto* proto = + upb_MessageDef_ToProto(self->msgdef, arena); + size_t size; + const char* serialized = + google_protobuf_DescriptorProto_serialize(proto, arena, &size); + VALUE proto_class = rb_path2class("Google::Protobuf::DescriptorProto"); + VALUE proto_rb = + Message_decode_bytes(size, serialized, 0, proto_class, false); + upb_Arena_Free(arena); + return proto_rb; +} + static void Descriptor_register(VALUE module) { VALUE klass = rb_define_class_under(module, "Descriptor", rb_cObject); rb_define_alloc_func(klass, Descriptor_alloc); @@ -463,6 +484,7 @@ static void Descriptor_register(VALUE module) { rb_define_method(klass, "name", Descriptor_name, 0); rb_define_method(klass, "file_descriptor", Descriptor_file_descriptor, 0); rb_define_method(klass, "options", Descriptor_options, 0); + rb_define_method(klass, "to_proto", Descriptor_to_proto, 0); rb_include_module(klass, rb_mEnumerable); rb_gc_register_address(&cDescriptor); cDescriptor = klass; @@ -558,12 +580,37 @@ static VALUE FileDescriptor_options(VALUE _self) { return file_options; } +/* + * call-seq: + * FileDescriptor.to_proto => FileDescriptorProto + * + * Returns the `FileDescriptorProto` of this `FileDescriptor`. + */ +static VALUE FileDescriptor_to_proto(VALUE _self) { + FileDescriptor* self = ruby_to_FileDescriptor(_self); + upb_Arena* arena = upb_Arena_New(); + google_protobuf_FileDescriptorProto* file_proto = + upb_FileDef_ToProto(self->filedef, arena); + + size_t size; + const char* serialized = + google_protobuf_FileDescriptorProto_serialize(file_proto, arena, &size); + + VALUE file_proto_class = + rb_path2class("Google::Protobuf::FileDescriptorProto"); + VALUE proto_rb = + Message_decode_bytes(size, serialized, 0, file_proto_class, false); + upb_Arena_Free(arena); + return proto_rb; +} + static void FileDescriptor_register(VALUE module) { VALUE klass = rb_define_class_under(module, "FileDescriptor", rb_cObject); rb_define_alloc_func(klass, FileDescriptor_alloc); rb_define_method(klass, "initialize", FileDescriptor_initialize, 3); rb_define_method(klass, "name", FileDescriptor_name, 0); rb_define_method(klass, "options", FileDescriptor_options, 0); + rb_define_method(klass, "to_proto", FileDescriptor_to_proto, 0); rb_gc_register_address(&cFileDescriptor); cFileDescriptor = klass; } @@ -956,6 +1003,27 @@ static VALUE FieldDescriptor_options(VALUE _self) { return field_options; } +/* + * call-seq: + * FieldDescriptor.to_proto => FieldDescriptorProto + * + * Returns the `FieldDescriptorProto` of this `FieldDescriptor`. + */ +static VALUE FieldDescriptor_to_proto(VALUE _self) { + FieldDescriptor* self = ruby_to_FieldDescriptor(_self); + upb_Arena* arena = upb_Arena_New(); + google_protobuf_FieldDescriptorProto* proto = + upb_FieldDef_ToProto(self->fielddef, arena); + size_t size; + const char* serialized = + google_protobuf_FieldDescriptorProto_serialize(proto, arena, &size); + VALUE proto_class = rb_path2class("Google::Protobuf::FieldDescriptorProto"); + VALUE proto_rb = + Message_decode_bytes(size, serialized, 0, proto_class, false); + upb_Arena_Free(arena); + return proto_rb; +} + static void FieldDescriptor_register(VALUE module) { VALUE klass = rb_define_class_under(module, "FieldDescriptor", rb_cObject); rb_define_alloc_func(klass, FieldDescriptor_alloc); @@ -975,6 +1043,7 @@ static void FieldDescriptor_register(VALUE module) { rb_define_method(klass, "get", FieldDescriptor_get, 1); rb_define_method(klass, "set", FieldDescriptor_set, 2); rb_define_method(klass, "options", FieldDescriptor_options, 0); + rb_define_method(klass, "to_proto", FieldDescriptor_to_proto, 0); rb_gc_register_address(&cFieldDescriptor); cFieldDescriptor = klass; } @@ -1093,6 +1162,27 @@ static VALUE OneOfDescriptor_options(VALUE _self) { return oneof_options; } +/* + * call-seq: + * OneofDescriptor.to_proto => OneofDescriptorProto + * + * Returns the `OneofDescriptorProto` of this `OneofDescriptor`. + */ +static VALUE OneOfDescriptor_to_proto(VALUE _self) { + OneofDescriptor* self = ruby_to_OneofDescriptor(_self); + upb_Arena* arena = upb_Arena_New(); + google_protobuf_OneofDescriptorProto* proto = + upb_OneofDef_ToProto(self->oneofdef, arena); + size_t size; + const char* serialized = + google_protobuf_OneofDescriptorProto_serialize(proto, arena, &size); + VALUE proto_class = rb_path2class("Google::Protobuf::OneofDescriptorProto"); + VALUE proto_rb = + Message_decode_bytes(size, serialized, 0, proto_class, false); + upb_Arena_Free(arena); + return proto_rb; +} + static void OneofDescriptor_register(VALUE module) { VALUE klass = rb_define_class_under(module, "OneofDescriptor", rb_cObject); rb_define_alloc_func(klass, OneofDescriptor_alloc); @@ -1100,6 +1190,7 @@ static void OneofDescriptor_register(VALUE module) { rb_define_method(klass, "name", OneofDescriptor_name, 0); rb_define_method(klass, "each", OneofDescriptor_each, 0); rb_define_method(klass, "options", OneOfDescriptor_options, 0); + rb_define_method(klass, "to_proto", OneOfDescriptor_to_proto, 0); rb_include_module(klass, rb_mEnumerable); rb_gc_register_address(&cOneofDescriptor); cOneofDescriptor = klass; @@ -1298,6 +1389,29 @@ static VALUE EnumDescriptor_options(VALUE _self) { return enum_options; } +/* + * call-seq: + * EnumDescriptor.to_proto => EnumDescriptorProto + * + * Returns the `EnumDescriptorProto` of this `EnumDescriptor`. + */ +static VALUE EnumDescriptor_to_proto(VALUE _self) { + EnumDescriptor* self = ruby_to_EnumDescriptor(_self); + upb_Arena* arena = upb_Arena_New(); + google_protobuf_EnumDescriptorProto* proto = + upb_EnumDef_ToProto(self->enumdef, arena); + + size_t size; + const char* serialized = + google_protobuf_EnumDescriptorProto_serialize(proto, arena, &size); + + VALUE proto_class = rb_path2class("Google::Protobuf::EnumDescriptorProto"); + VALUE proto_rb = + Message_decode_bytes(size, serialized, 0, proto_class, false); + upb_Arena_Free(arena); + return proto_rb; +} + static void EnumDescriptor_register(VALUE module) { VALUE klass = rb_define_class_under(module, "EnumDescriptor", rb_cObject); rb_define_alloc_func(klass, EnumDescriptor_alloc); @@ -1310,6 +1424,7 @@ static void EnumDescriptor_register(VALUE module) { rb_define_method(klass, "file_descriptor", EnumDescriptor_file_descriptor, 0); rb_define_method(klass, "is_closed?", EnumDescriptor_is_closed, 0); rb_define_method(klass, "options", EnumDescriptor_options, 0); + rb_define_method(klass, "to_proto", EnumDescriptor_to_proto, 0); rb_include_module(klass, rb_mEnumerable); rb_gc_register_address(&cEnumDescriptor); cEnumDescriptor = klass; @@ -1438,6 +1553,27 @@ static VALUE ServiceDescriptor_options(VALUE _self) { return service_options; } +/* + * call-seq: + * ServiceDescriptor.to_proto => ServiceDescriptorProto + * + * Returns the `ServiceDescriptorProto` of this `ServiceDescriptor`. + */ +static VALUE ServiceDescriptor_to_proto(VALUE _self) { + ServiceDescriptor* self = ruby_to_ServiceDescriptor(_self); + upb_Arena* arena = upb_Arena_New(); + google_protobuf_ServiceDescriptorProto* proto = + upb_ServiceDef_ToProto(self->servicedef, arena); + size_t size; + const char* serialized = + google_protobuf_ServiceDescriptorProto_serialize(proto, arena, &size); + VALUE proto_class = rb_path2class("Google::Protobuf::ServiceDescriptorProto"); + VALUE proto_rb = + Message_decode_bytes(size, serialized, 0, proto_class, false); + upb_Arena_Free(arena); + return proto_rb; +} + static void ServiceDescriptor_register(VALUE module) { VALUE klass = rb_define_class_under(module, "ServiceDescriptor", rb_cObject); rb_define_alloc_func(klass, ServiceDescriptor_alloc); @@ -1447,6 +1583,7 @@ static void ServiceDescriptor_register(VALUE module) { rb_define_method(klass, "file_descriptor", ServiceDescriptor_file_descriptor, 0); rb_define_method(klass, "options", ServiceDescriptor_options, 0); + rb_define_method(klass, "to_proto", ServiceDescriptor_to_proto, 0); rb_include_module(klass, rb_mEnumerable); rb_gc_register_address(&cServiceDescriptor); cServiceDescriptor = klass; @@ -1580,6 +1717,27 @@ static VALUE MethodDescriptor_client_streaming(VALUE _self) { return upb_MethodDef_ClientStreaming(self->methoddef) ? Qtrue : Qfalse; } +/* + * call-seq: + * MethodDescriptor.to_proto => MethodDescriptorProto + * + * Returns the `MethodDescriptorProto` of this `MethodDescriptor`. + */ +static VALUE MethodDescriptor_to_proto(VALUE _self) { + MethodDescriptor* self = ruby_to_MethodDescriptor(_self); + upb_Arena* arena = upb_Arena_New(); + google_protobuf_MethodDescriptorProto* proto = + upb_MethodDef_ToProto(self->methoddef, arena); + size_t size; + const char* serialized = + google_protobuf_MethodDescriptorProto_serialize(proto, arena, &size); + VALUE proto_class = rb_path2class("Google::Protobuf::MethodDescriptorProto"); + VALUE proto_rb = + Message_decode_bytes(size, serialized, 0, proto_class, false); + upb_Arena_Free(arena); + return proto_rb; +} + /* * call-seq: * MethodDescriptor.server_streaming => bool @@ -1603,6 +1761,7 @@ static void MethodDescriptor_register(VALUE module) { 0); rb_define_method(klass, "server_streaming", MethodDescriptor_server_streaming, 0); + rb_define_method(klass, "to_proto", MethodDescriptor_to_proto, 0); rb_gc_register_address(&cMethodDescriptor); cMethodDescriptor = klass; } diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/extconf.rb b/third_party/protobuf/ruby/ext/google/protobuf_c/extconf.rb index ed812c9549454..4e80949e29731 100755 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/extconf.rb +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/extconf.rb @@ -6,6 +6,18 @@ ext_name = "google/protobuf_c" dir_config(ext_name) +if ENV["CC"] + RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] +end + +if ENV["CXX"] + RbConfig::CONFIG["CXX"] = RbConfig::MAKEFILE_CONFIG["CXX"] = ENV["CXX"] +end + +if ENV["LD"] + RbConfig::CONFIG["LD"] = RbConfig::MAKEFILE_CONFIG["LD"] = ENV["LD"] +end + if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /freebsd/ $CFLAGS += " -std=gnu99 -O3 -DNDEBUG -fvisibility=hidden -Wall -Wsign-compare -Wno-declaration-after-statement" else diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/glue.c b/third_party/protobuf/ruby/ext/google/protobuf_c/glue.c index 3c84d7fb47555..46e9146347128 100644 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/glue.c +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/glue.c @@ -26,6 +26,15 @@ char* EnumDescriptor_serialized_options(const upb_EnumDef* enumdef, return serialized; } +char* EnumDescriptor_serialized_to_proto(const upb_EnumDef* enumdef, + size_t* size, upb_Arena* arena) { + const google_protobuf_EnumDescriptorProto* file_proto = + upb_EnumDef_ToProto(enumdef, arena); + char* serialized = + google_protobuf_EnumDescriptorProto_serialize(file_proto, arena, size); + return serialized; +} + char* FileDescriptor_serialized_options(const upb_FileDef* filedef, size_t* size, upb_Arena* arena) { const google_protobuf_FileOptions* opts = upb_FileDef_Options(filedef); @@ -33,6 +42,15 @@ char* FileDescriptor_serialized_options(const upb_FileDef* filedef, return serialized; } +char* FileDescriptor_serialized_to_proto(const upb_FileDef* filedef, + size_t* size, upb_Arena* arena) { + const google_protobuf_FileDescriptorProto* file_proto = + upb_FileDef_ToProto(filedef, arena); + char* serialized = + google_protobuf_FileDescriptorProto_serialize(file_proto, arena, size); + return serialized; +} + char* Descriptor_serialized_options(const upb_MessageDef* msgdef, size_t* size, upb_Arena* arena) { const google_protobuf_MessageOptions* opts = upb_MessageDef_Options(msgdef); @@ -41,6 +59,15 @@ char* Descriptor_serialized_options(const upb_MessageDef* msgdef, size_t* size, return serialized; } +char* Descriptor_serialized_to_proto(const upb_MessageDef* msgdef, size_t* size, + upb_Arena* arena) { + const google_protobuf_DescriptorProto* proto = + upb_MessageDef_ToProto(msgdef, arena); + char* serialized = + google_protobuf_DescriptorProto_serialize(proto, arena, size); + return serialized; +} + char* OneOfDescriptor_serialized_options(const upb_OneofDef* oneofdef, size_t* size, upb_Arena* arena) { const google_protobuf_OneofOptions* opts = upb_OneofDef_Options(oneofdef); @@ -48,6 +75,15 @@ char* OneOfDescriptor_serialized_options(const upb_OneofDef* oneofdef, return serialized; } +char* OneOfDescriptor_serialized_to_proto(const upb_OneofDef* oneofdef, + size_t* size, upb_Arena* arena) { + const google_protobuf_OneofDescriptorProto* proto = + upb_OneofDef_ToProto(oneofdef, arena); + char* serialized = + google_protobuf_OneofDescriptorProto_serialize(proto, arena, size); + return serialized; +} + char* FieldDescriptor_serialized_options(const upb_FieldDef* fielddef, size_t* size, upb_Arena* arena) { const google_protobuf_FieldOptions* opts = upb_FieldDef_Options(fielddef); @@ -55,6 +91,15 @@ char* FieldDescriptor_serialized_options(const upb_FieldDef* fielddef, return serialized; } +char* FieldDescriptor_serialized_to_proto(const upb_FieldDef* fieldef, + size_t* size, upb_Arena* arena) { + const google_protobuf_FieldDescriptorProto* proto = + upb_FieldDef_ToProto(fieldef, arena); + char* serialized = + google_protobuf_FieldDescriptorProto_serialize(proto, arena, size); + return serialized; +} + char* ServiceDescriptor_serialized_options(const upb_ServiceDef* servicedef, size_t* size, upb_Arena* arena) { const google_protobuf_ServiceOptions* opts = @@ -64,9 +109,27 @@ char* ServiceDescriptor_serialized_options(const upb_ServiceDef* servicedef, return serialized; } +char* ServiceDescriptor_serialized_to_proto(const upb_ServiceDef* servicedef, + size_t* size, upb_Arena* arena) { + const google_protobuf_ServiceDescriptorProto* proto = + upb_ServiceDef_ToProto(servicedef, arena); + char* serialized = + google_protobuf_ServiceDescriptorProto_serialize(proto, arena, size); + return serialized; +} + char* MethodDescriptor_serialized_options(const upb_MethodDef* methoddef, size_t* size, upb_Arena* arena) { const google_protobuf_MethodOptions* opts = upb_MethodDef_Options(methoddef); char* serialized = google_protobuf_MethodOptions_serialize(opts, arena, size); return serialized; } + +char* MethodDescriptor_serialized_to_proto(const upb_MethodDef* methodef, + size_t* size, upb_Arena* arena) { + const google_protobuf_MethodDescriptorProto* proto = + upb_MethodDef_ToProto(methodef, arena); + char* serialized = + google_protobuf_MethodDescriptorProto_serialize(proto, arena, size); + return serialized; +} \ No newline at end of file diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/message.c b/third_party/protobuf/ruby/ext/google/protobuf_c/message.c index 37f4dc70d011a..b909e75c8060d 100644 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/message.c +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/message.c @@ -362,7 +362,8 @@ static VALUE Message_field_accessor(VALUE _self, const upb_FieldDef* f, if (!upb_FieldDef_HasPresence(f)) { rb_raise(rb_eRuntimeError, "Field does not have presence."); } - return upb_Message_HasFieldByDef(Message_Get(_self, NULL), f); + return upb_Message_HasFieldByDef(Message_Get(_self, NULL), f) ? Qtrue + : Qfalse; case METHOD_WRAPPER_GETTER: { Message* self = ruby_to_Message(_self); if (upb_Message_HasFieldByDef(self->msg, f)) { @@ -1046,9 +1047,6 @@ static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) { switch (result) { case kUpb_JsonDecodeResult_Ok: break; - case kUpb_JsonDecodeResult_OkWithEmptyStringNumerics: - rb_warn("%s", upb_Status_ErrorMessage(&status)); - break; case kUpb_JsonDecodeResult_Error: rb_raise(cParseError, "Error occurred during parsing: %s", upb_Status_ErrorMessage(&status)); diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.c b/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.c index e84395bf882c5..4df4886a6043e 100644 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.c +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.c @@ -286,7 +286,8 @@ VALUE ObjectCache_Get(const void *key) { static VALUE Google_Protobuf_discard_unknown(VALUE self, VALUE msg_rb) { const upb_MessageDef *m; upb_Message *msg = Message_GetMutable(msg_rb, &m); - if (!upb_Message_DiscardUnknown(msg, m, 128)) { + const upb_DefPool* ext_pool = upb_FileDef_Pool(upb_MessageDef_File(m)); + if (!upb_Message_DiscardUnknown(msg, m, ext_pool, 128)) { rb_raise(rb_eRuntimeError, "Messages nested too deeply."); } diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.c b/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.c index c7c4526b6f255..eb2ac74c70e3f 100644 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.c @@ -24,9 +24,9 @@ */ #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(__cplusplus) && __cplusplus >= 201703L) || \ (defined(_MSC_VER) && _MSC_VER >= 1900)) -#error upb requires C99 or C++14 or MSVC >= 2015. +#error upb requires C99 or C++17 or MSVC >= 2015. #endif // Portable check for GCC minimum version: @@ -58,7 +58,14 @@ Error, UINTPTR_MAX is undefined /* If we always read/write as a consistent type to each address, this shouldn't * violate aliasing. */ -#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) +#define UPB_PTR_AT(msg, ofs, type) ((type *)((char *)(msg) + (ofs))) + +// A flexible array member may have lower alignment requirements than the struct +// overall - in that case, it can overlap with the trailing padding of the rest +// of the struct, and a naive sizeof(base) + sizeof(flex) * count calculation +// will not take into account that overlap, and allocate more than is required. +#define UPB_SIZEOF_FLEX(type, member, count) \ + UPB_MAX(sizeof(type), offsetof(type, member[count])) #define UPB_MAPTYPE_STRING 0 @@ -72,12 +79,19 @@ Error, UINTPTR_MAX is undefined // UPB_INLINE: inline if possible, emit standalone code if required. #ifdef __cplusplus #define UPB_INLINE inline -#elif defined (__GNUC__) || defined(__clang__) +#elif defined(__GNUC__) || defined(__clang__) #define UPB_INLINE static __inline__ #else #define UPB_INLINE static #endif +// UPB_INLINE_IF_NOT_GCC: because gcc can be very noisy at times. +#if defined(__GNUC__) && !defined(__clang__) +#define UPB_INLINE_IF_NOT_GCC static +#else +#define UPB_INLINE_IF_NOT_GCC UPB_INLINE +#endif + #ifdef UPB_BUILD_API #define UPB_API UPB_EXPORT #define UPB_API_INLINE UPB_EXPORT @@ -99,7 +113,13 @@ Error, UINTPTR_MAX is undefined #ifdef __clang__ #define UPB_ALIGN_OF(type) _Alignof(type) #else -#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) +#define UPB_ALIGN_OF(type) \ + offsetof( \ + struct { \ + char c; \ + type member; \ + }, \ + member) #endif #ifdef _MSC_VER @@ -110,7 +130,7 @@ Error, UINTPTR_MAX is undefined #endif // Hints to the compiler about likely/unlikely branches. -#if defined (__GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) #else @@ -118,18 +138,30 @@ Error, UINTPTR_MAX is undefined #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static #define UPB_NOINLINE __attribute__((noinline)) #define UPB_NORETURN __attribute__((__noreturn__)) -#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) +#define UPB_PRINTF(str, first_vararg) \ + __attribute__((format(printf, str, first_vararg))) #elif defined(_MSC_VER) #define UPB_NOINLINE #define UPB_FORCEINLINE static #define UPB_NORETURN __declspec(noreturn) #define UPB_PRINTF(str, first_vararg) -#else /* !defined(__GNUC__) */ +#else /* !defined(__GNUC__) */ #define UPB_FORCEINLINE static #define UPB_NOINLINE #define UPB_NORETURN @@ -144,11 +176,15 @@ Error, UINTPTR_MAX is undefined // UPB_ASSUME(): in release mode, we tell the compiler to assume this is true. #ifdef NDEBUG #ifdef __GNUC__ -#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() +#define UPB_ASSUME(expr) \ + if (!(expr)) __builtin_unreachable() #elif defined _MSC_VER -#define UPB_ASSUME(expr) if (!(expr)) __assume(0) +#define UPB_ASSUME(expr) \ + if (!(expr)) __assume(0) #else -#define UPB_ASSUME(expr) do {} while (false && (expr)) +#define UPB_ASSUME(expr) \ + do { \ + } while (false && (expr)) #endif #else #define UPB_ASSUME(expr) assert(expr) @@ -157,13 +193,19 @@ Error, UINTPTR_MAX is undefined /* UPB_ASSERT(): in release mode, we use the expression without letting it be * evaluated. This prevents "unused variable" warnings. */ #ifdef NDEBUG -#define UPB_ASSERT(expr) do {} while (false && (expr)) +#define UPB_ASSERT(expr) \ + do { \ + } while (false && (expr)) #else #define UPB_ASSERT(expr) assert(expr) #endif #if defined(__GNUC__) || defined(__clang__) -#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __builtin_unreachable(); \ + } while (0) #elif defined(_MSC_VER) #define UPB_UNREACHABLE() \ do { \ @@ -171,13 +213,26 @@ Error, UINTPTR_MAX is undefined __assume(0); \ } while (0) #else -#define UPB_UNREACHABLE() do { assert(0); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + } while (0) #endif -/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ -#ifdef __APPLE__ -#define UPB_SETJMP(buf) _setjmp(buf) -#define UPB_LONGJMP(buf, val) _longjmp(buf, val) +#ifdef __ANDROID__ +#define UPB_DEFAULT_MAX_BLOCK_SIZE 8192 +#else +#define UPB_DEFAULT_MAX_BLOCK_SIZE 32768 +#endif + +/* UPB_SETJMP() / UPB_LONGJMP() */ +// Android uses a custom libc that does not implement all of posix, but it has +// had sigsetjmp/siglongjmp forever on arm and since API 12 on x86. Apple has +// sigsetjmp, but does not define the posix feature test macro. +#if defined(__APPLE__) || defined(_POSIX_C_SOURCE) || defined(__ANDROID__) +// avoid setting/restoring signal mask, which involves costly syscalls +#define UPB_SETJMP(buf) sigsetjmp(buf, 0) +#define UPB_LONGJMP(buf, val) siglongjmp(buf, val) #elif defined(WASM_WAMR) #define UPB_SETJMP(buf) 0 #define UPB_LONGJMP(buf, val) abort() @@ -186,9 +241,23 @@ Error, UINTPTR_MAX is undefined #define UPB_LONGJMP(buf, val) longjmp(buf, val) #endif -#ifdef __GNUC__ +#if ((__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)) #define UPB_USE_C11_ATOMICS +#elif defined(__has_extension) +#if __has_extension(c_atomic) +#define UPB_USE_C11_ATOMICS +#endif +#elif defined(__GNUC__) +// GCC supported atomics as an extension before it supported __has_extension +#define UPB_USE_C11_ATOMICS +#elif defined(_MSC_VER) +#define UPB_USE_MSC_ATOMICS +#endif + +#if defined(UPB_USE_C11_ATOMICS) #define UPB_ATOMIC(T) _Atomic(T) +#elif defined(UPB_USE_MSC_ATOMICS) +#define UPB_ATOMIC(T) volatile T #else #define UPB_ATOMIC(T) T #endif @@ -276,7 +345,7 @@ Error, UINTPTR_MAX is undefined */ /* Due to preprocessor limitations, the conditional logic for setting - * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner. + * UPB_CLANG_ASAN below cannot be consolidated into a portable one-liner. * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html. */ #if defined(__has_feature) @@ -285,8 +354,14 @@ Error, UINTPTR_MAX is undefined #else #define UPB_CLANG_ASAN 0 #endif +#if __has_feature(thread_sanitizer) +#define UPB_CLANG_TSAN 1 +#else +#define UPB_CLANG_TSAN 0 +#endif #else #define UPB_CLANG_ASAN 0 +#define UPB_CLANG_TSAN 0 #endif #if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN @@ -295,10 +370,10 @@ Error, UINTPTR_MAX is undefined #ifdef __cplusplus extern "C" { #endif -void __asan_poison_memory_region(void const volatile *addr, size_t size); -void __asan_unpoison_memory_region(void const volatile *addr, size_t size); + void __asan_poison_memory_region(void const volatile *addr, size_t size); + void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #ifdef __cplusplus -} /* extern "C" */ +} /* extern "C" */ #endif #define UPB_POISON_MEMORY_REGION(addr, size) \ __asan_poison_memory_region((addr), (size)) @@ -307,10 +382,38 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #else #define UPB_ASAN 0 #define UPB_ASAN_GUARD_SIZE 0 -#define UPB_POISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) -#define UPB_UNPOISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) +#define UPB_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#define UPB_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#endif + +#if defined(__SANITIZE_THREAD__) || UPB_CLANG_TSAN +#define UPB_TSAN_PUBLISHED_MEMBER uintptr_t upb_tsan_safely_published; +#define UPB_TSAN_INIT_PUBLISHED(ptr) (ptr)->upb_tsan_safely_published = 0x5AFE +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + UPB_ASSERT((ptr)->upb_tsan_safely_published == 0x5AFE) +#define UPB_TSAN_PUBLISH 1 +#define UPB_TSAN_CHECK_READ(member) \ + __asm__ volatile("" ::"r"(*(char *)&(member))) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + char *write_upb_tsan_detect_race_ptr = (char *)&(member); \ + char write_upb_tsan_detect_race = *write_upb_tsan_detect_race_ptr; \ + __asm__ volatile("" : "+r"(write_upb_tsan_detect_race)); \ + *write_upb_tsan_detect_race_ptr = write_upb_tsan_detect_race; \ + } while (false) +#else +#define UPB_TSAN_PUBLISHED_MEMBER +#define UPB_TSAN_INIT_PUBLISHED(ptr) +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + do { \ + } while (false && (ptr)) +#define UPB_TSAN_PUBLISH 0 +#define UPB_TSAN_CHECK_READ(member) \ + do { \ + } while (false && (member)) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + } while (false && (member)) #endif /* Disable proto2 arena behavior (TEMPORARY) **********************************/ @@ -376,8 +479,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #if defined(__ELF__) || defined(__wasm__) -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("linkarr_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("linkarr_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name; \ extern type const __stop_linkarr_##name; \ @@ -388,8 +492,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #elif defined(__MACH__) /* As described in: https://stackoverflow.com/a/22366882 */ -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("__DATA,__la_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("__DATA,__la_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name __asm( \ "section$start$__DATA$__la_" #name); \ @@ -409,8 +514,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // Usage of __attribute__ here probably means this is Clang-specific, and would // not work on MSVC. -#define UPB_LINKARR_APPEND(name) \ - __declspec(allocate("la_" #name "$j")) __attribute__((retain, used)) +#define UPB_LINKARR_APPEND(name) \ + __declspec(allocate("la_" #name "$j")) \ + __attribute__((retain, used, no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ __declspec(allocate("la_" #name "$a")) type __start_linkarr_##name; \ __declspec(allocate("la_" #name "$z")) type __stop_linkarr_##name; \ @@ -431,10 +537,6 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // user code can be updated before upgrading versions of protobuf. #ifdef UPB_FUTURE_BREAKING_CHANGES -// Properly enforce closed enums in python. -// Owner: mkruskal@ -#define UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT 1 - #endif @@ -1156,7 +1258,7 @@ static int64_t jsondec_strtoint64(jsondec* d, upb_StringView str) { static void jsondec_checkempty(jsondec* d, upb_StringView str, const upb_FieldDef* f) { if (str.size != 0) return; - d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics; + d->result = kUpb_JsonDecodeResult_Error; upb_Status_SetErrorFormat(d->status, "Empty string is not a valid number (field: %s). " "This will be an error in a future version.", @@ -1264,7 +1366,7 @@ static upb_MessageValue jsondec_double(jsondec* d, const upb_FieldDef* f) { char* end; val.double_val = strtod(str.data, &end); if (end != str.data + str.size) { - d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics; + d->result = kUpb_JsonDecodeResult_Error; upb_Status_SetErrorFormat( d->status, "Non-number characters in quoted number (field: %s). " @@ -2859,14 +2961,15 @@ upb_alloc upb_alloc_global = {&upb_global_allocfunc}; // Must be last. -static UPB_ATOMIC(size_t) max_block_size = 32 << 10; +static UPB_ATOMIC(size_t) g_max_block_size = UPB_DEFAULT_MAX_BLOCK_SIZE; -void upb_Arena_SetMaxBlockSize(size_t max) { max_block_size = max; } +void upb_Arena_SetMaxBlockSize(size_t max) { + upb_Atomic_Store(&g_max_block_size, max, memory_order_relaxed); +} typedef struct upb_MemBlock { - // Atomic only for the benefit of SpaceAllocated(). - UPB_ATOMIC(struct upb_MemBlock*) next; - uint32_t size; + struct upb_MemBlock* next; + size_t size; // Data follows. } upb_MemBlock; @@ -2875,6 +2978,10 @@ typedef struct upb_ArenaInternal { // block. uintptr_t block_alloc; + // The cleanup for the allocator. This is called after all the blocks are + // freed in an arena. + upb_AllocCleanupFunc* upb_alloc_cleanup; + // When multiple arenas are fused together, each arena points to a parent // arena (root points to itself). The root tracks how many live arenas // reference it. @@ -2888,15 +2995,19 @@ typedef struct upb_ArenaInternal { // == NULL at end of list. UPB_ATOMIC(struct upb_ArenaInternal*) next; - // The last element of the linked list. This is present only as an - // optimization, so that we do not have to iterate over all members for every - // fuse. Only significant for an arena root. In other cases it is ignored. - // == self when no other list members. - UPB_ATOMIC(struct upb_ArenaInternal*) tail; + // If the low bit is set, is a pointer to the tail of the list (populated for + // roots, set to self for roots with no fused arenas). If the low bit is not + // set, is a pointer to the previous node in the list, such that + // a->previous_or_tail->next == a. + UPB_ATOMIC(uintptr_t) previous_or_tail; - // Linked list of blocks to free/cleanup. Atomic only for the benefit of - // upb_Arena_SpaceAllocated(). - UPB_ATOMIC(upb_MemBlock*) blocks; + // Linked list of blocks to free/cleanup. + upb_MemBlock* blocks; + + // Total space allocated in blocks, atomic only for SpaceAllocated + UPB_ATOMIC(uintptr_t) space_allocated; + + UPB_TSAN_PUBLISHED_MEMBER } upb_ArenaInternal; // All public + private state for an arena. @@ -2911,7 +3022,7 @@ typedef struct { } upb_ArenaRoot; static const size_t kUpb_MemblockReserve = - UPB_ALIGN_UP(sizeof(upb_MemBlock), UPB_MALLOC_ALIGN); + UPB_ALIGN_MALLOC(sizeof(upb_MemBlock)); // Extracts the (upb_ArenaInternal*) from a (upb_Arena*) static upb_ArenaInternal* upb_Arena_Internal(const upb_Arena* a) { @@ -2949,6 +3060,38 @@ static uintptr_t _upb_Arena_TaggedFromPointer(upb_ArenaInternal* ai) { return parent_or_count; } +static bool _upb_Arena_IsTaggedTail(uintptr_t previous_or_tail) { + return (previous_or_tail & 1) == 1; +} + +static bool _upb_Arena_IsTaggedPrevious(uintptr_t previous_or_tail) { + return (previous_or_tail & 1) == 0; +} + +static upb_ArenaInternal* _upb_Arena_TailFromTagged( + uintptr_t previous_or_tail) { + UPB_ASSERT(_upb_Arena_IsTaggedTail(previous_or_tail)); + return (upb_ArenaInternal*)(previous_or_tail ^ 1); +} + +static uintptr_t _upb_Arena_TaggedFromTail(upb_ArenaInternal* tail) { + uintptr_t previous_or_tail = (uintptr_t)tail | 1; + UPB_ASSERT(_upb_Arena_IsTaggedTail(previous_or_tail)); + return previous_or_tail; +} + +static upb_ArenaInternal* _upb_Arena_PreviousFromTagged( + uintptr_t previous_or_tail) { + UPB_ASSERT(_upb_Arena_IsTaggedPrevious(previous_or_tail)); + return (upb_ArenaInternal*)previous_or_tail; +} + +static uintptr_t _upb_Arena_TaggedFromPrevious(upb_ArenaInternal* ai) { + uintptr_t previous = (uintptr_t)ai; + UPB_ASSERT(_upb_Arena_IsTaggedPrevious(previous)); + return previous; +} + static upb_alloc* _upb_ArenaInternal_BlockAlloc(upb_ArenaInternal* ai) { return (upb_alloc*)(ai->block_alloc & ~0x1); } @@ -2995,56 +3138,79 @@ void upb_Arena_LogFree(const upb_Arena* arena) { } #endif // UPB_TRACING_ENABLED -static upb_ArenaRoot _upb_Arena_FindRoot(upb_Arena* a) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - while (_upb_Arena_IsTaggedPointer(poc)) { +// If the param a is already the root, provides no memory order of refcount. +// If it has a parent, then acquire memory order is provided for both the root +// and the refcount. Thread safe. +static upb_ArenaRoot _upb_Arena_FindRoot(upb_ArenaInternal* ai) { + uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_relaxed); + if (_upb_Arena_IsTaggedRefcount(poc)) { + // Fast, relaxed path - arenas that have never been fused to a parent only + // need relaxed memory order, since they're returning themselves and the + // refcount. + return (upb_ArenaRoot){.root = ai, .tagged_count = poc}; + } + // Slow path needs acquire order; reloading is cheaper than a fence on ARM + // (LDA vs DMB ISH). Even though this is a reread, we know it must be a tagged + // pointer because if this Arena isn't a root, it can't ever become one. + poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); + do { upb_ArenaInternal* next = _upb_Arena_PointerFromTagged(poc); + UPB_TSAN_CHECK_PUBLISHED(next); UPB_ASSERT(ai != next); - uintptr_t next_poc = - upb_Atomic_Load(&next->parent_or_count, memory_order_acquire); + poc = upb_Atomic_Load(&next->parent_or_count, memory_order_acquire); - if (_upb_Arena_IsTaggedPointer(next_poc)) { + if (_upb_Arena_IsTaggedPointer(poc)) { // To keep complexity down, we lazily collapse levels of the tree. This // keeps it flat in the final case, but doesn't cost much incrementally. // // Path splitting keeps time complexity down, see: // https://en.wikipedia.org/wiki/Disjoint-set_data_structure - // - // We can safely use a relaxed atomic here because all threads doing this - // will converge on the same value and we don't need memory orderings to - // be visible. - // - // This is true because: - // - If no fuses occur, this will eventually become the root. - // - If fuses are actively occurring, the root may change, but the - // invariant is that `parent_or_count` merely points to *a* parent. - // - // In other words, it is moving towards "the" root, and that root may move - // further away over time, but the path towards that root will continue to - // be valid and the creation of the path carries all the memory orderings - // required. - UPB_ASSERT(ai != _upb_Arena_PointerFromTagged(next_poc)); - upb_Atomic_Store(&ai->parent_or_count, next_poc, memory_order_relaxed); + UPB_ASSERT(ai != _upb_Arena_PointerFromTagged(poc)); + upb_Atomic_Store(&ai->parent_or_count, poc, memory_order_release); } ai = next; - poc = next_poc; - } + } while (_upb_Arena_IsTaggedPointer(poc)); return (upb_ArenaRoot){.root = ai, .tagged_count = poc}; } -size_t upb_Arena_SpaceAllocated(upb_Arena* arena, size_t* fused_count) { - upb_ArenaInternal* ai = _upb_Arena_FindRoot(arena).root; - size_t memsize = 0; +uintptr_t upb_Arena_SpaceAllocated(const upb_Arena* arena, + size_t* fused_count) { + upb_ArenaInternal* ai = upb_Arena_Internal(arena); + uintptr_t memsize = 0; size_t local_fused_count = 0; - + // Our root would get updated by any racing fuses before our target arena + // became reachable from the root via the linked list; in order to preserve + // monotonic output (any arena counted by a previous invocation is counted by + // this one), we instead iterate forwards and backwards so that we only see + // the results of completed fuses. + uintptr_t previous_or_tail = + upb_Atomic_Load(&ai->previous_or_tail, memory_order_acquire); + while (_upb_Arena_IsTaggedPrevious(previous_or_tail)) { + upb_ArenaInternal* previous = + _upb_Arena_PreviousFromTagged(previous_or_tail); + UPB_ASSERT(previous != ai); + UPB_TSAN_CHECK_PUBLISHED(previous); + // Unfortunate macro behavior; prior to C11 when using nonstandard atomics + // this returns a void* and can't be used with += without an intermediate + // conversion to an integer. + // Relaxed is safe - no subsequent reads depend this one + uintptr_t allocated = + upb_Atomic_Load(&previous->space_allocated, memory_order_relaxed); + memsize += allocated; + previous_or_tail = + upb_Atomic_Load(&previous->previous_or_tail, memory_order_acquire); + local_fused_count++; + } while (ai != NULL) { - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_relaxed); - while (block != NULL) { - memsize += sizeof(upb_MemBlock) + block->size; - block = upb_Atomic_Load(&block->next, memory_order_relaxed); - } - ai = upb_Atomic_Load(&ai->next, memory_order_relaxed); + UPB_TSAN_CHECK_PUBLISHED(ai); + // Unfortunate macro behavior; prior to C11 when using nonstandard atomics + // this returns a void* and can't be used with += without an intermediate + // conversion to an integer. + // Relaxed is safe - no subsequent reads depend this one + uintptr_t allocated = + upb_Atomic_Load(&ai->space_allocated, memory_order_relaxed); + memsize += allocated; + ai = upb_Atomic_Load(&ai->next, memory_order_acquire); local_fused_count++; } @@ -3052,44 +3218,24 @@ size_t upb_Arena_SpaceAllocated(upb_Arena* arena, size_t* fused_count) { return memsize; } -bool UPB_PRIVATE(_upb_Arena_Contains)(const upb_Arena* a, void* ptr) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - UPB_ASSERT(ai); - - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_relaxed); - while (block) { - uintptr_t beg = (uintptr_t)block; - uintptr_t end = beg + block->size; - if ((uintptr_t)ptr >= beg && (uintptr_t)ptr < end) return true; - block = upb_Atomic_Load(&block->next, memory_order_relaxed); - } - - return false; +uint32_t upb_Arena_DebugRefCount(const upb_Arena* a) { + uintptr_t tagged = _upb_Arena_FindRoot(upb_Arena_Internal(a)).tagged_count; + return (uint32_t)_upb_Arena_RefCountFromTagged(tagged); } -uint32_t upb_Arena_DebugRefCount(upb_Arena* a) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - // These loads could probably be relaxed, but given that this is debug-only, - // it's not worth introducing a new variant for it. - uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - while (_upb_Arena_IsTaggedPointer(poc)) { - ai = _upb_Arena_PointerFromTagged(poc); - poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - } - return _upb_Arena_RefCountFromTagged(poc); -} - -static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t size) { +static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t offset, + size_t block_size) { upb_ArenaInternal* ai = upb_Arena_Internal(a); upb_MemBlock* block = ptr; + block->size = block_size; // Insert into linked list. - block->size = (uint32_t)size; - upb_Atomic_Init(&block->next, ai->blocks); - upb_Atomic_Store(&ai->blocks, block, memory_order_release); + block->next = ai->blocks; + ai->blocks = block; - a->UPB_PRIVATE(ptr) = UPB_PTR_AT(block, kUpb_MemblockReserve, char); - a->UPB_PRIVATE(end) = UPB_PTR_AT(block, size, char); + UPB_ASSERT(offset >= kUpb_MemblockReserve); + a->UPB_PRIVATE(ptr) = UPB_PTR_AT(block, offset, char); + a->UPB_PRIVATE(end) = UPB_PTR_AT(block, block_size, char); UPB_POISON_MEMORY_REGION(a->UPB_PRIVATE(ptr), a->UPB_PRIVATE(end) - a->UPB_PRIVATE(ptr)); @@ -3098,21 +3244,37 @@ static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t size) { static bool _upb_Arena_AllocBlock(upb_Arena* a, size_t size) { upb_ArenaInternal* ai = upb_Arena_Internal(a); if (!ai->block_alloc) return false; - upb_MemBlock* last_block = upb_Atomic_Load(&ai->blocks, memory_order_acquire); - size_t last_size = last_block != NULL ? last_block->size : 128; + size_t last_size = 128; + upb_MemBlock* last_block = ai->blocks; + if (last_block) { + last_size = a->UPB_PRIVATE(end) - (char*)last_block; + } + + // Relaxed order is safe here as we don't need any ordering with the setter. + size_t max_block_size = + upb_Atomic_Load(&g_max_block_size, memory_order_relaxed); // Don't naturally grow beyond the max block size. size_t clamped_size = UPB_MIN(last_size * 2, max_block_size); // We may need to exceed the max block size if the user requested a large // allocation. - size_t block_size = UPB_MAX(size, clamped_size) + kUpb_MemblockReserve; + size_t block_size = UPB_MAX(kUpb_MemblockReserve + size, clamped_size); upb_MemBlock* block = upb_malloc(_upb_ArenaInternal_BlockAlloc(ai), block_size); if (!block) return false; - _upb_Arena_AddBlock(a, block, block_size); + _upb_Arena_AddBlock(a, block, kUpb_MemblockReserve, block_size); + // Atomic add not required here, as threads won't race allocating blocks, plus + // atomic fetch-add is slower than load/add/store on arm devices compiled + // targetting pre-v8.1. Relaxed order is safe as nothing depends on order of + // size allocated. + + uintptr_t old_space_allocated = + upb_Atomic_Load(&ai->space_allocated, memory_order_relaxed); + upb_Atomic_Store(&ai->space_allocated, old_space_allocated + block_size, + memory_order_relaxed); UPB_ASSERT(UPB_PRIVATE(_upb_ArenaHas)(a) >= size); return true; } @@ -3122,28 +3284,33 @@ void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(upb_Arena* a, size_t size) { return upb_Arena_Malloc(a, size - UPB_ASAN_GUARD_SIZE); } -static upb_Arena* _upb_Arena_InitSlow(upb_alloc* alloc) { +static upb_Arena* _upb_Arena_InitSlow(upb_alloc* alloc, size_t first_size) { const size_t first_block_overhead = - sizeof(upb_ArenaState) + kUpb_MemblockReserve; + UPB_ALIGN_MALLOC(kUpb_MemblockReserve + sizeof(upb_ArenaState)); upb_ArenaState* a; // We need to malloc the initial block. char* mem; - size_t n = first_block_overhead + 256; - if (!alloc || !(mem = upb_malloc(alloc, n))) { + size_t block_size = + first_block_overhead + + UPB_MAX(256, UPB_ALIGN_MALLOC(first_size) + UPB_ASAN_GUARD_SIZE); + if (!alloc || !(mem = upb_malloc(alloc, block_size))) { return NULL; } - a = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), upb_ArenaState); - n -= sizeof(upb_ArenaState); + a = UPB_PTR_AT(mem, kUpb_MemblockReserve, upb_ArenaState); a->body.block_alloc = _upb_Arena_MakeBlockAlloc(alloc, 0); upb_Atomic_Init(&a->body.parent_or_count, _upb_Arena_TaggedFromRefcount(1)); upb_Atomic_Init(&a->body.next, NULL); - upb_Atomic_Init(&a->body.tail, &a->body); - upb_Atomic_Init(&a->body.blocks, NULL); + upb_Atomic_Init(&a->body.previous_or_tail, + _upb_Arena_TaggedFromTail(&a->body)); + upb_Atomic_Init(&a->body.space_allocated, block_size); + a->body.blocks = NULL; + a->body.upb_alloc_cleanup = NULL; + UPB_TSAN_INIT_PUBLISHED(&a->body); - _upb_Arena_AddBlock(&a->head, mem, n); + _upb_Arena_AddBlock(&a->head, mem, first_block_overhead, block_size); return &a->head; } @@ -3152,38 +3319,34 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) { UPB_ASSERT(sizeof(void*) * UPB_ARENA_SIZE_HACK >= sizeof(upb_ArenaState)); upb_ArenaState* a; - if (n) { + if (mem) { /* Align initial pointer up so that we return properly-aligned pointers. */ - void* aligned = (void*)UPB_ALIGN_UP((uintptr_t)mem, UPB_MALLOC_ALIGN); + void* aligned = (void*)UPB_ALIGN_MALLOC((uintptr_t)mem); size_t delta = (uintptr_t)aligned - (uintptr_t)mem; n = delta <= n ? n - delta : 0; mem = aligned; } - - /* Round block size down to alignof(*a) since we will allocate the arena - * itself at the end. */ - n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_ArenaState)); - - if (UPB_UNLIKELY(n < sizeof(upb_ArenaState))) { + if (UPB_UNLIKELY(n < sizeof(upb_ArenaState) || !mem)) { + upb_Arena* ret = _upb_Arena_InitSlow(alloc, mem ? 0 : n); #ifdef UPB_TRACING_ENABLED - upb_Arena* ret = _upb_Arena_InitSlow(alloc); upb_Arena_LogInit(ret, n); - return ret; -#else - return _upb_Arena_InitSlow(alloc); #endif + return ret; } - a = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), upb_ArenaState); + a = mem; upb_Atomic_Init(&a->body.parent_or_count, _upb_Arena_TaggedFromRefcount(1)); upb_Atomic_Init(&a->body.next, NULL); - upb_Atomic_Init(&a->body.tail, &a->body); - upb_Atomic_Init(&a->body.blocks, NULL); - + upb_Atomic_Init(&a->body.previous_or_tail, + _upb_Arena_TaggedFromTail(&a->body)); + upb_Atomic_Init(&a->body.space_allocated, 0); + a->body.blocks = NULL; + a->body.upb_alloc_cleanup = NULL; a->body.block_alloc = _upb_Arena_MakeBlockAlloc(alloc, 1); - a->head.UPB_PRIVATE(ptr) = mem; - a->head.UPB_PRIVATE(end) = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), char); + a->head.UPB_PRIVATE(ptr) = (void*)UPB_ALIGN_MALLOC((uintptr_t)(a + 1)); + a->head.UPB_PRIVATE(end) = UPB_PTR_AT(mem, n, char); + UPB_TSAN_INIT_PUBLISHED(&a->body); #ifdef UPB_TRACING_ENABLED upb_Arena_LogInit(&a->head, n); #endif @@ -3193,28 +3356,40 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) { static void _upb_Arena_DoFree(upb_ArenaInternal* ai) { UPB_ASSERT(_upb_Arena_RefCountFromTagged(ai->parent_or_count) == 1); while (ai != NULL) { + UPB_TSAN_CHECK_PUBLISHED(ai); // Load first since arena itself is likely from one of its blocks. upb_ArenaInternal* next_arena = (upb_ArenaInternal*)upb_Atomic_Load(&ai->next, memory_order_acquire); + // Freeing may have memory barriers that confuse tsan, so assert immdiately + // after load here + if (next_arena) { + UPB_TSAN_CHECK_PUBLISHED(next_arena); + } upb_alloc* block_alloc = _upb_ArenaInternal_BlockAlloc(ai); - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_acquire); + upb_MemBlock* block = ai->blocks; + upb_AllocCleanupFunc* alloc_cleanup = *ai->upb_alloc_cleanup; while (block != NULL) { // Load first since we are deleting block. - upb_MemBlock* next_block = - upb_Atomic_Load(&block->next, memory_order_acquire); - upb_free(block_alloc, block); + upb_MemBlock* next_block = block->next; + upb_free_sized(block_alloc, block, block->size); block = next_block; } + if (alloc_cleanup != NULL) { + alloc_cleanup(block_alloc); + } ai = next_arena; } } void upb_Arena_Free(upb_Arena* a) { upb_ArenaInternal* ai = upb_Arena_Internal(a); + // Cannot be replaced with _upb_Arena_FindRoot, as that provides only a + // relaxed read of the refcount if ai is already the root. uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); retry: while (_upb_Arena_IsTaggedPointer(poc)) { ai = _upb_Arena_PointerFromTagged(poc); + UPB_TSAN_CHECK_PUBLISHED(ai); poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); } @@ -3244,32 +3419,70 @@ retry: static void _upb_Arena_DoFuseArenaLists(upb_ArenaInternal* const parent, upb_ArenaInternal* child) { - upb_ArenaInternal* parent_tail = - upb_Atomic_Load(&parent->tail, memory_order_relaxed); - - do { + UPB_TSAN_CHECK_PUBLISHED(parent); + uintptr_t parent_previous_or_tail = + upb_Atomic_Load(&parent->previous_or_tail, memory_order_acquire); + upb_ArenaInternal* parent_tail = parent; + if (_upb_Arena_IsTaggedTail(parent_previous_or_tail)) { // Our tail might be stale, but it will always converge to the true tail. + parent_tail = _upb_Arena_TailFromTagged(parent_previous_or_tail); + } + + // Link parent to child going forwards + while (true) { + UPB_TSAN_CHECK_PUBLISHED(parent_tail); upb_ArenaInternal* parent_tail_next = - upb_Atomic_Load(&parent_tail->next, memory_order_relaxed); + upb_Atomic_Load(&parent_tail->next, memory_order_acquire); while (parent_tail_next != NULL) { parent_tail = parent_tail_next; + UPB_TSAN_CHECK_PUBLISHED(parent_tail); parent_tail_next = - upb_Atomic_Load(&parent_tail->next, memory_order_relaxed); + upb_Atomic_Load(&parent_tail->next, memory_order_acquire); } + if (upb_Atomic_CompareExchangeWeak(&parent_tail->next, &parent_tail_next, + child, memory_order_release, + memory_order_acquire)) { + break; + } + if (parent_tail_next != NULL) { + parent_tail = parent_tail_next; + } + } - upb_ArenaInternal* displaced = - upb_Atomic_Exchange(&parent_tail->next, child, memory_order_relaxed); - parent_tail = upb_Atomic_Load(&child->tail, memory_order_relaxed); + // Update parent's tail (may be stale). + uintptr_t child_previous_or_tail = + upb_Atomic_Load(&child->previous_or_tail, memory_order_acquire); + upb_ArenaInternal* new_parent_tail = + _upb_Arena_TailFromTagged(child_previous_or_tail); + UPB_TSAN_CHECK_PUBLISHED(new_parent_tail); - // If we displaced something that got installed racily, we can simply - // reinstall it on our new tail. - child = displaced; - } while (child != NULL); + // If another thread fused with us, don't overwrite their previous pointer + // with our tail. Relaxed order is fine here as we only inspect the tag bit + parent_previous_or_tail = + upb_Atomic_Load(&parent->previous_or_tail, memory_order_relaxed); + if (_upb_Arena_IsTaggedTail(parent_previous_or_tail)) { + upb_Atomic_CompareExchangeStrong( + &parent->previous_or_tail, &parent_previous_or_tail, + _upb_Arena_TaggedFromTail(new_parent_tail), memory_order_release, + memory_order_relaxed); + } - upb_Atomic_Store(&parent->tail, parent_tail, memory_order_relaxed); + // Link child to parent going backwards, for SpaceAllocated + upb_Atomic_Store(&child->previous_or_tail, + _upb_Arena_TaggedFromPrevious(parent_tail), + memory_order_release); } -static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, +void upb_Arena_SetAllocCleanup(upb_Arena* a, upb_AllocCleanupFunc* func) { + UPB_TSAN_CHECK_READ(a->UPB_ONLYBITS(ptr)); + upb_ArenaInternal* ai = upb_Arena_Internal(a); + UPB_ASSERT(ai->upb_alloc_cleanup == NULL); + ai->upb_alloc_cleanup = func; +} + +// Thread safe. +static upb_ArenaInternal* _upb_Arena_DoFuse(upb_ArenaInternal** ai1, + upb_ArenaInternal** ai2, uintptr_t* ref_delta) { // `parent_or_count` has two distinct modes // - parent pointer mode @@ -3278,11 +3491,14 @@ static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, // In parent pointer mode, it may change what pointer it refers to in the // tree, but it will always approach a root. Any operation that walks the // tree to the root may collapse levels of the tree concurrently. - upb_ArenaRoot r1 = _upb_Arena_FindRoot(a1); - upb_ArenaRoot r2 = _upb_Arena_FindRoot(a2); + upb_ArenaRoot r1 = _upb_Arena_FindRoot(*ai1); + upb_ArenaRoot r2 = _upb_Arena_FindRoot(*ai2); if (r1.root == r2.root) return r1.root; // Already fused. + *ai1 = r1.root; + *ai2 = r2.root; + // Avoid cycles by always fusing into the root with the lower address. if ((uintptr_t)r1.root > (uintptr_t)r2.root) { upb_ArenaRoot tmp = r1; @@ -3328,20 +3544,33 @@ static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, return r1.root; } +// Thread safe. static bool _upb_Arena_FixupRefs(upb_ArenaInternal* new_root, uintptr_t ref_delta) { if (ref_delta == 0) return true; // No fixup required. + // Relaxed order is safe here as if the value is a pointer, we don't deref it + // or publish it anywhere else. The refcount does provide memory order + // between allocations on arenas and the eventual free and thus normally + // requires acquire/release; but in this case any edges provided by the refs + // we are cleaning up were already provided by the fuse operation itself. It's + // not valid for a decrement that could cause the overall fused arena to reach + // a zero refcount to race with this function, as that could result in a + // use-after-free anyway. uintptr_t poc = upb_Atomic_Load(&new_root->parent_or_count, memory_order_relaxed); if (_upb_Arena_IsTaggedPointer(poc)) return false; uintptr_t with_refs = poc - ref_delta; UPB_ASSERT(!_upb_Arena_IsTaggedPointer(with_refs)); + // Relaxed order on success is safe here, for the same reasons as the relaxed + // read above. Relaxed order is safe on failure because the updated value is + // stored in a local variable which goes immediately out of scope; the retry + // loop will reread what it needs with proper memory order. return upb_Atomic_CompareExchangeStrong(&new_root->parent_or_count, &poc, with_refs, memory_order_relaxed, memory_order_relaxed); } -bool upb_Arena_Fuse(upb_Arena* a1, upb_Arena* a2) { +bool upb_Arena_Fuse(const upb_Arena* a1, const upb_Arena* a2) { if (a1 == a2) return true; // trivial fuse #ifdef UPB_TRACING_ENABLED @@ -3361,25 +3590,46 @@ bool upb_Arena_Fuse(upb_Arena* a1, upb_Arena* a2) { // The number of refs we ultimately need to transfer to the new root. uintptr_t ref_delta = 0; while (true) { - upb_ArenaInternal* new_root = _upb_Arena_DoFuse(a1, a2, &ref_delta); + upb_ArenaInternal* new_root = _upb_Arena_DoFuse(&ai1, &ai2, &ref_delta); if (new_root != NULL && _upb_Arena_FixupRefs(new_root, ref_delta)) { return true; } } } -bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner) { +bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b) { + if (a == b) return true; // trivial fuse + upb_ArenaInternal* ra = _upb_Arena_FindRoot(upb_Arena_Internal(a)).root; + upb_ArenaInternal* rb = upb_Arena_Internal(b); + while (true) { + rb = _upb_Arena_FindRoot(rb).root; + if (ra == rb) return true; + upb_ArenaInternal* tmp = _upb_Arena_FindRoot(ra).root; + if (ra == tmp) return false; + // a's root changed since we last checked. Retry. + ra = tmp; + } +} + +bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner) { upb_ArenaInternal* ai = upb_Arena_Internal(a); if (_upb_ArenaInternal_HasInitialBlock(ai)) return false; upb_ArenaRoot r; + r.root = ai; retry: - r = _upb_Arena_FindRoot(a); + r = _upb_Arena_FindRoot(r.root); if (upb_Atomic_CompareExchangeWeak( &r.root->parent_or_count, &r.tagged_count, _upb_Arena_TaggedFromRefcount( _upb_Arena_RefCountFromTagged(r.tagged_count) + 1), - memory_order_release, memory_order_acquire)) { + // Relaxed order is safe on success, incrementing the refcount + // need not perform any synchronization with the eventual free of the + // arena - that's provided by decrements. + memory_order_relaxed, + // Relaxed order is safe on failure as r.tagged_count is immediately + // overwritten by retrying the find root operation. + memory_order_relaxed)) { // We incremented it successfully, so we are done. return true; } @@ -3387,7 +3637,15 @@ retry: goto retry; } -void upb_Arena_DecRefFor(upb_Arena* a, const void* owner) { upb_Arena_Free(a); } +void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner) { + upb_Arena_Free((upb_Arena*)a); +} + +upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a) { + UPB_TSAN_CHECK_READ(a->UPB_ONLYBITS(ptr)); + upb_ArenaInternal* ai = upb_Arena_Internal(a); + return _upb_ArenaInternal_BlockAlloc(ai); +} void UPB_PRIVATE(_upb_Arena_SwapIn)(upb_Arena* des, const upb_Arena* src) { upb_ArenaInternal* desi = upb_Arena_Internal(des); @@ -3395,8 +3653,7 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(upb_Arena* des, const upb_Arena* src) { *des = *src; desi->block_alloc = srci->block_alloc; - upb_MemBlock* blocks = upb_Atomic_Load(&srci->blocks, memory_order_relaxed); - upb_Atomic_Init(&desi->blocks, blocks); + desi->blocks = srci->blocks; } void UPB_PRIVATE(_upb_Arena_SwapOut)(upb_Arena* des, const upb_Arena* src) { @@ -3404,8 +3661,7 @@ void UPB_PRIVATE(_upb_Arena_SwapOut)(upb_Arena* des, const upb_Arena* src) { upb_ArenaInternal* srci = upb_Arena_Internal(src); *des = *src; - upb_MemBlock* blocks = upb_Atomic_Load(&srci->blocks, memory_order_relaxed); - upb_Atomic_Store(&desi->blocks, blocks, memory_order_relaxed); + desi->blocks = srci->blocks; } @@ -3577,23 +3833,20 @@ void upb_Array_Freeze(upb_Array* arr, const upb_MiniTable* m) { // Must be last. -const upb_MiniTableExtension* upb_Message_ExtensionByIndex( - const upb_Message* msg, size_t index) { - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - - UPB_ASSERT(index < count); - return ext[index].ext; +bool upb_Message_NextExtensionReverse(const upb_Message* msg, + const upb_MiniTableExtension** result, + uintptr_t* iter) { + upb_MessageValue val; + return UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, result, &val, + iter); } const upb_MiniTableExtension* upb_Message_FindExtensionByNumber( const upb_Message* msg, uint32_t field_number) { - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - - for (; count--; ext++) { - const upb_MiniTableExtension* e = ext->ext; - if (upb_MiniTableExtension_Number(e) == field_number) return e; + uintptr_t iter = kUpb_Message_ExtensionBegin; + const upb_MiniTableExtension* result; + while (upb_Message_NextExtensionReverse(msg, &result, &iter)) { + if (upb_MiniTableExtension_Number(result) == field_number) return result; } return NULL; } @@ -3728,6 +3981,7 @@ upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size) { #include <stdint.h> +#include <stdlib.h> #include <string.h> @@ -3812,7 +4066,7 @@ static bool _upb_mapsorter_resize(_upb_mapsorter* s, _upb_sortedmap* sorted, if (sorted->end > s->cap) { const int oldsize = s->cap * sizeof(*s->entries); - s->cap = upb_Log2CeilingSize(sorted->end); + s->cap = upb_RoundUpToPowerOfTwo(sorted->end); const int newsize = s->cap * sizeof(*s->entries); s->entries = upb_grealloc(s->entries, oldsize, newsize); if (!s->entries) return false; @@ -3856,20 +4110,29 @@ static int _upb_mapsorter_cmpext(const void* _a, const void* _b) { return a_num < b_num ? -1 : 1; } -bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, - size_t count, _upb_sortedmap* sorted) { - if (!_upb_mapsorter_resize(s, sorted, count)) return false; - - for (size_t i = 0; i < count; i++) { - s->entries[sorted->start + i] = &exts[i]; +bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Message_Internal* in, + _upb_sortedmap* sorted) { + size_t count = 0; + for (size_t i = 0; i < in->size; i++) { + count += upb_TaggedAuxPtr_IsExtension(in->aux_data[i]); + } + if (!_upb_mapsorter_resize(s, sorted, count)) return false; + if (count == 0) return true; + const upb_Extension** entry = + (const upb_Extension**)&s->entries[sorted->start]; + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + *entry++ = upb_TaggedAuxPtr_Extension(tagged_ptr); + } } - qsort(&s->entries[sorted->start], count, sizeof(*s->entries), _upb_mapsorter_cmpext); return true; } +#include <stdarg.h> #include <stddef.h> #include <stdint.h> #include <string.h> @@ -3877,64 +4140,109 @@ bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, // Must be last. -static const size_t message_overhead = sizeof(upb_Message_Internal); - upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* a) { return _upb_Message_New(m, a); } bool UPB_PRIVATE(_upb_Message_AddUnknown)(upb_Message* msg, const char* data, - size_t len, upb_Arena* arena) { + size_t len, upb_Arena* arena, + bool alias) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); - if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, len, arena)) return false; + // TODO: b/376969853 - Add debug check that the unknown field is an overall + // valid proto field + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, arena)) { + return false; + } + upb_StringView* view; + if (alias) { + view = upb_Arena_Malloc(arena, sizeof(upb_StringView)); + if (!view) return false; + view->data = data; + } else { + view = upb_Arena_Malloc(arena, sizeof(upb_StringView) + len); + if (!view) return false; + char* copy = UPB_PTR_AT(view, sizeof(upb_StringView), char); + memcpy(copy, data, len); + view->data = copy; + } + view->size = len; upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - memcpy(UPB_PTR_AT(in, in->unknown_end, char), data, len); - in->unknown_end += len; + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeUnknownData(view); + return true; +} + +bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg, + upb_Arena* arena, + upb_StringView data[], + size_t count) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSERT(count > 0); + size_t total_len = 0; + for (size_t i = 0; i < count; i++) { + total_len += data[i].size; + } + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, arena)) return false; + + upb_StringView* view = + upb_Arena_Malloc(arena, sizeof(upb_StringView) + total_len); + if (!view) return false; + char* copy = UPB_PTR_AT(view, sizeof(upb_StringView), char); + view->data = copy; + view->size = total_len; + for (size_t i = 0; i < count; i++) { + memcpy(copy, data[i].data, data[i].size); + copy += data[i].size; + } + // TODO: b/376969853 - Add debug check that the unknown field is an overall + // valid proto field + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeUnknownData(view); return true; } void _upb_Message_DiscardUnknown_shallow(upb_Message* msg) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - in->unknown_end = message_overhead; + if (!in) return; + uint32_t size = 0; + for (uint32_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + in->aux_data[size++] = tagged_ptr; + } } + in->size = size; } -const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len) { - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - *len = in->unknown_end - message_overhead; - return (char*)(in + 1); - } else { - *len = 0; - return NULL; - } -} - -void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len) { +bool upb_Message_DeleteUnknown(upb_Message* msg, upb_StringView* data, + uintptr_t* iter) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSERT(*iter != kUpb_Message_UnknownBegin); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - const char* internal_unknown_end = UPB_PTR_AT(in, in->unknown_end, char); - + UPB_ASSERT(in); + UPB_ASSERT(*iter <= in->size); #ifndef NDEBUG - size_t full_unknown_size; - const char* full_unknown = upb_Message_GetUnknown(msg, &full_unknown_size); - UPB_ASSERT((uintptr_t)data >= (uintptr_t)full_unknown); - UPB_ASSERT((uintptr_t)data < (uintptr_t)(full_unknown + full_unknown_size)); - UPB_ASSERT((uintptr_t)(data + len) > (uintptr_t)data); - UPB_ASSERT((uintptr_t)(data + len) <= (uintptr_t)internal_unknown_end); + upb_TaggedAuxPtr unknown_ptr = in->aux_data[*iter - 1]; + UPB_ASSERT(upb_TaggedAuxPtr_IsUnknown(unknown_ptr)); + upb_StringView* unknown = upb_TaggedAuxPtr_UnknownData(unknown_ptr); + UPB_ASSERT(unknown->data == data->data); + UPB_ASSERT(unknown->size == data->size); #endif + in->aux_data[*iter - 1] = upb_TaggedAuxPtr_Null(); - if ((data + len) != internal_unknown_end) { - memmove((char*)data, data + len, internal_unknown_end - data - len); - } - in->unknown_end -= len; + return upb_Message_NextUnknown(msg, data, iter); } size_t upb_Message_ExtensionCount(const upb_Message* msg) { - size_t count; - UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return 0; + const upb_MiniTableExtension* ext; + upb_MessageValue val; + uintptr_t iter = kUpb_Message_ExtensionBegin; + size_t count = 0; + while (upb_Message_NextExtension(msg, &ext, &val, &iter)) { + count++; + } return count; } @@ -3975,16 +4283,21 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) { } // Extensions. - size_t ext_count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &ext_count); - - for (size_t i = 0; i < ext_count; i++) { - const upb_MiniTableExtension* e = ext[i].ext; + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + // TODO: b/376969853 - use iterator API + uint32_t size = in ? in->size : 0; + for (size_t i = 0; i < size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + continue; + } + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + const upb_MiniTableExtension* e = ext->ext; const upb_MiniTableField* f = &e->UPB_PRIVATE(field); const upb_MiniTable* m2 = upb_MiniTableExtension_GetSubMessage(e); upb_MessageValue val; - memcpy(&val, &ext[i].data, sizeof(upb_MessageValue)); + memcpy(&val, &(ext->data), sizeof(upb_MessageValue)); switch (UPB_PRIVATE(_upb_MiniTableField_Mode)(f)) { case kUpb_FieldMode_Array: { @@ -4007,6 +4320,7 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) { #include <stddef.h> +#include <stdint.h> // Must be last. @@ -4117,20 +4431,18 @@ static bool _upb_Message_ExtensionsAreEqual(const upb_Message* msg1, const upb_Message* msg2, const upb_MiniTable* m, int options) { - // Must have identical extension counts. - if (upb_Message_ExtensionCount(msg1) != upb_Message_ExtensionCount(msg2)) { - return false; - } - const upb_MiniTableExtension* e; upb_MessageValue val1; // Iterate over all extensions for msg1, and search msg2 for each extension. - size_t iter1 = kUpb_Extension_Begin; - while (UPB_PRIVATE(_upb_Message_NextExtension)(msg1, m, &e, &val1, &iter1)) { + size_t count1 = 0; + size_t iter1 = kUpb_Message_ExtensionBegin; + while (upb_Message_NextExtension(msg1, &e, &val1, &iter1)) { const upb_Extension* ext2 = UPB_PRIVATE(_upb_Message_Getext)(msg2, e); if (!ext2) return false; + count1++; + const upb_MessageValue val2 = ext2->data; const upb_MiniTableField* f = &e->UPB_PRIVATE(field); const upb_MiniTable* subm = upb_MiniTableField_IsSubMessage(f) @@ -4154,6 +4466,11 @@ static bool _upb_Message_ExtensionsAreEqual(const upb_Message* msg1, } if (!eq) return false; } + + // Must have identical extension counts (this catches the case where msg2 + // has extensions that msg1 doesn't). + if (count1 != upb_Message_ExtensionCount(msg2)) return false; + return true; } @@ -4166,18 +4483,341 @@ bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2, if (!(options & kUpb_CompareOption_IncludeUnknownFields)) return true; - // Check the unknown fields. - size_t usize1, usize2; - const char* uf1 = upb_Message_GetUnknown(msg1, &usize1); - const char* uf2 = upb_Message_GetUnknown(msg2, &usize2); - // The wire encoder enforces a maximum depth of 100 so we match that here. - return UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - uf1, usize1, uf2, usize2, 100) == kUpb_UnknownCompareResult_Equal; + return UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(msg1, msg2, 100) == + kUpb_UnknownCompareResult_Equal; +} + + +#include <stdint.h> +#include <stdlib.h> + + +// Must be last. + +typedef struct upb_UnknownFields upb_UnknownFields; + +typedef struct { + uint32_t tag; + union { + uint64_t varint; + uint64_t uint64; + uint32_t uint32; + upb_StringView delimited; + upb_UnknownFields* group; + } data; +} upb_UnknownField; + +struct upb_UnknownFields { + size_t size; + size_t capacity; + upb_UnknownField* fields; +}; + +typedef struct { + upb_EpsCopyInputStream stream; + upb_Arena* arena; + upb_UnknownField* tmp; + size_t tmp_size; + int depth; + upb_UnknownCompareResult status; + jmp_buf err; +} upb_UnknownField_Context; + +typedef struct { + upb_UnknownField* arr_base; + upb_UnknownField* arr_ptr; + upb_UnknownField* arr_end; + uint32_t last_tag; + bool sorted; +} upb_UnknownFields_Builder; + +UPB_NORETURN static void upb_UnknownFields_OutOfMemory( + upb_UnknownField_Context* ctx) { + ctx->status = kUpb_UnknownCompareResult_OutOfMemory; + UPB_LONGJMP(ctx->err, 1); +} + +static void upb_UnknownFields_Grow(upb_UnknownField_Context* ctx, + upb_UnknownField** base, + upb_UnknownField** ptr, + upb_UnknownField** end) { + size_t old = (*ptr - *base); + size_t new = UPB_MAX(4, old * 2); + + *base = upb_Arena_Realloc(ctx->arena, *base, old * sizeof(**base), + new * sizeof(**base)); + if (!*base) upb_UnknownFields_OutOfMemory(ctx); + + *ptr = *base + old; + *end = *base + new; +} + +// We have to implement our own sort here, since qsort() is not an in-order +// sort. Here we use merge sort, the simplest in-order sort. +static void upb_UnknownFields_Merge(upb_UnknownField* arr, size_t start, + size_t mid, size_t end, + upb_UnknownField* tmp) { + memcpy(tmp, &arr[start], (end - start) * sizeof(*tmp)); + + upb_UnknownField* ptr1 = tmp; + upb_UnknownField* end1 = &tmp[mid - start]; + upb_UnknownField* ptr2 = &tmp[mid - start]; + upb_UnknownField* end2 = &tmp[end - start]; + upb_UnknownField* out = &arr[start]; + + while (ptr1 < end1 && ptr2 < end2) { + if (ptr1->tag <= ptr2->tag) { + *out++ = *ptr1++; + } else { + *out++ = *ptr2++; + } + } + + if (ptr1 < end1) { + memcpy(out, ptr1, (end1 - ptr1) * sizeof(*out)); + } else if (ptr2 < end2) { + memcpy(out, ptr1, (end2 - ptr2) * sizeof(*out)); + } +} + +static void upb_UnknownFields_SortRecursive(upb_UnknownField* arr, size_t start, + size_t end, upb_UnknownField* tmp) { + if (end - start > 1) { + size_t mid = start + ((end - start) / 2); + upb_UnknownFields_SortRecursive(arr, start, mid, tmp); + upb_UnknownFields_SortRecursive(arr, mid, end, tmp); + upb_UnknownFields_Merge(arr, start, mid, end, tmp); + } +} + +static void upb_UnknownFields_Sort(upb_UnknownField_Context* ctx, + upb_UnknownFields* fields) { + if (ctx->tmp_size < fields->size) { + const int oldsize = ctx->tmp_size * sizeof(*ctx->tmp); + ctx->tmp_size = UPB_MAX(8, ctx->tmp_size); + while (ctx->tmp_size < fields->size) ctx->tmp_size *= 2; + const int newsize = ctx->tmp_size * sizeof(*ctx->tmp); + ctx->tmp = upb_grealloc(ctx->tmp, oldsize, newsize); + } + upb_UnknownFields_SortRecursive(fields->fields, 0, fields->size, ctx->tmp); +} + +static upb_UnknownFields* upb_UnknownFields_BuildFromBuffer( + upb_UnknownField_Context* ctx, const char** buf); + +// Combines two unknown fields into one. +static void upb_CombineUnknownFields(upb_UnknownField_Context* ctx, + upb_UnknownFields_Builder* builder, + const char** buf) { + upb_UnknownField* arr_base = builder->arr_base; + upb_UnknownField* arr_ptr = builder->arr_ptr; + upb_UnknownField* arr_end = builder->arr_end; + const char* ptr = *buf; + uint32_t last_tag = builder->last_tag; + bool sorted = builder->sorted; + while (!upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr)) { + uint32_t tag; + ptr = upb_WireReader_ReadTag(ptr, &tag); + UPB_ASSERT(tag <= UINT32_MAX); + int wire_type = upb_WireReader_GetWireType(tag); + if (wire_type == kUpb_WireType_EndGroup) break; + if (tag < last_tag) sorted = false; + last_tag = tag; + + if (arr_ptr == arr_end) { + upb_UnknownFields_Grow(ctx, &arr_base, &arr_ptr, &arr_end); + } + upb_UnknownField* field = arr_ptr; + field->tag = tag; + arr_ptr++; + + switch (wire_type) { + case kUpb_WireType_Varint: + ptr = upb_WireReader_ReadVarint(ptr, &field->data.varint); + break; + case kUpb_WireType_64Bit: + ptr = upb_WireReader_ReadFixed64(ptr, &field->data.uint64); + break; + case kUpb_WireType_32Bit: + ptr = upb_WireReader_ReadFixed32(ptr, &field->data.uint32); + break; + case kUpb_WireType_Delimited: { + int size; + ptr = upb_WireReader_ReadSize(ptr, &size); + const char* s_ptr = ptr; + ptr = upb_EpsCopyInputStream_ReadStringAliased(&ctx->stream, &s_ptr, + size); + field->data.delimited.data = s_ptr; + field->data.delimited.size = size; + break; + } + case kUpb_WireType_StartGroup: + if (--ctx->depth == 0) { + ctx->status = kUpb_UnknownCompareResult_MaxDepthExceeded; + UPB_LONGJMP(ctx->err, 1); + } + field->data.group = upb_UnknownFields_BuildFromBuffer(ctx, &ptr); + ctx->depth++; + break; + default: + UPB_UNREACHABLE(); + } + } + *buf = ptr; + builder->arr_base = arr_base; + builder->arr_ptr = arr_ptr; + builder->arr_end = arr_end; + builder->sorted = sorted; + builder->last_tag = last_tag; +} + +static upb_UnknownFields* upb_UnknownFields_DoBuild( + upb_UnknownField_Context* ctx, upb_UnknownFields_Builder* builder) { + upb_UnknownFields* ret = upb_Arena_Malloc(ctx->arena, sizeof(*ret)); + if (!ret) upb_UnknownFields_OutOfMemory(ctx); + ret->fields = builder->arr_base; + ret->size = builder->arr_ptr - builder->arr_base; + ret->capacity = builder->arr_end - builder->arr_base; + if (!builder->sorted) { + upb_UnknownFields_Sort(ctx, ret); + } + return ret; +} + +// Builds a upb_UnknownFields data structure from the binary data in buf. +static upb_UnknownFields* upb_UnknownFields_BuildFromBuffer( + upb_UnknownField_Context* ctx, const char** buf) { + upb_UnknownFields_Builder builder = { + .arr_base = NULL, + .arr_ptr = NULL, + .arr_end = NULL, + .sorted = true, + .last_tag = 0, + }; + const char* ptr = *buf; + upb_CombineUnknownFields(ctx, &builder, &ptr); + upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &builder); + *buf = ptr; + return fields; +} + +// Builds a upb_UnknownFields data structure from the unknown fields of a +// upb_Message. +static upb_UnknownFields* upb_UnknownFields_Build(upb_UnknownField_Context* ctx, + const upb_Message* msg) { + upb_UnknownFields_Builder builder = { + .arr_base = NULL, + .arr_ptr = NULL, + .arr_end = NULL, + .sorted = true, + .last_tag = 0, + }; + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView view; + while (upb_Message_NextUnknown(msg, &view, &iter)) { + upb_EpsCopyInputStream_Init(&ctx->stream, &view.data, view.size, true); + upb_CombineUnknownFields(ctx, &builder, &view.data); + UPB_ASSERT(upb_EpsCopyInputStream_IsDone(&ctx->stream, &view.data) && + !upb_EpsCopyInputStream_IsError(&ctx->stream)); + } + upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &builder); + return fields; +} + +// Compares two sorted upb_UnknownFields structures for equality. +static bool upb_UnknownFields_IsEqual(const upb_UnknownFields* uf1, + const upb_UnknownFields* uf2) { + if (uf1->size != uf2->size) return false; + for (size_t i = 0, n = uf1->size; i < n; i++) { + upb_UnknownField* f1 = &uf1->fields[i]; + upb_UnknownField* f2 = &uf2->fields[i]; + if (f1->tag != f2->tag) return false; + int wire_type = f1->tag & 7; + switch (wire_type) { + case kUpb_WireType_Varint: + if (f1->data.varint != f2->data.varint) return false; + break; + case kUpb_WireType_64Bit: + if (f1->data.uint64 != f2->data.uint64) return false; + break; + case kUpb_WireType_32Bit: + if (f1->data.uint32 != f2->data.uint32) return false; + break; + case kUpb_WireType_Delimited: + if (!upb_StringView_IsEqual(f1->data.delimited, f2->data.delimited)) { + return false; + } + break; + case kUpb_WireType_StartGroup: + if (!upb_UnknownFields_IsEqual(f1->data.group, f2->data.group)) { + return false; + } + break; + default: + UPB_UNREACHABLE(); + } + } + return true; +} + +static upb_UnknownCompareResult upb_UnknownField_DoCompare( + upb_UnknownField_Context* ctx, const upb_Message* msg1, + const upb_Message* msg2) { + upb_UnknownCompareResult ret; + // First build both unknown fields into a sorted data structure (similar + // to the UnknownFieldSet in C++). + upb_UnknownFields* uf1 = upb_UnknownFields_Build(ctx, msg1); + upb_UnknownFields* uf2 = upb_UnknownFields_Build(ctx, msg2); + + // Now perform the equality check on the sorted structures. + if (upb_UnknownFields_IsEqual(uf1, uf2)) { + ret = kUpb_UnknownCompareResult_Equal; + } else { + ret = kUpb_UnknownCompareResult_NotEqual; + } + return ret; +} + +static upb_UnknownCompareResult upb_UnknownField_Compare( + upb_UnknownField_Context* const ctx, const upb_Message* msg1, + const upb_Message* msg2) { + upb_UnknownCompareResult ret; + if (UPB_SETJMP(ctx->err) == 0) { + ret = upb_UnknownField_DoCompare(ctx, msg1, msg2); + } else { + ret = ctx->status; + UPB_ASSERT(ret != kUpb_UnknownCompareResult_Equal); + } + + upb_Arena_Free(ctx->arena); + upb_gfree(ctx->tmp); + return ret; +} + +upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( + const upb_Message* msg1, const upb_Message* msg2, int max_depth) { + bool msg1_empty = !upb_Message_HasUnknown(msg1); + bool msg2_empty = !upb_Message_HasUnknown(msg2); + if (msg1_empty && msg2_empty) return kUpb_UnknownCompareResult_Equal; + if (msg1_empty || msg2_empty) return kUpb_UnknownCompareResult_NotEqual; + + upb_UnknownField_Context ctx = { + .arena = upb_Arena_New(), + .depth = max_depth, + .tmp = NULL, + .tmp_size = 0, + .status = kUpb_UnknownCompareResult_Equal, + }; + + if (!ctx.arena) return kUpb_UnknownCompareResult_OutOfMemory; + + return upb_UnknownField_Compare(&ctx, msg1, msg2); } #include <stdbool.h> +#include <stdint.h> #include <string.h> @@ -4301,7 +4941,7 @@ upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type, for (size_t i = 0; i < size; ++i) { upb_MessageValue val = upb_Array_Get(array, i); if (!upb_Clone_MessageValue(&val, value_type, sub, arena)) { - return false; + return NULL; } upb_Array_Set(cloned_array, i, val); } @@ -4405,41 +5045,44 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src, } } // Clone extensions. - size_t ext_count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(src, &ext_count); - for (size_t i = 0; i < ext_count; ++i) { - const upb_Extension* msg_ext = &ext[i]; - const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field); - upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( - dst, msg_ext->ext, arena); - if (!dst_ext) return NULL; - if (upb_MiniTableField_IsScalar(field)) { - if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) { + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(src); + if (!in) return dst; + + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + // Clone extension + const upb_Extension* msg_ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field); + upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( + dst, msg_ext->ext, arena); + if (!dst_ext) return NULL; + if (upb_MiniTableField_IsScalar(field)) { + if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) { + return NULL; + } + } else { + upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val; + UPB_ASSERT(msg_array); + upb_Array* cloned_array = upb_Array_DeepClone( + msg_array, upb_MiniTableField_CType(field), + upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena); + if (!cloned_array) { + return NULL; + } + dst_ext->data.array_val = cloned_array; + } + } else if (upb_TaggedAuxPtr_IsUnknown(tagged_ptr)) { + // Clone unknown + upb_StringView* unknown = upb_TaggedAuxPtr_UnknownData(tagged_ptr); + // Make a copy into destination arena. + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, unknown->data, + unknown->size, arena, false)) { return NULL; } - } else { - upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val; - UPB_ASSERT(msg_array); - upb_Array* cloned_array = upb_Array_DeepClone( - msg_array, upb_MiniTableField_CType(field), - upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena); - if (!cloned_array) { - return NULL; - } - dst_ext->data.array_val = cloned_array; } } - // Clone unknowns. - size_t unknown_size = 0; - const char* ptr = upb_Message_GetUnknown(src, &unknown_size); - if (unknown_size != 0) { - UPB_ASSERT(ptr); - // Make a copy into destination arena. - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, ptr, unknown_size, arena)) { - return NULL; - } - } return dst; } @@ -4522,7 +5165,7 @@ typedef struct { } upb_MdEnumDecoder; static size_t upb_MiniTableEnum_Size(size_t count) { - return sizeof(upb_MiniTableEnum) + count * sizeof(uint32_t); + return UPB_SIZEOF_FLEX(upb_MiniTableEnum, UPB_PRIVATE(data), count); } static upb_MiniTableEnum* _upb_MiniTable_AddEnumDataMember(upb_MdEnumDecoder* d, @@ -4644,39 +5287,36 @@ upb_MiniTableEnum* upb_MiniTableEnum_Build(const char* data, size_t len, // 64 is the first hasbit that we currently use. #define kUpb_Reserved_Hasbits (kUpb_Reserved_Hasbytes * 8) -// Note: we sort by this number when calculating layout order. -typedef enum { - kUpb_LayoutItemType_OneofCase, // Oneof case. - kUpb_LayoutItemType_OneofField, // Oneof field data. - kUpb_LayoutItemType_Field, // Non-oneof field data. +#define kUpb_OneOfLayoutItem_IndexSentinel ((uint16_t)-1) - kUpb_LayoutItemType_Max = kUpb_LayoutItemType_Field, -} upb_LayoutItemType; - -#define kUpb_LayoutItem_IndexSentinel ((uint16_t) - 1) +// Stores the field number of the present value of the oneof +#define kUpb_OneOf_CaseFieldRep (kUpb_FieldRep_4Byte) typedef struct { - // Index of the corresponding field. When this is a oneof field, the field's - // offset will be the index of the next field in a linked list. + // Index of the corresponding field. The field's offset will be the index of + // the next field in a linked list. uint16_t field_index; - uint16_t offset; - upb_FieldRep rep; - upb_LayoutItemType type; -} upb_LayoutItem; + // This enum is stored in bytes to avoid trailing padding while preserving + // two-byte alignment. + uint8_t /* upb_FieldRep*/ rep; +} upb_OneOfLayoutItem; typedef struct { - upb_LayoutItem* data; + upb_OneOfLayoutItem* data; size_t size; - size_t capacity; -} upb_LayoutItemVector; + size_t buf_capacity_bytes; +} upb_OneOfLayoutItemVector; typedef struct { upb_MdDecoder base; upb_MiniTable* table; upb_MiniTableField* fields; upb_MiniTablePlatform platform; - upb_LayoutItemVector vec; + upb_OneOfLayoutItemVector oneofs; upb_Arena* arena; + // Initially tracks the count of each field rep type; then, during assignment, + // tracks the base offset for the next processed field of the given rep. + uint16_t rep_counts_offsets[kUpb_FieldRep_Max + 1]; } upb_MtDecoder; // In each field's offset, we temporarily store a presence classifier: @@ -4862,30 +5502,24 @@ static void upb_MtDecoder_ModifyField(upb_MtDecoder* d, } } -static void upb_MtDecoder_PushItem(upb_MtDecoder* d, upb_LayoutItem item) { - if (d->vec.size == d->vec.capacity) { - size_t new_cap = UPB_MAX(8, d->vec.size * 2); - d->vec.data = realloc(d->vec.data, new_cap * sizeof(*d->vec.data)); - upb_MdDecoder_CheckOutOfMemory(&d->base, d->vec.data); - d->vec.capacity = new_cap; - } - d->vec.data[d->vec.size++] = item; -} - -static void upb_MtDecoder_PushOneof(upb_MtDecoder* d, upb_LayoutItem item) { - if (item.field_index == kUpb_LayoutItem_IndexSentinel) { +static void upb_MtDecoder_PushOneof(upb_MtDecoder* d, + upb_OneOfLayoutItem item) { + if (item.field_index == kUpb_OneOfLayoutItem_IndexSentinel) { upb_MdDecoder_ErrorJmp(&d->base, "Empty oneof"); } + if ((d->oneofs.size + 1) * sizeof(*d->oneofs.data) > + d->oneofs.buf_capacity_bytes) { + size_t new_cap = UPB_MAX(8, d->oneofs.size * 2) * sizeof(*d->oneofs.data); + d->oneofs.data = + upb_grealloc(d->oneofs.data, d->oneofs.buf_capacity_bytes, new_cap); + upb_MdDecoder_CheckOutOfMemory(&d->base, d->oneofs.data); + d->oneofs.buf_capacity_bytes = new_cap; + } item.field_index -= kOneofBase; - // Push oneof data. - item.type = kUpb_LayoutItemType_OneofField; - upb_MtDecoder_PushItem(d, item); - - // Push oneof case. - item.rep = kUpb_FieldRep_4Byte; // Field Number. - item.type = kUpb_LayoutItemType_OneofCase; - upb_MtDecoder_PushItem(d, item); + d->rep_counts_offsets[kUpb_OneOf_CaseFieldRep]++; + d->rep_counts_offsets[item.rep]++; + d->oneofs.data[d->oneofs.size++] = item; } static size_t upb_MtDecoder_SizeOfRep(upb_FieldRep rep, @@ -4931,7 +5565,7 @@ static size_t upb_MtDecoder_AlignOfRep(upb_FieldRep rep, static const char* upb_MtDecoder_DecodeOneofField(upb_MtDecoder* d, const char* ptr, char first_ch, - upb_LayoutItem* item) { + upb_OneOfLayoutItem* item) { uint32_t field_num; ptr = upb_MdDecoder_DecodeBase92Varint( &d->base, ptr, first_ch, kUpb_EncodedValue_MinOneofField, @@ -4967,8 +5601,8 @@ static const char* upb_MtDecoder_DecodeOneofField(upb_MtDecoder* d, static const char* upb_MtDecoder_DecodeOneofs(upb_MtDecoder* d, const char* ptr) { - upb_LayoutItem item = {.rep = 0, - .field_index = kUpb_LayoutItem_IndexSentinel}; + upb_OneOfLayoutItem item = { + .rep = 0, .field_index = kUpb_OneOfLayoutItem_IndexSentinel}; while (ptr < d->base.end) { char ch = *ptr++; if (ch == kUpb_EncodedValue_FieldSeparator) { @@ -4976,7 +5610,8 @@ static const char* upb_MtDecoder_DecodeOneofs(upb_MtDecoder* d, } else if (ch == kUpb_EncodedValue_OneofSeparator) { // End of oneof. upb_MtDecoder_PushOneof(d, item); - item.field_index = kUpb_LayoutItem_IndexSentinel; // Move to next oneof. + item.field_index = + kUpb_OneOfLayoutItem_IndexSentinel; // Move to next oneof. } else { ptr = upb_MtDecoder_DecodeOneofField(d, ptr, ch, &item); } @@ -5115,45 +5750,42 @@ static void upb_MtDecoder_ParseMessage(upb_MtDecoder* d, const char* data, upb_MtDecoder_AllocateSubs(d, sub_counts); } -static int upb_MtDecoder_CompareFields(const void* _a, const void* _b) { - const upb_LayoutItem* a = _a; - const upb_LayoutItem* b = _b; - // Currently we just sort by: - // 1. rep (smallest fields first) - // 2. type (oneof cases first) - // 2. field_index (smallest numbers first) - // The main goal of this is to reduce space lost to padding. - // Later we may have more subtle reasons to prefer a different ordering. - const int rep_bits = upb_Log2Ceiling(kUpb_FieldRep_Max); - const int type_bits = upb_Log2Ceiling(kUpb_LayoutItemType_Max); - const int idx_bits = (sizeof(a->field_index) * 8); - UPB_ASSERT(idx_bits + rep_bits + type_bits < 32); -#define UPB_COMBINE(rep, ty, idx) (((rep << type_bits) | ty) << idx_bits) | idx - uint32_t a_packed = UPB_COMBINE(a->rep, a->type, a->field_index); - uint32_t b_packed = UPB_COMBINE(b->rep, b->type, b->field_index); - UPB_ASSERT(a_packed != b_packed); -#undef UPB_COMBINE - return a_packed < b_packed ? -1 : 1; -} - -static bool upb_MtDecoder_SortLayoutItems(upb_MtDecoder* d) { - // Add items for all non-oneof fields (oneofs were already added). +static void upb_MtDecoder_CalculateAlignments(upb_MtDecoder* d) { + // Add alignment counts for non-oneof fields (oneofs were added already) int n = d->table->UPB_PRIVATE(field_count); for (int i = 0; i < n; i++) { upb_MiniTableField* f = &d->fields[i]; if (f->UPB_PRIVATE(offset) >= kOneofBase) continue; - upb_LayoutItem item = {.field_index = i, - .rep = f->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift, - .type = kUpb_LayoutItemType_Field}; - upb_MtDecoder_PushItem(d, item); + d->rep_counts_offsets[f->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift]++; } - if (d->vec.size) { - qsort(d->vec.data, d->vec.size, sizeof(*d->vec.data), - upb_MtDecoder_CompareFields); + // Reserve properly aligned space for each type of field representation + // present in this message. When we iterate over the fields, they will obtain + // their offset from within the region matching their alignment requirements. + size_t base = d->table->UPB_PRIVATE(size); + // Start with the lowest alignment requirement, going up, because: + // 1. If there are presence bits, we won't be aligned to start, but adding + // some lower-alignment fields may get us closer without wasting space to + // padding. + // 2. The allocator enforces 8 byte alignment, so moving intermediate padding + // to trailing padding doesn't save us anything. + for (upb_FieldRep rep = kUpb_FieldRep_1Byte; rep <= kUpb_FieldRep_Max; + rep++) { + uint16_t count = d->rep_counts_offsets[rep]; + if (count) { + base = UPB_ALIGN_UP(base, upb_MtDecoder_AlignOfRep(rep, d->platform)); + // This entry now tracks the base offset for this field representation + // type, instead of the count + d->rep_counts_offsets[rep] = base; + base += upb_MtDecoder_SizeOfRep(rep, d->platform) * count; + } } - - return true; + static const size_t max = UINT16_MAX; + if (base > max) { + upb_MdDecoder_ErrorJmp( + &d->base, "Message size exceeded maximum size of %zu bytes", max); + } + d->table->UPB_PRIVATE(size) = (uint16_t)base; } static size_t upb_MiniTable_DivideRoundUp(size_t n, size_t d) { @@ -5196,57 +5828,33 @@ static void upb_MtDecoder_AssignHasbits(upb_MtDecoder* d) { static size_t upb_MtDecoder_Place(upb_MtDecoder* d, upb_FieldRep rep) { size_t size = upb_MtDecoder_SizeOfRep(rep, d->platform); - size_t align = upb_MtDecoder_AlignOfRep(rep, d->platform); - size_t ret = UPB_ALIGN_UP(d->table->UPB_PRIVATE(size), align); - static const size_t max = UINT16_MAX; - size_t new_size = ret + size; - if (new_size > max) { - upb_MdDecoder_ErrorJmp( - &d->base, "Message size exceeded maximum size of %zu bytes", max); - } - d->table->UPB_PRIVATE(size) = new_size; - return ret; + size_t offset = d->rep_counts_offsets[rep]; + d->rep_counts_offsets[rep] += size; + return offset; } static void upb_MtDecoder_AssignOffsets(upb_MtDecoder* d) { - upb_LayoutItem* end = UPB_PTRADD(d->vec.data, d->vec.size); - - // Compute offsets. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - item->offset = upb_MtDecoder_Place(d, item->rep); + upb_MiniTableField* field_end = + UPB_PTRADD(d->fields, d->table->UPB_PRIVATE(field_count)); + for (upb_MiniTableField* field = d->fields; field < field_end; field++) { + if (field->UPB_PRIVATE(offset) >= kOneofBase) continue; + field->UPB_PRIVATE(offset) = + upb_MtDecoder_Place(d, field->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift); } - // Assign oneof case offsets. We must do these first, since assigning - // actual offsets will overwrite the links of the linked list. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - if (item->type != kUpb_LayoutItemType_OneofCase) continue; + upb_OneOfLayoutItem* oneof_end = UPB_PTRADD(d->oneofs.data, d->oneofs.size); + + for (upb_OneOfLayoutItem* item = d->oneofs.data; item < oneof_end; item++) { upb_MiniTableField* f = &d->fields[item->field_index]; + uint16_t case_offset = upb_MtDecoder_Place(d, kUpb_OneOf_CaseFieldRep); + uint16_t data_offset = upb_MtDecoder_Place(d, item->rep); while (true) { - f->presence = ~item->offset; - if (f->UPB_PRIVATE(offset) == kUpb_LayoutItem_IndexSentinel) break; - UPB_ASSERT(f->UPB_PRIVATE(offset) - kOneofBase < - d->table->UPB_PRIVATE(field_count)); - f = &d->fields[f->UPB_PRIVATE(offset) - kOneofBase]; - } - } - - // Assign offsets. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - upb_MiniTableField* f = &d->fields[item->field_index]; - switch (item->type) { - case kUpb_LayoutItemType_OneofField: - while (true) { - uint16_t next_offset = f->UPB_PRIVATE(offset); - f->UPB_PRIVATE(offset) = item->offset; - if (next_offset == kUpb_LayoutItem_IndexSentinel) break; - f = &d->fields[next_offset - kOneofBase]; - } - break; - case kUpb_LayoutItemType_Field: - f->UPB_PRIVATE(offset) = item->offset; - break; - default: - break; + f->presence = ~case_offset; + uint16_t next_offset = f->UPB_PRIVATE(offset); + f->UPB_PRIVATE(offset) = data_offset; + if (next_offset == kUpb_OneOfLayoutItem_IndexSentinel) break; + UPB_ASSERT(next_offset - kOneofBase < d->table->UPB_PRIVATE(field_count)); + f = &d->fields[next_offset - kOneofBase]; } } @@ -5300,11 +5908,8 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data, UPB_UNREACHABLE(); } - upb_LayoutItem* end = UPB_PTRADD(d->vec.data, d->vec.size); - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - if (item->type == kUpb_LayoutItemType_OneofCase) { - upb_MdDecoder_ErrorJmp(&d->base, "Map entry cannot have oneof"); - } + if (d->oneofs.size != 0) { + upb_MdDecoder_ErrorJmp(&d->base, "Map entry cannot have oneof"); } upb_MtDecoder_ValidateEntryField(d, &d->table->UPB_PRIVATE(fields)[0], 1); @@ -5346,7 +5951,7 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( decoder->table->UPB_PRIVATE(dense_below) = 0; decoder->table->UPB_PRIVATE(table_mask) = -1; decoder->table->UPB_PRIVATE(required_count) = 0; -#if UPB_TRACING_ENABLED +#ifdef UPB_TRACING_ENABLED // MiniTables built from MiniDescriptors will not be able to vend the message // name unless it is explicitly set with upb_MiniTable_SetFullName(). decoder->table->UPB_PRIVATE(full_name) = 0; @@ -5364,7 +5969,7 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( case kUpb_EncodedVersion_MessageV1: upb_MtDecoder_ParseMessage(decoder, data, len); upb_MtDecoder_AssignHasbits(decoder); - upb_MtDecoder_SortLayoutItems(decoder); + upb_MtDecoder_CalculateAlignments(decoder); upb_MtDecoder_AssignOffsets(decoder); break; @@ -5378,8 +5983,8 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( } done: - *buf = decoder->vec.data; - *buf_size = decoder->vec.capacity * sizeof(*decoder->vec.data); + *buf = decoder->oneofs.data; + *buf_size = decoder->oneofs.buf_capacity_bytes; return decoder->table; } @@ -5387,8 +5992,8 @@ static upb_MiniTable* upb_MtDecoder_BuildMiniTableWithBuf( upb_MtDecoder* const decoder, const char* const data, const size_t len, void** const buf, size_t* const buf_size) { if (UPB_SETJMP(decoder->base.err) != 0) { - *buf = decoder->vec.data; - *buf_size = decoder->vec.capacity * sizeof(*decoder->vec.data); + *buf = decoder->oneofs.data; + *buf_size = decoder->oneofs.buf_capacity_bytes; return NULL; } @@ -5404,10 +6009,10 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, upb_MtDecoder decoder = { .base = {.status = status}, .platform = platform, - .vec = + .oneofs = { .data = *buf, - .capacity = *buf_size / sizeof(*decoder.vec.data), + .buf_capacity_bytes = *buf_size, .size = 0, }, .arena = arena, @@ -5505,7 +6110,7 @@ upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, size_t size = 0; upb_MiniTable* ret = upb_MiniTable_BuildWithBuf(data, len, platform, arena, &buf, &size, status); - free(buf); + upb_gfree(buf); return ret; } @@ -5657,24 +6262,32 @@ upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena) { return r; } -UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, - const upb_MiniTableExtension* e) { +UPB_API upb_ExtensionRegistryStatus upb_ExtensionRegistry_Add( + upb_ExtensionRegistry* r, const upb_MiniTableExtension* e) { char buf[EXTREG_KEY_SIZE]; extreg_key(buf, e->UPB_PRIVATE(extendee), upb_MiniTableExtension_Number(e)); - if (upb_strtable_lookup2(&r->exts, buf, EXTREG_KEY_SIZE, NULL)) return false; - return upb_strtable_insert(&r->exts, buf, EXTREG_KEY_SIZE, - upb_value_constptr(e), r->arena); + + if (upb_strtable_lookup2(&r->exts, buf, EXTREG_KEY_SIZE, NULL)) { + return kUpb_ExtensionRegistryStatus_DuplicateEntry; + } + + if (!upb_strtable_insert(&r->exts, buf, EXTREG_KEY_SIZE, + upb_value_constptr(e), r->arena)) { + return kUpb_ExtensionRegistryStatus_OutOfMemory; + } + return kUpb_ExtensionRegistryStatus_Ok; } -bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, - const upb_MiniTableExtension** e, - size_t count) { +upb_ExtensionRegistryStatus upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistry* r, const upb_MiniTableExtension** e, size_t count) { const upb_MiniTableExtension** start = e; const upb_MiniTableExtension** end = UPB_PTRADD(e, count); + upb_ExtensionRegistryStatus status = kUpb_ExtensionRegistryStatus_Ok; for (; e < end; e++) { - if (!upb_ExtensionRegistry_Add(r, *e)) goto failure; + status = upb_ExtensionRegistry_Add(r, *e); + if (status != kUpb_ExtensionRegistryStatus_Ok) goto failure; } - return true; + return kUpb_ExtensionRegistryStatus_Ok; failure: // Back out the entries previously added. @@ -5685,7 +6298,8 @@ failure: upb_MiniTableExtension_Number(ext)); upb_strtable_remove2(&r->exts, buf, EXTREG_KEY_SIZE, NULL); } - return false; + UPB_ASSERT(status != kUpb_ExtensionRegistryStatus_Ok); + return status; } #ifdef UPB_LINKARR_DECLARE @@ -5698,7 +6312,9 @@ bool upb_ExtensionRegistry_AddAllLinkedExtensions(upb_ExtensionRegistry* r) { for (const upb_MiniTableExtension* p = start; p < stop; p++) { // Windows can introduce zero padding, so we have to skip zeroes. if (upb_MiniTableExtension_Number(p) != 0) { - if (!upb_ExtensionRegistry_Add(r, p)) return false; + if (upb_ExtensionRegistry_Add(r, p) != kUpb_ExtensionRegistryStatus_Ok) { + return false; + } } } return true; @@ -5719,7 +6335,6 @@ const upb_MiniTableExtension* upb_ExtensionRegistry_Lookup( } -#include <inttypes.h> #include <stddef.h> #include <stdint.h> @@ -5737,21 +6352,30 @@ const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( } // Slow case: binary search - int lo = m->UPB_PRIVATE(dense_below); - int hi = m->UPB_PRIVATE(field_count) - 1; - while (lo <= hi) { - int mid = (lo + hi) / 2; - uint32_t num = m->UPB_PRIVATE(fields)[mid].UPB_PRIVATE(number); - if (num < number) { - lo = mid + 1; - continue; + uint32_t lo = m->UPB_PRIVATE(dense_below); + int32_t hi = m->UPB_PRIVATE(field_count) - 1; + const upb_MiniTableField* base = m->UPB_PRIVATE(fields); + while (hi >= (int32_t)lo) { + uint32_t mid = (hi + lo) / 2; + uint32_t num = base[mid].UPB_ONLYBITS(number); + // These comparison operations allow, on ARM machines, to fuse all these + // branches into one comparison followed by two CSELs to set the lo/hi + // values, followed by a BNE to continue or terminate the loop. Since binary + // search branches are generally unpredictable (50/50 in each direction), + // this is a good deal. We use signed for the high, as this decrement may + // underflow if mid is 0. + int32_t hi_mid = mid - 1; + uint32_t lo_mid = mid + 1; + if (num == number) { + return &base[mid]; } - if (num > number) { - hi = mid - 1; - continue; + if (UPB_UNPREDICTABLE(num < number)) { + lo = lo_mid; + } else { + hi = hi_mid; } - return &m->UPB_PRIVATE(fields)[mid]; } + return NULL; } @@ -6135,11 +6759,14 @@ static upb_Message* _upb_Decoder_ReuseSubMessage( upb_Message* existing = UPB_PRIVATE(_upb_TaggedMessagePtr_GetEmptyMessage)(tagged); upb_Message* promoted = _upb_Decoder_NewSubMessage(d, subs, field, target); - size_t size; - const char* unknown = upb_Message_GetUnknown(existing, &size); - upb_DecodeStatus status = upb_Decode(unknown, size, promoted, subl, d->extreg, - d->options, &d->arena); - if (status != kUpb_DecodeStatus_Ok) _upb_Decoder_ErrorJmp(d, status); + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView unknown; + while (upb_Message_NextUnknown(existing, &unknown, &iter)) { + upb_DecodeStatus status = + upb_Decode(unknown.data, unknown.size, promoted, subl, d->extreg, + d->options, &d->arena); + if (status != kUpb_DecodeStatus_Ok) _upb_Decoder_ErrorJmp(d, status); + } return promoted; } @@ -6213,6 +6840,7 @@ const char* _upb_Decoder_DecodeKnownGroup(upb_Decoder* d, const char* ptr, field->UPB_PRIVATE(number)); } +#define kUpb_Decoder_EncodeVarint32MaxSize 5 static char* upb_Decoder_EncodeVarint32(uint32_t val, char* ptr) { do { uint8_t byte = val & 0x7fU; @@ -6223,18 +6851,6 @@ static char* upb_Decoder_EncodeVarint32(uint32_t val, char* ptr) { return ptr; } -static void _upb_Decoder_AddUnknownVarints(upb_Decoder* d, upb_Message* msg, - uint32_t val1, uint32_t val2) { - char buf[20]; - char* end = buf; - end = upb_Decoder_EncodeVarint32(val1, end); - end = upb_Decoder_EncodeVarint32(val2, end); - - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, end - buf, &d->arena)) { - _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); - } -} - UPB_FORCEINLINE bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, const upb_MiniTableEnum* e, @@ -6249,9 +6865,17 @@ bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, const uint32_t tag = ((uint32_t)field->UPB_PRIVATE(number) << 3) | kUpb_WireType_Varint; upb_Message* unknown_msg = - field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension ? d->unknown_msg + field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension ? d->original_msg : msg; - _upb_Decoder_AddUnknownVarints(d, unknown_msg, tag, v); + char buf[2 * kUpb_Decoder_EncodeVarint32MaxSize]; + char* end = buf; + end = upb_Decoder_EncodeVarint32(tag, end); + end = upb_Decoder_EncodeVarint32(v, end); + + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(unknown_msg, buf, end - buf, + &d->arena, false)) { + _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); + } return false; } @@ -6509,10 +7133,7 @@ static const char* _upb_Decoder_DecodeToMap( ptr = _upb_Decoder_DecodeSubMessage(d, ptr, &ent.message, subs, field, val->size); - // check if ent had any unknown fields - size_t size; - upb_Message_GetUnknown(&ent.message, &size); - if (size != 0) { + if (upb_Message_HasUnknown(&ent.message)) { char* buf; size_t size; uint32_t tag = @@ -6522,8 +7143,16 @@ static const char* _upb_Decoder_DecodeToMap( if (status != kUpb_EncodeStatus_Ok) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } - _upb_Decoder_AddUnknownVarints(d, msg, tag, size); - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, size, &d->arena)) { + char delim_buf[2 * kUpb_Decoder_EncodeVarint32MaxSize]; + char* delim_end = delim_buf; + delim_end = upb_Decoder_EncodeVarint32(tag, delim_end); + delim_end = upb_Decoder_EncodeVarint32(size, delim_end); + upb_StringView unknown[] = { + {delim_buf, delim_end - delim_buf}, + {buf, size}, + }; + + if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 2)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } else { @@ -6670,7 +7299,7 @@ static void upb_Decoder_AddKnownMessageSetItem( } upb_Message* submsg = _upb_Decoder_NewSubMessage2( d, ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg), - &ext->ext->UPB_PRIVATE(field), (upb_TaggedMessagePtr*)&ext->data); + &ext->ext->UPB_PRIVATE(field), &ext->data.tagged_msg_val); upb_DecodeStatus status = upb_Decode( data, size, submsg, upb_MiniTableExtension_GetSubMessage(item_mt), d->extreg, d->options, &d->arena); @@ -6682,7 +7311,7 @@ static void upb_Decoder_AddUnknownMessageSetItem(upb_Decoder* d, uint32_t type_id, const char* message_data, uint32_t message_size) { - char buf[60]; + char buf[6 * kUpb_Decoder_EncodeVarint32MaxSize]; char* ptr = buf; ptr = upb_Decoder_EncodeVarint32(kStartItemTag, ptr); ptr = upb_Decoder_EncodeVarint32(kTypeIdTag, ptr); @@ -6693,12 +7322,12 @@ static void upb_Decoder_AddUnknownMessageSetItem(upb_Decoder* d, ptr = upb_Decoder_EncodeVarint32(kEndItemTag, ptr); char* end = ptr; - - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, split - buf, &d->arena) || - !UPB_PRIVATE(_upb_Message_AddUnknown)(msg, message_data, message_size, - &d->arena) || - !UPB_PRIVATE(_upb_Message_AddUnknown)(msg, split, end - split, - &d->arena)) { + upb_StringView unknown[] = { + {buf, split - buf}, + {message_data, message_size}, + {split, end - split}, + }; + if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 3)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } @@ -7023,8 +7652,8 @@ const char* _upb_Decoder_DecodeKnownField(upb_Decoder* d, const char* ptr, if (UPB_UNLIKELY(!ext)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } - d->unknown_msg = msg; - msg = (upb_Message*)&ext->data; + d->original_msg = msg; + msg = &ext->data.UPB_PRIVATE(ext_msg_val); if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) { ext_sub.UPB_PRIVATE(submsg) = &ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); @@ -7068,7 +7697,8 @@ static const char* _upb_Decoder_DecodeUnknownField(upb_Decoder* d, // Since unknown fields are the uncommon case, we do a little extra work here // to walk backwards through the buffer to find the field start. This frees // up a register in the fast paths (when the field is known), which leads to - // significant speedups in benchmarks. + // significant speedups in benchmarks. Note that ptr may point into the slop + // space, beyond the normal end of the input buffer. const char* start = ptr; if (wire_type == kUpb_WireType_Delimited) ptr += val.size; @@ -7094,15 +7724,21 @@ static const char* _upb_Decoder_DecodeUnknownField(upb_Decoder* d, start = _upb_Decoder_ReverseSkipVarint(start, tag); assert(start == d->debug_tagstart); + const char* input_start = + upb_EpsCopyInputStream_GetInputPtr(&d->input, start); if (wire_type == kUpb_WireType_StartGroup) { - d->unknown = start; - d->unknown_msg = msg; ptr = _upb_Decoder_DecodeUnknownGroup(d, ptr, field_number); - start = d->unknown; - d->unknown = NULL; } - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, start, ptr - start, - &d->arena)) { + // Normally, bounds checks for fixed or varint fields are performed after + // the field is parsed; it's OK for the field to overrun the end of the + // buffer, because it'll just read into slop space. However, because this + // path reads bytes from the input buffer rather than the patch buffer, + // bounds checks are needed before adding the unknown field. + _upb_Decoder_IsDone(d, &ptr); + const char* input_ptr = upb_EpsCopyInputStream_GetInputPtr(&d->input, ptr); + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, input_start, + input_ptr - input_start, + &d->arena, d->input.aliasing)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } else if (wire_type == kUpb_WireType_StartGroup) { @@ -7223,20 +7859,23 @@ static upb_DecodeStatus upb_Decoder_Decode(upb_Decoder* const decoder, return decoder->status; } +uint16_t upb_DecodeOptions_GetEffectiveMaxDepth(uint32_t options) { + uint16_t max_depth = upb_DecodeOptions_GetMaxDepth(options); + return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; +} + upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, const upb_MiniTable* mt, const upb_ExtensionRegistry* extreg, int options, upb_Arena* arena) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Decoder decoder; - unsigned depth = (unsigned)options >> 16; upb_EpsCopyInputStream_Init(&decoder.input, &buf, size, options & kUpb_DecodeOption_AliasString); decoder.extreg = extreg; - decoder.unknown = NULL; - decoder.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; + decoder.depth = upb_DecodeOptions_GetEffectiveMaxDepth(options); decoder.end_group = DECODE_NOGROUP; decoder.options = (uint16_t)options; decoder.missing_required = false; @@ -7317,6 +7956,7 @@ const char* upb_DecodeStatus_String(upb_DecodeStatus status) { #include <setjmp.h> #include <stdbool.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> @@ -7802,32 +8442,72 @@ static void encode_field(upb_encstate* e, const upb_Message* msg, } } -static void encode_msgset_item(upb_encstate* e, const upb_Extension* ext) { +static void encode_msgset_item(upb_encstate* e, + const upb_MiniTableExtension* ext, + const upb_MessageValue ext_val) { size_t size; encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_EndGroup); - encode_message(e, ext->data.msg_val, - upb_MiniTableExtension_GetSubMessage(ext->ext), &size); + encode_message(e, ext_val.msg_val, upb_MiniTableExtension_GetSubMessage(ext), + &size); encode_varint(e, size); encode_tag(e, kUpb_MsgSet_Message, kUpb_WireType_Delimited); - encode_varint(e, upb_MiniTableExtension_Number(ext->ext)); + encode_varint(e, upb_MiniTableExtension_Number(ext)); encode_tag(e, kUpb_MsgSet_TypeId, kUpb_WireType_Varint); encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_StartGroup); } -static void encode_ext(upb_encstate* e, const upb_Extension* ext, - bool is_message_set) { +static void encode_ext(upb_encstate* e, const upb_MiniTableExtension* ext, + upb_MessageValue ext_val, bool is_message_set) { if (UPB_UNLIKELY(is_message_set)) { - encode_msgset_item(e, ext); + encode_msgset_item(e, ext, ext_val); } else { upb_MiniTableSubInternal sub; - if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) { - sub.UPB_PRIVATE(submsg) = &ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); + if (upb_MiniTableField_IsSubMessage(&ext->UPB_PRIVATE(field))) { + sub.UPB_PRIVATE(submsg) = &ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); } else { - sub.UPB_PRIVATE(subenum) = - ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum); + sub.UPB_PRIVATE(subenum) = ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum); } - encode_field(e, (upb_Message*)&ext->data, &sub, - &ext->ext->UPB_PRIVATE(field)); + encode_field(e, &ext_val.UPB_PRIVATE(ext_msg_val), &sub, + &ext->UPB_PRIVATE(field)); + } +} + +static void encode_exts(upb_encstate* e, const upb_MiniTable* m, + const upb_Message* msg) { + if (m->UPB_PRIVATE(ext) == kUpb_ExtMode_NonExtendable) return; + + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return; + + /* Encode all extensions together. Unlike C++, we do not attempt to keep + * these in field number order relative to normal fields or even to each + * other. */ + uintptr_t iter = kUpb_Message_ExtensionBegin; + const upb_MiniTableExtension* ext; + upb_MessageValue ext_val; + if (!UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, &ext, &ext_val, + &iter)) { + // Message has no extensions. + return; + } + + if (e->options & kUpb_EncodeOption_Deterministic) { + _upb_sortedmap sorted; + if (!_upb_mapsorter_pushexts(&e->sorter, in, &sorted)) { + // TODO: b/378744096 - handle alloc failure + } + const upb_Extension* ext; + while (_upb_sortedmap_nextext(&e->sorter, &sorted, &ext)) { + encode_ext(e, ext->ext, ext->data, + m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); + } + _upb_mapsorter_popmap(&e->sorter, &sorted); + } else { + do { + encode_ext(e, ext, ext_val, + m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); + } while (UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, &ext, &ext_val, + &iter)); } } @@ -7844,38 +8524,27 @@ static void encode_message(upb_encstate* e, const upb_Message* msg, } if ((e->options & kUpb_EncodeOption_SkipUnknown) == 0) { - size_t unknown_size; - const char* unknown = upb_Message_GetUnknown(msg, &unknown_size); - - if (unknown) { - encode_bytes(e, unknown, unknown_size); + size_t unknown_size = 0; + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView unknown; + // Need to write in reverse order, but iteration is in-order; scan to + // reserve capacity up front, then write in-order + while (upb_Message_NextUnknown(msg, &unknown, &iter)) { + unknown_size += unknown.size; } - } - - if (m->UPB_PRIVATE(ext) != kUpb_ExtMode_NonExtendable) { - /* Encode all extensions together. Unlike C++, we do not attempt to keep - * these in field number order relative to normal fields or even to each - * other. */ - size_t ext_count; - const upb_Extension* ext = - UPB_PRIVATE(_upb_Message_Getexts)(msg, &ext_count); - if (ext_count) { - if (e->options & kUpb_EncodeOption_Deterministic) { - _upb_sortedmap sorted; - _upb_mapsorter_pushexts(&e->sorter, ext, ext_count, &sorted); - while (_upb_sortedmap_nextext(&e->sorter, &sorted, &ext)) { - encode_ext(e, ext, m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); - } - _upb_mapsorter_popmap(&e->sorter, &sorted); - } else { - const upb_Extension* end = ext + ext_count; - for (; ext != end; ext++) { - encode_ext(e, ext, m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); - } + if (unknown_size != 0) { + encode_reserve(e, unknown_size); + char* ptr = e->ptr; + iter = kUpb_Message_UnknownBegin; + while (upb_Message_NextUnknown(msg, &unknown, &iter)) { + memcpy(ptr, unknown.data, unknown.size); + ptr += unknown.size; } } } + encode_exts(e, m, msg); + if (upb_MiniTable_FieldCount(m)) { const upb_MiniTableField* f = &m->UPB_PRIVATE(fields)[m->UPB_PRIVATE(field_count)]; @@ -7924,19 +8593,23 @@ static upb_EncodeStatus upb_Encoder_Encode(upb_encstate* const encoder, return encoder->status; } +uint16_t upb_EncodeOptions_GetEffectiveMaxDepth(uint32_t options) { + uint16_t max_depth = upb_EncodeOptions_GetMaxDepth(options); + return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; +} + static upb_EncodeStatus _upb_Encode(const upb_Message* msg, const upb_MiniTable* l, int options, upb_Arena* arena, char** buf, size_t* size, bool prepend_len) { upb_encstate e; - unsigned depth = (unsigned)options >> 16; e.status = kUpb_EncodeStatus_Ok; e.arena = arena; e.buf = NULL; e.limit = NULL; e.ptr = NULL; - e.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; + e.depth = upb_EncodeOptions_GetEffectiveMaxDepth(options); e.options = options; _upb_mapsorter_init(&e.sorter); @@ -9046,16 +9719,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileDescriptorProto__subms static const upb_MiniTableField google_protobuf_FileDescriptorProto__fields[13] = { {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; @@ -9070,15 +9743,15 @@ const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init = { {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x003000003f00001a, &upb_prs_1bt}, - {0x003800003f000022, &upb_prm_1bt_max128b}, - {0x004000003f01002a, &upb_prm_1bt_max128b}, - {0x004800003f020032, &upb_prm_1bt_max64b}, - {0x005000003f03003a, &upb_prm_1bt_max128b}, + {0x004000003f00001a, &upb_prs_1bt}, + {0x004800003f000022, &upb_prm_1bt_max128b}, + {0x005000003f01002a, &upb_prm_1bt_max128b}, + {0x005800003f020032, &upb_prm_1bt_max64b}, + {0x006000003f03003a, &upb_prm_1bt_max128b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x006800003f000050, &upb_prv4_1bt}, - {0x007000003f000058, &upb_prv4_1bt}, + {0x007800003f000050, &upb_prv4_1bt}, + {0x008000003f000058, &upb_prv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -9234,16 +9907,16 @@ const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init = { const upb_MiniTable* google__protobuf__ExtensionRangeOptions_msg_init_ptr = &google__protobuf__ExtensionRangeOptions_msg_init; static const upb_MiniTableField google_protobuf_ExtensionRangeOptions_Declaration__fields[5] = { {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init = { NULL, &google_protobuf_ExtensionRangeOptions_Declaration__fields[0], - UPB_SIZE(40, 56), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(32, 48), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.ExtensionRangeOptions.Declaration", #endif @@ -9257,23 +9930,23 @@ static const upb_MiniTableSubInternal google_protobuf_FieldDescriptorProto__subm }; static const upb_MiniTableField google_protobuf_FieldDescriptorProto__fields[11] = { - {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init = { &google_protobuf_FieldDescriptorProto__submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], - UPB_SIZE(80, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(72, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldDescriptorProto", #endif @@ -9400,18 +10073,18 @@ static const upb_MiniTableSubInternal google_protobuf_MethodDescriptorProto__sub }; static const upb_MiniTableField google_protobuf_MethodDescriptorProto__fields[6] = { - {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init = { &google_protobuf_MethodDescriptorProto__submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], - UPB_SIZE(48, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(40, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.MethodDescriptorProto", #endif @@ -9427,16 +10100,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileOptions__submsgs[3] = static const upb_MiniTableField google_protobuf_FileOptions__fields[21] = { {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, @@ -9563,26 +10236,26 @@ static const upb_MiniTableSubInternal google_protobuf_FieldOptions__submsgs[8] = }; static const upb_MiniTableField google_protobuf_FieldOptions__fields[14] = { - {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldOptions_msg_init = { &google_protobuf_FieldOptions__submsgs[0], &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(56, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(48, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldOptions", #endif @@ -9785,15 +10458,15 @@ static const upb_MiniTableSubInternal google_protobuf_EnumValueOptions__submsgs[ static const upb_MiniTableField google_protobuf_EnumValueOptions__fields[5] = { {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__EnumValueOptions_msg_init = { &google_protobuf_EnumValueOptions__submsgs[0], &google_protobuf_EnumValueOptions__fields[0], - UPB_SIZE(32, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(24, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.EnumValueOptions", #endif @@ -9951,13 +10624,13 @@ static const upb_MiniTableSubInternal google_protobuf_UninterpretedOption__subms }; static const upb_MiniTableField google_protobuf_UninterpretedOption__fields[7] = { - {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { @@ -9970,7 +10643,7 @@ const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f000012, &upb_prm_1bt_max64b}, + {0x004000003f000012, &upb_prm_1bt_max64b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, }) }; @@ -9991,28 +10664,30 @@ const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init = { }; const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init_ptr = &google__protobuf__UninterpretedOption__NamePart_msg_init; -static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[6] = { +static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[7] = { {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__FieldPresence_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnumType_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__RepeatedFieldEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__Utf8Validation_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__MessageEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__JsonFormat_enum_init}, + {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init}, }; -static const upb_MiniTableField google_protobuf_FeatureSet__fields[6] = { +static const upb_MiniTableField google_protobuf_FeatureSet__fields[7] = { {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FeatureSet_msg_init = { &google_protobuf_FeatureSet__submsgs[0], &google_protobuf_FeatureSet__fields[0], - 40, 6, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(255), 0, + 40, 7, kUpb_ExtMode_Extendable, 7, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FeatureSet", #endif @@ -10090,10 +10765,10 @@ const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init = { const upb_MiniTable* google__protobuf__SourceCodeInfo_msg_init_ptr = &google__protobuf__SourceCodeInfo_msg_init; static const upb_MiniTableField google_protobuf_SourceCodeInfo_Location__fields[5] = { - {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; @@ -10106,8 +10781,8 @@ const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f00000a, &upb_ppv4_1bt}, - {0x001800003f000012, &upb_ppv4_1bt}, + {0x003000003f00000a, &upb_ppv4_1bt}, + {0x003800003f000012, &upb_ppv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -10144,8 +10819,8 @@ static const upb_MiniTableSubInternal google_protobuf_GeneratedCodeInfo_Annotati }; static const upb_MiniTableField google_protobuf_GeneratedCodeInfo_Annotation__fields[5] = { - {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, @@ -10160,7 +10835,7 @@ const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001800003f00000a, &upb_ppv4_1bt}, + {0x002800003f00000a, &upb_ppv4_1bt}, }) }; @@ -10192,6 +10867,15 @@ const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationSta }, }; +const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init = { + 64, + 0, + { + 0x7, + 0x0, + }, +}; + const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init = { 64, 0, @@ -10363,9 +11047,10 @@ static const upb_MiniTable *messages_layout[33] = { &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, }; -static const upb_MiniTableEnum *enums_layout[17] = { +static const upb_MiniTableEnum *enums_layout[18] = { &google__protobuf__Edition_enum_init, &google__protobuf__ExtensionRangeOptions__VerificationState_enum_init, + &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init, &google__protobuf__FeatureSet__EnumType_enum_init, &google__protobuf__FeatureSet__FieldPresence_enum_init, &google__protobuf__FeatureSet__JsonFormat_enum_init, @@ -10388,7 +11073,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = { enums_layout, NULL, 33, - 17, + 18, 0, }; @@ -10787,8 +11472,12 @@ uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed) { return Wyhash(p, n, seed, kWyhashSalt); } +// Returns a seed for upb's hash function. For now this is just a hard-coded +// constant, but we are going to randomize it soon. +static uint64_t _upb_Seed(void) { return 0x69835f69597ec1cc; } + static uint32_t _upb_Hash_NoSeed(const char* p, size_t n) { - return _upb_Hash(p, n, 0); + return _upb_Hash(p, n, _upb_Seed()); } static uint32_t strhash(upb_tabkey key) { @@ -11408,282 +12097,7 @@ int upb_Unicode_ToUTF8(uint32_t cp, char* out) { } -#include <stdlib.h> - - -// Must be last. - -typedef struct upb_UnknownFields upb_UnknownFields; - -typedef struct { - uint32_t tag; - union { - uint64_t varint; - uint64_t uint64; - uint32_t uint32; - upb_StringView delimited; - upb_UnknownFields* group; - } data; -} upb_UnknownField; - -struct upb_UnknownFields { - size_t size; - size_t capacity; - upb_UnknownField* fields; -}; - -typedef struct { - upb_EpsCopyInputStream stream; - upb_Arena* arena; - upb_UnknownField* tmp; - size_t tmp_size; - int depth; - upb_UnknownCompareResult status; - jmp_buf err; -} upb_UnknownField_Context; - -UPB_NORETURN static void upb_UnknownFields_OutOfMemory( - upb_UnknownField_Context* ctx) { - ctx->status = kUpb_UnknownCompareResult_OutOfMemory; - UPB_LONGJMP(ctx->err, 1); -} - -static void upb_UnknownFields_Grow(upb_UnknownField_Context* ctx, - upb_UnknownField** base, - upb_UnknownField** ptr, - upb_UnknownField** end) { - size_t old = (*ptr - *base); - size_t new = UPB_MAX(4, old * 2); - - *base = upb_Arena_Realloc(ctx->arena, *base, old * sizeof(**base), - new * sizeof(**base)); - if (!*base) upb_UnknownFields_OutOfMemory(ctx); - - *ptr = *base + old; - *end = *base + new; -} - -// We have to implement our own sort here, since qsort() is not an in-order -// sort. Here we use merge sort, the simplest in-order sort. -static void upb_UnknownFields_Merge(upb_UnknownField* arr, size_t start, - size_t mid, size_t end, - upb_UnknownField* tmp) { - memcpy(tmp, &arr[start], (end - start) * sizeof(*tmp)); - - upb_UnknownField* ptr1 = tmp; - upb_UnknownField* end1 = &tmp[mid - start]; - upb_UnknownField* ptr2 = &tmp[mid - start]; - upb_UnknownField* end2 = &tmp[end - start]; - upb_UnknownField* out = &arr[start]; - - while (ptr1 < end1 && ptr2 < end2) { - if (ptr1->tag <= ptr2->tag) { - *out++ = *ptr1++; - } else { - *out++ = *ptr2++; - } - } - - if (ptr1 < end1) { - memcpy(out, ptr1, (end1 - ptr1) * sizeof(*out)); - } else if (ptr2 < end2) { - memcpy(out, ptr1, (end2 - ptr2) * sizeof(*out)); - } -} - -static void upb_UnknownFields_SortRecursive(upb_UnknownField* arr, size_t start, - size_t end, upb_UnknownField* tmp) { - if (end - start > 1) { - size_t mid = start + ((end - start) / 2); - upb_UnknownFields_SortRecursive(arr, start, mid, tmp); - upb_UnknownFields_SortRecursive(arr, mid, end, tmp); - upb_UnknownFields_Merge(arr, start, mid, end, tmp); - } -} - -static void upb_UnknownFields_Sort(upb_UnknownField_Context* ctx, - upb_UnknownFields* fields) { - if (ctx->tmp_size < fields->size) { - const int oldsize = ctx->tmp_size * sizeof(*ctx->tmp); - ctx->tmp_size = UPB_MAX(8, ctx->tmp_size); - while (ctx->tmp_size < fields->size) ctx->tmp_size *= 2; - const int newsize = ctx->tmp_size * sizeof(*ctx->tmp); - ctx->tmp = upb_grealloc(ctx->tmp, oldsize, newsize); - } - upb_UnknownFields_SortRecursive(fields->fields, 0, fields->size, ctx->tmp); -} - -static upb_UnknownFields* upb_UnknownFields_DoBuild( - upb_UnknownField_Context* ctx, const char** buf) { - upb_UnknownField* arr_base = NULL; - upb_UnknownField* arr_ptr = NULL; - upb_UnknownField* arr_end = NULL; - const char* ptr = *buf; - uint32_t last_tag = 0; - bool sorted = true; - while (!upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr)) { - uint32_t tag; - ptr = upb_WireReader_ReadTag(ptr, &tag); - UPB_ASSERT(tag <= UINT32_MAX); - int wire_type = upb_WireReader_GetWireType(tag); - if (wire_type == kUpb_WireType_EndGroup) break; - if (tag < last_tag) sorted = false; - last_tag = tag; - - if (arr_ptr == arr_end) { - upb_UnknownFields_Grow(ctx, &arr_base, &arr_ptr, &arr_end); - } - upb_UnknownField* field = arr_ptr; - field->tag = tag; - arr_ptr++; - - switch (wire_type) { - case kUpb_WireType_Varint: - ptr = upb_WireReader_ReadVarint(ptr, &field->data.varint); - break; - case kUpb_WireType_64Bit: - ptr = upb_WireReader_ReadFixed64(ptr, &field->data.uint64); - break; - case kUpb_WireType_32Bit: - ptr = upb_WireReader_ReadFixed32(ptr, &field->data.uint32); - break; - case kUpb_WireType_Delimited: { - int size; - ptr = upb_WireReader_ReadSize(ptr, &size); - const char* s_ptr = ptr; - ptr = upb_EpsCopyInputStream_ReadStringAliased(&ctx->stream, &s_ptr, - size); - field->data.delimited.data = s_ptr; - field->data.delimited.size = size; - break; - } - case kUpb_WireType_StartGroup: - if (--ctx->depth == 0) { - ctx->status = kUpb_UnknownCompareResult_MaxDepthExceeded; - UPB_LONGJMP(ctx->err, 1); - } - field->data.group = upb_UnknownFields_DoBuild(ctx, &ptr); - ctx->depth++; - break; - default: - UPB_UNREACHABLE(); - } - } - - *buf = ptr; - upb_UnknownFields* ret = upb_Arena_Malloc(ctx->arena, sizeof(*ret)); - if (!ret) upb_UnknownFields_OutOfMemory(ctx); - ret->fields = arr_base; - ret->size = arr_ptr - arr_base; - ret->capacity = arr_end - arr_base; - if (!sorted) { - upb_UnknownFields_Sort(ctx, ret); - } - return ret; -} - -// Builds a upb_UnknownFields data structure from the binary data in buf. -static upb_UnknownFields* upb_UnknownFields_Build(upb_UnknownField_Context* ctx, - const char* ptr, - size_t size) { - upb_EpsCopyInputStream_Init(&ctx->stream, &ptr, size, true); - upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &ptr); - UPB_ASSERT(upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr) && - !upb_EpsCopyInputStream_IsError(&ctx->stream)); - return fields; -} - -// Compares two sorted upb_UnknownFields structures for equality. -static bool upb_UnknownFields_IsEqual(const upb_UnknownFields* uf1, - const upb_UnknownFields* uf2) { - if (uf1->size != uf2->size) return false; - for (size_t i = 0, n = uf1->size; i < n; i++) { - upb_UnknownField* f1 = &uf1->fields[i]; - upb_UnknownField* f2 = &uf2->fields[i]; - if (f1->tag != f2->tag) return false; - int wire_type = f1->tag & 7; - switch (wire_type) { - case kUpb_WireType_Varint: - if (f1->data.varint != f2->data.varint) return false; - break; - case kUpb_WireType_64Bit: - if (f1->data.uint64 != f2->data.uint64) return false; - break; - case kUpb_WireType_32Bit: - if (f1->data.uint32 != f2->data.uint32) return false; - break; - case kUpb_WireType_Delimited: - if (!upb_StringView_IsEqual(f1->data.delimited, f2->data.delimited)) { - return false; - } - break; - case kUpb_WireType_StartGroup: - if (!upb_UnknownFields_IsEqual(f1->data.group, f2->data.group)) { - return false; - } - break; - default: - UPB_UNREACHABLE(); - } - } - return true; -} - -static upb_UnknownCompareResult upb_UnknownField_DoCompare( - upb_UnknownField_Context* ctx, const char* buf1, size_t size1, - const char* buf2, size_t size2) { - upb_UnknownCompareResult ret; - // First build both unknown fields into a sorted data structure (similar - // to the UnknownFieldSet in C++). - upb_UnknownFields* uf1 = upb_UnknownFields_Build(ctx, buf1, size1); - upb_UnknownFields* uf2 = upb_UnknownFields_Build(ctx, buf2, size2); - - // Now perform the equality check on the sorted structures. - if (upb_UnknownFields_IsEqual(uf1, uf2)) { - ret = kUpb_UnknownCompareResult_Equal; - } else { - ret = kUpb_UnknownCompareResult_NotEqual; - } - return ret; -} - -static upb_UnknownCompareResult upb_UnknownField_Compare( - upb_UnknownField_Context* const ctx, const char* const buf1, - const size_t size1, const char* const buf2, const size_t size2) { - upb_UnknownCompareResult ret; - if (UPB_SETJMP(ctx->err) == 0) { - ret = upb_UnknownField_DoCompare(ctx, buf1, size1, buf2, size2); - } else { - ret = ctx->status; - UPB_ASSERT(ret != kUpb_UnknownCompareResult_Equal); - } - - upb_Arena_Free(ctx->arena); - upb_gfree(ctx->tmp); - return ret; -} - -upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - const char* buf1, size_t size1, const char* buf2, size_t size2, - int max_depth) { - if (size1 == 0 && size2 == 0) return kUpb_UnknownCompareResult_Equal; - if (size1 == 0 || size2 == 0) return kUpb_UnknownCompareResult_NotEqual; - if (memcmp(buf1, buf2, size1) == 0) return kUpb_UnknownCompareResult_Equal; - - upb_UnknownField_Context ctx = { - .arena = upb_Arena_New(), - .depth = max_depth, - .tmp = NULL, - .tmp_size = 0, - .status = kUpb_UnknownCompareResult_Equal, - }; - - if (!ctx.arena) return kUpb_UnknownCompareResult_OutOfMemory; - - return upb_UnknownField_Compare(&ctx, buf1, size1, buf2, size2); -} - - +#include <stdint.h> #include <string.h> @@ -11691,98 +12105,118 @@ upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( const struct upb_Message* msg, const upb_MiniTableExtension* e) { - size_t n; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &n); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return NULL; - // For now we use linear search exclusively to find extensions. - // If this becomes an issue due to messages with lots of extensions, - // we can introduce a table of some sort. - for (size_t i = 0; i < n; i++) { - if (ext[i].ext == e) { - return &ext[i]; + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + if (ext->ext == e) { + return ext; + } } } return NULL; } -const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)( - const struct upb_Message* msg, size_t* count) { - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - *count = (in->size - in->ext_begin) / sizeof(upb_Extension); - return UPB_PTR_AT(in, in->ext_begin, void); - } else { - *count = 0; - return NULL; - } -} - upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( struct upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* a) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e); if (ext) return ext; - if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(upb_Extension), a)) - return NULL; + + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, a)) return NULL; upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - in->ext_begin -= sizeof(upb_Extension); - ext = UPB_PTR_AT(in, in->ext_begin, void); + ext = upb_Arena_Malloc(a, sizeof(upb_Extension)); + if (!ext) return NULL; memset(ext, 0, sizeof(upb_Extension)); ext->ext = e; + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeExtension(ext); return ext; } +void upb_Message_ReplaceUnknownWithExtension(struct upb_Message* msg, + uintptr_t iter, + const upb_Extension* ext) { + UPB_ASSERT(iter != 0); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + UPB_ASSERT(in); + size_t index = iter - 1; + upb_TaggedAuxPtr tagged_ptr = in->aux_data[index]; + UPB_ASSERT(upb_TaggedAuxPtr_IsUnknown(tagged_ptr)); + in->aux_data[index] = upb_TaggedAuxPtr_MakeExtension(ext); +} #include <math.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> // Must be last. -const float kUpb_FltInfinity = (float)(1.0 / 0.0); -const double kUpb_Infinity = 1.0 / 0.0; -const double kUpb_NaN = 0.0 / 0.0; +// The latest win32 SDKs have an invalid definition of NAN. +// https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907 +// +// Unfortunately, the `0.0 / 0.0` workaround doesn't work in Clang under C23, so +// try __builtin_nan first, if that exists. +#ifdef _WIN32 +#ifdef __has_builtin +#if __has_builtin(__builtin_nan) +#define UPB_NAN __builtin_nan("0") +#endif +#if __has_builtin(__builtin_inf) +#define UPB_INFINITY __builtin_inf() +#endif +#endif +#ifndef UPB_NAN +#define UPB_NAN 0.0 / 0.0 +#endif +#ifndef UPB_INFINITY +#define UPB_INFINITY 1.0 / 0.0 +#endif +#else +// For !_WIN32, assume math.h works. +#define UPB_NAN NAN +#define UPB_INFINITY INFINITY +#endif -bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, - upb_Arena* a) { +const float kUpb_FltInfinity = UPB_INFINITY; +const double kUpb_Infinity = UPB_INFINITY; +const double kUpb_NaN = UPB_NAN; + +static size_t _upb_Message_SizeOfInternal(uint32_t count) { + return UPB_SIZEOF_FLEX(upb_Message_Internal, aux_data, count); +} + +bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, + upb_Arena* a) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); - const size_t overhead = sizeof(upb_Message_Internal); - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) { // No internal data, allocate from scratch. - size_t size = UPB_MAX(128, upb_Log2CeilingSize(need + overhead)); - in = upb_Arena_Malloc(a, size); + uint32_t capacity = 4; + in = upb_Arena_Malloc(a, _upb_Message_SizeOfInternal(capacity)); if (!in) return false; - - in->size = size; - in->unknown_end = overhead; - in->ext_begin = size; + in->size = 0; + in->capacity = capacity; UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); - } else if (in->ext_begin - in->unknown_end < need) { + } else if (in->capacity == in->size) { // Internal data is too small, reallocate. - size_t new_size = upb_Log2CeilingSize(in->size + need); - size_t ext_bytes = in->size - in->ext_begin; - size_t new_ext_begin = new_size - ext_bytes; - in = upb_Arena_Realloc(a, in, in->size, new_size); + uint32_t new_capacity = upb_RoundUpToPowerOfTwo(in->size + 1); + in = upb_Arena_Realloc(a, in, _upb_Message_SizeOfInternal(in->capacity), + _upb_Message_SizeOfInternal(new_capacity)); if (!in) return false; - - if (ext_bytes) { - // Need to move extension data to the end. - char* ptr = (char*)in; - memmove(ptr + new_ext_begin, ptr + in->ext_begin, ext_bytes); - } - in->ext_begin = new_ext_begin; - in->size = new_size; + in->capacity = new_capacity; UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); } - - UPB_ASSERT(in->ext_begin - in->unknown_end >= need); + UPB_ASSERT(in->capacity - in->size >= 1); return true; } -#if UPB_TRACING_ENABLED +#ifdef UPB_TRACING_ENABLED static void (*_message_trace_handler)(const upb_MiniTable*, const upb_Arena*); void upb_Message_LogNewMessage(const upb_MiniTable* m, const upb_Arena* arena) { @@ -11840,23 +12274,6 @@ bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg, return false; } -bool UPB_PRIVATE(_upb_Message_NextExtension)( - const upb_Message* msg, const upb_MiniTable* m, - const upb_MiniTableExtension** out_e, upb_MessageValue* out_v, - size_t* iter) { - size_t count; - const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - size_t i = *iter; - - if (++i < count) { - *out_e = exts[i].ext; - *out_v = exts[i].data; - *iter = i; - return true; - } - - return false; -} const char _kUpb_ToBase92[] = { ' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/', @@ -12439,9 +12856,15 @@ const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( return _upb_DefType_Unpack(v, UPB_DEFTYPE_FIELD); case UPB_DEFTYPE_MSG: { const upb_MessageDef* m = _upb_DefType_Unpack(v, UPB_DEFTYPE_MSG); - return _upb_MessageDef_InMessageSet(m) - ? upb_MessageDef_NestedExtension(m, 0) - : NULL; + if (_upb_MessageDef_InMessageSet(m)) { + for (int i = 0; i < upb_MessageDef_NestedExtensionCount(m); i++) { + const upb_FieldDef* ext = upb_MessageDef_NestedExtension(m, i); + if (upb_FieldDef_MessageSubDef(ext) == m) { + return ext; + } + } + } + return NULL; } default: break; @@ -14473,7 +14896,7 @@ bool upb_FileDef_Resolves(const upb_FileDef* f, const char* path) { return false; } -static char* strviewdup(upb_DefBuilder* ctx, upb_StringView view) { +static char* _strviewdup(upb_DefBuilder* ctx, upb_StringView view) { char* ret = upb_strdup2(view.data, view.size, _upb_DefBuilder_Arena(ctx)); if (!ret) _upb_DefBuilder_OomErr(ctx); return ret; @@ -14602,7 +15025,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, } upb_StringView name = UPB_DESC(FileDescriptorProto_name)(file_proto); - file->name = strviewdup(ctx, name); + file->name = _strviewdup(ctx, name); if (strlen(file->name) != name.size) { _upb_DefBuilder_Errf(ctx, "File name contained embedded NULL"); } @@ -14611,7 +15034,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, if (package.size) { _upb_DefBuilder_CheckIdentFull(ctx, package); - file->package = strviewdup(ctx, package); + file->package = _strviewdup(ctx, package); } else { file->package = NULL; } @@ -14745,9 +15168,16 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, } if (file->ext_count) { - bool ok = upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistryStatus status = upb_ExtensionRegistry_AddArray( _upb_DefPool_ExtReg(ctx->symtab), file->ext_layouts, file->ext_count); - if (!ok) _upb_DefBuilder_OomErr(ctx); + if (status != kUpb_ExtensionRegistryStatus_Ok) { + if (status == kUpb_ExtensionRegistryStatus_OutOfMemory) { + _upb_DefBuilder_OomErr(ctx); + } + + UPB_ASSERT(status == kUpb_ExtensionRegistryStatus_DuplicateEntry); + _upb_DefBuilder_Errf(ctx, "duplicate extension entry"); + } } } @@ -15084,7 +15514,7 @@ upb_StringView _upb_DefBuilder_MakeKey(upb_DefBuilder* ctx, upb_StringView key) { size_t need = key.size + sizeof(void*); if (ctx->tmp_buf_size < need) { - ctx->tmp_buf_size = UPB_MAX(64, upb_Log2Ceiling(need)); + ctx->tmp_buf_size = UPB_MAX(64, upb_RoundUpToPowerOfTwo(need)); ctx->tmp_buf = upb_Arena_Malloc(ctx->tmp_arena, ctx->tmp_buf_size); if (!ctx->tmp_buf) _upb_DefBuilder_OomErr(ctx); } @@ -15323,15 +15753,18 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, } if (ext_pool) { - // Return any extensions that are set. - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - if (i - n < count) { - ext += count - 1 - (i - n); - memcpy(out_val, &ext->data, sizeof(*out_val)); - *out_f = upb_DefPool_FindExtensionByMiniTable(ext_pool, ext->ext); - *iter = i; - return true; + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return false; + + for (; (i - n) < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i - n]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + memcpy(out_val, &ext->data, sizeof(*out_val)); + *out_f = upb_DefPool_FindExtensionByMiniTable(ext_pool, ext->ext); + *iter = i; + return true; + } } } @@ -15340,7 +15773,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, } bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, - int depth) { + const upb_DefPool* ext_pool, int depth) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); size_t iter = kUpb_Message_Begin; const upb_FieldDef* f; @@ -15351,7 +15784,7 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, _upb_Message_DiscardUnknown_shallow(msg); - while (upb_Message_Next(msg, m, NULL /*ext_pool*/, &f, &val, &iter)) { + while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { const upb_MessageDef* subm = upb_FieldDef_MessageSubDef(f); if (!subm) continue; if (upb_FieldDef_IsMap(f)) { @@ -15365,7 +15798,7 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, upb_MessageValue map_key, map_val; while (upb_Map_Next(map, &map_key, &map_val, &iter)) { if (!_upb_Message_DiscardUnknown((upb_Message*)map_val.msg_val, val_m, - depth)) { + ext_pool, depth)) { ret = false; } } @@ -15375,13 +15808,13 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, for (i = 0; i < n; i++) { upb_MessageValue elem = upb_Array_Get(arr, i); if (!_upb_Message_DiscardUnknown((upb_Message*)elem.msg_val, subm, - depth)) { + ext_pool, depth)) { ret = false; } } } else { if (!_upb_Message_DiscardUnknown((upb_Message*)val.msg_val, subm, - depth)) { + ext_pool, depth)) { ret = false; } } @@ -15391,8 +15824,8 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, } bool upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, - int maxdepth) { - return _upb_Message_DiscardUnknown(msg, m, maxdepth); + const upb_DefPool* ext_pool, int maxdepth) { + return _upb_Message_DiscardUnknown(msg, m, ext_pool, maxdepth); } @@ -16602,16 +17035,683 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, return s; } + +#include <inttypes.h> +#include <math.h> + + +// Must be last. + +typedef struct { + upb_Arena* arena; + jmp_buf err; +} upb_ToProto_Context; + +#define CHK_OOM(val) \ + if (!(val)) UPB_LONGJMP(ctx->err, 1); + +// We want to copy the options verbatim into the destination options proto. +// We use serialize+parse as our deep copy. +#define SET_OPTIONS(proto, desc_type, options_type, src) \ + { \ + size_t size; \ + /* MEM: could use a temporary arena here instead. */ \ + char* pb = google_protobuf_##options_type##_serialize(src, ctx->arena, &size); \ + CHK_OOM(pb); \ + google_protobuf_##options_type* dst = \ + google_protobuf_##options_type##_parse(pb, size, ctx->arena); \ + CHK_OOM(dst); \ + google_protobuf_##desc_type##_set_options(proto, dst); \ + } + +static upb_StringView strviewdup2(upb_ToProto_Context* ctx, + upb_StringView str) { + char* p = upb_Arena_Malloc(ctx->arena, str.size); + CHK_OOM(p); + memcpy(p, str.data, str.size); + return (upb_StringView){.data = p, .size = str.size}; +} + +static upb_StringView strviewdup(upb_ToProto_Context* ctx, const char* s) { + return strviewdup2(ctx, (upb_StringView){.data = s, .size = strlen(s)}); +} + +static upb_StringView qual_dup(upb_ToProto_Context* ctx, const char* s) { + size_t n = strlen(s); + char* p = upb_Arena_Malloc(ctx->arena, n + 1); + CHK_OOM(p); + p[0] = '.'; + memcpy(p + 1, s, n); + return (upb_StringView){.data = p, .size = n + 1}; +} + +UPB_PRINTF(2, 3) +static upb_StringView printf_dup(upb_ToProto_Context* ctx, const char* fmt, + ...) { + const size_t max = 32; + char* p = upb_Arena_Malloc(ctx->arena, max); + CHK_OOM(p); + va_list args; + va_start(args, fmt); + size_t n = _upb_vsnprintf(p, max, fmt, args); + va_end(args); + UPB_ASSERT(n < max); + return (upb_StringView){.data = p, .size = n}; +} + +static bool upb_isprint(char ch) { return ch >= 0x20 && ch <= 0x7f; } + +static int special_escape(char ch) { + switch (ch) { + // This is the same set of special escapes recognized by + // absl::CEscape(). + case '\n': + return 'n'; + case '\r': + return 'r'; + case '\t': + return 't'; + case '\\': + return '\\'; + case '\'': + return '\''; + case '"': + return '"'; + default: + return -1; + } +} + +static upb_StringView default_bytes(upb_ToProto_Context* ctx, + upb_StringView val) { + size_t n = 0; + for (size_t i = 0; i < val.size; i++) { + char ch = val.data[i]; + if (special_escape(ch) >= 0) + n += 2; // '\C' + else if (upb_isprint(ch)) + n += 1; + else + n += 4; // '\123' + } + char* p = upb_Arena_Malloc(ctx->arena, n); + CHK_OOM(p); + char* dst = p; + const char* src = val.data; + const char* end = src + val.size; + while (src < end) { + unsigned char ch = *src++; + if (special_escape(ch) >= 0) { + *dst++ = '\\'; + *dst++ = (char)special_escape(ch); + } else if (upb_isprint(ch)) { + *dst++ = ch; + } else { + *dst++ = '\\'; + *dst++ = '0' + (ch >> 6); + *dst++ = '0' + ((ch >> 3) & 0x7); + *dst++ = '0' + (ch & 0x7); + } + } + return (upb_StringView){.data = p, .size = n}; +} + +static upb_StringView default_string(upb_ToProto_Context* ctx, + const upb_FieldDef* f) { + upb_MessageValue d = upb_FieldDef_Default(f); + upb_CType type = upb_FieldDef_CType(f); + + if (type == kUpb_CType_Float || type == kUpb_CType_Double) { + double val = type == kUpb_CType_Float ? d.float_val : d.double_val; + if (val == INFINITY) { + return strviewdup(ctx, "inf"); + } else if (val == -INFINITY) { + return strviewdup(ctx, "-inf"); + } else if (val != val) { + return strviewdup(ctx, "nan"); + } + } + + switch (upb_FieldDef_CType(f)) { + case kUpb_CType_Bool: + return strviewdup(ctx, d.bool_val ? "true" : "false"); + case kUpb_CType_Enum: { + const upb_EnumDef* e = upb_FieldDef_EnumSubDef(f); + const upb_EnumValueDef* ev = + upb_EnumDef_FindValueByNumber(e, d.int32_val); + return strviewdup(ctx, upb_EnumValueDef_Name(ev)); + } + case kUpb_CType_Int64: + return printf_dup(ctx, "%" PRId64, d.int64_val); + case kUpb_CType_UInt64: + return printf_dup(ctx, "%" PRIu64, d.uint64_val); + case kUpb_CType_Int32: + return printf_dup(ctx, "%" PRId32, d.int32_val); + case kUpb_CType_UInt32: + return printf_dup(ctx, "%" PRIu32, d.uint32_val); + case kUpb_CType_Float: + return printf_dup(ctx, "%.9g", d.float_val); + case kUpb_CType_Double: + return printf_dup(ctx, "%.17g", d.double_val); + case kUpb_CType_String: + return strviewdup2(ctx, d.str_val); + case kUpb_CType_Bytes: + return default_bytes(ctx, d.str_val); + default: + UPB_UNREACHABLE(); + } +} + +static google_protobuf_DescriptorProto_ReservedRange* resrange_toproto( + upb_ToProto_Context* ctx, const upb_MessageReservedRange* r) { + google_protobuf_DescriptorProto_ReservedRange* proto = + google_protobuf_DescriptorProto_ReservedRange_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_DescriptorProto_ReservedRange_set_start( + proto, upb_MessageReservedRange_Start(r)); + google_protobuf_DescriptorProto_ReservedRange_set_end(proto, + upb_MessageReservedRange_End(r)); + + return proto; +} + +static google_protobuf_EnumDescriptorProto_EnumReservedRange* enumresrange_toproto( + upb_ToProto_Context* ctx, const upb_EnumReservedRange* r) { + google_protobuf_EnumDescriptorProto_EnumReservedRange* proto = + google_protobuf_EnumDescriptorProto_EnumReservedRange_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start( + proto, upb_EnumReservedRange_Start(r)); + google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end( + proto, upb_EnumReservedRange_End(r)); + + return proto; +} + +static google_protobuf_FieldDescriptorProto* fielddef_toproto(upb_ToProto_Context* ctx, + const upb_FieldDef* f) { + google_protobuf_FieldDescriptorProto* proto = + google_protobuf_FieldDescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_FieldDescriptorProto_set_name(proto, + strviewdup(ctx, upb_FieldDef_Name(f))); + google_protobuf_FieldDescriptorProto_set_number(proto, upb_FieldDef_Number(f)); + + if (upb_FieldDef_IsRequired(f) && + upb_FileDef_Edition(upb_FieldDef_File(f)) >= UPB_DESC(EDITION_2023)) { + google_protobuf_FieldDescriptorProto_set_label( + proto, UPB_DESC(FieldDescriptorProto_LABEL_OPTIONAL)); + } else { + google_protobuf_FieldDescriptorProto_set_label(proto, upb_FieldDef_Label(f)); + } + if (upb_FieldDef_Type(f) == kUpb_FieldType_Group && + upb_FileDef_Edition(upb_FieldDef_File(f)) >= UPB_DESC(EDITION_2023)) { + google_protobuf_FieldDescriptorProto_set_type(proto, kUpb_FieldType_Message); + } else { + google_protobuf_FieldDescriptorProto_set_type(proto, upb_FieldDef_Type(f)); + } + + if (upb_FieldDef_HasJsonName(f)) { + google_protobuf_FieldDescriptorProto_set_json_name( + proto, strviewdup(ctx, upb_FieldDef_JsonName(f))); + } + + if (upb_FieldDef_IsSubMessage(f)) { + google_protobuf_FieldDescriptorProto_set_type_name( + proto, + qual_dup(ctx, upb_MessageDef_FullName(upb_FieldDef_MessageSubDef(f)))); + } else if (upb_FieldDef_CType(f) == kUpb_CType_Enum) { + google_protobuf_FieldDescriptorProto_set_type_name( + proto, qual_dup(ctx, upb_EnumDef_FullName(upb_FieldDef_EnumSubDef(f)))); + } + + if (upb_FieldDef_IsExtension(f)) { + google_protobuf_FieldDescriptorProto_set_extendee( + proto, + qual_dup(ctx, upb_MessageDef_FullName(upb_FieldDef_ContainingType(f)))); + } + + if (upb_FieldDef_HasDefault(f)) { + google_protobuf_FieldDescriptorProto_set_default_value(proto, + default_string(ctx, f)); + } + + const upb_OneofDef* o = upb_FieldDef_ContainingOneof(f); + if (o) { + google_protobuf_FieldDescriptorProto_set_oneof_index(proto, upb_OneofDef_Index(o)); + } + + if (_upb_FieldDef_IsProto3Optional(f)) { + google_protobuf_FieldDescriptorProto_set_proto3_optional(proto, true); + } + + if (upb_FieldDef_HasOptions(f)) { + SET_OPTIONS(proto, FieldDescriptorProto, FieldOptions, + upb_FieldDef_Options(f)); + } + + return proto; +} + +static google_protobuf_OneofDescriptorProto* oneofdef_toproto(upb_ToProto_Context* ctx, + const upb_OneofDef* o) { + google_protobuf_OneofDescriptorProto* proto = + google_protobuf_OneofDescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_OneofDescriptorProto_set_name(proto, + strviewdup(ctx, upb_OneofDef_Name(o))); + + if (upb_OneofDef_HasOptions(o)) { + SET_OPTIONS(proto, OneofDescriptorProto, OneofOptions, + upb_OneofDef_Options(o)); + } + + return proto; +} + +static google_protobuf_EnumValueDescriptorProto* enumvaldef_toproto( + upb_ToProto_Context* ctx, const upb_EnumValueDef* e) { + google_protobuf_EnumValueDescriptorProto* proto = + google_protobuf_EnumValueDescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_EnumValueDescriptorProto_set_name( + proto, strviewdup(ctx, upb_EnumValueDef_Name(e))); + google_protobuf_EnumValueDescriptorProto_set_number(proto, upb_EnumValueDef_Number(e)); + + if (upb_EnumValueDef_HasOptions(e)) { + SET_OPTIONS(proto, EnumValueDescriptorProto, EnumValueOptions, + upb_EnumValueDef_Options(e)); + } + + return proto; +} + +static google_protobuf_EnumDescriptorProto* enumdef_toproto(upb_ToProto_Context* ctx, + const upb_EnumDef* e) { + google_protobuf_EnumDescriptorProto* proto = + google_protobuf_EnumDescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_EnumDescriptorProto_set_name(proto, + strviewdup(ctx, upb_EnumDef_Name(e))); + + int n = upb_EnumDef_ValueCount(e); + google_protobuf_EnumValueDescriptorProto** vals = + google_protobuf_EnumDescriptorProto_resize_value(proto, n, ctx->arena); + CHK_OOM(vals); + for (int i = 0; i < n; i++) { + vals[i] = enumvaldef_toproto(ctx, upb_EnumDef_Value(e, i)); + } + + n = upb_EnumDef_ReservedRangeCount(e); + google_protobuf_EnumDescriptorProto_EnumReservedRange** res_ranges = + google_protobuf_EnumDescriptorProto_resize_reserved_range(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + res_ranges[i] = enumresrange_toproto(ctx, upb_EnumDef_ReservedRange(e, i)); + } + + n = upb_EnumDef_ReservedNameCount(e); + upb_StringView* res_names = + google_protobuf_EnumDescriptorProto_resize_reserved_name(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + res_names[i] = upb_EnumDef_ReservedName(e, i); + } + + if (upb_EnumDef_HasOptions(e)) { + SET_OPTIONS(proto, EnumDescriptorProto, EnumOptions, + upb_EnumDef_Options(e)); + } + + return proto; +} + +static google_protobuf_DescriptorProto_ExtensionRange* extrange_toproto( + upb_ToProto_Context* ctx, const upb_ExtensionRange* e) { + google_protobuf_DescriptorProto_ExtensionRange* proto = + google_protobuf_DescriptorProto_ExtensionRange_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_DescriptorProto_ExtensionRange_set_start(proto, + upb_ExtensionRange_Start(e)); + google_protobuf_DescriptorProto_ExtensionRange_set_end(proto, + upb_ExtensionRange_End(e)); + + if (upb_ExtensionRange_HasOptions(e)) { + SET_OPTIONS(proto, DescriptorProto_ExtensionRange, ExtensionRangeOptions, + upb_ExtensionRange_Options(e)); + } + + return proto; +} + +static google_protobuf_DescriptorProto* msgdef_toproto(upb_ToProto_Context* ctx, + const upb_MessageDef* m) { + google_protobuf_DescriptorProto* proto = google_protobuf_DescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_DescriptorProto_set_name(proto, + strviewdup(ctx, upb_MessageDef_Name(m))); + + int n; + + n = upb_MessageDef_FieldCount(m); + google_protobuf_FieldDescriptorProto** fields = + google_protobuf_DescriptorProto_resize_field(proto, n, ctx->arena); + CHK_OOM(fields); + for (int i = 0; i < n; i++) { + fields[i] = fielddef_toproto(ctx, upb_MessageDef_Field(m, i)); + } + + n = upb_MessageDef_OneofCount(m); + google_protobuf_OneofDescriptorProto** oneofs = + google_protobuf_DescriptorProto_resize_oneof_decl(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + oneofs[i] = oneofdef_toproto(ctx, upb_MessageDef_Oneof(m, i)); + } + + n = upb_MessageDef_NestedMessageCount(m); + google_protobuf_DescriptorProto** nested_msgs = + google_protobuf_DescriptorProto_resize_nested_type(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + nested_msgs[i] = msgdef_toproto(ctx, upb_MessageDef_NestedMessage(m, i)); + } + + n = upb_MessageDef_NestedEnumCount(m); + google_protobuf_EnumDescriptorProto** nested_enums = + google_protobuf_DescriptorProto_resize_enum_type(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + nested_enums[i] = enumdef_toproto(ctx, upb_MessageDef_NestedEnum(m, i)); + } + + n = upb_MessageDef_NestedExtensionCount(m); + google_protobuf_FieldDescriptorProto** nested_exts = + google_protobuf_DescriptorProto_resize_extension(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + nested_exts[i] = + fielddef_toproto(ctx, upb_MessageDef_NestedExtension(m, i)); + } + + n = upb_MessageDef_ExtensionRangeCount(m); + google_protobuf_DescriptorProto_ExtensionRange** ext_ranges = + google_protobuf_DescriptorProto_resize_extension_range(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + ext_ranges[i] = extrange_toproto(ctx, upb_MessageDef_ExtensionRange(m, i)); + } + + n = upb_MessageDef_ReservedRangeCount(m); + google_protobuf_DescriptorProto_ReservedRange** res_ranges = + google_protobuf_DescriptorProto_resize_reserved_range(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + res_ranges[i] = resrange_toproto(ctx, upb_MessageDef_ReservedRange(m, i)); + } + + n = upb_MessageDef_ReservedNameCount(m); + upb_StringView* res_names = + google_protobuf_DescriptorProto_resize_reserved_name(proto, n, ctx->arena); + for (int i = 0; i < n; i++) { + res_names[i] = upb_MessageDef_ReservedName(m, i); + } + + if (upb_MessageDef_HasOptions(m)) { + SET_OPTIONS(proto, DescriptorProto, MessageOptions, + upb_MessageDef_Options(m)); + } + + return proto; +} + +static google_protobuf_MethodDescriptorProto* methoddef_toproto(upb_ToProto_Context* ctx, + const upb_MethodDef* m) { + google_protobuf_MethodDescriptorProto* proto = + google_protobuf_MethodDescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_MethodDescriptorProto_set_name(proto, + strviewdup(ctx, upb_MethodDef_Name(m))); + + google_protobuf_MethodDescriptorProto_set_input_type( + proto, + qual_dup(ctx, upb_MessageDef_FullName(upb_MethodDef_InputType(m)))); + google_protobuf_MethodDescriptorProto_set_output_type( + proto, + qual_dup(ctx, upb_MessageDef_FullName(upb_MethodDef_OutputType(m)))); + + if (upb_MethodDef_ClientStreaming(m)) { + google_protobuf_MethodDescriptorProto_set_client_streaming(proto, true); + } + + if (upb_MethodDef_ServerStreaming(m)) { + google_protobuf_MethodDescriptorProto_set_server_streaming(proto, true); + } + + if (upb_MethodDef_HasOptions(m)) { + SET_OPTIONS(proto, MethodDescriptorProto, MethodOptions, + upb_MethodDef_Options(m)); + } + + return proto; +} + +static google_protobuf_ServiceDescriptorProto* servicedef_toproto( + upb_ToProto_Context* ctx, const upb_ServiceDef* s) { + google_protobuf_ServiceDescriptorProto* proto = + google_protobuf_ServiceDescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_ServiceDescriptorProto_set_name( + proto, strviewdup(ctx, upb_ServiceDef_Name(s))); + + size_t n = upb_ServiceDef_MethodCount(s); + google_protobuf_MethodDescriptorProto** methods = + google_protobuf_ServiceDescriptorProto_resize_method(proto, n, ctx->arena); + for (size_t i = 0; i < n; i++) { + methods[i] = methoddef_toproto(ctx, upb_ServiceDef_Method(s, i)); + } + + if (upb_ServiceDef_HasOptions(s)) { + SET_OPTIONS(proto, ServiceDescriptorProto, ServiceOptions, + upb_ServiceDef_Options(s)); + } + + return proto; +} + +static google_protobuf_FileDescriptorProto* filedef_toproto(upb_ToProto_Context* ctx, + const upb_FileDef* f) { + google_protobuf_FileDescriptorProto* proto = + google_protobuf_FileDescriptorProto_new(ctx->arena); + CHK_OOM(proto); + + google_protobuf_FileDescriptorProto_set_name(proto, + strviewdup(ctx, upb_FileDef_Name(f))); + + const char* package = upb_FileDef_Package(f); + if (package) { + size_t n = strlen(package); + if (n) { + google_protobuf_FileDescriptorProto_set_package(proto, strviewdup(ctx, package)); + } + } + + if (upb_FileDef_Syntax(f) == kUpb_Syntax_Editions) { + google_protobuf_FileDescriptorProto_set_edition(proto, upb_FileDef_Edition(f)); + } + + if (upb_FileDef_Syntax(f) == kUpb_Syntax_Proto3) { + google_protobuf_FileDescriptorProto_set_syntax(proto, strviewdup(ctx, "proto3")); + } else if (upb_FileDef_Syntax(f) == kUpb_Syntax_Editions) { + google_protobuf_FileDescriptorProto_set_syntax(proto, strviewdup(ctx, "editions")); + } + + size_t n; + n = upb_FileDef_DependencyCount(f); + upb_StringView* deps = + google_protobuf_FileDescriptorProto_resize_dependency(proto, n, ctx->arena); + for (size_t i = 0; i < n; i++) { + deps[i] = strviewdup(ctx, upb_FileDef_Name(upb_FileDef_Dependency(f, i))); + } + + n = upb_FileDef_PublicDependencyCount(f); + int32_t* public_deps = + google_protobuf_FileDescriptorProto_resize_public_dependency(proto, n, ctx->arena); + const int32_t* public_dep_nums = _upb_FileDef_PublicDependencyIndexes(f); + if (n) memcpy(public_deps, public_dep_nums, n * sizeof(int32_t)); + + n = upb_FileDef_WeakDependencyCount(f); + int32_t* weak_deps = + google_protobuf_FileDescriptorProto_resize_weak_dependency(proto, n, ctx->arena); + const int32_t* weak_dep_nums = _upb_FileDef_WeakDependencyIndexes(f); + if (n) memcpy(weak_deps, weak_dep_nums, n * sizeof(int32_t)); + + n = upb_FileDef_TopLevelMessageCount(f); + google_protobuf_DescriptorProto** msgs = + google_protobuf_FileDescriptorProto_resize_message_type(proto, n, ctx->arena); + for (size_t i = 0; i < n; i++) { + msgs[i] = msgdef_toproto(ctx, upb_FileDef_TopLevelMessage(f, i)); + } + + n = upb_FileDef_TopLevelEnumCount(f); + google_protobuf_EnumDescriptorProto** enums = + google_protobuf_FileDescriptorProto_resize_enum_type(proto, n, ctx->arena); + for (size_t i = 0; i < n; i++) { + enums[i] = enumdef_toproto(ctx, upb_FileDef_TopLevelEnum(f, i)); + } + + n = upb_FileDef_ServiceCount(f); + google_protobuf_ServiceDescriptorProto** services = + google_protobuf_FileDescriptorProto_resize_service(proto, n, ctx->arena); + for (size_t i = 0; i < n; i++) { + services[i] = servicedef_toproto(ctx, upb_FileDef_Service(f, i)); + } + + n = upb_FileDef_TopLevelExtensionCount(f); + google_protobuf_FieldDescriptorProto** exts = + google_protobuf_FileDescriptorProto_resize_extension(proto, n, ctx->arena); + for (size_t i = 0; i < n; i++) { + exts[i] = fielddef_toproto(ctx, upb_FileDef_TopLevelExtension(f, i)); + } + + if (upb_FileDef_HasOptions(f)) { + SET_OPTIONS(proto, FileDescriptorProto, FileOptions, + upb_FileDef_Options(f)); + } + + return proto; +} + +static google_protobuf_DescriptorProto* upb_ToProto_ConvertMessageDef( + upb_ToProto_Context* const ctx, const upb_MessageDef* const m) { + if (UPB_SETJMP(ctx->err)) return NULL; + return msgdef_toproto(ctx, m); +} + +google_protobuf_DescriptorProto* upb_MessageDef_ToProto(const upb_MessageDef* m, + upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertMessageDef(&ctx, m); +} + +google_protobuf_EnumDescriptorProto* upb_ToProto_ConvertEnumDef( + upb_ToProto_Context* const ctx, const upb_EnumDef* const e) { + if (UPB_SETJMP(ctx->err)) return NULL; + return enumdef_toproto(ctx, e); +} + +google_protobuf_EnumDescriptorProto* upb_EnumDef_ToProto(const upb_EnumDef* e, + upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertEnumDef(&ctx, e); +} + +google_protobuf_EnumValueDescriptorProto* upb_ToProto_ConvertEnumValueDef( + upb_ToProto_Context* const ctx, const upb_EnumValueDef* e) { + if (UPB_SETJMP(ctx->err)) return NULL; + return enumvaldef_toproto(ctx, e); +} + +google_protobuf_EnumValueDescriptorProto* upb_EnumValueDef_ToProto( + const upb_EnumValueDef* e, upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertEnumValueDef(&ctx, e); +} + +google_protobuf_FieldDescriptorProto* upb_ToProto_ConvertFieldDef( + upb_ToProto_Context* const ctx, const upb_FieldDef* f) { + if (UPB_SETJMP(ctx->err)) return NULL; + return fielddef_toproto(ctx, f); +} + +google_protobuf_FieldDescriptorProto* upb_FieldDef_ToProto(const upb_FieldDef* f, + upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertFieldDef(&ctx, f); +} + +google_protobuf_OneofDescriptorProto* upb_ToProto_ConvertOneofDef( + upb_ToProto_Context* const ctx, const upb_OneofDef* o) { + if (UPB_SETJMP(ctx->err)) return NULL; + return oneofdef_toproto(ctx, o); +} + +google_protobuf_OneofDescriptorProto* upb_OneofDef_ToProto(const upb_OneofDef* o, + upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertOneofDef(&ctx, o); +} + +google_protobuf_FileDescriptorProto* upb_ToProto_ConvertFileDef( + upb_ToProto_Context* const ctx, const upb_FileDef* const f) { + if (UPB_SETJMP(ctx->err)) return NULL; + return filedef_toproto(ctx, f); +} + +google_protobuf_FileDescriptorProto* upb_FileDef_ToProto(const upb_FileDef* f, + upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertFileDef(&ctx, f); +} + +google_protobuf_MethodDescriptorProto* upb_ToProto_ConvertMethodDef( + upb_ToProto_Context* const ctx, const upb_MethodDef* m) { + if (UPB_SETJMP(ctx->err)) return NULL; + return methoddef_toproto(ctx, m); +} + +google_protobuf_MethodDescriptorProto* upb_MethodDef_ToProto( + const upb_MethodDef* const m, upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertMethodDef(&ctx, m); +} + +google_protobuf_ServiceDescriptorProto* upb_ToProto_ConvertServiceDef( + upb_ToProto_Context* const ctx, const upb_ServiceDef* const s) { + if (UPB_SETJMP(ctx->err)) return NULL; + return servicedef_toproto(ctx, s); +} + +google_protobuf_ServiceDescriptorProto* upb_ServiceDef_ToProto(const upb_ServiceDef* s, + upb_Arena* a) { + upb_ToProto_Context ctx = {a}; + return upb_ToProto_ConvertServiceDef(&ctx, s); +} + // This should #undef all macros #defined in def.inc #undef UPB_SIZE #undef UPB_PTR_AT +#undef UPB_SIZEOF_FLEX #undef UPB_MAPTYPE_STRING #undef UPB_EXPORT #undef UPB_INLINE #undef UPB_API #undef UPBC_API #undef UPB_API_INLINE +#undef UPB_API_INLINE_IF_NOT_GCC #undef UPB_ALIGN_UP #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC @@ -16620,6 +17720,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN @@ -16630,6 +17731,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASSUME #undef UPB_ASSERT #undef UPB_UNREACHABLE +#undef UPB_DEFAULT_MAX_BLOCK_SIZE #undef UPB_SETJMP #undef UPB_LONGJMP #undef UPB_PTRADD @@ -16643,6 +17745,12 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASAN #undef UPB_ASAN_GUARD_SIZE #undef UPB_CLANG_ASAN +#undef UPB_TSAN_PUBLISHED_MEMBER +#undef UPB_TSAN_INIT_PUBLISHED +#undef UPB_TSAN_CHECK_PUBLISHED +#undef UPB_TSAN_PUBLISH +#undef UPB_TSAN_CHECK_READ +#undef UPB_TSAN_CHECK_WRITE #undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN #undef UPB_DEPRECATED #undef UPB_GNUC_MIN @@ -16652,6 +17760,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_IS_GOOGLE3 #undef UPB_ATOMIC #undef UPB_USE_C11_ATOMICS +#undef UPB_USE_MSC_ATOMICS #undef UPB_PRIVATE #undef UPB_ONLYBITS #undef UPB_LINKARR_DECLARE @@ -16659,4 +17768,3 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_LINKARR_START #undef UPB_LINKARR_STOP #undef UPB_FUTURE_BREAKING_CHANGES -#undef UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT diff --git a/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.h b/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.h index 3b6866adca055..25b5e67d9a3b6 100755 --- a/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/third_party/protobuf/ruby/ext/google/protobuf_c/ruby-upb.h @@ -25,9 +25,9 @@ */ #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(__cplusplus) && __cplusplus >= 201703L) || \ (defined(_MSC_VER) && _MSC_VER >= 1900)) -#error upb requires C99 or C++14 or MSVC >= 2015. +#error upb requires C99 or C++17 or MSVC >= 2015. #endif // Portable check for GCC minimum version: @@ -59,7 +59,14 @@ Error, UINTPTR_MAX is undefined /* If we always read/write as a consistent type to each address, this shouldn't * violate aliasing. */ -#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) +#define UPB_PTR_AT(msg, ofs, type) ((type *)((char *)(msg) + (ofs))) + +// A flexible array member may have lower alignment requirements than the struct +// overall - in that case, it can overlap with the trailing padding of the rest +// of the struct, and a naive sizeof(base) + sizeof(flex) * count calculation +// will not take into account that overlap, and allocate more than is required. +#define UPB_SIZEOF_FLEX(type, member, count) \ + UPB_MAX(sizeof(type), offsetof(type, member[count])) #define UPB_MAPTYPE_STRING 0 @@ -73,12 +80,19 @@ Error, UINTPTR_MAX is undefined // UPB_INLINE: inline if possible, emit standalone code if required. #ifdef __cplusplus #define UPB_INLINE inline -#elif defined (__GNUC__) || defined(__clang__) +#elif defined(__GNUC__) || defined(__clang__) #define UPB_INLINE static __inline__ #else #define UPB_INLINE static #endif +// UPB_INLINE_IF_NOT_GCC: because gcc can be very noisy at times. +#if defined(__GNUC__) && !defined(__clang__) +#define UPB_INLINE_IF_NOT_GCC static +#else +#define UPB_INLINE_IF_NOT_GCC UPB_INLINE +#endif + #ifdef UPB_BUILD_API #define UPB_API UPB_EXPORT #define UPB_API_INLINE UPB_EXPORT @@ -100,7 +114,13 @@ Error, UINTPTR_MAX is undefined #ifdef __clang__ #define UPB_ALIGN_OF(type) _Alignof(type) #else -#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) +#define UPB_ALIGN_OF(type) \ + offsetof( \ + struct { \ + char c; \ + type member; \ + }, \ + member) #endif #ifdef _MSC_VER @@ -111,7 +131,7 @@ Error, UINTPTR_MAX is undefined #endif // Hints to the compiler about likely/unlikely branches. -#if defined (__GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) #else @@ -119,18 +139,30 @@ Error, UINTPTR_MAX is undefined #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static #define UPB_NOINLINE __attribute__((noinline)) #define UPB_NORETURN __attribute__((__noreturn__)) -#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) +#define UPB_PRINTF(str, first_vararg) \ + __attribute__((format(printf, str, first_vararg))) #elif defined(_MSC_VER) #define UPB_NOINLINE #define UPB_FORCEINLINE static #define UPB_NORETURN __declspec(noreturn) #define UPB_PRINTF(str, first_vararg) -#else /* !defined(__GNUC__) */ +#else /* !defined(__GNUC__) */ #define UPB_FORCEINLINE static #define UPB_NOINLINE #define UPB_NORETURN @@ -145,11 +177,15 @@ Error, UINTPTR_MAX is undefined // UPB_ASSUME(): in release mode, we tell the compiler to assume this is true. #ifdef NDEBUG #ifdef __GNUC__ -#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() +#define UPB_ASSUME(expr) \ + if (!(expr)) __builtin_unreachable() #elif defined _MSC_VER -#define UPB_ASSUME(expr) if (!(expr)) __assume(0) +#define UPB_ASSUME(expr) \ + if (!(expr)) __assume(0) #else -#define UPB_ASSUME(expr) do {} while (false && (expr)) +#define UPB_ASSUME(expr) \ + do { \ + } while (false && (expr)) #endif #else #define UPB_ASSUME(expr) assert(expr) @@ -158,13 +194,19 @@ Error, UINTPTR_MAX is undefined /* UPB_ASSERT(): in release mode, we use the expression without letting it be * evaluated. This prevents "unused variable" warnings. */ #ifdef NDEBUG -#define UPB_ASSERT(expr) do {} while (false && (expr)) +#define UPB_ASSERT(expr) \ + do { \ + } while (false && (expr)) #else #define UPB_ASSERT(expr) assert(expr) #endif #if defined(__GNUC__) || defined(__clang__) -#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __builtin_unreachable(); \ + } while (0) #elif defined(_MSC_VER) #define UPB_UNREACHABLE() \ do { \ @@ -172,13 +214,26 @@ Error, UINTPTR_MAX is undefined __assume(0); \ } while (0) #else -#define UPB_UNREACHABLE() do { assert(0); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + } while (0) #endif -/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ -#ifdef __APPLE__ -#define UPB_SETJMP(buf) _setjmp(buf) -#define UPB_LONGJMP(buf, val) _longjmp(buf, val) +#ifdef __ANDROID__ +#define UPB_DEFAULT_MAX_BLOCK_SIZE 8192 +#else +#define UPB_DEFAULT_MAX_BLOCK_SIZE 32768 +#endif + +/* UPB_SETJMP() / UPB_LONGJMP() */ +// Android uses a custom libc that does not implement all of posix, but it has +// had sigsetjmp/siglongjmp forever on arm and since API 12 on x86. Apple has +// sigsetjmp, but does not define the posix feature test macro. +#if defined(__APPLE__) || defined(_POSIX_C_SOURCE) || defined(__ANDROID__) +// avoid setting/restoring signal mask, which involves costly syscalls +#define UPB_SETJMP(buf) sigsetjmp(buf, 0) +#define UPB_LONGJMP(buf, val) siglongjmp(buf, val) #elif defined(WASM_WAMR) #define UPB_SETJMP(buf) 0 #define UPB_LONGJMP(buf, val) abort() @@ -187,9 +242,23 @@ Error, UINTPTR_MAX is undefined #define UPB_LONGJMP(buf, val) longjmp(buf, val) #endif -#ifdef __GNUC__ +#if ((__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)) #define UPB_USE_C11_ATOMICS +#elif defined(__has_extension) +#if __has_extension(c_atomic) +#define UPB_USE_C11_ATOMICS +#endif +#elif defined(__GNUC__) +// GCC supported atomics as an extension before it supported __has_extension +#define UPB_USE_C11_ATOMICS +#elif defined(_MSC_VER) +#define UPB_USE_MSC_ATOMICS +#endif + +#if defined(UPB_USE_C11_ATOMICS) #define UPB_ATOMIC(T) _Atomic(T) +#elif defined(UPB_USE_MSC_ATOMICS) +#define UPB_ATOMIC(T) volatile T #else #define UPB_ATOMIC(T) T #endif @@ -277,7 +346,7 @@ Error, UINTPTR_MAX is undefined */ /* Due to preprocessor limitations, the conditional logic for setting - * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner. + * UPB_CLANG_ASAN below cannot be consolidated into a portable one-liner. * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html. */ #if defined(__has_feature) @@ -286,8 +355,14 @@ Error, UINTPTR_MAX is undefined #else #define UPB_CLANG_ASAN 0 #endif +#if __has_feature(thread_sanitizer) +#define UPB_CLANG_TSAN 1 +#else +#define UPB_CLANG_TSAN 0 +#endif #else #define UPB_CLANG_ASAN 0 +#define UPB_CLANG_TSAN 0 #endif #if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN @@ -296,10 +371,10 @@ Error, UINTPTR_MAX is undefined #ifdef __cplusplus extern "C" { #endif -void __asan_poison_memory_region(void const volatile *addr, size_t size); -void __asan_unpoison_memory_region(void const volatile *addr, size_t size); + void __asan_poison_memory_region(void const volatile *addr, size_t size); + void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #ifdef __cplusplus -} /* extern "C" */ +} /* extern "C" */ #endif #define UPB_POISON_MEMORY_REGION(addr, size) \ __asan_poison_memory_region((addr), (size)) @@ -308,10 +383,38 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #else #define UPB_ASAN 0 #define UPB_ASAN_GUARD_SIZE 0 -#define UPB_POISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) -#define UPB_UNPOISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) +#define UPB_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#define UPB_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#endif + +#if defined(__SANITIZE_THREAD__) || UPB_CLANG_TSAN +#define UPB_TSAN_PUBLISHED_MEMBER uintptr_t upb_tsan_safely_published; +#define UPB_TSAN_INIT_PUBLISHED(ptr) (ptr)->upb_tsan_safely_published = 0x5AFE +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + UPB_ASSERT((ptr)->upb_tsan_safely_published == 0x5AFE) +#define UPB_TSAN_PUBLISH 1 +#define UPB_TSAN_CHECK_READ(member) \ + __asm__ volatile("" ::"r"(*(char *)&(member))) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + char *write_upb_tsan_detect_race_ptr = (char *)&(member); \ + char write_upb_tsan_detect_race = *write_upb_tsan_detect_race_ptr; \ + __asm__ volatile("" : "+r"(write_upb_tsan_detect_race)); \ + *write_upb_tsan_detect_race_ptr = write_upb_tsan_detect_race; \ + } while (false) +#else +#define UPB_TSAN_PUBLISHED_MEMBER +#define UPB_TSAN_INIT_PUBLISHED(ptr) +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + do { \ + } while (false && (ptr)) +#define UPB_TSAN_PUBLISH 0 +#define UPB_TSAN_CHECK_READ(member) \ + do { \ + } while (false && (member)) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + } while (false && (member)) #endif /* Disable proto2 arena behavior (TEMPORARY) **********************************/ @@ -377,8 +480,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #if defined(__ELF__) || defined(__wasm__) -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("linkarr_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("linkarr_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name; \ extern type const __stop_linkarr_##name; \ @@ -389,8 +493,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #elif defined(__MACH__) /* As described in: https://stackoverflow.com/a/22366882 */ -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("__DATA,__la_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("__DATA,__la_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name __asm( \ "section$start$__DATA$__la_" #name); \ @@ -410,8 +515,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // Usage of __attribute__ here probably means this is Clang-specific, and would // not work on MSVC. -#define UPB_LINKARR_APPEND(name) \ - __declspec(allocate("la_" #name "$j")) __attribute__((retain, used)) +#define UPB_LINKARR_APPEND(name) \ + __declspec(allocate("la_" #name "$j")) \ + __attribute__((retain, used, no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ __declspec(allocate("la_" #name "$a")) type __start_linkarr_##name; \ __declspec(allocate("la_" #name "$z")) type __stop_linkarr_##name; \ @@ -432,10 +538,6 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // user code can be updated before upgrading versions of protobuf. #ifdef UPB_FUTURE_BREAKING_CHANGES -// Properly enforce closed enums in python. -// Owner: mkruskal@ -#define UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT 1 - #endif #ifndef UPB_BASE_STATUS_H_ @@ -488,7 +590,8 @@ void upb_Status_VAppendErrorFormat(upb_Status* status, const char* fmt, * to be freed. However the Arena does allow users to register cleanup * functions that will run when the arena is destroyed. * - * A upb_Arena is *not* thread-safe. + * A upb_Arena is *not* thread-safe, although some functions related to its + * managing its lifetime are, and are documented as such. * * You could write a thread-safe arena allocator that satisfies the * upb_alloc interface, but it would not be as efficient for the @@ -545,6 +648,11 @@ UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { alloc->func(alloc, ptr, 0, 0); } +UPB_INLINE void upb_free_sized(upb_alloc* alloc, void* ptr, size_t size) { + UPB_ASSERT(alloc); + alloc->func(alloc, ptr, size, 0); +} + // The global allocator used by upb. Uses the standard malloc()/free(). extern upb_alloc upb_alloc_global; @@ -585,7 +693,7 @@ UPB_INLINE void upb_gfree(void* ptr) { upb_free(&upb_alloc_global, ptr); } // // We need this because the decoder inlines a upb_Arena for performance but // the full struct is not visible outside of arena.c. Yes, I know, it's awful. -#define UPB_ARENA_SIZE_HACK 7 +#define UPB_ARENA_SIZE_HACK (9 + UPB_TSAN_PUBLISH) // LINT.IfChange(upb_Arena) @@ -605,16 +713,12 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(struct upb_Arena* des, void UPB_PRIVATE(_upb_Arena_SwapOut)(struct upb_Arena* des, const struct upb_Arena* src); -// Returns whether |ptr| was allocated directly by |a| (so care must be used -// with fused arenas). -UPB_API bool UPB_ONLYBITS(_upb_Arena_Contains)(const struct upb_Arena* a, - void* ptr); - UPB_INLINE size_t UPB_PRIVATE(_upb_ArenaHas)(const struct upb_Arena* a) { return (size_t)(a->UPB_ONLYBITS(end) - a->UPB_ONLYBITS(ptr)); } UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(struct upb_Arena * a, size_t size); size = UPB_ALIGN_MALLOC(size); @@ -636,6 +740,7 @@ UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) { UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr, size_t oldsize, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); oldsize = UPB_ALIGN_MALLOC(oldsize); size = UPB_ALIGN_MALLOC(size); bool is_most_recent_alloc = @@ -662,6 +767,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr, UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr, size_t oldsize, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); oldsize = UPB_ALIGN_MALLOC(oldsize); size = UPB_ALIGN_MALLOC(size); // Must be the last alloc. @@ -682,33 +788,67 @@ UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr, typedef struct upb_Arena upb_Arena; +typedef void upb_AllocCleanupFunc(upb_alloc* alloc); + #ifdef __cplusplus extern "C" { #endif -// Creates an arena from the given initial block (if any -- n may be 0). -// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this -// is a fixed-size arena and cannot grow. +// Creates an arena from the given initial block (if any -- mem may be NULL). If +// an initial block is specified, the arena's lifetime cannot be extended by +// |upb_Arena_IncRefFor| or |upb_Arena_Fuse|. Additional blocks will be +// allocated from |alloc|. If |alloc| is NULL, this is a fixed-size arena and +// cannot grow. If an initial block is specified, |n| is its length; if there is +// no initial block, |n| is a hint of the size that should be allocated for the +// first block of the arena, such that `upb_Arena_Malloc(hint)` will not require +// another call to |alloc|. UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc); UPB_API void upb_Arena_Free(upb_Arena* a); -UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); +// Sets the cleanup function for the upb_alloc used by the arena. Only one +// cleanup function can be set, which will be called after all blocks are +// freed. +UPB_API void upb_Arena_SetAllocCleanup(upb_Arena* a, + upb_AllocCleanupFunc* func); -bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner); -void upb_Arena_DecRefFor(upb_Arena* a, const void* owner); +// Fuses the lifetime of two arenas, such that no arenas that have been +// transitively fused together will be freed until all of them have reached a +// zero refcount. This operation is safe to use concurrently from multiple +// threads. +UPB_API bool upb_Arena_Fuse(const upb_Arena* a, const upb_Arena* b); -size_t upb_Arena_SpaceAllocated(upb_Arena* a, size_t* fused_count); -uint32_t upb_Arena_DebugRefCount(upb_Arena* a); +// This operation is safe to use concurrently from multiple threads. +UPB_API bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b); + +// Returns the upb_alloc used by the arena. +UPB_API upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a); + +// This operation is safe to use concurrently from multiple threads. +bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner); +// This operation is safe to use concurrently from multiple threads. +void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner); + +// This operation is safe to use concurrently from multiple threads. +uintptr_t upb_Arena_SpaceAllocated(const upb_Arena* a, size_t* fused_count); +// This operation is safe to use concurrently from multiple threads. +uint32_t upb_Arena_DebugRefCount(const upb_Arena* a); UPB_API_INLINE upb_Arena* upb_Arena_New(void) { return upb_Arena_Init(NULL, 0, &upb_alloc_global); } +UPB_API_INLINE upb_Arena* upb_Arena_NewSized(size_t size_hint) { + return upb_Arena_Init(NULL, size_hint, &upb_alloc_global); +} + UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size); UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, size_t size); +static const size_t UPB_PRIVATE(kUpbDefaultMaxBlockSize) = + UPB_DEFAULT_MAX_BLOCK_SIZE; + // Sets the maximum block size for all arenas. This is a global configuration // setting that will affect all existing and future arenas. If // upb_Arena_Malloc() is called with a size larger than this, we will exceed @@ -716,6 +856,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, // // This API is meant for experimentation only. It will likely be removed in // the future. +// This operation is safe to use concurrently from multiple threads. void upb_Arena_SetMaxBlockSize(size_t max); // Shrinks the last alloc from arena. @@ -754,18 +895,13 @@ extern "C" { // this invariant. #define kUpb_EpsCopyInputStream_SlopBytes 16 -enum { - kUpb_EpsCopyInputStream_NoAliasing = 0, - kUpb_EpsCopyInputStream_OnPatch = 1, - kUpb_EpsCopyInputStream_NoDelta = 2 -}; - typedef struct { const char* end; // Can read up to SlopBytes bytes beyond this. const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) - uintptr_t aliasing; + uintptr_t input_delta; // Diff between the original input pointer and patch int limit; // Submessage limit relative to end bool error; // To distinguish between EOF and error. + bool aliasing; char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; } upb_EpsCopyInputStream; @@ -791,17 +927,16 @@ UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, if (size <= kUpb_EpsCopyInputStream_SlopBytes) { memset(&e->patch, 0, 32); if (size) memcpy(&e->patch, *ptr, size); - e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch - : kUpb_EpsCopyInputStream_NoAliasing; + e->input_delta = (uintptr_t)*ptr - (uintptr_t)e->patch; *ptr = e->patch; e->end = *ptr + size; e->limit = 0; } else { e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; e->limit = kUpb_EpsCopyInputStream_SlopBytes; - e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta - : kUpb_EpsCopyInputStream_NoAliasing; + e->input_delta = 0; } + e->aliasing = enable_aliasing; e->limit_ptr = e->end; e->error = false; } @@ -944,7 +1079,7 @@ UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( // upb_EpsCopyInputStream_Init() when this stream was initialized. UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( upb_EpsCopyInputStream* e) { - return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; + return e->aliasing; } // Returns true if aliasing_enabled=true was passed to @@ -954,8 +1089,16 @@ UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( upb_EpsCopyInputStream* e, const char* ptr, size_t size) { // When EpsCopyInputStream supports streaming, this will need to become a // runtime check. - return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && - e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; + return e->aliasing && + upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size); +} + +// Returns a pointer into an input buffer that corresponds to the parsing +// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may +// be different if we are currently parsing out of the patch buffer. +UPB_INLINE const char* upb_EpsCopyInputStream_GetInputPtr( + upb_EpsCopyInputStream* e, const char* ptr) { + return (const char*)(((uintptr_t)ptr) + e->input_delta); } // Returns a pointer into an input buffer that corresponds to the parsing @@ -967,9 +1110,7 @@ UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( upb_EpsCopyInputStream* e, const char* ptr) { UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); - uintptr_t delta = - e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; - return (const char*)((uintptr_t)ptr + delta); + return upb_EpsCopyInputStream_GetInputPtr(e, ptr); } // Reads string data from the input, aliasing into the input buffer instead of @@ -1083,9 +1224,7 @@ UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( e->limit -= kUpb_EpsCopyInputStream_SlopBytes; e->limit_ptr = e->end + e->limit; UPB_ASSERT(ptr < e->limit_ptr); - if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { - e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; - } + e->input_delta = (uintptr_t)old_end - (uintptr_t)new_start; return callback(e, old_end, new_start); } else { UPB_ASSERT(overrun > e->limit); @@ -1144,36 +1283,7 @@ UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( #define UPB_MESSAGE_MESSAGE_H_ #include <stddef.h> - - -/* -** Our memory representation for parsing tables and messages themselves. -** Functions in this file are used by generated code and possibly reflection. -** -** The definitions in this file are internal to upb. -**/ - -#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_ -#define UPB_MESSAGE_INTERNAL_MESSAGE_H_ - -#include <stdlib.h> -#include <string.h> - - -#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ -#define UPB_MESSAGE_INTERNAL_EXTENSION_H_ - -#include <stddef.h> - - -// Users should include array.h or map.h instead. -// IWYU pragma: private, include "upb/message/array.h" - -#ifndef UPB_MESSAGE_VALUE_H_ -#define UPB_MESSAGE_VALUE_H_ - #include <stdint.h> -#include <string.h> #ifndef UPB_BASE_STRING_VIEW_H_ #define UPB_BASE_STRING_VIEW_H_ @@ -1214,6 +1324,16 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { return (a.size == b.size) && (!a.size || !memcmp(a.data, b.data, a.size)); } +// Compares StringViews following strcmp rules. +// Please note this comparison is neither unicode nor locale aware. +UPB_INLINE int upb_StringView_Compare(upb_StringView a, upb_StringView b) { + int result = memcmp(a.data, b.data, UPB_MIN(a.size, b.size)); + if (result == 0) { + return a.size - b.size; + } + return result; +} + // LINT.ThenChange( // GoogleInternalName1, // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string, @@ -1227,61 +1347,10 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { #endif /* UPB_BASE_STRING_VIEW_H_ */ -// Must be last. +#ifndef UPB_MESSAGE_ARRAY_H_ +#define UPB_MESSAGE_ARRAY_H_ -#ifdef __cplusplus -extern "C" { -#endif - -typedef union { - bool bool_val; - float float_val; - double double_val; - int32_t int32_val; - int64_t int64_val; - uint32_t uint32_val; - uint64_t uint64_val; - const struct upb_Array* array_val; - const struct upb_Map* map_val; - const struct upb_Message* msg_val; - upb_StringView str_val; - - // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of - // msg_val if unlinked sub-messages may possibly be in use. See the - // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more - // information. - uintptr_t tagged_msg_val; // upb_TaggedMessagePtr -} upb_MessageValue; - -UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) { - upb_MessageValue zero; - memset(&zero, 0, sizeof(zero)); - return zero; -} - -typedef union { - struct upb_Array* array; - struct upb_Map* map; - struct upb_Message* msg; -} upb_MutableMessageValue; - -UPB_API_INLINE upb_MutableMessageValue upb_MutableMessageValue_Zero(void) { - upb_MutableMessageValue zero; - memset(&zero, 0, sizeof(zero)); - return zero; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_VALUE_H_ */ - -#ifndef UPB_MINI_TABLE_EXTENSION_H_ -#define UPB_MINI_TABLE_EXTENSION_H_ - -#include <stdint.h> +#include <stddef.h> #ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_ @@ -1387,10 +1456,264 @@ UPB_INLINE bool upb_FieldType_IsPackable(upb_FieldType field_type) { #endif /* UPB_BASE_DESCRIPTOR_CONSTANTS_H_ */ -#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ -#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ +#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_ +#define UPB_MESSAGE_INTERNAL_ARRAY_H_ + +#include <stdint.h> +#include <string.h> + + +// Must be last. + +#define _UPB_ARRAY_MASK_IMM 0x4 // Frozen/immutable bit. +#define _UPB_ARRAY_MASK_LG2 0x3 // Encoded elem size. +#define _UPB_ARRAY_MASK_ALL (_UPB_ARRAY_MASK_IMM | _UPB_ARRAY_MASK_LG2) + +#ifdef __cplusplus +extern "C" { +#endif + +// LINT.IfChange(upb_Array) + +// Our internal representation for repeated fields. +struct upb_Array { + // This is a tagged pointer. Bits #0 and #1 encode the elem size as follows: + // 0 maps to elem size 1 + // 1 maps to elem size 4 + // 2 maps to elem size 8 + // 3 maps to elem size 16 + // + // Bit #2 contains the frozen/immutable flag. + uintptr_t UPB_ONLYBITS(data); + + size_t UPB_ONLYBITS(size); // The number of elements in the array. + size_t UPB_PRIVATE(capacity); // Allocated storage. Measured in elements. +}; + +UPB_INLINE void UPB_PRIVATE(_upb_Array_ShallowFreeze)(struct upb_Array* arr) { + arr->UPB_ONLYBITS(data) |= _UPB_ARRAY_MASK_IMM; +} + +UPB_API_INLINE bool upb_Array_IsFrozen(const struct upb_Array* arr) { + return (arr->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_IMM) != 0; +} + +UPB_INLINE void UPB_PRIVATE(_upb_Array_SetTaggedPtr)(struct upb_Array* array, + void* data, size_t lg2) { + UPB_ASSERT(lg2 != 1); + UPB_ASSERT(lg2 <= 4); + const size_t bits = lg2 - (lg2 != 0); + array->UPB_ONLYBITS(data) = (uintptr_t)data | bits; +} + +UPB_INLINE size_t +UPB_PRIVATE(_upb_Array_ElemSizeLg2)(const struct upb_Array* array) { + const size_t bits = array->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_LG2; + const size_t lg2 = bits + (bits != 0); + return lg2; +} + +UPB_API_INLINE const void* upb_Array_DataPtr(const struct upb_Array* array) { + UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array); // Check assertions. + return (void*)(array->UPB_ONLYBITS(data) & ~(uintptr_t)_UPB_ARRAY_MASK_ALL); +} + +UPB_API_INLINE void* upb_Array_MutableDataPtr(struct upb_Array* array) { + return (void*)upb_Array_DataPtr(array); +} + +UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena, + size_t init_capacity, + int elem_size_lg2) { + UPB_ASSERT(elem_size_lg2 != 1); + UPB_ASSERT(elem_size_lg2 <= 4); + const size_t array_size = + UPB_ALIGN_UP(sizeof(struct upb_Array), UPB_MALLOC_ALIGN); + const size_t bytes = array_size + (init_capacity << elem_size_lg2); + struct upb_Array* array = (struct upb_Array*)upb_Arena_Malloc(arena, bytes); + if (!array) return NULL; + UPB_PRIVATE(_upb_Array_SetTaggedPtr) + (array, UPB_PTR_AT(array, array_size, void), elem_size_lg2); + array->UPB_ONLYBITS(size) = 0; + array->UPB_PRIVATE(capacity) = init_capacity; + return array; +} + +// Resizes the capacity of the array to be at least min_size. +bool UPB_PRIVATE(_upb_Array_Realloc)(struct upb_Array* array, size_t min_size, + upb_Arena* arena); + +UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size, + upb_Arena* arena) { + UPB_ASSERT(!upb_Array_IsFrozen(array)); + if (array->UPB_PRIVATE(capacity) < size) + return UPB_PRIVATE(_upb_Array_Realloc)(array, size, arena); + return true; +} + +// Resize without initializing new elements. +UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)( + struct upb_Array* array, size_t size, upb_Arena* arena) { + UPB_ASSERT(!upb_Array_IsFrozen(array)); + UPB_ASSERT(size <= array->UPB_ONLYBITS(size) || + arena); // Allow NULL arena when shrinking. + if (!upb_Array_Reserve(array, size, arena)) return false; + array->UPB_ONLYBITS(size) = size; + return true; +} + +// This function is intended for situations where elem_size is compile-time +// constant or a known expression of the form (1 << lg2), so that the expression +// i*elem_size does not result in an actual multiplication. +UPB_INLINE void UPB_PRIVATE(_upb_Array_Set)(struct upb_Array* array, size_t i, + const void* data, + size_t elem_size) { + UPB_ASSERT(!upb_Array_IsFrozen(array)); + UPB_ASSERT(i < array->UPB_ONLYBITS(size)); + UPB_ASSERT(elem_size == 1U << UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array)); + char* arr_data = (char*)upb_Array_MutableDataPtr(array); + memcpy(arr_data + (i * elem_size), data, elem_size); +} + +UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) { + return arr->UPB_ONLYBITS(size); +} + +// LINT.ThenChange(GoogleInternalName0) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#undef _UPB_ARRAY_MASK_IMM +#undef _UPB_ARRAY_MASK_LG2 +#undef _UPB_ARRAY_MASK_ALL + + +#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */ + +// Users should include array.h or map.h instead. +// IWYU pragma: private, include "upb/message/array.h" + +#ifndef UPB_MESSAGE_VALUE_H_ +#define UPB_MESSAGE_VALUE_H_ + +#include <stdint.h> +#include <string.h> + + +#ifndef UPB_MESSAGE_INTERNAL_TYPES_H_ +#define UPB_MESSAGE_INTERNAL_TYPES_H_ + +#include <stdint.h> + +// Must be last. + +#define UPB_OPAQUE(x) x##_opaque + +struct upb_Message { + union { + uintptr_t UPB_OPAQUE(internal); // tagged pointer, low bit == frozen + double d; // Forces same size for 32-bit/64-bit builds + }; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_INLINE void UPB_PRIVATE(_upb_Message_ShallowFreeze)( + struct upb_Message* msg) { + msg->UPB_OPAQUE(internal) |= 1ULL; +} + +UPB_API_INLINE bool upb_Message_IsFrozen(const struct upb_Message* msg) { + return (msg->UPB_OPAQUE(internal) & 1ULL) != 0; +} + +UPB_INLINE struct upb_Message_Internal* UPB_PRIVATE(_upb_Message_GetInternal)( + const struct upb_Message* msg) { + const uintptr_t tmp = msg->UPB_OPAQUE(internal) & ~1ULL; + return (struct upb_Message_Internal*)tmp; +} + +UPB_INLINE void UPB_PRIVATE(_upb_Message_SetInternal)( + struct upb_Message* msg, struct upb_Message_Internal* internal) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + msg->UPB_OPAQUE(internal) = (uintptr_t)internal; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#undef UPB_OPAQUE + + +#endif /* UPB_MESSAGE_INTERNAL_TYPES_H_ */ + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +typedef union { + bool bool_val; + float float_val; + double double_val; + int32_t int32_val; + int64_t int64_val; + uint32_t uint32_val; + uint64_t uint64_val; + const struct upb_Array* array_val; + const struct upb_Map* map_val; + const struct upb_Message* msg_val; + upb_StringView str_val; + + // EXPERIMENTAL: A tagged upb_Message*. Users must use this instead of + // msg_val if unlinked sub-messages may possibly be in use. See the + // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more + // information. + uintptr_t tagged_msg_val; // upb_TaggedMessagePtr + + // For an extension field, we are essentially treating ext->data (a + // upb_MessageValue) as if it were a message with one field that lives at + // offset 0. This works because upb_MessageValue is precisely one value that + // can hold any type of data. Recall that an extension can be of any type + // (scalar, repeated, or message). For a message extension, that will be a + // single upb_Message* at offset 0 of the upb_MessageValue. + struct upb_Message UPB_PRIVATE(ext_msg_val); +} upb_MessageValue; + +UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) { + upb_MessageValue zero; + memset(&zero, 0, sizeof(zero)); + return zero; +} + +typedef union { + struct upb_Array* array; + struct upb_Map* map; + struct upb_Message* msg; +} upb_MutableMessageValue; + +UPB_API_INLINE upb_MutableMessageValue upb_MutableMessageValue_Zero(void) { + upb_MutableMessageValue zero; + memset(&zero, 0, sizeof(zero)); + return zero; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_VALUE_H_ */ + +#ifndef UPB_MINI_TABLE_FIELD_H_ +#define UPB_MINI_TABLE_FIELD_H_ -#include <stddef.h> #include <stdint.h> @@ -1674,104 +1997,47 @@ UPB_INLINE size_t UPB_PRIVATE(_upb_MiniTableField_ElemSizeLg2)( #endif /* UPB_MINI_TABLE_INTERNAL_FIELD_H_ */ -#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ -#define UPB_MINI_TABLE_INTERNAL_SUB_H_ - // Must be last. -typedef union { - const struct upb_MiniTable* const* UPB_PRIVATE(submsg); - const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); -} upb_MiniTableSubInternal; - -union upb_MiniTableSub { - const struct upb_MiniTable* UPB_PRIVATE(submsg); - const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); -}; +typedef struct upb_MiniTableField upb_MiniTableField; #ifdef __cplusplus extern "C" { #endif -UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromEnum( - const struct upb_MiniTableEnum* subenum) { - union upb_MiniTableSub out; - out.UPB_PRIVATE(subenum) = subenum; - return out; -} +UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f); -UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromMessage( - const struct upb_MiniTable* submsg) { - union upb_MiniTableSub out; - out.UPB_PRIVATE(submsg) = submsg; - return out; -} +UPB_API_INLINE bool upb_MiniTableField_HasPresence(const upb_MiniTableField* f); -UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableSub_Enum( - const union upb_MiniTableSub sub) { - return sub.UPB_PRIVATE(subenum); -} +UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f); -UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableSub_Message( - const union upb_MiniTableSub sub) { - return sub.UPB_PRIVATE(submsg); -} +UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( + const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsExtension(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f); + +UPB_API_INLINE bool upb_MiniTableField_IsSubMessage( + const upb_MiniTableField* f); + +UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f); + +UPB_API_INLINE upb_FieldType +upb_MiniTableField_Type(const upb_MiniTableField* f); #ifdef __cplusplus } /* extern "C" */ #endif -#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ - -// Must be last. - -struct upb_MiniTableExtension { - // Do not move this field. We need to be able to alias pointers. - struct upb_MiniTableField UPB_PRIVATE(field); - - const struct upb_MiniTable* UPB_PRIVATE(extendee); - union upb_MiniTableSub UPB_PRIVATE(sub); // NULL unless submsg or proto2 enum -}; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_API_INLINE upb_CType -upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) { - return upb_MiniTableField_CType(&e->UPB_PRIVATE(field)); -} - -UPB_API_INLINE uint32_t -upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) { - return e->UPB_PRIVATE(field).UPB_ONLYBITS(number); -} - -UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage( - const struct upb_MiniTableExtension* e) { - if (upb_MiniTableExtension_CType(e) != kUpb_CType_Message) { - return NULL; - } - return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub)); -} - -UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( - struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) { - e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m; -} - -UPB_INLINE upb_FieldRep UPB_PRIVATE(_upb_MiniTableExtension_GetRep)( - const struct upb_MiniTableExtension* e) { - return UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)); -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ +#endif /* UPB_MINI_TABLE_FIELD_H_ */ #ifndef UPB_MINI_TABLE_MESSAGE_H_ #define UPB_MINI_TABLE_MESSAGE_H_ @@ -1851,54 +2117,6 @@ UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e, #endif /* UPB_MINI_TABLE_ENUM_H_ */ -#ifndef UPB_MINI_TABLE_FIELD_H_ -#define UPB_MINI_TABLE_FIELD_H_ - -#include <stdint.h> - - -// Must be last. - -typedef struct upb_MiniTableField upb_MiniTableField; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_API_INLINE upb_CType upb_MiniTableField_CType(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_HasPresence(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsArray(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( - const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsExtension(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsInOneof(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsMap(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsPacked(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsScalar(const upb_MiniTableField* f); - -UPB_API_INLINE bool upb_MiniTableField_IsSubMessage( - const upb_MiniTableField* f); - -UPB_API_INLINE uint32_t upb_MiniTableField_Number(const upb_MiniTableField* f); - -UPB_API_INLINE upb_FieldType -upb_MiniTableField_Type(const upb_MiniTableField* f); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MINI_TABLE_FIELD_H_ */ - #ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ #define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_ @@ -1906,6 +2124,56 @@ upb_MiniTableField_Type(const upb_MiniTableField* f); #include <stdint.h> +#ifndef UPB_MINI_TABLE_INTERNAL_SUB_H_ +#define UPB_MINI_TABLE_INTERNAL_SUB_H_ + +// Must be last. + +typedef union { + const struct upb_MiniTable* const* UPB_PRIVATE(submsg); + const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); +} upb_MiniTableSubInternal; + +union upb_MiniTableSub { + const struct upb_MiniTable* UPB_PRIVATE(submsg); + const struct upb_MiniTableEnum* UPB_PRIVATE(subenum); +}; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromEnum( + const struct upb_MiniTableEnum* subenum) { + union upb_MiniTableSub out; + out.UPB_PRIVATE(subenum) = subenum; + return out; +} + +UPB_API_INLINE union upb_MiniTableSub upb_MiniTableSub_FromMessage( + const struct upb_MiniTable* submsg) { + union upb_MiniTableSub out; + out.UPB_PRIVATE(submsg) = submsg; + return out; +} + +UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTableSub_Enum( + const union upb_MiniTableSub sub) { + return sub.UPB_PRIVATE(subenum); +} + +UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableSub_Message( + const union upb_MiniTableSub sub) { + return sub.UPB_PRIVATE(submsg); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MINI_TABLE_INTERNAL_SUB_H_ */ + // Must be last. struct upb_Decoder; @@ -2173,458 +2441,6 @@ bool upb_MiniTable_NextOneofField(const upb_MiniTable* m, // Must be last. -typedef struct upb_MiniTableExtension upb_MiniTableExtension; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_API_INLINE upb_CType -upb_MiniTableExtension_CType(const upb_MiniTableExtension* e); - -UPB_API_INLINE uint32_t -upb_MiniTableExtension_Number(const upb_MiniTableExtension* e); - -UPB_API_INLINE const upb_MiniTable* upb_MiniTableExtension_GetSubMessage( - const upb_MiniTableExtension* e); - -UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( - upb_MiniTableExtension* e, const upb_MiniTable* m); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MINI_TABLE_EXTENSION_H_ */ - -// Must be last. - -// The internal representation of an extension is self-describing: it contains -// enough information that we can serialize it to binary format without needing -// to look it up in a upb_ExtensionRegistry. -// -// This representation allocates 16 bytes to data on 64-bit platforms. -// This is rather wasteful for scalars (in the extreme case of bool, -// it wastes 15 bytes). We accept this because we expect messages to be -// the most common extension type. -typedef struct { - const upb_MiniTableExtension* ext; - upb_MessageValue data; -} upb_Extension; - -#ifdef __cplusplus -extern "C" { -#endif - -// Adds the given extension data to the given message. -// |ext| is copied into the message instance. -// This logically replaces any previously-added extension with this number. -upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( - struct upb_Message* msg, const upb_MiniTableExtension* ext, - upb_Arena* arena); - -// Returns an array of extensions for this message. -// Note: the array is ordered in reverse relative to the order of creation. -const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)( - const struct upb_Message* msg, size_t* count); - -// Returns an extension for a message with a given mini table, -// or NULL if no extension exists with this mini table. -const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( - const struct upb_Message* msg, const upb_MiniTableExtension* ext); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ - -// Must be last. - -#ifdef __cplusplus -extern "C" { -#endif - -extern const float kUpb_FltInfinity; -extern const double kUpb_Infinity; -extern const double kUpb_NaN; - -// Internal members of a upb_Message that track unknown fields and/or -// extensions. We can change this without breaking binary compatibility. - -typedef struct upb_Message_Internal { - // Total size of this structure, including the data that follows. - // Must be aligned to 8, which is alignof(upb_Extension) - uint32_t size; - - /* Offsets relative to the beginning of this structure. - * - * Unknown data grows forward from the beginning to unknown_end. - * Extension data grows backward from size to ext_begin. - * When the two meet, we're out of data and have to realloc. - * - * If we imagine that the final member of this struct is: - * char data[size - overhead]; // overhead = sizeof(upb_Message_Internal) - * - * Then we have: - * unknown data: data[0 .. (unknown_end - overhead)] - * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ - uint32_t unknown_end; - uint32_t ext_begin; - // Data follows, as if there were an array: - // char data[size - sizeof(upb_Message_Internal)]; -} upb_Message_Internal; - -#ifdef UPB_TRACING_ENABLED -UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, - const upb_Arena* arena); -UPB_API void upb_Message_SetNewMessageTraceHandler( - void (*handler)(const upb_MiniTable*, const upb_Arena*)); -#endif // UPB_TRACING_ENABLED - -// Inline version upb_Message_New(), for internal use. -UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m, - upb_Arena* a) { -#ifdef UPB_TRACING_ENABLED - upb_Message_LogNewMessage(m, a); -#endif // UPB_TRACING_ENABLED - - const int size = m->UPB_PRIVATE(size); - struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size); - if (UPB_UNLIKELY(!msg)) return NULL; - memset(msg, 0, size); - return msg; -} - -// Discards the unknown fields for this message only. -void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg); - -// Adds unknown data (serialized protobuf data) to the given message. -// The data is copied into the message instance. -bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg, - const char* data, size_t len, - upb_Arena* arena); - -bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, - upb_Arena* arena); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */ - -#ifndef UPB_MESSAGE_INTERNAL_TYPES_H_ -#define UPB_MESSAGE_INTERNAL_TYPES_H_ - -#include <stdint.h> - -// Must be last. - -#define UPB_OPAQUE(x) x##_opaque - -struct upb_Message { - union { - uintptr_t UPB_OPAQUE(internal); // tagged pointer, low bit == frozen - double d; // Forces same size for 32-bit/64-bit builds - }; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_INLINE void UPB_PRIVATE(_upb_Message_ShallowFreeze)( - struct upb_Message* msg) { - msg->UPB_OPAQUE(internal) |= 1ULL; -} - -UPB_API_INLINE bool upb_Message_IsFrozen(const struct upb_Message* msg) { - return (msg->UPB_OPAQUE(internal) & 1ULL) != 0; -} - -UPB_INLINE struct upb_Message_Internal* UPB_PRIVATE(_upb_Message_GetInternal)( - const struct upb_Message* msg) { - const uintptr_t tmp = msg->UPB_OPAQUE(internal) & ~1ULL; - return (struct upb_Message_Internal*)tmp; -} - -UPB_INLINE void UPB_PRIVATE(_upb_Message_SetInternal)( - struct upb_Message* msg, struct upb_Message_Internal* internal) { - UPB_ASSERT(!upb_Message_IsFrozen(msg)); - msg->UPB_OPAQUE(internal) = (uintptr_t)internal; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#undef UPB_OPAQUE - - -#endif /* UPB_MESSAGE_INTERNAL_TYPES_H_ */ - -// Must be last. - -typedef struct upb_Message upb_Message; - -#ifdef __cplusplus -extern "C" { -#endif - -// Creates a new message with the given mini_table on the given arena. -UPB_API upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* arena); - -// Returns a reference to the message's unknown data. -const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); - -// Removes partial unknown data from message. -void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); - -// Returns the number of extensions present in this message. -size_t upb_Message_ExtensionCount(const upb_Message* msg); - -// Mark a message and all of its descendents as frozen/immutable. -UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m); - -// Returns whether a message has been frozen. -UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg); - -#ifdef UPB_TRACING_ENABLED -UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, - const upb_Arena* arena); - -UPB_API void upb_Message_SetNewMessageTraceHandler( - void (*handler)(const upb_MiniTable* m, const upb_Arena* arena)); -#endif // UPB_TRACING_ENABLED - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_MESSAGE_MESSAGE_H_ */ - -#ifndef UPB_REFLECTION_DEF_H_ -#define UPB_REFLECTION_DEF_H_ - -// IWYU pragma: begin_exports - -// IWYU pragma: private, include "upb/reflection/def.h" - -#ifndef UPB_REFLECTION_DEF_POOL_H_ -#define UPB_REFLECTION_DEF_POOL_H_ - - -// IWYU pragma: private, include "upb/reflection/def.h" - -// Declarations common to all public def types. - -#ifndef UPB_REFLECTION_COMMON_H_ -#define UPB_REFLECTION_COMMON_H_ - -#ifndef THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ -#define THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ - -// IWYU pragma: begin_exports - -#if defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 0 -// This header is checked in. -#elif UPB_BOOTSTRAP_STAGE == 1 -// This header is generated at build time by the bootstrapping process. -#else -// This is the normal header, generated by upb_c_proto_library(). -/* This file was generated by upb_generator from the input file: - * - * google/protobuf/descriptor.proto - * - * Do not edit -- your changes will be discarded when the file is - * regenerated. - * NO CHECKED-IN PROTOBUF GENCODE */ - -#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ -#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ - - -#ifndef UPB_GENERATED_CODE_SUPPORT_H_ -#define UPB_GENERATED_CODE_SUPPORT_H_ - -// IWYU pragma: begin_exports - -#ifndef UPB_BASE_UPCAST_H_ -#define UPB_BASE_UPCAST_H_ - -// Must be last. - -// This macro provides a way to upcast message pointers in a way that is -// somewhat more bulletproof than blindly casting a pointer. Example: -// -// typedef struct { -// upb_Message UPB_PRIVATE(base); -// } pkg_FooMessage; -// -// void f(pkg_FooMessage* msg) { -// upb_Decode(UPB_UPCAST(msg), ...); -// } - -#define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only) - - -#endif /* UPB_BASE_UPCAST_H_ */ - -#ifndef UPB_MESSAGE_ACCESSORS_H_ -#define UPB_MESSAGE_ACCESSORS_H_ - -#include <stdint.h> - - -#ifndef UPB_MESSAGE_ARRAY_H_ -#define UPB_MESSAGE_ARRAY_H_ - -#include <stddef.h> - - -#ifndef UPB_MESSAGE_INTERNAL_ARRAY_H_ -#define UPB_MESSAGE_INTERNAL_ARRAY_H_ - -#include <stdint.h> -#include <string.h> - - -// Must be last. - -#define _UPB_ARRAY_MASK_IMM 0x4 // Frozen/immutable bit. -#define _UPB_ARRAY_MASK_LG2 0x3 // Encoded elem size. -#define _UPB_ARRAY_MASK_ALL (_UPB_ARRAY_MASK_IMM | _UPB_ARRAY_MASK_LG2) - -#ifdef __cplusplus -extern "C" { -#endif - -// LINT.IfChange(upb_Array) - -// Our internal representation for repeated fields. -struct upb_Array { - // This is a tagged pointer. Bits #0 and #1 encode the elem size as follows: - // 0 maps to elem size 1 - // 1 maps to elem size 4 - // 2 maps to elem size 8 - // 3 maps to elem size 16 - // - // Bit #2 contains the frozen/immutable flag. - uintptr_t UPB_ONLYBITS(data); - - size_t UPB_ONLYBITS(size); // The number of elements in the array. - size_t UPB_PRIVATE(capacity); // Allocated storage. Measured in elements. -}; - -UPB_INLINE void UPB_PRIVATE(_upb_Array_ShallowFreeze)(struct upb_Array* arr) { - arr->UPB_ONLYBITS(data) |= _UPB_ARRAY_MASK_IMM; -} - -UPB_API_INLINE bool upb_Array_IsFrozen(const struct upb_Array* arr) { - return (arr->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_IMM) != 0; -} - -UPB_INLINE void UPB_PRIVATE(_upb_Array_SetTaggedPtr)(struct upb_Array* array, - void* data, size_t lg2) { - UPB_ASSERT(lg2 != 1); - UPB_ASSERT(lg2 <= 4); - const size_t bits = lg2 - (lg2 != 0); - array->UPB_ONLYBITS(data) = (uintptr_t)data | bits; -} - -UPB_INLINE size_t -UPB_PRIVATE(_upb_Array_ElemSizeLg2)(const struct upb_Array* array) { - const size_t bits = array->UPB_ONLYBITS(data) & _UPB_ARRAY_MASK_LG2; - const size_t lg2 = bits + (bits != 0); - return lg2; -} - -UPB_API_INLINE const void* upb_Array_DataPtr(const struct upb_Array* array) { - UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array); // Check assertions. - return (void*)(array->UPB_ONLYBITS(data) & ~(uintptr_t)_UPB_ARRAY_MASK_ALL); -} - -UPB_API_INLINE void* upb_Array_MutableDataPtr(struct upb_Array* array) { - return (void*)upb_Array_DataPtr(array); -} - -UPB_INLINE struct upb_Array* UPB_PRIVATE(_upb_Array_New)(upb_Arena* arena, - size_t init_capacity, - int elem_size_lg2) { - UPB_ASSERT(elem_size_lg2 != 1); - UPB_ASSERT(elem_size_lg2 <= 4); - const size_t array_size = - UPB_ALIGN_UP(sizeof(struct upb_Array), UPB_MALLOC_ALIGN); - const size_t bytes = array_size + (init_capacity << elem_size_lg2); - struct upb_Array* array = (struct upb_Array*)upb_Arena_Malloc(arena, bytes); - if (!array) return NULL; - UPB_PRIVATE(_upb_Array_SetTaggedPtr) - (array, UPB_PTR_AT(array, array_size, void), elem_size_lg2); - array->UPB_ONLYBITS(size) = 0; - array->UPB_PRIVATE(capacity) = init_capacity; - return array; -} - -// Resizes the capacity of the array to be at least min_size. -bool UPB_PRIVATE(_upb_Array_Realloc)(struct upb_Array* array, size_t min_size, - upb_Arena* arena); - -UPB_API_INLINE bool upb_Array_Reserve(struct upb_Array* array, size_t size, - upb_Arena* arena) { - UPB_ASSERT(!upb_Array_IsFrozen(array)); - if (array->UPB_PRIVATE(capacity) < size) - return UPB_PRIVATE(_upb_Array_Realloc)(array, size, arena); - return true; -} - -// Resize without initializing new elements. -UPB_INLINE bool UPB_PRIVATE(_upb_Array_ResizeUninitialized)( - struct upb_Array* array, size_t size, upb_Arena* arena) { - UPB_ASSERT(!upb_Array_IsFrozen(array)); - UPB_ASSERT(size <= array->UPB_ONLYBITS(size) || - arena); // Allow NULL arena when shrinking. - if (!upb_Array_Reserve(array, size, arena)) return false; - array->UPB_ONLYBITS(size) = size; - return true; -} - -// This function is intended for situations where elem_size is compile-time -// constant or a known expression of the form (1 << lg2), so that the expression -// i*elem_size does not result in an actual multiplication. -UPB_INLINE void UPB_PRIVATE(_upb_Array_Set)(struct upb_Array* array, size_t i, - const void* data, - size_t elem_size) { - UPB_ASSERT(!upb_Array_IsFrozen(array)); - UPB_ASSERT(i < array->UPB_ONLYBITS(size)); - UPB_ASSERT(elem_size == 1U << UPB_PRIVATE(_upb_Array_ElemSizeLg2)(array)); - char* arr_data = (char*)upb_Array_MutableDataPtr(array); - memcpy(arr_data + (i * elem_size), data, elem_size); -} - -UPB_API_INLINE size_t upb_Array_Size(const struct upb_Array* arr) { - return arr->UPB_ONLYBITS(size); -} - -// LINT.ThenChange(GoogleInternalName0) - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#undef _UPB_ARRAY_MASK_IMM -#undef _UPB_ARRAY_MASK_LG2 -#undef _UPB_ARRAY_MASK_ALL - - -#endif /* UPB_MESSAGE_INTERNAL_ARRAY_H_ */ - -// Must be last. - typedef struct upb_Array upb_Array; #ifdef __cplusplus @@ -2697,52 +2513,12 @@ UPB_API_INLINE bool upb_Array_IsFrozen(const upb_Array* arr); #endif /* UPB_MESSAGE_ARRAY_H_ */ -#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ -#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ +#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_ +#define UPB_MESSAGE_INTERNAL_EXTENSION_H_ #include <stddef.h> -#include <stdint.h> -#include <string.h> -#ifndef UPB_BASE_INTERNAL_ENDIAN_H_ -#define UPB_BASE_INTERNAL_ENDIAN_H_ - -#include <stdint.h> - -// Must be last. - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_INLINE bool upb_IsLittleEndian(void) { - const int x = 1; - return *(char*)&x == 1; -} - -UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) { - if (upb_IsLittleEndian()) return val; - - return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | - ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); -} - -UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) { - if (upb_IsLittleEndian()) return val; - - const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32; - const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32)); - return hi | lo; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */ - #ifndef UPB_MESSAGE_INTERNAL_MAP_H_ #define UPB_MESSAGE_INTERNAL_MAP_H_ @@ -3125,14 +2901,13 @@ UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { } } -UPB_INLINE void* _upb_map_next(const struct upb_Map* map, size_t* iter) { +UPB_INLINE bool _upb_map_next(const struct upb_Map* map, size_t* iter) { upb_strtable_iter it; it.t = &map->table; it.index = *iter; upb_strtable_next(&it); *iter = it.index; - if (upb_strtable_done(&it)) return NULL; - return (void*)str_tabent(&it); + return !upb_strtable_done(&it); } UPB_INLINE void _upb_Map_Clear(struct upb_Map* map) { @@ -3203,6 +2978,578 @@ struct upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size); #endif /* UPB_MESSAGE_INTERNAL_MAP_H_ */ +#ifndef UPB_MINI_TABLE_EXTENSION_H_ +#define UPB_MINI_TABLE_EXTENSION_H_ + +#include <stdint.h> + + +#ifndef UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ +#define UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ + +#include <stddef.h> +#include <stdint.h> + + +// Must be last. + +struct upb_MiniTableExtension { + // Do not move this field. We need to be able to alias pointers. + struct upb_MiniTableField UPB_PRIVATE(field); + + const struct upb_MiniTable* UPB_PRIVATE(extendee); + union upb_MiniTableSub UPB_PRIVATE(sub); // NULL unless submsg or proto2 enum +}; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_API_INLINE upb_CType +upb_MiniTableExtension_CType(const struct upb_MiniTableExtension* e) { + return upb_MiniTableField_CType(&e->UPB_PRIVATE(field)); +} + +UPB_API_INLINE uint32_t +upb_MiniTableExtension_Number(const struct upb_MiniTableExtension* e) { + return e->UPB_PRIVATE(field).UPB_ONLYBITS(number); +} + +UPB_API_INLINE const struct upb_MiniTable* upb_MiniTableExtension_GetSubMessage( + const struct upb_MiniTableExtension* e) { + if (upb_MiniTableExtension_CType(e) != kUpb_CType_Message) { + return NULL; + } + return upb_MiniTableSub_Message(e->UPB_PRIVATE(sub)); +} + +UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( + struct upb_MiniTableExtension* e, const struct upb_MiniTable* m) { + e->UPB_PRIVATE(sub).UPB_PRIVATE(submsg) = m; +} + +UPB_INLINE upb_FieldRep UPB_PRIVATE(_upb_MiniTableExtension_GetRep)( + const struct upb_MiniTableExtension* e) { + return UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MINI_TABLE_INTERNAL_EXTENSION_H_ */ + +// Must be last. + +typedef struct upb_MiniTableExtension upb_MiniTableExtension; + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_API_INLINE upb_CType +upb_MiniTableExtension_CType(const upb_MiniTableExtension* e); + +UPB_API_INLINE uint32_t +upb_MiniTableExtension_Number(const upb_MiniTableExtension* e); + +UPB_API_INLINE const upb_MiniTable* upb_MiniTableExtension_GetSubMessage( + const upb_MiniTableExtension* e); + +UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage( + upb_MiniTableExtension* e, const upb_MiniTable* m); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MINI_TABLE_EXTENSION_H_ */ + +// Must be last. + +// The internal representation of an extension is self-describing: it contains +// enough information that we can serialize it to binary format without needing +// to look it up in a upb_ExtensionRegistry. +// +// This representation allocates 16 bytes to data on 64-bit platforms. +// This is rather wasteful for scalars (in the extreme case of bool, +// it wastes 15 bytes). We accept this because we expect messages to be +// the most common extension type. +typedef struct { + const upb_MiniTableExtension* ext; + upb_MessageValue data; +} upb_Extension; + +#ifdef __cplusplus +extern "C" { +#endif + +// Adds the given extension data to the given message. +// |ext| is copied into the message instance. +// This logically replaces any previously-added extension with this number. +upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( + struct upb_Message* msg, const upb_MiniTableExtension* ext, + upb_Arena* arena); + +// Returns an extension for a message with a given mini table, +// or NULL if no extension exists with this mini table. +const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( + const struct upb_Message* msg, const upb_MiniTableExtension* ext); + +UPB_INLINE bool UPB_PRIVATE(_upb_Extension_IsEmpty)(const upb_Extension* ext) { + switch ( + UPB_PRIVATE(_upb_MiniTableField_Mode)(&ext->ext->UPB_PRIVATE(field))) { + case kUpb_FieldMode_Scalar: + return false; + case kUpb_FieldMode_Array: + return upb_Array_Size(ext->data.array_val) == 0; + case kUpb_FieldMode_Map: + return _upb_Map_Size(ext->data.map_val) == 0; + } + UPB_UNREACHABLE(); +} + +// Replaces the unknown field at iter with the provided extension. +void upb_Message_ReplaceUnknownWithExtension(struct upb_Message* msg, + uintptr_t iter, + const upb_Extension* ext); +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_INTERNAL_EXTENSION_H_ */ + +/* +** Our memory representation for parsing tables and messages themselves. +** Functions in this file are used by generated code and possibly reflection. +** +** The definitions in this file are internal to upb. +**/ + +#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_ +#define UPB_MESSAGE_INTERNAL_MESSAGE_H_ + +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +extern const float kUpb_FltInfinity; +extern const double kUpb_Infinity; +extern const double kUpb_NaN; + +// Internal members of a upb_Message that track unknown fields and/or +// extensions. We can change this without breaking binary compatibility. + +typedef struct upb_TaggedAuxPtr { + uintptr_t ptr; +} upb_TaggedAuxPtr; + +UPB_INLINE bool upb_TaggedAuxPtr_IsNull(upb_TaggedAuxPtr ptr) { + return ptr.ptr == 0; +} + +UPB_INLINE bool upb_TaggedAuxPtr_IsExtension(upb_TaggedAuxPtr ptr) { + return ptr.ptr & 1; +} + +UPB_INLINE bool upb_TaggedAuxPtr_IsUnknown(upb_TaggedAuxPtr ptr) { + return (ptr.ptr != 0) && ((ptr.ptr & 1) == 0); +} + +UPB_INLINE upb_Extension* upb_TaggedAuxPtr_Extension(upb_TaggedAuxPtr ptr) { + UPB_ASSERT(upb_TaggedAuxPtr_IsExtension(ptr)); + return (upb_Extension*)(ptr.ptr & ~1ULL); +} + +UPB_INLINE upb_StringView* upb_TaggedAuxPtr_UnknownData(upb_TaggedAuxPtr ptr) { + UPB_ASSERT(!upb_TaggedAuxPtr_IsExtension(ptr)); + return (upb_StringView*)(ptr.ptr); +} + +UPB_INLINE upb_TaggedAuxPtr upb_TaggedAuxPtr_Null(void) { + upb_TaggedAuxPtr ptr; + ptr.ptr = 0; + return ptr; +} + +UPB_INLINE upb_TaggedAuxPtr +upb_TaggedAuxPtr_MakeExtension(const upb_Extension* e) { + upb_TaggedAuxPtr ptr; + ptr.ptr = (uintptr_t)e | 1; + return ptr; +} + +UPB_INLINE upb_TaggedAuxPtr +upb_TaggedAuxPtr_MakeUnknownData(const upb_StringView* sv) { + upb_TaggedAuxPtr ptr; + ptr.ptr = (uintptr_t)sv; + return ptr; +} + +typedef struct upb_Message_Internal { + // Total number of entries set in aux_data + uint32_t size; + uint32_t capacity; + // Tagged pointers to upb_StringView or upb_Extension + upb_TaggedAuxPtr aux_data[]; +} upb_Message_Internal; + +#ifdef UPB_TRACING_ENABLED +UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, + const upb_Arena* arena); +UPB_API void upb_Message_SetNewMessageTraceHandler( + void (*handler)(const upb_MiniTable*, const upb_Arena*)); +#endif // UPB_TRACING_ENABLED + +// Inline version upb_Message_New(), for internal use. +UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m, + upb_Arena* a) { +#ifdef UPB_TRACING_ENABLED + upb_Message_LogNewMessage(m, a); +#endif // UPB_TRACING_ENABLED + + const int size = m->UPB_PRIVATE(size); + struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size); + if (UPB_UNLIKELY(!msg)) return NULL; + memset(msg, 0, size); + return msg; +} + +// Discards the unknown fields for this message only. +void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg); + +// Adds unknown data (serialized protobuf data) to the given message. The data +// must represent one or more complete and well formed proto fields. +// If alias is set, will keep a view to the provided data; otherwise a copy is +// made. +bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg, + const char* data, size_t len, + upb_Arena* arena, bool alias); + +// Adds unknown data (serialized protobuf data) to the given message. +// The data is copied into the message instance. Data when concatenated together +// must represent one or more complete and well formed proto fields, but the +// individual spans may point only to partial fields. +bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg, + upb_Arena* arena, + upb_StringView data[], size_t count); + +// Ensures at least one slot is available in the aux_data of this message. +// Returns false if a reallocation is needed to satisfy the request, and fails. +bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, + upb_Arena* arena); + +#define kUpb_Message_UnknownBegin 0 +#define kUpb_Message_ExtensionBegin 0 + +UPB_INLINE bool upb_Message_NextUnknown(const struct upb_Message* msg, + upb_StringView* data, uintptr_t* iter) { + const upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + size_t i = *iter; + if (in) { + while (i < in->size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i++]; + if (upb_TaggedAuxPtr_IsUnknown(tagged_ptr)) { + *data = *upb_TaggedAuxPtr_UnknownData(tagged_ptr); + *iter = i; + return true; + } + } + } + data->size = 0; + data->data = NULL; + *iter = i; + return false; +} + +UPB_INLINE bool upb_Message_HasUnknown(const struct upb_Message* msg) { + upb_StringView data; + uintptr_t iter = kUpb_Message_UnknownBegin; + return upb_Message_NextUnknown(msg, &data, &iter); +} + +UPB_INLINE bool upb_Message_NextExtension(const struct upb_Message* msg, + const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, + uintptr_t* iter) { + const upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + uintptr_t i = *iter; + if (in) { + while (i < in->size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i++]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + + // Empty repeated fields or maps semantically don't exist. + if (UPB_PRIVATE(_upb_Extension_IsEmpty)(ext)) continue; + + *out_e = ext->ext; + *out_v = ext->data; + *iter = i; + return true; + } + } + } + *iter = i; + + return false; +} + +UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( + const struct upb_Message* msg, const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, uintptr_t* iter) { + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return false; + uintptr_t i = *iter; + uint32_t size = in->size; + while (i < size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[size - 1 - i]; + i++; + if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + continue; + } + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + + // Empty repeated fields or maps semantically don't exist. + if (UPB_PRIVATE(_upb_Extension_IsEmpty)(ext)) continue; + + *out_e = ext->ext; + *out_v = ext->data; + *iter = i; + return true; + } + *iter = i; + return false; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */ + +// Must be last. + +typedef struct upb_Message upb_Message; + +#ifdef __cplusplus +extern "C" { +#endif + +// Creates a new message with the given mini_table on the given arena. +UPB_API upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* arena); + +// +// Unknown data may be stored non-contiguously. Each segment stores a block of +// unknown fields. To iterate over segments: +// +// uintptr_t iter = kUpb_Message_UnknownBegin; +// upb_StringView data; +// while (upb_Message_NextUnknown(msg, &data, &iter)) { +// // Use data +// } +// Iterates in the order unknown fields were parsed. + +#define kUpb_Message_UnknownBegin 0 +#define kUpb_Message_ExtensionBegin 0 + +UPB_INLINE bool upb_Message_NextUnknown(const upb_Message* msg, + upb_StringView* data, uintptr_t* iter); + +UPB_INLINE bool upb_Message_HasUnknown(const upb_Message* msg); + +// Returns a reference to the message's unknown data. +const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); + +// Removes a segment of unknown data from the message, advancing to the next +// segment. Returns false if the removed segment was at the end of the last +// chunk. +// +// This must be done while iterating: +// +// uintptr_t iter = kUpb_Message_UnknownBegin; +// upb_StringView data; +// // Iterate chunks +// while (upb_Message_NextUnknown(msg, &data, &iter)) { +// // Iterate within a chunk, deleting ranges +// while (ShouldDeleteSubSegment(&data)) { +// // Data now points to the region to be deleted +// if (!upb_Message_DeleteUnknown(msg, &data, &iter)) return; +// // If DeleteUnknown returned true, then data now points to the +// // remaining unknown fields after the region that was just deleted. +// } +// } +// +// The range given in `data` must be contained inside the most recently +// returned region. +bool upb_Message_DeleteUnknown(upb_Message* msg, upb_StringView* data, + uintptr_t* iter); + +// Returns the number of extensions present in this message. +size_t upb_Message_ExtensionCount(const upb_Message* msg); + +// Iterates extensions in wire order +UPB_INLINE bool upb_Message_NextExtension(const upb_Message* msg, + const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, + uintptr_t* iter); + +// Iterates extensions in reverse wire order +UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( + const struct upb_Message* msg, const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, uintptr_t* iter); + +// Mark a message and all of its descendents as frozen/immutable. +UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m); + +// Returns whether a message has been frozen. +UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg); + +#ifdef UPB_TRACING_ENABLED +UPB_API void upb_Message_LogNewMessage(const upb_MiniTable* m, + const upb_Arena* arena); + +UPB_API void upb_Message_SetNewMessageTraceHandler( + void (*handler)(const upb_MiniTable* m, const upb_Arena* arena)); +#endif // UPB_TRACING_ENABLED + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_MESSAGE_MESSAGE_H_ */ + +#ifndef UPB_REFLECTION_DEF_H_ +#define UPB_REFLECTION_DEF_H_ + +// IWYU pragma: begin_exports + +// IWYU pragma: private, include "upb/reflection/def.h" + +#ifndef UPB_REFLECTION_DEF_POOL_H_ +#define UPB_REFLECTION_DEF_POOL_H_ + + +// IWYU pragma: private, include "upb/reflection/def.h" + +// Declarations common to all public def types. + +#ifndef UPB_REFLECTION_COMMON_H_ +#define UPB_REFLECTION_COMMON_H_ + +#ifndef THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ +#define THIRD_PARTY_UPB_UPB_REFLECTION_DESCRIPTOR_BOOTSTRAP_H_ + +// IWYU pragma: begin_exports + +#if defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 0 +// This header is checked in. +#elif defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 1 +// This header is generated at build time by the bootstrapping process. +#else +// This is the normal header, generated by upb_c_proto_library(). +/* This file was generated by upb_generator from the input file: + * + * google/protobuf/descriptor.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. + * NO CHECKED-IN PROTOBUF GENCODE */ + +#ifndef GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ +#define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H__UPB_H_ + + +#ifndef UPB_GENERATED_CODE_SUPPORT_H_ +#define UPB_GENERATED_CODE_SUPPORT_H_ + +// IWYU pragma: begin_exports + +#ifndef UPB_BASE_UPCAST_H_ +#define UPB_BASE_UPCAST_H_ + +// Must be last. + +// This macro provides a way to upcast message pointers in a way that is +// somewhat more bulletproof than blindly casting a pointer. Example: +// +// typedef struct { +// upb_Message UPB_PRIVATE(base); +// } pkg_FooMessage; +// +// void f(pkg_FooMessage* msg) { +// upb_Decode(UPB_UPCAST(msg), ...); +// } + +#define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only) + + +#endif /* UPB_BASE_UPCAST_H_ */ + +#ifndef UPB_MESSAGE_ACCESSORS_H_ +#define UPB_MESSAGE_ACCESSORS_H_ + +#include <stdint.h> + + +#ifndef UPB_MESSAGE_INTERNAL_ACCESSORS_H_ +#define UPB_MESSAGE_INTERNAL_ACCESSORS_H_ + +#include <stddef.h> +#include <stdint.h> +#include <string.h> + + +#ifndef UPB_BASE_INTERNAL_ENDIAN_H_ +#define UPB_BASE_INTERNAL_ENDIAN_H_ + +#include <stdint.h> + +// Must be last. + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_INLINE bool upb_IsLittleEndian(void) { + const int x = 1; + return *(char*)&x == 1; +} + +UPB_INLINE uint32_t upb_BigEndian32(uint32_t val) { + if (upb_IsLittleEndian()) return val; + + return ((val & 0xff) << 24) | ((val & 0xff00) << 8) | + ((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24); +} + +UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) { + if (upb_IsLittleEndian()) return val; + + const uint64_t hi = ((uint64_t)upb_BigEndian32((uint32_t)val)) << 32; + const uint64_t lo = upb_BigEndian32((uint32_t)(val >> 32)); + return hi | lo; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* UPB_BASE_INTERNAL_ENDIAN_H_ */ + #ifndef UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ #define UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_ @@ -3383,7 +3730,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)( } } -UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( +UPB_INLINE_IF_NOT_GCC void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( const upb_MiniTableField* f, void* to, const void* from) { switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) { case kUpb_FieldRep_1Byte: @@ -3403,7 +3750,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( UPB_UNREACHABLE(); } -UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)( +UPB_INLINE_IF_NOT_GCC bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)( const upb_MiniTableField* f, const void* a, const void* b) { switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) { case kUpb_FieldRep_1Byte: @@ -4076,9 +4423,7 @@ UPB_API_INLINE void upb_Message_Clear(struct upb_Message* msg, memset(msg, 0, m->UPB_PRIVATE(size)); if (in) { // Reset the internal buffer to empty. - in->unknown_end = sizeof(upb_Message_Internal); - in->ext_begin = in->size; - UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); + in->size = 0; } } @@ -4102,11 +4447,15 @@ UPB_API_INLINE void upb_Message_ClearExtension( UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) return; - const upb_Extension* base = UPB_PTR_AT(in, in->ext_begin, upb_Extension); - upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e); - if (ext) { - *ext = *base; - in->ext_begin += sizeof(upb_Extension); + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + if (ext->ext == e) { + in->aux_data[i] = upb_TaggedAuxPtr_Null(); + return; + } + } } } @@ -4136,6 +4485,133 @@ UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( return upb_Array_MutableDataPtr(arr); } +UPB_API_INLINE bool upb_Message_GetExtensionBool( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + bool default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Bool); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_1Byte); + bool ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE double upb_Message_GetExtensionDouble( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + double default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Double); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + double ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE float upb_Message_GetExtensionFloat( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + float default_val) { + float ret; + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Float); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE int32_t upb_Message_GetExtensionInt32( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + int32_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int32 || + upb_MiniTableExtension_CType(e) == kUpb_CType_Enum); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + int32_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE int64_t upb_Message_GetExtensionInt64( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + int64_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int64); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + int64_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + uint32_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt32); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + uint32_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + uint64_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt64); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + uint64_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE upb_StringView upb_Message_GetExtensionString( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + upb_StringView default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_String || + upb_MiniTableExtension_CType(e) == kUpb_CType_Bytes); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_StringView); + upb_StringView ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE struct upb_Message* upb_Message_GetExtensionMessage( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + struct upb_Message* default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Message); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); + struct upb_Message* ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +// Repeated +UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray( + const struct upb_Message* msg, const upb_MiniTableExtension* e) { + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) == + kUpb_FieldRep_NativePointer); + UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field))); + UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0); + upb_Array* ret; + const upb_Array* default_val = NULL; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray( + struct upb_Message* msg, const upb_MiniTableExtension* e) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) == + kUpb_FieldRep_NativePointer); + UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field))); + UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0); + upb_Array* ret; + upb_Array* default_val = NULL; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + #ifdef __cplusplus } /* extern "C" */ #endif @@ -4439,6 +4915,47 @@ UPB_API_INLINE void upb_Message_SetBaseFieldUInt64(struct upb_Message* msg, const upb_MiniTableField* f, uint64_t value); +// Extension Getters /////////////////////////////////////////////////////////// +UPB_API_INLINE bool upb_Message_GetExtensionBool( + const upb_Message* msg, const upb_MiniTableExtension* f, bool default_val); + +UPB_API_INLINE double upb_Message_GetExtensionDouble( + const upb_Message* msg, const upb_MiniTableExtension* f, + double default_val); + +UPB_API_INLINE float upb_Message_GetExtensionFloat( + const upb_Message* msg, const upb_MiniTableExtension* f, float default_val); + +UPB_API_INLINE int32_t upb_Message_GetExtensionInt32( + const upb_Message* msg, const upb_MiniTableExtension* f, + int32_t default_val); + +UPB_API_INLINE int64_t upb_Message_GetExtensionInt64( + const upb_Message* msg, const upb_MiniTableExtension* f, + int64_t default_val); + +UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32( + const upb_Message* msg, const upb_MiniTableExtension* f, + uint32_t default_val); + +UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64( + const upb_Message* msg, const upb_MiniTableExtension* f, + uint64_t default_val); + +UPB_API_INLINE upb_StringView upb_Message_GetExtensionString( + const upb_Message* msg, const upb_MiniTableExtension* f, + upb_StringView default_val); + +UPB_API_INLINE upb_Message* upb_Message_GetExtensionMessage( + const upb_Message* msg, const upb_MiniTableExtension* f, + struct upb_Message* default_val); + +UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray( + const upb_Message* msg, const upb_MiniTableExtension* f); + +UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray( + upb_Message* msg, const upb_MiniTableExtension* f); + // Extension Setters /////////////////////////////////////////////////////////// UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg, @@ -4805,10 +5322,11 @@ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( } // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so -// it can be reused from call to call, avoiding repeated realloc()/free(). +// it can be reused from call to call, avoiding repeated +// upb_grealloc()/upb_gfree(). // -// The caller owns `*buf` both before and after the call, and must free() it -// when it is no longer in use. The function will realloc() `*buf` as +// The caller owns `*buf` both before and after the call, and must upb_gfree() +// it when it is no longer in use. The function will upb_grealloc() `*buf` as // necessary, updating `*size` accordingly. upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, upb_MiniTablePlatform platform, @@ -4825,6 +5343,9 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ +#include <stddef.h> +#include <stdint.h> + // Must be last. @@ -4868,21 +5389,25 @@ extern "C" { typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; +typedef enum { + kUpb_ExtensionRegistryStatus_Ok = 0, + kUpb_ExtensionRegistryStatus_DuplicateEntry = 1, + kUpb_ExtensionRegistryStatus_OutOfMemory = 2, +} upb_ExtensionRegistryStatus; + // Creates a upb_ExtensionRegistry in the given arena. // The arena must outlive any use of the extreg. UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); -UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, - const upb_MiniTableExtension* e); +UPB_API upb_ExtensionRegistryStatus upb_ExtensionRegistry_Add( + upb_ExtensionRegistry* r, const upb_MiniTableExtension* e); // Adds the given extension info for the array |e| of size |count| into the // registry. If there are any errors, the entire array is backed out. // The extensions must outlive the registry. // Possible errors include OOM or an extension number that already exists. -// TODO: There is currently no way to know the exact reason for failure. -bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, - const upb_MiniTableExtension** e, - size_t count); +upb_ExtensionRegistryStatus upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistry* r, const upb_MiniTableExtension** e, size_t count); #ifdef UPB_LINKARR_DECLARE @@ -5021,8 +5546,8 @@ extern "C" { #endif enum { - /* If set, strings will alias the input buffer instead of copying into the - * arena. */ + /* If set, strings and unknown fields will alias the input buffer instead of + * copying into the arena. */ kUpb_DecodeOption_AliasString = 1, /* If set, the parse will return failure if any message is missing any @@ -5098,6 +5623,8 @@ UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { return options >> 16; } +uint16_t upb_DecodeOptions_GetEffectiveMaxDepth(uint32_t options); + // Enforce an upper bound on recursion depth. UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) { uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); @@ -5198,6 +5725,8 @@ UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { return options >> 16; } +uint16_t upb_EncodeOptions_GetEffectiveMaxDepth(uint32_t options); + // Enforce an upper bound on recursion depth. UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); @@ -5454,6 +5983,7 @@ extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_ extern const upb_MiniTableEnum google__protobuf__Edition_enum_init; extern const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationState_enum_init; +extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__FieldPresence_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__JsonFormat_enum_init; @@ -5539,6 +6069,12 @@ typedef enum { google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 } google_protobuf_ExtensionRangeOptions_VerificationState; +typedef enum { + google_protobuf_FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + google_protobuf_FeatureSet_STYLE2024 = 1, + google_protobuf_FeatureSet_STYLE_LEGACY = 2 +} google_protobuf_FeatureSet_EnforceNamingStyle; + typedef enum { google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, google_protobuf_FeatureSet_OPEN = 1, @@ -5828,11 +6364,11 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_pro return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -5843,7 +6379,7 @@ UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -5851,7 +6387,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_ return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -5860,11 +6396,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_up return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5876,7 +6412,7 @@ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDes } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5885,7 +6421,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_up return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5895,11 +6431,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_ return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5911,7 +6447,7 @@ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_Fil } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5920,7 +6456,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5930,11 +6466,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5946,7 +6482,7 @@ UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_ } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5955,7 +6491,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_arr return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5965,11 +6501,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_a return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5981,7 +6517,7 @@ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_Fi } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5990,7 +6526,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -6000,45 +6536,45 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_FileOptions* default_val = NULL; const google_protobuf_FileOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_SourceCodeInfo* default_val = NULL; const google_protobuf_SourceCodeInfo* ret; - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6049,7 +6585,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6057,7 +6593,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependen return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6066,11 +6602,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mut return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6081,7 +6617,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(co } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6089,7 +6625,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6098,19 +6634,19 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutab return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { @@ -6139,7 +6675,7 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_ upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6150,12 +6686,12 @@ UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependenc } } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6167,7 +6703,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protob return true; } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6179,12 +6715,12 @@ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto } } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6199,7 +6735,7 @@ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescripto return sub; } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6211,12 +6747,12 @@ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorP } } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6231,7 +6767,7 @@ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescr return sub; } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6243,12 +6779,12 @@ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescript } } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6263,7 +6799,7 @@ UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDe return sub; } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -6275,12 +6811,12 @@ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptor } } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -6295,7 +6831,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -6308,7 +6844,7 @@ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorPro return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -6321,7 +6857,7 @@ UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptor return sub; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6332,12 +6868,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependenc } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6349,7 +6885,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google return true; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6360,12 +6896,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency( } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6377,7 +6913,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p return true; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) { @@ -7463,67 +7999,67 @@ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(con return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } @@ -7532,19 +8068,19 @@ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(goo upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -7585,35 +8121,35 @@ UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_ return ptr; } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { @@ -7665,52 +8201,52 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) { const google_protobuf_FieldOptions* default_val = NULL; const google_protobuf_FieldOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) { @@ -7730,44 +8266,44 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { @@ -7783,15 +8319,15 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_Fi upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -7808,11 +8344,11 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -8564,51 +9100,51 @@ UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google return ptr; } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { @@ -8629,48 +9165,48 @@ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_p return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { @@ -8687,11 +9223,11 @@ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescripto return sub; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -8764,35 +9300,35 @@ UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) { int32_t default_val = 1; int32_t ret; - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) { @@ -8812,115 +9348,115 @@ UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) { bool default_val = true; bool ret; - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) { @@ -9097,11 +9633,11 @@ UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -9109,31 +9645,31 @@ UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileO upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -9482,67 +10018,67 @@ UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf return ptr; } UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { @@ -9562,75 +10098,75 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_Fi return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -9641,7 +10177,7 @@ UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -9649,7 +10185,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(cons return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -9658,11 +10194,11 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(go return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9674,7 +10210,7 @@ UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -9683,7 +10219,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -9693,45 +10229,45 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { const google_protobuf_FeatureSet* default_val = NULL; const google_protobuf_FeatureSet* ret; - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_feature_support(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_feature_support(const google_protobuf_FieldOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_feature_support(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9743,7 +10279,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Fie } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -9752,7 +10288,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_u return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -9763,19 +10299,19 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable } UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { @@ -9783,23 +10319,23 @@ UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOpt upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -9810,12 +10346,12 @@ UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf } } UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -9827,7 +10363,7 @@ UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOp return true; } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9839,12 +10375,12 @@ UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOp } } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -9859,7 +10395,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_F return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -9872,7 +10408,7 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutab return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_feature_support(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -9885,7 +10421,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_F return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -9897,12 +10433,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -10513,44 +11049,44 @@ UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_feature_support(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_EnumValueOptions_feature_support(const google_protobuf_EnumValueOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_feature_support(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -10562,7 +11098,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Enu } } UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -10571,7 +11107,7 @@ UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_opti return arr; } UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -10599,11 +11135,11 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_m return sub; } UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_EnumValueOptions_set_feature_support(google_protobuf_EnumValueOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -10616,7 +11152,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_E return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -10628,12 +11164,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOption } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -11015,11 +11551,11 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_p return ptr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -11031,7 +11567,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_pro } } UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -11040,7 +11576,7 @@ UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array( return arr; } UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -11050,104 +11586,104 @@ UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_arra return arr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) { uint64_t default_val = (uint64_t)0ull; uint64_t ret; - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) { int64_t default_val = (int64_t)0ll; int64_t ret; - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) { double default_val = 0; double ret; - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -11159,12 +11695,12 @@ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_Uninte } } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -11179,27 +11715,27 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_ return sub; } UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -11413,6 +11949,22 @@ UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } +UPB_INLINE void google_protobuf_FeatureSet_clear_enforce_naming_style(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); +} +UPB_INLINE int32_t google_protobuf_FeatureSet_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, + &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); +} UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; @@ -11438,6 +11990,10 @@ UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_Featu const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } +UPB_INLINE void google_protobuf_FeatureSet_set_enforce_naming_style(google_protobuf_FeatureSet *msg, int32_t value) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_SetBaseField((upb_Message *)msg, &field, &value); +} /* google.protobuf.FeatureSetDefaults */ @@ -11844,11 +12400,11 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const goog return ptr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -11859,7 +12415,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -11867,7 +12423,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -11876,11 +12432,11 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -11891,7 +12447,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -11899,7 +12455,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -11908,35 +12464,35 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) { @@ -11973,7 +12529,7 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_ } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -11984,12 +12540,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -12001,7 +12557,7 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf return true; } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -12012,12 +12568,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -12029,11 +12585,11 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf return true; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { @@ -12207,11 +12763,11 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const return ptr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -12222,7 +12778,7 @@ UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(cons } } UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -12230,7 +12786,7 @@ UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_u return arr; } UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -12239,19 +12795,19 @@ UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable return arr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) { @@ -12304,7 +12860,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -12315,12 +12871,12 @@ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(go } } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -12332,7 +12888,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro return true; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { @@ -13023,7 +13579,6 @@ enum { upb_JsonDecode_IgnoreUnknown = 1 }; enum { kUpb_JsonDecodeResult_Ok = 0, - kUpb_JsonDecodeResult_OkWithEmptyStringNumerics = 1, kUpb_JsonDecodeResult_Error = 2, }; @@ -13196,7 +13751,9 @@ UPB_API bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, // Clears all unknown field data from this message and all submessages. UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg, - const upb_MessageDef* m, int maxdepth); + const upb_MessageDef* m, + const upb_DefPool* ext_pool, + int maxdepth); #ifdef __cplusplus } /* extern "C" */ @@ -13310,10 +13867,6 @@ UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) #define upb_Atomic_Store(addr, val, order) \ atomic_store_explicit(addr, val, order) -#define upb_Atomic_Add(addr, val, order) \ - atomic_fetch_add_explicit(addr, val, order) -#define upb_Atomic_Sub(addr, val, order) \ - atomic_fetch_sub_explicit(addr, val, order) #define upb_Atomic_Exchange(addr, val, order) \ atomic_exchange_explicit(addr, val, order) #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ @@ -13325,15 +13878,146 @@ UPB_INLINE int _upb_vsnprintf(char* buf, size_t size, const char* fmt, atomic_compare_exchange_weak_explicit(addr, expected, desired, \ success_order, failure_order) -#else // !UPB_USE_C11_ATOMICS +#elif defined(UPB_USE_MSC_ATOMICS) +#include <intrin.h> +#include <stdbool.h> +#include <stdint.h> + +#define upb_Atomic_Init(addr, val) (*(addr) = val) + +#if defined(_WIN64) +// MSVC, without C11 atomics, does not have any way in pure C to force +// load-acquire store-release behavior, so we hack it with exchanges. +#pragma intrinsic(_InterlockedExchange64) +#define upb_Atomic_Store(addr, val, order) \ + (void)_InterlockedExchange64((uint64_t volatile *)addr, (uint64_t)val) + +#pragma intrinsic(_InterlockedCompareExchange64) +static uintptr_t upb_Atomic_LoadMsc(uint64_t volatile *addr) { + // Compare exchange with an unlikely value reduces the risk of a spurious + // (but harmless) store + return _InterlockedCompareExchange64(addr, 0xDEADC0DEBAADF00D, + 0xDEADC0DEBAADF00D); +} +// If _Generic is available, use it to avoid emitting a "'uintptr_t' differs in +// levels of indirection from 'void *'" or -Wint-conversion compiler warning. +#if __STDC_VERSION__ >= 201112L +#define upb_Atomic_Load(addr, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: upb_Atomic_LoadMsc( \ + (uint64_t volatile *)(addr)), \ + default: (void *)upb_Atomic_LoadMsc((uint64_t volatile *)(addr))) + +#define upb_Atomic_Exchange(addr, val, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: _InterlockedExchange64( \ + (uint64_t volatile *)(addr), (uint64_t)val), \ + default: (void *)_InterlockedExchange64((uint64_t volatile *)addr, \ + (uint64_t)val)) +#else +// Compare exchange with an unlikely value reduces the risk of a spurious +// (but harmless) store +#define upb_Atomic_Load(addr, order) \ + (void *)upb_Atomic_LoadMsc((uint64_t volatile *)(addr)) + +#define upb_Atomic_Exchange(addr, val, order) \ + (void *)_InterlockedExchange64((uint64_t volatile *)addr, (uint64_t)val) +#endif + +#pragma intrinsic(_InterlockedCompareExchange64) +static bool upb_Atomic_CompareExchangeMscP(uint64_t volatile *addr, + uint64_t *expected, + uint64_t desired) { + uint64_t expect_val = *expected; + uint64_t actual_val = + _InterlockedCompareExchange64(addr, desired, expect_val); + if (expect_val != actual_val) { + *expected = actual_val; + return false; + } + return true; +} + +#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ + success_order, failure_order) \ + upb_Atomic_CompareExchangeMscP((uint64_t volatile *)addr, \ + (uint64_t *)expected, (uint64_t)desired) + +#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ + failure_order) \ + upb_Atomic_CompareExchangeMscP((uint64_t volatile *)addr, \ + (uint64_t *)expected, (uint64_t)desired) + +#else // 32 bit pointers +#pragma intrinsic(_InterlockedExchange) +#define upb_Atomic_Store(addr, val, order) \ + (void)_InterlockedExchange((uint32_t volatile *)addr, (uint32_t)val) + +#pragma intrinsic(_InterlockedCompareExchange) +static uintptr_t upb_Atomic_LoadMsc(uint32_t volatile *addr) { + // Compare exchange with an unlikely value reduces the risk of a spurious + // (but harmless) store + return _InterlockedCompareExchange(addr, 0xDEADC0DE, 0xDEADC0DE); +} +// If _Generic is available, use it to avoid emitting 'uintptr_t' differs in +// levels of indirection from 'void *' +#if __STDC_VERSION__ >= 201112L +#define upb_Atomic_Load(addr, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: upb_Atomic_LoadMsc( \ + (uint32_t volatile *)(addr)), \ + default: (void *)upb_Atomic_LoadMsc((uint32_t volatile *)(addr))) + +#define upb_Atomic_Exchange(addr, val, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: _InterlockedExchange( \ + (uint32_t volatile *)(addr), (uint32_t)val), \ + default: (void *)_InterlockedExchange64((uint32_t volatile *)addr, \ + (uint32_t)val)) +#else +#define upb_Atomic_Load(addr, order) \ + (void *)upb_Atomic_LoadMsc((uint32_t volatile *)(addr)) + +#define upb_Atomic_Exchange(addr, val, order) \ + (void *)_InterlockedExchange((uint32_t volatile *)addr, (uint32_t)val) +#endif + +#pragma intrinsic(_InterlockedCompareExchange) +static bool upb_Atomic_CompareExchangeMscP(uint32_t volatile *addr, + uint32_t *expected, + uint32_t desired) { + uint32_t expect_val = *expected; + uint32_t actual_val = _InterlockedCompareExchange(addr, desired, expect_val); + if (expect_val != actual_val) { + *expected = actual_val; + return false; + } + return true; +} + +#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ + success_order, failure_order) \ + upb_Atomic_CompareExchangeMscP((uint32_t volatile *)addr, \ + (uint32_t *)expected, (uint32_t)desired) + +#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ + failure_order) \ + upb_Atomic_CompareExchangeMscP((uint32_t volatile *)addr, \ + (uint32_t *)expected, (uint32_t)desired) +#endif + +#else // No atomics + +#if !defined(UPB_SUPPRESS_MISSING_ATOMICS) +// NOLINTNEXTLINE +#error Your compiler does not support atomic instructions, which UPB uses. If you do not use UPB on multiple threads, you can suppress this error by defining UPB_SUPPRESS_MISSING_ATOMICS. +#endif #include <string.h> #define upb_Atomic_Init(addr, val) (*addr = val) #define upb_Atomic_Load(addr, order) (*addr) #define upb_Atomic_Store(addr, val, order) (*(addr) = val) -#define upb_Atomic_Add(addr, val, order) (*(addr) += val) -#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { void* old; @@ -13387,9 +14071,10 @@ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr, extern "C" { #endif -const upb_MiniTableExtension* upb_Message_ExtensionByIndex( - const upb_Message* msg, size_t index); - +// Same as upb_Message_NextExtension but iterates in reverse wire order +bool upb_Message_NextExtensionReverse(const upb_Message* msg, + const upb_MiniTableExtension** result, + uintptr_t* iter); // Returns the minitable with the given field number, or NULL on failure. const upb_MiniTableExtension* upb_Message_FindExtensionByNumber( const upb_Message* msg, uint32_t field_number); @@ -13501,8 +14186,8 @@ UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, const struct upb_Map* map, _upb_sortedmap* sorted); -bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, - size_t count, _upb_sortedmap* sorted); +bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Message_Internal* in, + _upb_sortedmap* sorted); #ifdef __cplusplus } /* extern "C" */ @@ -13531,7 +14216,9 @@ UPB_INLINE int upb_Log2Ceiling(int x) { #endif } -UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } +UPB_INLINE int upb_RoundUpToPowerOfTwo(int x) { + return 1 << upb_Log2Ceiling(x); +} #ifdef __cplusplus } /* extern "C" */ @@ -13638,8 +14325,7 @@ typedef enum { } upb_UnknownCompareResult; upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - const char* buf1, size_t size1, const char* buf2, size_t size2, - int max_depth); + const upb_Message* msg1, const upb_Message* msg2, int max_depth); #ifdef __cplusplus } /* extern "C" */ @@ -13652,25 +14338,250 @@ upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( #define THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_ #include <stddef.h> +#include <stdint.h> // Must be last. #define kUpb_BaseField_Begin ((size_t)-1) -#define kUpb_Extension_Begin ((size_t)-1) - bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg, const upb_MiniTable* m, const upb_MiniTableField** out_f, upb_MessageValue* out_v, - size_t* iter); + uintptr_t* iter); -bool UPB_PRIVATE(_upb_Message_NextExtension)( - const upb_Message* msg, const upb_MiniTable* m, - const upb_MiniTableExtension** out_e, upb_MessageValue* out_v, - size_t* iter); #endif // THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_ +#ifndef UPB_WIRE_READER_H_ +#define UPB_WIRE_READER_H_ + + +#ifndef UPB_WIRE_INTERNAL_READER_H_ +#define UPB_WIRE_INTERNAL_READER_H_ + +// Must be last. + +#define kUpb_WireReader_WireTypeBits 3 +#define kUpb_WireReader_WireTypeMask 7 + +typedef struct { + const char* ptr; + uint64_t val; +} UPB_PRIVATE(_upb_WireReader_LongVarint); + +#ifdef __cplusplus +extern "C" { +#endif + +UPB_PRIVATE(_upb_WireReader_LongVarint) +UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val); + +UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)( + const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) { + uint64_t byte = (uint8_t)*ptr; + if (UPB_LIKELY((byte & 0x80) == 0)) { + *val = (uint32_t)byte; + return ptr + 1; + } + const char* start = ptr; + UPB_PRIVATE(_upb_WireReader_LongVarint) + res = UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(ptr, byte); + if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || + res.val > maxval) { + return NULL; // Malformed. + } + *val = res.val; + return res.ptr; +} + +UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { + return tag >> kUpb_WireReader_WireTypeBits; +} + +UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { + return tag & kUpb_WireReader_WireTypeMask; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif // UPB_WIRE_INTERNAL_READER_H_ + +#ifndef UPB_WIRE_TYPES_H_ +#define UPB_WIRE_TYPES_H_ + +// A list of types as they are encoded on the wire. +typedef enum { + kUpb_WireType_Varint = 0, + kUpb_WireType_64Bit = 1, + kUpb_WireType_Delimited = 2, + kUpb_WireType_StartGroup = 3, + kUpb_WireType_EndGroup = 4, + kUpb_WireType_32Bit = 5 +} upb_WireType; + +#endif /* UPB_WIRE_TYPES_H_ */ + +// Must be last. + +// The upb_WireReader interface is suitable for general-purpose parsing of +// protobuf binary wire format. It is designed to be used along with +// upb_EpsCopyInputStream for buffering, and all parsing routines in this file +// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is +// available to read without any bounds checks. + +#ifdef __cplusplus +extern "C" { +#endif + +// Parses a tag into `tag`, and returns a pointer past the end of the tag, or +// NULL if there was an error in the tag data. +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, + uint32_t* tag) { + uint64_t val; + ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX); + if (!ptr) return NULL; + *tag = val; + return ptr; +} + +// Given a tag, returns the field number. +UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag); + +// Given a tag, returns the wire type. +UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag); + +UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, + uint64_t* val) { + return UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, val, 10, UINT64_MAX); +} + +// Skips data for a varint, returning a pointer past the end of the varint, or +// NULL if there was an error in the varint data. +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { + uint64_t val; + return upb_WireReader_ReadVarint(ptr, &val); +} + +// Reads a varint indicating the size of a delimited field into `size`, or +// NULL if there was an error in the varint data. +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { + uint64_t size64; + ptr = upb_WireReader_ReadVarint(ptr, &size64); + if (!ptr || size64 >= INT32_MAX) return NULL; + *size = size64; + return ptr; +} + +// Reads a fixed32 field, performing byte swapping if necessary. +// +// REQUIRES: there must be at least 4 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { + uint32_t uval; + memcpy(&uval, ptr, 4); + uval = upb_BigEndian32(uval); + memcpy(val, &uval, 4); + return ptr + 4; +} + +// Reads a fixed64 field, performing byte swapping if necessary. +// +// REQUIRES: there must be at least 4 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { + uint64_t uval; + memcpy(&uval, ptr, 8); + uval = upb_BigEndian64(uval); + memcpy(val, &uval, 8); + return ptr + 8; +} + +const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)( + const char* ptr, uint32_t tag, int depth_limit, + upb_EpsCopyInputStream* stream); + +// Skips data for a group, returning a pointer past the end of the group, or +// NULL if there was an error parsing the group. The `tag` argument should be +// the start group tag that begins the group. The `depth_limit` argument +// indicates how many levels of recursion the group is allowed to have before +// reporting a parse error (this limit exists to protect against stack +// overflow). +// +// TODO: evaluate how the depth_limit should be specified. Do users need +// control over this? +UPB_INLINE const char* upb_WireReader_SkipGroup( + const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { + return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, 100, stream); +} + +UPB_INLINE const char* _upb_WireReader_SkipValue( + const char* ptr, uint32_t tag, int depth_limit, + upb_EpsCopyInputStream* stream) { + switch (upb_WireReader_GetWireType(tag)) { + case kUpb_WireType_Varint: + return upb_WireReader_SkipVarint(ptr); + case kUpb_WireType_32Bit: + return ptr + 4; + case kUpb_WireType_64Bit: + return ptr + 8; + case kUpb_WireType_Delimited: { + int size; + ptr = upb_WireReader_ReadSize(ptr, &size); + if (!ptr) return NULL; + ptr += size; + return ptr; + } + case kUpb_WireType_StartGroup: + return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, depth_limit, + stream); + case kUpb_WireType_EndGroup: + return NULL; // Should be handled before now. + default: + return NULL; // Unknown wire type. + } +} + +// Skips data for a wire value of any type, returning a pointer past the end of +// the data, or NULL if there was an error parsing the group. The `tag` argument +// should be the tag that was just parsed. The `depth_limit` argument indicates +// how many levels of recursion a group is allowed to have before reporting a +// parse error (this limit exists to protect against stack overflow). +// +// REQUIRES: there must be at least 10 bytes of data available at `ptr`. +// Bounds checks must be performed before calling this function, preferably +// by calling upb_EpsCopyInputStream_IsDone(). +// +// TODO: evaluate how the depth_limit should be specified. Do users need +// control over this? +UPB_INLINE const char* upb_WireReader_SkipValue( + const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { + return _upb_WireReader_SkipValue(ptr, tag, 100, stream); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif // UPB_WIRE_READER_H_ + #ifndef UPB_MESSAGE_COPY_H_ #define UPB_MESSAGE_COPY_H_ @@ -14056,17 +14967,18 @@ enum { #ifndef UPB_WIRE_INTERNAL_DECODER_H_ #define UPB_WIRE_INTERNAL_DECODER_H_ +#include <stddef.h> + #include "utf8_range.h" // Must be last. -#define DECODE_NOGROUP (uint32_t) - 1 +#define DECODE_NOGROUP (uint32_t)-1 typedef struct upb_Decoder { upb_EpsCopyInputStream input; const upb_ExtensionRegistry* extreg; - const char* unknown; // Start of unknown data, preserve at buffer flip - upb_Message* unknown_msg; // Pointer to preserve data to + upb_Message* original_msg; // Pointer to preserve data to int depth; // Tracks recursion depth to bound stack usage. uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP. uint16_t options; @@ -14126,14 +15038,6 @@ UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { upb_Decoder* d = (upb_Decoder*)e; if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); - - if (d->unknown) { - if (!UPB_PRIVATE(_upb_Message_AddUnknown)( - d->unknown_msg, d->unknown, old_end - d->unknown, &d->arena)) { - _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); - } - d->unknown = new_start; - } return new_start; } @@ -14163,236 +15067,6 @@ UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { #endif /* UPB_WIRE_INTERNAL_DECODER_H_ */ -#ifndef UPB_WIRE_READER_H_ -#define UPB_WIRE_READER_H_ - - -#ifndef UPB_WIRE_INTERNAL_READER_H_ -#define UPB_WIRE_INTERNAL_READER_H_ - -// Must be last. - -#define kUpb_WireReader_WireTypeBits 3 -#define kUpb_WireReader_WireTypeMask 7 - -typedef struct { - const char* ptr; - uint64_t val; -} UPB_PRIVATE(_upb_WireReader_LongVarint); - -#ifdef __cplusplus -extern "C" { -#endif - -UPB_PRIVATE(_upb_WireReader_LongVarint) -UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(const char* ptr, uint64_t val); - -UPB_FORCEINLINE const char* UPB_PRIVATE(_upb_WireReader_ReadVarint)( - const char* ptr, uint64_t* val, int maxlen, uint64_t maxval) { - uint64_t byte = (uint8_t)*ptr; - if (UPB_LIKELY((byte & 0x80) == 0)) { - *val = (uint32_t)byte; - return ptr + 1; - } - const char* start = ptr; - UPB_PRIVATE(_upb_WireReader_LongVarint) - res = UPB_PRIVATE(_upb_WireReader_ReadLongVarint)(ptr, byte); - if (!res.ptr || (maxlen < 10 && res.ptr - start > maxlen) || - res.val > maxval) { - return NULL; // Malformed. - } - *val = res.val; - return res.ptr; -} - -UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag) { - return tag >> kUpb_WireReader_WireTypeBits; -} - -UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag) { - return tag & kUpb_WireReader_WireTypeMask; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif // UPB_WIRE_INTERNAL_READER_H_ - -#ifndef UPB_WIRE_TYPES_H_ -#define UPB_WIRE_TYPES_H_ - -// A list of types as they are encoded on the wire. -typedef enum { - kUpb_WireType_Varint = 0, - kUpb_WireType_64Bit = 1, - kUpb_WireType_Delimited = 2, - kUpb_WireType_StartGroup = 3, - kUpb_WireType_EndGroup = 4, - kUpb_WireType_32Bit = 5 -} upb_WireType; - -#endif /* UPB_WIRE_TYPES_H_ */ - -// Must be last. - -// The upb_WireReader interface is suitable for general-purpose parsing of -// protobuf binary wire format. It is designed to be used along with -// upb_EpsCopyInputStream for buffering, and all parsing routines in this file -// assume that at least kUpb_EpsCopyInputStream_SlopBytes worth of data is -// available to read without any bounds checks. - -#ifdef __cplusplus -extern "C" { -#endif - -// Parses a tag into `tag`, and returns a pointer past the end of the tag, or -// NULL if there was an error in the tag data. -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_FORCEINLINE const char* upb_WireReader_ReadTag(const char* ptr, - uint32_t* tag) { - uint64_t val; - ptr = UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, &val, 5, UINT32_MAX); - if (!ptr) return NULL; - *tag = val; - return ptr; -} - -// Given a tag, returns the field number. -UPB_API_INLINE uint32_t upb_WireReader_GetFieldNumber(uint32_t tag); - -// Given a tag, returns the wire type. -UPB_API_INLINE uint8_t upb_WireReader_GetWireType(uint32_t tag); - -UPB_INLINE const char* upb_WireReader_ReadVarint(const char* ptr, - uint64_t* val) { - return UPB_PRIVATE(_upb_WireReader_ReadVarint)(ptr, val, 10, UINT64_MAX); -} - -// Skips data for a varint, returning a pointer past the end of the varint, or -// NULL if there was an error in the varint data. -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_SkipVarint(const char* ptr) { - uint64_t val; - return upb_WireReader_ReadVarint(ptr, &val); -} - -// Reads a varint indicating the size of a delimited field into `size`, or -// NULL if there was an error in the varint data. -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_ReadSize(const char* ptr, int* size) { - uint64_t size64; - ptr = upb_WireReader_ReadVarint(ptr, &size64); - if (!ptr || size64 >= INT32_MAX) return NULL; - *size = size64; - return ptr; -} - -// Reads a fixed32 field, performing byte swapping if necessary. -// -// REQUIRES: there must be at least 4 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_ReadFixed32(const char* ptr, void* val) { - uint32_t uval; - memcpy(&uval, ptr, 4); - uval = upb_BigEndian32(uval); - memcpy(val, &uval, 4); - return ptr + 4; -} - -// Reads a fixed64 field, performing byte swapping if necessary. -// -// REQUIRES: there must be at least 4 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -UPB_INLINE const char* upb_WireReader_ReadFixed64(const char* ptr, void* val) { - uint64_t uval; - memcpy(&uval, ptr, 8); - uval = upb_BigEndian64(uval); - memcpy(val, &uval, 8); - return ptr + 8; -} - -const char* UPB_PRIVATE(_upb_WireReader_SkipGroup)( - const char* ptr, uint32_t tag, int depth_limit, - upb_EpsCopyInputStream* stream); - -// Skips data for a group, returning a pointer past the end of the group, or -// NULL if there was an error parsing the group. The `tag` argument should be -// the start group tag that begins the group. The `depth_limit` argument -// indicates how many levels of recursion the group is allowed to have before -// reporting a parse error (this limit exists to protect against stack -// overflow). -// -// TODO: evaluate how the depth_limit should be specified. Do users need -// control over this? -UPB_INLINE const char* upb_WireReader_SkipGroup( - const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { - return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, 100, stream); -} - -UPB_INLINE const char* _upb_WireReader_SkipValue( - const char* ptr, uint32_t tag, int depth_limit, - upb_EpsCopyInputStream* stream) { - switch (upb_WireReader_GetWireType(tag)) { - case kUpb_WireType_Varint: - return upb_WireReader_SkipVarint(ptr); - case kUpb_WireType_32Bit: - return ptr + 4; - case kUpb_WireType_64Bit: - return ptr + 8; - case kUpb_WireType_Delimited: { - int size; - ptr = upb_WireReader_ReadSize(ptr, &size); - if (!ptr) return NULL; - ptr += size; - return ptr; - } - case kUpb_WireType_StartGroup: - return UPB_PRIVATE(_upb_WireReader_SkipGroup)(ptr, tag, depth_limit, - stream); - case kUpb_WireType_EndGroup: - return NULL; // Should be handled before now. - default: - return NULL; // Unknown wire type. - } -} - -// Skips data for a wire value of any type, returning a pointer past the end of -// the data, or NULL if there was an error parsing the group. The `tag` argument -// should be the tag that was just parsed. The `depth_limit` argument indicates -// how many levels of recursion a group is allowed to have before reporting a -// parse error (this limit exists to protect against stack overflow). -// -// REQUIRES: there must be at least 10 bytes of data available at `ptr`. -// Bounds checks must be performed before calling this function, preferably -// by calling upb_EpsCopyInputStream_IsDone(). -// -// TODO: evaluate how the depth_limit should be specified. Do users need -// control over this? -UPB_INLINE const char* upb_WireReader_SkipValue( - const char* ptr, uint32_t tag, upb_EpsCopyInputStream* stream) { - return _upb_WireReader_SkipValue(ptr, tag, 100, stream); -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - - -#endif // UPB_WIRE_READER_H_ - #ifndef UPB_LEX_STRTOD_H_ #define UPB_LEX_STRTOD_H_ @@ -14894,7 +15568,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n, // features. This is used for feature resolution under Editions. // NOLINTBEGIN // clang-format off -#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\023\030\204\007\"\000*\014\010\001\020\002\030\002 \003(\0010\002\n\023\030\347\007\"\000*\014\010\002\020\001\030\001 \002(\0010\001\n\023\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\000 \346\007(\350\007" +#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\025\030\204\007\"\000*\016\010\001\020\002\030\002 \003(\0010\0028\002\n\025\030\347\007\"\000*\016\010\002\020\001\030\001 \002(\0010\0018\002\n\025\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\0028\002 \346\007(\350\007" // clang-format on // NOLINTEND @@ -15134,16 +15808,53 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #endif /* UPB_REFLECTION_METHOD_DEF_INTERNAL_H_ */ +#ifndef UPB_UTIL_DEF_TO_PROTO_H_ +#define UPB_UTIL_DEF_TO_PROTO_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + +// Functions for converting defs back to the equivalent descriptor proto. +// Ultimately the goal is that a round-trip proto->def->proto is lossless. Each +// function returns a new proto created in arena `a`, or NULL if memory +// allocation failed. +google_protobuf_DescriptorProto* upb_MessageDef_ToProto(const upb_MessageDef* m, + upb_Arena* a); +google_protobuf_EnumDescriptorProto* upb_EnumDef_ToProto(const upb_EnumDef* e, + upb_Arena* a); +google_protobuf_EnumValueDescriptorProto* upb_EnumValueDef_ToProto( + const upb_EnumValueDef* e, upb_Arena* a); +google_protobuf_FieldDescriptorProto* upb_FieldDef_ToProto( + const upb_FieldDef* f, upb_Arena* a); +google_protobuf_OneofDescriptorProto* upb_OneofDef_ToProto( + const upb_OneofDef* o, upb_Arena* a); +google_protobuf_FileDescriptorProto* upb_FileDef_ToProto(const upb_FileDef* f, + upb_Arena* a); +google_protobuf_MethodDescriptorProto* upb_MethodDef_ToProto( + const upb_MethodDef* m, upb_Arena* a); +google_protobuf_ServiceDescriptorProto* upb_ServiceDef_ToProto( + const upb_ServiceDef* s, upb_Arena* a); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* UPB_UTIL_DEF_TO_PROTO_H_ */ + // This should #undef all macros #defined in def.inc #undef UPB_SIZE #undef UPB_PTR_AT +#undef UPB_SIZEOF_FLEX #undef UPB_MAPTYPE_STRING #undef UPB_EXPORT #undef UPB_INLINE #undef UPB_API #undef UPBC_API #undef UPB_API_INLINE +#undef UPB_API_INLINE_IF_NOT_GCC #undef UPB_ALIGN_UP #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC @@ -15152,6 +15863,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN @@ -15162,6 +15874,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASSUME #undef UPB_ASSERT #undef UPB_UNREACHABLE +#undef UPB_DEFAULT_MAX_BLOCK_SIZE #undef UPB_SETJMP #undef UPB_LONGJMP #undef UPB_PTRADD @@ -15175,6 +15888,12 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_ASAN #undef UPB_ASAN_GUARD_SIZE #undef UPB_CLANG_ASAN +#undef UPB_TSAN_PUBLISHED_MEMBER +#undef UPB_TSAN_INIT_PUBLISHED +#undef UPB_TSAN_CHECK_PUBLISHED +#undef UPB_TSAN_PUBLISH +#undef UPB_TSAN_CHECK_READ +#undef UPB_TSAN_CHECK_WRITE #undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN #undef UPB_DEPRECATED #undef UPB_GNUC_MIN @@ -15184,6 +15903,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_IS_GOOGLE3 #undef UPB_ATOMIC #undef UPB_USE_C11_ATOMICS +#undef UPB_USE_MSC_ATOMICS #undef UPB_PRIVATE #undef UPB_ONLYBITS #undef UPB_LINKARR_DECLARE @@ -15191,4 +15911,3 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n, #undef UPB_LINKARR_START #undef UPB_LINKARR_STOP #undef UPB_FUTURE_BREAKING_CHANGES -#undef UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT diff --git a/third_party/protobuf/ruby/google-protobuf.gemspec b/third_party/protobuf/ruby/google-protobuf.gemspec index 3ce29a4b22a7b..c899bbd52bdd6 100644 --- a/third_party/protobuf/ruby/google-protobuf.gemspec +++ b/third_party/protobuf/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "4.29.3" + s.version = "4.30.1" git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag s.licenses = ["BSD-3-Clause"] s.summary = "Protocol Buffers" diff --git a/third_party/protobuf/ruby/lib/google/BUILD.bazel b/third_party/protobuf/ruby/lib/google/BUILD.bazel index e5aaceab911ce..5530bb17b0fba 100644 --- a/third_party/protobuf/ruby/lib/google/BUILD.bazel +++ b/third_party/protobuf/ruby/lib/google/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_java//java:java_binary.bzl", "java_binary") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_ruby//ruby:defs.bzl", "ruby_library") diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/descriptor.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/descriptor.rb index ee52a5cbe8819..c30da20b409c3 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/descriptor.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/descriptor.rb @@ -106,6 +106,15 @@ module Google end end + def to_proto + @to_proto ||= begin + size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) + temporary_arena = Google::Protobuf::FFI.create_arena + buffer = Google::Protobuf::FFI.message_to_proto(self, size_ptr, temporary_arena) + Google::Protobuf::DescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) + end + end + private extend Google::Protobuf::Internal::Convert @@ -160,6 +169,7 @@ module Google attach_function :message_options, :Descriptor_serialized_options, [Descriptor, :pointer, Internal::Arena], :pointer attach_function :get_well_known_type, :upb_MessageDef_WellKnownType, [Descriptor], WellKnown attach_function :find_msg_def_by_name, :upb_MessageDef_FindByNameWithSize, [Descriptor, :string, :size_t, :FieldDefPointer, :OneofDefPointer], :bool + attach_function :message_to_proto, :Descriptor_serialized_to_proto, [Descriptor, :pointer, Internal::Arena], :pointer end end end diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/enum_descriptor.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/enum_descriptor.rb index e7ce04dab0abb..f95e0915ee0d0 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/enum_descriptor.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/enum_descriptor.rb @@ -90,6 +90,15 @@ module Google end end + def to_proto + @to_proto ||= begin + size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) + temporary_arena = Google::Protobuf::FFI.create_arena + buffer = Google::Protobuf::FFI.enum_to_proto(self, size_ptr, temporary_arena) + Google::Protobuf::EnumDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) + end + end + private def initialize(enum_def, descriptor_pool) @@ -164,6 +173,7 @@ module Google attach_function :enum_value_by_number, :upb_EnumDef_FindValueByNumber, [EnumDescriptor, :int], :EnumValueDef attach_function :get_enum_fullname, :upb_EnumDef_FullName, [EnumDescriptor], :string attach_function :enum_options, :EnumDescriptor_serialized_options, [EnumDescriptor, :pointer, Internal::Arena], :pointer + attach_function :enum_to_proto, :EnumDescriptor_serialized_to_proto, [EnumDescriptor, :pointer, Internal::Arena], :pointer attach_function :enum_value_by_index, :upb_EnumDef_Value, [EnumDescriptor, :int], :EnumValueDef attach_function :enum_value_count, :upb_EnumDef_ValueCount, [EnumDescriptor], :int attach_function :enum_name, :upb_EnumValueDef_Name, [:EnumValueDef], :string diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/ffi.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/ffi.rb index 0270f9778c3f0..eac476d07c5da 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/ffi.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/ffi.rb @@ -38,7 +38,6 @@ module Google ## JSON Decoding results Upb_JsonDecodeResult_Ok = 0 - Upb_JsonDecodeResult_OkWithEmptyStringNumerics = 1 Upb_JsonDecodeResult_Error = 2 typedef :pointer, :Array diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/field_descriptor.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/field_descriptor.rb index 632692b75db94..5d6bfa48f19f4 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/field_descriptor.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/field_descriptor.rb @@ -225,6 +225,15 @@ module Google end end + def to_proto + @to_proto ||= begin + size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) + temporary_arena = Google::Protobuf::FFI.create_arena + buffer = Google::Protobuf::FFI.field_to_proto(self, size_ptr, temporary_arena) + Google::Protobuf::FieldDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) + end + end + private def initialize(field_def, descriptor_pool) @@ -325,6 +334,7 @@ module Google attach_function :get_number, :upb_FieldDef_Number, [FieldDescriptor], :uint32_t attach_function :get_type, :upb_FieldDef_Type, [FieldDescriptor], FieldType attach_function :file_def_by_raw_field_def, :upb_FieldDef_File, [:pointer], :FileDef + attach_function :field_to_proto, :FieldDescriptor_serialized_to_proto,[FieldDescriptor, :pointer, Internal::Arena], :pointer end end end diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/file_descriptor.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/file_descriptor.rb index 2a7bf87e6d39b..7c3de9f1756c2 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/file_descriptor.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/file_descriptor.rb @@ -12,6 +12,7 @@ module Google attach_function :file_def_name, :upb_FileDef_Name, [:FileDef], :string attach_function :file_def_pool, :upb_FileDef_Pool, [:FileDef], :DefPool attach_function :file_options, :FileDescriptor_serialized_options, [:FileDef, :pointer, Internal::Arena], :pointer + attach_function :file_to_proto, :FileDescriptor_serialized_to_proto, [:FileDef, :pointer, Internal::Arena], :pointer end class FileDescriptor @@ -44,6 +45,15 @@ module Google opts.freeze end end + + def to_proto + @to_proto ||= begin + size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) + temporary_arena = Google::Protobuf::FFI.create_arena + buffer = Google::Protobuf::FFI.file_to_proto(@file_def, size_ptr, temporary_arena) + Google::Protobuf::FileDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) + end + end end end end diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/internal/convert.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/internal/convert.rb index b22184e419790..649b90ad14e40 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/internal/convert.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/internal/convert.rb @@ -36,11 +36,7 @@ module Google value = value.to_s if value.is_a?(Symbol) if value.encoding == Encoding::UTF_8 unless value.valid_encoding? - # TODO: - # For now we only warn for this case. We will remove the - # warning and throw an exception below in the 30.x release - warn "String is invalid UTF-8. This will be an error in a future version." - # raise Encoding::InvalidByteSequenceError.new "String is invalid UTF-8" + raise Encoding::InvalidByteSequenceError.new "String is invalid UTF-8" end string_value = value else diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/message.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/message.rb index 4b02ae52c9f2d..4a4881302166f 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/message.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/message.rb @@ -22,7 +22,7 @@ module Google attach_function :decode_message, :upb_Decode, [:binary_string, :size_t, :Message, MiniTable.by_ref, :ExtensionRegistry, :int, Internal::Arena], DecodeStatus attach_function :get_mutable_message, :upb_Message_Mutable, [:Message, FieldDescriptor, Internal::Arena], MutableMessageValue.by_value attach_function :get_message_which_oneof, :upb_Message_WhichOneofByDef, [:Message, OneofDescriptor], FieldDescriptor - attach_function :message_discard_unknown, :upb_Message_DiscardUnknown, [:Message, Descriptor, :int], :bool + attach_function :message_discard_unknown, :upb_Message_DiscardUnknown, [:Message, Descriptor, :DefPool, :int], :bool attach_function :message_next, :upb_Message_Next, [:Message, Descriptor, :DefPool, :FieldDefPointer, MessageValue.by_ref, :pointer], :bool attach_function :message_freeze, :upb_Message_Freeze, [:Message, MiniTable.by_ref], :void attach_function :message_frozen?, :upb_Message_IsFrozen, [:Message], :bool @@ -272,8 +272,6 @@ module Google status = Google::Protobuf::FFI::Status.new result = Google::Protobuf::FFI.json_decode_message_detecting_nonconformance(data, data.bytesize, message.instance_variable_get(:@msg), message.class.descriptor, pool_def, decoding_options, message.instance_variable_get(:@arena), status) case result - when Google::Protobuf::FFI::Upb_JsonDecodeResult_OkWithEmptyStringNumerics - warn Google::Protobuf::FFI.error_message(status) when Google::Protobuf::FFI::Upb_JsonDecodeResult_Error raise ParseError.new "Error occurred during parsing: #{Google::Protobuf::FFI.error_message(status)}" end diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/method_descriptor.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/method_descriptor.rb index b7bbf0af08747..f879d49c070f7 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/method_descriptor.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/method_descriptor.rb @@ -7,7 +7,7 @@ module Google module Protobuf - class MethodDescriptor + class MethodDescriptor attr :method_def, :descriptor_pool include Google::Protobuf::Internal::Convert @@ -81,6 +81,15 @@ module Google @server_streaming ||= Google::Protobuf::FFI.method_server_streaming(self) end + def to_proto + @to_proto ||= begin + size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) + temporary_arena = Google::Protobuf::FFI.create_arena + buffer = Google::Protobuf::FFI.method_to_proto(self, size_ptr, temporary_arena) + Google::Protobuf::MethodDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) + end + end + private def initialize(method_def, descriptor_pool) @@ -108,6 +117,7 @@ module Google attach_function :method_output_type, :upb_MethodDef_OutputType, [MethodDescriptor], Descriptor attach_function :method_client_streaming, :upb_MethodDef_ClientStreaming, [MethodDescriptor], :bool attach_function :method_server_streaming, :upb_MethodDef_ServerStreaming, [MethodDescriptor], :bool + attach_function :method_to_proto, :MethodDescriptor_serialized_to_proto, [MethodDescriptor, :pointer, Internal::Arena], :pointer end end end diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/oneof_descriptor.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/oneof_descriptor.rb index 65050ef0acb69..3733900c499c6 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/oneof_descriptor.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/oneof_descriptor.rb @@ -64,6 +64,15 @@ module Google end end + def to_proto + @to_proto ||= begin + size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) + temporary_arena = Google::Protobuf::FFI.create_arena + buffer = Google::Protobuf::FFI.oneof_to_proto(self, size_ptr, temporary_arena) + Google::Protobuf::OneofDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) + end + end + private def initialize(oneof_def, descriptor_pool) @@ -89,6 +98,7 @@ module Google attach_function :get_oneof_field_by_index, :upb_OneofDef_Field, [OneofDescriptor, :int], FieldDescriptor attach_function :get_oneof_containing_type,:upb_OneofDef_ContainingType, [:pointer], Descriptor attach_function :oneof_options, :OneOfDescriptor_serialized_options, [OneofDescriptor, :pointer, Internal::Arena], :pointer + attach_function :oneof_to_proto, :OneOfDescriptor_serialized_to_proto, [OneofDescriptor, :pointer, Internal::Arena], :pointer # FieldDescriptor attach_function :real_containing_oneof, :upb_FieldDef_RealContainingOneof, [FieldDescriptor], OneofDescriptor diff --git a/third_party/protobuf/ruby/lib/google/protobuf/ffi/service_descriptor.rb b/third_party/protobuf/ruby/lib/google/protobuf/ffi/service_descriptor.rb index d8554d379d6d0..72fd679c51f6a 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf/ffi/service_descriptor.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf/ffi/service_descriptor.rb @@ -77,10 +77,19 @@ module Google end end + def to_proto + @to_proto ||= begin + size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) + temporary_arena = Google::Protobuf::FFI.create_arena + buffer = Google::Protobuf::FFI.service_to_proto(self, size_ptr, temporary_arena) + Google::Protobuf::ServiceDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) + end + end + private def initialize(service_def, descriptor_pool) - @service_def = service_def + @service_def = service_def @descriptor_pool = descriptor_pool end @@ -102,6 +111,7 @@ module Google attach_function :method_count, :upb_ServiceDef_MethodCount, [ServiceDescriptor], :int attach_function :get_method_by_index, :upb_ServiceDef_Method, [ServiceDescriptor, :int], MethodDescriptor attach_function :service_options, :ServiceDescriptor_serialized_options, [ServiceDescriptor, :pointer, Internal::Arena], :pointer + attach_function :service_to_proto, :ServiceDescriptor_serialized_to_proto, [ServiceDescriptor, :pointer, Internal::Arena], :pointer end end end diff --git a/third_party/protobuf/ruby/lib/google/protobuf_ffi.rb b/third_party/protobuf/ruby/lib/google/protobuf_ffi.rb index 6580df49a1e3d..51f191639f2a9 100644 --- a/third_party/protobuf/ruby/lib/google/protobuf_ffi.rb +++ b/third_party/protobuf/ruby/lib/google/protobuf_ffi.rb @@ -42,7 +42,8 @@ module Google def self.discard_unknown(message) raise FrozenError if message.frozen? raise ArgumentError.new "Expected message, got #{message.class} instead." if message.instance_variable_get(:@msg).nil? - unless Google::Protobuf::FFI.message_discard_unknown(message.instance_variable_get(:@msg), message.class.descriptor, 128) + pool_def = message.class.descriptor.instance_variable_get(:@descriptor_pool).descriptor_pool + unless Google::Protobuf::FFI.message_discard_unknown(message.instance_variable_get(:@msg), message.class.descriptor, pool_def, 128) raise RuntimeError.new "Messages nested too deeply." end nil diff --git a/third_party/protobuf/ruby/pom.xml b/third_party/protobuf/ruby/pom.xml index 1b53786a16f3e..d9cd3b9711cbc 100644 --- a/third_party/protobuf/ruby/pom.xml +++ b/third_party/protobuf/ruby/pom.xml @@ -9,7 +9,7 @@ <groupId>com.google.protobuf.jruby</groupId> <artifactId>protobuf-jruby</artifactId> - <version>4.29.3</version> + <version>4.30.1</version> <name>Protocol Buffer JRuby native extension</name> <description> Protocol Buffers are a way of encoding structured data in an efficient yet @@ -76,7 +76,7 @@ <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java-util</artifactId> - <version>4.29.3</version> + <version>4.30.1</version> </dependency> <dependency> <groupId>org.jruby</groupId> diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java index aa64d1a5e74f2..b41450c97ff12 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java @@ -175,6 +175,27 @@ public class RubyDescriptor extends RubyObject { true); } + /* + * call-seq: + * Descriptor.to_proto => DescriptorProto + * + * Returns the `DescriptorProto` of this `Descriptor`. + */ + @JRubyMethod(name = "to_proto") + public IRubyObject toProto(ThreadContext context) { + RubyDescriptorPool pool = (RubyDescriptorPool) RubyDescriptorPool.generatedPool(null, null); + RubyDescriptor descriptorProto = + (RubyDescriptor) + pool.lookup(context, context.runtime.newString("google.protobuf.DescriptorProto")); + RubyClass msgClass = (RubyClass) descriptorProto.msgclass(context); + RubyMessage msg = (RubyMessage) msgClass.newInstance(context, Block.NULL_BLOCK); + return msg.decodeBytes( + context, + msg, + CodedInputStream.newInstance(descriptor.toProto().toByteString().toByteArray()), /*freeze*/ + true); + } + protected FieldDescriptor getField(String name) { return descriptor.findFieldByName(name); } diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java index 017c9d5394d25..32dd502142e68 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java @@ -100,8 +100,8 @@ public class RubyDescriptorPool extends RubyObject { * call-seq: * DescriptorPool.lookup(name) => descriptor * - * Finds a Descriptor, EnumDescriptor or FieldDescriptor by name and returns it, or nil if none - * exists with the given name. + * Finds a Descriptor, EnumDescriptor, FieldDescriptor or ServiceDescriptor by name and returns it, + * or nil if none exists with the given name. * * This currently lazy loads the ruby descriptor objects as they are requested. * This allows us to leave the heavy lifting to the java library diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java index 3ef946f12d6fd..c280de4d361a5 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java @@ -140,6 +140,27 @@ public class RubyEnumDescriptor extends RubyObject { true); } + /* + * call-seq: + * EnumDescriptor.to_proto => EnumDescriptorProto + * + * Returns the `EnumDescriptorProto` of this `EnumDescriptor`. + */ + @JRubyMethod(name = "to_proto") + public IRubyObject toProto(ThreadContext context) { + RubyDescriptorPool pool = (RubyDescriptorPool) RubyDescriptorPool.generatedPool(null, null); + RubyDescriptor enumDescriptorProto = + (RubyDescriptor) + pool.lookup(context, context.runtime.newString("google.protobuf.EnumDescriptorProto")); + RubyClass msgClass = (RubyClass) enumDescriptorProto.msgclass(context); + RubyMessage msg = (RubyMessage) msgClass.newInstance(context, Block.NULL_BLOCK); + return msg.decodeBytes( + context, + msg, + CodedInputStream.newInstance(descriptor.toProto().toByteString().toByteArray()), /*freeze*/ + true); + } + public boolean isValidValue(ThreadContext context, IRubyObject value) { EnumValueDescriptor enumValue; diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java index 189d881fbc258..1227a28b6fbb4 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java @@ -273,6 +273,27 @@ public class RubyFieldDescriptor extends RubyObject { true); } + /* + * call-seq: + * FieldDescriptor.to_proto => FieldDescriptorProto + * + * Returns the `FieldDescriptorProto` of this `FieldDescriptor`. + */ + @JRubyMethod(name = "to_proto") + public IRubyObject toProto(ThreadContext context) { + RubyDescriptorPool pool = (RubyDescriptorPool) RubyDescriptorPool.generatedPool(null, null); + RubyDescriptor fieldDescriptorProto = + (RubyDescriptor) + pool.lookup(context, context.runtime.newString("google.protobuf.FieldDescriptorProto")); + RubyClass msgClass = (RubyClass) fieldDescriptorProto.msgclass(context); + RubyMessage msg = (RubyMessage) msgClass.newInstance(context, Block.NULL_BLOCK); + return msg.decodeBytes( + context, + msg, + CodedInputStream.newInstance(descriptor.toProto().toByteString().toByteArray()), /*freeze*/ + true); + } + protected void setDescriptor( ThreadContext context, FieldDescriptor descriptor, RubyDescriptorPool pool) { this.descriptor = descriptor; diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java index f0147d686c338..238926b1e6aad 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java @@ -100,6 +100,28 @@ public class RubyFileDescriptor extends RubyObject { true); } + /* + * call-seq: + * FileDescriptor.to_proto => FileDescriptorProto + * + * Returns the `FileDescriptorProto` of this `FileDescriptor`. + */ + @JRubyMethod(name = "to_proto") + public IRubyObject toProto(ThreadContext context) { + RubyDescriptorPool pool = (RubyDescriptorPool) RubyDescriptorPool.generatedPool(null, null); + RubyDescriptor fileDescriptorProto = + (RubyDescriptor) + pool.lookup(context, context.runtime.newString("google.protobuf.FileDescriptorProto")); + RubyClass msgClass = (RubyClass) fileDescriptorProto.msgclass(context); + RubyMessage msg = (RubyMessage) msgClass.newInstance(context, Block.NULL_BLOCK); + return msg.decodeBytes( + context, + msg, + CodedInputStream.newInstance( + fileDescriptor.toProto().toByteString().toByteArray()), /*freeze*/ + true); + } + private static RubyClass cFileDescriptor; private FileDescriptor fileDescriptor; diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java index 2b533dfc45063..d073c54bb16a0 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java @@ -454,7 +454,9 @@ public class RubyMessage extends RubyObject { fieldDescriptor = descriptor.findFieldByName(methodName); if (fieldDescriptor != null && fieldDescriptor.hasPresence()) { - return fields.containsKey(fieldDescriptor) ? runtime.getTrue() : runtime.getFalse(); + return (fields.containsKey(fieldDescriptor) || builder.hasField(fieldDescriptor)) + ? runtime.getTrue() + : runtime.getFalse(); } } else if (methodName.endsWith(AS_VALUE_SUFFIX)) { @@ -952,7 +954,7 @@ public class RubyMessage extends RubyObject { if (!fieldDescriptor.hasPresence()) { throw context.runtime.newArgumentError("does not track presence"); } - return fields.containsKey(fieldDescriptor) + return (fields.containsKey(fieldDescriptor) || builder.hasField(fieldDescriptor)) ? context.runtime.getTrue() : context.runtime.getFalse(); } diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMethodDescriptor.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMethodDescriptor.java index 1f339357934a8..4d2a28f62ca97 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMethodDescriptor.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMethodDescriptor.java @@ -148,6 +148,28 @@ public class RubyMethodDescriptor extends RubyObject { : context.runtime.getFalse(); } + /* + * call-seq: + * MethodDescriptor.to_proto => MethodDescriptorProto + * + * Returns the `MethodDescriptorProto` of this `MethodDescriptor`. + */ + @JRubyMethod(name = "to_proto") + public IRubyObject toProto(ThreadContext context) { + RubyDescriptorPool pool = (RubyDescriptorPool) RubyDescriptorPool.generatedPool(null, null); + RubyDescriptor methodDescriptorProto = + (RubyDescriptor) + pool.lookup( + context, context.runtime.newString("google.protobuf.MethodDescriptorProto")); + RubyClass msgClass = (RubyClass) methodDescriptorProto.msgclass(context); + RubyMessage msg = (RubyMessage) msgClass.newInstance(context, Block.NULL_BLOCK); + return msg.decodeBytes( + context, + msg, + CodedInputStream.newInstance(descriptor.toProto().toByteString().toByteArray()), /*freeze*/ + true); + } + protected void setDescriptor( ThreadContext context, MethodDescriptor descriptor, RubyDescriptorPool pool) { this.descriptor = descriptor; diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java index 36fe2d0e8a5f5..82e55a28af931 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java @@ -83,6 +83,27 @@ public class RubyOneofDescriptor extends RubyObject { true); } + /* + * call-seq: + * OneofDescriptor.to_proto => OneofDescriptor + * + * Returns the `OneofDescriptorProto` of this `OneofDescriptor`. + */ + @JRubyMethod(name = "to_proto") + public IRubyObject toProto(ThreadContext context) { + RubyDescriptorPool pool = (RubyDescriptorPool) RubyDescriptorPool.generatedPool(null, null); + RubyDescriptor oneofDescriptorProto = + (RubyDescriptor) + pool.lookup(context, context.runtime.newString("google.protobuf.OneofDescriptorProto")); + RubyClass msgClass = (RubyClass) oneofDescriptorProto.msgclass(context); + RubyMessage msg = (RubyMessage) msgClass.newInstance(context, Block.NULL_BLOCK); + return msg.decodeBytes( + context, + msg, + CodedInputStream.newInstance(descriptor.toProto().toByteString().toByteArray()), /*freeze*/ + true); + } + protected Collection<RubyFieldDescriptor> getFields() { return fields; } diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyServiceDescriptor.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyServiceDescriptor.java index 0a7a7e346efdc..fd9fde5227e17 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyServiceDescriptor.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyServiceDescriptor.java @@ -129,6 +129,28 @@ public class RubyServiceDescriptor extends RubyObject { return context.nil; } + /* + * call-seq: + * ServiceDescriptor.to_proto => ServiceDescriptorProto + * + * Returns the `ServiceDescriptorProto` of this `ServiceDescriptor`. + */ + @JRubyMethod(name = "to_proto") + public IRubyObject toProto(ThreadContext context) { + RubyDescriptorPool pool = (RubyDescriptorPool) RubyDescriptorPool.generatedPool(null, null); + RubyDescriptor serviceDescriptorProto = + (RubyDescriptor) + pool.lookup( + context, context.runtime.newString("google.protobuf.ServiceDescriptorProto")); + RubyClass msgClass = (RubyClass) serviceDescriptorProto.msgclass(context); + RubyMessage msg = (RubyMessage) msgClass.newInstance(context, Block.NULL_BLOCK); + return msg.decodeBytes( + context, + msg, + CodedInputStream.newInstance(descriptor.toProto().toByteString().toByteArray()), /*freeze*/ + true); + } + protected void setDescriptor( ThreadContext context, ServiceDescriptor descriptor, RubyDescriptorPool pool) { this.descriptor = descriptor; diff --git a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/Utils.java b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/Utils.java index c42bfd454d5d0..3ac31ab5b97f0 100644 --- a/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/Utils.java +++ b/third_party/protobuf/ruby/src/main/java/com/google/protobuf/jruby/Utils.java @@ -331,6 +331,15 @@ public class Utils { && fieldDescriptor.getMessageType().getOptions().getMapEntry(); } + public static RaiseException createInvalidByteSequenceError( + ThreadContext context, String message) { + if (cInvalidByteSequenceError == null) { + cInvalidByteSequenceError = + (RubyClass) context.runtime.getClassFromPath("Encoding::InvalidByteSequenceError"); + } + return RaiseException.from(context.runtime, cInvalidByteSequenceError, message); + } + public static RaiseException createTypeError(ThreadContext context, String message) { if (cTypeError == null) { cTypeError = (RubyClass) context.runtime.getClassFromPath("Google::Protobuf::TypeError"); @@ -393,12 +402,7 @@ public class Utils { RubyString string = (RubyString) value; if (encoding == UTF8Encoding.INSTANCE && string.getEncoding().isUTF8()) { if (string.isCodeRangeBroken()) { - // TODO: For now we only warn for - // this case. We will remove the warning and throw an exception in the 30.x release - context - .runtime - .getWarnings() - .warn("String is invalid UTF-8. This will be an error in a future version."); + throw createInvalidByteSequenceError(context, "String is invalid UTF-8."); } } @@ -424,4 +428,5 @@ public class Utils { private static final long UINT_MAX = 0xffffffffl; private static RubyClass cTypeError; + private static RubyClass cInvalidByteSequenceError; } diff --git a/third_party/protobuf/ruby/tests/BUILD.bazel b/third_party/protobuf/ruby/tests/BUILD.bazel index f61982eb1cb78..581df17568a75 100644 --- a/third_party/protobuf/ruby/tests/BUILD.bazel +++ b/third_party/protobuf/ruby/tests/BUILD.bazel @@ -162,6 +162,26 @@ ruby_test( ], ) +ruby_test( + name = "service_test", + srcs = ["service_test.rb"], + deps = [ + ":test_ruby_protos", + "//ruby:protobuf", + "@protobuf_bundle//:test-unit", + ], +) + +ruby_test( + name = "memory_test", + srcs = ["memory_test.rb"], + deps = [ + ":test_ruby_protos", + "//ruby:protobuf", + "@protobuf_bundle//:test-unit", + ], +) + pkg_files( name = "dist_files", srcs = glob([ diff --git a/third_party/protobuf/ruby/tests/basic.rb b/third_party/protobuf/ruby/tests/basic.rb index a55f921011cc7..afff9c7907686 100755 --- a/third_party/protobuf/ruby/tests/basic.rb +++ b/third_party/protobuf/ruby/tests/basic.rb @@ -656,6 +656,12 @@ module BasicTest assert file_descriptor.options.deprecated end + def test_file_descriptor_to_proto + file_descriptor = TestMessage.descriptor.file_descriptor + + assert_instance_of Google::Protobuf::FileDescriptorProto, file_descriptor.to_proto + end + def test_field_descriptor_options field_descriptor = TestDeprecatedMessage.descriptor.lookup("foo") @@ -663,6 +669,12 @@ module BasicTest assert field_descriptor.options.deprecated end + def test_field_descriptor_to_proto + field_descriptor = TestDeprecatedMessage.descriptor.lookup("foo") + + assert_instance_of Google::Protobuf::FieldDescriptorProto, field_descriptor.to_proto + end + def test_descriptor_options descriptor = TestDeprecatedMessage.descriptor @@ -670,6 +682,12 @@ module BasicTest assert descriptor.options.deprecated end + def test_descriptor_to_proto + descriptor = TestDeprecatedMessage.descriptor + + assert_instance_of Google::Protobuf::DescriptorProto, descriptor.to_proto + end + def test_enum_descriptor_options enum_descriptor = TestDeprecatedEnum.descriptor @@ -677,6 +695,12 @@ module BasicTest assert enum_descriptor.options.deprecated end + def test_enum_descriptor_to_proto + enum_descriptor = TestDeprecatedEnum.descriptor + + assert_instance_of Google::Protobuf::EnumDescriptorProto, enum_descriptor.to_proto + end + def test_oneof_descriptor_options descriptor = TestDeprecatedMessage.descriptor oneof_descriptor = descriptor.lookup_oneof("test_deprecated_message_oneof") @@ -687,6 +711,13 @@ module BasicTest assert_equal "Custom option value", test_top_level_option.get(oneof_descriptor.options) end + def test_oneof_descriptor_to_proto + descriptor = TestDeprecatedMessage.descriptor + oneof_descriptor = descriptor.lookup_oneof("test_deprecated_message_oneof") + + assert_instance_of Google::Protobuf::OneofDescriptorProto, oneof_descriptor.to_proto + end + def test_nested_extension descriptor = TestDeprecatedMessage.descriptor oneof_descriptor = descriptor.lookup_oneof("test_deprecated_message_oneof") diff --git a/third_party/protobuf/ruby/tests/basic_proto2.rb b/third_party/protobuf/ruby/tests/basic_proto2.rb index 2112732664166..a14ab16591664 100755 --- a/third_party/protobuf/ruby/tests/basic_proto2.rb +++ b/third_party/protobuf/ruby/tests/basic_proto2.rb @@ -43,6 +43,15 @@ module BasicTestProto2 m = TestMessage.new(:optional_int32 => nil) refute m.has_optional_int32? + refute TestMessage.descriptor.lookup('optional_int32').has?(m) + + m = TestMessage.new(:optional_int32 => 0) + assert m.has_optional_int32? + assert TestMessage.descriptor.lookup('optional_int32').has?(m) + + m = TestMessage.decode(TestMessage.encode(m)) + assert m.has_optional_int32? + assert TestMessage.descriptor.lookup('optional_int32').has?(m) assert_raises NoMethodError do m.has_repeated_msg? diff --git a/third_party/protobuf/ruby/tests/encode_decode_test.rb b/third_party/protobuf/ruby/tests/encode_decode_test.rb index 41355fd7b612b..53b28b190b373 100755 --- a/third_party/protobuf/ruby/tests/encode_decode_test.rb +++ b/third_party/protobuf/ruby/tests/encode_decode_test.rb @@ -38,36 +38,14 @@ end class NonConformantNumericsTest < Test::Unit::TestCase def test_empty_json_numerics - if defined? JRUBY_VERSION and Google::Protobuf::IMPLEMENTATION != :FFI - # In a future version, CRuby and JRuby FFI will also have this behavior. - assert_raises Google::Protobuf::ParseError do - msg = ::BasicTestProto2::TestMessage.decode_json('{"optionalInt32":""}') - end - else - warnings = CaptureWarnings.capture { - msg = ::BasicTestProto2::TestMessage.decode_json('{"optionalInt32":""}') - assert_equal 0, msg.optional_int32 - assert msg.has_optional_int32? - } - assert_equal 1, warnings.size - assert_match "Empty string is not a valid number (field: basic_test_proto2.TestMessage.optional_int32)", warnings[0] + assert_raises Google::Protobuf::ParseError do + msg = ::BasicTestProto2::TestMessage.decode_json('{"optionalInt32":""}') end end def test_trailing_non_numeric_characters - if defined? JRUBY_VERSION and Google::Protobuf::IMPLEMENTATION != :FFI - # In a future version, CRuby and JRuby FFI will also have this behavior. - assert_raises Google::Protobuf::ParseError do - msg = ::BasicTestProto2::TestMessage.decode_json('{"optionalDouble":"123abc"}') - end - else - warnings = CaptureWarnings.capture { - msg = ::BasicTestProto2::TestMessage.decode_json('{"optionalDouble":"123abc"}') - assert_equal 123, msg.optional_double - assert msg.has_optional_double? - } - assert_equal 1, warnings.size - assert_match "Non-number characters in quoted number (field: basic_test_proto2.TestMessage.optional_double)", warnings[0] + assert_raises Google::Protobuf::ParseError do + msg = ::BasicTestProto2::TestMessage.decode_json('{"optionalDouble":"123abc"}') end end end diff --git a/third_party/protobuf/ruby/tests/memory_test.rb b/third_party/protobuf/ruby/tests/memory_test.rb index e8c638a1c434c..477b23fbb9ba0 100755 --- a/third_party/protobuf/ruby/tests/memory_test.rb +++ b/third_party/protobuf/ruby/tests/memory_test.rb @@ -7,6 +7,8 @@ require 'test/unit' require 'objspace' require 'test_import_pb' +return if defined?(JRUBY_VERSION) || Google::Protobuf::IMPLEMENTATION != :NATIVE + $is_64bit = Google::Protobuf::Internal::SIZEOF_LONG == 8 class MemoryTest < Test::Unit::TestCase diff --git a/third_party/protobuf/ruby/tests/repeated_field_test.rb b/third_party/protobuf/ruby/tests/repeated_field_test.rb index 143a9ead06a5b..e4983a566f2cc 100755 --- a/third_party/protobuf/ruby/tests/repeated_field_test.rb +++ b/third_party/protobuf/ruby/tests/repeated_field_test.rb @@ -18,15 +18,17 @@ class RepeatedFieldTest < Test::Unit::TestCase def test_acts_like_an_array m = TestMessage.new arr_methods = ([].methods - TestMessage.new.repeated_string.methods) - # jRuby additions to the Array class that we can ignore + # JRuby additions to the Array class that we ignore arr_methods -= [ :indices, :iter_for_each, :iter_for_each_index, :iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple, :nitems, :iter_for_reverse_each, :indexes, :append, :prepend] arr_methods -= [:filter!] - # ruby 2.7 methods we can ignore + # ruby 2.7 methods we ignore arr_methods -= [:deconstruct, :resolve_feature_path] - # ruby 3.1 methods we can ignore + # ruby 3.1 methods we ignore arr_methods -= [:intersect?] + # ruby 3.4 methods we ignore + arr_methods -= [:fetch_values] arr_methods.each do |method_name| assert_respond_to m.repeated_string, method_name end diff --git a/third_party/protobuf/ruby/tests/service_test.rb b/third_party/protobuf/ruby/tests/service_test.rb index 729b7995994ac..2cd1e2f7b5474 100644 --- a/third_party/protobuf/ruby/tests/service_test.rb +++ b/third_party/protobuf/ruby/tests/service_test.rb @@ -23,7 +23,10 @@ class ServiceTest < Test::Unit::TestCase end def test_method_iteration - @test_service.each { |method| assert_kind_of Google::Protobuf::MethodDescriptor, method } + @test_service.each do |method| + assert_kind_of Google::Protobuf::MethodDescriptor, method + assert_instance_of Google::Protobuf::MethodDescriptorProto, method.to_proto + end assert_equal %w(UnaryOne UnaryTwo), @test_service.map { |method| method.name }.first(2) end @@ -33,10 +36,15 @@ class ServiceTest < Test::Unit::TestCase end def test_service_options_extensions + omit "JRuby and FFI do not support service options extensions" if defined?(JRUBY_VERSION) || Google::Protobuf::IMPLEMENTATION != :NATIVE extension_field = Google::Protobuf::DescriptorPool.generated_pool.lookup('service_test_protos.test_options') assert_equal 8325, extension_field.get(@test_service.options).int_option_value end + def test_service_to_proto + assert_instance_of Google::Protobuf::ServiceDescriptorProto, @test_service.to_proto + end + def test_method_options assert_equal :IDEMPOTENT, @test_service_methods['IdempotentMethod'].options.idempotency_level assert_equal :NO_SIDE_EFFECTS, @test_service_methods['PureMethod'].options.idempotency_level diff --git a/third_party/protobuf/ruby/tests/utf8.rb b/third_party/protobuf/ruby/tests/utf8.rb index 6512e18aee758..da74c9ee63958 100644 --- a/third_party/protobuf/ruby/tests/utf8.rb +++ b/third_party/protobuf/ruby/tests/utf8.rb @@ -53,13 +53,10 @@ end # Tests the case of string objects that are marked UTF-8, but contain invalid # UTF-8. # -# For now these only warn, but in the next major version they will throw an -# exception. +# This case will raise Encoding::InvalidByteSequenceError class MarkedUtf8Test < Test::Unit::TestCase def assert_bad_utf8(&block) - warnings = CaptureWarnings.capture(&block) - assert_equal 1, warnings.length - assert_match(/String is invalid UTF-8. This will be an error in a future version./, warnings[0]) + assert_raises(Encoding::InvalidByteSequenceError, &block) end def bad_utf8_string @@ -79,13 +76,10 @@ if !defined? JRUBY_VERSION # valid UTF-8, but are later modified to be invalid UTF-8. This may put the # string into an state of "unknown" validity. # - # For now these only warn, but in the next major version they will throw an - # exception. + # This case will raise Encoding::InvalidByteSequenceError class MarkedModifiedUtf8Test < Test::Unit::TestCase def assert_bad_utf8(&block) - warnings = CaptureWarnings.capture(&block) - assert_equal 1, warnings.length - assert_match(/String is invalid UTF-8. This will be an error in a future version./, warnings[0]) + assert_raises(Encoding::InvalidByteSequenceError, &block) end def bad_utf8_string diff --git a/third_party/protobuf/rust/BUILD b/third_party/protobuf/rust/BUILD index 8b6bb61b898dd..e4759961a378a 100644 --- a/third_party/protobuf/rust/BUILD +++ b/third_party/protobuf/rust/BUILD @@ -2,7 +2,6 @@ load("@bazel_skylib//rules:common_settings.bzl", "string_flag") load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix") -load("@rules_pkg//pkg:zip.bzl", "pkg_zip") load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain") @@ -68,6 +67,18 @@ PROTOBUF_SHARED = [ # go/keep-sorted end ] +# All Rust source files; this is used for packaging up a crate. +ALL_RUST_SRCS = PROTOBUF_SHARED + [ + # go/keep-sorted start + "cpp.rs", + "gtest_matchers.rs", + "gtest_matchers_impl.rs", + "protobuf.rs", + "upb.rs", + "utf8.rs", + # go/keep-sorted end +] + # The Rust Protobuf runtime using the upb kernel. # # `rust_upb_proto_library` implicitly depends on this target. This target cannot depend on @@ -160,21 +171,25 @@ rust_library( deps = [":protobuf_cpp"], ) -alias( +rust_library( name = "protobuf_gtest_matchers", - actual = select({ - ":use_upb_kernel": ":protobuf_gtest_matchers_upb", - "//conditions:default": ":protobuf_gtest_matchers_cpp", + testonly = True, + srcs = ["gtest_matchers.rs"], + aliases = select({ + ":use_upb_kernel": {"//rust:protobuf_gtest_matchers_upb": "protobuf_gtest_matchers_impl"}, + "//conditions:default": {"//rust:protobuf_gtest_matchers_cpp": "protobuf_gtest_matchers_impl"}, + }), + visibility = ["//visibility:public"], + deps = select({ + ":use_upb_kernel": [":protobuf_gtest_matchers_upb"], + "//conditions:default": [":protobuf_gtest_matchers_cpp"], }), - visibility = [ - "//visibility:public", - ], ) rust_library( name = "protobuf_gtest_matchers_cpp", testonly = True, - srcs = ["gtest_matchers.rs"], + srcs = ["gtest_matchers_impl.rs"], aliases = { "//rust:protobuf_cpp": "protobuf", }, @@ -188,7 +203,7 @@ rust_library( rust_library( name = "protobuf_gtest_matchers_upb", testonly = True, - srcs = ["gtest_matchers.rs"], + srcs = ["gtest_matchers_impl.rs"], aliases = { "//rust:protobuf_upb": "protobuf", }, @@ -207,6 +222,7 @@ rust_library( proto_lang_toolchain( name = "proto_rust_upb_toolchain", command_line = "--rust_out=$(OUT)", + output_files = "multiple", progress_message = "Generating Rust proto_library %{label}", runtime = ":protobuf_upb", visibility = ["//visibility:public"], @@ -215,6 +231,7 @@ proto_lang_toolchain( proto_lang_toolchain( name = "proto_rust_cpp_toolchain", command_line = "--rust_out=$(OUT)", + output_files = "multiple", progress_message = "Generating Rust proto_library %{label}", runtime = ":protobuf_cpp", visibility = ["//visibility:public"], @@ -244,20 +261,8 @@ config_setting( pkg_files( name = "rust_protobuf_src", - srcs = glob( - [ - "*", - ], - ), + srcs = ALL_RUST_SRCS, strip_prefix = strip_prefix.from_root("rust"), - visibility = ["//:__pkg__"], -) - -pkg_files( - name = "crate_root_files", - srcs = glob(["cargo/**/*"]), - strip_prefix = strip_prefix.from_root("rust/cargo"), - visibility = ["//:__pkg__"], ) pkg_filegroup( @@ -267,6 +272,7 @@ pkg_filegroup( "//rust/upb:rust_protobuf_upb_src", ], prefix = "src", + visibility = ["//rust/release_crates:__subpackages__"], ) pkg_files( @@ -282,57 +288,5 @@ pkg_filegroup( "//upb/cmake:upb_cmake_dist", ], prefix = "libupb", -) - -pkg_zip( - name = "rust_crate", - srcs = [ - ":crate_root_files", - ":rust_protobuf_libupb_src", - ":rust_protobuf_src_dir", - "//:LICENSE", - ], -) - -pkg_files( - name = "protobuf_codegen_files", - srcs = glob(["protobuf_codegen/src/*"]) + ["protobuf_codegen/Cargo.toml"], - strip_prefix = strip_prefix.from_root("rust/protobuf_codegen"), -) - -pkg_zip( - name = "codegen_crate", - srcs = [ - ":protobuf_codegen_files", - "//:LICENSE", - ], - visibility = ["//rust:__pkg__"], -) - -pkg_files( - name = "codegen_example_files", - srcs = glob(["protobuf_codegen/example/**/*"]), - strip_prefix = strip_prefix.from_root("rust/protobuf_codegen/example"), -) - -pkg_zip( - name = "codegen_example", - srcs = [ - ":codegen_example_files", - "//:LICENSE", - ], - visibility = ["//rust:__pkg__"], -) - -sh_binary( - name = "cargo_test", - srcs = ["cargo_test.sh"], - data = [ - ":codegen_crate", - ":codegen_example", - ":rust_crate", - "//:protoc", - "//upb_generator/minitable:protoc-gen-upb_minitable", - ], - deps = ["@bazel_tools//tools/bash/runfiles"], + visibility = ["//rust/release_crates:__subpackages__"], ) diff --git a/third_party/protobuf/rust/aspects.bzl b/third_party/protobuf/rust/aspects.bzl index e156c8e8851cb..07fb7573498c6 100644 --- a/third_party/protobuf/rust/aspects.bzl +++ b/third_party/protobuf/rust/aspects.bzl @@ -10,6 +10,7 @@ load("@rules_rust//rust/private:rustc.bzl", "rustc_compile_action") load("//bazel:upb_minitable_proto_library.bzl", "UpbMinitableCcInfo", "upb_minitable_proto_library_aspect") load("//bazel/common:proto_common.bzl", "proto_common") load("//bazel/common:proto_info.bzl", "ProtoInfo") +load("//bazel/private:cc_proto_aspect.bzl", "cc_proto_aspect") visibility(["//rust/..."]) @@ -24,8 +25,8 @@ CrateMappingInfo = provider( RustProtoInfo = provider( doc = "Rust protobuf provider info", fields = { - "dep_variant_info": "DepVariantInfo for the compiled Rust gencode (also covers its " + - "transitive dependencies)", + "dep_variant_infos": "List of DepVariantInfo for the compiled Rust " + + "gencode (also covers its transitive dependencies)", "crate_mapping": "depset(CrateMappingInfo) containing mappings of all transitive " + "dependencies of the current proto_library.", }, @@ -105,6 +106,12 @@ def _generate_rust_gencode( proto_info = proto_info, extension = ".{}.pb.rs".format("u" if is_upb else "c"), ) + + entry_point_rs_output = actions.declare_file( + "{}.generated.{}.rs".format(ctx.label.name, "u" if is_upb else "c"), + sibling = proto_info.direct_sources[0], + ) + if is_upb: cc_outputs = [] else: @@ -116,9 +123,10 @@ def _generate_rust_gencode( additional_args = ctx.actions.args() additional_args.add( - "--rust_opt=experimental-codegen=enabled,kernel={},bazel_crate_mapping={}".format( + "--rust_opt=experimental-codegen=enabled,kernel={},bazel_crate_mapping={},generated_entry_point_rs_file_name={}".format( "upb" if is_upb else "cpp", crate_mapping.path, + entry_point_rs_output.basename, ), ) @@ -127,11 +135,10 @@ def _generate_rust_gencode( proto_info = proto_info, additional_inputs = depset(direct = [crate_mapping]), additional_args = additional_args, - generated_files = rs_outputs + cc_outputs, + generated_files = [entry_point_rs_output] + rs_outputs + cc_outputs, proto_lang_toolchain_info = proto_lang_toolchain, - plugin_output = ctx.bin_dir.path, ) - return (rs_outputs, cc_outputs) + return (entry_point_rs_output, rs_outputs, cc_outputs) def _get_crate_info(providers): for provider in providers: @@ -197,7 +204,7 @@ def _compile_cc( linking_context = linking_context, ) -def _compile_rust(ctx, attr, src, extra_srcs, deps): +def _compile_rust(ctx, attr, src, extra_srcs, deps, runtime): """Compiles a Rust source file. Eventually this function could be upstreamed into rules_rust and be made present in rust_common. @@ -208,6 +215,7 @@ def _compile_rust(ctx, attr, src, extra_srcs, deps): src (File): The crate root source file to be compiled. extra_srcs ([File]): Additional source files to include in the crate. deps (List[DepVariantInfo]): A list of dependencies needed. + runtime: The protobuf runtime target. Returns: A DepVariantInfo provider. @@ -246,7 +254,11 @@ def _compile_rust(ctx, attr, src, extra_srcs, deps): srcs = depset([src] + extra_srcs), deps = depset(deps), proc_macro_deps = depset([]), - aliases = {}, + # Make "protobuf" into an alias for the runtime. This allows the + # generated code to use a consistent name, even though the actual + # name of the runtime crate varies depending on the protobuf kernel + # and build system. + aliases = {runtime: "protobuf"}, output = lib, metadata = rmeta, edition = "2021", @@ -286,6 +298,26 @@ def _rust_proto_aspect_common(target, ctx, is_upb): if RustProtoInfo in target: return [] + proto_srcs = target[ProtoInfo].direct_sources + proto_deps = getattr(ctx.rule.attr, "deps", []) + transitive_crate_mappings = [] + for dep in proto_deps: + rust_proto_info = dep[RustProtoInfo] + transitive_crate_mappings.append(rust_proto_info.crate_mapping) + + dep_variant_infos = [] + for info in [d[RustProtoInfo].dep_variant_infos for d in proto_deps]: + dep_variant_infos += info + + # If there are no srcs, then this is an alias library (which in Rust acts as a middle + # library in a dependency chain). Don't generate any Rust code for it, but do propagate the + # crate mappings. + if not proto_srcs: + return [RustProtoInfo( + dep_variant_infos = dep_variant_infos, + crate_mapping = depset(transitive = transitive_crate_mappings), + )] + proto_lang_toolchain = ctx.attr._proto_lang_toolchain[proto_common.ProtoLangToolchainInfo] cc_toolchain = find_cpp_toolchain(ctx) toolchain = ctx.toolchains["@rules_rust//rust:toolchain_type"] @@ -297,13 +329,6 @@ def _rust_proto_aspect_common(target, ctx, is_upb): unsupported_features = ctx.disabled_features, ) - proto_srcs = getattr(ctx.rule.files, "srcs", []) - proto_deps = getattr(ctx.rule.attr, "deps", []) - transitive_crate_mappings = [] - for dep in proto_deps: - rust_proto_info = dep[RustProtoInfo] - transitive_crate_mappings.append(rust_proto_info.crate_mapping) - mapping_for_current_target = depset(transitive = transitive_crate_mappings) crate_mapping_file = _register_crate_mapping_write_action( target.label.name, @@ -311,7 +336,7 @@ def _rust_proto_aspect_common(target, ctx, is_upb): mapping_for_current_target, ) - (gencode, thunks) = _generate_rust_gencode( + (entry_point_rs_output, rs_gencode, cc_thunks_gencode) = _generate_rust_gencode( ctx, target[ProtoInfo], proto_lang_toolchain, @@ -333,7 +358,7 @@ def _rust_proto_aspect_common(target, ctx, is_upb): attr = attr, cc_toolchain = cc_toolchain, cc_infos = [target[CcInfo]] + [dep[CcInfo] for dep in ctx.attr._cpp_thunks_deps] + dep_cc_infos, - ) for thunk in thunks]) + ) for thunk in cc_thunks_gencode]) runtime = proto_lang_toolchain.runtime dep_variant_info_for_runtime = DepVariantInfo( @@ -342,19 +367,19 @@ def _rust_proto_aspect_common(target, ctx, is_upb): cc_info = runtime[CcInfo] if CcInfo in runtime else None, build_info = None, ) + dep_variant_info_for_native_gencode = DepVariantInfo(cc_info = thunks_cc_info) dep_variant_info = _compile_rust( ctx = ctx, attr = ctx.rule.attr, - src = gencode[0], - extra_srcs = gencode[1:], - deps = [dep_variant_info_for_runtime, dep_variant_info_for_native_gencode] + ( - [d[RustProtoInfo].dep_variant_info for d in proto_deps] - ), + src = entry_point_rs_output, + extra_srcs = rs_gencode, + deps = [dep_variant_info_for_runtime, dep_variant_info_for_native_gencode] + dep_variant_infos, + runtime = runtime, ) return [RustProtoInfo( - dep_variant_info = dep_variant_info, + dep_variant_infos = [dep_variant_info], crate_mapping = depset( direct = [CrateMappingInfo( crate_name = label_to_crate_name(ctx, target.label, toolchain), @@ -370,14 +395,6 @@ def _make_proto_library_aspect(is_upb): attr_aspects = ["deps"], requires = ([upb_minitable_proto_library_aspect] if is_upb else [cc_proto_aspect]), attrs = { - "_cc_toolchain": attr.label( - doc = ( - "In order to use find_cc_toolchain, your rule has to depend " + - "on C++ toolchain. See `@rules_cc//cc:find_cc_toolchain.bzl` " + - "docs for details." - ), - default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"), - ), "_collect_cc_coverage": attr.label( default = Label("@rules_rust//util:collect_coverage"), executable = True, diff --git a/third_party/protobuf/rust/codegen_traits.rs b/third_party/protobuf/rust/codegen_traits.rs index 88864be9dad28..d61f379ddea59 100644 --- a/third_party/protobuf/rust/codegen_traits.rs +++ b/third_party/protobuf/rust/codegen_traits.rs @@ -155,11 +155,11 @@ pub(crate) mod interop { /// This takes a ref of a pointer so that a stack variable's lifetime /// can be used for a safe lifetime; under most cases this is /// the correct lifetime and this should be used as: - /// ``` + /// ```ignore /// fn called_from_cpp(msg: *const c_void) { /// // `msg` is known live for the current stack frame, so view's /// // lifetime is also tied to the current stack frame here: - /// let view = unsafe { __unstable_wrap_raw_message(&msg); } + /// let view = unsafe { __unstable_wrap_raw_message(&msg) }; /// do_something_with_view(view); /// } /// ``` @@ -205,11 +205,11 @@ pub(crate) mod interop { /// This takes a ref of a pointer so that a stack variable's lifetime /// can be used for a safe lifetime; under most cases this is /// the correct lifetime and this should be used as: - /// ``` + /// ```ignore /// fn called_from_cpp(msg: *mut c_void) { /// // `msg` is known live for the current stack frame, so mut's /// // lifetime is also tied to the current stack frame here: - /// let m = unsafe { __unstable_wrap_raw_message_mut(&mut msg); } + /// let m = unsafe { __unstable_wrap_raw_message_mut(&mut msg) }; /// do_something_with_mut(m); /// } /// diff --git a/third_party/protobuf/rust/cpp.rs b/third_party/protobuf/rust/cpp.rs index 661b3c5613999..615a2cf285457 100644 --- a/third_party/protobuf/rust/cpp.rs +++ b/third_party/protobuf/rust/cpp.rs @@ -110,11 +110,6 @@ extern "C" { pub fn proto2_rust_Message_merge_from(dst: RawMessage, src: RawMessage) -> bool; } -/// An opaque type matching MapNodeSizeInfoT from C++. -#[doc(hidden)] -#[repr(transparent)] -pub struct MapNodeSizeInfo(pub i32); - impl Drop for InnerProtoString { fn drop(&mut self) { // SAFETY: `self.owned_ptr` points to a valid std::string object. @@ -594,6 +589,30 @@ macro_rules! impl_repeated_primitives { impl_repeated_primitives!(i32, u32, i64, u64, f32, f64, bool, ProtoString, ProtoBytes); +extern "C" { + pub fn proto2_rust_RepeatedField_Message_new() -> RawRepeatedField; + pub fn proto2_rust_RepeatedField_Message_free(field: RawRepeatedField); + pub fn proto2_rust_RepeatedField_Message_size(field: RawRepeatedField) -> usize; + pub fn proto2_rust_RepeatedField_Message_get( + field: RawRepeatedField, + index: usize, + ) -> RawMessage; + pub fn proto2_rust_RepeatedField_Message_get_mut( + field: RawRepeatedField, + index: usize, + ) -> RawMessage; + pub fn proto2_rust_RepeatedField_Message_add( + field: RawRepeatedField, + prototype: RawMessage, + ) -> RawMessage; + pub fn proto2_rust_RepeatedField_Message_clear(field: RawRepeatedField); + pub fn proto2_rust_RepeatedField_Message_copy_from( + dst: RawRepeatedField, + src: RawRepeatedField, + ); + pub fn proto2_rust_RepeatedField_Message_reserve(field: RawRepeatedField, additional: usize); +} + /// Cast a `RepeatedView<SomeEnum>` to `RepeatedView<c_int>`. pub fn cast_enum_repeated_view<E: Enum + ProxiedInRepeated>( repeated: RepeatedView<E>, @@ -767,36 +786,381 @@ impl UntypedMapIterator { } } +// LINT.IfChange(map_ffi) #[doc(hidden)] -#[repr(transparent)] -pub struct MapNodeSizeInfoIndex(i32); - +#[repr(u8)] +#[derive(Debug, PartialEq)] +// Copy of UntypedMapBase::TypeKind +pub enum MapValueTag { + Bool, + U32, + U64, + F32, + F64, + String, + Message, +} +// For the purposes of FFI, we treat all integral types of a given size the same +// way. For example, u32 and i32 values are all represented as a u32. +// Likewise, u64 and i64 values are all stored in a u64. #[doc(hidden)] -pub trait MapNodeSizeInfoIndexForType { - const SIZE_INFO_INDEX: MapNodeSizeInfoIndex; +#[repr(C)] +pub union MapValueUnion { + pub b: bool, + pub u: u32, + pub uu: u64, + pub f: f32, + pub ff: f64, + // Generally speaking, if s is set then it should not be None. However, we + // do set it to None in the special case where the MapValue is just a + // "prototype" (see below). In that scenario, we just want to indicate the + // value type without having to allocate a real C++ std::string. + pub s: Option<CppStdString>, + pub m: RawMessage, } -macro_rules! generate_map_node_size_info_mapping { - ( $($key:ty, $index:expr;)* ) => { - $( - impl MapNodeSizeInfoIndexForType for $key { - const SIZE_INFO_INDEX: MapNodeSizeInfoIndex = MapNodeSizeInfoIndex($index); - } - )* +// We use this tagged union to represent map values for the purposes of FFI. +#[doc(hidden)] +#[repr(C)] +pub struct MapValue { + pub tag: MapValueTag, + pub val: MapValueUnion, +} +// LINT.ThenChange(//depot/google3/third_party/protobuf/rust/cpp_kernel/map.cc: +// map_ffi) + +impl MapValue { + fn make_bool(b: bool) -> Self { + MapValue { tag: MapValueTag::Bool, val: MapValueUnion { b } } + } + + pub fn make_u32(u: u32) -> Self { + MapValue { tag: MapValueTag::U32, val: MapValueUnion { u } } + } + + fn make_u64(uu: u64) -> Self { + MapValue { tag: MapValueTag::U64, val: MapValueUnion { uu } } + } + + pub fn make_f32(f: f32) -> Self { + MapValue { tag: MapValueTag::F32, val: MapValueUnion { f } } + } + + fn make_f64(ff: f64) -> Self { + MapValue { tag: MapValueTag::F64, val: MapValueUnion { ff } } + } + + fn make_string(s: CppStdString) -> Self { + MapValue { tag: MapValueTag::String, val: MapValueUnion { s: Some(s) } } + } + + pub fn make_message(m: RawMessage) -> Self { + MapValue { tag: MapValueTag::Message, val: MapValueUnion { m } } } } -// LINT.IfChange(size_info_mapping) -generate_map_node_size_info_mapping!( - i32, 0; - u32, 0; - i64, 1; - u64, 1; - bool, 2; - ProtoString, 3; +pub trait CppMapTypeConversions: Proxied { + // We have a notion of a map value "prototype", which is a MapValue that + // contains just enough information to indicate the value type of the map. + // We need this on the C++ side to be able to determine size and offset + // information about the map entry. For messages, the prototype is + // the message default instance. For all other types, it is just a MapValue + // with the appropriate tag. + fn get_prototype() -> MapValue; + + fn to_map_value(self) -> MapValue; + + /// # Safety + /// - `value` must store the correct type for `Self`. If it is a string or + /// bytes, then it must not be None. If `Self` is a closed enum, then + /// `value` must store a valid value for that enum. If `Self` is a + /// message, then `value` must store a message of the same type. + /// - The value must be valid for `'a` lifetime. + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self>; +} + +impl CppMapTypeConversions for u32 { + fn get_prototype() -> MapValue { + MapValue::make_u32(0) + } + fn to_map_value(self) -> MapValue { + MapValue::make_u32(self) + } + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self> { + debug_assert_eq!(value.tag, MapValueTag::U32); + unsafe { value.val.u } + } +} + +impl CppMapTypeConversions for i32 { + fn get_prototype() -> MapValue { + MapValue::make_u32(0) + } + fn to_map_value(self) -> MapValue { + MapValue::make_u32(self as u32) + } + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self> { + debug_assert_eq!(value.tag, MapValueTag::U32); + unsafe { value.val.u as i32 } + } +} + +impl CppMapTypeConversions for u64 { + fn get_prototype() -> MapValue { + MapValue::make_u64(0) + } + fn to_map_value(self) -> MapValue { + MapValue::make_u64(self) + } + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self> { + debug_assert_eq!(value.tag, MapValueTag::U64); + unsafe { value.val.uu } + } +} + +impl CppMapTypeConversions for i64 { + fn get_prototype() -> MapValue { + MapValue::make_u64(0) + } + fn to_map_value(self) -> MapValue { + MapValue::make_u64(self as u64) + } + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self> { + debug_assert_eq!(value.tag, MapValueTag::U64); + unsafe { value.val.uu as i64 } + } +} + +impl CppMapTypeConversions for f32 { + fn get_prototype() -> MapValue { + MapValue::make_f32(0f32) + } + fn to_map_value(self) -> MapValue { + MapValue::make_f32(self) + } + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self> { + debug_assert_eq!(value.tag, MapValueTag::F32); + unsafe { value.val.f } + } +} + +impl CppMapTypeConversions for f64 { + fn get_prototype() -> MapValue { + MapValue::make_f64(0.0) + } + fn to_map_value(self) -> MapValue { + MapValue::make_f64(self) + } + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self> { + debug_assert_eq!(value.tag, MapValueTag::F64); + unsafe { value.val.ff } + } +} + +impl CppMapTypeConversions for bool { + fn get_prototype() -> MapValue { + MapValue::make_bool(false) + } + fn to_map_value(self) -> MapValue { + MapValue::make_bool(self) + } + unsafe fn from_map_value<'a>(value: MapValue) -> View<'a, Self> { + debug_assert_eq!(value.tag, MapValueTag::Bool); + unsafe { value.val.b } + } +} + +impl CppMapTypeConversions for ProtoString { + fn get_prototype() -> MapValue { + MapValue { tag: MapValueTag::String, val: MapValueUnion { s: None } } + } + + fn to_map_value(self) -> MapValue { + MapValue::make_string(protostr_into_cppstdstring(self)) + } + + unsafe fn from_map_value<'a>(value: MapValue) -> &'a ProtoStr { + debug_assert_eq!(value.tag, MapValueTag::String); + unsafe { + ProtoStr::from_utf8_unchecked( + ptrlen_to_str(proto2_rust_cpp_string_to_view(value.val.s.unwrap())).into(), + ) + } + } +} + +impl CppMapTypeConversions for ProtoBytes { + fn get_prototype() -> MapValue { + MapValue { tag: MapValueTag::String, val: MapValueUnion { s: None } } + } + + fn to_map_value(self) -> MapValue { + MapValue::make_string(protobytes_into_cppstdstring(self)) + } + + unsafe fn from_map_value<'a>(value: MapValue) -> &'a [u8] { + debug_assert_eq!(value.tag, MapValueTag::String); + unsafe { proto2_rust_cpp_string_to_view(value.val.s.unwrap()).as_ref() } + } +} + +// This trait encapsulates functionality that is specific to each map key type. +// We need this primarily so that we can call the appropriate FFI function for +// the key type. +#[doc(hidden)] +pub trait MapKey +where + Self: Proxied, +{ + type FfiKey; + + fn to_view<'a>(key: Self::FfiKey) -> View<'a, Self>; + + unsafe fn insert(m: RawMap, key: View<'_, Self>, value: MapValue) -> bool; + + unsafe fn get(m: RawMap, key: View<'_, Self>, value: *mut MapValue) -> bool; + + unsafe fn iter_get(iter: &mut UntypedMapIterator, key: *mut Self::FfiKey, value: *mut MapValue); + + unsafe fn remove(m: RawMap, key: View<'_, Self>) -> bool; +} + +macro_rules! generate_map_key_impl { + ( $($key:ty, $mutable_ffi_key:ty, $to_ffi:expr, $from_ffi:expr;)* ) => { + paste! { + $( + impl MapKey for $key { + type FfiKey = $mutable_ffi_key; + + #[inline] + fn to_view<'a>(key: Self::FfiKey) -> View<'a, Self> { + $from_ffi(key) + } + + #[inline] + unsafe fn insert( + m: RawMap, + key: View<'_, Self>, + value: MapValue, + ) -> bool { + unsafe { [< proto2_rust_map_insert_ $key >](m, $to_ffi(key), value) } + } + + #[inline] + unsafe fn get( + m: RawMap, + key: View<'_, Self>, + value: *mut MapValue, + ) -> bool { + unsafe { [< proto2_rust_map_get_ $key >](m, $to_ffi(key), value) } + } + + #[inline] + unsafe fn iter_get( + iter: &mut UntypedMapIterator, + key: *mut Self::FfiKey, + value: *mut MapValue, + ) { + unsafe { [< proto2_rust_map_iter_get_ $key >](iter, key, value) } + } + + #[inline] + unsafe fn remove(m: RawMap, key: View<'_, Self>) -> bool { + unsafe { [< proto2_rust_map_remove_ $key >](m, $to_ffi(key)) } + } + } + )* + } + } +} + +generate_map_key_impl!( + bool, bool, identity, identity; + i32, i32, identity, identity; + u32, u32, identity, identity; + i64, i64, identity, identity; + u64, u64, identity, identity; + ProtoString, PtrAndLen, str_to_ptrlen, ptrlen_to_str; ); -// LINT.ThenChange(//depot/google3/third_party/protobuf/compiler/rust/message. -// cc:size_info_mapping) + +impl<Key, Value> ProxiedInMapValue<Key> for Value +where + Key: Proxied + MapKey + CppMapTypeConversions, + Value: Proxied + CppMapTypeConversions, +{ + fn map_new(_private: Private) -> Map<Key, Self> { + unsafe { + Map::from_inner( + Private, + InnerMap::new(proto2_rust_map_new(Key::get_prototype(), Value::get_prototype())), + ) + } + } + + unsafe fn map_free(_private: Private, map: &mut Map<Key, Self>) { + unsafe { + proto2_rust_map_free(map.as_raw(Private)); + } + } + + fn map_clear(mut map: MapMut<Key, Self>) { + unsafe { + proto2_rust_map_clear(map.as_raw(Private)); + } + } + + fn map_len(map: MapView<Key, Self>) -> usize { + unsafe { proto2_rust_map_size(map.as_raw(Private)) } + } + + fn map_insert( + mut map: MapMut<Key, Self>, + key: View<'_, Key>, + value: impl IntoProxied<Self>, + ) -> bool { + unsafe { Key::insert(map.as_raw(Private), key, value.into_proxied(Private).to_map_value()) } + } + + fn map_get<'a>(map: MapView<'a, Key, Self>, key: View<'_, Key>) -> Option<View<'a, Self>> { + let mut value = std::mem::MaybeUninit::uninit(); + let found = unsafe { Key::get(map.as_raw(Private), key, value.as_mut_ptr()) }; + if !found { + return None; + } + unsafe { Some(Self::from_map_value(value.assume_init())) } + } + + fn map_remove(mut map: MapMut<Key, Self>, key: View<'_, Key>) -> bool { + unsafe { Key::remove(map.as_raw(Private), key) } + } + + fn map_iter(map: MapView<Key, Self>) -> MapIter<Key, Self> { + // SAFETY: + // - The backing map for `map.as_raw` is valid for at least '_. + // - A View that is live for '_ guarantees the backing map is unmodified for '_. + // - The `iter` function produces an iterator that is valid for the key and + // value types, and live for at least '_. + unsafe { MapIter::from_raw(Private, proto2_rust_map_iter(map.as_raw(Private))) } + } + + fn map_iter_next<'a>( + iter: &mut MapIter<'a, Key, Self>, + ) -> Option<(View<'a, Key>, View<'a, Self>)> { + // SAFETY: + // - The `MapIter` API forbids the backing map from being mutated for 'a, and + // guarantees that it's the correct key and value types. + // - The thunk is safe to call as long as the iterator isn't at the end. + // - The thunk always writes to key and value fields and does not read. + // - The thunk does not increment the iterator. + unsafe { + iter.as_raw_mut(Private).next_unchecked::<Key, Self, _, _>( + |iter, key, value| Key::iter_get(iter, key, value), + |ffi_key| Key::to_view(ffi_key), + |value| Self::from_map_value(value), + ) + } + } +} macro_rules! impl_map_primitives { (@impl $(($rust_type:ty, $cpp_type:ty) => [ @@ -809,23 +1173,20 @@ macro_rules! impl_map_primitives { extern "C" { pub fn $insert_thunk( m: RawMap, - size_info: MapNodeSizeInfo, key: $cpp_type, - value: RawMessage, + value: MapValue, ) -> bool; pub fn $get_thunk( m: RawMap, - size_info: MapNodeSizeInfo, key: $cpp_type, - value: *mut RawMessage, + value: *mut MapValue, ) -> bool; pub fn $iter_get_thunk( iter: &mut UntypedMapIterator, - size_info: MapNodeSizeInfo, key: *mut $cpp_type, - value: *mut RawMessage, + value: *mut MapValue, ); - pub fn $remove_thunk(m: RawMap, size_info: MapNodeSizeInfo, key: $cpp_type) -> bool; + pub fn $remove_thunk(m: RawMap, key: $cpp_type) -> bool; } )* }; @@ -855,114 +1216,13 @@ impl_map_primitives!( extern "C" { fn proto2_rust_thunk_UntypedMapIterator_increment(iter: &mut UntypedMapIterator); - pub fn proto2_rust_map_new() -> RawMap; - pub fn proto2_rust_map_free(m: RawMap, key_is_string: bool, size_info: MapNodeSizeInfo); - pub fn proto2_rust_map_clear(m: RawMap, key_is_string: bool, size_info: MapNodeSizeInfo); + pub fn proto2_rust_map_new(key_prototype: MapValue, value_prototype: MapValue) -> RawMap; + pub fn proto2_rust_map_free(m: RawMap); + pub fn proto2_rust_map_clear(m: RawMap); pub fn proto2_rust_map_size(m: RawMap) -> usize; pub fn proto2_rust_map_iter(m: RawMap) -> UntypedMapIterator; } -macro_rules! impl_ProxiedInMapValue_for_non_generated_value_types { - ($key_t:ty, $ffi_key_t:ty, $to_ffi_key:expr, $from_ffi_key:expr, for $($t:ty, $ffi_view_t:ty, $ffi_value_t:ty, $to_ffi_value:expr, $from_ffi_value:expr;)*) => { - paste! { $( - extern "C" { - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _new >]() -> RawMap; - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _free >](m: RawMap); - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _clear >](m: RawMap); - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _size >](m: RawMap) -> usize; - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _insert >](m: RawMap, key: $ffi_key_t, value: $ffi_value_t) -> bool; - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _get >](m: RawMap, key: $ffi_key_t, value: *mut $ffi_view_t) -> bool; - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _iter >](m: RawMap) -> UntypedMapIterator; - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _iter_get >](iter: &mut UntypedMapIterator, key: *mut $ffi_key_t, value: *mut $ffi_view_t); - pub fn [< proto2_rust_thunk_Map_ $key_t _ $t _remove >](m: RawMap, key: $ffi_key_t, value: *mut $ffi_view_t) -> bool; - } - - impl ProxiedInMapValue<$key_t> for $t { - fn map_new(_private: Private) -> Map<$key_t, Self> { - unsafe { - Map::from_inner( - Private, - InnerMap { - raw: [< proto2_rust_thunk_Map_ $key_t _ $t _new >](), - } - ) - } - } - - unsafe fn map_free(_private: Private, map: &mut Map<$key_t, Self>) { - // SAFETY: - // - `map.inner.raw` is a live `RawMap` - // - This function is only called once for `map` in `Drop`. - unsafe { [< proto2_rust_thunk_Map_ $key_t _ $t _free >](map.as_mut().as_raw(Private)); } - } - - - fn map_clear(mut map: MapMut<$key_t, Self>) { - unsafe { [< proto2_rust_thunk_Map_ $key_t _ $t _clear >](map.as_raw(Private)); } - } - - fn map_len(map: MapView<$key_t, Self>) -> usize { - unsafe { [< proto2_rust_thunk_Map_ $key_t _ $t _size >](map.as_raw(Private)) } - } - - fn map_insert(mut map: MapMut<$key_t, Self>, key: View<'_, $key_t>, value: impl IntoProxied<Self>) -> bool { - let ffi_key = $to_ffi_key(key); - let ffi_value = $to_ffi_value(value.into_proxied(Private)); - unsafe { [< proto2_rust_thunk_Map_ $key_t _ $t _insert >](map.as_raw(Private), ffi_key, ffi_value) } - } - - fn map_get<'a>(map: MapView<'a, $key_t, Self>, key: View<'_, $key_t>) -> Option<View<'a, Self>> { - let ffi_key = $to_ffi_key(key); - let mut ffi_value = MaybeUninit::uninit(); - let found = unsafe { [< proto2_rust_thunk_Map_ $key_t _ $t _get >](map.as_raw(Private), ffi_key, ffi_value.as_mut_ptr()) }; - - if !found { - return None; - } - // SAFETY: if `found` is true, then the `ffi_value` was written to by `get`. - Some($from_ffi_value(unsafe { ffi_value.assume_init() })) - } - - fn map_remove(mut map: MapMut<$key_t, Self>, key: View<'_, $key_t>) -> bool { - let ffi_key = $to_ffi_key(key); - let mut ffi_value = MaybeUninit::uninit(); - unsafe { [< proto2_rust_thunk_Map_ $key_t _ $t _remove >](map.as_raw(Private), ffi_key, ffi_value.as_mut_ptr()) } - } - - fn map_iter(map: MapView<$key_t, Self>) -> MapIter<$key_t, Self> { - // SAFETY: - // - The backing map for `map.as_raw` is valid for at least '_. - // - A View that is live for '_ guarantees the backing map is unmodified for '_. - // - The `iter` function produces an iterator that is valid for the key - // and value types, and live for at least '_. - unsafe { - MapIter::from_raw( - Private, - [< proto2_rust_thunk_Map_ $key_t _ $t _iter >](map.as_raw(Private)) - ) - } - } - - fn map_iter_next<'a>(iter: &mut MapIter<'a, $key_t, Self>) -> Option<(View<'a, $key_t>, View<'a, Self>)> { - // SAFETY: - // - The `MapIter` API forbids the backing map from being mutated for 'a, - // and guarantees that it's the correct key and value types. - // - The thunk is safe to call as long as the iterator isn't at the end. - // - The thunk always writes to key and value fields and does not read. - // - The thunk does not increment the iterator. - unsafe { - iter.as_raw_mut(Private).next_unchecked::<$key_t, Self, _, _>( - |iter, key, value| { [< proto2_rust_thunk_Map_ $key_t _ $t _iter_get >](iter, key, value) }, - $from_ffi_key, - $from_ffi_value, - ) - } - } - } - )* } - } -} - fn str_to_ptrlen<'msg>(val: impl Into<&'msg ProtoStr>) -> PtrAndLen { val.into().as_bytes().into() } @@ -987,36 +1247,6 @@ fn ptrlen_to_bytes<'msg>(val: PtrAndLen) -> &'msg [u8] { unsafe { val.as_ref() } } -macro_rules! impl_ProxiedInMapValue_for_key_types { - ($($t:ty, $ffi_t:ty, $to_ffi_key:expr, $from_ffi_key:expr;)*) => { - paste! { - $( - impl_ProxiedInMapValue_for_non_generated_value_types!( - $t, $ffi_t, $to_ffi_key, $from_ffi_key, for - f32, f32, f32, identity, identity; - f64, f64, f64, identity, identity; - i32, i32, i32, identity, identity; - u32, u32, u32, identity, identity; - i64, i64, i64, identity, identity; - u64, u64, u64, identity, identity; - bool, bool, bool, identity, identity; - ProtoString, PtrAndLen, CppStdString, protostr_into_cppstdstring, ptrlen_to_str; - ProtoBytes, PtrAndLen, CppStdString, protobytes_into_cppstdstring, ptrlen_to_bytes; - ); - )* - } - } -} - -impl_ProxiedInMapValue_for_key_types!( - i32, i32, identity, identity; - u32, u32, identity, identity; - i64, i64, identity, identity; - u64, u64, identity, identity; - bool, bool, identity, identity; - ProtoString, PtrAndLen, str_to_ptrlen, ptrlen_to_str; -); - #[cfg(test)] mod tests { use super::*; diff --git a/third_party/protobuf/rust/cpp_kernel/BUILD b/third_party/protobuf/rust/cpp_kernel/BUILD index 041b0c7a8774d..e53fc4505457e 100644 --- a/third_party/protobuf/rust/cpp_kernel/BUILD +++ b/third_party/protobuf/rust/cpp_kernel/BUILD @@ -15,7 +15,6 @@ cc_library( hdrs = [ "compare.h", "debug.h", - "map.h", "rust_alloc_for_cpp_api.h", "serialized_data.h", "strings.h", @@ -29,9 +28,10 @@ cc_library( "//src/google/protobuf", "//src/google/protobuf:protobuf_lite", "//src/google/protobuf/io", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings:string_view", + "@abseil-cpp//absl/functional:overload", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings:string_view", ], ) diff --git a/third_party/protobuf/rust/cpp_kernel/map.cc b/third_party/protobuf/rust/cpp_kernel/map.cc index 45b996b92d97a..92151b9205e38 100644 --- a/third_party/protobuf/rust/cpp_kernel/map.cc +++ b/third_party/protobuf/rust/cpp_kernel/map.cc @@ -1,4 +1,4 @@ -#include "rust/cpp_kernel/map.h" +#include "google/protobuf/map.h" #include <cstddef> #include <cstdint> @@ -6,7 +6,9 @@ #include <type_traits> #include <utility> -#include "google/protobuf/map.h" +#include "absl/functional/overload.h" +#include "absl/log/absl_log.h" +#include "absl/strings/string_view.h" #include "google/protobuf/message.h" #include "google/protobuf/message_lite.h" #include "rust/cpp_kernel/strings.h" @@ -16,6 +18,23 @@ namespace protobuf { namespace rust { namespace { +using MapValueTag = internal::UntypedMapBase::TypeKind; + +// LINT.IfChange(map_ffi) +struct MapValue { + MapValueTag tag; + union { + bool b; + uint32_t u32; + uint64_t u64; + float f32; + double f64; + std::string* s; + google::protobuf::MessageLite* message; + }; +}; +// LINT.ThenChange(//depot/google3/third_party/protobuf/rust/cpp.rs:map_ffi) + template <typename T> struct FromViewType { using type = T; @@ -30,113 +49,117 @@ template <typename Key> using KeyMap = internal::KeyMapBase< internal::KeyForBase<typename FromViewType<Key>::type>>; -template <typename Key> -void DestroyMapNode(internal::UntypedMapBase* m, internal::NodeBase* node, - internal::MapNodeSizeInfoT size_info) { - if constexpr (std::is_same<Key, PtrAndLen>::value) { - static_cast<std::string*>(node->GetVoidKey())->~basic_string(); - } - internal::RustMapHelper::DestroyMessage( - static_cast<MessageLite*>(node->GetVoidValue(size_info))); - internal::RustMapHelper::DeallocNode(m, node, size_info); +template <typename T> +T AsViewType(T t) { + return t; } -template <typename Key> -bool Insert(internal::UntypedMapBase* m, internal::MapNodeSizeInfoT size_info, - Key key, MessageLite* value) { - internal::NodeBase* node = internal::RustMapHelper::AllocNode(m, size_info); - if constexpr (std::is_same<Key, PtrAndLen>::value) { - new (node->GetVoidKey()) std::string(key.ptr, key.len); - } else { - *static_cast<Key*>(node->GetVoidKey()) = key; - } +absl::string_view AsViewType(PtrAndLen key) { return key.AsStringView(); } - MessageLite* new_msg = internal::RustMapHelper::PlacementNew( - value, node->GetVoidValue(size_info)); +void InitializeMessageValue(void* raw_ptr, MessageLite* msg) { + MessageLite* new_msg = internal::RustMapHelper::PlacementNew(msg, raw_ptr); auto* full_msg = DynamicCastMessage<Message>(new_msg); // If we are working with a full (non-lite) proto, we reflectively swap the // value into place. Otherwise, we have to perform a copy. if (full_msg != nullptr) { - full_msg->GetReflection()->Swap(full_msg, - DynamicCastMessage<Message>(value)); + full_msg->GetReflection()->Swap(full_msg, DynamicCastMessage<Message>(msg)); } else { - new_msg->CheckTypeAndMergeFrom(*value); + new_msg->CheckTypeAndMergeFrom(*msg); + } + delete msg; +} + +template <typename Key> +bool Insert(internal::UntypedMapBase* m, Key key, MapValue value) { + internal::NodeBase* node = internal::RustMapHelper::AllocNode(m); + if constexpr (std::is_same<Key, PtrAndLen>::value) { + key.PlacementNewString(node->GetVoidKey()); + } else { + *static_cast<Key*>(node->GetVoidKey()) = key; } - node = internal::RustMapHelper::InsertOrReplaceNode( + m->VisitValue(node, absl::Overload{ + [&](bool* v) { *v = value.b; }, + [&](uint32_t* v) { *v = value.u32; }, + [&](uint64_t* v) { *v = value.u64; }, + [&](float* v) { *v = value.f32; }, + [&](double* v) { *v = value.f64; }, + [&](std::string* str) { + new (str) std::string(std::move(*value.s)); + delete value.s; + }, + [&](MessageLite* msg) { + InitializeMessageValue(msg, value.message); + }, + }); + + return internal::RustMapHelper::InsertOrReplaceNode( static_cast<KeyMap<Key>*>(m), node); - if (node == nullptr) { - return true; - } - DestroyMapNode<Key>(m, node, size_info); - return false; } -template <typename Map, typename Key, - typename = typename std::enable_if< - !std::is_same<Key, google::protobuf::rust::PtrAndLen>::value>::type> -internal::RustMapHelper::NodeAndBucket FindHelper(Map* m, Key key) { - return internal::RustMapHelper::FindHelper( - m, static_cast<internal::KeyForBase<Key>>(key)); -} - -template <typename Map> -internal::RustMapHelper::NodeAndBucket FindHelper(Map* m, - google::protobuf::rust::PtrAndLen key) { - return internal::RustMapHelper::FindHelper( - m, absl::string_view(key.ptr, key.len)); +void PopulateMapValue(const internal::UntypedMapBase& map, + internal::NodeBase* node, MapValue& output) { + map.VisitValue(node, absl::Overload{ + [&](const bool* v) { + output.tag = MapValueTag::kBool; + output.b = *v; + }, + [&](const uint32_t* v) { + output.tag = MapValueTag::kU32; + output.u32 = *v; + }, + [&](const uint64_t* v) { + output.tag = MapValueTag::kU64; + output.u64 = *v; + }, + [&](const float* v) { + output.tag = MapValueTag::kFloat; + output.f32 = *v; + }, + [&](const double* v) { + output.tag = MapValueTag::kDouble; + output.f64 = *v; + }, + [&](std::string* str) { + output.tag = MapValueTag::kString; + output.s = str; + }, + [&](MessageLite* msg) { + output.tag = MapValueTag::kMessage; + output.message = msg; + }, + }); } template <typename Key> -bool Get(internal::UntypedMapBase* m, internal::MapNodeSizeInfoT size_info, - Key key, MessageLite** value) { +bool Get(internal::UntypedMapBase* m, Key key, MapValue* value) { auto* map_base = static_cast<KeyMap<Key>*>(m); - internal::RustMapHelper::NodeAndBucket result = FindHelper(map_base, key); + auto result = internal::RustMapHelper::FindHelper(map_base, AsViewType(key)); if (result.node == nullptr) { return false; } - *value = static_cast<MessageLite*>(result.node->GetVoidValue(size_info)); + PopulateMapValue(*m, result.node, *value); return true; } template <typename Key> -bool Remove(internal::UntypedMapBase* m, internal::MapNodeSizeInfoT size_info, - Key key) { +bool Remove(internal::UntypedMapBase* m, Key key) { auto* map_base = static_cast<KeyMap<Key>*>(m); - internal::RustMapHelper::NodeAndBucket result = FindHelper(map_base, key); - if (result.node == nullptr) { - return false; - } - internal::RustMapHelper::EraseNoDestroy(map_base, result.bucket, result.node); - DestroyMapNode<Key>(m, result.node, size_info); - return true; + return internal::RustMapHelper::EraseImpl(map_base, AsViewType(key)); } template <typename Key> -void IterGet(const internal::UntypedMapIterator* iter, - internal::MapNodeSizeInfoT size_info, Key* key, - MessageLite** value) { +void IterGet(const internal::UntypedMapIterator* iter, Key* key, + MapValue* value) { internal::NodeBase* node = iter->node_; if constexpr (std::is_same<Key, PtrAndLen>::value) { - const std::string* s = static_cast<const std::string*>(node->GetVoidKey()); + const std::string* s = iter->m_->GetKey<std::string>(node); *key = PtrAndLen{s->data(), s->size()}; } else { - *key = *static_cast<const Key*>(node->GetVoidKey()); + *key = *iter->m_->GetKey<Key>(node); } - *value = static_cast<MessageLite*>(node->GetVoidValue(size_info)); -} - -void ClearMap(internal::UntypedMapBase* m, internal::MapNodeSizeInfoT size_info, - bool key_is_string, bool reset_table) { - if (internal::RustMapHelper::IsGlobalEmptyTable(m)) return; - uint8_t bits = internal::RustMapHelper::kValueIsProto; - if (key_is_string) { - bits |= internal::RustMapHelper::kKeyIsString; - } - internal::RustMapHelper::ClearTable( - m, internal::RustMapHelper::ClearInput{size_info, bits, reset_table, - /* destroy_node = */ nullptr}); + PopulateMapValue(*iter->m_, node, *value); } } // namespace @@ -151,22 +174,16 @@ void proto2_rust_thunk_UntypedMapIterator_increment( iter->PlusPlus(); } -google::protobuf::internal::UntypedMapBase* proto2_rust_map_new() { - return new google::protobuf::internal::UntypedMapBase(/* arena = */ nullptr); -} - -void proto2_rust_map_free(google::protobuf::internal::UntypedMapBase* m, - bool key_is_string, - google::protobuf::internal::MapNodeSizeInfoT size_info) { - google::protobuf::rust::ClearMap(m, size_info, key_is_string, - /* reset_table = */ false); - delete m; -} - -void proto2_rust_map_clear(google::protobuf::internal::UntypedMapBase* m, - bool key_is_string, - google::protobuf::internal::MapNodeSizeInfoT size_info) { - google::protobuf::rust::ClearMap(m, size_info, key_is_string, /* reset_table = */ true); +google::protobuf::internal::UntypedMapBase* proto2_rust_map_new( + google::protobuf::rust::MapValue key_prototype, + google::protobuf::rust::MapValue value_prototype) { + return new google::protobuf::internal::UntypedMapBase( + /* arena = */ nullptr, + google::protobuf::internal::UntypedMapBase::GetTypeInfoDynamic( + key_prototype.tag, value_prototype.tag, + value_prototype.tag == google::protobuf::rust::MapValueTag::kMessage + ? value_prototype.message + : nullptr)); } size_t proto2_rust_map_size(google::protobuf::internal::UntypedMapBase* m) { @@ -178,32 +195,37 @@ google::protobuf::internal::UntypedMapIterator proto2_rust_map_iter( return m->begin(); } -#define DEFINE_KEY_SPECIFIC_MAP_OPERATIONS(cpp_type, suffix) \ - bool proto2_rust_map_insert_##suffix( \ - google::protobuf::internal::UntypedMapBase* m, \ - google::protobuf::internal::MapNodeSizeInfoT size_info, cpp_type key, \ - google::protobuf::MessageLite* value) { \ - return google::protobuf::rust::Insert(m, size_info, key, value); \ - } \ - \ - bool proto2_rust_map_get_##suffix( \ - google::protobuf::internal::UntypedMapBase* m, \ - google::protobuf::internal::MapNodeSizeInfoT size_info, cpp_type key, \ - google::protobuf::MessageLite** value) { \ - return google::protobuf::rust::Get(m, size_info, key, value); \ - } \ - \ - bool proto2_rust_map_remove_##suffix( \ - google::protobuf::internal::UntypedMapBase* m, \ - google::protobuf::internal::MapNodeSizeInfoT size_info, cpp_type key) { \ - return google::protobuf::rust::Remove(m, size_info, key); \ - } \ - \ - void proto2_rust_map_iter_get_##suffix( \ - const google::protobuf::internal::UntypedMapIterator* iter, \ - google::protobuf::internal::MapNodeSizeInfoT size_info, cpp_type* key, \ - google::protobuf::MessageLite** value) { \ - return google::protobuf::rust::IterGet(iter, size_info, key, value); \ +void proto2_rust_map_free(google::protobuf::internal::UntypedMapBase* m) { + m->ClearTable(false); + delete m; +} + +void proto2_rust_map_clear(google::protobuf::internal::UntypedMapBase* m) { + m->ClearTable(true); +} + +#define DEFINE_KEY_SPECIFIC_MAP_OPERATIONS(cpp_type, suffix) \ + bool proto2_rust_map_insert_##suffix(google::protobuf::internal::UntypedMapBase* m, \ + cpp_type key, \ + google::protobuf::rust::MapValue value) { \ + return google::protobuf::rust::Insert(m, key, value); \ + } \ + \ + bool proto2_rust_map_get_##suffix(google::protobuf::internal::UntypedMapBase* m, \ + cpp_type key, \ + google::protobuf::rust::MapValue* value) { \ + return google::protobuf::rust::Get(m, key, value); \ + } \ + \ + bool proto2_rust_map_remove_##suffix(google::protobuf::internal::UntypedMapBase* m, \ + cpp_type key) { \ + return google::protobuf::rust::Remove(m, key); \ + } \ + \ + void proto2_rust_map_iter_get_##suffix( \ + const google::protobuf::internal::UntypedMapIterator* iter, cpp_type* key, \ + google::protobuf::rust::MapValue* value) { \ + return google::protobuf::rust::IterGet(iter, key, value); \ } DEFINE_KEY_SPECIFIC_MAP_OPERATIONS(int32_t, i32) @@ -213,27 +235,4 @@ DEFINE_KEY_SPECIFIC_MAP_OPERATIONS(uint64_t, u64) DEFINE_KEY_SPECIFIC_MAP_OPERATIONS(bool, bool) DEFINE_KEY_SPECIFIC_MAP_OPERATIONS(google::protobuf::rust::PtrAndLen, ProtoString) -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE(int32_t, i32, int32_t, - int32_t, value, cpp_value); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE(uint32_t, u32, uint32_t, - uint32_t, value, cpp_value); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE(float, f32, float, float, - value, cpp_value); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE(double, f64, double, double, - value, cpp_value); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE(bool, bool, bool, bool, - value, cpp_value); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE(uint64_t, u64, uint64_t, - uint64_t, value, cpp_value); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE(int64_t, i64, int64_t, - int64_t, value, cpp_value); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE( - std::string, ProtoBytes, google::protobuf::rust::PtrAndLen, std::string*, - std::move(*value), - (google::protobuf::rust::PtrAndLen{cpp_value.data(), cpp_value.size()})); -__PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE( - std::string, ProtoString, google::protobuf::rust::PtrAndLen, std::string*, - std::move(*value), - (google::protobuf::rust::PtrAndLen{cpp_value.data(), cpp_value.size()})); - } // extern "C" diff --git a/third_party/protobuf/rust/cpp_kernel/map.h b/third_party/protobuf/rust/cpp_kernel/map.h deleted file mode 100644 index 8e9881f44627b..0000000000000 --- a/third_party/protobuf/rust/cpp_kernel/map.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef GOOGLE_PROTOBUF_RUST_CPP_KERNEL_MAP_H__ -#define GOOGLE_PROTOBUF_RUST_CPP_KERNEL_MAP_H__ - -#include <memory> -#include <type_traits> - -#include "google/protobuf/map.h" -#include "google/protobuf/message_lite.h" -#include "rust/cpp_kernel/strings.h" - -namespace google { -namespace protobuf { -namespace rust { - -// String and bytes values are passed across the FFI boundary as owned raw -// pointers when we do map insertions. Unlike other types, they have to be -// explicitly deleted. This MakeCleanup() helper does nothing by default, but -// for std::string pointers it returns a std::unique_ptr to take ownership of -// the raw pointer. -template <typename T> -auto MakeCleanup(T value) { - if constexpr (std::is_same<T, std::string*>::value) { - return std::unique_ptr<std::string>(value); - } else { - return 0; - } -} - -} // namespace rust -} // namespace protobuf -} // namespace google - -// Defines concrete thunks to access typed map methods from Rust. -#define __PB_RUST_EXPOSE_SCALAR_MAP_METHODS( \ - key_ty, rust_key_ty, ffi_key_ty, to_cpp_key, to_ffi_key, value_ty, \ - rust_value_ty, ffi_view_ty, ffi_value_ty, to_cpp_value, to_ffi_value) \ - google::protobuf::Map<key_ty, value_ty>* \ - proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_new() { \ - return new google::protobuf::Map<key_ty, value_ty>(); \ - } \ - void proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_free( \ - google::protobuf::Map<key_ty, value_ty>* m) { \ - delete m; \ - } \ - void proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_clear( \ - google::protobuf::Map<key_ty, value_ty>* m) { \ - m->clear(); \ - } \ - size_t proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_size( \ - const google::protobuf::Map<key_ty, value_ty>* m) { \ - return m->size(); \ - } \ - bool proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_insert( \ - google::protobuf::Map<key_ty, value_ty>* m, ffi_key_ty key, ffi_value_ty value) { \ - auto cleanup = google::protobuf::rust::MakeCleanup(value); \ - (void)cleanup; \ - auto iter_and_inserted = m->try_emplace(to_cpp_key, to_cpp_value); \ - if (!iter_and_inserted.second) { \ - iter_and_inserted.first->second = to_cpp_value; \ - } \ - return iter_and_inserted.second; \ - } \ - bool proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_get( \ - const google::protobuf::Map<key_ty, value_ty>* m, ffi_key_ty key, \ - ffi_view_ty* value) { \ - auto cpp_key = to_cpp_key; \ - auto it = m->find(cpp_key); \ - if (it == m->end()) { \ - return false; \ - } \ - auto& cpp_value = it->second; \ - *value = to_ffi_value; \ - return true; \ - } \ - google::protobuf::internal::UntypedMapIterator \ - proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_iter( \ - const google::protobuf::Map<key_ty, value_ty>* m) { \ - return google::protobuf::internal::UntypedMapIterator::FromTyped(m->cbegin()); \ - } \ - void proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_iter_get( \ - const google::protobuf::internal::UntypedMapIterator* iter, ffi_key_ty* key, \ - ffi_view_ty* value) { \ - auto typed_iter = \ - iter->ToTyped<google::protobuf::Map<key_ty, value_ty>::const_iterator>(); \ - const auto& cpp_key = typed_iter->first; \ - const auto& cpp_value = typed_iter->second; \ - *key = to_ffi_key; \ - *value = to_ffi_value; \ - } \ - bool proto2_rust_thunk_Map_##rust_key_ty##_##rust_value_ty##_remove( \ - google::protobuf::Map<key_ty, value_ty>* m, ffi_key_ty key, ffi_view_ty* value) { \ - auto cpp_key = to_cpp_key; \ - auto num_removed = m->erase(cpp_key); \ - return num_removed > 0; \ - } - -// Defines the map thunks for all supported key types for a given value type. -#define __PB_RUST_EXPOSE_SCALAR_MAP_METHODS_FOR_VALUE_TYPE( \ - value_ty, rust_value_ty, ffi_view_ty, ffi_value_ty, to_cpp_value, \ - to_ffi_value) \ - __PB_RUST_EXPOSE_SCALAR_MAP_METHODS( \ - int32_t, i32, int32_t, key, cpp_key, value_ty, rust_value_ty, \ - ffi_view_ty, ffi_value_ty, to_cpp_value, to_ffi_value); \ - __PB_RUST_EXPOSE_SCALAR_MAP_METHODS( \ - uint32_t, u32, uint32_t, key, cpp_key, value_ty, rust_value_ty, \ - ffi_view_ty, ffi_value_ty, to_cpp_value, to_ffi_value); \ - __PB_RUST_EXPOSE_SCALAR_MAP_METHODS( \ - bool, bool, bool, key, cpp_key, value_ty, rust_value_ty, ffi_view_ty, \ - ffi_value_ty, to_cpp_value, to_ffi_value); \ - __PB_RUST_EXPOSE_SCALAR_MAP_METHODS( \ - uint64_t, u64, uint64_t, key, cpp_key, value_ty, rust_value_ty, \ - ffi_view_ty, ffi_value_ty, to_cpp_value, to_ffi_value); \ - __PB_RUST_EXPOSE_SCALAR_MAP_METHODS( \ - int64_t, i64, int64_t, key, cpp_key, value_ty, rust_value_ty, \ - ffi_view_ty, ffi_value_ty, to_cpp_value, to_ffi_value); \ - __PB_RUST_EXPOSE_SCALAR_MAP_METHODS( \ - std::string, ProtoString, google::protobuf::rust::PtrAndLen, \ - std::string(key.ptr, key.len), \ - (google::protobuf::rust::PtrAndLen{cpp_key.data(), cpp_key.size()}), value_ty, \ - rust_value_ty, ffi_view_ty, ffi_value_ty, to_cpp_value, to_ffi_value); - -#endif // GOOGLE_PROTOBUF_RUST_CPP_KERNEL_MAP_H__ diff --git a/third_party/protobuf/rust/cpp_kernel/repeated.cc b/third_party/protobuf/rust/cpp_kernel/repeated.cc index ff07992ed93fd..7922c433f894e 100644 --- a/third_party/protobuf/rust/cpp_kernel/repeated.cc +++ b/third_party/protobuf/rust/cpp_kernel/repeated.cc @@ -105,4 +105,51 @@ expose_repeated_ptr_field_methods(ProtoBytes); #undef expose_repeated_ptr_field_methods +using google::protobuf::internal::GenericTypeHandler; +using google::protobuf::internal::RepeatedPtrFieldBase; +using google::protobuf::internal::RustRepeatedMessageHelper; + +void* proto2_rust_RepeatedField_Message_new() { + return RustRepeatedMessageHelper::New(); +} + +void proto2_rust_RepeatedField_Message_free(RepeatedPtrFieldBase* field) { + RustRepeatedMessageHelper::Delete(field); +} + +size_t proto2_rust_RepeatedField_Message_size( + const RepeatedPtrFieldBase* field) { + return RustRepeatedMessageHelper::Size(*field); +} + +const google::protobuf::MessageLite* proto2_rust_RepeatedField_Message_get( + const RepeatedPtrFieldBase* field, size_t index) { + return &RustRepeatedMessageHelper::At(*field, index); +} + +google::protobuf::MessageLite* proto2_rust_RepeatedField_Message_get_mut( + RepeatedPtrFieldBase* field, size_t index) { + return &RustRepeatedMessageHelper::At(*field, index); +} + +google::protobuf::MessageLite* proto2_rust_RepeatedField_Message_add( + RepeatedPtrFieldBase* field, const google::protobuf::MessageLite* prototype) { + return field->AddMessage(prototype); +} + +void proto2_rust_RepeatedField_Message_clear(RepeatedPtrFieldBase* field) { + field->Clear<GenericTypeHandler<google::protobuf::MessageLite>>(); +} + +void proto2_rust_RepeatedField_Message_copy_from( + RepeatedPtrFieldBase* dst, const RepeatedPtrFieldBase* src) { + dst->Clear<GenericTypeHandler<google::protobuf::MessageLite>>(); + dst->MergeFrom<google::protobuf::MessageLite>(*src); +} + +void proto2_rust_RepeatedField_Message_reserve(RepeatedPtrFieldBase* field, + size_t additional) { + RustRepeatedMessageHelper::Reserve(*field, additional); +} + } // extern "C" diff --git a/third_party/protobuf/rust/cpp_kernel/strings.cc b/third_party/protobuf/rust/cpp_kernel/strings.cc index af29ddeaf4300..d1af5656b02c5 100644 --- a/third_party/protobuf/rust/cpp_kernel/strings.cc +++ b/third_party/protobuf/rust/cpp_kernel/strings.cc @@ -3,12 +3,25 @@ #include <cstring> #include <string> +#include "absl/strings/string_view.h" #include "rust/cpp_kernel/rust_alloc_for_cpp_api.h" namespace google { namespace protobuf { namespace rust { +std::string PtrAndLen::CopyToString() const { + return len == 0 ? "" : std::string(ptr, len); +} + +absl::string_view PtrAndLen::AsStringView() const { + return absl::string_view(len == 0 ? nullptr : ptr, len); +} + +void PtrAndLen::PlacementNewString(void* location) { + new (location) std::string(len == 0 ? nullptr : ptr, len); +} + RustStringRawParts::RustStringRawParts(std::string src) { if (src.empty()) { data = nullptr; @@ -27,7 +40,7 @@ RustStringRawParts::RustStringRawParts(std::string src) { extern "C" { std::string* proto2_rust_cpp_new_string(google::protobuf::rust::PtrAndLen src) { - return new std::string(src.ptr, src.len); + return new std::string(src.CopyToString()); } void proto2_rust_cpp_delete_string(std::string* str) { delete str; } diff --git a/third_party/protobuf/rust/cpp_kernel/strings.h b/third_party/protobuf/rust/cpp_kernel/strings.h index b3302a191972f..124b6395dd8b1 100644 --- a/third_party/protobuf/rust/cpp_kernel/strings.h +++ b/third_party/protobuf/rust/cpp_kernel/strings.h @@ -12,16 +12,32 @@ #include <cstring> #include <string> +#include "absl/strings/string_view.h" + namespace google { namespace protobuf { namespace rust { // Represents an ABI-stable version of &[u8]/string_view (borrowed slice of // bytes) for FFI use only. +// +// Note that the intent is for either Rust or C++ to construct one of these with +// the pointer that they would have from a Rust slice or C++ string_view. +// Notably this means that if len==0, ptr may be any value, including nullptr or +// an invalid pointer, which may be a value incompatible for use with either a +// Rust slice or C++ string_view. +// +// It may be constructed trivially, but use the provided conversion methods +// when converting from this type into any other type to avoid obscure undefined +// behavior. struct PtrAndLen { /// Borrows the memory. const char* ptr; size_t len; + + std::string CopyToString() const; + absl::string_view AsStringView() const; + void PlacementNewString(void* location); }; // Represents an owned string for FFI purposes. diff --git a/third_party/protobuf/rust/defs.bzl b/third_party/protobuf/rust/defs.bzl index 14d7e7027817c..cace2d8d130e5 100644 --- a/third_party/protobuf/rust/defs.bzl +++ b/third_party/protobuf/rust/defs.bzl @@ -12,6 +12,14 @@ load( "rust_upb_proto_library_aspect", ) +ProtoCrateNamesInfo = provider( + doc = """A provider that contains both names a Protobuf crate has throughout the build.""", + fields = { + "crate_name": "The name of rust_proto_library.", + "old_crate_name": "The name of the proto_library.", + }, +) + def rust_proto_library(name, deps, **args): """Declares all the boilerplate needed to use Rust protobufs conveniently. @@ -81,10 +89,21 @@ def _rust_proto_library_impl(ctx): dep = deps[0] rust_proto_info = dep[RustProtoInfo] - dep_variant_info = rust_proto_info.dep_variant_info + proto_common.check_collocated( + ctx.label, + dep[ProtoInfo], + ctx.attr._proto_lang_toolchain[proto_common.ProtoLangToolchainInfo], + ) + + if len(rust_proto_info.dep_variant_infos) != 1: + fail( + "{}: rust_proto_library does not support src-less proto_library targets." + .format(_user_visible_label(ctx)), + ) + dep_variant_info = rust_proto_info.dep_variant_infos[0] crate_info = dep_variant_info.crate_info - # Change the crate name from the hame of the proto_library to the name of the rust_proto_library. + # Change the crate name from the name of the proto_library to the name of the rust_proto_library. # # When the aspect visits proto_libraries, it doesn't know and cannot deduce the name of the # rust_proto_library (although the name of rust_proto_libraries is consistently ending with @@ -96,17 +115,26 @@ def _rust_proto_library_impl(ctx): toolchain = ctx.toolchains["@rules_rust//rust:toolchain_type"] fields = {field: getattr(crate_info, field) for field in dir(crate_info)} pkg, name = _user_visible_label(ctx).rsplit(":") - label = struct(**{"name": name, "pkg": pkg}) + + # Construct a label and compute the crate name. + # Package and workspace root are only relevant when 1P crate renaming is enabled. + # The current implementation of crate renaming supports only monorepos which + # means that it will only rename wen label.workspace_root is empty. + label = struct(**{"name": name, "package": pkg, "workspace_root": ""}) fields["name"] = label_to_crate_name(ctx, label, toolchain) # These two fields present on the dir(crate_info) but break on some versions of Bazel when # passed back in to crate_info. Strip them for now. - fields.pop("to_json") - fields.pop("to_proto") + fields.pop("to_json", None) + fields.pop("to_proto", None) crate_info_with_rust_proto_name = rust_common.crate_info(**fields) return [ + ProtoCrateNamesInfo( + crate_name = crate_info_with_rust_proto_name.name, + old_crate_name = crate_info.name, + ), crate_info_with_rust_proto_name, dep_variant_info.dep_info, dep_variant_info.cc_info, diff --git a/third_party/protobuf/rust/dist.bzl b/third_party/protobuf/rust/dist.bzl new file mode 100644 index 0000000000000..327e1af29bc94 --- /dev/null +++ b/third_party/protobuf/rust/dist.bzl @@ -0,0 +1,100 @@ +""" +This module exports the pkg_cross_compiled_binaries rule. This rule is used to create a pkg_filegroup +that contains the cross compiled binaries for each cpu. +""" + +load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files") + +def _cpu_transition_impl(settings, attr): + _ignore = (settings) # @unused + return [{"//command_line_option:cpu": attr.cpu}] + +_cpu_transition = transition( + implementation = _cpu_transition_impl, + inputs = [], + outputs = [ + "//command_line_option:cpu", + ], +) + +def _cross_compiled_binary_impl(ctx): + target = ctx.attr.target + + default_info = target[0][DefaultInfo] + files = default_info.files + runfiles = default_info.default_runfiles + + files = depset(transitive = [files]) + + return [ + DefaultInfo( + files = files, + runfiles = runfiles, + ), + ] + +_cross_compiled_binary = rule( + implementation = _cross_compiled_binary_impl, + attrs = { + "target": attr.label( + mandatory = True, + cfg = _cpu_transition, + ), + "cpu": attr.string(), + "_allowlist_function_transition": attr.label( + default = "@bazel_tools//tools/allowlists/function_transition_allowlist", + ), + }, +) + +def pkg_cross_compiled_binaries(name, cpus, targets, prefix, tags, visibility = None): + """Creates a pkg_filegroup that contains the cross compiled binaries for each cpu. + + This rule is used to create a pkg_filegroup that contains the cross compiled binaries for each + cpu. The binaries are created by an aspect that changes the cpu configuration for each target. + The targets are placed into a directory that is named after the cpu. + + Args: + name: The name of the pkg_filegroup. + cpus: The cpus to cross compile for. + targets: The targets to cross compile. + prefix: The prefix to add to the pkg_filegroup. + tags: The tags to add to the pkg_filegroup. + visibility: The visibility of the pkg_filegroup. + """ + + filegroups = [] + for cpu in cpus: + compiled_targets = [] + for target in targets: + target_name = target.split(":")[1] + bin_target_name = name + "_" + cpu + "_" + target_name + _cross_compiled_binary( + name = bin_target_name, + cpu = cpu, + target = target, + ) + compiled_targets.append(Label(":" + bin_target_name)) + files_name = name + "_" + cpu + "_src" + filegroup_name = files_name + "_dir" + filegroups.append(Label(":" + filegroup_name)) + pkg_files( + name = files_name, + srcs = compiled_targets, + attributes = pkg_attributes( + mode = "0755", + ), + ) + pkg_filegroup( + name = filegroup_name, + srcs = [Label(":" + files_name)], + prefix = cpu, + ) + pkg_filegroup( + name = name, + srcs = filegroups, + prefix = prefix, + tags = tags, + visibility = visibility, + ) + return diff --git a/third_party/protobuf/rust/gtest_matchers.rs b/third_party/protobuf/rust/gtest_matchers.rs index 0dc833a7584a0..70ea26a1e57fa 100644 --- a/third_party/protobuf/rust/gtest_matchers.rs +++ b/third_party/protobuf/rust/gtest_matchers.rs @@ -5,31 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -use googletest::description::Description; -use googletest::matcher::{Matcher, MatcherBase, MatcherResult}; -use protobuf::__internal::MatcherEq; +extern crate protobuf_gtest_matchers_impl; -#[derive(MatcherBase)] -pub struct MessageMatcher<T: MatcherEq> { - expected: T, -} - -impl<T> Matcher<&T> for MessageMatcher<T> -where - T: MatcherEq, -{ - fn matches(&self, actual: &T) -> MatcherResult { - actual.matches(&self.expected).into() - } - - fn describe(&self, matcher_result: MatcherResult) -> Description { - match matcher_result { - MatcherResult::Match => format!("is equal to {:?}", self.expected).into(), - MatcherResult::NoMatch => format!("is not equal to {:?}", self.expected).into(), - } - } -} - -pub fn proto_eq<T: MatcherEq>(expected: T) -> MessageMatcher<T> { - MessageMatcher { expected } -} +// Re-export all symbols from the underlying implementation of gtest_matchers. +pub use protobuf_gtest_matchers_impl::*; diff --git a/third_party/protobuf/rust/gtest_matchers_impl.rs b/third_party/protobuf/rust/gtest_matchers_impl.rs new file mode 100644 index 0000000000000..c52f98b2313ce --- /dev/null +++ b/third_party/protobuf/rust/gtest_matchers_impl.rs @@ -0,0 +1,51 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +use googletest::description::Description; +use googletest::matcher::{Matcher, MatcherBase, MatcherResult}; +use protobuf::__internal::MatcherEq; + +#[derive(MatcherBase)] +pub struct MessageMatcher<T: MatcherEq> { + expected: T, +} + +impl<T> Matcher<&T> for MessageMatcher<T> +where + T: MatcherEq, +{ + fn matches(&self, actual: &T) -> MatcherResult { + actual.matches(&self.expected).into() + } + + fn describe(&self, matcher_result: MatcherResult) -> Description { + match matcher_result { + MatcherResult::Match => format!("is equal to {:?}", self.expected).into(), + MatcherResult::NoMatch => format!("is not equal to {:?}", self.expected).into(), + } + } +} + +impl<T> Matcher<T> for MessageMatcher<T> +where + T: MatcherEq + Copy, +{ + fn matches(&self, actual: T) -> MatcherResult { + actual.matches(&self.expected).into() + } + + fn describe(&self, matcher_result: MatcherResult) -> Description { + match matcher_result { + MatcherResult::Match => format!("is equal to {:?}", self.expected).into(), + MatcherResult::NoMatch => format!("is not equal to {:?}", self.expected).into(), + } + } +} + +pub fn proto_eq<T: MatcherEq>(expected: T) -> MessageMatcher<T> { + MessageMatcher { expected } +} diff --git a/third_party/protobuf/rust/internal.rs b/third_party/protobuf/rust/internal.rs index b8849373cf75f..c6aa8c925b4fd 100644 --- a/third_party/protobuf/rust/internal.rs +++ b/third_party/protobuf/rust/internal.rs @@ -12,14 +12,24 @@ // Used by the proto! macro pub use paste::paste; +use crate::map; pub use crate::r#enum::Enum; +use crate::repeated; pub use crate::ProtoStr; +use crate::Proxied; pub use std::fmt::Debug; +#[cfg(all(bzl, cpp_kernel))] +#[path = "cpp.rs"] +pub mod runtime; +#[cfg(any(not(bzl), upb_kernel))] +#[path = "upb.rs"] +pub mod runtime; + // TODO: Temporarily re-export these symbols which are now under -// __runtime under __internal since some external callers using it through -// __internal. -pub use crate::__runtime::{PtrAndLen, RawMap, RawMessage, RawRepeatedField}; +// runtime under __internal directly since some external callers using it +// through __internal. +pub use runtime::{PtrAndLen, RawMap, RawMessage, RawRepeatedField}; /// Used to protect internal-only items from being used accidentally. #[derive(Debug)] @@ -31,9 +41,71 @@ pub struct Private; /// This is slightly less 'sealed' than the typical sealed trait pattern would /// permit in other crates; this trait is intended to be available to crates /// which were generated by protoc, but not to application code. -pub trait SealedInternal {} +/// +/// We require Sized as a supertrait, because we generally do not want our +/// traits to support trait objects. +pub trait SealedInternal: Sized {} /// A trait used by the proto_eq() gtest macro. pub trait MatcherEq: SealedInternal + Debug { fn matches(&self, o: &Self) -> bool; } + +/// Used by the proto! macro to get a default value for a repeated field. +pub fn get_repeated_default_value<T: repeated::ProxiedInRepeated + Default>( + _: Private, + _: repeated::RepeatedView<'_, T>, +) -> T { + Default::default() +} + +/// Used by the proto! macro to get a default value for a map field. +pub fn get_map_default_value<K: Proxied, V: map::ProxiedInMapValue<K> + Default>( + _: Private, + _: map::MapView<'_, K, V>, +) -> V { + Default::default() +} + +/// A function that is used to assert that the generated code is compatible with +/// the current runtime version. Right now a perfect/exact match with zero skew +/// is require, except any -prerelease suffixes are ignored as long it is +/// present on both. This may be relaxed in the future. +/// +/// As the generated code is permitted to use unstable internal APIs, the protoc +/// used to generate the code must correspond to the runtime dependency. This +/// const fn is used to check at compile time that the right gencode is used +/// with the right runtime; if you are seeing this fail it means your protoc +/// version mismatches the Rust runtime crate version. +#[cfg(not(bzl))] +pub const fn assert_compatible_gencode_version(gencode_version: &'static str) { + // Helper since str eq is not allowed in const context. In a future rust release + // &str PartialEq will be allowed in const contexts and we can drop this. + const fn const_str_eq(lhs: &str, rhs: &str) -> bool { + let lhs = lhs.as_bytes(); + let rhs = rhs.as_bytes(); + if lhs.len() != rhs.len() { + return false; + } + let mut i = 0; + while i < lhs.len() { + if lhs[i] != rhs[i] { + return false; + } + i += 1; + } + true + } + + let runtime_version = env!("CARGO_PKG_VERSION"); + assert!( + const_str_eq(gencode_version, runtime_version), + "Gencode version is not compatible with runtime version", + ) +} + +/// There is no need for gencode/runtime poison pill when running in bzl; the +/// gencode using the __internal mod which is not available to checked in +/// gencode; gencode built from source should always match. +#[cfg(bzl)] +pub const fn assert_compatible_gencode_version(_gencode_version: &'static str) {} diff --git a/third_party/protobuf/rust/map.rs b/third_party/protobuf/rust/map.rs index 6dfa88236b4ae..56c8655af10bd 100644 --- a/third_party/protobuf/rust/map.rs +++ b/third_party/protobuf/rust/map.rs @@ -8,8 +8,8 @@ use crate::{ AsMut, AsView, IntoMut, IntoProxied, IntoView, MutProxied, MutProxy, Proxied, Proxy, View, ViewProxy, + __internal::runtime::{InnerMap, InnerMapMut, RawMap, RawMapIter}, __internal::{Private, SealedInternal}, - __runtime::{InnerMap, InnerMapMut, RawMap, RawMapIter}, }; use std::marker::PhantomData; @@ -104,7 +104,11 @@ where } impl<K: Proxied, V: ProxiedInMapValue<K>> Proxied for Map<K, V> { - type View<'msg> = MapView<'msg, K, V> where K: 'msg, V: 'msg; + type View<'msg> + = MapView<'msg, K, V> + where + K: 'msg, + V: 'msg; } impl<K: Proxied, V: ProxiedInMapValue<K>> AsView for Map<K, V> { @@ -116,7 +120,11 @@ impl<K: Proxied, V: ProxiedInMapValue<K>> AsView for Map<K, V> { } impl<K: Proxied, V: ProxiedInMapValue<K>> MutProxied for Map<K, V> { - type Mut<'msg> = MapMut<'msg, K, V> where K: 'msg, V: 'msg; + type Mut<'msg> + = MapMut<'msg, K, V> + where + K: 'msg, + V: 'msg; } impl<K: Proxied, V: ProxiedInMapValue<K>> AsMut for Map<K, V> { @@ -400,6 +408,21 @@ where } } +impl<'msg, 'k, 'v, K, KView, V, VView, I> IntoProxied<Map<K, V>> for I +where + I: Iterator<Item = (KView, VView)>, + K: Proxied + 'msg + 'k, + V: ProxiedInMapValue<K> + 'msg + 'v, + KView: Into<View<'k, K>>, + VView: IntoProxied<V>, +{ + fn into_proxied(self, _private: Private) -> Map<K, V> { + let mut m = Map::<K, V>::new(); + m.as_mut().extend(self); + m + } +} + /// An iterator visiting all key-value pairs in arbitrary order. /// /// The iterator element type is `(View<Key>, View<Value>)`. diff --git a/third_party/protobuf/rust/prelude.rs b/third_party/protobuf/rust/prelude.rs index e06a73d252d37..cd98cdedb8bdc 100644 --- a/third_party/protobuf/rust/prelude.rs +++ b/third_party/protobuf/rust/prelude.rs @@ -6,11 +6,18 @@ // https://developers.google.com/open-source/licenses/bsd //! Prelude for the Protobuf Rust API. -//! This module contains only non-struct items that are needed for extremely -//! common usages of the generated types from application code. Any struct -//! or less common items should be imported normally. +//! +//! This module contains only the proto! macro and traits which define very +//! common fns that on messages (fns that would be methods on a base class in +//! other languages). +//! +//! All traits here have `Proto` prefixed on them, as the intent of this prelude +//! is to make the methods callable on message instances: if the traits are +//! named for generic reasons, they should be explicitly imported from the +//! `protobuf::` crate instead. pub use crate::{ - proto, AsMut, AsView, Clear, ClearAndParse, IntoMut, IntoView, MergeFrom, Message, MessageMut, - MessageView, Parse, Serialize, + proto, AsMut as ProtoAsMut, AsView as ProtoAsView, Clear as ProtoClear, + ClearAndParse as ProtoClearAndParse, IntoMut as ProtoIntoMut, IntoView as ProtoIntoView, + MergeFrom as ProtoMergeFrom, Parse as ProtoParse, Serialize as ProtoSerialize, }; diff --git a/third_party/protobuf/rust/proto_macro.rs b/third_party/protobuf/rust/proto_macro.rs index 19e1063dad7ab..3017049844e99 100644 --- a/third_party/protobuf/rust/proto_macro.rs +++ b/third_party/protobuf/rust/proto_macro.rs @@ -11,8 +11,11 @@ /// submessage is being defined as part of the original struct literal. /// Introducing an expression using () or {} as the value of a field will /// require another call to this macro in order to return a submessage -/// literal.``` /* -/// Given the following proto definition +/// literal. +/// +/// ```rust,ignore +/// /* +/// Given the following proto definition: /// message Data { /// int32 number = 1; /// string letters = 2; @@ -29,7 +32,8 @@ /// x + 1 /// } /// } -/// }); ``` +/// }); +/// ``` #[macro_export] macro_rules! proto { ($msgtype:ty { $($tt:tt)* }) => { @@ -99,7 +103,7 @@ macro_rules! proto_internal { // field with array literal, calls out to @array to look for nested messages (@msg $msg:ident $ident:ident : [$($elems:tt)*]) => { { - let _repeated = $crate::__internal::paste!($msg.[<$ident>]()); + let _repeated = $msg.$ident(); let elems = proto_internal!(@array $msg _repeated [] $($elems)*); $crate::__internal::paste!($msg.[<set_ $ident>](elems.into_iter())); } @@ -117,7 +121,7 @@ macro_rules! proto_internal { proto_internal!(@array $msg $repeated [ $($vals),+ , { - let mut $msg = $crate::get_repeated_default_value($crate::__internal::Private, $repeated); + let mut $msg = $crate::__internal::get_repeated_default_value($crate::__internal::Private, $repeated); proto_internal!(@merge $msg $($value)*); proto_internal!(@msg $msg $($value)*); $msg @@ -130,7 +134,7 @@ macro_rules! proto_internal { [ $($vals),+ , { - let mut $msg = $crate::get_repeated_default_value($crate::__internal::Private, $repeated); + let mut $msg = $crate::__internal::get_repeated_default_value($crate::__internal::Private, $repeated); proto_internal!(@merge $msg $($value)*); proto_internal!(@msg $msg $($value)*); $msg @@ -142,7 +146,7 @@ macro_rules! proto_internal { (@array $msg:ident $repeated:ident [] __ { $($value:tt)* }, $($rest:tt)*) => { proto_internal!(@array $msg $repeated [ { - let mut $msg = $crate::get_repeated_default_value($crate::__internal::Private, $repeated); + let mut $msg = $crate::__internal::get_repeated_default_value($crate::__internal::Private, $repeated); proto_internal!(@merge $msg $($value)*); proto_internal!(@msg $msg $($value)*); $msg @@ -154,7 +158,7 @@ macro_rules! proto_internal { (@array $msg:ident $repeated:ident [] __ { $($value:tt)* }) => { [ { - let mut $msg = $crate::get_repeated_default_value($crate::__internal::Private, $repeated); + let mut $msg = $crate::__internal::get_repeated_default_value($crate::__internal::Private, $repeated); proto_internal!(@merge $msg $($value)*); proto_internal!(@msg $msg $($value)*); $msg @@ -257,6 +261,189 @@ macro_rules! proto_internal { ] }; + // Begin handling (key, value) for Maps in array literals + // Message nested in array literal with trailing array items + (@array $msg:ident $map:ident [$($vals:expr),+] ($key:expr, __ { $($value:tt)* }), $($rest:tt)*) => { + proto_internal!(@array $msg $map [ + $($vals),+ , + ( + $key, + { + let mut $msg = $crate::__internal::get_map_default_value($crate::__internal::Private, $map); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] $($rest)*) + }; + + // Message nested in [] literal + (@array $msg:ident $map:ident [$($vals:expr),+] ($key:expr, __ { $($value:tt)* })) => { + [ + $($vals),+ , + ( + $key, + { + let mut $msg = $crate::__internal::get_map_default_value($crate::__internal::Private, $map); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] + }; + + // Message nested in array literal with trailing array items + (@array $msg:ident $map:ident [] ($key:expr, __ { $($value:tt)* }), $($rest:tt)*) => { + proto_internal!(@array $msg $map [ + ( + $key, + { + let mut $msg = $crate::__internal::get_map_default_value($crate::__internal::Private, $map); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] $($rest)*) + }; + + // Message nested in [] literal + (@array $msg:ident $map:ident [] ($key:expr, __ { $($value:tt)* })) => { + [ + ( + $key, + { + let mut $msg = $crate::__internal::get_map_default_value($crate::__internal::Private, $map); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] + }; + + // End of __ repeated, now we need to handle named types + + // Message nested in array literal with trailing array items + (@array $msg:ident $map:ident [$($vals:expr),+] ($key:expr, $($msgtype:ident)::+ { $($value:tt)* }), $($rest:tt)*) => { + proto_internal!(@array $msg $map [ + $($vals),+ , + ( + $key, + { + let mut $msg = $($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] $($rest)*) + }; + // Message nested in [] literal with leading :: on type and trailing array items + (@array $msg:ident $map:ident [$($vals:expr),+] ($key:expr, ::$($msgtype:ident)::+ { $($value:tt)* }), $($rest:tt)*) => { + proto_internal!(@array $msg $map [ + $($vals),+ , + ( + $key, + { + let mut $msg = ::$($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] $($rest)*) + }; + // Message nested in [] literal + (@array $msg:ident $map:ident [$($vals:expr),+] ($key:expr, $($msgtype:ident)::+ { $($value:tt)* })) => { + [ + $($vals),+ , + ( + $key, + { + let mut $msg = $($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] + }; + // Message nested in [] literal with leading :: on type + (@array $msg:ident $map:ident [$($vals:expr),+] ($key:expr, ::$($msgtype:ident)::+ { $($value:tt)* })) => { + [ + $($vals),+ , + ( + $key, + { + let mut $msg = ::$($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] + }; + + // Message nested in array literal with trailing array items + (@array $msg:ident $map:ident [] ($key:expr, $($msgtype:ident)::+ { $($value:tt)* }), $($rest:tt)*) => { + proto_internal!(@array $msg $map [ + ( + $key, + { + let mut $msg = $($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] $($rest)*) + }; + // with leading :: + (@array $msg:ident $map:ident [] ($key:expr, ::$($msgtype:ident)::+ { $($value:tt)* }), $($rest:tt)*) => { + proto_internal!(@array $msg $map [ + ( + $key, + { + let mut $msg = ::$($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] $($rest)*) + }; + // Message nested in [] literal + (@array $msg:ident $map:ident [] ($key:expr, $($msgtype:ident)::+ { $($value:tt)* })) => { + [ + ( + $key, + { + let mut $msg = $($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] + }; + (@array $msg:ident $map:ident [] ::($key:expr, $($msgtype:ident)::+ { $($value:tt)* })) => { + [ + ( + $key, + { + let mut $msg = ::$($msgtype)::+::new(); + proto_internal!(@merge $msg $($value)*); + proto_internal!(@msg $msg $($value)*); + $msg + } + ) + ] + }; + // End handling of (key, value) for Maps + (@array $msg:ident $repeated:ident [$($vals:expr),+] $expr:expr, $($rest:tt)*) => { proto_internal!(@array $msg $repeated [$($vals),+, $expr] $($rest)*) }; diff --git a/third_party/protobuf/rust/protobuf.rs b/third_party/protobuf/rust/protobuf.rs index 13d0b5f14d522..d7f9bff9a71f3 100644 --- a/third_party/protobuf/rust/protobuf.rs +++ b/third_party/protobuf/rust/protobuf.rs @@ -7,12 +7,13 @@ //! Rust Protobuf Runtime //! -//! This file forwards to `shared.rs`, which exports a kernel-specific -//! `__runtime`. Rust Protobuf gencode actually depends directly on kernel -//! specific crates. This crate exists for two reasons: -//! - To be able to use `protobuf` as a crate name for both cpp and upb kernels -//! from user code. -//! - To make it more difficult to access internal-only items by default. +//! This file exists as the public entry point for the Rust Protobuf runtime. It +//! is a thin re-export of the `shared.rs` file but is needed for two reasons: +//! - To create a single `protobuf` crate name for either cpp and upb kernels +//! from user code (toggled at compile time). +//! - Blocks the __internal module from being re-exported to application code, +//! unless they use one of our visibility-restricted targets (gencode does +//! have access to them). #[cfg(cpp_kernel)] use protobuf_cpp as kernel; @@ -20,6 +21,14 @@ use protobuf_cpp as kernel; #[cfg(upb_kernel)] use protobuf_upb as kernel; -pub use kernel::__public::*; +/// Block these two mods from being re-exported by the `pub use` +/// below (glob use automatically only adds things that aren't otherwise +/// defined). +/// +/// By creating a const instead of an empty mod it is easier to have a test +/// that confirms this targeted 'blocking' is working as intended. +#[doc(hidden)] +#[allow(non_upper_case_globals)] +pub const __internal: () = (); -pub use kernel::prelude; +pub use kernel::*; diff --git a/third_party/protobuf/rust/protobuf_codegen/Cargo.toml b/third_party/protobuf/rust/protobuf_codegen/Cargo.toml deleted file mode 100644 index bcec2cdc30f61..0000000000000 --- a/third_party/protobuf/rust/protobuf_codegen/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -edition = "2021" -name = "protobuf-codegen" -readme = "README.md" -version = "4.27.3-beta.0" - -[dependencies] -walkdir = "2.5.0" -cc = "1.1.6" \ No newline at end of file diff --git a/third_party/protobuf/rust/protobuf_codegen/example/Cargo.toml b/third_party/protobuf/rust/protobuf_codegen/example/Cargo.toml deleted file mode 100644 index e95d55900dd53..0000000000000 --- a/third_party/protobuf/rust/protobuf_codegen/example/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "protobuf-codegen-example" -version = "0.1.0" -edition = "2021" - -[dependencies] -protobuf = { path = "../protobuf" } - -[build-dependencies] -protobuf-codegen = { path = "../protobuf_codegen" } \ No newline at end of file diff --git a/third_party/protobuf/rust/protobuf_codegen/example/build.rs b/third_party/protobuf/rust/protobuf_codegen/example/build.rs deleted file mode 100644 index 4b80e1e8af619..0000000000000 --- a/third_party/protobuf/rust/protobuf_codegen/example/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -use protobuf_codegen::CodeGen; -use std::env; - -fn main() { - let mut codegen = CodeGen::new(); - codegen - .protoc_path(env::var("PROTOC").expect("PROTOC should be set to the path to protoc")) - .protoc_gen_upb_minitable_path(env::var("PROTOC_GEN_UPB_MINITABLE").expect( - "PROTOC_GEN_UPB_MINITABLE should be set to the path to protoc-gen-upb_minitable", - )) - .inputs(["foo.proto", "bar/bar.proto"]) - .include("proto"); - codegen.compile().unwrap(); -} diff --git a/third_party/protobuf/rust/protobuf_codegen/src/lib.rs b/third_party/protobuf/rust/protobuf_codegen/src/lib.rs deleted file mode 100644 index db2998a0e3a26..0000000000000 --- a/third_party/protobuf/rust/protobuf_codegen/src/lib.rs +++ /dev/null @@ -1,154 +0,0 @@ -use std::fs::{self, OpenOptions}; -use std::io::prelude::*; -use std::path::{Path, PathBuf}; -use walkdir::WalkDir; - -#[derive(Debug)] -pub struct CodeGen { - inputs: Vec<PathBuf>, - output_dir: PathBuf, - protoc_path: PathBuf, - protoc_gen_upb_path: PathBuf, - protoc_gen_upb_minitable_path: PathBuf, - includes: Vec<PathBuf>, -} - -const VERSION: &str = env!("CARGO_PKG_VERSION"); - -impl CodeGen { - pub fn new() -> Self { - Self { - inputs: Vec::new(), - output_dir: std::env::current_dir().unwrap().join("src").join("protos"), - protoc_path: PathBuf::from("protoc"), - protoc_gen_upb_path: PathBuf::from("protoc-gen-upb"), - protoc_gen_upb_minitable_path: PathBuf::from("protoc-gen-upb_minitable"), - includes: Vec::new(), - } - } - - pub fn input(&mut self, input: impl AsRef<Path>) -> &mut Self { - self.inputs.push(input.as_ref().to_owned()); - self - } - - pub fn inputs(&mut self, inputs: impl IntoIterator<Item = impl AsRef<Path>>) -> &mut Self { - self.inputs.extend(inputs.into_iter().map(|input| input.as_ref().to_owned())); - self - } - - pub fn output_dir(&mut self, output_dir: impl AsRef<Path>) -> &mut Self { - self.output_dir = output_dir.as_ref().to_owned(); - self - } - - pub fn protoc_path(&mut self, protoc_path: impl AsRef<Path>) -> &mut Self { - self.protoc_path = protoc_path.as_ref().to_owned(); - self - } - - pub fn protoc_gen_upb_path(&mut self, protoc_gen_upb_path: impl AsRef<Path>) -> &mut Self { - self.protoc_gen_upb_path = protoc_gen_upb_path.as_ref().to_owned(); - self - } - - pub fn protoc_gen_upb_minitable_path( - &mut self, - protoc_gen_upb_minitable_path: impl AsRef<Path>, - ) -> &mut Self { - self.protoc_gen_upb_minitable_path = protoc_gen_upb_minitable_path.as_ref().to_owned(); - self - } - - pub fn include(&mut self, include: impl AsRef<Path>) -> &mut Self { - self.includes.push(include.as_ref().to_owned()); - self - } - - pub fn includes(&mut self, includes: impl Iterator<Item = impl AsRef<Path>>) -> &mut Self { - self.includes.extend(includes.into_iter().map(|include| include.as_ref().to_owned())); - self - } - - /// Generate Rust, upb, and upb minitables. Build and link the C code. - pub fn compile(&self) -> Result<(), String> { - let libupb_version = std::env::var("DEP_LIBUPB_VERSION").expect("DEP_LIBUPB_VERSION should have been set, make sure that the Protobuf crate is a dependency"); - if VERSION != libupb_version { - panic!( - "protobuf-codegen version {} does not match protobuf version {}.", - VERSION, libupb_version - ); - } - - let mut cmd = std::process::Command::new(&self.protoc_path); - for input in &self.inputs { - cmd.arg(input); - } - if !self.output_dir.exists() { - // Attempt to make the directory if it doesn't exist - let _ = std::fs::create_dir(&self.output_dir); - } - cmd.arg(format!("--rust_out={}", self.output_dir.display())) - .arg("--rust_opt=experimental-codegen=enabled,kernel=upb") - .arg(format!("--plugin=protoc-gen-upb={}", self.protoc_gen_upb_path.display())) - .arg(format!( - "--plugin=protoc-gen-upb_minitable={}", - self.protoc_gen_upb_minitable_path.display() - )) - .arg(format!("--upb_minitable_out={}", self.output_dir.display())); - for include in &self.includes { - cmd.arg(format!("--proto_path={}", include.display())); - } - let output = cmd.output().map_err(|e| format!("failed to run protoc: {}", e))?; - println!("{}", std::str::from_utf8(&output.stdout).unwrap()); - eprintln!("{}", std::str::from_utf8(&output.stderr).unwrap()); - assert!(output.status.success()); - - let mut cc_build = cc::Build::new(); - cc_build - .include( - std::env::var_os("DEP_LIBUPB_INCLUDE") - .expect("DEP_LIBUPB_INCLUDE should have been set, make sure that the Protobuf crate is a dependency"), - ) - .include(self.output_dir.clone()) - .flag("-std=c99"); - for entry in WalkDir::new(&self.output_dir) { - if let Ok(entry) = entry { - let path = entry.path(); - let file_name = path.file_name().unwrap().to_str().unwrap(); - if file_name.ends_with(".upb_minitable.c") { - cc_build.file(path); - } - if file_name.ends_with(".upb.h") { - Self::strip_upb_inline(&path); - cc_build.file(path.with_extension("c")); - } - if file_name.ends_with(".pb.rs") { - Self::fix_rs_gencode(&path); - } - } - } - cc_build.compile(&format!("{}_upb_gen_code", std::env::var("CARGO_PKG_NAME").unwrap())); - Ok(()) - } - - // Remove UPB_INLINE from the .upb.h file. - fn strip_upb_inline(header: &Path) { - let contents = fs::read_to_string(header).unwrap().replace("UPB_INLINE ", ""); - let mut file = - OpenOptions::new().write(true).truncate(true).open(header.with_extension("c")).unwrap(); - file.write(contents.as_bytes()).unwrap(); - } - - // Adjust the generated Rust code to work with the crate structure. - fn fix_rs_gencode(path: &Path) { - let contents = fs::read_to_string(path) - .unwrap() - .replace("crate::", "") - .replace("protobuf_upb", "protobuf") - .replace("::__pb", "__pb") - .replace("::__std", "__std"); - let mut file = OpenOptions::new().write(true).truncate(true).open(path).unwrap(); - file.write(contents.as_bytes()).unwrap(); - } -} diff --git a/third_party/protobuf/rust/release_crates/BUILD b/third_party/protobuf/rust/release_crates/BUILD new file mode 100644 index 0000000000000..f531f9053b05f --- /dev/null +++ b/third_party/protobuf/rust/release_crates/BUILD @@ -0,0 +1,31 @@ +# Protobuf Rust crate packaging for release. + +# Run the cargo test with only a bundled linux-x86_64 protoc. +sh_binary( + name = "cargo_test", + srcs = ["cargo_test.sh"], + data = [ + "//:protoc", + "//rust/release_crates/protobuf:protobuf_crate", + "//rust/release_crates/protobuf_codegen:protobuf_codegen_crate", + "//rust/release_crates/protobuf_example:protobuf_example_crate", + "//rust/release_crates/protobuf_well_known_types:crate", + "//upb_generator/minitable:protoc-gen-upb_minitable", + ], + tags = ["manual"], + deps = ["@bazel_tools//tools/bash/runfiles"], +) + +sh_binary( + name = "release", + srcs = ["release.sh"], + data = [ + "//:protoc", + "//rust/release_crates/protobuf:protobuf_crate", + "//rust/release_crates/protobuf_codegen:protobuf_codegen_crate", + "//rust/release_crates/protobuf_example:protobuf_example_crate", + "//upb_generator/minitable:protoc-gen-upb_minitable", + ], + tags = ["manual"], + deps = ["@bazel_tools//tools/bash/runfiles"], +) diff --git a/third_party/protobuf/rust/release_crates/README.md b/third_party/protobuf/rust/release_crates/README.md new file mode 100644 index 0000000000000..4ca9a2ae98232 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/README.md @@ -0,0 +1,4 @@ +This directory contains one directory per crate that we release. + +Each directory contains a pkg_tar() which packages up the crate into a tar which +can be pushed to crates.io. \ No newline at end of file diff --git a/third_party/protobuf/rust/release_crates/cargo_test.sh b/third_party/protobuf/rust/release_crates/cargo_test.sh new file mode 100755 index 0000000000000..7e9d337cdf305 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/cargo_test.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Runs tests that are defined in the protobuf crate using Cargo. This also +# performs a publish dry-run, which catches some but not all issues that +# would prevent the crates from being published. +# This is not a hermetic task because Cargo will fetch the needed +# dependencies from crates.io + +# --- begin runfiles.bash initialization --- +# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash). +set -euo pipefail +if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then + if [[ -f "$0.runfiles_manifest" ]]; then + export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" + elif [[ -f "$0.runfiles/MANIFEST" ]]; then + export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" + elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then + export RUNFILES_DIR="$0.runfiles" + fi +fi +if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then + source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" +elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then + source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ + "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" +else + echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" + exit 1 +fi +# --- end runfiles.bash initialization --- + +TMP_DIR=$(mktemp -d) +trap 'rm -rf -- "$TMP_DIR"' EXIT + +CARGO_HOME=$TMP_DIR/cargo_home +mkdir $CARGO_HOME + +CRATE_ROOT=$TMP_DIR/protobuf +mkdir $CRATE_ROOT + +PROTOBUF_TAR=$(rlocation com_google_protobuf/rust/release_crates/protobuf/protobuf_crate.tar) + +echo "Expanding protobuf crate tar" +tar -xvf $PROTOBUF_TAR -C $CRATE_ROOT + +CODEGEN_ROOT=$TMP_DIR/protobuf_codegen +mkdir $CODEGEN_ROOT + +CODEGEN_TAR=$(rlocation com_google_protobuf/rust/release_crates/protobuf_codegen/protobuf_codegen_crate.tar) + +echo "Expanding protobuf_codegen crate tar" +tar -xvf $CODEGEN_TAR -C $CODEGEN_ROOT + +EXAMPLE_ROOT=$TMP_DIR/protobuf_example +mkdir $EXAMPLE_ROOT + +EXAMPLE_TAR=$(rlocation com_google_protobuf/rust/release_crates/protobuf_example/protobuf_example_crate.tar) + +echo "Expanding protobuf_example crate tar" +tar -xvf $EXAMPLE_TAR -C $EXAMPLE_ROOT + +WELL_KNOWN_TYPES_ROOT=$TMP_DIR/protobuf_well_known_types +mkdir $WELL_KNOWN_TYPES_ROOT + +WELL_KNOWN_TYPES_TAR=$(rlocation com_google_protobuf/rust/release_crates/protobuf_well_known_types/crate.tar) + +echo "Expanding protobuf_well_known_types crate tar" +tar -xvf $WELL_KNOWN_TYPES_TAR -C $WELL_KNOWN_TYPES_ROOT + +# Put the Bazel-built protoc and plugin at the beginning of $PATH +PATH=$(dirname $(rlocation com_google_protobuf/protoc)):$PATH +PATH=$(dirname $(rlocation com_google_protobuf/upb_generator/minitable/protoc-gen-upb_minitable)):$PATH + +cd $CRATE_ROOT +CARGO_HOME=$CARGO_HOME cargo test +CARGO_HOME=$CARGO_HOME cargo publish --dry-run + +cd $CODEGEN_ROOT +CARGO_HOME=$CARGO_HOME cargo test +CARGO_HOME=$CARGO_HOME cargo publish --dry-run + +cd $EXAMPLE_ROOT +CARGO_HOME=$CARGO_HOME cargo test + +cd $WELL_KNOWN_TYPES_ROOT +CARGO_HOME=$CARGO_HOME cargo test + +# TODO: Cannot enable this dry-run yet because it checks that the versions of +# its dependencies are published on crates.io, which they are definitely not +# in this case. +# CARGO_HOME=$CARGO_HOME cargo publish --dry-run diff --git a/third_party/protobuf/rust/release_crates/protobuf/BUILD b/third_party/protobuf/rust/release_crates/protobuf/BUILD new file mode 100644 index 0000000000000..5e5dd4bda0ab4 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf/BUILD @@ -0,0 +1,40 @@ +load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("//rust/release_crates:substitute_rust_release_version.bzl", "substitute_rust_release_version") + +pkg_tar( + name = "protobuf_crate", + srcs = [ + ":crate_root_files", + "//:LICENSE", + "//rust:rust_protobuf_libupb_src", + "//rust:rust_protobuf_src_dir", + ], + visibility = ["//rust:__subpackages__"], +) + +pkg_files( + name = "crate_root_files", + srcs = [":srcs"], + strip_prefix = strip_prefix.from_root("rust/release_crates/protobuf"), +) + +substitute_rust_release_version( + src = "Cargo-template.toml", + out = "Cargo.toml", +) + +substitute_rust_release_version( + src = "README-template.md", + out = "README.md", +) + +filegroup( + name = "srcs", + srcs = [ + "Cargo.toml", + "README.md", + "build.rs", + ], + visibility = ["//rust:__subpackages__"], +) diff --git a/third_party/protobuf/rust/cargo/Cargo.toml b/third_party/protobuf/rust/release_crates/protobuf/Cargo-template.toml similarity index 68% rename from third_party/protobuf/rust/cargo/Cargo.toml rename to third_party/protobuf/rust/release_crates/protobuf/Cargo-template.toml index 2ed875695d371..c02be0868e77a 100644 --- a/third_party/protobuf/rust/cargo/Cargo.toml +++ b/third_party/protobuf/rust/release_crates/protobuf/Cargo-template.toml @@ -7,11 +7,12 @@ [package] name = "protobuf" -version = "4.27.3-beta.0" -edition = "2021" -links = "libupb" +version = "{VERSION}" +edition = "2021" # The Rust edition (not to be confused with Protobuf Edition). +links = "upb" license = "BSD-3-Clause" rust-version = "1.74" +description = "Protocol Buffers - Google's data interchange format" [lib] path = "src/shared.rs" @@ -20,10 +21,10 @@ path = "src/shared.rs" paste = "1.0.15" [dev-dependencies] -googletest = {git = "https://github.com/google/googletest-rust.git" } +googletest = "0.13.0" [build-dependencies] cc = "1.1.6" [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bzl)', 'cfg(cpp_kernel)', 'cfg(upb_kernel)'] } \ No newline at end of file +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bzl)', 'cfg(cpp_kernel)', 'cfg(upb_kernel)'] } diff --git a/third_party/protobuf/rust/release_crates/protobuf/README-template.md b/third_party/protobuf/rust/release_crates/protobuf/README-template.md new file mode 100644 index 0000000000000..d09c6791fd235 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf/README-template.md @@ -0,0 +1,48 @@ +The runtime of the official Google Rust Protobuf implementation. + +This is currently a beta release: the API is subject to change, and there may be +some rough edges, including missing documentation and features. + +Usage of this crate currently requires protoc to be built from source as it +relies on changes that have not been included in the newest protoc release yet. + +An example for how to use this crate can be found in the +[protobuf_example crate](http://crates.io/crates/protobuf_example) + +# V4 ownership and implementation change + +V4 of this crate is officially supported by the Protobuf team at Google. Prior +major versions were developed by as a community project by +[stepancheg](https://github.com/stepancheg) who generously donated the crate +name to Google. + +V4 is a completely new implementation with a different API, as well as a +fundamentally different approach than prior versions of this crate. It focuses +on delivering a high-quality Rust API which is backed by either a pure C +implementation (upb) or the Protobuf C++ implementation. This choice was made +for performance, feature parity, development velocity, and security reasons. More +discussion about the rationale and design philosophy can be found at +[https://protobuf.dev/reference/rust/](https://protobuf.dev/reference/rust/). + +It is not planned for the V3 pure Rust lineage to be actively developed going +forward. While it is not expected to receive significant further development, as +a stable and high quality pure Rust implementation, many open source projects +may reasonably continue to stay on the V3 API. + +# How to get a compatible version of protoc + +Usage of this crate currently requires protoc to be built from source as it +relies on changes that have not been included in the newest protoc release yet. + +A future stable release will be compatible with the officially released protoc +binaries. + +You can build a compatible protoc from source as follows: + +``` +git clone https://github.com/protocolbuffers/protobuf.git +cd protobuf +git checkout rust-prerelease-{VERSION} +cmake . -Dprotobuf_FORCE_FETCH_DEPENDENCIES=ON +cmake --build . --parallel 12" +``` diff --git a/third_party/protobuf/rust/cargo/build.rs b/third_party/protobuf/rust/release_crates/protobuf/build.rs similarity index 100% rename from third_party/protobuf/rust/cargo/build.rs rename to third_party/protobuf/rust/release_crates/protobuf/build.rs diff --git a/third_party/protobuf/rust/release_crates/protobuf_codegen/BUILD b/third_party/protobuf/rust/release_crates/protobuf_codegen/BUILD new file mode 100644 index 0000000000000..42c875b432bb5 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_codegen/BUILD @@ -0,0 +1,38 @@ +load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("//rust/release_crates:substitute_rust_release_version.bzl", "substitute_rust_release_version") + +pkg_tar( + name = "protobuf_codegen_crate", + srcs = [ + ":protobuf_codegen_files", + "//:LICENSE", + ], + tags = ["manual"], + visibility = ["//rust:__subpackages__"], +) + +pkg_files( + name = "protobuf_codegen_files", + srcs = [":srcs"], + strip_prefix = strip_prefix.from_root("rust/release_crates/protobuf_codegen"), +) + +substitute_rust_release_version( + src = "Cargo-template.toml", + out = "Cargo.toml", +) + +substitute_rust_release_version( + src = "README-template.md", + out = "README.md", +) + +filegroup( + name = "srcs", + srcs = [ + "Cargo.toml", + "README.md", + ] + glob(["src/**/*"]), + visibility = ["//rust:__subpackages__"], +) diff --git a/third_party/protobuf/rust/release_crates/protobuf_codegen/Cargo-template.toml b/third_party/protobuf/rust/release_crates/protobuf_codegen/Cargo-template.toml new file mode 100644 index 0000000000000..f3ece958dcd07 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_codegen/Cargo-template.toml @@ -0,0 +1,15 @@ +[package] +edition = "2021" # The Rust edition (not to be confused with Protobuf Edition). +name = "protobuf-codegen" +readme = "README.md" +version = "{VERSION}" +description = "Code generator for Rust Protocol Buffers bindings" +license = "BSD-3-Clause" +rust-version = "1.74" + + +[dependencies] +cc = "1.1.6" + +[dev-dependencies] +googletest = "0.13.0" diff --git a/third_party/protobuf/rust/release_crates/protobuf_codegen/README-template.md b/third_party/protobuf/rust/release_crates/protobuf_codegen/README-template.md new file mode 100644 index 0000000000000..5caea061b0910 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_codegen/README-template.md @@ -0,0 +1,27 @@ +The build time dependency crate for generating code for the official Google Rust +Protobuf implementation. + +The code generated by this is expected to be used in conjunction with the +official [Protobuf crate](http://crates.io/crates/protobuf). + +This is currently a beta release: the API is subject to change, +and there may be some rough edges, including missing documentation and features. + +# How to get a compatible version of protoc + +Usage of this crate currently requires protoc to be built from +source, as it relies on changes that have not been included in the newest protoc +release yet. + +A future stable release will be compatible with the officially released protoc +binaries. + +You can build a compatible protoc from source as follows: + +``` +git clone https://github.com/protocolbuffers/protobuf.git +cd protobuf +git checkout rust-prerelease-{VERSION} +cmake . -Dprotobuf_FORCE_FETCH_DEPENDENCIES=ON +cmake --build . --parallel 12" +``` diff --git a/third_party/protobuf/rust/release_crates/protobuf_codegen/src/lib.rs b/third_party/protobuf/rust/release_crates/protobuf_codegen/src/lib.rs new file mode 100644 index 0000000000000..4cb5c37297732 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_codegen/src/lib.rs @@ -0,0 +1,226 @@ +use std::path::{Path, PathBuf}; + +#[derive(Debug)] +pub struct CodeGen { + inputs: Vec<PathBuf>, + output_dir: PathBuf, + includes: Vec<PathBuf>, +} + +const VERSION: &str = env!("CARGO_PKG_VERSION"); + +fn missing_protoc_error_message() -> String { + format!( + " +Please make sure you have protoc and protoc-gen-upb_minitable available in your PATH. You can \ +build these binaries from source as follows: \ +git clone https://github.com/protocolbuffers/protobuf.git; \ +cd protobuf; \ +git checkout rust-prerelease-{}; \ +cmake . -Dprotobuf_FORCE_FETCH_DEPENDENCIES=ON; \ +cmake --build . --parallel 12", + VERSION + ) +} + +// Given the output of "protoc --version", returns a shortened version string +// suitable for comparing against the protobuf crate version. +// +// The output of protoc --version looks something like "libprotoc XX.Y", +// optionally followed by "-dev" or "-rcN". We want to strip the "-dev" suffix +// if present and return something like "30.0" or "30.0-rc1". +fn protoc_version(protoc_output: &str) -> String { + let mut s = protoc_output.strip_prefix("libprotoc ").unwrap().to_string(); + let first_dash = s.find("-dev"); + if let Some(i) = first_dash { + s.truncate(i); + } + s +} + +// Given a crate version string, returns just the part of it suitable for +// comparing against the protoc version. The crate version is of the form +// "X.Y.Z" with an optional suffix starting with a dash. We want to drop the +// major version ("X.") and only keep the suffix if it starts with "-rc". +fn expected_protoc_version(cargo_version: &str) -> String { + let mut s = cargo_version.to_string(); + let is_release_candidate = s.find("-rc") != None; + if !is_release_candidate { + if let Some(i) = s.find('-') { + s.truncate(i); + } + } + let mut v: Vec<&str> = s.split('.').collect(); + assert_eq!(v.len(), 3); + v.remove(0); + v.join(".") +} + +impl CodeGen { + pub fn new() -> Self { + Self { + inputs: Vec::new(), + output_dir: PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("protobuf_generated"), + includes: Vec::new(), + } + } + + pub fn input(&mut self, input: impl AsRef<Path>) -> &mut Self { + self.inputs.push(input.as_ref().to_owned()); + self + } + + pub fn inputs(&mut self, inputs: impl IntoIterator<Item = impl AsRef<Path>>) -> &mut Self { + self.inputs.extend(inputs.into_iter().map(|input| input.as_ref().to_owned())); + self + } + + pub fn output_dir(&mut self, output_dir: impl AsRef<Path>) -> &mut Self { + self.output_dir = output_dir.as_ref().to_owned(); + self + } + + pub fn include(&mut self, include: impl AsRef<Path>) -> &mut Self { + self.includes.push(include.as_ref().to_owned()); + self + } + + pub fn includes(&mut self, includes: impl Iterator<Item = impl AsRef<Path>>) -> &mut Self { + self.includes.extend(includes.into_iter().map(|include| include.as_ref().to_owned())); + self + } + + fn expected_generated_rs_files(&self) -> Vec<PathBuf> { + self.inputs + .iter() + .map(|input| { + let mut input = input.clone(); + assert!(input.set_extension("u.pb.rs")); + self.output_dir.join(input) + }) + .collect() + } + + fn expected_generated_c_files(&self) -> Vec<PathBuf> { + self.inputs + .iter() + .map(|input| { + let mut input = input.clone(); + assert!(input.set_extension("upb_minitable.c")); + self.output_dir.join(input) + }) + .collect() + } + + pub fn generate_and_compile(&self) -> Result<(), String> { + let upb_version = std::env::var("DEP_UPB_VERSION").expect("DEP_UPB_VERSION should have been set, make sure that the Protobuf crate is a dependency"); + if VERSION != upb_version { + panic!( + "protobuf-codegen version {} does not match protobuf version {}.", + VERSION, upb_version + ); + } + + let mut version_cmd = std::process::Command::new("protoc"); + let output = version_cmd.arg("--version").output().map_err(|e| { + format!("failed to run protoc --version: {} {}", e, missing_protoc_error_message()) + })?; + + let protoc_version = protoc_version(&String::from_utf8(output.stdout).unwrap()); + let expected_protoc_version = expected_protoc_version(VERSION); + if protoc_version != expected_protoc_version { + panic!( + "Expected protoc version {} but found {}", + expected_protoc_version, protoc_version + ); + } + + // We cannot easily check the version of the minitable plugin, but let's at + // least verify that it is present. + std::process::Command::new("protoc-gen-upb_minitable") + .stdin(std::process::Stdio::null()) + .output() + .map_err(|e| { + format!( + "Unable to find protoc-gen-upb_minitable: {} {}", + e, + missing_protoc_error_message() + ) + })?; + + let mut cmd = std::process::Command::new("protoc"); + for input in &self.inputs { + cmd.arg(input); + } + if !self.output_dir.exists() { + // Attempt to make the directory if it doesn't exist + let _ = std::fs::create_dir(&self.output_dir); + } + + for include in &self.includes { + println!("cargo:rerun-if-changed={}", include.display()); + } + + cmd.arg(format!("--rust_out={}", self.output_dir.display())) + .arg("--rust_opt=experimental-codegen=enabled,kernel=upb") + .arg(format!("--upb_minitable_out={}", self.output_dir.display())); + for include in &self.includes { + cmd.arg(format!("--proto_path={}", include.display())); + } + let output = cmd.output().map_err(|e| format!("failed to run protoc: {}", e))?; + println!("{}", std::str::from_utf8(&output.stdout).unwrap()); + eprintln!("{}", std::str::from_utf8(&output.stderr).unwrap()); + assert!(output.status.success()); + self.compile_only() + } + + /// Builds and links the C code. + pub fn compile_only(&self) -> Result<(), String> { + let mut cc_build = cc::Build::new(); + cc_build + .include( + std::env::var_os("DEP_UPB_INCLUDE") + .expect("DEP_UPB_INCLUDE should have been set, make sure that the Protobuf crate is a dependency"), + ) + .include(self.output_dir.clone()) + .flag("-std=c99"); + + for path in &self.expected_generated_rs_files() { + if !path.exists() { + return Err(format!("expected generated file {} does not exist", path.display())); + } + println!("cargo:rerun-if-changed={}", path.display()); + } + for path in &self.expected_generated_c_files() { + if !path.exists() { + return Err(format!("expected generated file {} does not exist", path.display())); + } + println!("cargo:rerun-if-changed={}", path.display()); + cc_build.file(path); + } + cc_build.compile(&format!("{}_upb_gen_code", std::env::var("CARGO_PKG_NAME").unwrap())); + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use googletest::prelude::*; + + #[gtest] + fn test_protoc_version() { + assert_that!(protoc_version("libprotoc 30.0"), eq("30.0")); + assert_that!(protoc_version("libprotoc 30.0-dev"), eq("30.0")); + assert_that!(protoc_version("libprotoc 30.0-rc1"), eq("30.0-rc1")); + } + + #[googletest::test] + fn test_expected_protoc_version() { + assert_that!(expected_protoc_version("4.30.0"), eq("30.0")); + assert_that!(expected_protoc_version("4.30.0-alpha"), eq("30.0")); + assert_that!(expected_protoc_version("4.30.0-beta"), eq("30.0")); + assert_that!(expected_protoc_version("4.30.0-pre"), eq("30.0")); + assert_that!(expected_protoc_version("4.30.0-rc1"), eq("30.0-rc1")); + } +} diff --git a/third_party/protobuf/rust/release_crates/protobuf_example/BUILD b/third_party/protobuf/rust/release_crates/protobuf_example/BUILD new file mode 100644 index 0000000000000..a9a1b3954394b --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_example/BUILD @@ -0,0 +1,43 @@ +load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("//rust/release_crates:substitute_rust_release_version.bzl", "substitute_rust_release_version") + +pkg_tar( + name = "protobuf_example_crate", + srcs = [ + ":protobuf_example_files", + "//:LICENSE", + ], + visibility = ["//rust:__subpackages__"], +) + +pkg_files( + name = "protobuf_example_files", + srcs = [":srcs"], + strip_prefix = strip_prefix.from_root("rust/release_crates/protobuf_example"), +) + +substitute_rust_release_version( + src = "Cargo-template.toml", + out = "Cargo.toml", +) + +substitute_rust_release_version( + src = "README-template.md", + out = "README.md", +) + +filegroup( + name = "srcs", + srcs = [ + "Cargo.toml", + "README.md", + "build.rs", + ] + glob( + [ + "proto/**/*", + "src/**/*", + ], + ), + visibility = ["//rust:__subpackages__"], +) diff --git a/third_party/protobuf/rust/release_crates/protobuf_example/Cargo-template.toml b/third_party/protobuf/rust/release_crates/protobuf_example/Cargo-template.toml new file mode 100644 index 0000000000000..ffa002877b613 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_example/Cargo-template.toml @@ -0,0 +1,12 @@ +[package] +name = "protobuf-example" +version = "{VERSION}" +edition = "2021" +description = "Example use of Rust Protocol Buffers bindings" +license = "BSD-3-Clause" + +[dependencies] +protobuf = { version = "{VERSION}", path = "../protobuf", package = "protobuf" } + +[build-dependencies] +protobuf-codegen = { version = "{VERSION}", path = "../protobuf_codegen", package = "protobuf-codegen" } diff --git a/third_party/protobuf/rust/release_crates/protobuf_example/README-template.md b/third_party/protobuf/rust/release_crates/protobuf_example/README-template.md new file mode 100644 index 0000000000000..7783f68256595 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_example/README-template.md @@ -0,0 +1,21 @@ +An example that demonstrates how to use the `protobuf` and `protobuf_codegen` +crates together. + +# How to get a compatible version of protoc + +Usage of this crate currently requires protoc to be built from +source, as it relies on changes that have not been included in the newest protoc +release yet. + +A future stable release will be compatible with the officially released protoc +binaries. + +You can build a compatible protoc from source as follows: + +``` +git clone https://github.com/protocolbuffers/protobuf.git +cd protobuf +git checkout rust-prerelease-{VERSION} +cmake . -Dprotobuf_FORCE_FETCH_DEPENDENCIES=ON +cmake --build . --parallel 12" +``` diff --git a/third_party/protobuf/rust/release_crates/protobuf_example/build.rs b/third_party/protobuf/rust/release_crates/protobuf_example/build.rs new file mode 100644 index 0000000000000..0924c662d408a --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_example/build.rs @@ -0,0 +1,9 @@ +use protobuf_codegen::CodeGen; + +fn main() { + CodeGen::new() + .inputs(["proto_example/foo.proto", "proto_example/bar/bar.proto"]) + .include("proto") + .generate_and_compile() + .unwrap(); +} diff --git a/third_party/protobuf/rust/protobuf_codegen/example/proto/bar/bar.proto b/third_party/protobuf/rust/release_crates/protobuf_example/proto/proto_example/bar/bar.proto similarity index 100% rename from third_party/protobuf/rust/protobuf_codegen/example/proto/bar/bar.proto rename to third_party/protobuf/rust/release_crates/protobuf_example/proto/proto_example/bar/bar.proto diff --git a/third_party/protobuf/rust/protobuf_codegen/example/proto/foo.proto b/third_party/protobuf/rust/release_crates/protobuf_example/proto/proto_example/foo.proto similarity index 78% rename from third_party/protobuf/rust/protobuf_codegen/example/proto/foo.proto rename to third_party/protobuf/rust/release_crates/protobuf_example/proto/proto_example/foo.proto index 92bc3952f9a96..83f3c4aaabaa2 100644 --- a/third_party/protobuf/rust/protobuf_codegen/example/proto/foo.proto +++ b/third_party/protobuf/rust/release_crates/protobuf_example/proto/proto_example/foo.proto @@ -2,7 +2,7 @@ edition = "2023"; package proto_example; -import "bar/bar.proto"; +import "proto_example/bar/bar.proto"; message Foo { int32 int = 1; diff --git a/third_party/protobuf/rust/protobuf_codegen/example/src/main.rs b/third_party/protobuf/rust/release_crates/protobuf_example/src/main.rs similarity index 78% rename from third_party/protobuf/rust/protobuf_codegen/example/src/main.rs rename to third_party/protobuf/rust/release_crates/protobuf_example/src/main.rs index 4b82be6abccf4..ecb3cb9b0a89a 100644 --- a/third_party/protobuf/rust/protobuf_codegen/example/src/main.rs +++ b/third_party/protobuf/rust/release_crates/protobuf_example/src/main.rs @@ -1,8 +1,8 @@ -#[path = "protos/foo.u.pb.rs"] -mod protos; - use protobuf::proto; +mod protos { + include!(concat!(env!("OUT_DIR"), "/protobuf_generated/proto_example/generated.rs")); +} use protos::Foo; fn main() { @@ -14,7 +14,7 @@ fn main() { mod tests { use super::*; - #[test] + #[test] // allow_core_test fn set_strings() { let foo = proto!(Foo { name: "foo", bar: __ { name: "bar" } }); @@ -22,7 +22,7 @@ mod tests { assert_eq!(foo.bar().name(), "bar"); } - #[test] + #[test] // allow_core_test fn set_ints() { let foo = proto!(Foo { int: 42, bar: __ { numbers: [1, 2, 3] } }); diff --git a/third_party/protobuf/rust/release_crates/protobuf_well_known_types/BUILD.bazel b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/BUILD.bazel new file mode 100644 index 0000000000000..16313d69878f2 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/BUILD.bazel @@ -0,0 +1,38 @@ +load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("//:protobuf_version.bzl", "PROTOBUF_RUST_VERSION") + +pkg_tar( + name = "crate", + srcs = [ + ":crate_root_files", + ":well_known_types", + "//:LICENSE", + ], + visibility = ["//rust:__subpackages__"], +) + +pkg_files( + name = "crate_root_files", + srcs = [":srcs"], + strip_prefix = strip_prefix.from_root("rust/release_crates/protobuf_well_known_types"), +) + +genrule( + name = "gen_cargo_toml", + srcs = ["Cargo-template.toml"], + outs = ["Cargo.toml"], + cmd = "cat $(SRCS) | sed -e 's/{{VERSION}}/{0}-beta/g' > $(OUTS)".format(PROTOBUF_RUST_VERSION), +) + +filegroup( + name = "srcs", + srcs = [":gen_cargo_toml"] + glob(["**/*"]), + visibility = ["//rust:__subpackages__"], +) + +pkg_files( + name = "well_known_types", + srcs = ["//src/google/protobuf:well_known_type_protos"], + prefix = "proto/google/protobuf", +) diff --git a/third_party/protobuf/rust/release_crates/protobuf_well_known_types/Cargo-template.toml b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/Cargo-template.toml new file mode 100644 index 0000000000000..34e47c21913e3 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/Cargo-template.toml @@ -0,0 +1,12 @@ +[package] +name = "protobuf-well-known-types" +version = "{VERSION}" +edition = "2021" +description = "Protobuf Well-Known Types" +license = "BSD-3-Clause" + +[dependencies] +protobuf = { version = "{VERSION}", path = "../protobuf", package = "protobuf" } + +[build-dependencies] +protobuf-codegen = { version = "{VERSION}", path = "../protobuf_codegen", package = "protobuf-codegen" } diff --git a/third_party/protobuf/rust/release_crates/protobuf_well_known_types/README.md b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/README.md new file mode 100644 index 0000000000000..b198aa2bb4d98 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/README.md @@ -0,0 +1,2 @@ +This crate contains the protobuf +[well-known types](https://protobuf.dev/reference/protobuf/google.protobuf/). diff --git a/third_party/protobuf/rust/release_crates/protobuf_well_known_types/build.rs b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/build.rs new file mode 100644 index 0000000000000..779124c4109bf --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/build.rs @@ -0,0 +1,20 @@ +use protobuf_codegen::CodeGen; + +fn main() { + CodeGen::new() + .inputs([ + "google/protobuf/any.proto", + "google/protobuf/api.proto", + "google/protobuf/duration.proto", + "google/protobuf/empty.proto", + "google/protobuf/field_mask.proto", + "google/protobuf/source_context.proto", + "google/protobuf/struct.proto", + "google/protobuf/timestamp.proto", + "google/protobuf/type.proto", + "google/protobuf/wrappers.proto", + ]) + .include("proto") + .generate_and_compile() + .unwrap(); +} diff --git a/third_party/protobuf/rust/release_crates/protobuf_well_known_types/src/lib.rs b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/src/lib.rs new file mode 100644 index 0000000000000..7018111627968 --- /dev/null +++ b/third_party/protobuf/rust/release_crates/protobuf_well_known_types/src/lib.rs @@ -0,0 +1 @@ +include!(concat!(env!("OUT_DIR"), "/protobuf_generated/google/protobuf/any.u.pb.rs")); diff --git a/third_party/protobuf/rust/cargo_test.sh b/third_party/protobuf/rust/release_crates/release.sh similarity index 54% rename from third_party/protobuf/rust/cargo_test.sh rename to third_party/protobuf/rust/release_crates/release.sh index 46460c9b3fb49..4954aee39aa73 100755 --- a/third_party/protobuf/rust/cargo_test.sh +++ b/third_party/protobuf/rust/release_crates/release.sh @@ -1,7 +1,5 @@ #!/bin/bash -# Runs tests that are defined in the protobuf crate using Cargo. -# This is not a hermetic task because Cargo will fetch the needed -# dependencies from crates.io +# A script that publishes the protobuf crates to crates.io. # --- begin runfiles.bash initialization --- # Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash). @@ -26,6 +24,8 @@ else fi # --- end runfiles.bash initialization --- +read -p 'Enter cratesio auth token: ' AUTH_TOKEN + TMP_DIR=$(mktemp -d) trap 'rm -rf -- "$TMP_DIR"' EXIT @@ -35,33 +35,37 @@ mkdir $CARGO_HOME CRATE_ROOT=$TMP_DIR/protobuf mkdir $CRATE_ROOT -PROTOBUF_ZIP=$(rlocation com_google_protobuf/rust/rust_crate.zip) +PROTOBUF_TAR=$(rlocation com_google_protobuf/rust/release_crates/protobuf/protobuf_crate.tar) -unzip -d $CRATE_ROOT $PROTOBUF_ZIP +echo "Expanding protobuf crate tar" +tar -xvf $PROTOBUF_TAR -C $CRATE_ROOT CODEGEN_ROOT=$TMP_DIR/protobuf_codegen mkdir $CODEGEN_ROOT -CODEGEN_ZIP=$(rlocation com_google_protobuf/rust/codegen_crate.zip) +CODEGEN_TAR=$(rlocation com_google_protobuf/rust/release_crates/protobuf_codegen/protobuf_codegen_crate.tar) -unzip -d $CODEGEN_ROOT $CODEGEN_ZIP +echo "Expanding protbuf_codegen crate tar" +tar -xvf $CODEGEN_TAR -C $CODEGEN_ROOT -EXAMPLE_ROOT=$TMP_DIR/codegen_example +EXAMPLE_ROOT=$TMP_DIR/protobuf_example mkdir $EXAMPLE_ROOT -EXAMPLE_ZIP=$(rlocation com_google_protobuf/rust/codegen_example.zip) +EXAMPLE_TAR=$(rlocation com_google_protobuf/rust/release_crates/protobuf_example/protobuf_example_crate.tar) -unzip -d $EXAMPLE_ROOT $EXAMPLE_ZIP +echo "Expanding protobuf_example crate tar" +tar -xvf $EXAMPLE_TAR -C $EXAMPLE_ROOT + +# Put the Bazel-built protoc and plugin at the beginning of $PATH +PATH=$(dirname $(rlocation com_google_protobuf/protoc)):$PATH +PATH=$(dirname $(rlocation com_google_protobuf/upb_generator/minitable/protoc-gen-upb_minitable)):$PATH cd $CRATE_ROOT -# Run all tests except doctests -CARGO_HOME=$CARGO_HOME cargo test --lib --bins --tests +CARGO_HOME=$CARGO_HOME CARGO_REGISTRY_TOKEN=$AUTH_TOKEN cargo publish cd $CODEGEN_ROOT -CARGO_HOME=$CARGO_HOME cargo test --lib --bins --tests - -PROTOC=$(rlocation com_google_protobuf/protoc) -PROTOC_GEN_UPB_MINITABLE=$(rlocation com_google_protobuf/upb_generator/minitable/protoc-gen-upb_minitable) +CARGO_HOME=$CARGO_HOME CARGO_REGISTRY_TOKEN=$AUTH_TOKEN cargo publish cd $EXAMPLE_ROOT -CARGO_HOME=$CARGO_HOME PROTOC=$PROTOC PROTOC_GEN_UPB_MINITABLE=$PROTOC_GEN_UPB_MINITABLE cargo test +CARGO_HOME=$CARGO_HOME CARGO_REGISTRY_TOKEN=$AUTH_TOKEN cargo publish + diff --git a/third_party/protobuf/rust/release_crates/substitute_rust_release_version.bzl b/third_party/protobuf/rust/release_crates/substitute_rust_release_version.bzl new file mode 100644 index 0000000000000..eed862269fd1c --- /dev/null +++ b/third_party/protobuf/rust/release_crates/substitute_rust_release_version.bzl @@ -0,0 +1,15 @@ +"""A rule to textually replace {{VERSION}} with the Rust release version in files.""" + +load("//:protobuf_version.bzl", "PROTOBUF_RUST_VERSION") + +# Temporarily append a prerelease suffix to our versions until we consider the release stable. +PROTOBUF_RUST_VERSION_WITH_BETA_SUFFIX = PROTOBUF_RUST_VERSION + "-beta2" + +def substitute_rust_release_version(src, out, name = None): + version = PROTOBUF_RUST_VERSION_WITH_BETA_SUFFIX + native.genrule( + name = name or ("gen_%s" % out), + srcs = [src], + outs = [out], + cmd = "cat $(SRCS) | sed -e 's/{{VERSION}}/{0}/g' > $(OUTS)".format(version), + ) diff --git a/third_party/protobuf/rust/repeated.rs b/third_party/protobuf/rust/repeated.rs index b1a406b3cd570..1e51df1a7cb45 100644 --- a/third_party/protobuf/rust/repeated.rs +++ b/third_party/protobuf/rust/repeated.rs @@ -5,6 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd +use std::fmt::{self, Debug}; use std::iter; use std::iter::FusedIterator; /// Repeated scalar fields are implemented around the runtime-specific @@ -12,13 +13,12 @@ use std::iter::FusedIterator; /// runtime-specific representation of a repeated scalar (`upb_Array*` on upb, /// and `RepeatedField<T>*` on cpp). use std::marker::PhantomData; -use std::fmt::{self, Debug}; use crate::{ AsMut, AsView, IntoMut, IntoProxied, IntoView, Mut, MutProxied, MutProxy, Proxied, Proxy, View, ViewProxy, + __internal::runtime::{InnerRepeated, InnerRepeatedMut, RawRepeatedField}, __internal::{Private, SealedInternal}, - __runtime::{InnerRepeated, InnerRepeatedMut, RawRepeatedField}, }; /// Views the elements in a `repeated` field of `T`. @@ -379,7 +379,10 @@ impl<T> Proxied for Repeated<T> where T: ProxiedInRepeated, { - type View<'msg> = RepeatedView<'msg, T> where Repeated<T>: 'msg; + type View<'msg> + = RepeatedView<'msg, T> + where + Repeated<T>: 'msg; } impl<T> SealedInternal for Repeated<T> where T: ProxiedInRepeated {} @@ -399,7 +402,10 @@ impl<T> MutProxied for Repeated<T> where T: ProxiedInRepeated, { - type Mut<'msg> = RepeatedMut<'msg, T> where Repeated<T>: 'msg; + type Mut<'msg> + = RepeatedMut<'msg, T> + where + Repeated<T>: 'msg; } impl<T> AsMut for Repeated<T> diff --git a/third_party/protobuf/rust/shared.rs b/third_party/protobuf/rust/shared.rs index 8e42de96504b7..8e49f75bf7acc 100644 --- a/third_party/protobuf/rust/shared.rs +++ b/third_party/protobuf/rust/shared.rs @@ -5,10 +5,6 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -//! Kernel-agnostic logic for the Rust Protobuf Runtime. -//! -//! For kernel-specific logic this crate delegates to the respective `__runtime` -//! crate. #![deny(unsafe_op_in_unsafe_fn)] use std::fmt; @@ -18,52 +14,44 @@ use std::fmt; // This problem is referred to as "perfect derive". // https://smallcultfollowing.com/babysteps/blog/2022/04/12/implied-bounds-and-perfect-derive/ -/// Everything in `__public` is re-exported in `protobuf.rs`. -/// These are the items protobuf users can access directly. -#[doc(hidden)] -pub mod __public { - pub use crate::codegen_traits::{ - create::Parse, - interop::{MessageMutInterop, MessageViewInterop, OwnedMessageInterop}, - read::Serialize, - write::{Clear, ClearAndParse, MergeFrom}, - Message, MessageMut, MessageView, - }; - pub use crate::cord::{ProtoBytesCow, ProtoStringCow}; - pub use crate::r#enum::{Enum, UnknownEnumValue}; - pub use crate::map::{Map, MapIter, MapMut, MapView, ProxiedInMapValue}; - pub use crate::optional::Optional; - pub use crate::proto; - pub use crate::proxied::{ - AsMut, AsView, IntoMut, IntoProxied, IntoView, Mut, MutProxied, MutProxy, Proxied, Proxy, - View, ViewProxy, - }; - pub use crate::repeated::{ - ProxiedInRepeated, Repeated, RepeatedIter, RepeatedMut, RepeatedView, - }; - pub use crate::string::{ProtoBytes, ProtoStr, ProtoString}; - pub use crate::{ParseError, SerializeError}; -} -pub use __public::*; +pub use crate::codegen_traits::{ + create::Parse, + interop::{MessageMutInterop, MessageViewInterop, OwnedMessageInterop}, + read::Serialize, + write::{Clear, ClearAndParse, MergeFrom}, + Message, MessageMut, MessageView, +}; +pub use crate::cord::{ProtoBytesCow, ProtoStringCow}; +pub use crate::map::{Map, MapIter, MapMut, MapView, ProxiedInMapValue}; +pub use crate::optional::Optional; +pub use crate::proxied::{ + AsMut, AsView, IntoMut, IntoProxied, IntoView, Mut, MutProxied, MutProxy, Proxied, Proxy, View, + ViewProxy, +}; +pub use crate::r#enum::{Enum, UnknownEnumValue}; +pub use crate::repeated::{ProxiedInRepeated, Repeated, RepeatedIter, RepeatedMut, RepeatedView}; +pub use crate::string::{ProtoBytes, ProtoStr, ProtoString, Utf8Error}; pub mod prelude; -/// Everything in `__internal` is allowed to change without it being considered -/// a breaking change for the protobuf library. Nothing in here should be -/// exported in `protobuf.rs`. +/// The `__internal` module is for necessary encapsulation breaks between +/// generated code and the runtime. +/// +/// These symbols are never intended to be used by application code under any +/// circumstances. +/// +/// In blaze/bazel builds, this symbol is actively hidden from application +/// code by having a shim crate in front that does not re-export this symbol, +/// and a different BUILD visibility-restricted target that is used by the +/// generated code. +/// +/// In Cargo builds we have no good way to technically hide this +/// symbol while still allowing it from codegen, so it is only by private by +/// convention. As application code should never use this module, anything +/// changes under `__internal` is not considered a semver breaking change. #[path = "internal.rs"] pub mod __internal; -/// Everything in `__runtime` is allowed to change without it being considered -/// a breaking change for the protobuf library. Nothing in here should be -/// exported in `protobuf.rs`. -#[cfg(all(bzl, cpp_kernel))] -#[path = "cpp.rs"] -pub mod __runtime; -#[cfg(any(not(bzl), upb_kernel))] -#[path = "upb.rs"] -pub mod __runtime; - mod codegen_traits; mod cord; #[path = "enum.rs"] @@ -116,10 +104,3 @@ impl fmt::Display for SerializeError { write!(f, "Couldn't serialize proto into bytes (depth too deep or missing required fields)") } } - -pub fn get_repeated_default_value<T: repeated::ProxiedInRepeated + Default>( - _: __internal::Private, - _: repeated::RepeatedView<'_, T>, -) -> T { - Default::default() -} diff --git a/third_party/protobuf/rust/string.rs b/third_party/protobuf/rust/string.rs index cc473039f0d95..6d3658900171d 100644 --- a/third_party/protobuf/rust/string.rs +++ b/third_party/protobuf/rust/string.rs @@ -9,8 +9,8 @@ #![allow(dead_code)] #![allow(unused)] +use crate::__internal::runtime::{InnerProtoString, PtrAndLen, RawMessage}; use crate::__internal::{Private, SealedInternal}; -use crate::__runtime::{InnerProtoString, PtrAndLen, RawMessage}; use crate::{ utf8::Utf8Chunks, AsView, IntoProxied, IntoView, Mut, MutProxied, MutProxy, Optional, Proxied, Proxy, View, ViewProxy, diff --git a/third_party/protobuf/rust/test/BUILD b/third_party/protobuf/rust/test/BUILD index 3d58de67850ac..2ae3d8f7b3598 100644 --- a/third_party/protobuf/rust/test/BUILD +++ b/third_party/protobuf/rust/test/BUILD @@ -4,12 +4,17 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("//bazel:proto_library.bzl", "proto_library") load( "//rust:defs.bzl", "rust_cc_proto_library", "rust_upb_proto_library", ) +package( + default_visibility = ["//rust/test:__subpackages__"], +) + proto_library( name = "parent_proto", srcs = ["parent.proto"], @@ -26,28 +31,24 @@ proto_library( rust_upb_proto_library( name = "parent_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":parent_proto"], ) rust_upb_proto_library( name = "child_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":child_proto"], ) rust_cc_proto_library( name = "parent_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":parent_proto"], ) rust_cc_proto_library( name = "child_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":child_proto"], ) @@ -60,14 +61,12 @@ proto_library( rust_cc_proto_library( name = "dots_in_package_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":dots_in_package_proto"], ) rust_upb_proto_library( name = "dots_in_package_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":dots_in_package_proto"], ) @@ -81,14 +80,12 @@ proto_library( rust_cc_proto_library( name = "edition2023_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":edition2023_proto"], ) rust_upb_proto_library( name = "edition2023_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":edition2023_proto"], ) @@ -101,14 +98,12 @@ proto_library( rust_cc_proto_library( name = "enums_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":enums_proto"], ) rust_upb_proto_library( name = "enums_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":enums_proto"], ) @@ -155,14 +150,12 @@ proto_library( rust_cc_proto_library( name = "import_public_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":import_public_proto"], ) rust_upb_proto_library( name = "import_public_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":import_public_proto"], ) @@ -190,14 +183,12 @@ proto_library( rust_cc_proto_library( name = "no_package_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":no_package_proto"], ) rust_upb_proto_library( name = "no_package_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":no_package_proto"], ) @@ -222,14 +213,12 @@ proto_library( rust_cc_proto_library( name = "package_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":package_proto"], ) rust_upb_proto_library( name = "package_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":package_proto"], ) @@ -246,14 +235,12 @@ proto_library( rust_upb_proto_library( name = "package_disabiguation_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":package_disabiguation_proto"], ) rust_cc_proto_library( name = "package_disabiguation_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":package_disabiguation_proto"], ) @@ -266,14 +253,12 @@ proto_library( rust_cc_proto_library( name = "bad_names_cpp_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":bad_names_proto"], ) rust_upb_proto_library( name = "bad_names_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":bad_names_proto"], ) @@ -286,37 +271,35 @@ proto_library( rust_cc_proto_library( name = "nested_cpp_rust_proto", testonly = True, - visibility = [ - "//rust/test/cpp:__subpackages__", - "//rust/test/shared:__subpackages__", - ], deps = [":nested_proto"], ) rust_upb_proto_library( name = "nested_upb_rust_proto", testonly = True, - visibility = ["//rust/test/shared:__subpackages__"], deps = [":nested_proto"], ) +proto_library( + name = "map_unittest_proto", + srcs = [ + "map_unittest.proto", + ], + deps = [ + ":unittest_proto", + ], +) + rust_cc_proto_library( name = "map_unittest_cpp_rust_proto", testonly = True, - visibility = [ - "//rust/test/shared:__subpackages__", - ], - deps = ["//src/google/protobuf:map_unittest_proto"], + deps = [":map_unittest_proto"], ) rust_upb_proto_library( name = "map_unittest_upb_rust_proto", testonly = True, - visibility = [ - "//rust/test/shared:__subpackages__", - "//rust/test/upb:__subpackages__", - ], - deps = ["//src/google/protobuf:map_unittest_proto"], + deps = [":map_unittest_proto"], ) proto_library( @@ -328,18 +311,12 @@ proto_library( rust_cc_proto_library( name = "imported_types_cpp_rust_proto", testonly = True, - visibility = [ - "//rust/test/shared:__subpackages__", - ], deps = [":imported_types_proto"], ) rust_upb_proto_library( name = "imported_types_upb_rust_proto", testonly = True, - visibility = [ - "//rust/test/shared:__subpackages__", - ], deps = [":imported_types_proto"], ) @@ -354,17 +331,112 @@ proto_library( rust_cc_proto_library( name = "fields_with_imported_types_cpp_rust_proto", testonly = True, - visibility = [ - "//rust/test/shared:__subpackages__", - ], deps = [":fields-with-imported-types_proto"], ) rust_upb_proto_library( name = "fields_with_imported_types_upb_rust_proto", testonly = True, - visibility = [ - "//rust/test/shared:__subpackages__", - ], deps = [":fields-with-imported-types_proto"], ) + +proto_library( + name = "unittest_proto", + srcs = ["unittest.proto"], + deps = [":unittest_import_proto"], +) + +rust_upb_proto_library( + name = "unittest_upb_rust_proto", + testonly = True, + deps = [":unittest_proto"], +) + +rust_cc_proto_library( + name = "unittest_cpp_rust_proto", + testonly = True, + deps = ["unittest_proto"], +) + +proto_library( + name = "unittest_import_proto", + srcs = ["unittest_import.proto"], +) + +rust_upb_proto_library( + name = "unittest_import_upb_rust_proto", + testonly = True, + deps = [":unittest_import_proto"], +) + +rust_cc_proto_library( + name = "unittest_import_cpp_rust_proto", + testonly = True, + deps = ["unittest_import_proto"], +) + +proto_library( + name = "unittest_proto3_proto", + srcs = ["unittest_proto3.proto"], + deps = [":unittest_import_proto"], +) + +rust_upb_proto_library( + name = "unittest_proto3_upb_rust_proto", + testonly = True, + deps = [":unittest_proto3_proto"], +) + +rust_cc_proto_library( + name = "unittest_proto3_cpp_rust_proto", + testonly = True, + deps = ["unittest_proto3_proto"], +) + +proto_library( + name = "unittest_proto3_optional_proto", + srcs = ["unittest_proto3_optional.proto"], +) + +rust_upb_proto_library( + name = "unittest_proto3_optional_upb_rust_proto", + testonly = True, + deps = [":unittest_proto3_optional_proto"], +) + +rust_cc_proto_library( + name = "unittest_proto3_optional_cpp_rust_proto", + testonly = True, + deps = ["unittest_proto3_optional_proto"], +) + +proto_library( + name = "srcsless_library_test_child_proto", + testonly = True, + srcs = ["srcsless_library_test_child.proto"], +) + +proto_library( + name = "srcsless_library_test_alias_proto", + testonly = True, + deps = [":srcsless_library_test_child_proto"], +) + +proto_library( + name = "srcsless_library_test_parent_proto", + testonly = True, + srcs = ["srcsless_library_test_parent.proto"], + deps = [":srcsless_library_test_alias_proto"], +) + +rust_cc_proto_library( + name = "srcsless_library_test_parent_cpp_rust_proto", + testonly = True, + deps = [":srcsless_library_test_parent_proto"], +) + +rust_upb_proto_library( + name = "srcsless_library_test_parent_upb_rust_proto", + testonly = True, + deps = [":srcsless_library_test_parent_proto"], +) diff --git a/third_party/protobuf/rust/test/bad_names.proto b/third_party/protobuf/rust/test/bad_names.proto index 21fbf3b7cb4e1..600d04749d83d 100644 --- a/third_party/protobuf/rust/test/bad_names.proto +++ b/third_party/protobuf/rust/test/bad_names.proto @@ -23,6 +23,8 @@ message Self { optional Self self = 2; optional bool true = 3; optional string false = 4; + repeated int32 match = 5; + optional bool clear = 6; } message Pub { diff --git a/third_party/protobuf/rust/test/cpp/BUILD b/third_party/protobuf/rust/test/cpp/BUILD index eac60a71c5c63..3293654847699 100644 --- a/third_party/protobuf/rust/test/cpp/BUILD +++ b/third_party/protobuf/rust/test/cpp/BUILD @@ -12,6 +12,7 @@ # `//rust:protobuf`. load("@rules_rust//rust:defs.bzl", "rust_test") +load("//bazel:proto_library.bzl", "proto_library") load( "//rust:defs.bzl", "rust_cc_proto_library", @@ -38,9 +39,7 @@ proto_library( rust_cc_proto_library( name = "optimize_for_lite_cpp_rust_proto", testonly = True, - visibility = [ - "//rust/test/shared:__subpackages__", - ], + visibility = ["//visibility:private"], deps = [":optimize_for_lite_proto"], ) diff --git a/third_party/protobuf/rust/test/cpp/debug_test.rs b/third_party/protobuf/rust/test/cpp/debug_test.rs index d1e50f97123d7..7878ab6a9fd72 100644 --- a/third_party/protobuf/rust/test/cpp/debug_test.rs +++ b/third_party/protobuf/rust/test/cpp/debug_test.rs @@ -10,7 +10,6 @@ fn test_debug() { msg.set_secret_user_data("password"); assert_that!(format!("{msg:?}"), contains_substring("id: 1")); - assert_that!(format!("{msg:?}"), not(contains_substring("password"))); } #[cfg(lite_runtime)] @@ -21,7 +20,6 @@ fn test_debug_lite() { msg.set_secret_user_data("password"); assert_that!(format!("{msg:?}"), contains_substring("MessageLite")); - assert_that!(format!("{msg:?}"), not(contains_substring("password"))); } /// A message with the option set to optimize for lite will behave as a lite @@ -32,5 +30,4 @@ fn test_optimize_for_lite_option() { let mut msg = OptimizeForLiteTestMessage::new(); msg.set_value("password"); assert_that!(format!("{msg:?}"), contains_substring("MessageLite")); - assert_that!(format!("{msg:?}"), not(contains_substring("password"))); } diff --git a/third_party/protobuf/rust/test/cpp/interop/BUILD b/third_party/protobuf/rust/test/cpp/interop/BUILD index ac4852660a677..4482bee1414a6 100644 --- a/third_party/protobuf/rust/test/cpp/interop/BUILD +++ b/third_party/protobuf/rust/test/cpp/interop/BUILD @@ -1,15 +1,21 @@ # This package contains tests exercising C++/Rust interop in the cpp kernel. load("@rules_rust//rust:defs.bzl", "rust_test") +load("//bazel:cc_proto_library.bzl", "cc_proto_library") +load("//bazel:proto_library.bzl", "proto_library") +load( + "//rust:defs.bzl", + "rust_cc_proto_library", +) cc_library( name = "test_utils", srcs = ["test_utils.cc"], deps = [ + ":interop_test_cc_proto", "//rust/cpp_kernel:cpp_api", - "//src/google/protobuf:unittest_cc_proto", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", ], ) @@ -17,9 +23,24 @@ rust_test( name = "interop_test", srcs = ["main.rs"], deps = [ + ":interop_test_cpp_rust_proto", ":test_utils", "//rust:protobuf_cpp", - "//src/google/protobuf:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) + +proto_library( + name = "interop_test_proto", + srcs = ["interop_test.proto"], +) + +cc_proto_library( + name = "interop_test_cc_proto", + deps = [":interop_test_proto"], +) + +rust_cc_proto_library( + name = "interop_test_cpp_rust_proto", + deps = [":interop_test_proto"], +) diff --git a/third_party/protobuf/rust/test/cpp/interop/interop_test.proto b/third_party/protobuf/rust/test/cpp/interop/interop_test.proto new file mode 100644 index 0000000000000..ca3351d9165bf --- /dev/null +++ b/third_party/protobuf/rust/test/cpp/interop/interop_test.proto @@ -0,0 +1,16 @@ +edition = "2023"; + +package rust_cpp_interop_test; + +message InteropTestMessage { + int64 i64 = 1; + bytes bytes = 2; + bool b = 3; + int32 default_int32 = 4 [default = 41]; + + extensions 100 to max; +} + +extend InteropTestMessage { + bytes bytes_extension = 100; +} diff --git a/third_party/protobuf/rust/test/cpp/interop/main.rs b/third_party/protobuf/rust/test/cpp/interop/main.rs index 1b4781bb388ef..544c8a0328be5 100644 --- a/third_party/protobuf/rust/test/cpp/interop/main.rs +++ b/third_party/protobuf/rust/test/cpp/interop/main.rs @@ -8,80 +8,84 @@ use googletest::prelude::*; use protobuf_cpp::prelude::*; -use protobuf_cpp::__runtime::PtrAndLen; +use protobuf_cpp::__internal::runtime::PtrAndLen; use protobuf_cpp::{MessageMutInterop, MessageViewInterop, OwnedMessageInterop}; use std::ffi::c_void; -use unittest_rust_proto::{TestAllExtensions, TestAllTypes, TestAllTypesMut, TestAllTypesView}; + +use interop_test_rust_proto::{InteropTestMessage, InteropTestMessageMut, InteropTestMessageView}; macro_rules! proto_assert_eq { ($lhs:expr, $rhs:expr) => {{ let lhs = &$lhs; let rhs = &$rhs; - assert_that!(lhs.optional_int64(), eq(rhs.optional_int64())); - assert_that!(lhs.optional_bytes(), eq(rhs.optional_bytes())); - assert_that!(lhs.optional_bool(), eq(rhs.optional_bool())); + assert_that!(lhs.i64(), eq(rhs.i64())); + assert_that!(lhs.bytes(), eq(rhs.bytes())); + assert_that!(lhs.b(), eq(rhs.b())); }}; } // Helper functions invoking C++ Protobuf APIs directly in C++. // Defined in `test_utils.cc`. extern "C" { - fn TakeOwnershipAndGetOptionalInt32(msg: *mut c_void) -> i32; - fn DeserializeTestAllTypes(data: *const u8, len: usize) -> *mut c_void; - fn MutateTestAllTypes(msg: *mut c_void); - fn SerializeTestAllTypes(msg: *const c_void) -> protobuf_cpp::__runtime::SerializedData; - fn DeleteTestAllTypes(msg: *mut c_void); + fn TakeOwnershipAndGetOptionalInt64(msg: *mut c_void) -> i64; + fn DeserializeInteropTestMessage(data: *const u8, len: usize) -> *mut c_void; + fn MutateInteropTestMessage(msg: *mut c_void); + fn SerializeInteropTestMessage( + msg: *const c_void, + ) -> protobuf_cpp::__internal::runtime::SerializedData; + fn DeleteInteropTestMessage(msg: *mut c_void); fn NewWithExtension() -> *mut c_void; fn GetBytesExtension(msg: *const c_void) -> PtrAndLen; - fn GetConstStaticTestAllTypes() -> *const c_void; + fn GetConstStaticInteropTestMessage() -> *const c_void; } #[gtest] fn send_to_cpp() { - let mut msg1 = TestAllTypes::new(); - msg1.set_optional_int32(7); - let i = unsafe { TakeOwnershipAndGetOptionalInt32(msg1.__unstable_leak_raw_message()) }; + let mut msg1 = InteropTestMessage::new(); + msg1.set_i64(7); + let i = unsafe { TakeOwnershipAndGetOptionalInt64(msg1.__unstable_leak_raw_message()) }; assert_eq!(i, 7); } #[gtest] fn mutate_message_mut_in_cpp() { - let mut msg1 = TestAllTypes::new(); + let mut msg1 = InteropTestMessage::new(); unsafe { - MutateTestAllTypes(msg1.as_mut().__unstable_as_raw_message_mut()); + MutateInteropTestMessage(msg1.as_mut().__unstable_as_raw_message_mut()); } - let mut msg2 = TestAllTypes::new(); - msg2.set_optional_int64(42); - msg2.set_optional_bytes(b"something mysterious"); - msg2.set_optional_bool(false); + let mut msg2 = InteropTestMessage::new(); + msg2.set_i64(42); + msg2.set_bytes(b"something mysterious"); + msg2.set_b(false); proto_assert_eq!(msg1, msg2); } #[gtest] fn deserialize_in_rust() { - let mut msg1 = TestAllTypes::new(); - msg1.set_optional_int64(-1); - msg1.set_optional_bytes(b"some cool data I guess"); - let serialized = unsafe { SerializeTestAllTypes(msg1.as_view().__unstable_as_raw_message()) }; + let mut msg1 = InteropTestMessage::new(); + msg1.set_i64(-1); + msg1.set_bytes(b"some cool data I guess"); + let serialized = + unsafe { SerializeInteropTestMessage(msg1.as_view().__unstable_as_raw_message()) }; - let msg2 = TestAllTypes::parse(&serialized).unwrap(); + let msg2 = InteropTestMessage::parse(&serialized).unwrap(); proto_assert_eq!(msg1, msg2); } #[gtest] fn deserialize_in_cpp() { - let mut msg1 = TestAllTypes::new(); - msg1.set_optional_int64(-1); - msg1.set_optional_bytes(b"some cool data I guess"); + let mut msg1 = InteropTestMessage::new(); + msg1.set_i64(-1); + msg1.set_bytes(b"some cool data I guess"); let data = msg1.serialize().unwrap(); let msg2 = unsafe { - TestAllTypes::__unstable_take_ownership_of_raw_message(DeserializeTestAllTypes( + InteropTestMessage::__unstable_take_ownership_of_raw_message(DeserializeInteropTestMessage( (*data).as_ptr(), data.len(), )) @@ -92,38 +96,38 @@ fn deserialize_in_cpp() { #[gtest] fn deserialize_in_cpp_into_mut() { - let mut msg1 = TestAllTypes::new(); - msg1.set_optional_int64(-1); - msg1.set_optional_bytes(b"some cool data I guess"); + let mut msg1 = InteropTestMessage::new(); + msg1.set_i64(-1); + msg1.set_bytes(b"some cool data I guess"); let data = msg1.serialize().unwrap(); - let mut raw_msg = unsafe { DeserializeTestAllTypes((*data).as_ptr(), data.len()) }; - let msg2 = unsafe { TestAllTypesMut::__unstable_wrap_raw_message_mut(&mut raw_msg) }; + let mut raw_msg = unsafe { DeserializeInteropTestMessage((*data).as_ptr(), data.len()) }; + let msg2 = unsafe { InteropTestMessageMut::__unstable_wrap_raw_message_mut(&mut raw_msg) }; proto_assert_eq!(msg1, msg2); // The C++ still owns the message here and needs to delete it. unsafe { - DeleteTestAllTypes(raw_msg); + DeleteInteropTestMessage(raw_msg); } } #[gtest] fn deserialize_in_cpp_into_view() { - let mut msg1 = TestAllTypes::new(); - msg1.set_optional_int64(-1); - msg1.set_optional_bytes(b"some cool data I guess"); + let mut msg1 = InteropTestMessage::new(); + msg1.set_i64(-1); + msg1.set_bytes(b"some cool data I guess"); let data = msg1.serialize().unwrap(); - let raw_msg = unsafe { DeserializeTestAllTypes((*data).as_ptr(), data.len()) }; + let raw_msg = unsafe { DeserializeInteropTestMessage((*data).as_ptr(), data.len()) }; let const_msg = raw_msg as *const _; - let msg2 = unsafe { TestAllTypesView::__unstable_wrap_raw_message(&const_msg) }; + let msg2 = unsafe { InteropTestMessageView::__unstable_wrap_raw_message(&const_msg) }; proto_assert_eq!(msg1, msg2); // The C++ still owns the message here and needs to delete it. unsafe { - DeleteTestAllTypes(raw_msg); + DeleteInteropTestMessage(raw_msg); } } @@ -132,10 +136,10 @@ fn deserialize_in_cpp_into_view() { #[gtest] fn smuggle_extension() { let msg1 = - unsafe { TestAllExtensions::__unstable_take_ownership_of_raw_message(NewWithExtension()) }; + unsafe { InteropTestMessage::__unstable_take_ownership_of_raw_message(NewWithExtension()) }; let data = msg1.serialize().unwrap(); - let mut msg2 = TestAllExtensions::parse(&data).unwrap(); + let mut msg2 = InteropTestMessage::parse(&data).unwrap(); let bytes = unsafe { GetBytesExtension(msg2.as_mut().__unstable_as_raw_message_mut()).as_ref() }; assert_eq!(bytes, b"smuggled"); @@ -143,11 +147,11 @@ fn smuggle_extension() { #[gtest] fn view_of_const_static() { - let view: TestAllTypesView<'static> = unsafe { - TestAllTypesView::__unstable_wrap_raw_message_unchecked_lifetime( - GetConstStaticTestAllTypes(), + let view: InteropTestMessageView<'static> = unsafe { + InteropTestMessageView::__unstable_wrap_raw_message_unchecked_lifetime( + GetConstStaticInteropTestMessage(), ) }; - assert_eq!(view.optional_int64(), 0); + assert_eq!(view.i64(), 0); assert_eq!(view.default_int32(), 41); } diff --git a/third_party/protobuf/rust/test/cpp/interop/test_utils.cc b/third_party/protobuf/rust/test/cpp/interop/test_utils.cc index 32e419ba200ad..b95168562f4c5 100644 --- a/third_party/protobuf/rust/test/cpp/interop/test_utils.cc +++ b/third_party/protobuf/rust/test/cpp/interop/test_utils.cc @@ -12,55 +12,55 @@ #include "absl/strings/string_view.h" #include "rust/cpp_kernel/serialized_data.h" #include "rust/cpp_kernel/strings.h" -#include "google/protobuf/unittest.pb.h" +#include "rust/test/cpp/interop/interop_test.pb.h" using google::protobuf::rust::SerializedData; using google::protobuf::rust::SerializeMsg; +using rust_cpp_interop_test::InteropTestMessage; -extern "C" void MutateTestAllTypes(protobuf_unittest::TestAllTypes* msg) { - msg->set_optional_int64(42); - msg->set_optional_bytes("something mysterious"); - msg->set_optional_bool(false); +extern "C" void MutateInteropTestMessage(InteropTestMessage* msg) { + msg->set_i64(42); + msg->set_bytes("something mysterious"); + msg->set_b(false); } -extern "C" SerializedData SerializeTestAllTypes( - const protobuf_unittest::TestAllTypes* msg) { +extern "C" SerializedData SerializeInteropTestMessage( + const InteropTestMessage* msg) { SerializedData data; ABSL_CHECK(SerializeMsg(msg, &data)); return data; } -extern "C" void DeleteTestAllTypes(protobuf_unittest::TestAllTypes* msg) { +extern "C" void DeleteInteropTestMessage(InteropTestMessage* msg) { delete msg; } -extern "C" void* DeserializeTestAllTypes(const void* data, size_t size) { - auto* proto = new protobuf_unittest::TestAllTypes; +extern "C" void* DeserializeInteropTestMessage(const void* data, size_t size) { + auto* proto = new InteropTestMessage; proto->ParseFromArray(data, static_cast<int>(size)); return proto; } extern "C" void* NewWithExtension() { - auto* proto = new protobuf_unittest::TestAllExtensions; - proto->SetExtension(protobuf_unittest::optional_bytes_extension, "smuggled"); + auto* proto = new InteropTestMessage; + proto->SetExtension(rust_cpp_interop_test::bytes_extension, "smuggled"); return proto; } extern "C" google::protobuf::rust::PtrAndLen GetBytesExtension( - const protobuf_unittest::TestAllExtensions* proto) { + const InteropTestMessage* proto) { absl::string_view bytes = - proto->GetExtension(protobuf_unittest::optional_bytes_extension); + proto->GetExtension(rust_cpp_interop_test::bytes_extension); return {bytes.data(), bytes.size()}; } -extern "C" int32_t TakeOwnershipAndGetOptionalInt32( - protobuf_unittest::TestAllTypes* msg) { - int32_t i = msg->optional_int32(); +extern "C" int64_t TakeOwnershipAndGetOptionalInt64(InteropTestMessage* msg) { + int64_t i = msg->i64(); delete msg; return i; } -extern "C" const void* GetConstStaticTestAllTypes() { - static const auto* msg = new protobuf_unittest::TestAllTypes; +extern "C" const void* GetConstStaticInteropTestMessage() { + static const auto* msg = new InteropTestMessage; return msg; } diff --git a/third_party/protobuf/rust/test/fields_with_imported_types.proto b/third_party/protobuf/rust/test/fields_with_imported_types.proto index 2610ff2c743c3..0cbd4c700d3fd 100644 --- a/third_party/protobuf/rust/test/fields_with_imported_types.proto +++ b/third_party/protobuf/rust/test/fields_with_imported_types.proto @@ -9,7 +9,7 @@ syntax = "proto2"; package main; -import "google/protobuf/rust/test/imported_types.proto"; +import "rust/test/imported_types.proto"; message MsgWithFieldsWithImportedTypes { optional imported_types.ImportedMessage imported_message_field = 1; @@ -20,3 +20,9 @@ message MsgWithFieldsWithImportedTypes { imported_types.ImportedEnum imported_enum_oneof = 4; } } + +// This will produce a module called imported_types_proto. Let's verify that we +// can do this without conflicting with the crate of the same name. +message ImportedTypesProto { + message Nested {} +} diff --git a/third_party/protobuf/rust/test/import_public.proto b/third_party/protobuf/rust/test/import_public.proto index 1103b66411a94..4c35039488178 100644 --- a/third_party/protobuf/rust/test/import_public.proto +++ b/third_party/protobuf/rust/test/import_public.proto @@ -9,4 +9,4 @@ syntax = "proto2"; package import_public; -import public "google/protobuf/rust/test/import_public_primary_src.proto"; +import public "rust/test/import_public_primary_src.proto"; diff --git a/third_party/protobuf/rust/test/import_public2.proto b/third_party/protobuf/rust/test/import_public2.proto index 18ad958e3b6bc..8746921f38ee1 100644 --- a/third_party/protobuf/rust/test/import_public2.proto +++ b/third_party/protobuf/rust/test/import_public2.proto @@ -9,5 +9,5 @@ syntax = "proto2"; package import_public; -import public "google/protobuf/rust/test/import_public_non_primary_src1.proto"; -import public "google/protobuf/rust/test/import_public_non_primary_src2.proto"; +import public "rust/test/import_public_non_primary_src1.proto"; +import public "rust/test/import_public_non_primary_src2.proto"; diff --git a/third_party/protobuf/rust/test/import_public_primary_src.proto b/third_party/protobuf/rust/test/import_public_primary_src.proto index 689cc644dc1c6..f590fc95c876f 100644 --- a/third_party/protobuf/rust/test/import_public_primary_src.proto +++ b/third_party/protobuf/rust/test/import_public_primary_src.proto @@ -9,7 +9,7 @@ syntax = "proto2"; package primary_src_testing_packages; -import public "google/protobuf/rust/test/import_public_grandparent.proto"; +import public "rust/test/import_public_grandparent.proto"; message PrimarySrcPubliclyImportedMsg {} diff --git a/third_party/protobuf/rust/test/map_unittest.proto b/third_party/protobuf/rust/test/map_unittest.proto new file mode 100644 index 0000000000000..e4e9a2910cbe5 --- /dev/null +++ b/third_party/protobuf/rust/test/map_unittest.proto @@ -0,0 +1,119 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +syntax = "proto3"; + +package rust_unittest; + +import "rust/test/unittest.proto"; + +option cc_enable_arenas = true; + +// Tests maps. +message TestMap { + map<int32, int32> map_int32_int32 = 1; + map<int64, int64> map_int64_int64 = 2; + map<uint32, uint32> map_uint32_uint32 = 3; + map<uint64, uint64> map_uint64_uint64 = 4; + map<sint32, sint32> map_sint32_sint32 = 5; + map<sint64, sint64> map_sint64_sint64 = 6; + map<fixed32, fixed32> map_fixed32_fixed32 = 7; + map<fixed64, fixed64> map_fixed64_fixed64 = 8; + map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; + map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; + map<int32, float> map_int32_float = 11; + map<int32, double> map_int32_double = 12; + map<bool, bool> map_bool_bool = 13; + map<string, string> map_string_string = 14; + map<int32, bytes> map_int32_bytes = 15; + map<int32, MapEnum> map_int32_enum = 16; + map<int32, ForeignMessage> map_int32_foreign_message = 17; + map<string, ForeignMessage> map_string_foreign_message = 18; + map<int32, TestAllTypes> map_int32_all_types = 19; +} + +message TestMapWithMessages { + map<int32, TestAllTypes> map_int32_all_types = 1; + map<int64, TestAllTypes> map_int64_all_types = 2; + map<uint32, TestAllTypes> map_uint32_all_types = 3; + map<uint64, TestAllTypes> map_uint64_all_types = 4; + map<sint32, TestAllTypes> map_sint32_all_types = 5; + map<sint64, TestAllTypes> map_sint64_all_types = 6; + map<fixed32, TestAllTypes> map_fixed32_all_types = 7; + map<fixed64, TestAllTypes> map_fixed64_all_types = 8; + map<sfixed32, TestAllTypes> map_sfixed32_all_types = 9; + map<sfixed64, TestAllTypes> map_sfixed64_all_types = 10; + map<bool, TestAllTypes> map_bool_all_types = 11; + map<string, TestAllTypes> map_string_all_types = 12; +} + +message TestMapSubmessage { + TestMap test_map = 1; +} + +message TestMessageMap { + map<int32, TestAllTypes> map_int32_message = 1; +} + +// Two map fields share the same entry default instance. +message TestSameTypeMap { + map<int32, int32> map1 = 1; + map<int32, int32> map2 = 2; +} + +enum MapEnum { + MAP_ENUM_FOO = 0; + MAP_ENUM_BAR = 1; + MAP_ENUM_BAZ = 2; +} + +// Test embedded message with required fields +message TestRequiredMessageMap { + map<int32, TestRequired> map_field = 1; +} + +message TestArenaMap { + map<int32, int32> map_int32_int32 = 1; + map<int64, int64> map_int64_int64 = 2; + map<uint32, uint32> map_uint32_uint32 = 3; + map<uint64, uint64> map_uint64_uint64 = 4; + map<sint32, sint32> map_sint32_sint32 = 5; + map<sint64, sint64> map_sint64_sint64 = 6; + map<fixed32, fixed32> map_fixed32_fixed32 = 7; + map<fixed64, fixed64> map_fixed64_fixed64 = 8; + map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9; + map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10; + map<int32, float> map_int32_float = 11; + map<int32, double> map_int32_double = 12; + map<bool, bool> map_bool_bool = 13; + map<string, string> map_string_string = 14; + map<int32, bytes> map_int32_bytes = 15; + map<int32, MapEnum> map_int32_enum = 16; + map<int32, ForeignMessage> map_int32_foreign_message = 17; +} + +// Previously, message containing enum called Type cannot be used as value of +// map field. +message MessageContainingEnumCalledType { + enum Type { + TYPE_FOO = 0; + } + map<string, MessageContainingEnumCalledType> type = 1; +} + +// Previously, message cannot contain map field called "entry". +message MessageContainingMapCalledEntry { + map<int32, int32> entry = 1; +} + +message TestRecursiveMapMessage { + map<string, TestRecursiveMapMessage> a = 1; +} + +message TestI32StrMap { + map<int32, string> m_32_str = 1; +} diff --git a/third_party/protobuf/rust/test/no_package.proto b/third_party/protobuf/rust/test/no_package.proto index 4db4f3c3a63f6..a476ffb431eea 100644 --- a/third_party/protobuf/rust/test/no_package.proto +++ b/third_party/protobuf/rust/test/no_package.proto @@ -7,7 +7,7 @@ syntax = "proto2"; -import public "google/protobuf/rust/test/no_package_import.proto"; +import public "rust/test/no_package_import.proto"; message MsgWithoutPackage {} diff --git a/third_party/protobuf/rust/test/package.proto b/third_party/protobuf/rust/test/package.proto index f68e6767a6a12..135ac0b7a3ae3 100644 --- a/third_party/protobuf/rust/test/package.proto +++ b/third_party/protobuf/rust/test/package.proto @@ -9,7 +9,7 @@ syntax = "proto2"; package testing_packages; -import public "google/protobuf/rust/test/package_import.proto"; +import public "rust/test/package_import.proto"; message MsgWithPackage {} diff --git a/third_party/protobuf/rust/test/package_disabiguation2.proto b/third_party/protobuf/rust/test/package_disabiguation2.proto index 33a0471620c50..e52c04c5dda69 100644 --- a/third_party/protobuf/rust/test/package_disabiguation2.proto +++ b/third_party/protobuf/rust/test/package_disabiguation2.proto @@ -9,7 +9,7 @@ syntax = "proto2"; package package2; -import "google/protobuf/rust/test/package_disabiguation1.proto"; +import "rust/test/package_disabiguation1.proto"; message YayConflict { optional .package1.YayConflict other_message = 1; diff --git a/third_party/protobuf/rust/test/rust_proto_library_unit_test/rust_proto_library_unit_test.bzl b/third_party/protobuf/rust/test/rust_proto_library_unit_test/rust_proto_library_unit_test.bzl index 1a6eb48bf4e71..7953ce3761dbf 100644 --- a/third_party/protobuf/rust/test/rust_proto_library_unit_test/rust_proto_library_unit_test.bzl +++ b/third_party/protobuf/rust/test/rust_proto_library_unit_test/rust_proto_library_unit_test.bzl @@ -78,7 +78,7 @@ def _relevant_linker_inputs(ltl): ) def _find_linker_input(rust_proto_info, basename_substring): - cc_info = rust_proto_info.dep_variant_info.cc_info + cc_info = rust_proto_info.dep_variant_infos[0].cc_info for linker_input in cc_info.linking_context.linker_inputs.to_list(): for ltl in linker_input.libraries: for file in _relevant_linker_inputs(ltl): @@ -173,12 +173,20 @@ def _rust_outputs_test_impl(ctx): env = analysistest.begin(ctx) target_under_test = analysistest.target_under_test(env) - label_to_file = { - "child_cpp_rust_proto": "child.c.pb.rs", - "child_upb_rust_proto": "child.u.pb.rs", + label_to_files = { + "child_cpp_rust_proto": ["generated.c.rs", "child.c.pb.rs"], + "child_upb_rust_proto": ["generated.u.rs", "child.u.pb.rs"], } - expected_output = label_to_file[target_under_test.label.name] - asserts.true(env, target_under_test.files.to_list()[0].path.endswith(expected_output)) + expected_outputs = label_to_files[target_under_test.label.name] + actual_outputs = target_under_test.files.to_list() + asserts.equals(env, len(expected_outputs), len(actual_outputs)) + for expected in expected_outputs: + found = False + for actual in actual_outputs: + if actual.path.endswith(expected): + found = True + break + asserts.true(env, found) return analysistest.end(env) diff --git a/third_party/protobuf/rust/test/shared/BUILD b/third_party/protobuf/rust/test/shared/BUILD index 43453f179fca9..673753911c2bb 100644 --- a/third_party/protobuf/rust/test/shared/BUILD +++ b/third_party/protobuf/rust/test/shared/BUILD @@ -24,7 +24,7 @@ rust_test( }, deps = [ "//rust:protobuf_upb_export", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -37,7 +37,7 @@ rust_test( }, deps = [ "//rust:protobuf_cpp_export", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -97,7 +97,7 @@ rust_test( deps = [ "//rust:protobuf_cpp_export", "//rust/test:enums_cpp_rust_proto", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -111,7 +111,7 @@ rust_test( deps = [ "//rust:protobuf_upb_export", "//rust/test:enums_upb_rust_proto", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -171,30 +171,36 @@ rust_test( rust_test( name = "bad_names_cpp_test", srcs = ["bad_names_test.rs"], + aliases = { + "//rust:protobuf_cpp_export": "protobuf", + }, deps = [ + "//rust:protobuf_cpp_export", "//rust/test:bad_names_cpp_rust_proto", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) -# TODO: This test currently fails on upb due to the thunk names not correctly matching -# the upb C codegen collision avoidance. -# rust_test( -# name = "bad_names_upb_test", -# srcs = ["bad_names_test.rs"], -# deps = [ -# "@crate_index//:googletest", -# "//rust/test:bad_names_upb_rust_proto", -# "//src/google/protobuf:unittest_upb_rust_proto", -# ], -# ) +rust_test( + name = "bad_names_upb_test", + srcs = ["bad_names_test.rs"], + aliases = { + "//rust:protobuf_upb_export": "protobuf", + }, + deps = [ + "//rust:protobuf_upb_export", + "//rust/test:bad_names_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", + "@crate_index//:googletest", + ], +) rust_test( name = "nested_types_cpp_test", srcs = ["nested_types_test.rs"], deps = [ - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -203,7 +209,7 @@ rust_test( name = "nested_types_upb_test", srcs = ["nested_types_test.rs"], deps = [ - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -219,7 +225,8 @@ rust_test( ], deps = [ "//rust:protobuf_cpp_export", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", + "//rust/test:unittest_import_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -235,7 +242,8 @@ rust_test( ], deps = [ "//rust:protobuf_upb_export", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_import_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -248,8 +256,8 @@ rust_test( }, deps = [ "//rust:protobuf_cpp_export", - "//src/google/protobuf:unittest_proto3_cpp_rust_proto", - "//src/google/protobuf:unittest_proto3_optional_cpp_rust_proto", + "//rust/test:unittest_proto3_cpp_rust_proto", + "//rust/test:unittest_proto3_optional_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -262,8 +270,8 @@ rust_test( }, deps = [ "//rust:protobuf_upb_export", - "//src/google/protobuf:unittest_proto3_optional_upb_rust_proto", - "//src/google/protobuf:unittest_proto3_upb_rust_proto", + "//rust/test:unittest_proto3_optional_upb_rust_proto", + "//rust/test:unittest_proto3_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -279,10 +287,9 @@ rust_test( ], deps = [ "//rust:protobuf_upb_export", - "//src/google/protobuf:edition_unittest_upb_rust_proto", - "//src/google/protobuf:unittest_proto3_optional_upb_rust_proto", - "//src/google/protobuf:unittest_proto3_upb_rust_proto", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_proto3_optional_upb_rust_proto", + "//rust/test:unittest_proto3_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -298,10 +305,9 @@ rust_test( ], deps = [ "//rust:protobuf_cpp_export", - "//src/google/protobuf:edition_unittest_cpp_rust_proto", - "//src/google/protobuf:unittest_cpp_rust_proto", - "//src/google/protobuf:unittest_proto3_cpp_rust_proto", - "//src/google/protobuf:unittest_proto3_optional_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", + "//rust/test:unittest_proto3_cpp_rust_proto", + "//rust/test:unittest_proto3_optional_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -343,7 +349,7 @@ rust_test( ], deps = [ "//rust:protobuf_cpp_export", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -359,7 +365,7 @@ rust_test( ], deps = [ "//rust:protobuf_upb_export", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -377,7 +383,7 @@ rust_test( "//rust:protobuf_cpp_export", "//rust/test:enums_cpp_rust_proto", "//rust/test:map_unittest_cpp_rust_proto", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -395,7 +401,7 @@ rust_test( "//rust:protobuf_upb_export", "//rust/test:enums_upb_rust_proto", "//rust/test:map_unittest_upb_rust_proto", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -430,7 +436,7 @@ rust_test( }, deps = [ "//rust:protobuf_cpp", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -443,7 +449,7 @@ rust_test( }, deps = [ "//rust:protobuf_upb", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -456,7 +462,8 @@ rust_test( }, deps = [ "//rust:protobuf_cpp", - "//src/google/protobuf:unittest_cpp_rust_proto", + "//rust/test:map_unittest_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -471,7 +478,8 @@ rust_test( deps = [ "//rust:protobuf_gtest_matchers_upb", "//rust:protobuf_upb", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:map_unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -489,10 +497,9 @@ rust_test( deps = [ "//rust:protobuf_cpp", "//rust:protobuf_gtest_matchers_cpp", - "//src/google/protobuf:edition_unittest_cpp_rust_proto", - "//src/google/protobuf:unittest_cpp_rust_proto", - "//src/google/protobuf:unittest_proto3_cpp_rust_proto", - "//src/google/protobuf:unittest_proto3_optional_cpp_rust_proto", + "//rust/test:unittest_cpp_rust_proto", + "//rust/test:unittest_proto3_cpp_rust_proto", + "//rust/test:unittest_proto3_optional_cpp_rust_proto", "@crate_index//:googletest", ], ) @@ -510,10 +517,33 @@ rust_test( deps = [ "//rust:protobuf_gtest_matchers_upb", "//rust:protobuf_upb", - "//src/google/protobuf:edition_unittest_upb_rust_proto", - "//src/google/protobuf:unittest_proto3_optional_upb_rust_proto", - "//src/google/protobuf:unittest_proto3_upb_rust_proto", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_proto3_optional_upb_rust_proto", + "//rust/test:unittest_proto3_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", + "@crate_index//:googletest", + ], +) + +rust_test( + name = "no_internal_access_test_cpp", + srcs = ["no_internal_access_test.rs"], + aliases = { + "//rust:protobuf_cpp_export": "protobuf", + }, + deps = [ + "//rust:protobuf_cpp_export", + "@crate_index//:googletest", + ], +) + +rust_test( + name = "no_internal_access_test_upb", + srcs = ["no_internal_access_test.rs"], + aliases = { + "//rust:protobuf_upb_export": "protobuf", + }, + deps = [ + "//rust:protobuf_upb_export", "@crate_index//:googletest", ], ) diff --git a/third_party/protobuf/rust/test/shared/accessors_proto3_test.rs b/third_party/protobuf/rust/test/shared/accessors_proto3_test.rs index c23356f404191..6b17297efb925 100644 --- a/third_party/protobuf/rust/test/shared/accessors_proto3_test.rs +++ b/third_party/protobuf/rust/test/shared/accessors_proto3_test.rs @@ -173,7 +173,7 @@ fn test_foreign_enum_accessors() { #[gtest] fn test_oneof_accessors() { - use test_all_types::OneofField::*; + use test_all_types::OneofFieldOneof::*; let mut msg = TestAllTypes::new(); assert_that!(msg.oneof_field(), matches_pattern!(not_set(_))); @@ -202,7 +202,7 @@ fn test_oneof_accessors() { #[gtest] fn test_oneof_accessors_view_long_lifetime() { - use test_all_types::OneofField::*; + use test_all_types::OneofFieldOneof::*; let mut msg = TestAllTypes::new(); msg.set_oneof_uint32(7); @@ -219,18 +219,18 @@ fn test_oneof_accessors_view_long_lifetime() { #[gtest] fn test_oneof_enum_accessors() { use unittest_proto3_rust_proto::{ - test_oneof2::{Foo, FooCase, NestedEnum}, + test_oneof2::{FooCase, FooOneof, NestedEnum}, TestOneof2, }; let mut msg = TestOneof2::new(); assert_that!(msg.foo_enum_opt(), eq(Optional::Unset(NestedEnum::Unknown))); - assert_that!(msg.foo(), matches_pattern!(Foo::not_set(_))); + assert_that!(msg.foo(), matches_pattern!(FooOneof::not_set(_))); assert_that!(msg.foo_case(), matches_pattern!(FooCase::not_set)); msg.set_foo_enum(NestedEnum::Bar); assert_that!(msg.foo_enum_opt(), eq(Optional::Set(NestedEnum::Bar))); - assert_that!(msg.foo(), matches_pattern!(Foo::FooEnum(eq(NestedEnum::Bar)))); + assert_that!(msg.foo(), matches_pattern!(FooOneof::FooEnum(eq(NestedEnum::Bar)))); assert_that!(msg.foo_case(), matches_pattern!(FooCase::FooEnum)); } diff --git a/third_party/protobuf/rust/test/shared/accessors_repeated_test.rs b/third_party/protobuf/rust/test/shared/accessors_repeated_test.rs index e838c2cf387b8..9bca92b9466fb 100644 --- a/third_party/protobuf/rust/test/shared/accessors_repeated_test.rs +++ b/third_party/protobuf/rust/test/shared/accessors_repeated_test.rs @@ -7,7 +7,7 @@ use googletest::prelude::*; use paste::paste; -use protobuf::AsView; +use protobuf::{proto, AsMut, AsView, Repeated}; use unittest_rust_proto::{test_all_types, test_all_types::NestedMessage, TestAllTypes}; macro_rules! generate_repeated_numeric_test { @@ -209,7 +209,13 @@ fn test_repeated_message() { assert_that!(msg.repeated_nested_message().get(0).unwrap().bb(), eq(1)); let mut msg2 = TestAllTypes::new(); + for _i in 0..2 { + msg2.repeated_nested_message_mut().push(NestedMessage::new()); + } + assert_that!(msg2.repeated_nested_message().len(), eq(2)); + msg2.repeated_nested_message_mut().copy_from(msg.repeated_nested_message()); + assert_that!(msg2.repeated_nested_message().len(), eq(1)); assert_that!(msg2.repeated_nested_message().get(0).unwrap().bb(), eq(1)); let mut nested2 = NestedMessage::new(); @@ -239,6 +245,22 @@ fn test_repeated_message_setter() { assert_that!(msg.repeated_nested_message().get(0).unwrap().bb(), eq(1)); } +#[gtest] +fn test_empty_repeated_message_drop() { + let _ = Repeated::<TestAllTypes>::new(); +} + +#[gtest] +fn test_repeated_message_drop() { + let mut repeated = Repeated::<TestAllTypes>::new(); + repeated.as_mut().push(TestAllTypes::new()); + + { + let v: Vec<TestAllTypes> = vec![proto!(TestAllTypes { optional_int32: 1 })]; + repeated.as_mut().extend(v.iter().cloned()); + } +} + #[gtest] fn test_repeated_strings() { let mut older_msg = TestAllTypes::new(); diff --git a/third_party/protobuf/rust/test/shared/accessors_test.rs b/third_party/protobuf/rust/test/shared/accessors_test.rs index d76ec8965b5c9..d0f3221c9ae16 100644 --- a/third_party/protobuf/rust/test/shared/accessors_test.rs +++ b/third_party/protobuf/rust/test/shared/accessors_test.rs @@ -733,7 +733,7 @@ fn test_default_foreign_enum_accessors() { #[gtest] fn test_optional_import_enum_accessors() { - use unittest_rust_proto::ImportEnum; + use unittest_import_rust_proto::ImportEnum; let mut msg = TestAllTypes::new(); assert_that!(msg.optional_import_enum_opt(), eq(Optional::Unset(ImportEnum::ImportFoo))); @@ -750,7 +750,7 @@ fn test_optional_import_enum_accessors() { #[gtest] fn test_default_import_enum_accessors() { - use unittest_rust_proto::ImportEnum; + use unittest_import_rust_proto::ImportEnum; let mut msg = TestAllTypes::new(); assert_that!(msg.default_import_enum(), eq(ImportEnum::ImportBar)); @@ -767,7 +767,7 @@ fn test_default_import_enum_accessors() { #[gtest] fn test_oneof_accessors() { - use unittest_rust_proto::test_oneof2::{Foo::*, FooCase, NestedEnum}; + use unittest_rust_proto::test_oneof2::{FooCase, FooOneof::*, NestedEnum}; use unittest_rust_proto::TestOneof2; let mut msg = TestOneof2::new(); @@ -818,7 +818,7 @@ fn test_oneof_accessors() { #[gtest] fn test_msg_oneof_default_accessors() { - use unittest_rust_proto::test_oneof2::{Bar::*, BarCase, NestedEnum}; + use unittest_rust_proto::test_oneof2::{BarCase, BarOneof::*, NestedEnum}; let mut msg = unittest_rust_proto::TestOneof2::new(); assert_that!(msg.bar(), matches_pattern!(not_set(_))); diff --git a/third_party/protobuf/rust/test/shared/bad_names_test.rs b/third_party/protobuf/rust/test/shared/bad_names_test.rs index febc0dcc335e2..d49f2add820cd 100644 --- a/third_party/protobuf/rust/test/shared/bad_names_test.rs +++ b/third_party/protobuf/rust/test/shared/bad_names_test.rs @@ -7,6 +7,7 @@ use bad_names_rust_proto::*; use googletest::prelude::*; +use protobuf::proto; #[gtest] fn test_reserved_keyword_in_accessors() { @@ -21,6 +22,14 @@ fn test_reserved_keyword_in_messages() { let _ = Ref::new().r#const(); } +#[gtest] +fn test_reserved_keyword_with_proto_macro() { + let _ = proto!(Self__mangled_because_ident_isnt_a_legal_raw_identifier { + r#true: false, + r#match: [0i32], + }); +} + #[gtest] fn test_collision_in_accessors() { let mut m = AccessorsCollide::new(); diff --git a/third_party/protobuf/rust/test/shared/ctype_cord_test.rs b/third_party/protobuf/rust/test/shared/ctype_cord_test.rs index 0e46dab714318..ecaa80d93fe06 100644 --- a/third_party/protobuf/rust/test/shared/ctype_cord_test.rs +++ b/third_party/protobuf/rust/test/shared/ctype_cord_test.rs @@ -9,20 +9,6 @@ use googletest::prelude::*; use unittest_rust_proto::{TestAllTypes, TestCord}; -#[gtest] -fn test_string_cord() { - let mut msg = TestAllTypes::new(); - assert_that!(msg.has_optional_cord(), eq(false)); - assert_that!(msg.optional_cord(), eq("")); - msg.set_optional_cord("hello"); - assert_that!(msg.has_optional_cord(), eq(true)); - assert_that!(msg.optional_cord(), eq("hello")); - - let mut msg2 = TestAllTypes::new(); - msg2.set_optional_cord(msg.optional_cord()); - assert_that!(msg2.optional_cord(), eq("hello")); -} - #[gtest] fn test_bytes_cord() { let mut msg = TestCord::new(); diff --git a/third_party/protobuf/rust/test/shared/enum_test.rs b/third_party/protobuf/rust/test/shared/enum_test.rs index a6cbfd4200c77..6549cbf491971 100644 --- a/third_party/protobuf/rust/test/shared/enum_test.rs +++ b/third_party/protobuf/rust/test/shared/enum_test.rs @@ -189,3 +189,52 @@ fn test_is_known_for_open_enum() { assert_that!(TestEnumWithNumericNames::is_known(3), eq(true)); assert_that!(TestEnumWithNumericNames::is_known(4), eq(false)); } + +#[gtest] +fn test_debug_string() { + assert_that!( + format!("{:?}", { TestEnumWithNumericNames::_2020 }), + eq("TestEnumWithNumericNames::_2020") + ); + + assert_that!( + format!("{:?}", { TestEnumWithNumericNames::from(2) }), + eq("TestEnumWithNumericNames::_2021") + ); + + // There is no name for 42, so the integer number is printed instead: + assert_that!( + format!("{:?}", { TestEnumWithNumericNames::from(42) }), + eq("TestEnumWithNumericNames::from(42)") + ); +} + +#[gtest] +fn test_enum_in_hash_set() { + use test_all_types::NestedEnum; + let mut s = std::collections::HashSet::<NestedEnum>::new(); + s.insert(NestedEnum::Foo); + s.insert(NestedEnum::Bar); + s.insert(NestedEnum::try_from(1).unwrap()); // FOO = 1 + assert_that!(s.len(), eq(2)); + assert_that!(s.contains(&NestedEnum::Bar), eq(true)); + assert_that!(s.contains(&NestedEnum::Baz), eq(false)); +} + +#[gtest] +fn test_enum_in_btree() { + use test_all_types::NestedEnum; + let mut s = std::collections::BTreeMap::<NestedEnum, i32>::new(); + + s.insert(NestedEnum::Baz, 1); + s.insert(NestedEnum::Bar, 2); + s.insert(NestedEnum::Foo, 3); + s.insert(NestedEnum::try_from(1).unwrap(), 4); // FOO = 1 + + // The order of entries should be sorted by the enum constant value, which is + // ordered FOO < BAR < BAZ. + assert_that!(s.pop_first(), some(eq((NestedEnum::Foo, 4)))); + assert_that!(s.pop_first(), some(eq((NestedEnum::Bar, 2)))); + assert_that!(s.pop_first(), some(eq((NestedEnum::Baz, 1)))); + assert_that!(s.pop_first(), none()); +} diff --git a/third_party/protobuf/rust/test/shared/fields_with_imported_types_test.rs b/third_party/protobuf/rust/test/shared/fields_with_imported_types_test.rs index 8ac233e2ce556..4c84bb9d8453e 100644 --- a/third_party/protobuf/rust/test/shared/fields_with_imported_types_test.rs +++ b/third_party/protobuf/rust/test/shared/fields_with_imported_types_test.rs @@ -30,13 +30,21 @@ fn test_enum_field_generated() { #[gtest] fn test_oneof_message_field_generated() { - use fields_with_imported_types_rust_proto::msg_with_fields_with_imported_types::ImportedTypesOneof::not_set; - use fields_with_imported_types_rust_proto::MsgWithFieldsWithImportedTypes; + use fields_with_imported_types_rust_proto::{ + msg_with_fields_with_imported_types, MsgWithFieldsWithImportedTypes, + }; use imported_types_rust_proto::ImportedEnum; use imported_types_rust_proto::ImportedMessageView; let msg = MsgWithFieldsWithImportedTypes::new(); assert_that!(msg.imported_message_oneof(), matches_pattern!(ImportedMessageView { .. })); assert_that!(msg.imported_enum_oneof(), eq(ImportedEnum::Unknown)); - assert_that!(msg.imported_types_oneof(), matches_pattern!(not_set(_))); + assert_that!( + msg.imported_types_oneof(), + matches_pattern!(msg_with_fields_with_imported_types::ImportedTypesOneofOneof::not_set(_)) + ); + assert_that!( + msg.imported_types_oneof_case(), + matches_pattern!(msg_with_fields_with_imported_types::ImportedTypesOneofCase::not_set) + ); } diff --git a/third_party/protobuf/rust/test/shared/gtest_matchers_test.rs b/third_party/protobuf/rust/test/shared/gtest_matchers_test.rs index 7db88f785f271..18931267a9033 100644 --- a/third_party/protobuf/rust/test/shared/gtest_matchers_test.rs +++ b/third_party/protobuf/rust/test/shared/gtest_matchers_test.rs @@ -5,12 +5,13 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -use edition_unittest_rust_proto::TestAllTypes as TestAllTypesEditions; use googletest::prelude::*; use paste::paste; +use protobuf::proto; use protobuf_gtest_matchers::proto_eq; +use unittest_proto3_rust_proto::test_all_types::NestedMessage; use unittest_proto3_rust_proto::TestAllTypes as TestAllTypesProto3; -use unittest_rust_proto::TestAllTypes as TestAllTypesProto2; +use unittest_rust_proto::TestAllTypes; macro_rules! generate_eq_msgs_tests { ($(($type: ident, $name_ext: ident)),*) => { @@ -46,14 +47,28 @@ macro_rules! generate_not_eq_msgs_tests { } } -generate_eq_msgs_tests!( - (TestAllTypesEditions, editions), - (TestAllTypesProto3, proto3), - (TestAllTypesProto2, proto2) -); +generate_eq_msgs_tests!((TestAllTypes, editions), (TestAllTypesProto3, proto3)); -generate_not_eq_msgs_tests!( - (TestAllTypesEditions, editions), - (TestAllTypesProto3, proto3), - (TestAllTypesProto2, proto2) -); +generate_not_eq_msgs_tests!((TestAllTypes, editions), (TestAllTypesProto3, proto3)); + +#[gtest] +fn proto_eq_works_on_view() { + // This exercises the `impl<T> Matcher<T> for MessageMatcher<T> + // where T: MatcherEq + Copy` implementation. + let msg = proto!(TestAllTypesProto3 { + repeated_nested_message: [ + NestedMessage { bb: 10 }, + NestedMessage { bb: 20 }, + NestedMessage { bb: 30 } + ] + }); + + expect_that!( + msg.repeated_nested_message(), + unordered_elements_are![ + proto_eq(proto!(NestedMessage { bb: 10 }).as_view()), + proto_eq(proto!(NestedMessage { bb: 20 }).as_view()), + proto_eq(proto!(NestedMessage { bb: 30 }).as_view()), + ] + ); +} diff --git a/third_party/protobuf/rust/test/shared/no_internal_access_test.rs b/third_party/protobuf/rust/test/shared/no_internal_access_test.rs new file mode 100644 index 0000000000000..7ccb3b48e85b0 --- /dev/null +++ b/third_party/protobuf/rust/test/shared/no_internal_access_test.rs @@ -0,0 +1,10 @@ +use googletest::gtest; +use protobuf::__internal; + +#[gtest] +#[allow(clippy::unit_cmp)] +fn test_no_internal_access() { + // This test is to ensure that the `__internal` is 'blocked' by instead being a + // unit type instead of a module. + assert_eq!(__internal, ()); +} diff --git a/third_party/protobuf/rust/test/shared/proto_macro_test.rs b/third_party/protobuf/rust/test/shared/proto_macro_test.rs index fa86f5dd7ff36..45ba49ddff03f 100644 --- a/third_party/protobuf/rust/test/shared/proto_macro_test.rs +++ b/third_party/protobuf/rust/test/shared/proto_macro_test.rs @@ -14,6 +14,8 @@ use unittest_rust_proto::{ NestedTestAllTypes, TestAllTypes, }; +use map_unittest_rust_proto::{TestMap, TestMapWithMessages}; + struct TestValue { val: i64, } @@ -202,3 +204,30 @@ fn test_repeated_msg() { assert_that!(msg.repeated_child().get(0).unwrap().payload().optional_int32(), eq(1)); assert_that!(msg.repeated_child().get(1).unwrap().payload().optional_int32(), eq(2)); } + +#[gtest] +fn test_string_maps() { + let msg = + proto!(TestMap { map_string_string: [("foo", "bar"), ("baz", "qux"), ("quux", "quuz")] }); + assert_that!(msg.map_string_string().len(), eq(3)); + assert_that!(msg.map_string_string().get("foo").unwrap(), eq("bar")); + assert_that!(msg.map_string_string().get("baz").unwrap(), eq("qux")); + assert_that!(msg.map_string_string().get("quux").unwrap(), eq("quuz")); +} + +#[gtest] +fn test_message_maps() { + let msg3 = proto!(TestAllTypes { optional_int32: 3 }); + let kv3 = ("quux", msg3); + let msg = proto!(TestMapWithMessages { + map_string_all_types: [ + ("foo", TestAllTypes { optional_int32: 1 }), + ("baz", __ { optional_int32: 2 }), + kv3 + ] + }); + assert_that!(msg.map_string_all_types().len(), eq(3)); + assert_that!(msg.map_string_all_types().get("foo").unwrap().optional_int32(), eq(1)); + assert_that!(msg.map_string_all_types().get("baz").unwrap().optional_int32(), eq(2)); + assert_that!(msg.map_string_all_types().get("quux").unwrap().optional_int32(), eq(3)); +} diff --git a/third_party/protobuf/rust/test/shared/serialization_test.rs b/third_party/protobuf/rust/test/shared/serialization_test.rs index 789e2fbef6a9c..04ae833b640d8 100644 --- a/third_party/protobuf/rust/test/shared/serialization_test.rs +++ b/third_party/protobuf/rust/test/shared/serialization_test.rs @@ -9,11 +9,10 @@ use googletest::prelude::*; use protobuf::prelude::*; use protobuf::View; -use edition_unittest_rust_proto::TestAllTypes as TestAllTypesEditions; use paste::paste; use unittest_proto3_optional_rust_proto::TestProto3Optional; use unittest_proto3_rust_proto::TestAllTypes as TestAllTypesProto3; -use unittest_rust_proto::TestAllTypes as TestAllTypesProto2; +use unittest_rust_proto::TestAllTypes; macro_rules! generate_parameterized_serialization_test { ($(($type: ident, $name_ext: ident)),*) => { @@ -94,9 +93,8 @@ macro_rules! generate_parameterized_serialization_test { } generate_parameterized_serialization_test!( - (TestAllTypesProto2, proto2), + (TestAllTypes, editions), (TestAllTypesProto3, proto3), - (TestAllTypesEditions, editions), (TestProto3Optional, proto3_optional) ); @@ -124,10 +122,9 @@ macro_rules! generate_parameterized_int32_byte_size_test { } generate_parameterized_int32_byte_size_test!( - (TestAllTypesProto2, proto2), - (TestProto3Optional, proto3_optional), /* Test would fail if we were to use - * TestAllTypesProto3: optional_int32 follows "no - * presence" semantics and setting it to 0 (default - * value) will cause it to not be serialized */ - (TestAllTypesEditions, editions) + (TestAllTypes, editions), + (TestProto3Optional, proto3_optional) /* Test would fail if we were to use + * TestAllTypesProto3: optional_int32 follows "no + * presence" semantics and setting it to 0 (default + * value) will cause it to not be serialized */ ); diff --git a/third_party/protobuf/rust/test/shared/utf8/BUILD b/third_party/protobuf/rust/test/shared/utf8/BUILD index 51f3b4da018ea..843b7ad6cc8c2 100644 --- a/third_party/protobuf/rust/test/shared/utf8/BUILD +++ b/third_party/protobuf/rust/test/shared/utf8/BUILD @@ -1,5 +1,6 @@ load("@rules_rust//rust:defs.bzl", "rust_test") load("//bazel:cc_proto_library.bzl", "cc_proto_library") +load("//bazel:proto_library.bzl", "proto_library") load("//rust:defs.bzl", "rust_cc_proto_library", "rust_upb_proto_library") licenses(["notice"]) @@ -41,9 +42,9 @@ cc_test( ":feature_verify_cc_proto", ":no_features_proto2_cc_proto", ":no_features_proto3_cc_proto", - "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings:string_view", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/rust/test/srcsless_library_test_child.proto b/third_party/protobuf/rust/test/srcsless_library_test_child.proto new file mode 100644 index 0000000000000..675f0ad981770 --- /dev/null +++ b/third_party/protobuf/rust/test/srcsless_library_test_child.proto @@ -0,0 +1,7 @@ +edition = "2023"; + +package srcsless_library_test; + +option java_multiple_files = true; + +message Child {} diff --git a/third_party/protobuf/rust/test/srcsless_library_test_parent.proto b/third_party/protobuf/rust/test/srcsless_library_test_parent.proto new file mode 100644 index 0000000000000..f37d3c6253f62 --- /dev/null +++ b/third_party/protobuf/rust/test/srcsless_library_test_parent.proto @@ -0,0 +1,14 @@ +edition = "2023"; + +package srcsless_library_test; + +// The purpose of this proto is for a test where a proto_library target that has +// no srcs (an "alias library") can be used in the middle between this parent +// target and this imported file. +import "rust/test/srcsless_library_test_child.proto"; + +option java_multiple_files = true; + +message Parent { + Child child = 1; +} diff --git a/third_party/protobuf/rust/test/unittest.proto b/third_party/protobuf/rust/test/unittest.proto new file mode 100644 index 0000000000000..3bf24b1652211 --- /dev/null +++ b/third_party/protobuf/rust/test/unittest.proto @@ -0,0 +1,1937 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file we will use for unit testing. +// +// LINT: ALLOW_GROUPS, LEGACY_NAMES + +edition = "2023"; + +package rust_unittest; + +import "rust/test/unittest_import.proto"; + +option features = { enum_type : CLOSED, repeated_field_encoding : EXPANDED, utf8_validation : NONE }; +option cc_enable_arenas = true; + +// Protos optimized for SPEED use a strict superset of the generated code +// of equivalent ones optimized for CODE_SIZE, so we should optimize all our +// tests for speed unless explicitly testing code size optimization. +option optimize_for = SPEED; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + + message OptionalGroup { + int32 a = 17; + } + + OptionalGroup optionalgroup = 16 [features.message_encoding = DELIMITED]; + + NestedMessage optional_nested_message = 18; + ForeignMessage optional_foreign_message = 19; + rust_unittest_import.ImportMessage optional_import_message = 20; + NestedEnum optional_nested_enum = 21; + ForeignEnum optional_foreign_enum = 22; + rust_unittest_import.ImportEnum optional_import_enum = 23; + string optional_string_piece = 24 [ctype = STRING_PIECE]; + + string optional_cord = 25 [ctype = CORD]; + bytes optional_bytes_cord = 86 [ctype = CORD]; + + NestedMessage optional_lazy_message = 27 [lazy = true]; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + message RepeatedGroup { + int32 a = 47; + } + + repeated RepeatedGroup repeatedgroup = 46 + [features.message_encoding = DELIMITED]; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated rust_unittest_import.ImportMessage repeated_import_message = 50; + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated rust_unittest_import.ImportEnum repeated_import_enum = 53; + repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; + + repeated string repeated_cord = 55 [ctype = CORD]; + + // Singular with defaults + int32 default_int32 = 61 [default = 41]; + + int64 default_int64 = 62 [default = 42]; + + uint32 default_uint32 = 63 [default = 43]; + + uint64 default_uint64 = 64 [default = 44]; + + sint32 default_sint32 = 65 [default = -45]; + + sint64 default_sint64 = 66 [default = 46]; + + fixed32 default_fixed32 = 67 [default = 47]; + + fixed64 default_fixed64 = 68 [default = 48]; + + sfixed32 default_sfixed32 = 69 [default = 49]; + + sfixed64 default_sfixed64 = 70 [default = -50]; + + float default_float = 71 [default = 51.5]; + + double default_double = 72 [default = 5.2e4]; + + bool default_bool = 73 [default = true]; + + string default_string = 74 [default = "hello"]; + + bytes default_bytes = 75 [default = "world"]; + + NestedEnum default_nested_enum = 81 [default = BAR]; + + ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; + + rust_unittest_import.ImportEnum default_import_enum = 83 + [default = IMPORT_BAR]; + + string default_string_piece = 84 [ctype = STRING_PIECE, default = "abc"]; + + string default_cord = 85 [ctype = CORD, default = "123"]; + + // For oneof test + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + string oneof_cord = 115 [ctype = CORD]; + + string oneof_string_piece = 116 [ctype = STRING_PIECE]; + + NestedMessage oneof_lazy_nested_message = 117 [lazy = true]; + } +} + +// This proto includes a recursively nested message. +message NestedTestAllTypes { + NestedTestAllTypes child = 1; + TestAllTypes payload = 2; + repeated NestedTestAllTypes repeated_child = 3; + NestedTestAllTypes lazy_child = 4 [lazy = true]; + + TestAllTypes eager_child = 5 [lazy = false]; +} + +message TestDeprecatedFields { + int32 deprecated_int32 = 1 [deprecated = true]; + + repeated string deprecated_repeated_string = 4 [deprecated = true]; + + TestAllTypes.NestedMessage deprecated_message = 3 [deprecated = true]; + + oneof oneof_fields { + int32 deprecated_int32_in_oneof = 2 [deprecated = true]; + } + + TestDeprecatedFields nested = 5; +} + +message TestDeprecatedMessage { + option deprecated = true; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + int32 c = 1; + int32 d = 2; +} + +enum ForeignEnum { + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; + FOREIGN_BAX = 32; // (1 << 32) to generate a 64b bitmask would be incorrect. + FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache. +} + +enum TestDeprecatedEnum { + option deprecated = true; + + TEST_DEPRECATED_ENUM_UNSPECIFIED = 0; + TEST_DEPRECATED_ENUM_VALUE1 = 1; + TEST_DEPRECATED_ENUM_VALUE2 = 2; +} + +message TestReservedFields { + reserved 2, 15, 9 to 11; + + reserved bar, baz; +} + +enum TestReservedEnumFields { + UNKNOWN = 0; + + reserved 2, 15, 9 to 11; + + reserved bar, baz; +} + +message TestAllExtensions { + extensions 1 to max; +} + +extend TestAllExtensions { + // Singular + int32 optional_int32_extension = 1; + int64 optional_int64_extension = 2; + uint32 optional_uint32_extension = 3; + uint64 optional_uint64_extension = 4; + sint32 optional_sint32_extension = 5; + sint64 optional_sint64_extension = 6; + fixed32 optional_fixed32_extension = 7; + fixed64 optional_fixed64_extension = 8; + sfixed32 optional_sfixed32_extension = 9; + sfixed64 optional_sfixed64_extension = 10; + float optional_float_extension = 11; + double optional_double_extension = 12; + bool optional_bool_extension = 13; + string optional_string_extension = 14; + bytes optional_bytes_extension = 15; + OptionalGroup_extension optionalgroup_extension = 16 + [features.message_encoding = DELIMITED]; + + TestAllTypes.NestedMessage optional_nested_message_extension = 18; + ForeignMessage optional_foreign_message_extension = 19; + rust_unittest_import.ImportMessage optional_import_message_extension = 20; + TestAllTypes.NestedEnum optional_nested_enum_extension = 21; + ForeignEnum optional_foreign_enum_extension = 22; + rust_unittest_import.ImportEnum optional_import_enum_extension = 23; + string optional_string_piece_extension = 24 [ctype = STRING_PIECE]; + + // TODO: ctype=CORD is not supported for extension. Add + // ctype=CORD option back after it is supported. + string optional_cord_extension = 25; + bytes optional_bytes_cord_extension = 86; + + TestAllTypes.NestedMessage optional_lazy_message_extension = 27 [lazy = true]; + + // Repeated + repeated int32 repeated_int32_extension = 31; + repeated int64 repeated_int64_extension = 32; + repeated uint32 repeated_uint32_extension = 33; + repeated uint64 repeated_uint64_extension = 34; + repeated sint32 repeated_sint32_extension = 35; + repeated sint64 repeated_sint64_extension = 36; + repeated fixed32 repeated_fixed32_extension = 37; + repeated fixed64 repeated_fixed64_extension = 38; + repeated sfixed32 repeated_sfixed32_extension = 39; + repeated sfixed64 repeated_sfixed64_extension = 40; + repeated float repeated_float_extension = 41; + repeated double repeated_double_extension = 42; + repeated bool repeated_bool_extension = 43; + repeated string repeated_string_extension = 44; + repeated bytes repeated_bytes_extension = 45; + repeated RepeatedGroup_extension repeatedgroup_extension = 46 + [features.message_encoding = DELIMITED]; + + repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; + repeated ForeignMessage repeated_foreign_message_extension = 49; + repeated rust_unittest_import.ImportMessage + repeated_import_message_extension = 50; + repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; + repeated ForeignEnum repeated_foreign_enum_extension = 52; + repeated rust_unittest_import.ImportEnum repeated_import_enum_extension = 53; + repeated string repeated_string_piece_extension = 54 [ctype = STRING_PIECE]; + + // TODO: ctype=CORD is not supported for extension. Add + // ctype=CORD option back after it is supported. + repeated string repeated_cord_extension = 55; + + // Singular with defaults + int32 default_int32_extension = 61 [default = 41]; + + int64 default_int64_extension = 62 [default = 42]; + + uint32 default_uint32_extension = 63 [default = 43]; + + uint64 default_uint64_extension = 64 [default = 44]; + + sint32 default_sint32_extension = 65 [default = -45]; + + sint64 default_sint64_extension = 66 [default = 46]; + + fixed32 default_fixed32_extension = 67 [default = 47]; + + fixed64 default_fixed64_extension = 68 [default = 48]; + + sfixed32 default_sfixed32_extension = 69 [default = 49]; + + sfixed64 default_sfixed64_extension = 70 [default = -50]; + + float default_float_extension = 71 [default = 51.5]; + + double default_double_extension = 72 [default = 5.2e4]; + + bool default_bool_extension = 73 [default = true]; + + string default_string_extension = 74 [default = "hello"]; + + bytes default_bytes_extension = 75 [default = "world"]; + + TestAllTypes.NestedEnum default_nested_enum_extension = 81 [default = BAR]; + + ForeignEnum default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; + + string default_string_piece_extension = 84 + [ctype = STRING_PIECE, default = "abc"]; + + // TODO: ctype=CORD is not supported for extension. Add + // ctype=CORD option back after it is supported. + string default_cord_extension = 85 [default = "123"]; + + // For oneof test + uint32 oneof_uint32_extension = 111; + TestAllTypes.NestedMessage oneof_nested_message_extension = 112; + string oneof_string_extension = 113; + bytes oneof_bytes_extension = 114; +} + +message OptionalGroup_extension { + int32 a = 17; +} + +message RepeatedGroup_extension { + int32 a = 47; +} + +message TestMixedFieldsAndExtensions { + int32 a = 1; + repeated fixed32 b = 3; + + extensions 2, 4; + + extend TestMixedFieldsAndExtensions { + int32 c = 2; + repeated fixed32 d = 4; + } +} + +message TestGroup { + message OptionalGroup { + int32 a = 17; + int32 zz = 89; // fast table size must be at least 16, for this + // field to be parsed by the fast parser, since + // 89 - 17 = 72 is a multiple of 8. + } + + OptionalGroup optionalgroup = 16 [features.message_encoding = DELIMITED]; + + ForeignEnum optional_foreign_enum = 22; +} + +message TestGroupExtension { + extensions 1 to max; +} + +message TestNestedExtension { + extend TestAllExtensions { + // Check for bug where string extensions declared in tested scope did not + // compile. + string test = 1002 [default = "test"]; + + // Used to test if generated extension name is correct when there are + // underscores. + string nested_string_extension = 1003; + } + + extend TestGroupExtension { + OptionalGroup_extension optionalgroup_extension = 16 + [features.message_encoding = DELIMITED]; + + ForeignEnum optional_foreign_enum_extension = 22; + } + + message OptionalGroup_extension { + int32 a = 17; + } +} + +message TestChildExtension { + string a = 1; + string b = 2; + TestAllExtensions optional_extension = 3; +} + +// Emulates wireformat data of TestChildExtension with dynamic extension +// (DynamicExtension). +message TestChildExtensionData { + message NestedTestAllExtensionsData { + message NestedDynamicExtensions { + int32 a = 1; + int32 b = 2; + } + + NestedDynamicExtensions dynamic = 409707008; + } + + string a = 1; + string b = 2; + NestedTestAllExtensionsData optional_extension = 3; +} + +message TestNestedChildExtension { + int32 a = 1; + TestChildExtension child = 2; +} + +// Emulates wireformat data of TestNestedChildExtension with dynamic extension +// (DynamicExtension). +message TestNestedChildExtensionData { + int32 a = 1; + TestChildExtensionData child = 2; +} + +// Required and closed enum fields are considered unknown fields if the value is +// not valid. We need to make sure it functions as expected. +message TestRequiredEnum { + ForeignEnum required_enum = 1 [features.field_presence = LEGACY_REQUIRED]; + + // A dummy optional field. + int32 a = 2; +} + +// Required and open enum accepts invalid enum values. +enum ForeignOpenEnum { + option features.enum_type = OPEN; + + FOREIGN_OPEN_UNKNOWN = 0; + FOREIGN_OPEN_FOO = 4; + FOREIGN_OPEN_BAR = 5; + FOREIGN_OPEN_BAZ = 6; + FOREIGN_OPEN_BAX = 32; // (1 << 32) to generate a 64b bitmask would be + // incorrect. +} + +message TestRequiredOpenEnum { + ForeignOpenEnum required_enum = 1 [features.field_presence = LEGACY_REQUIRED]; + + // A dummy optional field. + int32 a = 2; +} + +// TestRequiredEnum + using enum values that won't fit to 64 bitmask. +message TestRequiredEnumNoMask { + enum NestedEnum { + UNSPECIFIED = 0; + FOO = 2; + BAR = 100; + BAZ = -1; // Intentionally negative. + } + + NestedEnum required_enum = 1 [features.field_presence = LEGACY_REQUIRED]; + + // A dummy optional field. + int32 a = 2; +} + +message TestRequiredEnumMulti { + enum NestedEnum { + UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 100; + } + + // Intentionally placed in descending field number to force sorting in closed + // enum verification. + NestedEnum required_enum_4 = 4 [features.field_presence = LEGACY_REQUIRED]; + + int32 a_3 = 3; + NestedEnum required_enum_2 = 2 [features.field_presence = LEGACY_REQUIRED]; + + ForeignEnum required_enum_1 = 1 [features.field_presence = LEGACY_REQUIRED]; +} + +message TestRequiredNoMaskMulti { + enum NestedEnum { + UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 100; + } + + // Intentionally placed in descending field number to force sorting in closed + // enum verification. Also, using large field numbers to use tag only + // matching for required fields. + fixed32 required_fixed32_80 = 80 [features.field_presence = LEGACY_REQUIRED]; + + fixed32 required_fixed32_70 = 70 [features.field_presence = LEGACY_REQUIRED]; + + NestedEnum required_enum_64 = 64 [features.field_presence = LEGACY_REQUIRED]; + + NestedEnum required_enum_4 = 4 [features.field_presence = LEGACY_REQUIRED]; + + int32 a_3 = 3; + NestedEnum required_enum_2 = 2 [features.field_presence = LEGACY_REQUIRED]; + + ForeignEnum required_enum_1 = 1 [features.field_presence = LEGACY_REQUIRED]; +} + +// We have separate messages for testing required fields because it's +// annoying to have to fill in required fields in TestProto in order to +// do anything with it. Note that we don't need to test every type of +// required filed because the code output is basically identical to +// optional fields for all types. +message TestRequired { + int32 a = 1 [features.field_presence = LEGACY_REQUIRED]; + + int32 dummy2 = 2; + int32 b = 3 [features.field_presence = LEGACY_REQUIRED]; + + extend TestAllExtensions { + TestRequired single = 1000; + repeated TestRequired multi = 1001; + } + + // Pad the field count to 32 so that we can test that IsInitialized() + // properly checks multiple elements of has_bits_. + int32 dummy4 = 4; + int32 dummy5 = 5; + int32 dummy6 = 6; + int32 dummy7 = 7; + int32 dummy8 = 8; + int32 dummy9 = 9; + int32 dummy10 = 10; + int32 dummy11 = 11; + int32 dummy12 = 12; + int32 dummy13 = 13; + int32 dummy14 = 14; + int32 dummy15 = 15; + int32 dummy16 = 16; + int32 dummy17 = 17; + int32 dummy18 = 18; + int32 dummy19 = 19; + int32 dummy20 = 20; + int32 dummy21 = 21; + int32 dummy22 = 22; + int32 dummy23 = 23; + int32 dummy24 = 24; + int32 dummy25 = 25; + int32 dummy26 = 26; + int32 dummy27 = 27; + int32 dummy28 = 28; + int32 dummy29 = 29; + int32 dummy30 = 30; + int32 dummy31 = 31; + int32 dummy32 = 32; + int32 c = 33 [features.field_presence = LEGACY_REQUIRED]; + + // Add an optional child message to make this non-trivial for go/pdlazy. + ForeignMessage optional_foreign = 34; +} + +message TestRequiredForeign { + TestRequired optional_message = 1; + repeated TestRequired repeated_message = 2; + int32 dummy = 3; + + // Missing required fields must not affect verification of child messages. + NestedTestAllTypes optional_lazy_message = 4 [lazy = true]; +} + +message TestRequiredMessage { + TestRequired optional_message = 1; + repeated TestRequired repeated_message = 2; + TestRequired required_message = 3 [features.field_presence = LEGACY_REQUIRED]; +} + +message TestNestedRequiredForeign { + TestNestedRequiredForeign child = 1; + TestRequiredForeign payload = 2; + int32 dummy = 3; + + // optional message to test required closed enum. + TestRequiredEnum required_enum = 5; + TestRequiredEnumNoMask required_enum_no_mask = 6; + TestRequiredEnumMulti required_enum_multi = 7; + TestRequiredNoMaskMulti required_no_mask = 9; +} + +// Test that we can use NestedMessage from outside TestAllTypes. +message TestForeignNested { + TestAllTypes.NestedMessage foreign_nested = 1; +} + +// TestEmptyMessage is used to test unknown field support. +message TestEmptyMessage {} + +// Like above, but declare all field numbers as potential extensions. No +// actual extensions should ever be defined for this type. +message TestEmptyMessageWithExtensions { + extensions 1 to max; +} + +// Needed for a Python test. +message TestPickleNestedMessage { + message NestedMessage { + int32 bb = 1; + + message NestedNestedMessage { + int32 cc = 1; + } + } +} + +message TestMultipleExtensionRanges { + extensions 42; + extensions 4143 to 4243; + extensions 65536 to max; +} + +// Test that really large tag numbers don't break anything. +message TestReallyLargeTagNumber { + // The largest possible tag number is 2^28 - 1, since the wire format uses + // three bits to communicate wire type. + int32 a = 1; + int32 bb = 268435455; +} + +message TestRecursiveMessage { + TestRecursiveMessage a = 1; + int32 i = 2; +} + +// Test that mutual recursion works. +message TestMutualRecursionA { + message SubMessage { + TestMutualRecursionB b = 1; + } + + TestMutualRecursionB bb = 1; + + message SubGroup { + SubMessage sub_message = 3; // Needed because of bug in javatest + TestAllTypes not_in_this_scc = 4; + } + + SubGroup subgroup = 2 [features.message_encoding = DELIMITED]; + + message SubGroupR { + TestAllTypes payload = 6; + } + + repeated SubGroupR subgroupr = 5 [features.message_encoding = DELIMITED]; +} + +message TestMutualRecursionB { + TestMutualRecursionA a = 1; + int32 optional_int32 = 2; +} + +message TestIsInitialized { + message SubMessage { + message SubGroup { + int32 i = 2 [features.field_presence = LEGACY_REQUIRED]; + } + + SubGroup subgroup = 1 [features.message_encoding = DELIMITED]; + } + + SubMessage sub_message = 1; +} + +// Additional messages for testing lazy fields. +message TestEagerMessage { + TestAllTypes sub_message = 1 [lazy = false]; +} + +message TestLazyMessage { + TestAllTypes sub_message = 1 [lazy = true]; +} + +message TestLazyMessageRepeated { + repeated TestLazyMessage repeated_message = 1; +} + +message TestEagerMaybeLazy { + message NestedMessage { + TestPackedTypes packed = 1; + } + + TestAllTypes message_foo = 1; + TestAllTypes message_bar = 2; + NestedMessage message_baz = 3; +} + +// Needed for a Python test. +message TestNestedMessageHasBits { + message NestedMessage { + repeated int32 nestedmessage_repeated_int32 = 1; + repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2; + } + + NestedMessage optional_nested_message = 1; +} + +// Test an enum that has multiple values with the same number. +enum TestEnumWithDupValue { + option allow_alias = true; + + FOO1 = 1; + BAR1 = 2; + BAZ = 3; + FOO2 = 1; + BAR2 = 2; +} + +// Test an enum with large, unordered values. +enum TestSparseEnum { + SPARSE_A = 123; + SPARSE_B = 62374; + SPARSE_C = 12589234; + SPARSE_D = -15; + SPARSE_E = -53452; + SPARSE_F = 0; + SPARSE_G = 2; +} + +// Test message with CamelCase field names. This violates Protocol Buffer +// standard style. +message TestCamelCaseFieldNames { + int32 PrimitiveField = 1; + string StringField = 2; + ForeignEnum EnumField = 3; + ForeignMessage MessageField = 4; + string StringPieceField = 5 [ctype = STRING_PIECE]; + + string CordField = 6 [ctype = CORD]; + + repeated int32 RepeatedPrimitiveField = 7; + repeated string RepeatedStringField = 8; + repeated ForeignEnum RepeatedEnumField = 9; + repeated ForeignMessage RepeatedMessageField = 10; + repeated string RepeatedStringPieceField = 11 [ctype = STRING_PIECE]; + + repeated string RepeatedCordField = 12 [ctype = CORD]; +} + +// We list fields out of order, to ensure that we're using field number and not +// field index to determine serialization order. +message TestFieldOrderings { + string my_string = 11; + + extensions 2 to 10; + + int64 my_int = 1; + + extensions 12 to 100; + + float my_float = 101; + + message NestedMessage { + int64 oo = 2; + + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + NestedMessage optional_nested_message = 200; +} + +extend TestFieldOrderings { + string my_extension_string = 50; + int32 my_extension_int = 5; +} + +message TestExtensionOrderings1 { + extend TestFieldOrderings { + TestExtensionOrderings1 test_ext_orderings1 = 13; + } + + string my_string = 1; +} + +message TestExtensionOrderings2 { + extend TestFieldOrderings { + TestExtensionOrderings2 test_ext_orderings2 = 12; + } + + message TestExtensionOrderings3 { + extend TestFieldOrderings { + TestExtensionOrderings3 test_ext_orderings3 = 14; + } + + string my_string = 1; + } + + string my_string = 1; +} + +message TestExtremeDefaultValues { + bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"]; + + uint32 large_uint32 = 2 [default = 0xFFFFFFFF]; + + uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF]; + + int32 small_int32 = 4 [default = -0x7FFFFFFF]; + + int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF]; + + int32 really_small_int32 = 21 [default = -0x80000000]; + + int64 really_small_int64 = 22 [default = -0x8000000000000000]; + + // The default value here is UTF-8 for "\u1234". (We could also just type + // the UTF-8 text directly into this text file rather than escape it, but + // lots of people use editors that would be confused by this.) + string utf8_string = 6 [default = "\341\210\264"]; + + // Tests for single-precision floating-point values. + float zero_float = 7 [default = 0]; + + float one_float = 8 [default = 1]; + + float small_float = 9 [default = 1.5]; + + float negative_one_float = 10 [default = -1]; + + float negative_float = 11 [default = -1.5]; + + // Using exponents + float large_float = 12 [default = 2e8]; + + float small_negative_float = 13 [default = -8e-28]; + + // Text for nonfinite floating-point values. + double inf_double = 14 [default = inf]; + + double neg_inf_double = 15 [default = -inf]; + + double nan_double = 16 [default = nan]; + + float inf_float = 17 [default = inf]; + + float neg_inf_float = 18 [default = -inf]; + + float nan_float = 19 [default = nan]; + + // Tests for C++ trigraphs. + // Trigraphs should be escaped in C++ generated files, but they should not be + // escaped for other languages. + // Note that in .proto file, "\?" is a valid way to escape ? in string + // literals. + string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"]; + + // String defaults containing the character '\000' + string string_with_zero = 23 [default = "hel\000lo"]; + + bytes bytes_with_zero = 24 [default = "wor\000ld"]; + + string string_piece_with_zero = 25 + [ctype = STRING_PIECE, default = "ab\000c"]; + + string cord_with_zero = 26 [ctype = CORD, default = "12\0003"]; + + string replacement_string = 27 [default = "${unknown}"]; +} + +message SparseEnumMessage { + TestSparseEnum sparse_enum = 1; +} + +// Test String and Bytes: string is for valid UTF-8 strings +message OneString { + string data = 1; +} + +message MoreString { + repeated string data = 1; +} + +message OneBytes { + bytes data = 1; +} + +message MoreBytes { + repeated bytes data = 1; +} + +message ManyOptionalString { + string str1 = 1; + string str2 = 2; + string str3 = 3; + string str4 = 4; + string str5 = 5; + string str6 = 6; + string str7 = 7; + string str8 = 8; + string str9 = 9; + string str10 = 10; + string str11 = 11; + string str12 = 12; + string str13 = 13; + string str14 = 14; + string str15 = 15; + string str16 = 16; + string str17 = 17; + string str18 = 18; + string str19 = 19; + string str20 = 20; + string str21 = 21; + string str22 = 22; + string str23 = 23; + string str24 = 24; + string str25 = 25; + string str26 = 26; + string str27 = 27; + string str28 = 28; + string str29 = 29; + string str30 = 30; + string str31 = 31; + string str32 = 32; +} + +// Test int32, uint32, int64, uint64, and bool are all compatible +message Int32Message { + int32 data = 1; +} + +message Uint32Message { + uint32 data = 1; +} + +message Int64Message { + int64 data = 1; +} + +message Uint64Message { + uint64 data = 1; +} + +message BoolMessage { + bool data = 1; +} + +// Test oneofs. +message TestOneof { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + TestAllTypes foo_message = 3; + FooGroup foogroup = 4 [features.message_encoding = DELIMITED]; + } + + message FooGroup { + int32 a = 5; + string b = 6; + } +} + +message TestOneofBackwardsCompatible { + int32 foo_int = 1; + string foo_string = 2; + TestAllTypes foo_message = 3; + + message FooGroup { + int32 a = 5; + string b = 6; + } + + FooGroup foogroup = 4 [features.message_encoding = DELIMITED]; +} + +message TestOneof2 { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + string foo_cord = 3 [ctype = CORD]; + + string foo_string_piece = 4 [ctype = STRING_PIECE]; + + bytes foo_bytes = 5; + NestedEnum foo_enum = 6; + NestedMessage foo_message = 7; + FooGroup foogroup = 8 [features.message_encoding = DELIMITED]; + + NestedMessage foo_lazy_message = 11 [lazy = true]; + + bytes foo_bytes_cord = 30 [ctype = CORD]; + } + + message FooGroup { + int32 a = 9; + string b = 10; + } + + oneof bar { + int32 bar_int = 12 [default = 5]; + + string bar_string = 13 [default = "STRING"]; + + string bar_cord = 14 [ctype = CORD, default = "CORD"]; + + string bar_string_piece = 15 [ctype = STRING_PIECE, default = "SPIECE"]; + + bytes bar_bytes = 16 [default = "BYTES"]; + + NestedEnum bar_enum = 17 [default = BAR]; + + string bar_string_with_empty_default = 20 [default = ""]; + + string bar_cord_with_empty_default = 21 [ctype = CORD, default = ""]; + + string bar_string_piece_with_empty_default = 22 + [ctype = STRING_PIECE, default = ""]; + + bytes bar_bytes_with_empty_default = 23 [default = ""]; + } + + int32 baz_int = 18; + string baz_string = 19 [default = "BAZ"]; + + message NestedMessage { + int64 moo_int = 1; + repeated int32 corge_int = 2; + NestedMessage child = 3; + } + + enum NestedEnum { + FOO = 1; + BAR = 2; + BAZ = 3; + } +} + +message TestRequiredOneof { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + NestedMessage foo_message = 3; + NestedMessage foo_lazy_message = 4 [lazy = true]; + } + + message NestedMessage { + double required_double = 1 [features.field_presence = LEGACY_REQUIRED]; + } +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [features.repeated_field_encoding = PACKED]; + + repeated int64 packed_int64 = 91 [features.repeated_field_encoding = PACKED]; + + repeated uint32 packed_uint32 = 92 + [features.repeated_field_encoding = PACKED]; + + repeated uint64 packed_uint64 = 93 + [features.repeated_field_encoding = PACKED]; + + repeated sint32 packed_sint32 = 94 + [features.repeated_field_encoding = PACKED]; + + repeated sint64 packed_sint64 = 95 + [features.repeated_field_encoding = PACKED]; + + repeated fixed32 packed_fixed32 = 96 + [features.repeated_field_encoding = PACKED]; + + repeated fixed64 packed_fixed64 = 97 + [features.repeated_field_encoding = PACKED]; + + repeated sfixed32 packed_sfixed32 = 98 + [features.repeated_field_encoding = PACKED]; + + repeated sfixed64 packed_sfixed64 = 99 + [features.repeated_field_encoding = PACKED]; + + repeated float packed_float = 100 [features.repeated_field_encoding = PACKED]; + + repeated double packed_double = 101 + [features.repeated_field_encoding = PACKED]; + + repeated bool packed_bool = 102 [features.repeated_field_encoding = PACKED]; + + repeated ForeignEnum packed_enum = 103 + [features.repeated_field_encoding = PACKED]; +} + +// A message with the same fields as TestPackedTypes, but without packing. Used +// to test packed <-> unpacked wire compatibility. +message TestUnpackedTypes { + repeated int32 unpacked_int32 = 90; + repeated int64 unpacked_int64 = 91; + repeated uint32 unpacked_uint32 = 92; + repeated uint64 unpacked_uint64 = 93; + repeated sint32 unpacked_sint32 = 94; + repeated sint64 unpacked_sint64 = 95; + repeated fixed32 unpacked_fixed32 = 96; + repeated fixed64 unpacked_fixed64 = 97; + repeated sfixed32 unpacked_sfixed32 = 98; + repeated sfixed64 unpacked_sfixed64 = 99; + repeated float unpacked_float = 100; + repeated double unpacked_double = 101; + repeated bool unpacked_bool = 102; + repeated ForeignEnum unpacked_enum = 103; +} + +message TestPackedExtensions { + extensions 1 to max; +} + +extend TestPackedExtensions { + repeated int32 packed_int32_extension = 90 + [features.repeated_field_encoding = PACKED]; + + repeated int64 packed_int64_extension = 91 + [features.repeated_field_encoding = PACKED]; + + repeated uint32 packed_uint32_extension = 92 + [features.repeated_field_encoding = PACKED]; + + repeated uint64 packed_uint64_extension = 93 + [features.repeated_field_encoding = PACKED]; + + repeated sint32 packed_sint32_extension = 94 + [features.repeated_field_encoding = PACKED]; + + repeated sint64 packed_sint64_extension = 95 + [features.repeated_field_encoding = PACKED]; + + repeated fixed32 packed_fixed32_extension = 96 + [features.repeated_field_encoding = PACKED]; + + repeated fixed64 packed_fixed64_extension = 97 + [features.repeated_field_encoding = PACKED]; + + repeated sfixed32 packed_sfixed32_extension = 98 + [features.repeated_field_encoding = PACKED]; + + repeated sfixed64 packed_sfixed64_extension = 99 + [features.repeated_field_encoding = PACKED]; + + repeated float packed_float_extension = 100 + [features.repeated_field_encoding = PACKED]; + + repeated double packed_double_extension = 101 + [features.repeated_field_encoding = PACKED]; + + repeated bool packed_bool_extension = 102 + [features.repeated_field_encoding = PACKED]; + + repeated ForeignEnum packed_enum_extension = 103 + [features.repeated_field_encoding = PACKED]; +} + +message TestUnpackedExtensions { + extensions 1 to max; +} + +extend TestUnpackedExtensions { + repeated int32 unpacked_int32_extension = 90; + repeated int64 unpacked_int64_extension = 91; + repeated uint32 unpacked_uint32_extension = 92; + repeated uint64 unpacked_uint64_extension = 93; + repeated sint32 unpacked_sint32_extension = 94; + repeated sint64 unpacked_sint64_extension = 95; + repeated fixed32 unpacked_fixed32_extension = 96; + repeated fixed64 unpacked_fixed64_extension = 97; + repeated sfixed32 unpacked_sfixed32_extension = 98; + repeated sfixed64 unpacked_sfixed64_extension = 99; + repeated float unpacked_float_extension = 100; + repeated double unpacked_double_extension = 101; + repeated bool unpacked_bool_extension = 102; + repeated ForeignEnum unpacked_enum_extension = 103; +} + +// Used by ExtensionSetTest/DynamicExtensions. The test actually builds +// a set of extensions to TestAllExtensions dynamically, based on the fields +// of this message type. +message TestDynamicExtensions { + enum DynamicEnumType { + DYNAMIC_FOO = 2200; + DYNAMIC_BAR = 2201; + DYNAMIC_BAZ = 2202; + } + + message DynamicMessageType { + int32 dynamic_field = 2100; + } + + fixed32 scalar_extension = 2000; + ForeignEnum enum_extension = 2001; + DynamicEnumType dynamic_enum_extension = 2002; + ForeignMessage message_extension = 2003; + DynamicMessageType dynamic_message_extension = 2004; + repeated string repeated_extension = 2005; + repeated sint32 packed_extension = 2006 + [features.repeated_field_encoding = PACKED]; +} + +message TestRepeatedString { + repeated string repeated_string1 = 1; + repeated string repeated_string2 = 2; + repeated bytes repeated_bytes11 = 11; + repeated bytes repeated_bytes12 = 12; +} + +message TestRepeatedScalarDifferentTagSizes { + // Parsing repeated fixed size values used to fail. This message needs to be + // used in order to get a tag of the right size; all of the repeated fields + // in TestAllTypes didn't trigger the check. + repeated fixed32 repeated_fixed32 = 12; + + // Check for a varint type, just for good measure. + repeated int32 repeated_int32 = 13; + + // These have two-byte tags. + repeated fixed64 repeated_fixed64 = 2046; + repeated int64 repeated_int64 = 2047; + + // Three byte tags. + repeated float repeated_float = 262142; + repeated uint64 repeated_uint64 = 262143; +} + +// Test that if an optional or required message/group field appears multiple +// times in the input, they need to be merged. +message TestParsingMerge { + // RepeatedFieldsGenerator defines matching field types as TestParsingMerge, + // except that all fields are repeated. In the tests, we will serialize the + // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge. + // Repeated fields in RepeatedFieldsGenerator are expected to be merged into + // the corresponding required/optional fields in TestParsingMerge. + message RepeatedFieldsGenerator { + repeated TestAllTypes field1 = 1; + repeated TestAllTypes field2 = 2; + repeated TestAllTypes field3 = 3; + + message Group1 { + TestAllTypes field1 = 11; + } + + repeated Group1 group1 = 10 [features.message_encoding = DELIMITED]; + + message Group2 { + TestAllTypes field1 = 21; + } + + repeated Group2 group2 = 20 [features.message_encoding = DELIMITED]; + + repeated TestAllTypes ext1 = 1000; + repeated TestAllTypes ext2 = 1001; + } + + TestAllTypes required_all_types = 1 + [features.field_presence = LEGACY_REQUIRED]; + + TestAllTypes optional_all_types = 2; + repeated TestAllTypes repeated_all_types = 3; + + message OptionalGroup { + TestAllTypes optional_group_all_types = 11; + } + + OptionalGroup optionalgroup = 10 [features.message_encoding = DELIMITED]; + + message RepeatedGroup { + TestAllTypes repeated_group_all_types = 21; + } + + repeated RepeatedGroup repeatedgroup = 20 + [features.message_encoding = DELIMITED]; + + extensions 1000 to max; + + extend TestParsingMerge { + TestAllTypes optional_ext = 1000; + repeated TestAllTypes repeated_ext = 1001; + } +} + +// Test that the correct exception is thrown by parseFrom in a corner case +// involving merging, extensions, and required fields. +message TestMergeException { + TestAllExtensions all_extensions = 1; +} + +message TestCommentInjectionMessage { + // */ <- This should not close the generated doc comment + string a = 1 [default = "*/ <- Neither should this."]; +} + +// Used to check that the c++ code generator re-orders messages to reduce +// padding. +message TestMessageSize { + bool m1 = 1; + int64 m2 = 2; + bool m3 = 3; + string m4 = 4; + int32 m5 = 5; + int64 m6 = 6; +} + +message OpenEnumMessage { + enum TestEnum { + option features.enum_type = OPEN; + + UNKNOWN = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + } + + TestEnum opt_open = 1; + + ForeignEnum opt_closed = 2; + repeated TestEnum repeated_open = 3; + + repeated ForeignEnum repeated_closed = 4; +} + +// Tests eager verification of a lazy message field. +message TestEagerlyVerifiedLazyMessage { + message LazyMessage { + bytes bytes_field = 1; + } + LazyMessage lazy_message = 1 [lazy = true]; +} + +message TestJsonName { + int32 field_name1 = 1; + int32 fieldName2 = 2; + int32 FieldName3 = 3; + int32 _field_name4 = 4; + int32 FIELD_NAME5 = 5; + int32 field_name6 = 6 [json_name = "@type"]; + + int32 fieldname7 = 7; +} + +message TestHugeFieldNumbers { + int32 optional_int32 = 536870000; + int32 fixed_32 = 536870001; + repeated int32 repeated_int32 = 536870002; + repeated int32 packed_int32 = 536870003 + [features.repeated_field_encoding = PACKED]; + + ForeignEnum optional_enum = 536870004; + string optional_string = 536870005; + bytes optional_bytes = 536870006; + ForeignMessage optional_message = 536870007; + + message OptionalGroup { + int32 group_a = 536870009; + } + + OptionalGroup optionalgroup = 536870008 + [features.message_encoding = DELIMITED]; + + map<string, string> string_string_map = 536870010; + + oneof oneof_field { + uint32 oneof_uint32 = 536870011; + TestAllTypes oneof_test_all_types = 536870012; + string oneof_string = 536870013; + bytes oneof_bytes = 536870014; + } + + extensions 536860000 to 536869999 [declaration = { + number: 536860000 + full_name: ".rust_unittest.test_all_types" + type: ".rust_unittest.TestAllTypes" + }]; +} + +extend TestHugeFieldNumbers { + TestAllTypes test_all_types = 536860000; +} + +message TestExtensionInsideTable { + int32 field1 = 1; + int32 field2 = 2; + int32 field3 = 3; + int32 field4 = 4; + + extensions 5; + + int32 field6 = 6; + int32 field7 = 7; + int32 field8 = 8; + int32 field9 = 9; + int32 field10 = 10; +} + +extend TestExtensionInsideTable { + int32 test_extension_inside_table_extension = 5; +} + +// NOTE: Intentionally nested to mirror go/glep. +message TestNestedGroupExtensionOuter { + message Layer1OptionalGroup { + message Layer2RepeatedGroup { + extensions 3 + // NOTE: extension metadata is not supported due to targets such as + // `//google/protobuf_legacy_opensource/src:shell_scripts_test`, + // eee https://screenshot.googleplex.com/Axz2QD8nxjdpyFF + // [metadata = { + // NOTE: can't write type there due to some clever build gen code at + // http://google3/google/protobuf/BUILD;l=1247;rcl=411090862 + // type: "rust_unittest.TestNestedGroupExtensionInnerExtension", + // name: "inner", + // }] + ; + + string another_field = 6; + } + + repeated Layer2RepeatedGroup layer2repeatedgroup = 2 + [features.message_encoding = DELIMITED]; + + message Layer2AnotherOptionalRepeatedGroup { + string but_why_tho = 5; + } + + repeated Layer2AnotherOptionalRepeatedGroup + layer2anotheroptionalrepeatedgroup = 4 + [features.message_encoding = DELIMITED]; + } + + Layer1OptionalGroup layer1optionalgroup = 1 + [features.message_encoding = DELIMITED]; +} + +message TestNestedGroupExtensionInnerExtension { + string inner_name = 1; +} + +extend TestNestedGroupExtensionOuter.Layer1OptionalGroup.Layer2RepeatedGroup { + TestNestedGroupExtensionInnerExtension inner = 3; +} + +enum VeryLargeEnum { + ENUM_LABEL_DEFAULT = 0; + ENUM_LABEL_1 = 1; + ENUM_LABEL_2 = 2; + ENUM_LABEL_3 = 3; + ENUM_LABEL_4 = 4; + ENUM_LABEL_5 = 5; + ENUM_LABEL_6 = 6; + ENUM_LABEL_7 = 7; + ENUM_LABEL_8 = 8; + ENUM_LABEL_9 = 9; + ENUM_LABEL_10 = 10; + ENUM_LABEL_11 = 11; + ENUM_LABEL_12 = 12; + ENUM_LABEL_13 = 13; + ENUM_LABEL_14 = 14; + ENUM_LABEL_15 = 15; + ENUM_LABEL_16 = 16; + ENUM_LABEL_17 = 17; + ENUM_LABEL_18 = 18; + ENUM_LABEL_19 = 19; + ENUM_LABEL_20 = 20; + ENUM_LABEL_21 = 21; + ENUM_LABEL_22 = 22; + ENUM_LABEL_23 = 23; + ENUM_LABEL_24 = 24; + ENUM_LABEL_25 = 25; + ENUM_LABEL_26 = 26; + ENUM_LABEL_27 = 27; + ENUM_LABEL_28 = 28; + ENUM_LABEL_29 = 29; + ENUM_LABEL_30 = 30; + ENUM_LABEL_31 = 31; + ENUM_LABEL_32 = 32; + ENUM_LABEL_33 = 33; + ENUM_LABEL_34 = 34; + ENUM_LABEL_35 = 35; + ENUM_LABEL_36 = 36; + ENUM_LABEL_37 = 37; + ENUM_LABEL_38 = 38; + ENUM_LABEL_39 = 39; + ENUM_LABEL_40 = 40; + ENUM_LABEL_41 = 41; + ENUM_LABEL_42 = 42; + ENUM_LABEL_43 = 43; + ENUM_LABEL_44 = 44; + ENUM_LABEL_45 = 45; + ENUM_LABEL_46 = 46; + ENUM_LABEL_47 = 47; + ENUM_LABEL_48 = 48; + ENUM_LABEL_49 = 49; + ENUM_LABEL_50 = 50; + ENUM_LABEL_51 = 51; + ENUM_LABEL_52 = 52; + ENUM_LABEL_53 = 53; + ENUM_LABEL_54 = 54; + ENUM_LABEL_55 = 55; + ENUM_LABEL_56 = 56; + ENUM_LABEL_57 = 57; + ENUM_LABEL_58 = 58; + ENUM_LABEL_59 = 59; + ENUM_LABEL_60 = 60; + ENUM_LABEL_61 = 61; + ENUM_LABEL_62 = 62; + ENUM_LABEL_63 = 63; + ENUM_LABEL_64 = 64; + ENUM_LABEL_65 = 65; + ENUM_LABEL_66 = 66; + ENUM_LABEL_67 = 67; + ENUM_LABEL_68 = 68; + ENUM_LABEL_69 = 69; + ENUM_LABEL_70 = 70; + ENUM_LABEL_71 = 71; + ENUM_LABEL_72 = 72; + ENUM_LABEL_73 = 73; + ENUM_LABEL_74 = 74; + ENUM_LABEL_75 = 75; + ENUM_LABEL_76 = 76; + ENUM_LABEL_77 = 77; + ENUM_LABEL_78 = 78; + ENUM_LABEL_79 = 79; + ENUM_LABEL_80 = 80; + ENUM_LABEL_81 = 81; + ENUM_LABEL_82 = 82; + ENUM_LABEL_83 = 83; + ENUM_LABEL_84 = 84; + ENUM_LABEL_85 = 85; + ENUM_LABEL_86 = 86; + ENUM_LABEL_87 = 87; + ENUM_LABEL_88 = 88; + ENUM_LABEL_89 = 89; + ENUM_LABEL_90 = 90; + ENUM_LABEL_91 = 91; + ENUM_LABEL_92 = 92; + ENUM_LABEL_93 = 93; + ENUM_LABEL_94 = 94; + ENUM_LABEL_95 = 95; + ENUM_LABEL_96 = 96; + ENUM_LABEL_97 = 97; + ENUM_LABEL_98 = 98; + ENUM_LABEL_99 = 99; + ENUM_LABEL_100 = 100; +} + +message TestExtensionRangeSerialize { + int32 foo_one = 1; + + extensions 2; + extensions 3 to 4; + + int32 foo_two = 6; + int32 foo_three = 7; + + extensions 9 to 10; + + int32 foo_four = 13; + + extensions 15 to 15; + extensions 17 to 17; + extensions 19 to 19; + + extend TestExtensionRangeSerialize { + int32 bar_one = 2; + int32 bar_two = 4; + int32 bar_three = 10; + int32 bar_four = 15; + int32 bar_five = 19; + } +} + +message TestVerifyInt32Simple { + int32 optional_int32_1 = 1; + int32 optional_int32_2 = 2; + int32 optional_int32_63 = 63; + int32 optional_int32_64 = 64; +} + +message TestVerifyInt32 { + int32 optional_int32_1 = 1; + int32 optional_int32_2 = 2; + int32 optional_int32_63 = 63; + int32 optional_int32_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyMostlyInt32 { + int64 optional_int64_30 = 30; + int32 optional_int32_1 = 1; + int32 optional_int32_2 = 2; + int32 optional_int32_3 = 3; + int32 optional_int32_4 = 4; + int32 optional_int32_63 = 63; + int32 optional_int32_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyMostlyInt32BigFieldNumber { + int64 optional_int64_30 = 30; + int32 optional_int32_300 = 300; + int32 optional_int32_1 = 1; + int32 optional_int32_2 = 2; + int32 optional_int32_3 = 3; + int32 optional_int32_4 = 4; + int32 optional_int32_63 = 63; + int32 optional_int32_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyUint32Simple { + uint32 optional_uint32_1 = 1; + uint32 optional_uint32_2 = 2; + uint32 optional_uint32_63 = 63; + uint32 optional_uint32_64 = 64; +} + +message TestVerifyUint32 { + uint32 optional_uint32_1 = 1; + uint32 optional_uint32_2 = 2; + uint32 optional_uint32_63 = 63; + uint32 optional_uint32_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyOneUint32 { + uint32 optional_uint32_1 = 1; + int32 optional_int32_2 = 2; + int32 optional_int32_63 = 63; + int32 optional_int32_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyOneInt32BigFieldNumber { + int32 optional_int32_65 = 65; + int64 optional_int64_1 = 1; + int64 optional_int64_2 = 2; + int64 optional_int64_63 = 63; + int64 optional_int64_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyInt32BigFieldNumber { + int32 optional_int32_1000 = 1000; + int32 optional_int32_65 = 65; + int32 optional_int32_1 = 1; + int32 optional_int32_2 = 2; + int32 optional_int32_63 = 63; + int32 optional_int32_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyUint32BigFieldNumber { + uint32 optional_uint32_1000 = 1000; + uint32 optional_uint32_65 = 65; + uint32 optional_uint32_1 = 1; + uint32 optional_uint32_2 = 2; + uint32 optional_uint32_63 = 63; + uint32 optional_uint32_64 = 64; + TestAllTypes optional_all_types = 9; + repeated TestAllTypes repeated_all_types = 10; +} + +message TestVerifyBigFieldNumberUint32 { + message Nested { + uint32 optional_uint32_5000 = 5000; + uint32 optional_uint32_1000 = 1000; + uint32 optional_uint32_66 = 66; + uint32 optional_uint32_65 = 65; + uint32 optional_uint32_1 = 1; + uint32 optional_uint32_2 = 2; + uint32 optional_uint32_63 = 63; + uint32 optional_uint32_64 = 64; + Nested optional_nested = 9; + repeated Nested repeated_nested = 10; + } + + Nested optional_nested = 1; +} + +message TestVerify { + message Nested { + int32 required_int32_64 = 64 [features.field_presence = LEGACY_REQUIRED]; + + uint32 required_uint32_63 = 63 [features.field_presence = LEGACY_REQUIRED]; + + uint32 required_uint32_30 = 30 [features.field_presence = LEGACY_REQUIRED]; + + uint32 optional_uint32_8 = 8; + uint32 optional_uint32_7 = 7; + uint32 optional_uint32_5 = 5; + uint32 optional_uint32_4 = 4; + uint32 optional_uint32_1 = 1; + repeated uint32 packed_uint32_2 = 2 + [features.repeated_field_encoding = PACKED]; + + int32 optional_int32_6 = 6; + int32 optional_int32_3 = 3; + Nested optional_nested = 9; + repeated Nested repeated_nested = 10; + } + + message NestedBigFieldNumber { + int32 required_int32_80 = 80 [features.field_presence = LEGACY_REQUIRED]; + + uint32 optional_uint32_8 = 8; + uint32 optional_uint32_7 = 7; + uint32 required_uint32_1 = 1 [features.field_presence = LEGACY_REQUIRED]; + } + + Nested optional_nested = 1; + NestedBigFieldNumber optional_nested_big_field = 2; +} + +message TestVerifyBigFieldNumber { + message Nested { + int32 optional_int32_5000 = 5000; + int32 optional_int32_1000 = 1000; + int32 optional_int32_66 = 66; + int32 optional_int32_65 = 65; + int32 optional_int32_1 = 1; + uint32 optional_uint32_2 = 2; + uint32 optional_uint32_63 = 63; + int32 optional_int32_64 = 64; + Nested optional_nested = 9; + repeated Nested repeated_nested = 10; + } + + Nested optional_nested = 1; +} + +message TestSplitFields { + int32 optional_int32_1 = 1; + int32 optional_int32_2 = 2; + int32 optional_int32_3 = 3; + int32 optional_int32_4 = 4; + int32 optional_int32_5 = 5; + int32 optional_int32_6 = 6; + int32 optional_int32_7 = 7; + int32 optional_int32_8 = 8; + repeated int32 repeated_int32_1 = 9; + repeated int32 repeated_int32_2 = 10; + repeated int32 repeated_int32_3 = 11; + repeated int32 repeated_int32_4 = 12; + repeated int32 repeated_int32_5 = 13; + repeated int32 repeated_int32_6 = 14; + repeated int32 repeated_int32_7 = 15; + repeated int32 repeated_int32_8 = 16; +} + +message BadFieldNames { + int32 OptionalInt32 = 1; + int32 for = 2; +} + +message TestNestedMessageRedaction { + string optional_unredacted_nested_string = 1; + string optional_redacted_nested_string = 2 [debug_redact = true]; +} + +message RedactedFields { + string optional_redacted_string = 1 [debug_redact = true]; + + string optional_unredacted_string = 2; + repeated string repeated_redacted_string = 3 [debug_redact = true]; + + repeated string repeated_unredacted_string = 4; + TestNestedMessageRedaction optional_redacted_message = 5 + [debug_redact = true]; + + TestNestedMessageRedaction optional_unredacted_message = 6; + repeated TestNestedMessageRedaction repeated_redacted_message = 7 + [debug_redact = true]; + + repeated TestNestedMessageRedaction repeated_unredacted_message = 8; + map<string, string> map_redacted_string = 9 [debug_redact = true]; + + map<string, string> map_unredacted_string = 10; + string optional_redacted_false_string = 11 [debug_redact = false]; + + extensions 20 to 30; +} + +extend RedactedFields { + string redacted_extension = 20 [debug_redact = true]; +} + +message TestCord { + bytes optional_bytes_cord = 1 [ctype = CORD]; + + bytes optional_bytes_cord_default = 2 [ctype = CORD, default = "hello"]; +} + +message TestPackedEnumSmallRange { + enum NestedEnum { + UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + } + + repeated NestedEnum vals = 1 [features.repeated_field_encoding = PACKED]; +} + +message EnumsForBenchmark { + enum Flat { + A0 = 0; + A1 = 1; + A2 = 2; + A3 = 3; + A4 = 4; + A5 = 5; + A6 = 6; + A7 = 7; + A8 = 8; + A9 = 9; + A10 = 10; + A11 = 11; + A12 = 12; + A13 = 13; + A14 = 14; + A15 = 15; + } + + // Has a few holes, bitmap can be used. + enum AlmostFlat { + B0 = 0; + B1 = 1; + B2 = 2; + B3 = 3; + B5 = 5; + B6 = 6; + B7 = 7; + B8 = 8; + B9 = 9; + B11 = 11; + B12 = 12; + B13 = 13; + B14 = 14; + B15 = 15; + B17 = 17; + B19 = 19; + } + + enum Sparse { + C536 = 536; + C8387 = 8387; + C9673 = 9673; + C10285 = 10285; + C13318 = 13318; + C15963 = 15963; + C16439 = 16439; + C18197 = 18197; + C19430 = 19430; + C20361 = 20361; + C20706 = 20706; + C21050 = 21050; + C21906 = 21906; + C27265 = 27265; + C30109 = 30109; + C31670 = 31670; + } +} + +message TestMessageWithManyRepeatedPtrFields { + repeated string repeated_string_1 = 1; + repeated string repeated_string_2 = 2; + repeated string repeated_string_3 = 3; + repeated string repeated_string_4 = 4; + repeated string repeated_string_5 = 5; + repeated string repeated_string_6 = 6; + repeated string repeated_string_7 = 7; + repeated string repeated_string_8 = 8; + repeated string repeated_string_9 = 9; + repeated string repeated_string_10 = 10; + repeated string repeated_string_11 = 11; + repeated string repeated_string_12 = 12; + repeated string repeated_string_13 = 13; + repeated string repeated_string_14 = 14; + repeated string repeated_string_15 = 15; + repeated string repeated_string_16 = 16; + repeated string repeated_string_17 = 17; + repeated string repeated_string_18 = 18; + repeated string repeated_string_19 = 19; + repeated string repeated_string_20 = 20; + repeated string repeated_string_21 = 21; + repeated string repeated_string_22 = 22; + repeated string repeated_string_23 = 23; + repeated string repeated_string_24 = 24; + repeated string repeated_string_25 = 25; + repeated string repeated_string_26 = 26; + repeated string repeated_string_27 = 27; + repeated string repeated_string_28 = 28; + repeated string repeated_string_29 = 29; + repeated string repeated_string_30 = 30; + repeated string repeated_string_31 = 31; + repeated string repeated_string_32 = 32; +} diff --git a/third_party/protobuf/rust/test/unittest_import.proto b/third_party/protobuf/rust/test/unittest_import.proto new file mode 100644 index 0000000000000..7dbcd1467925b --- /dev/null +++ b/third_party/protobuf/rust/test/unittest_import.proto @@ -0,0 +1,36 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which is imported by unittest.proto to test importing. + +syntax = "proto2"; + +package rust_unittest_import; + +option optimize_for = SPEED; +option cc_enable_arenas = true; + +message ImportMessage { + optional int32 d = 1; +} + +enum ImportEnum { + IMPORT_FOO = 7; + IMPORT_BAR = 8; + IMPORT_BAZ = 9; +} + +// To use an enum in a map, it must has the first value as 0. +enum ImportEnumForMap { + UNKNOWN = 0; + FOO = 1; + BAR = 2; +} diff --git a/third_party/protobuf/rust/test/unittest_proto3.proto b/third_party/protobuf/rust/test/unittest_proto3.proto new file mode 100644 index 0000000000000..95ff8e45b0151 --- /dev/null +++ b/third_party/protobuf/rust/test/unittest_proto3.proto @@ -0,0 +1,268 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +syntax = "proto3"; + +package rust_proto3_unittest; + +import "rust/test/unittest_import.proto"; + +option optimize_for = SPEED; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + ZERO = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + + optional NestedMessage optional_nested_message = 18; + ForeignMessage optional_foreign_message = 19; + rust_unittest_import.ImportMessage optional_import_message = 20; + + NestedEnum optional_nested_enum = 21; + ForeignEnum optional_foreign_enum = 22; + + string optional_string_piece = 24 [ctype = STRING_PIECE]; + string optional_cord = 25 [ctype = CORD]; + + NestedMessage optional_lazy_message = 27 [lazy = true]; + rust_unittest_import.ImportMessage optional_lazy_import_message = 115 + [lazy = true]; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + // Groups are not allowed in proto3. + // repeated group RepeatedGroup = 46 { + // optional int32 a = 47; + // } + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated rust_unittest_import.ImportMessage repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + + // Omitted (compared to unittest.proto) because proto2 enums are not allowed + // inside proto2 messages. + // + // repeated rust_unittest_import.ImportEnum repeated_import_enum = 53; + + repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; + repeated string repeated_cord = 55 [ctype = CORD]; + + repeated NestedMessage repeated_lazy_message = 57; + + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + } +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +// Explicitly set packed to false +message TestUnpackedTypes { + repeated int32 repeated_int32 = 1 [packed = false]; + repeated int64 repeated_int64 = 2 [packed = false]; + repeated uint32 repeated_uint32 = 3 [packed = false]; + repeated uint64 repeated_uint64 = 4 [packed = false]; + repeated sint32 repeated_sint32 = 5 [packed = false]; + repeated sint64 repeated_sint64 = 6 [packed = false]; + repeated fixed32 repeated_fixed32 = 7 [packed = false]; + repeated fixed64 repeated_fixed64 = 8 [packed = false]; + repeated sfixed32 repeated_sfixed32 = 9 [packed = false]; + repeated sfixed64 repeated_sfixed64 = 10 [packed = false]; + repeated float repeated_float = 11 [packed = false]; + repeated double repeated_double = 12 [packed = false]; + repeated bool repeated_bool = 13 [packed = false]; + repeated TestAllTypes.NestedEnum repeated_nested_enum = 14 [packed = false]; +} + +// This proto includes a recursively nested message. +message NestedTestAllTypes { + NestedTestAllTypes child = 1; + TestAllTypes payload = 2; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_ZERO = 0; + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; + FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache. +} + +// TestEmptyMessage is used to test behavior of unknown fields. +message TestEmptyMessage {} + +// TestMessageWithDummy is also used to test behavior of unknown fields. +message TestMessageWithDummy { + // This field is only here for triggering copy-on-write; it's not intended to + // be serialized. + bool dummy = 536870911; +} + +// Same layout as TestOneof2 in unittest.proto to test unknown enum value +// parsing behavior in oneof. +message TestOneof2 { + oneof foo { + NestedEnum foo_enum = 6; + } + + enum NestedEnum { + UNKNOWN = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + } +} + +// If bool fields are incorrectly assumed to have hasbits, InternalSwap would +// result in swapping N more 32bit hasbits incorrectly. Considering padding, we +// need many bool fields to stress this. +message TestHasbits { + bool b1 = 1; + bool b2 = 2; + bool b3 = 3; + bool b4 = 4; + bool b5 = 5; + bool b6 = 6; + bool b7 = 7; + bool b8 = 8; + bool b9 = 9; + bool b10 = 10; + bool b11 = 11; + bool b12 = 12; + bool b13 = 13; + bool b14 = 14; + bool b15 = 15; + bool b16 = 16; + bool b17 = 17; + bool b18 = 18; + bool b19 = 19; + bool b20 = 20; + bool b21 = 21; + bool b22 = 22; + bool b23 = 23; + bool b24 = 24; + bool b25 = 25; + bool b26 = 26; + bool b27 = 27; + bool b28 = 28; + bool b29 = 29; + bool b30 = 30; + bool b31 = 31; + bool b32 = 32; + bool b33 = 33; + bool b34 = 34; + bool b35 = 35; + bool b36 = 36; + bool b37 = 37; + bool b38 = 38; + bool b39 = 39; + bool b40 = 40; + bool b41 = 41; + bool b42 = 42; + bool b43 = 43; + bool b44 = 44; + bool b45 = 45; + bool b46 = 46; + bool b47 = 47; + bool b48 = 48; + bool b49 = 49; + bool b50 = 50; + bool b51 = 51; + bool b52 = 52; + bool b53 = 53; + bool b54 = 54; + bool b55 = 55; + bool b56 = 56; + bool b57 = 57; + bool b58 = 58; + bool b59 = 59; + bool b60 = 60; + bool b61 = 61; + bool b62 = 62; + bool b63 = 63; + bool b64 = 64; + bool b65 = 65; + bool b66 = 66; + bool b67 = 67; + bool b68 = 68; + bool b69 = 69; + TestAllTypes child = 100; +} diff --git a/third_party/protobuf/rust/test/unittest_proto3_optional.proto b/third_party/protobuf/rust/test/unittest_proto3_optional.proto new file mode 100644 index 0000000000000..8d81ca24eb474 --- /dev/null +++ b/third_party/protobuf/rust/test/unittest_proto3_optional.proto @@ -0,0 +1,90 @@ +// 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. + +edition = "2023"; + +package rust_unittest_proto3_optional; + +option java_multiple_files = true; +option java_package = "com.google.protobuf.testing.proto"; + +message TestProto3Optional { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + string optional_cord = 16 [ctype = CORD]; + + NestedMessage optional_nested_message = 18; + NestedMessage lazy_nested_message = 19 [lazy = true]; + + NestedEnum optional_nested_enum = 21; + + // Add some non-optional fields to verify we can mix them. + int32 singular_int32 = 22 [features.field_presence = IMPLICIT]; + + int64 singular_int64 = 23 [features.field_presence = IMPLICIT]; +} + +message TestProto3OptionalMessage { + message NestedMessage { + string s = 1 [features.field_presence = IMPLICIT]; + } + + NestedMessage nested_message = 1; + NestedMessage optional_nested_message = 2; +} diff --git a/third_party/protobuf/rust/test/upb/BUILD b/third_party/protobuf/rust/test/upb/BUILD index b3b5fc1a7c37a..b199326388a56 100644 --- a/third_party/protobuf/rust/test/upb/BUILD +++ b/third_party/protobuf/rust/test/upb/BUILD @@ -32,7 +32,7 @@ rust_test( }, deps = [ "//rust:protobuf_upb_export", - "//src/google/protobuf:unittest_proto3_upb_rust_proto", + "//rust/test:unittest_proto3_upb_rust_proto", "@crate_index//:googletest", ], ) @@ -45,8 +45,7 @@ rust_test( deps = [ "//rust:protobuf_upb", "//rust/test:map_unittest_upb_rust_proto", - "//src/google/protobuf:edition_unittest_upb_rust_proto", - "//src/google/protobuf:unittest_upb_rust_proto", + "//rust/test:unittest_upb_rust_proto", "@crate_index//:googletest", ], ) diff --git a/third_party/protobuf/rust/upb.rs b/third_party/protobuf/rust/upb.rs index ddcd3acd1795a..0df37b9248960 100644 --- a/third_party/protobuf/rust/upb.rs +++ b/third_party/protobuf/rust/upb.rs @@ -542,8 +542,12 @@ impl<'msg> InnerMapMut<'msg> { self.raw } + pub fn arena(&mut self) -> &Arena { + self.arena + } + #[doc(hidden)] - pub fn raw_arena(&self) -> RawArena { + pub fn raw_arena(&mut self) -> RawArena { self.arena.raw() } } diff --git a/third_party/protobuf/rust/upb/BUILD b/third_party/protobuf/rust/upb/BUILD index 0904bd668e25e..9b0339fba75dc 100644 --- a/third_party/protobuf/rust/upb/BUILD +++ b/third_party/protobuf/rust/upb/BUILD @@ -59,11 +59,11 @@ cc_library( pkg_files( name = "rust_protobuf_upb_src", - srcs = glob( - [ - "*", - ], - ), - strip_prefix = strip_prefix.from_root("rust"), - visibility = ["//rust:__pkg__"], + srcs = glob(["*"]), + prefix = "upb", + strip_prefix = strip_prefix.from_pkg(), + visibility = [ + "//rust:__subpackages__", + "//src/google/protobuf:__subpackages__", + ], ) diff --git a/third_party/protobuf/rust/upb/array.rs b/third_party/protobuf/rust/upb/array.rs index eb2d8868a42e2..f818ea9167839 100644 --- a/third_party/protobuf/rust/upb/array.rs +++ b/third_party/protobuf/rust/upb/array.rs @@ -57,11 +57,11 @@ mod tests { assert!(upb_Array_Append(array, upb_MessageValue { float_val: 7.0 }, raw_arena)); assert!(upb_Array_Append(array, upb_MessageValue { float_val: 42.0 }, raw_arena)); assert_eq!(upb_Array_Size(array), 2); - assert!(matches!(upb_Array_Get(array, 1), upb_MessageValue { float_val: 42.0 })); + assert_eq!(upb_Array_Get(array, 1).float_val, 42.0); assert!(upb_Array_Resize(array, 3, raw_arena)); assert_eq!(upb_Array_Size(array), 3); - assert!(matches!(upb_Array_Get(array, 2), upb_MessageValue { float_val: 0.0 })); + assert_eq!(upb_Array_Get(array, 2).float_val, 0.0); } } } diff --git a/third_party/protobuf/rust/upb/map.rs b/third_party/protobuf/rust/upb/map.rs index 8b3b78b2869f9..afddb42c17954 100644 --- a/third_party/protobuf/rust/upb/map.rs +++ b/third_party/protobuf/rust/upb/map.rs @@ -106,7 +106,7 @@ mod tests { let mut out = upb_MessageValue::zeroed(); assert!(upb_Map_Get(map, upb_MessageValue { bool_val: true }, &mut out)); - assert!(matches!(out, upb_MessageValue { double_val: 4.0 })); + assert_eq!(out.double_val, 4.0); } } } diff --git a/third_party/protobuf/rust/upb/text.rs b/third_party/protobuf/rust/upb/text.rs index 39d164439b16c..9f54812927d97 100644 --- a/third_party/protobuf/rust/upb/text.rs +++ b/third_party/protobuf/rust/upb/text.rs @@ -28,6 +28,8 @@ extern "C" { #[allow(dead_code)] #[repr(i32)] enum Options { + Default = 0, + // When set, prints everything on a single line. SingleLine = 1, @@ -50,7 +52,7 @@ pub unsafe fn debug_string(msg: RawMessage, mt: *const upb_MiniTable) -> String // `mt` // - `buf` is nullptr and `buf_len` is 0 let len = - unsafe { upb_DebugString(msg, mt, Options::NoSortMaps as i32, core::ptr::null_mut(), 0) }; + unsafe { upb_DebugString(msg, mt, Options::Default as i32, core::ptr::null_mut(), 0) }; assert!(len < isize::MAX as usize); // +1 for the trailing NULL let mut buf = vec![0u8; len + 1]; @@ -58,9 +60,8 @@ pub unsafe fn debug_string(msg: RawMessage, mt: *const upb_MiniTable) -> String // - `msg` is a legally dereferencable upb_Message whose associated minitable is // `mt` // - `buf` is legally writable for 'buf_len' bytes - let written_len = unsafe { - upb_DebugString(msg, mt, Options::NoSortMaps as i32, buf.as_mut_ptr(), buf.len()) - }; + let written_len = + unsafe { upb_DebugString(msg, mt, Options::Default as i32, buf.as_mut_ptr(), buf.len()) }; assert_eq!(len, written_len); String::from_utf8_lossy(buf.as_slice()).to_string() } diff --git a/third_party/protobuf/src/README.md b/third_party/protobuf/src/README.md index 8977d0da258cd..39e8440fce26e 100644 --- a/third_party/protobuf/src/README.md +++ b/third_party/protobuf/src/README.md @@ -3,7 +3,7 @@ Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. -https://developers.google.com/protocol-buffers/ +https://protobuf.dev. CMake Installation ----------------------- @@ -16,18 +16,18 @@ C++ Protobuf - Unix To build protobuf from source, the following tools are needed: - * bazel - * git - * g++ - * Abseil +* Bazel +* git +* g++ +* Abseil On Ubuntu/Debian, for example, you can install them with: sudo apt-get install g++ git bazel -On other platforms, please use the corresponding package managing tool to -install them before proceeding. See https://bazel.build/install for further -instructions on installing Bazel, or to build from source using CMake, see +On other platforms, use the corresponding package managing tool to install them +before proceeding. See https://bazel.build/install for further instructions on +installing Bazel, or to build from source using CMake, see [cmake/README.md](../cmake/README.md). See https://github.com/abseil/abseil-cpp for instructions on installing Abseil. @@ -49,11 +49,11 @@ To build the C++ Protocol Buffer runtime and the Protocol Buffer compiler bazel build :protoc :protobuf -The compiler can then be installed, for example on Linux: +You can then install the compiler, for example on Linux: cp bazel-bin/protoc /usr/local/bin -For more usage information on Bazel, please refer to http://bazel.build. +For more usage information on Bazel, see http://bazel.build. **Compiling dependent packages** @@ -90,15 +90,16 @@ page: https://github.com/protocolbuffers/protobuf/releases/latest -In the downloads section, download the zip file protoc-$VERSION-win32.zip. -It contains the protoc binary as well as public proto files of protobuf -library. +In the downloads section, download the zip file `protoc-$VERSION-win32.zip`. It +contains the protoc binary as well as public proto files of protobuf library. +The +[protoc binary and the gencode version must match](https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp). -Protobuf and its dependencies can be installed directly by using `vcpkg`: +You can install protobuf and its dependencies directly by using `vcpkg`: >vcpkg install protobuf protobuf:x64-windows -If zlib support is desired, you'll also need to install the zlib feature: +If you want to use zlib, you'll also need to install the zlib feature: >vcpkg install protobuf[zlib] protobuf[zlib]:x64-windows @@ -126,7 +127,6 @@ by specifying: Usage ----- -The complete documentation for Protocol Buffers is available via the -web at: +The complete documentation for Protocol Buffers is available at: https://protobuf.dev/ diff --git a/third_party/protobuf/src/file_lists.cmake b/third_party/protobuf/src/file_lists.cmake index 104a296d11105..d74a982f79ba1 100644 --- a/third_party/protobuf/src/file_lists.cmake +++ b/third_party/protobuf/src/file_lists.cmake @@ -287,6 +287,62 @@ set(libprotobuf_lite_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h ) +# @//pkg:protoc_public +set(libprotoc_public_srcs + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/names.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/helpers.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_features.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/line_consumer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/names.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/names.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/php_generator.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/subprocess.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/versions.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/zip_writer.cc +) + +# @//pkg:protoc_public +set(libprotoc_public_hdrs + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/names.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/options.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/names.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/context.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/helpers.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_features.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/options.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/notices.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/line_consumer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/names.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/nsobject_methods.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/names.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/php_generator.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/scc.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/subprocess.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/versions.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/zip_writer.h +) + # @//pkg:protoc set(libprotoc_srcs ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc @@ -364,6 +420,7 @@ set(libprotoc_srcs ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/shared_code_generator.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/field.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/file.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/generator.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/message.cc @@ -417,7 +474,6 @@ set(libprotoc_srcs ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/subprocess.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/versions.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/zip_writer.cc - ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc ${protobuf_SOURCE_DIR}/upb_generator/common/names.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names_internal.cc @@ -503,9 +559,11 @@ set(libprotoc_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/options.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/shared_code_generator.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/file.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/generator.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/kotlin/message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/notices.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/enum.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/enum_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/extension.h @@ -553,7 +611,6 @@ set(libprotoc_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/subprocess.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/versions.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/zip_writer.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.h ${protobuf_SOURCE_DIR}/upb/port/atomic.h ${protobuf_SOURCE_DIR}/upb/port/def.inc ${protobuf_SOURCE_DIR}/upb/port/undef.inc @@ -613,6 +670,7 @@ set(libupb_srcs ${protobuf_SOURCE_DIR}/upb/reflection/method_def.c ${protobuf_SOURCE_DIR}/upb/reflection/oneof_def.c ${protobuf_SOURCE_DIR}/upb/reflection/service_def.c + ${protobuf_SOURCE_DIR}/upb/text/debug_string.c ${protobuf_SOURCE_DIR}/upb/text/encode.c ${protobuf_SOURCE_DIR}/upb/text/internal/encode.c ${protobuf_SOURCE_DIR}/upb/util/def_to_proto.c @@ -730,6 +788,7 @@ set(libupb_hdrs ${protobuf_SOURCE_DIR}/upb/reflection/method_def.h ${protobuf_SOURCE_DIR}/upb/reflection/oneof_def.h ${protobuf_SOURCE_DIR}/upb/reflection/service_def.h + ${protobuf_SOURCE_DIR}/upb/text/debug_string.h ${protobuf_SOURCE_DIR}/upb/text/encode.h ${protobuf_SOURCE_DIR}/upb/text/internal/encode.h ${protobuf_SOURCE_DIR}/upb/text/options.h @@ -746,8 +805,61 @@ set(libupb_hdrs # @//pkg:protoc-gen-upb set(protoc-gen-upb_srcs + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/any_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_align.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/feature_resolver.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_full.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_gen.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_sink.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/map.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/port.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/raw_ptr.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_mode.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc ${protobuf_SOURCE_DIR}/upb_generator/c/generator.cc ${protobuf_SOURCE_DIR}/upb_generator/c/names.cc ${protobuf_SOURCE_DIR}/upb_generator/c/names_internal.cc @@ -756,14 +868,98 @@ set(protoc-gen-upb_srcs ${protobuf_SOURCE_DIR}/upb_generator/file_layout.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names_internal.cc + ${protobuf_SOURCE_DIR}/upb_generator/plugin.cc ) # @//pkg:protoc-gen-upb set(protoc-gen-upb_hdrs + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_align.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_allocation_policy.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_cleanup.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/scc.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_edition_defaults.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_visitor.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/explicitly_constructed.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_inl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/feature_resolver.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/field_access_listener.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_decl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_gen.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/has_bits.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/internal_visibility.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_sink.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_inl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_type_handler.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h ${protobuf_SOURCE_DIR}/src/google/protobuf/port.h ${protobuf_SOURCE_DIR}/src/google/protobuf/port_def.inc ${protobuf_SOURCE_DIR}/src/google/protobuf/port_undef.inc + ${protobuf_SOURCE_DIR}/src/google/protobuf/raw_ptr.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_mode.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_visit_field_info.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_visit_fields.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/runtime_version.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/string_block.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/platform_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/thread_safe_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/varint_shuffle.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h ${protobuf_SOURCE_DIR}/upb_generator/c/names.h ${protobuf_SOURCE_DIR}/upb_generator/c/names_internal.h ${protobuf_SOURCE_DIR}/upb_generator/common.h @@ -777,23 +973,160 @@ set(protoc-gen-upb_hdrs # @//pkg:protoc-gen-upbdefs set(protoc-gen-upbdefs_srcs + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/any_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_align.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/feature_resolver.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_full.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_gen.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_sink.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/map.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/port.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/raw_ptr.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_mode.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc ${protobuf_SOURCE_DIR}/upb_generator/common.cc ${protobuf_SOURCE_DIR}/upb_generator/common/names.cc ${protobuf_SOURCE_DIR}/upb_generator/file_layout.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names_internal.cc + ${protobuf_SOURCE_DIR}/upb_generator/plugin.cc ${protobuf_SOURCE_DIR}/upb_generator/reflection/generator.cc ${protobuf_SOURCE_DIR}/upb_generator/reflection/names.cc ) # @//pkg:protoc-gen-upbdefs set(protoc-gen-upbdefs_hdrs + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_align.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_allocation_policy.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_cleanup.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/scc.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_edition_defaults.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_visitor.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/explicitly_constructed.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_inl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/feature_resolver.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/field_access_listener.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_decl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_gen.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/has_bits.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/internal_visibility.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_sink.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_inl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_type_handler.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h ${protobuf_SOURCE_DIR}/src/google/protobuf/port.h ${protobuf_SOURCE_DIR}/src/google/protobuf/port_def.inc ${protobuf_SOURCE_DIR}/src/google/protobuf/port_undef.inc + ${protobuf_SOURCE_DIR}/src/google/protobuf/raw_ptr.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_mode.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_visit_field_info.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_visit_fields.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/runtime_version.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/string_block.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/platform_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/thread_safe_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/varint_shuffle.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h ${protobuf_SOURCE_DIR}/upb_generator/common.h ${protobuf_SOURCE_DIR}/upb_generator/common/names.h ${protobuf_SOURCE_DIR}/upb_generator/file_layout.h @@ -806,8 +1139,61 @@ set(protoc-gen-upbdefs_hdrs # @//pkg:protoc-gen-upb_minitable set(protoc-gen-upb_minitable_srcs + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/any_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_align.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/feature_resolver.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_full.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_gen.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_sink.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/map.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/port.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/raw_ptr.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_mode.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.cc ${protobuf_SOURCE_DIR}/upb_generator/common.cc ${protobuf_SOURCE_DIR}/upb_generator/common/names.cc ${protobuf_SOURCE_DIR}/upb_generator/file_layout.cc @@ -816,14 +1202,98 @@ set(protoc-gen-upb_minitable_srcs ${protobuf_SOURCE_DIR}/upb_generator/minitable/main.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names.cc ${protobuf_SOURCE_DIR}/upb_generator/minitable/names_internal.cc + ${protobuf_SOURCE_DIR}/upb_generator/plugin.cc ) # @//pkg:protoc-gen-upb_minitable set(protoc-gen-upb_minitable_hdrs + ${protobuf_SOURCE_DIR}/src/google/protobuf/any.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_align.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_allocation_policy.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_cleanup.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/retention.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/scc.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_edition_defaults.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_visitor.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/explicitly_constructed.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_inl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/feature_resolver.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/field_access_listener.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_decl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_gen.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/has_bits.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/internal_visibility.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/gzip_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/strtod.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_sink.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_inl.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/map_type_handler.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/message.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h ${protobuf_SOURCE_DIR}/src/google/protobuf/port.h ${protobuf_SOURCE_DIR}/src/google/protobuf/port_def.inc ${protobuf_SOURCE_DIR}/src/google/protobuf/port_undef.inc + ${protobuf_SOURCE_DIR}/src/google/protobuf/raw_ptr.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_mode.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_visit_field_info.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_visit_fields.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/runtime_version.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/string_block.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/platform_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/thread_safe_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/varint_shuffle.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h ${protobuf_SOURCE_DIR}/upb_generator/common.h ${protobuf_SOURCE_DIR}/upb_generator/common/names.h ${protobuf_SOURCE_DIR}/upb_generator/file_layout.h @@ -962,6 +1432,7 @@ set(common_test_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.h ${protobuf_SOURCE_DIR}/src/google/protobuf/internal_visibility_for_testing.h ${protobuf_SOURCE_DIR}/src/google/protobuf/test_textproto.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.h ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.h ) @@ -1171,6 +1642,7 @@ set(protobuf_test_protos_files ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_extensions.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_lite.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_optional.proto + ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_redaction.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_retention.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_string_type.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_string_view.proto @@ -1186,6 +1658,7 @@ set(protobuf_lite_test_files # @//src/google/protobuf:lite_test_proto_srcs set(protobuf_lite_test_protos_files ${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_unittest.proto + ${protobuf_SOURCE_DIR}/src/google/protobuf/only_one_enum_test.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_lite.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public_lite.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite.proto @@ -1216,7 +1689,9 @@ set(compiler_test_files ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment_unittest.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_serialization_unittest.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver_test.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/plugin_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/line_consumer_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/names_unittest.cc @@ -1233,6 +1708,7 @@ set(compiler_test_files set(compiler_test_protos_files ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/test_large_enum_value.proto + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_serialization_unittest.proto ) # @//src/google/protobuf/compiler:test_plugin_srcs diff --git a/third_party/protobuf/src/google/protobuf/BUILD.bazel b/third_party/protobuf/src/google/protobuf/BUILD.bazel index 5cfd160d94ba7..e35af5b9d5023 100644 --- a/third_party/protobuf/src/google/protobuf/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/BUILD.bazel @@ -276,13 +276,14 @@ cc_library( "//src/google/protobuf:__subpackages__", ], deps = [ - "@com_google_absl//absl/base:config", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:prefetch", - "@com_google_absl//absl/meta:type_traits", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:prefetch", + "@abseil-cpp//absl/meta:type_traits", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:variant", ], ) @@ -295,7 +296,10 @@ cc_library( "//:__subpackages__", "//src/google/protobuf:__subpackages__", ], - deps = [":port"], + deps = [ + ":port", + "@abseil-cpp//absl/base:core_headers", + ], ) cc_test( @@ -304,9 +308,9 @@ cc_test( deps = [ ":port", ":varint_shuffle", - "@com_google_absl//absl/log:absl_check", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -331,12 +335,12 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:string_view", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -346,10 +350,10 @@ cc_test( deps = [ ":port", ":varint_shuffle", - "@com_google_absl//absl/base:config", - "@com_google_absl//absl/log:absl_check", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/log:absl_check", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -365,10 +369,10 @@ cc_library( deps = [ ":port", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/numeric:bits", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/numeric:bits", ], ) @@ -381,8 +385,8 @@ cc_library( "//src/google/protobuf:__subpackages__", ], deps = [ - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:prefetch", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:prefetch", ], ) @@ -405,8 +409,8 @@ cc_library( strip_include_prefix = "/src", deps = [ ":arena_align", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/log:absl_check", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log:absl_check", ], ) @@ -416,8 +420,8 @@ cc_test( deps = [ ":port", ":string_block", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -444,15 +448,15 @@ cc_library( ":port", ":string_block", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:prefetch", - "@com_google_absl//absl/container:layout", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/numeric:bits", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/types:span", - "@com_google_absl//absl/utility:if_constexpr", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:dynamic_annotations", + "@abseil-cpp//absl/base:prefetch", + "@abseil-cpp//absl/container:layout", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:span", ], ) @@ -557,28 +561,28 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/stubs:lite", "//third_party/utf8_range:utf8_validity", - "@com_google_absl//absl/base", - "@com_google_absl//absl/base:config", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:dynamic_annotations", - "@com_google_absl//absl/base:prefetch", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/hash", - "@com_google_absl//absl/log", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/meta:type_traits", - "@com_google_absl//absl/numeric:bits", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:internal", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/time", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", - "@com_google_absl//absl/utility:if_constexpr", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:dynamic_annotations", + "@abseil-cpp//absl/base:prefetch", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/functional:overload", + "@abseil-cpp//absl/hash", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/meta:type_traits", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:internal", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/time", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", ], ) @@ -654,33 +658,36 @@ cc_library( "//src/google/protobuf/io:tokenizer", "//src/google/protobuf/stubs", "//third_party/utf8_range:utf8_validity", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/base", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:dynamic_annotations", - "@com_google_absl//absl/cleanup", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:fixed_array", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/functional:any_invocable", - "@com_google_absl//absl/functional:function_ref", - "@com_google_absl//absl/hash", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/numeric:bits", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:internal", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/time", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", - "@com_google_absl//absl/types:variant", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:dynamic_annotations", + "@abseil-cpp//absl/cleanup", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:fixed_array", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/functional:overload", + "@abseil-cpp//absl/hash", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:internal", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/time", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", + "@abseil-cpp//absl/types:variant", + "@abseil-cpp//absl/utility", ], ) @@ -728,8 +735,8 @@ cc_test( copts = COPTS, deps = [ ":protobuf_lite", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -814,6 +821,7 @@ filegroup( name = "lite_test_proto_srcs", srcs = [ "map_lite_unittest.proto", + "only_one_enum_test.proto", "unittest_import_lite.proto", "unittest_import_public_lite.proto", "unittest_lite.proto", @@ -868,6 +876,7 @@ filegroup( "unittest_proto3_extensions.proto", "unittest_proto3_lite.proto", "unittest_proto3_optional.proto", + "unittest_redaction.proto", "unittest_retention.proto", "unittest_string_type.proto", "unittest_well_known_types.proto", @@ -951,6 +960,7 @@ proto_library( "unittest_proto3_bad_macros.proto", "unittest_proto3_extensions.proto", "unittest_proto3_lite.proto", + "unittest_redaction.proto", "unittest_retention.proto", "unittest_string_type.proto", "unittest_string_view.proto", @@ -1174,9 +1184,9 @@ cc_test( ":port", ":protobuf", ":unittest_string_view_cc_proto", - "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings:string_view", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1224,10 +1234,10 @@ cc_library( ":port", ":test_util2", "//src/google/protobuf/io", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", ], ) @@ -1265,13 +1275,15 @@ cc_library( ":lite_test_util", ":port", ":protobuf", + ":test_textproto", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/time", - "@com_google_googletest//:gtest", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/time", + "@googletest//:gtest", ], ) @@ -1285,7 +1297,7 @@ cc_library( deps = [ "//src/google/protobuf/io", "//src/google/protobuf/util:differencer", - "@com_google_googletest//:gtest", + "@googletest//:gtest", ], ) @@ -1298,10 +1310,10 @@ cc_test( ":port", ":protobuf", ":test_util", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1316,8 +1328,8 @@ cc_test( }), deps = [ ":arena_align", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1340,13 +1352,13 @@ cc_test( ":protobuf_lite", ":test_util", "//src/google/protobuf/io", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/utility", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/utility", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1359,10 +1371,10 @@ cc_test( ":protobuf_lite", "//src/google/protobuf/io", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1371,11 +1383,17 @@ cc_test( srcs = ["arenaz_sampler_test.cc"], deps = [ ":arena", + ":arena_allocation_policy", ":port", ":protobuf", "//src/google/protobuf/stubs", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/time", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1387,8 +1405,8 @@ cc_test( ":test_textproto", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1415,22 +1433,22 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/base:log_severity", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/functional:any_invocable", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/log:scoped_mock_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base:log_severity", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/log:scoped_mock_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1446,9 +1464,9 @@ cc_library( ], deps = [ ":protobuf", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/memory", - "@com_google_googletest//:gtest", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/memory", + "@googletest//:gtest", ], ) @@ -1459,8 +1477,8 @@ cc_test( ":cc_test_protos", ":protobuf", ":protobuf_lite", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1480,8 +1498,8 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1506,11 +1524,11 @@ cc_test( "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", "//src/google/protobuf/util:differencer", - "@com_google_absl//absl/base", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1530,15 +1548,15 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1561,12 +1579,12 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1581,15 +1599,18 @@ cc_test( }), deps = [ ":cc_test_protos", + ":descriptor_visitor", ":port", + ":protobuf", ":protobuf_lite", "//src/google/protobuf/io", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1603,10 +1624,10 @@ cc_test( ":protobuf_lite", "//src/google/protobuf/io", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1623,8 +1644,8 @@ cc_test( ":lite_test_util", ":protobuf", ":test_util", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1639,10 +1660,10 @@ cc_test( ":protobuf_lite", "//src/google/protobuf/io", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1658,13 +1679,13 @@ cc_test( ":protobuf_lite", ":test_util", "//src/google/protobuf/stubs", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1689,6 +1710,7 @@ cc_test( ":port", ":protobuf", ":protobuf_lite", + ":test_textproto", ":test_util", ":test_util2", "//src/google/protobuf/io", @@ -1697,17 +1719,17 @@ cc_test( "//src/google/protobuf/testing:file", "//src/google/protobuf/util:differencer", "//src/google/protobuf/util:time_util", - "@com_google_absl//absl/base", - "@com_google_absl//absl/cleanup", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/time", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/cleanup", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/time", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1723,6 +1745,7 @@ cc_test( ":cc_lite_test_protos", ":cc_test_protos", ":internal_visibility", + ":lite_test_util", ":port", ":protobuf", ":protobuf_lite", @@ -1734,13 +1757,14 @@ cc_test( "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", "//src/google/protobuf/util:differencer", - "@com_google_absl//absl/hash:hash_testing", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:scoped_mock_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/hash:hash_testing", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:scoped_mock_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1754,6 +1778,7 @@ cc_test( ":arena", ":cc_test_protos", ":internal_visibility", + ":lite_test_util", ":port", ":protobuf", ":protobuf_lite", @@ -1765,12 +1790,13 @@ cc_test( "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", "//src/google/protobuf/util:differencer", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:scoped_mock_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:scoped_mock_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1780,12 +1806,12 @@ cc_test( deps = [ ":cc_test_protos", ":protobuf", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:string_view", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1795,12 +1821,12 @@ cc_test( deps = [ ":cc_test_protos", ":protobuf", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:string_view", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1810,8 +1836,8 @@ cc_test( deps = [ ":cc_test_protos", ":protobuf", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1826,8 +1852,8 @@ cc_test( ":unittest_proto3_arena_cc_proto", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1851,10 +1877,10 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1878,8 +1904,8 @@ cc_test( ":unittest_proto3_cc_proto", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1899,9 +1925,9 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1923,10 +1949,10 @@ cc_test( ":protobuf", ":test_util", "//src/google/protobuf/stubs", - "@com_google_absl//absl/base", - "@com_google_absl//absl/strings:cord", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/strings:cord", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1950,14 +1976,15 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/numeric:bits", - "@com_google_absl//absl/random", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/types:span", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base:config", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/types:span", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -1985,14 +2012,14 @@ cc_test( "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", "//third_party/utf8_range:utf8_validity", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/log:scoped_mock_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:str_format", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/log:scoped_mock_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:str_format", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2014,14 +2041,14 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/functional:bind_front", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/time", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/functional:bind_front", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/time", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2040,8 +2067,8 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2064,13 +2091,13 @@ cc_test( "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", "//src/google/protobuf/util:differencer", - "@com_google_absl//absl/base", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:scoped_mock_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:scoped_mock_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2081,11 +2108,11 @@ cc_test( ":port", ":protobuf", ":protobuf_lite", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:span", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:span", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2100,9 +2127,9 @@ cc_test( "//src/google/protobuf/io", "//src/google/protobuf/io:tokenizer", "//src/google/protobuf/util:differencer", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2111,8 +2138,8 @@ cc_test( srcs = ["reflection_mode_test.cc"], deps = [ ":protobuf", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2122,9 +2149,9 @@ cc_test( deps = [ ":cc_test_protos", ":protobuf", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2149,8 +2176,8 @@ cc_test( ":cc_test_protos", ":protobuf", ":unredacted_debug_format_for_test", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -2229,6 +2256,6 @@ cc_library( ], deps = [ ":port", - "@com_google_absl//absl/base:config", + "@abseil-cpp//absl/base:config", ], ) diff --git a/third_party/protobuf/src/google/protobuf/any.pb.cc b/third_party/protobuf/src/google/protobuf/any.pb.cc index 721cb5824e55b..e8d626ebf1011 100644 --- a/third_party/protobuf/src/google/protobuf/any.pb.cc +++ b/third_party/protobuf/src/google/protobuf/any.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/any.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/any.pb.h" @@ -33,18 +33,18 @@ namespace protobuf { inline constexpr Any::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : type_url_( + : _cached_size_{0}, + type_url_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), value_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template <typename> PROTOBUF_CONSTEXPR Any::Any(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Any_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -62,14 +62,14 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AnyDefaultTypeInternal _Any_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -79,13 +79,15 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _impl_.type_url_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Any, _impl_.value_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::Any)}, + {0, 10, -1, sizeof(::google::protobuf::Any)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_Any_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2fany_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -124,35 +126,42 @@ bool Any::GetAnyFieldDescriptors( const ::google::protobuf::FieldDescriptor** value_field) { return ::_pbi::GetAnyFieldDescriptors(message, type_url_field, value_field); } -bool Any::ParseAnyTypeUrl(::absl::string_view type_url, - std::string* full_type_name) { +bool Any::ParseAnyTypeUrl( + ::absl::string_view type_url, + std::string* PROTOBUF_NONNULL full_type_name) { return ::_pbi::ParseAnyTypeUrl(type_url, full_type_name); } class Any::_Internal { public: + using HasBits = + decltype(std::declval<Any>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Any, _impl_._has_bits_); }; -Any::Any(::google::protobuf::Arena* arena) +Any::Any(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Any_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Any) } -inline PROTOBUF_NDEBUG_INLINE Any::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Any& from_msg) - : type_url_(arena, from.type_url_), - value_(arena, from.value_), - _cached_size_{0} {} +PROTOBUF_NDEBUG_INLINE Any::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Any& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + type_url_(arena, from.type_url_), + value_(arena, from.value_) {} Any::Any( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Any& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Any_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -164,14 +173,14 @@ Any::Any( // @@protoc_insertion_point(copy_constructor:google.protobuf.Any) } -inline PROTOBUF_NDEBUG_INLINE Any::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Any::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : type_url_(arena), - value_(arena), - _cached_size_{0} {} + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + type_url_(arena), + value_(arena) {} -inline void Any::SharedCtor(::_pb::Arena* arena) { +inline void Any::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } Any::~Any() { @@ -187,45 +196,53 @@ inline void Any::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Any::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Any::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Any(arena); } constexpr auto Any::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Any), alignof(Any)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Any::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Any_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Any::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Any>(), +constexpr auto Any::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Any_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Any::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Any>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Any::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Any>(), &Any::ByteSizeLong, - &Any::_InternalSerialize, + &Any::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Any>(), &Any::ByteSizeLong, + &Any::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Any, _impl_._cached_size_), - false, - }, - &Any::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fany_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Any::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Any, _impl_._cached_size_), + false, + }, + &Any::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fany_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Any_class_data_ = + Any::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Any::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Any_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Any_class_data_.tc_table); + return Any_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 36, 2> Any::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 36, 2> +Any::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Any, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -234,7 +251,7 @@ const ::_pbi::TcParseTable<1, 2, 0, 36, 2> Any::_table_ = { 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Any_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -243,19 +260,19 @@ const ::_pbi::TcParseTable<1, 2, 0, 36, 2> Any::_table_ = { }, {{ // bytes value = 2; {::_pbi::TcParser::FastBS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.value_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.value_)}}, // string type_url = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_)}}, }}, {{ 65535, 65535 }}, {{ // string type_url = 1; - {PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Any, _impl_.type_url_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // bytes value = 2; - {PROTOBUF_FIELD_OFFSET(Any, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Any, _impl_.value_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -264,7 +281,6 @@ const ::_pbi::TcParseTable<1, 2, 0, 36, 2> Any::_table_ = { "type_url" }}, }; - PROTOBUF_NOINLINE void Any::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Any) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -272,79 +288,96 @@ PROTOBUF_NOINLINE void Any::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.type_url_.ClearToEmpty(); - _impl_.value_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.type_url_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + _impl_.value_.ClearNonDefaultToEmpty(); + } + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Any::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Any& this_ = static_cast<const Any&>(base); +::uint8_t* PROTOBUF_NONNULL Any::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Any& this_ = static_cast<const Any&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Any::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Any& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Any::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Any& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string type_url = 1; - if (!this_._internal_type_url().empty()) { - const std::string& _s = this_._internal_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Any.type_url"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string type_url = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_type_url().empty()) { + const std::string& _s = this_._internal_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Any.type_url"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - // bytes value = 2; - if (!this_._internal_value().empty()) { - const std::string& _s = this_._internal_value(); - target = stream->WriteBytesMaybeAliased(2, _s, target); - } + // bytes value = 2; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_value().empty()) { + const std::string& _s = this_._internal_value(); + target = stream->WriteBytesMaybeAliased(2, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Any::ByteSizeLong(const MessageLite& base) { - const Any& this_ = static_cast<const Any&>(base); +::size_t Any::ByteSizeLong(const MessageLite& base) { + const Any& this_ = static_cast<const Any&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Any::ByteSizeLong() const { - const Any& this_ = *this; +::size_t Any::ByteSizeLong() const { + const Any& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // string type_url = 1; - if (!this_._internal_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type_url()); - } - // bytes value = 2; - if (!this_._internal_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_value()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // string type_url = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_type_url()); + } + } + // bytes value = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this_._internal_value()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Any::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Any*>(&to_msg); @@ -354,12 +387,28 @@ void Any::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pro ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_type_url().empty()) { - _this->_internal_set_type_url(from._internal_type_url()); - } - if (!from._internal_value().empty()) { - _this->_internal_set_value(from._internal_value()); + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_type_url().empty()) { + _this->_internal_set_type_url(from._internal_type_url()); + } else { + if (_this->_impl_.type_url_.IsDefault()) { + _this->_internal_set_type_url(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (!from._internal_value().empty()) { + _this->_internal_set_value(from._internal_value()); + } else { + if (_this->_impl_.value_.IsDefault()) { + _this->_internal_set_value(""); + } + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -371,11 +420,12 @@ void Any::CopyFrom(const Any& from) { } -void Any::InternalSwap(Any* PROTOBUF_RESTRICT other) { +void Any::InternalSwap(Any* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.type_url_, &other->_impl_.type_url_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.value_, &other->_impl_.value_, arena); } @@ -395,7 +445,7 @@ namespace protobuf { #pragma clang diagnostic pop #endif // __llvm__ PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fany_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/any.pb.h b/third_party/protobuf/src/google/protobuf/any.pb.h index d5d369529289b..5586d7c83397d 100644 --- a/third_party/protobuf/src/google/protobuf/any.pb.h +++ b/third_party/protobuf/src/google/protobuf/any.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/any.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fany_2eproto_2epb_2eh #define google_2fprotobuf_2fany_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -49,13 +49,15 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fany_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto; +} // extern "C" namespace google { namespace protobuf { class Any; struct AnyDefaultTypeInternal; PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Any_class_data_; } // namespace protobuf } // namespace google @@ -74,15 +76,14 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message ~Any() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Any* msg, std::destroying_delete_t) { + void operator delete(Any* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Any)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Any( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Any(::google::protobuf::internal::ConstantInitialized); inline Any(const Any& from) : Any(nullptr, from) {} inline Any(Any&& from) noexcept @@ -105,25 +106,22 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Any& default_instance() { - return *internal_default_instance(); - } - static inline const Any* internal_default_instance() { - return reinterpret_cast<const Any*>( + return *reinterpret_cast<const Any*>( &_Any_default_instance_); } static constexpr int kIndexInFileMessages = 0; @@ -132,24 +130,26 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message bool PackFrom(const ::google::protobuf::Message& message) { ABSL_DCHECK_NE(&message, this); - return ::google::protobuf::internal::InternalPackFrom( - message, mutable_type_url(), _internal_mutable_value()); + return ::google::protobuf::internal::InternalPackFrom(message, mutable_type_url(), + _internal_mutable_value()); } bool PackFrom(const ::google::protobuf::Message& message, ::absl::string_view type_url_prefix) { ABSL_DCHECK_NE(&message, this); - return ::google::protobuf::internal::InternalPackFrom( - message, type_url_prefix, mutable_type_url(), - _internal_mutable_value()); + return ::google::protobuf::internal::InternalPackFrom(message, type_url_prefix, + mutable_type_url(), + _internal_mutable_value()); } - bool UnpackTo(::google::protobuf::Message* message) const { - return ::google::protobuf::internal::InternalUnpackTo( - _internal_type_url(), _internal_value(), message); + bool UnpackTo(::google::protobuf::Message* PROTOBUF_NONNULL message) const { + return ::google::protobuf::internal::InternalUnpackTo(_internal_type_url(), + _internal_value(), message); } static bool GetAnyFieldDescriptors( const ::google::protobuf::Message& message, - const ::google::protobuf::FieldDescriptor** type_url_field, - const ::google::protobuf::FieldDescriptor** value_field); + const ::google::protobuf::FieldDescriptor* PROTOBUF_NULLABLE* PROTOBUF_NONNULL + type_url_field, + const ::google::protobuf::FieldDescriptor* PROTOBUF_NULLABLE* PROTOBUF_NONNULL + value_field); template < typename T, class = typename std::enable_if<!std::is_convertible< @@ -172,7 +172,7 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message typename T, class = typename std::enable_if<!std::is_convertible< T, const ::google::protobuf::Message&>::value>::type> - bool UnpackTo(T* message) const { + bool UnpackTo(T* PROTOBUF_NONNULL message) const { return ::google::protobuf::internal::InternalUnpackTo<T>( _internal_type_url(), _internal_value(), message); } @@ -181,10 +181,11 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message bool Is() const { return ::google::protobuf::internal::InternalIs<T>(_internal_type_url()); } - static bool ParseAnyTypeUrl(::absl::string_view type_url, - std::string* full_type_name); + static bool ParseAnyTypeUrl( + ::absl::string_view type_url, + std::string* PROTOBUF_NONNULL full_type_name); friend void swap(Any& a, Any& b) { a.Swap(&b); } - inline void Swap(Any* other) { + inline void Swap(Any* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -192,7 +193,7 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Any* other) { + void UnsafeArenaSwap(Any* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -200,7 +201,7 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Any* New(::google::protobuf::Arena* arena = nullptr) const { + Any* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Any>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -209,9 +210,8 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message void MergeFrom(const Any& from) { Any::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -221,49 +221,51 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Any* other); + void InternalSwap(Any* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Any"; } protected: - explicit Any(::google::protobuf::Arena* arena); - Any(::google::protobuf::Arena* arena, const Any& from); - Any(::google::protobuf::Arena* arena, Any&& from) noexcept + explicit Any(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Any(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Any& from); + Any( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Any&& from) noexcept : Any(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -277,15 +279,14 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message const std::string& type_url() const; template <typename Arg_ = const std::string&, typename... Args_> void set_type_url(Arg_&& arg, Args_... args); - std::string* mutable_type_url(); - PROTOBUF_NODISCARD std::string* release_type_url(); - void set_allocated_type_url(std::string* value); + std::string* PROTOBUF_NONNULL mutable_type_url(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_type_url(); + void set_allocated_type_url(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_type_url() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url( - const std::string& value); - std::string* _internal_mutable_type_url(); + PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_type_url(); public: // bytes value = 2; @@ -293,24 +294,23 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message const std::string& value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_value(Arg_&& arg, Args_... args); - std::string* mutable_value(); - PROTOBUF_NODISCARD std::string* release_value(); - void set_allocated_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_value(); + void set_allocated_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_value( - const std::string& value); - std::string* _internal_mutable_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_value(); public: // @@protoc_insertion_point(class_scope:google.protobuf.Any) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, - 36, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 0, 36, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -320,22 +320,26 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Any& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Any& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr type_url_; ::google::protobuf::internal::ArenaStringPtr value_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fany_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Any_class_data_; + // =================================================================== @@ -356,6 +360,7 @@ class PROTOBUF_EXPORT Any final : public ::google::protobuf::Message inline void Any::clear_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Any::type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -363,13 +368,14 @@ inline const std::string& Any::type_url() const return _internal_type_url(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Any::set_type_url(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Any::set_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.type_url_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url) } -inline std::string* Any::mutable_type_url() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Any::mutable_type_url() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_type_url(); // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url) return _s; @@ -380,19 +386,34 @@ inline const std::string& Any::_internal_type_url() const { } inline void Any::_internal_set_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.type_url_.Set(value, GetArena()); } -inline std::string* Any::_internal_mutable_type_url() { +inline std::string* PROTOBUF_NONNULL Any::_internal_mutable_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.type_url_.Mutable( GetArena()); } -inline std::string* Any::release_type_url() { +inline std::string* PROTOBUF_NULLABLE Any::release_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url) - return _impl_.type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.type_url_.Set("", GetArena()); + } + return released; } -inline void Any::set_allocated_type_url(std::string* value) { +inline void Any::set_allocated_type_url(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.type_url_.IsDefault()) { _impl_.type_url_.Set("", GetArena()); @@ -404,6 +425,7 @@ inline void Any::set_allocated_type_url(std::string* value) { inline void Any::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Any::value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -411,13 +433,14 @@ inline const std::string& Any::value() const return _internal_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Any::set_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Any::set_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.value_.SetBytes(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Any.value) } -inline std::string* Any::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Any::mutable_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value) return _s; @@ -428,19 +451,34 @@ inline const std::string& Any::_internal_value() const { } inline void Any::_internal_set_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.value_.Set(value, GetArena()); } -inline std::string* Any::_internal_mutable_value() { +inline std::string* PROTOBUF_NONNULL Any::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.value_.Mutable( GetArena()); } -inline std::string* Any::release_value() { +inline std::string* PROTOBUF_NULLABLE Any::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Any.value) - return _impl_.value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.value_.Set("", GetArena()); + } + return released; } -inline void Any::set_allocated_value(std::string* value) { +inline void Any::set_allocated_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.value_.IsDefault()) { _impl_.value_.Set("", GetArena()); diff --git a/third_party/protobuf/src/google/protobuf/any_test.cc b/third_party/protobuf/src/google/protobuf/any_test.cc index 400e90c9933ae..386e2252b68da 100644 --- a/third_party/protobuf/src/google/protobuf/any_test.cc +++ b/third_party/protobuf/src/google/protobuf/any_test.cc @@ -25,9 +25,9 @@ namespace protobuf { namespace { TEST(AnyTest, TestPackAndUnpack) { - protobuf_unittest::TestAny submessage; + proto2_unittest::TestAny submessage; submessage.set_int32_value(12345); - protobuf_unittest::TestAny message; + proto2_unittest::TestAny message; ASSERT_TRUE(message.mutable_any_value()->PackFrom(submessage)); std::string data = message.SerializeAsString(); @@ -43,30 +43,30 @@ TEST(AnyTest, TestPackFromSerializationExceedsSizeLimit) { if (sizeof(size_t) == 4) { GTEST_SKIP() << "This toolchain can't allocate that much memory."; } - protobuf_unittest::TestAny submessage; + proto2_unittest::TestAny submessage; submessage.mutable_text()->resize(INT_MAX, 'a'); - protobuf_unittest::TestAny message; + proto2_unittest::TestAny message; EXPECT_FALSE(message.mutable_any_value()->PackFrom(submessage)); } TEST(AnyTest, TestUnpackWithTypeMismatch) { - protobuf_unittest::TestAny payload; + proto2_unittest::TestAny payload; payload.set_int32_value(13); google::protobuf::Any any; any.PackFrom(payload); // Attempt to unpack into the wrong type. - protobuf_unittest::TestAllTypes dest; + proto2_unittest::TestAllTypes dest; EXPECT_FALSE(any.UnpackTo(&dest)); } TEST(AnyTest, TestPackAndUnpackAny) { // We can pack a Any message inside another Any message. - protobuf_unittest::TestAny submessage; + proto2_unittest::TestAny submessage; submessage.set_int32_value(12345); google::protobuf::Any any; any.PackFrom(submessage); - protobuf_unittest::TestAny message; + proto2_unittest::TestAny message; message.mutable_any_value()->PackFrom(any); std::string data = message.SerializeAsString(); @@ -81,18 +81,18 @@ TEST(AnyTest, TestPackAndUnpackAny) { } TEST(AnyTest, TestPackWithCustomTypeUrl) { - protobuf_unittest::TestAny submessage; + proto2_unittest::TestAny submessage; submessage.set_int32_value(12345); google::protobuf::Any any; // Pack with a custom type URL prefix. any.PackFrom(submessage, "type.myservice.com"); - EXPECT_EQ("type.myservice.com/protobuf_unittest.TestAny", any.type_url()); + EXPECT_EQ("type.myservice.com/proto2_unittest.TestAny", any.type_url()); // Pack with a custom type URL prefix ending with '/'. any.PackFrom(submessage, "type.myservice.com/"); - EXPECT_EQ("type.myservice.com/protobuf_unittest.TestAny", any.type_url()); + EXPECT_EQ("type.myservice.com/proto2_unittest.TestAny", any.type_url()); // Pack with an empty type URL prefix. any.PackFrom(submessage, ""); - EXPECT_EQ("/protobuf_unittest.TestAny", any.type_url()); + EXPECT_EQ("/proto2_unittest.TestAny", any.type_url()); // Test unpacking the type. submessage.Clear(); @@ -101,32 +101,32 @@ TEST(AnyTest, TestPackWithCustomTypeUrl) { } TEST(AnyTest, TestIs) { - protobuf_unittest::TestAny submessage; + proto2_unittest::TestAny submessage; submessage.set_int32_value(12345); google::protobuf::Any any; any.PackFrom(submessage); ASSERT_TRUE(any.ParseFromString(any.SerializeAsString())); - EXPECT_TRUE(any.Is<protobuf_unittest::TestAny>()); + EXPECT_TRUE(any.Is<proto2_unittest::TestAny>()); EXPECT_FALSE(any.Is<google::protobuf::Any>()); - protobuf_unittest::TestAny message; + proto2_unittest::TestAny message; message.mutable_any_value()->PackFrom(any); ASSERT_TRUE(message.ParseFromString(message.SerializeAsString())); - EXPECT_FALSE(message.any_value().Is<protobuf_unittest::TestAny>()); + EXPECT_FALSE(message.any_value().Is<proto2_unittest::TestAny>()); EXPECT_TRUE(message.any_value().Is<google::protobuf::Any>()); - any.set_type_url("/protobuf_unittest.TestAny"); - EXPECT_TRUE(any.Is<protobuf_unittest::TestAny>()); + any.set_type_url("/proto2_unittest.TestAny"); + EXPECT_TRUE(any.Is<proto2_unittest::TestAny>()); // The type URL must contain at least one "/". - any.set_type_url("protobuf_unittest.TestAny"); - EXPECT_FALSE(any.Is<protobuf_unittest::TestAny>()); + any.set_type_url("proto2_unittest.TestAny"); + EXPECT_FALSE(any.Is<proto2_unittest::TestAny>()); // The type name after the slash must be fully qualified. any.set_type_url("/TestAny"); - EXPECT_FALSE(any.Is<protobuf_unittest::TestAny>()); + EXPECT_FALSE(any.Is<proto2_unittest::TestAny>()); } TEST(AnyTest, MoveConstructor) { - protobuf_unittest::TestAny payload; + proto2_unittest::TestAny payload; payload.set_int32_value(12345); google::protobuf::Any src; @@ -142,7 +142,7 @@ TEST(AnyTest, MoveConstructor) { } TEST(AnyTest, MoveAssignment) { - protobuf_unittest::TestAny payload; + proto2_unittest::TestAny payload; payload.set_int32_value(12345); google::protobuf::Any src; diff --git a/third_party/protobuf/src/google/protobuf/any_test.proto b/third_party/protobuf/src/google/protobuf/any_test.proto index db8c97c1cba20..05b0c8bcd6678 100644 --- a/third_party/protobuf/src/google/protobuf/any_test.proto +++ b/third_party/protobuf/src/google/protobuf/any_test.proto @@ -7,7 +7,7 @@ syntax = "proto3"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/any.proto"; diff --git a/third_party/protobuf/src/google/protobuf/api.pb.cc b/third_party/protobuf/src/google/protobuf/api.pb.cc index befe043732704..47f1184461621 100644 --- a/third_party/protobuf/src/google/protobuf/api.pb.cc +++ b/third_party/protobuf/src/google/protobuf/api.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/api.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/api.pb.h" @@ -29,18 +29,18 @@ namespace protobuf { inline constexpr Mixin::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : name_( + : _cached_size_{0}, + name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), root_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template <typename> PROTOBUF_CONSTEXPR Mixin::Mixin(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Mixin_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -59,7 +59,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Method::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : options_{}, + : _cached_size_{0}, + options_{}, name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -71,13 +72,12 @@ inline constexpr Method::Impl_::Impl_( ::_pbi::ConstantInitialized()), request_streaming_{false}, response_streaming_{false}, - syntax_{static_cast< ::google::protobuf::Syntax >(0)}, - _cached_size_{0} {} + syntax_{static_cast< ::google::protobuf::Syntax >(0)} {} template <typename> PROTOBUF_CONSTEXPR Method::Method(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Method_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -112,7 +112,7 @@ inline constexpr Api::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR Api::Api(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Api_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -130,9 +130,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ApiDefaultTypeInternal _Api_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -152,14 +152,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Api, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Api, _impl_.mixins_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Api, _impl_.syntax_), - ~0u, - ~0u, - ~0u, - ~0u, 0, ~0u, ~0u, - ~0u, // no _has_bits_ + 1, + 2, + ~0u, + 3, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -174,7 +174,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_.response_streaming_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_.options_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Method, _impl_.syntax_), - ~0u, // no _has_bits_ + 0, + 1, + 3, + 2, + 4, + ~0u, + 5, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -184,15 +191,17 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _impl_.name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Mixin, _impl_.root_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, 15, -1, sizeof(::google::protobuf::Api)}, - {22, -1, -1, sizeof(::google::protobuf::Method)}, - {37, -1, -1, sizeof(::google::protobuf::Mixin)}, + {22, 37, -1, sizeof(::google::protobuf::Method)}, + {44, 54, -1, sizeof(::google::protobuf::Mixin)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_Api_default_instance_._instance, &::google::protobuf::_Method_default_instance_._instance, &::google::protobuf::_Mixin_default_instance_._instance, @@ -219,8 +228,8 @@ const char descriptor_table_protodef_google_2fprotobuf_2fapi_2eproto[] ABSL_ATTR "otobuf/types/known/apipb\242\002\003GPB\252\002\036Google." "Protobuf.WellKnownTypesb\006proto3" }; -static const ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2fapi_2eproto_deps[2] = - { +static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const + descriptor_table_google_2fprotobuf_2fapi_2eproto_deps[2] = { &::descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto, &::descriptor_table_google_2fprotobuf_2ftype_2eproto, }; @@ -260,20 +269,21 @@ void Api::clear_options() { void Api::clear_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } -Api::Api(::google::protobuf::Arena* arena) +Api::Api(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Api_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Api) } -inline PROTOBUF_NDEBUG_INLINE Api::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Api& from_msg) +PROTOBUF_NDEBUG_INLINE Api::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Api& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, methods_{visibility, arena, from.methods_}, @@ -283,10 +293,10 @@ inline PROTOBUF_NDEBUG_INLINE Api::Impl_::Impl_( version_(arena, from.version_) {} Api::Api( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Api& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Api_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -296,16 +306,16 @@ Api::Api( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.source_context_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( - arena, *from._impl_.source_context_) - : nullptr; + _impl_.source_context_ = ((cached_has_bits & 0x00000004u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_context_) + : nullptr; _impl_.syntax_ = from._impl_.syntax_; // @@protoc_insertion_point(copy_constructor:google.protobuf.Api) } -inline PROTOBUF_NDEBUG_INLINE Api::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Api::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, methods_{visibility, arena}, options_{visibility, arena}, @@ -313,7 +323,7 @@ inline PROTOBUF_NDEBUG_INLINE Api::Impl_::Impl_( name_(arena), version_(arena) {} -inline void Api::SharedCtor(::_pb::Arena* arena) { +inline void Api::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, source_context_), @@ -336,8 +346,9 @@ inline void Api::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Api::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Api::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Api(arena); } constexpr auto Api::InternalNewImpl_() { @@ -364,35 +375,42 @@ constexpr auto Api::InternalNewImpl_() { alignof(Api)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Api::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Api_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Api::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Api>(), +constexpr auto Api::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Api_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Api::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Api>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Api::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Api>(), &Api::ByteSizeLong, - &Api::_InternalSerialize, + &Api::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Api>(), &Api::ByteSizeLong, + &Api::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Api, _impl_._cached_size_), - false, - }, - &Api::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fapi_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Api::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Api, _impl_._cached_size_), + false, + }, + &Api::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fapi_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Api_class_data_ = + Api::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Api::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Api_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Api_class_data_.tc_table); + return Api_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { +const ::_pbi::TcParseTable<3, 7, 4, 39, 2> +Api::_table_ = { { PROTOBUF_FIELD_OFFSET(Api, _impl_._has_bits_), 0, // no _extensions_ @@ -403,7 +421,7 @@ const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { 7, // num_field_entries 4, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Api_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -413,7 +431,7 @@ const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.name_)}}, // repeated .google.protobuf.Method methods = 2; {::_pbi::TcParser::FastMtR1, {18, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.methods_)}}, @@ -422,22 +440,22 @@ const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { {26, 63, 1, PROTOBUF_FIELD_OFFSET(Api, _impl_.options_)}}, // string version = 4; {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.version_)}}, + {34, 1, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.version_)}}, // .google.protobuf.SourceContext source_context = 5; {::_pbi::TcParser::FastMtS1, - {42, 0, 2, PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_)}}, + {42, 2, 2, PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_)}}, // repeated .google.protobuf.Mixin mixins = 6; {::_pbi::TcParser::FastMtR1, {50, 63, 3, PROTOBUF_FIELD_OFFSET(Api, _impl_.mixins_)}}, // .google.protobuf.Syntax syntax = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Api, _impl_.syntax_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Api, _impl_.syntax_), 3>(), + {56, 3, 0, PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Api, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // repeated .google.protobuf.Method methods = 2; {PROTOBUF_FIELD_OFFSET(Api, _impl_.methods_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, @@ -445,30 +463,31 @@ const ::_pbi::TcParseTable<3, 7, 4, 39, 2> Api::_table_ = { {PROTOBUF_FIELD_OFFSET(Api, _impl_.options_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // string version = 4; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.version_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Api, _impl_.version_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // .google.protobuf.SourceContext source_context = 5; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_), _Internal::kHasBitsOffset + 0, 2, + {PROTOBUF_FIELD_OFFSET(Api, _impl_.source_context_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // repeated .google.protobuf.Mixin mixins = 6; {PROTOBUF_FIELD_OFFSET(Api, _impl_.mixins_), -1, 3, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 7; - {PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Method>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::SourceContext>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Mixin>()}, - }}, {{ + {PROTOBUF_FIELD_OFFSET(Api, _impl_.syntax_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Method>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::SourceContext>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::Mixin>()}, + }}, + {{ "\23\4\0\0\7\0\0\0" "google.protobuf.Api" "name" "version" }}, }; - PROTOBUF_NOINLINE void Api::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Api) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -479,12 +498,18 @@ PROTOBUF_NOINLINE void Api::Clear() { _impl_.methods_.Clear(); _impl_.options_.Clear(); _impl_.mixins_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.version_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.source_context_ != nullptr); - _impl_.source_context_->Clear(); + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + _impl_.version_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000004u) != 0) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); + } } _impl_.syntax_ = 0; _impl_._has_bits_.Clear(); @@ -492,161 +517,169 @@ PROTOBUF_NOINLINE void Api::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Api::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Api& this_ = static_cast<const Api&>(base); +::uint8_t* PROTOBUF_NONNULL Api::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Api& this_ = static_cast<const Api&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Api::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Api& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Api::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Api& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - // repeated .google.protobuf.Method methods = 2; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_methods_size()); - i < n; i++) { - const auto& repfield = this_._internal_methods().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Method methods = 2; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_methods_size()); + i < n; i++) { + const auto& repfield = this_._internal_methods().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.Option options = 3; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_options_size()); - i < n; i++) { - const auto& repfield = this_._internal_options().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Option options = 3; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_options_size()); + i < n; i++) { + const auto& repfield = this_._internal_options().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, repfield, repfield.GetCachedSize(), + target, stream); + } - // string version = 4; - if (!this_._internal_version().empty()) { - const std::string& _s = this_._internal_version(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); - target = stream->WriteStringMaybeAliased(4, _s, target); - } + // string version = 4; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_version().empty()) { + const std::string& _s = this_._internal_version(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Api.version"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } + } - cached_has_bits = this_._impl_._has_bits_[0]; - // .google.protobuf.SourceContext source_context = 5; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, - stream); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // .google.protobuf.SourceContext source_context = 5; + if ((cached_has_bits & 0x00000004u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 5, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.Mixin mixins = 6; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_mixins_size()); - i < n; i++) { - const auto& repfield = this_._internal_mixins().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Mixin mixins = 6; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_mixins_size()); + i < n; i++) { + const auto& repfield = this_._internal_mixins().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 6, repfield, repfield.GetCachedSize(), + target, stream); + } - // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 7, this_._internal_syntax(), target); - } + // .google.protobuf.Syntax syntax = 7; + if ((cached_has_bits & 0x00000008u) != 0) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 7, this_._internal_syntax(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Api) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Api) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Api::ByteSizeLong(const MessageLite& base) { - const Api& this_ = static_cast<const Api&>(base); +::size_t Api::ByteSizeLong(const MessageLite& base) { + const Api& this_ = static_cast<const Api&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Api::ByteSizeLong() const { - const Api& this_ = *this; +::size_t Api::ByteSizeLong() const { + const Api& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.Method methods = 2; - { - total_size += 1UL * this_._internal_methods_size(); - for (const auto& msg : this_._internal_methods()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.Option options = 3; - { - total_size += 1UL * this_._internal_options_size(); - for (const auto& msg : this_._internal_options()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.Mixin mixins = 6; - { - total_size += 1UL * this_._internal_mixins_size(); - for (const auto& msg : this_._internal_mixins()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - { - // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // string version = 4; - if (!this_._internal_version().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_version()); - } - } - { - // .google.protobuf.SourceContext source_context = 5; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); - } - } - { - // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.Method methods = 2; + { + total_size += 1UL * this_._internal_methods_size(); + for (const auto& msg : this_._internal_methods()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.Option options = 3; + { + total_size += 1UL * this_._internal_options_size(); + for (const auto& msg : this_._internal_options()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.Mixin mixins = 6; + { + total_size += 1UL * this_._internal_mixins_size(); + for (const auto& msg : this_._internal_mixins()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // string version = 4; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_version().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_version()); + } + } + // .google.protobuf.SourceContext source_context = 5; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); + } + // .google.protobuf.Syntax syntax = 7; + if ((cached_has_bits & 0x00000008u) != 0) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Api::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Api*>(&to_msg); @@ -663,24 +696,39 @@ void Api::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pro from._internal_options()); _this->_internal_mutable_mixins()->MergeFrom( from._internal_mixins()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_version().empty()) { - _this->_internal_set_version(from._internal_version()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.source_context_ != nullptr); - if (_this->_impl_.source_context_ == nullptr) { - _this->_impl_.source_context_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); - } else { - _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (!from._internal_version().empty()) { + _this->_internal_set_version(from._internal_version()); + } else { + if (_this->_impl_.version_.IsDefault()) { + _this->_internal_set_version(""); + } + } + } + if ((cached_has_bits & 0x00000004u) != 0) { + ABSL_DCHECK(from._impl_.source_context_ != nullptr); + if (_this->_impl_.source_context_ == nullptr) { + _this->_impl_.source_context_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_context_); + } else { + _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + } + } + if ((cached_has_bits & 0x00000008u) != 0) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } } - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); @@ -694,7 +742,7 @@ void Api::CopyFrom(const Api& from) { } -void Api::InternalSwap(Api* PROTOBUF_RESTRICT other) { +void Api::InternalSwap(Api* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -720,35 +768,41 @@ void Api::InternalSwap(Api* PROTOBUF_RESTRICT other) { class Method::_Internal { public: + using HasBits = + decltype(std::declval<Method>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Method, _impl_._has_bits_); }; void Method::clear_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.options_.Clear(); } -Method::Method(::google::protobuf::Arena* arena) +Method::Method(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Method_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Method) } -inline PROTOBUF_NDEBUG_INLINE Method::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Method& from_msg) - : options_{visibility, arena, from.options_}, +PROTOBUF_NDEBUG_INLINE Method::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Method& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + options_{visibility, arena, from.options_}, name_(arena, from.name_), request_type_url_(arena, from.request_type_url_), - response_type_url_(arena, from.response_type_url_), - _cached_size_{0} {} + response_type_url_(arena, from.response_type_url_) {} Method::Method( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Method& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Method_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -767,16 +821,16 @@ Method::Method( // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) } -inline PROTOBUF_NDEBUG_INLINE Method::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Method::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : options_{visibility, arena}, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + options_{visibility, arena}, name_(arena), request_type_url_(arena), - response_type_url_(arena), - _cached_size_{0} {} + response_type_url_(arena) {} -inline void Method::SharedCtor(::_pb::Arena* arena) { +inline void Method::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, request_streaming_), @@ -799,8 +853,9 @@ inline void Method::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Method::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Method::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Method(arena); } constexpr auto Method::InternalNewImpl_() { @@ -819,37 +874,44 @@ constexpr auto Method::InternalNewImpl_() { alignof(Method)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Method::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Method_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Method::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Method>(), +constexpr auto Method::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Method_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Method::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Method>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Method::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Method>(), &Method::ByteSizeLong, - &Method::_InternalSerialize, + &Method::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Method>(), &Method::ByteSizeLong, + &Method::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Method, _impl_._cached_size_), - false, - }, - &Method::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fapi_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Method::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Method, _impl_._cached_size_), + false, + }, + &Method::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fapi_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Method_class_data_ = + Method::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Method::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Method_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Method_class_data_.tc_table); + return Method_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 7, 1, 68, 2> Method::_table_ = { +const ::_pbi::TcParseTable<3, 7, 1, 68, 2> +Method::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Method, _impl_._has_bits_), 0, // no _extensions_ 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -858,7 +920,7 @@ const ::_pbi::TcParseTable<3, 7, 1, 68, 2> Method::_table_ = { 7, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Method_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -868,52 +930,54 @@ const ::_pbi::TcParseTable<3, 7, 1, 68, 2> Method::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.name_)}}, // string request_type_url = 2; {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_)}}, // bool request_streaming = 3; - {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(Method, _impl_.request_streaming_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(Method, _impl_.request_streaming_), 3>(), + {24, 3, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_)}}, // string response_type_url = 4; {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_)}}, + {34, 2, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_)}}, // bool response_streaming = 5; - {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(Method, _impl_.response_streaming_), 63>(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(Method, _impl_.response_streaming_), 4>(), + {40, 4, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_)}}, // repeated .google.protobuf.Option options = 6; {::_pbi::TcParser::FastMtR1, {50, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.options_)}}, // .google.protobuf.Syntax syntax = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Method, _impl_.syntax_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Method, _impl_.syntax_), 5>(), + {56, 5, 0, PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string request_type_url = 2; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_type_url_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // bool request_streaming = 3; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.request_streaming_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, // string response_type_url = 4; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_type_url_), _Internal::kHasBitsOffset + 2, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // bool response_streaming = 5; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.response_streaming_), _Internal::kHasBitsOffset + 4, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, // repeated .google.protobuf.Option options = 6; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.options_), 0, 0, + {PROTOBUF_FIELD_OFFSET(Method, _impl_.options_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 7; - {PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, - }}, {{ + {PROTOBUF_FIELD_OFFSET(Method, _impl_.syntax_), _Internal::kHasBitsOffset + 5, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, + }}, + {{ "\26\4\20\0\21\0\0\0" "google.protobuf.Method" "name" @@ -921,7 +985,6 @@ const ::_pbi::TcParseTable<3, 7, 1, 68, 2> Method::_table_ = { "response_type_url" }}, }; - PROTOBUF_NOINLINE void Method::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Method) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -930,152 +993,189 @@ PROTOBUF_NOINLINE void Method::Clear() { (void) cached_has_bits; _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.request_type_url_.ClearToEmpty(); - _impl_.response_type_url_.ClearToEmpty(); - ::memset(&_impl_.request_streaming_, 0, static_cast<::size_t>( - reinterpret_cast<char*>(&_impl_.syntax_) - - reinterpret_cast<char*>(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_)); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + _impl_.request_type_url_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000004u) != 0) { + _impl_.response_type_url_.ClearNonDefaultToEmpty(); + } + } + if ((cached_has_bits & 0x00000038u) != 0) { + ::memset(&_impl_.request_streaming_, 0, static_cast<::size_t>( + reinterpret_cast<char*>(&_impl_.syntax_) - + reinterpret_cast<char*>(&_impl_.request_streaming_)) + sizeof(_impl_.syntax_)); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Method::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Method& this_ = static_cast<const Method&>(base); +::uint8_t* PROTOBUF_NONNULL Method::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Method& this_ = static_cast<const Method&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Method::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Method& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Method::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Method& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - // string request_type_url = 2; - if (!this_._internal_request_type_url().empty()) { - const std::string& _s = this_._internal_request_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + // string request_type_url = 2; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_request_type_url().empty()) { + const std::string& _s = this_._internal_request_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.request_type_url"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + } - // bool request_streaming = 3; - if (this_._internal_request_streaming() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_request_streaming(), target); - } + // bool request_streaming = 3; + if ((this_._impl_._has_bits_[0] & 0x00000008u) != 0) { + if (this_._internal_request_streaming() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this_._internal_request_streaming(), target); + } + } - // string response_type_url = 4; - if (!this_._internal_response_type_url().empty()) { - const std::string& _s = this_._internal_response_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); - target = stream->WriteStringMaybeAliased(4, _s, target); - } + // string response_type_url = 4; + if ((this_._impl_._has_bits_[0] & 0x00000004u) != 0) { + if (!this_._internal_response_type_url().empty()) { + const std::string& _s = this_._internal_response_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Method.response_type_url"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } + } - // bool response_streaming = 5; - if (this_._internal_response_streaming() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 5, this_._internal_response_streaming(), target); - } + // bool response_streaming = 5; + if ((this_._impl_._has_bits_[0] & 0x00000010u) != 0) { + if (this_._internal_response_streaming() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this_._internal_response_streaming(), target); + } + } - // repeated .google.protobuf.Option options = 6; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_options_size()); - i < n; i++) { - const auto& repfield = this_._internal_options().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Option options = 6; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_options_size()); + i < n; i++) { + const auto& repfield = this_._internal_options().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 6, repfield, repfield.GetCachedSize(), + target, stream); + } - // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 7, this_._internal_syntax(), target); - } + // .google.protobuf.Syntax syntax = 7; + if ((this_._impl_._has_bits_[0] & 0x00000020u) != 0) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 7, this_._internal_syntax(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Method) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Method) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Method::ByteSizeLong(const MessageLite& base) { - const Method& this_ = static_cast<const Method&>(base); +::size_t Method::ByteSizeLong(const MessageLite& base) { + const Method& this_ = static_cast<const Method&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Method::ByteSizeLong() const { - const Method& this_ = *this; +::size_t Method::ByteSizeLong() const { + const Method& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.Option options = 6; - { - total_size += 1UL * this_._internal_options_size(); - for (const auto& msg : this_._internal_options()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - { - // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // string request_type_url = 2; - if (!this_._internal_request_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_request_type_url()); - } - // string response_type_url = 4; - if (!this_._internal_response_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_response_type_url()); - } - // bool request_streaming = 3; - if (this_._internal_request_streaming() != 0) { - total_size += 2; - } - // bool response_streaming = 5; - if (this_._internal_response_streaming() != 0) { - total_size += 2; - } - // .google.protobuf.Syntax syntax = 7; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.Option options = 6; + { + total_size += 1UL * this_._internal_options_size(); + for (const auto& msg : this_._internal_options()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000003fu) != 0) { + // string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // string request_type_url = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_request_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_request_type_url()); + } + } + // string response_type_url = 4; + if ((cached_has_bits & 0x00000004u) != 0) { + if (!this_._internal_response_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_response_type_url()); + } + } + // bool request_streaming = 3; + if ((cached_has_bits & 0x00000008u) != 0) { + if (this_._internal_request_streaming() != 0) { + total_size += 2; + } + } + // bool response_streaming = 5; + if ((cached_has_bits & 0x00000010u) != 0) { + if (this_._internal_response_streaming() != 0) { + total_size += 2; + } + } + // .google.protobuf.Syntax syntax = 7; + if ((cached_has_bits & 0x00000020u) != 0) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Method::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Method*>(&to_msg); @@ -1087,24 +1187,52 @@ void Method::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google:: _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_request_type_url().empty()) { - _this->_internal_set_request_type_url(from._internal_request_type_url()); - } - if (!from._internal_response_type_url().empty()) { - _this->_internal_set_response_type_url(from._internal_response_type_url()); - } - if (from._internal_request_streaming() != 0) { - _this->_impl_.request_streaming_ = from._impl_.request_streaming_; - } - if (from._internal_response_streaming() != 0) { - _this->_impl_.response_streaming_ = from._impl_.response_streaming_; - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000003fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (!from._internal_request_type_url().empty()) { + _this->_internal_set_request_type_url(from._internal_request_type_url()); + } else { + if (_this->_impl_.request_type_url_.IsDefault()) { + _this->_internal_set_request_type_url(""); + } + } + } + if ((cached_has_bits & 0x00000004u) != 0) { + if (!from._internal_response_type_url().empty()) { + _this->_internal_set_response_type_url(from._internal_response_type_url()); + } else { + if (_this->_impl_.response_type_url_.IsDefault()) { + _this->_internal_set_response_type_url(""); + } + } + } + if ((cached_has_bits & 0x00000008u) != 0) { + if (from._internal_request_streaming() != 0) { + _this->_impl_.request_streaming_ = from._impl_.request_streaming_; + } + } + if ((cached_has_bits & 0x00000010u) != 0) { + if (from._internal_response_streaming() != 0) { + _this->_impl_.response_streaming_ = from._impl_.response_streaming_; + } + } + if ((cached_has_bits & 0x00000020u) != 0) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1116,11 +1244,12 @@ void Method::CopyFrom(const Method& from) { } -void Method::InternalSwap(Method* PROTOBUF_RESTRICT other) { +void Method::InternalSwap(Method* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.options_.InternalSwap(&other->_impl_.options_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.request_type_url_, &other->_impl_.request_type_url_, arena); @@ -1140,29 +1269,35 @@ void Method::InternalSwap(Method* PROTOBUF_RESTRICT other) { class Mixin::_Internal { public: + using HasBits = + decltype(std::declval<Mixin>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Mixin, _impl_._has_bits_); }; -Mixin::Mixin(::google::protobuf::Arena* arena) +Mixin::Mixin(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Mixin_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Mixin) } -inline PROTOBUF_NDEBUG_INLINE Mixin::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Mixin& from_msg) - : name_(arena, from.name_), - root_(arena, from.root_), - _cached_size_{0} {} +PROTOBUF_NDEBUG_INLINE Mixin::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Mixin& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + name_(arena, from.name_), + root_(arena, from.root_) {} Mixin::Mixin( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Mixin& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Mixin_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1174,14 +1309,14 @@ Mixin::Mixin( // @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin) } -inline PROTOBUF_NDEBUG_INLINE Mixin::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Mixin::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : name_(arena), - root_(arena), - _cached_size_{0} {} + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + name_(arena), + root_(arena) {} -inline void Mixin::SharedCtor(::_pb::Arena* arena) { +inline void Mixin::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } Mixin::~Mixin() { @@ -1197,45 +1332,53 @@ inline void Mixin::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Mixin::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Mixin::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Mixin(arena); } constexpr auto Mixin::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Mixin), alignof(Mixin)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Mixin::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Mixin_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Mixin::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Mixin>(), +constexpr auto Mixin::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Mixin_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Mixin::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Mixin>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Mixin::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Mixin>(), &Mixin::ByteSizeLong, - &Mixin::_InternalSerialize, + &Mixin::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Mixin>(), &Mixin::ByteSizeLong, + &Mixin::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Mixin, _impl_._cached_size_), - false, - }, - &Mixin::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fapi_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Mixin::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Mixin, _impl_._cached_size_), + false, + }, + &Mixin::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fapi_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Mixin_class_data_ = + Mixin::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Mixin::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Mixin_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Mixin_class_data_.tc_table); + return Mixin_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 38, 2> Mixin::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 38, 2> +Mixin::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Mixin, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1244,7 +1387,7 @@ const ::_pbi::TcParseTable<1, 2, 0, 38, 2> Mixin::_table_ = { 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Mixin_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1253,19 +1396,19 @@ const ::_pbi::TcParseTable<1, 2, 0, 38, 2> Mixin::_table_ = { }, {{ // string root = 2; {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_)}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string root = 2; - {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Mixin, _impl_.root_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -1275,7 +1418,6 @@ const ::_pbi::TcParseTable<1, 2, 0, 38, 2> Mixin::_table_ = { "root" }}, }; - PROTOBUF_NOINLINE void Mixin::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1283,81 +1425,98 @@ PROTOBUF_NOINLINE void Mixin::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.name_.ClearToEmpty(); - _impl_.root_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + _impl_.root_.ClearNonDefaultToEmpty(); + } + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Mixin::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Mixin& this_ = static_cast<const Mixin&>(base); +::uint8_t* PROTOBUF_NONNULL Mixin::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Mixin& this_ = static_cast<const Mixin&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Mixin::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Mixin& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Mixin::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Mixin& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - // string root = 2; - if (!this_._internal_root().empty()) { - const std::string& _s = this_._internal_root(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + // string root = 2; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_root().empty()) { + const std::string& _s = this_._internal_root(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Mixin.root"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Mixin) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Mixin) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Mixin::ByteSizeLong(const MessageLite& base) { - const Mixin& this_ = static_cast<const Mixin&>(base); +::size_t Mixin::ByteSizeLong(const MessageLite& base) { + const Mixin& this_ = static_cast<const Mixin&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Mixin::ByteSizeLong() const { - const Mixin& this_ = *this; +::size_t Mixin::ByteSizeLong() const { + const Mixin& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // string root = 2; - if (!this_._internal_root().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_root()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // string root = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_root().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_root()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Mixin::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Mixin*>(&to_msg); @@ -1367,12 +1526,28 @@ void Mixin::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::p ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_root().empty()) { - _this->_internal_set_root(from._internal_root()); + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (!from._internal_root().empty()) { + _this->_internal_set_root(from._internal_root()); + } else { + if (_this->_impl_.root_.IsDefault()) { + _this->_internal_set_root(""); + } + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1384,11 +1559,12 @@ void Mixin::CopyFrom(const Mixin& from) { } -void Mixin::InternalSwap(Mixin* PROTOBUF_RESTRICT other) { +void Mixin::InternalSwap(Mixin* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.root_, &other->_impl_.root_, arena); } @@ -1405,7 +1581,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fapi_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/api.pb.h b/third_party/protobuf/src/google/protobuf/api.pb.h index 7ae8537749bfd..2404c5ebcaffb 100644 --- a/third_party/protobuf/src/google/protobuf/api.pb.h +++ b/third_party/protobuf/src/google/protobuf/api.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/api.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fapi_2eproto_2epb_2eh #define google_2fprotobuf_2fapi_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -51,19 +51,23 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fapi_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto; +} // extern "C" namespace google { namespace protobuf { class Api; struct ApiDefaultTypeInternal; PROTOBUF_EXPORT extern ApiDefaultTypeInternal _Api_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Api_class_data_; class Method; struct MethodDefaultTypeInternal; PROTOBUF_EXPORT extern MethodDefaultTypeInternal _Method_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Method_class_data_; class Mixin; struct MixinDefaultTypeInternal; PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Mixin_class_data_; } // namespace protobuf } // namespace google @@ -82,15 +86,14 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message ~Mixin() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Mixin* msg, std::destroying_delete_t) { + void operator delete(Mixin* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Mixin)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Mixin( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Mixin(::google::protobuf::internal::ConstantInitialized); inline Mixin(const Mixin& from) : Mixin(nullptr, from) {} inline Mixin(Mixin&& from) noexcept @@ -113,30 +116,27 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Mixin& default_instance() { - return *internal_default_instance(); - } - static inline const Mixin* internal_default_instance() { - return reinterpret_cast<const Mixin*>( + return *reinterpret_cast<const Mixin*>( &_Mixin_default_instance_); } static constexpr int kIndexInFileMessages = 2; friend void swap(Mixin& a, Mixin& b) { a.Swap(&b); } - inline void Swap(Mixin* other) { + inline void Swap(Mixin* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -144,7 +144,7 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Mixin* other) { + void UnsafeArenaSwap(Mixin* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -152,7 +152,7 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Mixin* New(::google::protobuf::Arena* arena = nullptr) const { + Mixin* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Mixin>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -161,9 +161,8 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message void MergeFrom(const Mixin& from) { Mixin::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -173,49 +172,51 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Mixin* other); + void InternalSwap(Mixin* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Mixin"; } protected: - explicit Mixin(::google::protobuf::Arena* arena); - Mixin(::google::protobuf::Arena* arena, const Mixin& from); - Mixin(::google::protobuf::Arena* arena, Mixin&& from) noexcept + explicit Mixin(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Mixin(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Mixin& from); + Mixin( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Mixin&& from) noexcept : Mixin(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -229,15 +230,14 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // string root = 2; @@ -245,24 +245,23 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message const std::string& root() const; template <typename Arg_ = const std::string&, typename... Args_> void set_root(Arg_&& arg, Args_... args); - std::string* mutable_root(); - PROTOBUF_NODISCARD std::string* release_root(); - void set_allocated_root(std::string* value); + std::string* PROTOBUF_NONNULL mutable_root(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_root(); + void set_allocated_root(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_root() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_root( - const std::string& value); - std::string* _internal_mutable_root(); + PROTOBUF_ALWAYS_INLINE void _internal_set_root(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_root(); public: // @@protoc_insertion_point(class_scope:google.protobuf.Mixin) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, - 38, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 0, 38, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -272,21 +271,25 @@ class PROTOBUF_EXPORT Mixin final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Mixin& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Mixin& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr root_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Mixin_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message @@ -296,15 +299,14 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message ~Method() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Method* msg, std::destroying_delete_t) { + void operator delete(Method* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Method)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Method( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Method(::google::protobuf::internal::ConstantInitialized); inline Method(const Method& from) : Method(nullptr, from) {} inline Method(Method&& from) noexcept @@ -327,30 +329,27 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Method& default_instance() { - return *internal_default_instance(); - } - static inline const Method* internal_default_instance() { - return reinterpret_cast<const Method*>( + return *reinterpret_cast<const Method*>( &_Method_default_instance_); } static constexpr int kIndexInFileMessages = 1; friend void swap(Method& a, Method& b) { a.Swap(&b); } - inline void Swap(Method* other) { + inline void Swap(Method* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -358,7 +357,7 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Method* other) { + void UnsafeArenaSwap(Method* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -366,7 +365,7 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Method* New(::google::protobuf::Arena* arena = nullptr) const { + Method* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Method>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -375,9 +374,8 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message void MergeFrom(const Method& from) { Method::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -387,49 +385,51 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Method* other); + void InternalSwap(Method* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Method"; } protected: - explicit Method(::google::protobuf::Arena* arena); - Method(::google::protobuf::Arena* arena, const Method& from); - Method(::google::protobuf::Arena* arena, Method&& from) noexcept + explicit Method(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Method(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Method& from); + Method( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Method&& from) noexcept : Method(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -450,30 +450,29 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message public: void clear_options() ; - ::google::protobuf::Option* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* mutable_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL mutable_options(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* _internal_mutable_options(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL _internal_mutable_options(); public: const ::google::protobuf::Option& options(int index) const; - ::google::protobuf::Option* add_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL add_options(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& options() const; // string name = 1; void clear_name() ; const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // string request_type_url = 2; @@ -481,15 +480,14 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message const std::string& request_type_url() const; template <typename Arg_ = const std::string&, typename... Args_> void set_request_type_url(Arg_&& arg, Args_... args); - std::string* mutable_request_type_url(); - PROTOBUF_NODISCARD std::string* release_request_type_url(); - void set_allocated_request_type_url(std::string* value); + std::string* PROTOBUF_NONNULL mutable_request_type_url(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_request_type_url(); + void set_allocated_request_type_url(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_request_type_url() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_type_url( - const std::string& value); - std::string* _internal_mutable_request_type_url(); + PROTOBUF_ALWAYS_INLINE void _internal_set_request_type_url(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_request_type_url(); public: // string response_type_url = 4; @@ -497,15 +495,14 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message const std::string& response_type_url() const; template <typename Arg_ = const std::string&, typename... Args_> void set_response_type_url(Arg_&& arg, Args_... args); - std::string* mutable_response_type_url(); - PROTOBUF_NODISCARD std::string* release_response_type_url(); - void set_allocated_response_type_url(std::string* value); + std::string* PROTOBUF_NONNULL mutable_response_type_url(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_response_type_url(); + void set_allocated_response_type_url(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_response_type_url() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_response_type_url( - const std::string& value); - std::string* _internal_mutable_response_type_url(); + PROTOBUF_ALWAYS_INLINE void _internal_set_response_type_url(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_response_type_url(); public: // bool request_streaming = 3; @@ -542,9 +539,9 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 7, 1, - 68, 2> + static const ::google::protobuf::internal::TcParseTable<3, 7, + 1, 68, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -554,13 +551,16 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Method& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Method& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr request_type_url_; @@ -568,12 +568,13 @@ class PROTOBUF_EXPORT Method final : public ::google::protobuf::Message bool request_streaming_; bool response_streaming_; int syntax_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Method_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message @@ -583,15 +584,14 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message ~Api() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Api* msg, std::destroying_delete_t) { + void operator delete(Api* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Api)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Api( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Api(::google::protobuf::internal::ConstantInitialized); inline Api(const Api& from) : Api(nullptr, from) {} inline Api(Api&& from) noexcept @@ -614,30 +614,27 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Api& default_instance() { - return *internal_default_instance(); - } - static inline const Api* internal_default_instance() { - return reinterpret_cast<const Api*>( + return *reinterpret_cast<const Api*>( &_Api_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(Api& a, Api& b) { a.Swap(&b); } - inline void Swap(Api* other) { + inline void Swap(Api* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -645,7 +642,7 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Api* other) { + void UnsafeArenaSwap(Api* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -653,7 +650,7 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Api* New(::google::protobuf::Arena* arena = nullptr) const { + Api* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Api>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -662,9 +659,8 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message void MergeFrom(const Api& from) { Api::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -674,49 +670,51 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Api* other); + void InternalSwap(Api* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Api"; } protected: - explicit Api(::google::protobuf::Arena* arena); - Api(::google::protobuf::Arena* arena, const Api& from); - Api(::google::protobuf::Arena* arena, Api&& from) noexcept + explicit Api(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Api(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Api& from); + Api( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Api&& from) noexcept : Api(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -737,15 +735,15 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message public: void clear_methods() ; - ::google::protobuf::Method* mutable_methods(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* mutable_methods(); + ::google::protobuf::Method* PROTOBUF_NONNULL mutable_methods(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* PROTOBUF_NONNULL mutable_methods(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>& _internal_methods() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* _internal_mutable_methods(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* PROTOBUF_NONNULL _internal_mutable_methods(); public: const ::google::protobuf::Method& methods(int index) const; - ::google::protobuf::Method* add_methods(); + ::google::protobuf::Method* PROTOBUF_NONNULL add_methods(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>& methods() const; // repeated .google.protobuf.Option options = 3; int options_size() const; @@ -754,15 +752,15 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message public: void clear_options() ; - ::google::protobuf::Option* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* mutable_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL mutable_options(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* _internal_mutable_options(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL _internal_mutable_options(); public: const ::google::protobuf::Option& options(int index) const; - ::google::protobuf::Option* add_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL add_options(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& options() const; // repeated .google.protobuf.Mixin mixins = 6; int mixins_size() const; @@ -771,30 +769,29 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message public: void clear_mixins() ; - ::google::protobuf::Mixin* mutable_mixins(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* mutable_mixins(); + ::google::protobuf::Mixin* PROTOBUF_NONNULL mutable_mixins(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* PROTOBUF_NONNULL mutable_mixins(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>& _internal_mixins() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* _internal_mutable_mixins(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* PROTOBUF_NONNULL _internal_mutable_mixins(); public: const ::google::protobuf::Mixin& mixins(int index) const; - ::google::protobuf::Mixin* add_mixins(); + ::google::protobuf::Mixin* PROTOBUF_NONNULL add_mixins(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>& mixins() const; // string name = 1; void clear_name() ; const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // string version = 4; @@ -802,30 +799,29 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message const std::string& version() const; template <typename Arg_ = const std::string&, typename... Args_> void set_version(Arg_&& arg, Args_... args); - std::string* mutable_version(); - PROTOBUF_NODISCARD std::string* release_version(); - void set_allocated_version(std::string* value); + std::string* PROTOBUF_NONNULL mutable_version(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_version(); + void set_allocated_version(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_version() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_version( - const std::string& value); - std::string* _internal_mutable_version(); + PROTOBUF_ALWAYS_INLINE void _internal_set_version(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_version(); public: // .google.protobuf.SourceContext source_context = 5; bool has_source_context() const; void clear_source_context() ; const ::google::protobuf::SourceContext& source_context() const; - PROTOBUF_NODISCARD ::google::protobuf::SourceContext* release_source_context(); - ::google::protobuf::SourceContext* mutable_source_context(); - void set_allocated_source_context(::google::protobuf::SourceContext* value); - void unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* value); - ::google::protobuf::SourceContext* unsafe_arena_release_source_context(); + [[nodiscard]] ::google::protobuf::SourceContext* PROTOBUF_NULLABLE release_source_context(); + ::google::protobuf::SourceContext* PROTOBUF_NONNULL mutable_source_context(); + void set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value); + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE unsafe_arena_release_source_context(); private: const ::google::protobuf::SourceContext& _internal_source_context() const; - ::google::protobuf::SourceContext* _internal_mutable_source_context(); + ::google::protobuf::SourceContext* PROTOBUF_NONNULL _internal_mutable_source_context(); public: // .google.protobuf.Syntax syntax = 7; @@ -842,9 +838,9 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 7, 4, - 39, 2> + static const ::google::protobuf::internal::TcParseTable<3, 7, + 4, 39, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -854,13 +850,14 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Api& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Api& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method > methods_; @@ -868,7 +865,7 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin > mixins_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr version_; - ::google::protobuf::SourceContext* source_context_; + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE source_context_; int syntax_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -876,6 +873,8 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Api_class_data_; + // =================================================================== @@ -896,6 +895,7 @@ class PROTOBUF_EXPORT Api final : public ::google::protobuf::Message inline void Api::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Api::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -903,13 +903,14 @@ inline const std::string& Api::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Api::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Api::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Api.name) } -inline std::string* Api::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Api::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name) return _s; @@ -920,19 +921,34 @@ inline const std::string& Api::_internal_name() const { } inline void Api::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* Api::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL Api::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* Api::release_name() { +inline std::string* PROTOBUF_NULLABLE Api::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Api.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void Api::set_allocated_name(std::string* value) { +inline void Api::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -951,12 +967,12 @@ inline void Api::clear_methods() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.methods_.Clear(); } -inline ::google::protobuf::Method* Api::mutable_methods(int index) +inline ::google::protobuf::Method* PROTOBUF_NONNULL Api::mutable_methods(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) return _internal_mutable_methods()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* Api::mutable_methods() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* PROTOBUF_NONNULL Api::mutable_methods() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -967,7 +983,8 @@ inline const ::google::protobuf::Method& Api::methods(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) return _internal_methods().Get(index); } -inline ::google::protobuf::Method* Api::add_methods() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Method* PROTOBUF_NONNULL Api::add_methods() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Method* _add = _internal_mutable_methods()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) @@ -983,7 +1000,7 @@ Api::_internal_methods() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.methods_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Method>* PROTOBUF_NONNULL Api::_internal_mutable_methods() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.methods_; @@ -996,12 +1013,12 @@ inline int Api::_internal_options_size() const { inline int Api::options_size() const { return _internal_options_size(); } -inline ::google::protobuf::Option* Api::mutable_options(int index) +inline ::google::protobuf::Option* PROTOBUF_NONNULL Api::mutable_options(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) return _internal_mutable_options()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* Api::mutable_options() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Api::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1012,7 +1029,8 @@ inline const ::google::protobuf::Option& Api::options(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Api.options) return _internal_options().Get(index); } -inline ::google::protobuf::Option* Api::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Option* PROTOBUF_NONNULL Api::add_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Option* _add = _internal_mutable_options()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Api.options) @@ -1028,7 +1046,7 @@ Api::_internal_options() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.options_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Api::_internal_mutable_options() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.options_; @@ -1038,6 +1056,7 @@ Api::_internal_mutable_options() { inline void Api::clear_version() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.version_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Api::version() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1045,13 +1064,14 @@ inline const std::string& Api::version() const return _internal_version(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Api::set_version(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Api::set_version(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.version_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Api.version) } -inline std::string* Api::mutable_version() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Api::mutable_version() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_version(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version) return _s; @@ -1062,19 +1082,34 @@ inline const std::string& Api::_internal_version() const { } inline void Api::_internal_set_version(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.version_.Set(value, GetArena()); } -inline std::string* Api::_internal_mutable_version() { +inline std::string* PROTOBUF_NONNULL Api::_internal_mutable_version() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.version_.Mutable( GetArena()); } -inline std::string* Api::release_version() { +inline std::string* PROTOBUF_NULLABLE Api::release_version() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Api.version) - return _impl_.version_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.version_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.version_.Set("", GetArena()); + } + return released; } -inline void Api::set_allocated_version(std::string* value) { +inline void Api::set_allocated_version(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.version_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.version_.IsDefault()) { _impl_.version_.Set("", GetArena()); @@ -1084,7 +1119,7 @@ inline void Api::set_allocated_version(std::string* value) { // .google.protobuf.SourceContext source_context = 5; inline bool Api::has_source_context() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; PROTOBUF_ASSUME(!value || _impl_.source_context_ != nullptr); return value; } @@ -1097,23 +1132,24 @@ inline const ::google::protobuf::SourceContext& Api::source_context() const ABSL // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) return _internal_source_context(); } -inline void Api::unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* value) { +inline void Api::unsafe_arena_set_allocated_source_context( + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.source_context_); } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.source_context) } -inline ::google::protobuf::SourceContext* Api::release_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NULLABLE Api::release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* released = _impl_.source_context_; _impl_.source_context_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -1129,16 +1165,16 @@ inline ::google::protobuf::SourceContext* Api::release_source_context() { } return released; } -inline ::google::protobuf::SourceContext* Api::unsafe_arena_release_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NULLABLE Api::unsafe_arena_release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; return temp; } -inline ::google::protobuf::SourceContext* Api::_internal_mutable_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NONNULL Api::_internal_mutable_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::SourceContext>(GetArena()); @@ -1146,13 +1182,14 @@ inline ::google::protobuf::SourceContext* Api::_internal_mutable_source_context( } return _impl_.source_context_; } -inline ::google::protobuf::SourceContext* Api::mutable_source_context() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; +inline ::google::protobuf::SourceContext* PROTOBUF_NONNULL Api::mutable_source_context() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + _impl_._has_bits_[0] |= 0x00000004u; ::google::protobuf::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) return _msg; } -inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* value) { +inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { @@ -1160,13 +1197,13 @@ inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); @@ -1184,12 +1221,12 @@ inline void Api::clear_mixins() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.mixins_.Clear(); } -inline ::google::protobuf::Mixin* Api::mutable_mixins(int index) +inline ::google::protobuf::Mixin* PROTOBUF_NONNULL Api::mutable_mixins(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins) return _internal_mutable_mixins()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* Api::mutable_mixins() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* PROTOBUF_NONNULL Api::mutable_mixins() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1200,7 +1237,8 @@ inline const ::google::protobuf::Mixin& Api::mixins(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins) return _internal_mixins().Get(index); } -inline ::google::protobuf::Mixin* Api::add_mixins() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Mixin* PROTOBUF_NONNULL Api::add_mixins() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Mixin* _add = _internal_mutable_mixins()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins) @@ -1216,7 +1254,7 @@ Api::_internal_mixins() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.mixins_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Mixin>* PROTOBUF_NONNULL Api::_internal_mutable_mixins() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.mixins_; @@ -1226,6 +1264,7 @@ Api::_internal_mutable_mixins() { inline void Api::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000008u; } inline ::google::protobuf::Syntax Api::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax) @@ -1233,6 +1272,7 @@ inline ::google::protobuf::Syntax Api::syntax() const { } inline void Api::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) } inline ::google::protobuf::Syntax Api::_internal_syntax() const { @@ -1252,6 +1292,7 @@ inline void Api::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Method::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Method::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1259,13 +1300,14 @@ inline const std::string& Method::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Method::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Method::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Method.name) } -inline std::string* Method::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Method::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name) return _s; @@ -1276,19 +1318,34 @@ inline const std::string& Method::_internal_name() const { } inline void Method::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* Method::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL Method::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* Method::release_name() { +inline std::string* PROTOBUF_NULLABLE Method::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Method.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void Method::set_allocated_name(std::string* value) { +inline void Method::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -1300,6 +1357,7 @@ inline void Method::set_allocated_name(std::string* value) { inline void Method::clear_request_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.request_type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Method::request_type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1307,13 +1365,14 @@ inline const std::string& Method::request_type_url() const return _internal_request_type_url(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Method::set_request_type_url(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Method::set_request_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.request_type_url_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url) } -inline std::string* Method::mutable_request_type_url() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Method::mutable_request_type_url() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_request_type_url(); // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url) return _s; @@ -1324,19 +1383,34 @@ inline const std::string& Method::_internal_request_type_url() const { } inline void Method::_internal_set_request_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.request_type_url_.Set(value, GetArena()); } -inline std::string* Method::_internal_mutable_request_type_url() { +inline std::string* PROTOBUF_NONNULL Method::_internal_mutable_request_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.request_type_url_.Mutable( GetArena()); } -inline std::string* Method::release_request_type_url() { +inline std::string* PROTOBUF_NULLABLE Method::release_request_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url) - return _impl_.request_type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.request_type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.request_type_url_.Set("", GetArena()); + } + return released; } -inline void Method::set_allocated_request_type_url(std::string* value) { +inline void Method::set_allocated_request_type_url(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.request_type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.request_type_url_.IsDefault()) { _impl_.request_type_url_.Set("", GetArena()); @@ -1348,6 +1422,7 @@ inline void Method::set_allocated_request_type_url(std::string* value) { inline void Method::clear_request_streaming() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.request_streaming_ = false; + _impl_._has_bits_[0] &= ~0x00000008u; } inline bool Method::request_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming) @@ -1355,6 +1430,7 @@ inline bool Method::request_streaming() const { } inline void Method::set_request_streaming(bool value) { _internal_set_request_streaming(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming) } inline bool Method::_internal_request_streaming() const { @@ -1370,6 +1446,7 @@ inline void Method::_internal_set_request_streaming(bool value) { inline void Method::clear_response_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.response_type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000004u; } inline const std::string& Method::response_type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1377,13 +1454,14 @@ inline const std::string& Method::response_type_url() const return _internal_response_type_url(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Method::set_response_type_url(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Method::set_response_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.response_type_url_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url) } -inline std::string* Method::mutable_response_type_url() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Method::mutable_response_type_url() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_response_type_url(); // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url) return _s; @@ -1394,19 +1472,34 @@ inline const std::string& Method::_internal_response_type_url() const { } inline void Method::_internal_set_response_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.response_type_url_.Set(value, GetArena()); } -inline std::string* Method::_internal_mutable_response_type_url() { +inline std::string* PROTOBUF_NONNULL Method::_internal_mutable_response_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; return _impl_.response_type_url_.Mutable( GetArena()); } -inline std::string* Method::release_response_type_url() { +inline std::string* PROTOBUF_NULLABLE Method::release_response_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url) - return _impl_.response_type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000004u; + auto* released = _impl_.response_type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.response_type_url_.Set("", GetArena()); + } + return released; } -inline void Method::set_allocated_response_type_url(std::string* value) { +inline void Method::set_allocated_response_type_url(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } _impl_.response_type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.response_type_url_.IsDefault()) { _impl_.response_type_url_.Set("", GetArena()); @@ -1418,6 +1511,7 @@ inline void Method::set_allocated_response_type_url(std::string* value) { inline void Method::clear_response_streaming() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.response_streaming_ = false; + _impl_._has_bits_[0] &= ~0x00000010u; } inline bool Method::response_streaming() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming) @@ -1425,6 +1519,7 @@ inline bool Method::response_streaming() const { } inline void Method::set_response_streaming(bool value) { _internal_set_response_streaming(value); + _impl_._has_bits_[0] |= 0x00000010u; // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming) } inline bool Method::_internal_response_streaming() const { @@ -1443,12 +1538,12 @@ inline int Method::_internal_options_size() const { inline int Method::options_size() const { return _internal_options_size(); } -inline ::google::protobuf::Option* Method::mutable_options(int index) +inline ::google::protobuf::Option* PROTOBUF_NONNULL Method::mutable_options(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) return _internal_mutable_options()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* Method::mutable_options() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Method::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1459,7 +1554,8 @@ inline const ::google::protobuf::Option& Method::options(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Method.options) return _internal_options().Get(index); } -inline ::google::protobuf::Option* Method::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Option* PROTOBUF_NONNULL Method::add_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Option* _add = _internal_mutable_options()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Method.options) @@ -1475,7 +1571,7 @@ Method::_internal_options() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.options_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Method::_internal_mutable_options() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.options_; @@ -1485,6 +1581,7 @@ Method::_internal_mutable_options() { inline void Method::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000020u; } inline ::google::protobuf::Syntax Method::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax) @@ -1492,6 +1589,7 @@ inline ::google::protobuf::Syntax Method::syntax() const { } inline void Method::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000020u; // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) } inline ::google::protobuf::Syntax Method::_internal_syntax() const { @@ -1511,6 +1609,7 @@ inline void Method::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Mixin::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Mixin::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1518,13 +1617,14 @@ inline const std::string& Mixin::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Mixin::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Mixin::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name) } -inline std::string* Mixin::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Mixin::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.name) return _s; @@ -1535,19 +1635,34 @@ inline const std::string& Mixin::_internal_name() const { } inline void Mixin::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* Mixin::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL Mixin::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* Mixin::release_name() { +inline std::string* PROTOBUF_NULLABLE Mixin::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void Mixin::set_allocated_name(std::string* value) { +inline void Mixin::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -1559,6 +1674,7 @@ inline void Mixin::set_allocated_name(std::string* value) { inline void Mixin::clear_root() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.root_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Mixin::root() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1566,13 +1682,14 @@ inline const std::string& Mixin::root() const return _internal_root(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Mixin::set_root(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Mixin::set_root(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.root_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root) } -inline std::string* Mixin::mutable_root() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Mixin::mutable_root() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_root(); // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.root) return _s; @@ -1583,19 +1700,34 @@ inline const std::string& Mixin::_internal_root() const { } inline void Mixin::_internal_set_root(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.root_.Set(value, GetArena()); } -inline std::string* Mixin::_internal_mutable_root() { +inline std::string* PROTOBUF_NONNULL Mixin::_internal_mutable_root() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.root_.Mutable( GetArena()); } -inline std::string* Mixin::release_root() { +inline std::string* PROTOBUF_NULLABLE Mixin::release_root() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root) - return _impl_.root_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.root_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.root_.Set("", GetArena()); + } + return released; } -inline void Mixin::set_allocated_root(std::string* value) { +inline void Mixin::set_allocated_root(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.root_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.root_.IsDefault()) { _impl_.root_.Set("", GetArena()); diff --git a/third_party/protobuf/src/google/protobuf/arena.cc b/third_party/protobuf/src/google/protobuf/arena.cc index 55d87ab6bbf9f..a8672d96d7329 100644 --- a/third_party/protobuf/src/google/protobuf/arena.cc +++ b/third_party/protobuf/src/google/protobuf/arena.cc @@ -16,6 +16,8 @@ #include <vector> #include "absl/base/attributes.h" +#include "absl/base/dynamic_annotations.h" +#include "absl/base/optimization.h" #include "absl/base/prefetch.h" #include "absl/container/internal/layout.h" #include "absl/log/absl_check.h" @@ -336,7 +338,7 @@ void SerialArena::AllocateNewBlock(size_t n) { // Previous writes must take effect before writing new head. head_.store(new_head, std::memory_order_release); - PROTOBUF_POISON_MEMORY_REGION(ptr(), limit_ - ptr()); + internal::PoisonMemoryRegion(ptr(), limit_ - ptr()); } uint64_t SerialArena::SpaceUsed() const { @@ -507,7 +509,8 @@ class ThreadSafeArena::SerialArenaChunk { constexpr static int kArenas = 2; using layout_type = absl::container_internal::Layout< - SerialArenaChunkHeader, std::atomic<void*>, std::atomic<SerialArena*>>; + SerialArenaChunkHeader, std::atomic<void*>, + std::atomic<SerialArena*>>::WithStaticSizes</*header*/ 1>; const char* ptr() const { return reinterpret_cast<const char*>(this); } char* ptr() { return reinterpret_cast<char*>(this); } @@ -529,7 +532,7 @@ class ThreadSafeArena::SerialArenaChunk { } constexpr static layout_type Layout(size_t n) { - return layout_type(/*header*/ 1, /*ids*/ n, /*arenas*/ n); + return layout_type(/*ids*/ n, /*arenas*/ n); } layout_type Layout() const { return Layout(capacity()); } }; @@ -583,6 +586,16 @@ ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size) { return SentryArenaBlock(); } // Record user-owned block. + + if constexpr (internal::PerformDebugChecks()) { + // Touch block to verify it is addressable. + if (size > 0) { + static_cast<char*>(buf)[0] = 0; + static_cast<char*>(buf)[size - 1] = 0; + } + } + + ABSL_ANNOTATE_MEMORY_IS_UNINITIALIZED(buf, size); alloc_policy_.set_is_user_owned_initial_block(true); return new (buf) ArenaBlock{nullptr, size}; } @@ -599,6 +612,14 @@ ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size, } else { mem = {buf, size}; // Record user-owned block. + if constexpr (internal::PerformDebugChecks()) { + // Touch block to verify it is addressable. + if (size > 0) { + static_cast<char*>(buf)[0] = 0; + static_cast<char*>(buf)[size - 1] = 0; + } + } + ABSL_ANNOTATE_MEMORY_IS_UNINITIALIZED(buf, size); alloc_policy_.set_is_user_owned_initial_block(true); } @@ -639,7 +660,7 @@ uint64_t ThreadSafeArena::GetNextLifeCycleId() { ThreadCache& tc = thread_cache(); uint64_t id = tc.next_lifecycle_id; constexpr uint64_t kInc = ThreadCache::kPerThreadIds; - if (PROTOBUF_PREDICT_FALSE((id & (kInc - 1)) == 0)) { + if (ABSL_PREDICT_FALSE((id & (kInc - 1)) == 0)) { // On platforms that don't support uint64_t atomics we can certainly not // afford to increment by large intervals and expect uniqueness due to // wrapping, hence we only add by 1. @@ -711,7 +732,7 @@ void ThreadSafeArena::UnpoisonAllArenaBlocks() const { VisitSerialArena([](const SerialArena* serial) { for (const auto* b = serial->head(); b != nullptr && !b->IsSentry(); b = b->next) { - PROTOBUF_UNPOISON_MEMORY_REGION(b, b->size); + internal::UnpoisonMemoryRegion(b, b->size); } }); } @@ -741,7 +762,7 @@ ThreadSafeArena::~ThreadSafeArena() { auto mem = Free(); if (alloc_policy_.is_user_owned_initial_block()) { // Unpoison the initial block, now that it's going back to the user. - PROTOBUF_UNPOISON_MEMORY_REGION(mem.p, mem.n); + internal::UnpoisonMemoryRegion(mem.p, mem.n); } else if (mem.n > 0) { GetDeallocator(alloc_policy_.get())(mem); } @@ -794,6 +815,8 @@ uint64_t ThreadSafeArena::Reset() { size_t offset = alloc_policy_.get() == nullptr ? kBlockHeaderSize : kBlockHeaderSize + kAllocPolicySize; + ABSL_ANNOTATE_MEMORY_IS_UNINITIALIZED(static_cast<char*>(mem.p) + offset, + mem.n - offset); first_arena_.Init(new (mem.p) ArenaBlock{nullptr, mem.n}, offset); } else { first_arena_.Init(SentryArenaBlock(), 0); @@ -809,7 +832,7 @@ uint64_t ThreadSafeArena::Reset() { void* ThreadSafeArena::AllocateAlignedWithCleanup(size_t n, size_t align, void (*destructor)(void*)) { SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + if (ABSL_PREDICT_TRUE(GetSerialArenaFast(&arena))) { return arena->AllocateAlignedWithCleanup(n, align, destructor); } else { return AllocateAlignedWithCleanupFallback(n, align, destructor); @@ -822,7 +845,7 @@ void ThreadSafeArena::AddCleanup(void* elem, void (*cleanup)(void*)) { SerialArena* ThreadSafeArena::GetSerialArena() { SerialArena* arena; - if (PROTOBUF_PREDICT_FALSE(!GetSerialArenaFast(&arena))) { + if (ABSL_PREDICT_FALSE(!GetSerialArenaFast(&arena))) { arena = GetSerialArenaFallback(kMaxCleanupNodeSize); } return arena; @@ -915,9 +938,9 @@ template void* ThreadSafeArena::AllocateAlignedFallback<AllocationClient::kArray>(size_t); void ThreadSafeArena::CleanupList() { -#ifdef PROTOBUF_ASAN - UnpoisonAllArenaBlocks(); -#endif + if constexpr (HasMemoryPoisoning()) { + UnpoisonAllArenaBlocks(); + } WalkSerialArenaChunk([](SerialArenaChunk* chunk) { absl::Span<std::atomic<SerialArena*>> span = chunk->arenas(); diff --git a/third_party/protobuf/src/google/protobuf/arena.h b/third_party/protobuf/src/google/protobuf/arena.h index 55b1ec83bd06f..0409e585a3d8a 100644 --- a/third_party/protobuf/src/google/protobuf/arena.h +++ b/third_party/protobuf/src/google/protobuf/arena.h @@ -59,12 +59,6 @@ struct RepeatedFieldBase; class ExtensionSet; } // namespace internal -namespace arena_metrics { - -void EnableArenaMetrics(ArenaOptions* options); - -} // namespace arena_metrics - namespace TestUtil { class ReflectionTester; // defined in test_util.h } // namespace TestUtil @@ -196,19 +190,6 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { inline ~Arena() = default; -#ifndef PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE - // Deprecated. Use Create<T> instead. - template <typename T, typename... Args> - ABSL_DEPRECATED("Use Create") - static T* CreateMessage(Arena* arena, Args&&... args) { - using Type = std::remove_const_t<T>; - static_assert( - is_arena_constructable<Type>::value, - "CreateMessage can only construct types that are ArenaConstructable"); - return Create<Type>(arena, std::forward<Args>(args)...); - } -#endif // !PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE - // Allocates an object type T if the arena passed in is not nullptr; // otherwise, returns a heap-allocated object. template <typename T, typename... Args> @@ -279,7 +260,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { "CreateArray requires a trivially destructible type"); ABSL_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T)) << "Requested size is too large to fit into size_t."; - if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { + if (ABSL_PREDICT_FALSE(arena == nullptr)) { return new T[num_elements]; } else { // We count on compiler to realize that if sizeof(T) is a multiple of @@ -347,18 +328,6 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { impl_.AddCleanup(object, destruct); } - // Retrieves the arena associated with |value| if |value| is an arena-capable - // message, or nullptr otherwise. If possible, the call resolves at compile - // time. Note that we can often devirtualize calls to `value->GetArena()` so - // usually calling this method is unnecessary. - // TODO: remove this function. - template <typename T> - ABSL_DEPRECATED( - "This will be removed in a future release. Call value->GetArena() " - "instead.") - PROTOBUF_ALWAYS_INLINE static Arena* GetArena(T* value) { - return GetArenaInternal(value); - } template <typename T> class InternalHelper { @@ -447,9 +416,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { return new (ptr) T(static_cast<Args&&>(args)...); } - static inline PROTOBUF_ALWAYS_INLINE T* New() { - return new T(nullptr); - } + static PROTOBUF_ALWAYS_INLINE T* New() { return new T(nullptr); } friend class Arena; friend class TestUtil::ReflectionTester; @@ -522,7 +489,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { Args&&... args) { static_assert(is_arena_constructable<T>::value, "Can only construct types that are ArenaConstructable"); - if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { + if (ABSL_PREDICT_FALSE(arena == nullptr)) { return new T(nullptr, static_cast<Args&&>(args)...); } else { return arena->DoCreateMessage<T>(static_cast<Args&&>(args)...); @@ -536,7 +503,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { PROTOBUF_NDEBUG_INLINE static T* CreateArenaCompatible(Arena* arena) { static_assert(is_arena_constructable<T>::value, "Can only construct types that are ArenaConstructable"); - if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { + if (ABSL_PREDICT_FALSE(arena == nullptr)) { // Generated arena constructor T(Arena*) is protected. Call via // InternalHelper. return InternalHelper<T>::New(); @@ -585,31 +552,17 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { // which needs to declare Map as friend of generated message. template <typename T, typename... Args> static void CreateInArenaStorage(T* ptr, Arena* arena, Args&&... args) { - CreateInArenaStorageInternal(ptr, arena, is_arena_constructable<T>(), - std::forward<Args>(args)...); - if (PROTOBUF_PREDICT_TRUE(arena != nullptr)) { - RegisterDestructorInternal(ptr, arena, is_destructor_skippable<T>()); + if constexpr (is_arena_constructable<T>::value) { + InternalHelper<T>::Construct(ptr, arena, std::forward<Args>(args)...); + } else { + new (ptr) T(std::forward<Args>(args)...); } - } - template <typename T, typename... Args> - static void CreateInArenaStorageInternal(T* ptr, Arena* arena, - std::true_type, Args&&... args) { - InternalHelper<T>::Construct(ptr, arena, std::forward<Args>(args)...); - } - template <typename T, typename... Args> - static void CreateInArenaStorageInternal(T* ptr, Arena* /* arena */, - std::false_type, Args&&... args) { - new (ptr) T(std::forward<Args>(args)...); - } - - template <typename T> - static void RegisterDestructorInternal(T* /* ptr */, Arena* /* arena */, - std::true_type) {} - template <typename T> - static void RegisterDestructorInternal(T* ptr, Arena* arena, - std::false_type) { - arena->OwnDestructor(ptr); + if constexpr (!is_destructor_skippable<T>::value) { + if (ABSL_PREDICT_TRUE(arena != nullptr)) { + arena->OwnDestructor(ptr); + } + } } // Implementation for GetArena(). Only message objects with diff --git a/third_party/protobuf/src/google/protobuf/arena_align.h b/third_party/protobuf/src/google/protobuf/arena_align.h index 991392438e867..6aca16720f923 100644 --- a/third_party/protobuf/src/google/protobuf/arena_align.h +++ b/third_party/protobuf/src/google/protobuf/arena_align.h @@ -72,37 +72,37 @@ struct ArenaAlignDefault { static constexpr bool IsAligned(size_t n) { return (n & (align - 1)) == 0U; } template <typename T> - static inline PROTOBUF_ALWAYS_INLINE bool IsAligned(T* ptr) { + static PROTOBUF_ALWAYS_INLINE bool IsAligned(T* ptr) { return (reinterpret_cast<uintptr_t>(ptr) & (align - 1)) == 0U; } - static inline PROTOBUF_ALWAYS_INLINE constexpr size_t Ceil(size_t n) { + static PROTOBUF_ALWAYS_INLINE constexpr size_t Ceil(size_t n) { return (n + align - 1) & ~(align - 1); } - static inline PROTOBUF_ALWAYS_INLINE constexpr size_t Floor(size_t n) { + static PROTOBUF_ALWAYS_INLINE constexpr size_t Floor(size_t n) { return (n & ~(align - 1)); } - static inline PROTOBUF_ALWAYS_INLINE size_t Padded(size_t n) { + static PROTOBUF_ALWAYS_INLINE size_t Padded(size_t n) { ABSL_ASSERT(IsAligned(n)); return n; } template <typename T> - static inline PROTOBUF_ALWAYS_INLINE T* Ceil(T* ptr) { + static PROTOBUF_ALWAYS_INLINE T* Ceil(T* ptr) { uintptr_t intptr = reinterpret_cast<uintptr_t>(ptr); return reinterpret_cast<T*>((intptr + align - 1) & ~(align - 1)); } template <typename T> - static inline PROTOBUF_ALWAYS_INLINE T* CeilDefaultAligned(T* ptr) { + static PROTOBUF_ALWAYS_INLINE T* CeilDefaultAligned(T* ptr) { ABSL_ASSERT(IsAligned(ptr)); return ptr; } // Address sanitizer enabled alignment check template <typename T> - static inline PROTOBUF_ALWAYS_INLINE T* CheckAligned(T* ptr) { + static PROTOBUF_ALWAYS_INLINE T* CheckAligned(T* ptr) { ABSL_ASSERT(IsAligned(ptr)); return ptr; } diff --git a/third_party/protobuf/src/google/protobuf/arena_cleanup.h b/third_party/protobuf/src/google/protobuf/arena_cleanup.h index a153e36667f65..094e8adca239d 100644 --- a/third_party/protobuf/src/google/protobuf/arena_cleanup.h +++ b/third_party/protobuf/src/google/protobuf/arena_cleanup.h @@ -13,6 +13,7 @@ #include <vector> #include "absl/base/attributes.h" +#include "absl/base/optimization.h" #include "absl/base/prefetch.h" // Must be included last. @@ -60,7 +61,7 @@ class ChunkList { public: PROTOBUF_ALWAYS_INLINE void Add(void* elem, void (*destructor)(void*), SerialArena& arena) { - if (PROTOBUF_PREDICT_TRUE(next_ < limit_)) { + if (ABSL_PREDICT_TRUE(next_ < limit_)) { AddFromExisting(elem, destructor); return; } diff --git a/third_party/protobuf/src/google/protobuf/arena_unittest.cc b/third_party/protobuf/src/google/protobuf/arena_unittest.cc index 7fe39ed8ae048..0693fdca25eb0 100644 --- a/third_party/protobuf/src/google/protobuf/arena_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/arena_unittest.cc @@ -53,12 +53,12 @@ #include "google/protobuf/port_def.inc" using proto2_arena_unittest::ArenaMessage; -using protobuf_unittest::NestedTestAllTypes; -using protobuf_unittest::TestAllExtensions; -using protobuf_unittest::TestAllTypes; -using protobuf_unittest::TestEmptyMessage; -using protobuf_unittest::TestOneof2; -using protobuf_unittest::TestRepeatedString; +using proto2_unittest::NestedTestAllTypes; +using proto2_unittest::TestAllExtensions; +using proto2_unittest::TestAllTypes; +using proto2_unittest::TestEmptyMessage; +using proto2_unittest::TestOneof2; +using proto2_unittest::TestRepeatedString; using ::testing::ElementsAreArray; namespace google { @@ -1410,11 +1410,11 @@ TEST(ArenaTest, ExtensionsOnArena) { Arena arena; // Ensure no leaks. TestAllExtensions* message_ext = Arena::Create<TestAllExtensions>(&arena); - message_ext->SetExtension(protobuf_unittest::optional_int32_extension, 42); - message_ext->SetExtension(protobuf_unittest::optional_string_extension, + message_ext->SetExtension(proto2_unittest::optional_int32_extension, 42); + message_ext->SetExtension(proto2_unittest::optional_string_extension, std::string("test")); message_ext - ->MutableExtension(protobuf_unittest::optional_nested_message_extension) + ->MutableExtension(proto2_unittest::optional_nested_message_extension) ->set_bb(42); } @@ -1539,13 +1539,13 @@ TEST(ArenaTest, ClearOneofMessageOnArena) { child->set_moo_int(100); message->clear_foo_message(); -#ifndef PROTOBUF_ASAN - EXPECT_NE(child->moo_int(), 100); -#else -#if GTEST_HAS_DEATH_TEST && defined(__cpp_if_constexpr) - EXPECT_DEATH(EXPECT_EQ(child->moo_int(), 0), "use-after-poison"); -#endif -#endif + if (internal::HasMemoryPoisoning()) { +#if GTEST_HAS_DEATH_TEST + EXPECT_DEATH(EXPECT_EQ(child->moo_int(), 0), "use-after-poison"); +#endif // !GTEST_HAS_DEATH_TEST + } else { + EXPECT_NE(child->moo_int(), 100); + } } TEST(ArenaTest, CopyValuesWithinOneof) { @@ -1840,7 +1840,10 @@ TEST(ArenaTest, SpaceReuseForArraysSizeChecks) { } TEST(ArenaTest, SpaceReusePoisonsAndUnpoisonsMemory) { -#ifdef PROTOBUF_ASAN + if constexpr (!internal::HasMemoryPoisoning()) { + GTEST_SKIP() << "Memory poisoning not enabled."; + } + char buf[1024]{}; constexpr int kSize = 32; { @@ -1849,19 +1852,21 @@ TEST(ArenaTest, SpaceReusePoisonsAndUnpoisonsMemory) { for (int i = 0; i < 100; ++i) { void* p = Arena::CreateArray<char>(&arena, kSize); // Simulate other ASan client managing shadow memory. - ASAN_POISON_MEMORY_REGION(p, kSize); - ASAN_UNPOISON_MEMORY_REGION(p, kSize - 4); + internal::PoisonMemoryRegion(p, kSize); + internal::UnpoisonMemoryRegion(p, kSize - 4); pointers.push_back(p); } for (void* p : pointers) { internal::ArenaTestPeer::ReturnArrayMemory(&arena, p, kSize); // The first one is not poisoned because it becomes the freelist. - if (p != pointers[0]) EXPECT_TRUE(__asan_address_is_poisoned(p)); + if (p != pointers[0]) { + EXPECT_TRUE(internal::IsMemoryPoisoned(p)); + } } bool found_poison = false; for (char& c : buf) { - if (__asan_address_is_poisoned(&c)) { + if (internal::IsMemoryPoisoned(&c)) { found_poison = true; break; } @@ -1871,12 +1876,8 @@ TEST(ArenaTest, SpaceReusePoisonsAndUnpoisonsMemory) { // Should not be poisoned after destruction. for (char& c : buf) { - ASSERT_FALSE(__asan_address_is_poisoned(&c)); + ASSERT_FALSE(internal::IsMemoryPoisoned(&c)); } - -#else // PROTOBUF_ASAN - GTEST_SKIP(); -#endif // PROTOBUF_ASAN } diff --git a/third_party/protobuf/src/google/protobuf/arenastring.cc b/third_party/protobuf/src/google/protobuf/arenastring.cc index 0ccacfbc8d0d1..0488131cf7c69 100644 --- a/third_party/protobuf/src/google/protobuf/arenastring.cc +++ b/third_party/protobuf/src/google/protobuf/arenastring.cc @@ -9,12 +9,14 @@ #include <cstddef> +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/parse_context.h" +#include "google/protobuf/port.h" // clang-format off #include "google/protobuf/port_def.inc" @@ -42,7 +44,7 @@ constexpr size_t kNewAlign = alignof(std::max_align_t); constexpr size_t kStringAlign = alignof(std::string); static_assert((kStringAlign > kNewAlign ? kStringAlign : kNewAlign) >= 4, ""); -static_assert(alignof(ExplicitlyConstructedArenaString) >= 4, ""); +static_assert(alignof(GlobalEmptyString) >= 4, ""); } // namespace diff --git a/third_party/protobuf/src/google/protobuf/arenastring.h b/third_party/protobuf/src/google/protobuf/arenastring.h index 7758760ae0d9e..fa608c6ec3d73 100644 --- a/third_party/protobuf/src/google/protobuf/arenastring.h +++ b/third_party/protobuf/src/google/protobuf/arenastring.h @@ -35,10 +35,6 @@ class EpsCopyInputStream; class SwapFieldHelper; -// Declared in message_lite.h -PROTOBUF_EXPORT extern ExplicitlyConstructedArenaString - fixed_address_empty_string; - // Lazy string instance to support string fields with non-empty default. // These are initialized on the first call to .get(). class PROTOBUF_EXPORT LazyString { @@ -62,7 +58,7 @@ class PROTOBUF_EXPORT LazyString { const std::string& get() const { // This check generates less code than a call-once invocation. auto* res = inited_.load(std::memory_order_acquire); - if (PROTOBUF_PREDICT_FALSE(res == nullptr)) return Init(); + if (ABSL_PREDICT_FALSE(res == nullptr)) return Init(); return *res; } @@ -107,8 +103,8 @@ class PROTOBUF_EXPORT TaggedStringPtr { }; TaggedStringPtr() = default; - explicit constexpr TaggedStringPtr(ExplicitlyConstructedArenaString* ptr) - : ptr_(ptr) {} + explicit constexpr TaggedStringPtr(const GlobalEmptyString* ptr) + : ptr_(const_cast<void*>(static_cast<const void*>(ptr))) {} // Sets the value to `p`, tagging the value as being a 'default' value. // See documentation for kDefault for more info. @@ -231,7 +227,7 @@ struct PROTOBUF_EXPORT ArenaStringPtr { ArenaStringPtr() = default; // Constexpr constructor, initializes to a constexpr, empty string value. - constexpr ArenaStringPtr(ExplicitlyConstructedArenaString* default_value, + constexpr ArenaStringPtr(const GlobalEmptyString* default_value, ConstantInitialized) : tagged_ptr_(default_value) {} @@ -348,7 +344,7 @@ struct PROTOBUF_EXPORT ArenaStringPtr { // Own()'d by any arena. If the field is not set, this returns nullptr. The // caller retains ownership. Clears this field back to the default state. // Used to implement release_<field>() methods on generated classes. - PROTOBUF_NODISCARD std::string* Release(); + [[nodiscard]] std::string* Release(); // Takes a std::string that is heap-allocated, and takes ownership. The // std::string's destructor is registered with the arena. Used to implement @@ -376,9 +372,9 @@ struct PROTOBUF_EXPORT ArenaStringPtr { // Swaps internal pointers. Arena-safety semantics: this is guarded by the // logic in Swap()/UnsafeArenaSwap() at the message level, so this method is // 'unsafe' if called directly. - inline PROTOBUF_NDEBUG_INLINE static void InternalSwap(ArenaStringPtr* rhs, - ArenaStringPtr* lhs, - Arena* arena); + PROTOBUF_NDEBUG_INLINE static void InternalSwap(ArenaStringPtr* rhs, + ArenaStringPtr* lhs, + Arena* arena); // Internal setter used only at parse time to directly set a donated string // value. @@ -409,8 +405,8 @@ struct PROTOBUF_EXPORT ArenaStringPtr { // Swaps tagged pointer without debug hardening. This is to allow python // protobuf to maintain pointer stability even in DEBUG builds. - inline PROTOBUF_NDEBUG_INLINE static void UnsafeShallowSwap( - ArenaStringPtr* rhs, ArenaStringPtr* lhs) { + PROTOBUF_NDEBUG_INLINE static void UnsafeShallowSwap(ArenaStringPtr* rhs, + ArenaStringPtr* lhs) { std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); } @@ -498,8 +494,9 @@ inline void ArenaStringPtr::SetBytes(const void* p, size_t n, Arena* arena) { Set(absl::string_view{static_cast<const char*>(p), n}, arena); } -inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( - ArenaStringPtr* rhs, ArenaStringPtr* lhs, Arena* arena) { +PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap(ArenaStringPtr* rhs, + ArenaStringPtr* lhs, + Arena* arena) { // Silence unused variable warnings in release buildls. (void)arena; std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); @@ -523,6 +520,7 @@ inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( inline void ArenaStringPtr::ClearNonDefaultToEmpty() { // Unconditionally mask away the tag. + ABSL_DCHECK(!tagged_ptr_.IsDefault()); tagged_ptr_.Get()->clear(); } diff --git a/third_party/protobuf/src/google/protobuf/arenastring_unittest.cc b/third_party/protobuf/src/google/protobuf/arenastring_unittest.cc index 01def5611a5b2..f2a5947b591cb 100644 --- a/third_party/protobuf/src/google/protobuf/arenastring_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/arenastring_unittest.cc @@ -90,16 +90,11 @@ TEST_P(SingleArena, NullDefault) { } TEST(ArenaStringPtrTest, ConstInit) { - // Verify that we can constinit construct an ArenaStringPtr from an arbitrary - // ExplicitlyConstructed<std::string>*. - static internal::ExplicitlyConstructedArenaString str; - PROTOBUF_CONSTINIT static ArenaStringPtr ptr(&str, - internal::ConstantInitialized{}); - EXPECT_EQ(&ptr.Get(), str.get_mutable()); - - PROTOBUF_CONSTINIT static const ArenaStringPtr ptr2( + // Verify that we can constinit construct an ArenaStringPtr from the global + // string. + PROTOBUF_CONSTINIT static const ArenaStringPtr ptr( &internal::fixed_address_empty_string, internal::ConstantInitialized{}); - EXPECT_EQ(&ptr2.Get(), &internal::GetEmptyStringAlreadyInited()); + EXPECT_EQ(&ptr.Get(), &internal::GetEmptyStringAlreadyInited()); } TEST_P(SingleArena, ConstructEmpty) { diff --git a/third_party/protobuf/src/google/protobuf/arenaz_sampler.cc b/third_party/protobuf/src/google/protobuf/arenaz_sampler.cc index c5b126bb4a335..6fb92d4968f4d 100644 --- a/third_party/protobuf/src/google/protobuf/arenaz_sampler.cc +++ b/third_party/protobuf/src/google/protobuf/arenaz_sampler.cc @@ -12,6 +12,8 @@ #include <limits> #include <utility> +#include "absl/base/optimization.h" + // Must be included last. #include "google/protobuf/port_def.inc" @@ -129,7 +131,7 @@ ThreadSafeArenaStats* SampleSlow(SamplingState& sampling_state) { // We will only be negative on our first count, so we should just retry in // that case. if (first) { - if (PROTOBUF_PREDICT_TRUE(--sampling_state.next_sample > 0)) return nullptr; + if (ABSL_PREDICT_TRUE(--sampling_state.next_sample > 0)) return nullptr; return SampleSlow(sampling_state); } diff --git a/third_party/protobuf/src/google/protobuf/arenaz_sampler.h b/third_party/protobuf/src/google/protobuf/arenaz_sampler.h index f75659975ac48..53a073b31d800 100644 --- a/third_party/protobuf/src/google/protobuf/arenaz_sampler.h +++ b/third_party/protobuf/src/google/protobuf/arenaz_sampler.h @@ -84,7 +84,7 @@ struct ThreadSafeArenaStats void* stack[kMaxStackDepth]; static void RecordAllocateStats(ThreadSafeArenaStats* info, size_t used, size_t allocated, size_t wasted) { - if (PROTOBUF_PREDICT_TRUE(info == nullptr)) return; + if (ABSL_PREDICT_TRUE(info == nullptr)) return; RecordAllocateSlow(info, used, allocated, wasted); } @@ -117,7 +117,7 @@ class ThreadSafeArenaStatsHandle { : info_(info) {} ~ThreadSafeArenaStatsHandle() { - if (PROTOBUF_PREDICT_TRUE(info_ == nullptr)) return; + if (ABSL_PREDICT_TRUE(info_ == nullptr)) return; UnsampleSlow(info_); } @@ -126,7 +126,7 @@ class ThreadSafeArenaStatsHandle { ThreadSafeArenaStatsHandle& operator=( ThreadSafeArenaStatsHandle&& other) noexcept { - if (PROTOBUF_PREDICT_FALSE(info_ != nullptr)) { + if (ABSL_PREDICT_FALSE(info_ != nullptr)) { UnsampleSlow(info_); } info_ = std::exchange(other.info_, nullptr); @@ -154,7 +154,7 @@ extern PROTOBUF_THREAD_LOCAL SamplingState global_sampling_state; // Returns an RAII sampling handle that manages registration and unregistation // with the global sampler. inline ThreadSafeArenaStatsHandle Sample() { - if (PROTOBUF_PREDICT_TRUE(--global_sampling_state.next_sample > 0)) { + if (ABSL_PREDICT_TRUE(--global_sampling_state.next_sample > 0)) { return ThreadSafeArenaStatsHandle(nullptr); } return ThreadSafeArenaStatsHandle(SampleSlow(global_sampling_state)); diff --git a/third_party/protobuf/src/google/protobuf/arenaz_sampler_test.cc b/third_party/protobuf/src/google/protobuf/arenaz_sampler_test.cc index 20a0473207e52..dd8063900c778 100644 --- a/third_party/protobuf/src/google/protobuf/arenaz_sampler_test.cc +++ b/third_party/protobuf/src/google/protobuf/arenaz_sampler_test.cc @@ -8,6 +8,9 @@ #include "google/protobuf/arenaz_sampler.h" #include <atomic> +#include <cassert> +#include <cstddef> +#include <cstdint> #include <limits> #include <memory> #include <random> @@ -16,6 +19,12 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include "absl/log/absl_check.h" +#include "absl/strings/str_cat.h" +#include "absl/synchronization/mutex.h" +#include "absl/time/clock.h" +#include "google/protobuf/arena_allocation_policy.h" +#include "google/protobuf/serial_arena.h" // Must be included last. @@ -598,3 +607,5 @@ TEST(ThreadSafeArenazSamplerTest, UsedAndWasted) { } // namespace internal } // namespace protobuf } // namespace google + +#include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/compiler/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/BUILD.bazel index 5012ee7936cfe..91c0094d04dee 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/BUILD.bazel @@ -66,15 +66,15 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/io:io_win32", "//src/google/protobuf/io:tokenizer", - "@com_google_absl//absl/base", - "@com_google_absl//absl/cleanup", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/cleanup", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -102,16 +102,25 @@ cc_library( "//src/google/protobuf/compiler:retention", "//src/google/protobuf/io", "//src/google/protobuf/io:io_win32", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", ], ) +cc_library( + name = "plugin", + hdrs = ["plugin.h"], + copts = COPTS, + strip_include_prefix = "/src", + visibility = ["//visibility:public"], + deps = [":code_generator"], +) + cc_library( name = "code_generator_lite", srcs = ["code_generator_lite.cc"], @@ -121,7 +130,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ "//src/google/protobuf:port", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -141,8 +150,8 @@ cc_library( deps = [ ":code_generator", "//src/google/protobuf:port", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", ], ) @@ -153,9 +162,9 @@ cc_test( deps = [ ":versions", "//src/google/protobuf:test_textproto", - "@com_google_absl//absl/memory", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/memory", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -168,6 +177,7 @@ cc_library( ], hdrs = [ "command_line_interface.h", + "notices.h", "subprocess.h", "zip_writer.h", ], @@ -185,21 +195,21 @@ cc_library( "//src/google/protobuf/io:io_win32", "//src/google/protobuf/io:printer", "//src/google/protobuf/stubs", - "@com_google_absl//absl/algorithm", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:log_severity", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:globals", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/algorithm", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:log_severity", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:globals", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:span", ], ) @@ -229,7 +239,7 @@ cc_library( "//src/google/protobuf/compiler/python", "//src/google/protobuf/compiler/ruby", "//src/google/protobuf/compiler/rust", - "@com_google_absl//absl/log:initialize", + "@abseil-cpp//absl/log:initialize", ], ) @@ -246,7 +256,7 @@ cc_binary( deps = [ ":command_line_interface", "//src/google/protobuf:port", - "@com_google_absl//absl/log:initialize", + "@abseil-cpp//absl/log:initialize", ], ) @@ -290,10 +300,10 @@ cc_library( "//src/google/protobuf/io:printer", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", ], ) @@ -352,10 +362,10 @@ cc_library( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", ], ) @@ -380,8 +390,8 @@ cc_binary( ":plugin_cc_proto", "//src/google/protobuf", "//src/google/protobuf/io:io_win32", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", ], ) @@ -400,12 +410,12 @@ cc_test( "//src/google/protobuf/io:tokenizer", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -454,12 +464,12 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:span", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:span", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -482,10 +492,10 @@ cc_library( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", ], ) @@ -501,12 +511,12 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -533,12 +543,12 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -551,9 +561,9 @@ cc_library( deps = [ "//src/google/protobuf", "//src/google/protobuf:port", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:span", ], ) @@ -566,11 +576,11 @@ cc_test( "//src/google/protobuf", "//src/google/protobuf/io", "//src/google/protobuf/io:tokenizer", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -660,6 +670,7 @@ filegroup( name = "test_proto_srcs", srcs = [ "//src/google/protobuf/compiler/cpp:test_proto_srcs", + "//src/google/protobuf/compiler/java:test_proto_srcs", ], visibility = ["//pkg:__pkg__"], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc index a9cfa2c0e68b2..097028c6be28c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc @@ -64,17 +64,12 @@ bool CodeGenerator::GenerateAll(const std::vector<const FileDescriptor*>& files, absl::StatusOr<FeatureSetDefaults> CodeGenerator::BuildFeatureSetDefaults() const { - if ((GetSupportedFeatures() & FEATURE_SUPPORTS_EDITIONS) == 0) { - // For generators that don't fully support editions yet, provide an - // optimistic set of defaults. Protoc will check this condition later - // anyway. - return FeatureResolver::CompileDefaults( - FeatureSet::descriptor(), GetFeatureExtensions(), - MinimumAllowedEdition(), MaximumAllowedEdition()); - } + // For generators that don't fully support editions yet, provide an + // optimistic set of defaults. Protoc will check this condition later + // anyway. return FeatureResolver::CompileDefaults( - FeatureSet::descriptor(), GetFeatureExtensions(), GetMinimumEdition(), - GetMaximumEdition()); + FeatureSet::descriptor(), GetFeatureExtensions(), ProtocMinimumEdition(), + MaximumKnownEdition()); } GeneratorContext::~GeneratorContext() = default; diff --git a/third_party/protobuf/src/google/protobuf/compiler/code_generator.h b/third_party/protobuf/src/google/protobuf/compiler/code_generator.h index fc6c8dff05905..683a4276eb76e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/code_generator.h +++ b/third_party/protobuf/src/google/protobuf/compiler/code_generator.h @@ -162,8 +162,15 @@ class PROTOC_EXPORT CodeGenerator { } }; -constexpr auto MinimumAllowedEdition() { return Edition::EDITION_PROTO2; } -constexpr auto MaximumAllowedEdition() { return Edition::EDITION_2023; } +// The minimum edition supported by protoc. +constexpr auto ProtocMinimumEdition() { return Edition::EDITION_PROTO2; } +// The maximum edition supported by protoc. +constexpr auto ProtocMaximumEdition() { return Edition::EDITION_2023; } + +// The maximum edition known to protoc, which may or may not be officially +// supported yet. During development of a new edition, this will typically be +// set to that. +constexpr auto MaximumKnownEdition() { return Edition::EDITION_2024; } // CodeGenerators generate one or more files in a given directory. This // abstract interface represents the directory to which the CodeGenerator is diff --git a/third_party/protobuf/src/google/protobuf/compiler/code_generator_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/code_generator_unittest.cc index 1bbd24cb1f2c7..2f165e20794ec 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/code_generator_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/code_generator_unittest.cc @@ -72,8 +72,8 @@ class TestGenerator : public CodeGenerator { private: uint64_t features_ = CodeGenerator::Feature::FEATURE_SUPPORTS_EDITIONS; - Edition minimum_edition_ = MinimumAllowedEdition(); - Edition maximum_edition_ = MaximumAllowedEdition(); + Edition minimum_edition_ = ProtocMinimumEdition(); + Edition maximum_edition_ = ProtocMaximumEdition(); std::vector<const FieldDescriptor*> feature_extensions_ = { GetExtensionReflection(pb::test)}; }; @@ -114,7 +114,7 @@ TEST_F(CodeGeneratorTest, GetUnresolvedSourceFeaturesRoot) { ASSERT_THAT(BuildFile(pb::TestMessage::descriptor()->file()), NotNull()); auto file = BuildFile(R"schema( edition = "2023"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/unittest_features.proto"; @@ -137,7 +137,7 @@ TEST_F(CodeGeneratorTest, GetUnresolvedSourceFeaturesInherited) { ASSERT_THAT(BuildFile(pb::TestMessage::descriptor()->file()), NotNull()); auto file = BuildFile(R"schema( edition = "2023"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/unittest_features.proto"; @@ -176,7 +176,7 @@ TEST_F(CodeGeneratorTest, GetResolvedSourceFeaturesRoot) { ASSERT_THAT(BuildFile(pb::TestMessage::descriptor()->file()), NotNull()); auto file = BuildFile(R"schema( edition = "2023"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/unittest_features.proto"; @@ -209,7 +209,7 @@ TEST_F(CodeGeneratorTest, GetResolvedSourceFeaturesInherited) { ASSERT_THAT(BuildFile(pb::TestMessage::descriptor()->file()), NotNull()); auto file = BuildFile(R"schema( edition = "2023"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/unittest_features.proto"; @@ -280,6 +280,7 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -292,6 +293,7 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -304,10 +306,23 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } + fixed_features { enforce_naming_style: STYLE_LEGACY } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + } fixed_features {} } - minimum_edition: EDITION_99997_TEST_ONLY - maximum_edition: EDITION_99999_TEST_ONLY + minimum_edition: EDITION_PROTO2 + maximum_edition: EDITION_2024 )pb"))); } @@ -320,13 +335,13 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaultsUnsupported) { auto result = generator.BuildFeatureSetDefaults(); ASSERT_TRUE(result.ok()) << result.status().message(); - EXPECT_EQ(result->minimum_edition(), MinimumAllowedEdition()); - EXPECT_EQ(result->maximum_edition(), MaximumAllowedEdition()); + EXPECT_EQ(result->minimum_edition(), ProtocMinimumEdition()); + EXPECT_EQ(result->maximum_edition(), MaximumKnownEdition()); } TEST_F(CodeGeneratorTest, SupportedEditionRangeIsDense) { - for (int i = static_cast<int>(MinimumAllowedEdition()); - i <= static_cast<int>(MaximumAllowedEdition()); ++i) { + for (int i = static_cast<int>(ProtocMinimumEdition()); + i <= static_cast<int>(ProtocMaximumEdition()); ++i) { EXPECT_TRUE(Edition_IsValid(i)); } } diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc index ae6b87e4ad1f2..05962f667da89 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc @@ -59,7 +59,6 @@ #include "absl/log/globals.h" #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -93,6 +92,7 @@ #endif #include "google/protobuf/stubs/platform_macros.h" +#include "google/protobuf/compiler/notices.h" // Must be included last. #include "google/protobuf/port_def.inc" @@ -394,10 +394,6 @@ class CommandLineInterface::ErrorPrinter std::ostream& out) { std::string dfile; if ( -#ifndef PROTOBUF_OPENSOURCE - // Print full path when running under MSVS - format_ == CommandLineInterface::ERROR_FORMAT_MSVS && -#endif // !PROTOBUF_OPENSOURCE tree_ != nullptr && tree_->VirtualFileToDiskFile(filename, &dfile)) { out << dfile; } else { @@ -1257,12 +1253,13 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { return EXIT_FAILURE; } - // Enforce extension declarations only when compiling. We want to skip - // this enforcement when protoc is just being invoked to encode or decode - // protos. - if (mode_ == MODE_COMPILE - ) { - descriptor_pool->EnforceExtensionDeclarations(true); + // Enforce extension declarations only when compiling. We want to skip this + // enforcement when protoc is just being invoked to encode or decode + // protos. If allowlist is disabled, we will not check for descriptor + // extensions declarations, either. + if (mode_ == MODE_COMPILE) { + descriptor_pool->EnforceExtensionDeclarations( + ExtDeclEnforcementLevel::kCustomExtensions); } if (!ParseInputFiles(descriptor_pool.get(), disk_source_tree.get(), &parsed_files)) { @@ -1322,6 +1319,10 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { return 1; } + if (!EnforceProtocEditionsSupport(parsed_files)) { + return 1; + } + // We construct a separate GeneratorContext for each output location. Note // that two code generators may output to the same location, in which case // they should share a single GeneratorContext so that OpenForInsert() works. @@ -1496,7 +1497,6 @@ PopulateSingleSimpleDescriptorDatabase(const std::string& descriptor_set_name) { } // namespace - bool CommandLineInterface::VerifyInputFilesInDescriptors( DescriptorDatabase* database) { for (const auto& input_file : input_files_) { @@ -1515,7 +1515,6 @@ bool CommandLineInterface::VerifyInputFilesInDescriptors( << std::endl; return false; } - } return true; } @@ -1524,10 +1523,6 @@ bool CommandLineInterface::SetupFeatureResolution(DescriptorPool& pool) { // Calculate the feature defaults for each built-in generator. All generators // that support editions must agree on the supported edition range. std::vector<const FieldDescriptor*> feature_extensions; - Edition minimum_edition = MinimumAllowedEdition(); - // Override maximum_edition if experimental_editions is true. - Edition maximum_edition = - !experimental_editions_ ? MaximumAllowedEdition() : Edition::EDITION_MAX; for (const auto& output : output_directives_) { if (output.generator == nullptr) continue; if (!experimental_editions_ && @@ -1536,20 +1531,20 @@ bool CommandLineInterface::SetupFeatureResolution(DescriptorPool& pool) { // Only validate min/max edition on generators that advertise editions // support. Generators still under development will always use the // correct values. - if (output.generator->GetMinimumEdition() != minimum_edition) { + if (output.generator->GetMinimumEdition() != ProtocMinimumEdition()) { ABSL_LOG(ERROR) << "Built-in generator " << output.name << " specifies a minimum edition " << output.generator->GetMinimumEdition() << " which is not the protoc minimum " - << minimum_edition << "."; + << ProtocMinimumEdition() << "."; return false; } - if (output.generator->GetMaximumEdition() != maximum_edition) { + if (output.generator->GetMaximumEdition() != ProtocMaximumEdition()) { ABSL_LOG(ERROR) << "Built-in generator " << output.name << " specifies a maximum edition " << output.generator->GetMaximumEdition() << " which is not the protoc maximum " - << maximum_edition << "."; + << ProtocMaximumEdition() << "."; return false; } } @@ -1564,9 +1559,9 @@ bool CommandLineInterface::SetupFeatureResolution(DescriptorPool& pool) { } } absl::StatusOr<FeatureSetDefaults> defaults = - FeatureResolver::CompileDefaults(FeatureSet::descriptor(), - feature_extensions, minimum_edition, - maximum_edition); + FeatureResolver::CompileDefaults( + FeatureSet::descriptor(), feature_extensions, ProtocMinimumEdition(), + MaximumKnownEdition()); if (!defaults.ok()) { ABSL_LOG(ERROR) << defaults.status(); return false; @@ -1622,7 +1617,6 @@ bool CommandLineInterface::ParseInputFiles( break; } - // Enforce --direct_dependencies if (direct_dependencies_explicitly_set_) { bool indirect_imports = false; @@ -2007,6 +2001,7 @@ bool CommandLineInterface::ParseArgument(const char* arg, std::string* name, *name == "--include_imports" || *name == "--include_source_info" || *name == "--retain_options" || *name == "--version" || *name == "--decode_raw" || + *name == "--notices" || *name == "--experimental_editions" || *name == "--print_free_field_numbers" || *name == "--experimental_allow_proto3_optional" || @@ -2225,8 +2220,6 @@ CommandLineInterface::InterpretArgument(const std::string& name, } else if (name == "--disallow_services") { disallow_services_ = true; - - } else if (name == "--experimental_allow_proto3_optional") { // Flag is no longer observed, but we allow it for backward compat. } else if (name == "--encode" || name == "--decode" || @@ -2336,6 +2329,9 @@ CommandLineInterface::InterpretArgument(const std::string& name, #else ::setenv(io::Printer::kProtocCodegenTrace.data(), "yes", 0); #endif + } else if (name == "--notices") { + std::cout << notices_text << std::endl; + return PARSE_ARGUMENT_DONE_AND_EXIT; } else if (name == "--experimental_editions") { // If you're reading this, you're probably wondering what // --experimental_editions is for and thinking of turning it on. This is an @@ -2511,6 +2507,8 @@ Parse PROTO_FILES and generate output based on the options given: --enable_codegen_trace Enables tracing which parts of protoc are responsible for what codegen output. Not supported by all backends or on all platforms.)"; + std::cout << R"( + --notices Show notice file and exit.)"; if (!plugin_prefix_.empty()) { std::cout << R"( --plugin=EXECUTABLE Specifies a plugin executable to use. @@ -2617,6 +2615,31 @@ bool CommandLineInterface::EnforceEditionsSupport( return true; } +bool CommandLineInterface::EnforceProtocEditionsSupport( + const std::vector<const FileDescriptor*>& parsed_files) const { + if (experimental_editions_) { + // The user has explicitly specified the experimental flag. + return true; + } + for (const auto* fd : parsed_files) { + Edition edition = + ::google::protobuf::internal::InternalFeatureHelper::GetEdition(*fd); + if (CanSkipEditionCheck(fd->name())) { + // Legacy proto2/proto3 or exempted files don't need any checks. + continue; + } + + if (edition > ProtocMaximumEdition()) { + std::cerr << absl::Substitute( + "$0: is a file using edition $1, which is later than the protoc " + "maximum supported edition $2.", + fd->name(), edition, ProtocMaximumEdition()); + return false; + } + } + return true; +} + bool CommandLineInterface::GenerateOutput( const std::vector<const FileDescriptor*>& parsed_files, const OutputDirective& output_directive, @@ -3037,11 +3060,11 @@ bool CommandLineInterface::WriteEditionDefaults(const DescriptorPool& pool) { std::vector<const FieldDescriptor*> extensions; pool.FindAllExtensions(feature_set, &extensions); - Edition minimum = MinimumAllowedEdition(); + Edition minimum = ProtocMinimumEdition(); if (edition_defaults_minimum_ != EDITION_UNKNOWN) { minimum = edition_defaults_minimum_; } - Edition maximum = MaximumAllowedEdition(); + Edition maximum = ProtocMaximumEdition(); if (edition_defaults_maximum_ != EDITION_UNKNOWN) { maximum = edition_defaults_maximum_; } diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h index b67274709322d..86fff7639635f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h @@ -233,6 +233,9 @@ class PROTOC_EXPORT CommandLineInterface { Edition minimum_edition, Edition maximum_edition, const std::vector<const FileDescriptor*>& parsed_files) const; + bool EnforceProtocEditionsSupport( + const std::vector<const FileDescriptor*>& parsed_files) const; + // Return status for ParseArguments() and InterpretArgument(). enum ParseArgumentStatus { diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.cc b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.cc index 1586ee1df6161..290227864ed68 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.cc @@ -80,7 +80,7 @@ void CommandLineInterfaceTester::RunProtocWithArgs( return_code_ = cli_.Run(static_cast<int>(args.size()), argv.data()); - error_text_ = GetCapturedTestStderr(); + captured_stderr_ = GetCapturedTestStderr(); #if !defined(__CYGWIN__) captured_stdout_ = GetCapturedTestStdout(); #endif @@ -116,33 +116,42 @@ void CommandLineInterfaceTester::CreateTempDir(absl::string_view name) { void CommandLineInterfaceTester::ExpectNoErrors() { EXPECT_EQ(0, return_code_); - EXPECT_EQ("", error_text_); + + // Note: since warnings and errors are both simply printed to stderr, we + // can't holistically distinguish them here; in practice we don't have + // multiline warnings so just counting any line with 'warning:' in it + // is sufficient to separate warnings and errors in practice. + for (const auto& line : + absl::StrSplit(captured_stderr_, '\n', absl::SkipEmpty())) { + EXPECT_THAT(line, HasSubstr("warning:")); + } } void CommandLineInterfaceTester::ExpectErrorText( absl::string_view expected_text) { EXPECT_NE(0, return_code_); - EXPECT_EQ(absl::StrReplaceAll(expected_text, {{"$tmpdir", temp_directory_}}), - error_text_); + EXPECT_THAT(captured_stderr_, + HasSubstr(absl::StrReplaceAll(expected_text, + {{"$tmpdir", temp_directory_}}))); } void CommandLineInterfaceTester::ExpectErrorSubstring( absl::string_view expected_substring) { EXPECT_NE(0, return_code_); - EXPECT_THAT(error_text_, HasSubstr(expected_substring)); + EXPECT_THAT(captured_stderr_, HasSubstr(expected_substring)); } void CommandLineInterfaceTester::ExpectWarningSubstring( absl::string_view expected_substring) { EXPECT_EQ(0, return_code_); - EXPECT_THAT(error_text_, HasSubstr(expected_substring)); + EXPECT_THAT(captured_stderr_, HasSubstr(expected_substring)); } #if defined(_WIN32) && !defined(__CYGWIN__) bool CommandLineInterfaceTester::HasAlternateErrorSubstring( const std::string& expected_substring) { EXPECT_NE(0, return_code_); - return error_text_.find(expected_substring) != std::string::npos; + return captured_stderr_.find(expected_substring) != std::string::npos; } #endif // _WIN32 && !__CYGWIN__ @@ -162,7 +171,7 @@ void CommandLineInterfaceTester:: ExpectCapturedStderrSubstringWithZeroReturnCode( absl::string_view expected_substring) { EXPECT_EQ(0, return_code_); - EXPECT_THAT(error_text_, HasSubstr(expected_substring)); + EXPECT_THAT(captured_stderr_, HasSubstr(expected_substring)); } void CommandLineInterfaceTester::ExpectFileContent(absl::string_view filename, diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.h b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.h index b77dfa32b9635..4aa42bad02a54 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.h +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_tester.h @@ -25,6 +25,7 @@ #include "absl/strings/string_view.h" #include "google/protobuf/compiler/code_generator.h" #include "google/protobuf/compiler/command_line_interface.h" +#include "google/protobuf/testing/file.h" // Must be included last. #include "google/protobuf/port_def.inc" @@ -76,12 +77,10 @@ class CommandLineInterfaceTester : public testing::Test { // Creates a subdirectory within temp_directory_. void CreateTempDir(absl::string_view name); -#ifdef PROTOBUF_OPENSOURCE // Changes working directory to temp directory. void SwitchToTempDirectory() { File::ChangeWorkingDirectory(temp_directory_); } -#endif // !PROTOBUF_OPENSOURCE // ----------------------------------------------------------------- // Methods to check the test results (called after Run()). @@ -137,10 +136,8 @@ class CommandLineInterfaceTester : public testing::Test { // The result of Run(). int return_code_; - // The captured stderr output. - std::string error_text_; + std::string captured_stderr_; - // The captured stdout. std::string captured_stdout_; std::vector<std::unique_ptr<CodeGenerator>> generators_; diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc index 787d56fbf0cfc..5228117edcbf1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -19,6 +19,7 @@ #include <gmock/gmock.h> #include "absl/log/absl_check.h" #include "absl/strings/escaping.h" +#include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/types/span.h" #include "google/protobuf/compiler/command_line_interface_tester.h" @@ -84,7 +85,7 @@ using google::protobuf::io::win32::write; // Disable the whole test when we use tcmalloc for "draconian" heap checks, in // which case tcmalloc will print warnings that fail the plugin tests. -#if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN +#if !defined(GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN) namespace { @@ -659,7 +660,7 @@ TEST_F(CommandLineInterfaceTest, MultipleInputs_UnusedImport_DescriptorSetIn) { google::protobuf::Any::descriptor()->file()->CopyTo(&any_proto); const FileDescriptor* custom_file = - protobuf_unittest::AggregateMessage::descriptor()->file(); + proto2_unittest::AggregateMessage::descriptor()->file(); FileDescriptorProto* file_descriptor_proto = file_descriptor_set.add_file(); custom_file->CopyTo(file_descriptor_proto); file_descriptor_proto->set_name("custom_options.proto"); @@ -704,7 +705,7 @@ TEST_F(CommandLineInterfaceTest, MultipleInputs_UnusedImport_DescriptorSetIn) { file_descriptor_proto->mutable_message_type(0) ->mutable_options() ->mutable_unknown_fields() - ->AddVarint(protobuf_unittest::message_opt1.number(), 2222); + ->AddVarint(proto2_unittest::message_opt1.number(), 2222); WriteDescriptorSet("foo.bin", &file_descriptor_set); @@ -1633,7 +1634,7 @@ TEST_F(CommandLineInterfaceTest, Plugin_VersionSkewFuture) { ExpectErrorSubstring( "foo.proto:2:5: Edition 99997_TEST_ONLY is later than the maximum " - "supported edition 2023"); + "supported edition 2024"); } TEST_F(CommandLineInterfaceTest, Plugin_VersionSkewPast) { @@ -1927,6 +1928,70 @@ TEST_F(CommandLineInterfaceTest, PluginErrorAndNoEditionsSupport) { "--plug_out: foo.proto: Saw message type MockCodeGenerator_Error."); } +TEST_F(CommandLineInterfaceTest, AfterProtocMaximumEditionError) { + CreateTempFile("foo.proto", + R"schema( + edition = "2024"; + package foo; + message Foo { + } + )schema"); + + Run("protocol_compiler --proto_path=$tmpdir --test_out=$tmpdir foo.proto"); + ExpectErrorSubstring( + "foo.proto: is a file using edition 2024, which is later than the protoc " + "maximum supported edition 2023."); +} + +TEST_F(CommandLineInterfaceTest, AfterProtocMaximumEditionAllowlisted) { + constexpr absl::string_view path = "google/protobuf"; + CreateTempFile(absl::StrCat(path, "/foo.proto"), + R"schema( + edition = "2024"; + package foo; + message Foo { + } + )schema"); + + Run( + absl::Substitute("protocol_compiler --proto_path=$$tmpdir " + "--test_out=$$tmpdir $0/foo.proto", + path)); + ExpectNoErrors(); +} + +TEST_F(CommandLineInterfaceTest, + AfterProtocMaximumEditionExperimentalEditions) { + CreateTempFile("foo.proto", + R"schema( + edition = "2024"; + package foo; + message Foo { + } + )schema"); + + Run("protocol_compiler --experimental_editions --proto_path=$tmpdir " + "--test_out=$tmpdir foo.proto"); + ExpectNoErrors(); +} + +TEST_F(CommandLineInterfaceTest, + AfterMaximumKnownEditionErrorExperimentalEditions) { + CreateTempFile("foo.proto", + R"schema( + edition = "99997_TEST_ONLY"; + package foo; + message Foo { + } + )schema"); + + Run("protocol_compiler --experimental_editions --proto_path=$tmpdir " + "--test_out=$tmpdir foo.proto"); + ExpectErrorSubstring( + "foo.proto:2:5: Edition 99997_TEST_ONLY is later than the maximum " + "supported edition 2024\n"); +} + TEST_F(CommandLineInterfaceTest, EditionDefaults) { CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); @@ -1947,6 +2012,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -1959,6 +2025,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -1971,7 +2038,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } - fixed_features {} + fixed_features { enforce_naming_style: STYLE_LEGACY } } minimum_edition: EDITION_PROTO2 maximum_edition: EDITION_2023 @@ -1999,6 +2066,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2011,6 +2079,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2023,6 +2092,19 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } + fixed_features { enforce_naming_style: STYLE_LEGACY } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + } fixed_features {} } minimum_edition: EDITION_PROTO2 @@ -2052,6 +2134,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2064,6 +2147,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2076,6 +2160,19 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } + fixed_features { enforce_naming_style: STYLE_LEGACY } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + } fixed_features {} } minimum_edition: EDITION_99997_TEST_ONLY @@ -2618,7 +2715,6 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileGivenTwoInputs) { "Can only process one input file when using --dependency_out=FILE.\n"); } -#ifdef PROTOBUF_OPENSOURCE TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFile) { CreateTempFile("foo.proto", "syntax = \"proto2\";\n" @@ -2630,7 +2726,8 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFile) { " optional Foo foo = 1;\n" "}\n"); - std::string current_working_directory = getcwd(nullptr, 0); + char current_dir[PATH_MAX]; + ASSERT_EQ(getcwd(current_dir, sizeof(current_dir)), current_dir); SwitchToTempDirectory(); Run("protocol_compiler --dependency_out=manifest --test_out=. " @@ -2642,12 +2739,8 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFile) { "bar.proto.MockCodeGenerator.test_generator: " "foo.proto\\\n bar.proto"); - File::ChangeWorkingDirectory(current_working_directory); + File::ChangeWorkingDirectory(current_dir); } -#else // !PROTOBUF_OPENSOURCE -// TODO: Figure out how to change and get working directory in -// google3. -#endif // !PROTOBUF_OPENSOURCE TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileForAbsolutePath) { CreateTempFile("foo.proto", @@ -2771,9 +2864,12 @@ TEST_F(CommandLineInterfaceTest, ParseErrorsMultipleFiles) { "--proto_path=$tmpdir foo.proto"); ExpectErrorText( - "bar.proto:2:1: Expected top-level statement (e.g. \"message\").\n" - "baz.proto:2:1: Import \"bar.proto\" was not found or had errors.\n" - "foo.proto:2:1: Import \"bar.proto\" was not found or had errors.\n" + "bar.proto:2:1: Expected top-level statement (e.g. \"message\").\n"); + ExpectErrorText( + "baz.proto:2:1: Import \"bar.proto\" was not found or had errors.\n"); + ExpectErrorText( + "foo.proto:2:1: Import \"bar.proto\" was not found or had errors.\n"); + ExpectErrorText( "foo.proto:3:1: Import \"baz.proto\" was not found or had errors.\n"); } @@ -3533,7 +3629,7 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcement) { CreateTempFile("foo.proto", R"schema( syntax = "proto2"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/descriptor.proto"; message MyOptions { optional string file_option = 1 [targets = TARGET_TYPE_FILE]; @@ -3599,31 +3695,31 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcement) { Run("protocol_compiler --plug_out=$tmpdir --proto_path=$tmpdir foo.proto"); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `file`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `extension range`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `message`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `field`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `oneof`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.file_option " + "Option proto2_unittest.MyOptions.file_option " "cannot be set on an entity of type `enum`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `enum entry`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `service`."); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.enum_option " + "Option proto2_unittest.MyOptions.enum_option " "cannot be set on an entity of type `method`."); } @@ -3633,7 +3729,7 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsValid) { CreateTempFile("foo.proto", R"schema( syntax = "proto2"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/descriptor.proto"; message MyOptions { optional string message_or_file_option = 1 [ @@ -3661,7 +3757,7 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsInvalid) { CreateTempFile("foo.proto", R"schema( syntax = "proto2"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/descriptor.proto"; message MyOptions { optional string message_or_file_option = 1 [ @@ -3678,7 +3774,7 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsInvalid) { Run("protocol_compiler --plug_out=$tmpdir --proto_path=$tmpdir foo.proto"); ExpectErrorSubstring( - "Option protobuf_unittest.MyOptions.message_or_file_option cannot be set " + "Option proto2_unittest.MyOptions.message_or_file_option cannot be set " "on an entity of type `enum`."); } @@ -3689,7 +3785,7 @@ TEST_F(CommandLineInterfaceTest, CreateTempFile("foo.proto", R"schema( syntax = "proto2"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/descriptor.proto"; message A { optional B b = 1 [targets = TARGET_TYPE_FILE, @@ -3716,7 +3812,7 @@ TEST_F(CommandLineInterfaceTest, CreateTempFile("foo.proto", R"schema( syntax = "proto2"; - package protobuf_unittest; + package proto2_unittest; import "google/protobuf/descriptor.proto"; message A { optional B b = 1 [targets = TARGET_TYPE_ENUM]; @@ -3734,9 +3830,9 @@ TEST_F(CommandLineInterfaceTest, // We have target constraint violations at two different edges in the file // options, so let's make sure both are caught. ExpectErrorSubstring( - "Option protobuf_unittest.A.b cannot be set on an entity of type `file`."); + "Option proto2_unittest.A.b cannot be set on an entity of type `file`."); ExpectErrorSubstring( - "Option protobuf_unittest.B.i cannot be set on an entity of type `file`."); + "Option proto2_unittest.B.i cannot be set on an entity of type `file`."); } @@ -3927,6 +4023,20 @@ TEST_F(CommandLineInterfaceTest, "extendee message foo.Foo"); } +TEST_F(CommandLineInterfaceTest, WarningForReservedNameNotIdentifier) { + CreateTempFile("foo.proto", R"schema( + syntax = "proto2"; + package foo; + message Foo { + reserved "not ident"; + })schema"); + + Run("protocol_compiler --test_out=$tmpdir --proto_path=$tmpdir foo.proto"); + ExpectNoErrors(); + ExpectWarningSubstring( + "Reserved name \"not ident\" is not a valid identifier."); +} + TEST_F(CommandLineInterfaceTest, ExtensionDeclarationVerificationDeclarationUndeclaredError) { CreateTempFile("foo.proto", R"schema( @@ -4141,6 +4251,19 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> { captured_stdout_ = GetCapturedTestStdout(); captured_stderr_ = GetCapturedTestStderr(); + // Note: since warnings and errors are both simply printed to stderr, we + // can't holistically distinguish them here; in practice we don't have + // multiline warnings so just counting any line with 'warning:' in it + // is sufficient to separate warnings and errors in practice. + for (const auto& line : + absl::StrSplit(StripCR(captured_stderr_), '\n', absl::SkipEmpty())) { + if (absl::StrContains(line, "warning:")) { + captured_warnings_.push_back(std::string(line)); + } else { + captured_errors_.push_back(std::string(line)); + } + } + return result == 0; } @@ -4162,6 +4285,30 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> { ExpectStdoutMatchesText(expected_output); } + void ExpectNoErrors() { EXPECT_THAT(captured_errors_, testing::IsEmpty()); } + + void ExpectNoWarnings() { + EXPECT_THAT(captured_warnings_, testing::IsEmpty()); + } + + void ExpectError(absl::string_view expected_text) { + EXPECT_THAT(captured_errors_, testing::Contains(expected_text)); + } + + void ExpectErrorSubstring(absl::string_view expected_substring) { + EXPECT_THAT(captured_errors_, + testing::Contains(testing::HasSubstr(expected_substring))); + } + + void ExpectWarning(absl::string_view expected_text) { + EXPECT_THAT(captured_warnings_, testing::Contains(expected_text)); + } + + void ExpectWarningSubstring(absl::string_view expected_substring) { + EXPECT_THAT(captured_warnings_, + testing::Contains(testing::HasSubstr(expected_substring))); + } + void ExpectStdoutMatchesText(const std::string& expected_text) { EXPECT_EQ(StripCR(expected_text), StripCR(captured_stdout_)); } @@ -4180,13 +4327,13 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> { unittest_proto_descriptor_set_filename_ = absl::StrCat(TestTempDir(), "/unittest_proto_descriptor_set.bin"); FileDescriptorSet file_descriptor_set; - protobuf_unittest::TestAllTypes test_all_types; + proto2_unittest::TestAllTypes test_all_types; test_all_types.descriptor()->file()->CopyTo(file_descriptor_set.add_file()); - protobuf_unittest_import::ImportMessage import_message; + proto2_unittest_import::ImportMessage import_message; import_message.descriptor()->file()->CopyTo(file_descriptor_set.add_file()); - protobuf_unittest_import::PublicImportMessage public_import_message; + proto2_unittest_import::PublicImportMessage public_import_message; public_import_message.descriptor()->file()->CopyTo( file_descriptor_set.add_file()); ABSL_DCHECK(file_descriptor_set.IsInitialized()); @@ -4200,11 +4347,14 @@ class EncodeDecodeTest : public testing::TestWithParam<EncodeDecodeTestMode> { int duped_stdin_; std::string captured_stdout_; std::string captured_stderr_; + std::vector<std::string> captured_warnings_; + std::vector<std::string> captured_errors_; + std::string unittest_proto_descriptor_set_filename_; }; static void WriteGoldenMessage(const std::string& filename) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; TestUtil::SetAllFields(&message); std::string golden = message.SerializeAsString(); ABSL_CHECK_OK(File::SetContents(filename, golden, true)); @@ -4221,9 +4371,9 @@ TEST_P(EncodeDecodeTest, Encode) { args.append("google/protobuf/unittest.proto"); } EXPECT_TRUE( - Run(absl::StrCat(args, " --encode=protobuf_unittest.TestAllTypes"))); + Run(absl::StrCat(args, " --encode=proto2_unittest.TestAllTypes"))); ExpectStdoutMatchesBinaryFile(golden_path); - ExpectStderrMatchesText(""); + ExpectNoErrors(); } TEST_P(EncodeDecodeTest, Decode) { @@ -4232,25 +4382,24 @@ TEST_P(EncodeDecodeTest, Decode) { RedirectStdinFromFile(golden_path); EXPECT_TRUE( Run("google/protobuf/unittest.proto" - " --decode=protobuf_unittest.TestAllTypes")); + " --decode=proto2_unittest.TestAllTypes")); ExpectStdoutMatchesTextFile(TestUtil::GetTestDataPath( "google/protobuf/" "testdata/text_format_unittest_data_oneof_implemented.txt")); - ExpectStderrMatchesText(""); + ExpectNoErrors(); } TEST_P(EncodeDecodeTest, Partial) { RedirectStdinFromText(""); EXPECT_TRUE( Run("google/protobuf/unittest.proto" - " --encode=protobuf_unittest.TestRequired")); + " --encode=proto2_unittest.TestRequired")); ExpectStdoutMatchesText(""); - ExpectStderrMatchesText( - "warning: Input message is missing required fields: a, b, c\n"); + ExpectWarning("warning: Input message is missing required fields: a, b, c"); } TEST_P(EncodeDecodeTest, DecodeRaw) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.set_optional_int32(123); message.set_optional_string("foo"); std::string data; @@ -4261,7 +4410,7 @@ TEST_P(EncodeDecodeTest, DecodeRaw) { ExpectStdoutMatchesText( "1: 123\n" "14: \"foo\"\n"); - ExpectStderrMatchesText(""); + ExpectNoErrors(); } TEST_P(EncodeDecodeTest, UnknownType) { @@ -4269,7 +4418,7 @@ TEST_P(EncodeDecodeTest, UnknownType) { Run("google/protobuf/unittest.proto" " --encode=NoSuchType")); ExpectStdoutMatchesText(""); - ExpectStderrMatchesText("Type not defined: NoSuchType\n"); + ExpectError("Type not defined: NoSuchType"); } TEST_P(EncodeDecodeTest, ProtoParseError) { @@ -4277,8 +4426,9 @@ TEST_P(EncodeDecodeTest, ProtoParseError) { Run("net/proto2/internal/no_such_file.proto " "--encode=NoSuchType")); ExpectStdoutMatchesText(""); - ExpectStderrContainsText( - "net/proto2/internal/no_such_file.proto: No such file or directory\n"); + ExpectErrorSubstring( + "net/proto2/internal/no_such_file.proto: " + "No such file or directory"); } TEST_P(EncodeDecodeTest, EncodeDeterministicOutput) { @@ -4292,9 +4442,9 @@ TEST_P(EncodeDecodeTest, EncodeDeterministicOutput) { args.append("google/protobuf/unittest.proto"); } EXPECT_TRUE(Run(absl::StrCat( - args, " --encode=protobuf_unittest.TestAllTypes --deterministic_output"))); + args, " --encode=proto2_unittest.TestAllTypes --deterministic_output"))); ExpectStdoutMatchesBinaryFile(golden_path); - ExpectStderrMatchesText(""); + ExpectNoErrors(); } TEST_P(EncodeDecodeTest, DecodeDeterministicOutput) { @@ -4303,9 +4453,8 @@ TEST_P(EncodeDecodeTest, DecodeDeterministicOutput) { RedirectStdinFromFile(golden_path); EXPECT_FALSE( Run("google/protobuf/unittest.proto" - " --decode=protobuf_unittest.TestAllTypes --deterministic_output")); - ExpectStderrMatchesText( - "Can only use --deterministic_output with --encode.\n"); + " --decode=proto2_unittest.TestAllTypes --deterministic_output")); + ExpectError("Can only use --deterministic_output with --encode."); } INSTANTIATE_TEST_SUITE_P(FileDescriptorSetSource, EncodeDecodeTest, diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/cpp/BUILD.bazel index 0c50d219b8f20..72aa5e26ef1f7 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/BUILD.bazel @@ -18,7 +18,7 @@ cc_library( ":names_internal", "//src/google/protobuf", "//src/google/protobuf/compiler:code_generator", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -46,18 +46,18 @@ cc_library( "//src/google/protobuf/compiler:code_generator_lite", "//src/google/protobuf/io:printer", "//src/google/protobuf/io:tokenizer", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", ], ) @@ -105,6 +105,7 @@ cc_library( visibility = [ "//pkg:__pkg__", "//src/google/protobuf/compiler:__pkg__", + "//src/google/protobuf/compiler/python:__pkg__", # For testing only. "@io_kythe//kythe/cxx/tools:__subpackages__", ], deps = [ @@ -118,23 +119,23 @@ cc_library( "//src/google/protobuf/compiler:versions", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/container:layout", - "@com_google_absl//absl/functional:any_invocable", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/container:layout", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", ], ) @@ -195,8 +196,8 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -223,11 +224,11 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -242,9 +243,9 @@ cc_test( "//src/google/protobuf:port", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -256,8 +257,8 @@ cc_test( "//:protobuf", "//src/google/protobuf", "//src/google/protobuf/compiler:command_line_interface_tester", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -270,9 +271,9 @@ cc_test( "//src/google/protobuf:cc_test_protos", "//src/google/protobuf:port", "//src/google/protobuf:protobuf_lite", - "@com_google_absl//absl/log:absl_check", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -288,9 +289,9 @@ cc_test( "//src/google/protobuf/compiler:command_line_interface", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -303,8 +304,8 @@ cc_test( "//src/google/protobuf:cc_test_protos", "//src/google/protobuf:test_util", "//src/google/protobuf/stubs:lite", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -318,8 +319,8 @@ cc_test( "//src/google/protobuf:cc_test_protos", "//src/google/protobuf:test_util", "//src/google/protobuf/stubs:lite", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -331,8 +332,8 @@ cc_test( "//:protobuf", "//src/google/protobuf:arena", "//src/google/protobuf:cc_test_protos", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -347,9 +348,9 @@ cc_test( "//src/google/protobuf/io:printer", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -361,11 +362,11 @@ cc_test( "//:protobuf", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings:string_view", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -377,11 +378,11 @@ cc_test( "//:protobuf", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings:string_view", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/arena_ctor_visibility_test.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/arena_ctor_visibility_test.cc index 23c1a98493667..82f4a984a0e0e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/arena_ctor_visibility_test.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/arena_ctor_visibility_test.cc @@ -14,25 +14,25 @@ namespace google { namespace protobuf { namespace { -using protobuf_unittest::TestAllTypes; +using proto2_unittest::TestAllTypes; TEST(MessageConstructorTest, RegularCtor) { - using T = protobuf_unittest::TestAllTypes; + using T = proto2_unittest::TestAllTypes; EXPECT_TRUE((std::is_constructible<T>::value)); } TEST(MessageConstructorTest, RegularCopyCtor) { - using T = protobuf_unittest::TestAllTypes; + using T = proto2_unittest::TestAllTypes; EXPECT_TRUE((std::is_constructible<T, const T&>::value)); } TEST(MessageConstructorTest, ArenaCtor) { - using T = protobuf_unittest::TestAllTypes; + using T = proto2_unittest::TestAllTypes; EXPECT_FALSE((std::is_constructible<T, Arena*>::value)); } TEST(MessageConstructorTest, ArenaCopyCtor) { - using T = protobuf_unittest::TestAllTypes; + using T = proto2_unittest::TestAllTypes; EXPECT_FALSE((std::is_constructible<T, Arena*, const T&>::value)); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc index 5d64a9a88927d..4e38ea9585fa0 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc @@ -121,12 +121,6 @@ TEST(BootstrapTest, GeneratedFilesMatch) { // of the data to compare to. absl::flat_hash_map<absl::string_view, std::string> vpath_map; absl::flat_hash_map<absl::string_view, std::string> rpath_map; - rpath_map["google/protobuf/test_messages_proto2"] = - "net/proto2/z_generated_example/test_messages_proto2"; - rpath_map["google/protobuf/test_messages_proto3"] = - "net/proto2/z_generated_example/test_messages_proto3"; - rpath_map["net/proto2/internal/proto2_weak"] = - "net/proto2/z_generated_example/proto2_weak"; DiskSourceTree source_tree; source_tree.MapPath("", TestUtil::TestSourceDir()); diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/copy_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/copy_unittest.cc index cab9739239cb2..f28e996effe68 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/copy_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/copy_unittest.cc @@ -18,27 +18,27 @@ namespace cpp { namespace { TEST(CopyMessageTest, CopyConstructor) { - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; TestUtil::SetAllFields(&message1); - protobuf_unittest::TestAllTypes message2(message1); + proto2_unittest::TestAllTypes message2(message1); TestUtil::ExpectAllFieldsSet(message2); } TEST(CopyMessageTest, ArenaEnabledCopyConstructorNull) { - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; TestUtil::SetAllFields(&message1); - protobuf_unittest::TestAllTypes* message2 = - Arena::Create<protobuf_unittest::TestAllTypes>(nullptr, message1); + proto2_unittest::TestAllTypes* message2 = + Arena::Create<proto2_unittest::TestAllTypes>(nullptr, message1); TestUtil::ExpectAllFieldsSet(*message2); delete message2; } TEST(CopyMessageTest, ArenaEnabledCopyConstructor) { - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; TestUtil::SetAllFields(&message1); Arena arena; - protobuf_unittest::TestAllTypes* message2 = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena, message1); + proto2_unittest::TestAllTypes* message2 = + Arena::Create<proto2_unittest::TestAllTypes>(&arena, message1); TestUtil::ExpectAllFieldsSet(*message2); } @@ -46,14 +46,14 @@ TEST(CopyMessageTest, ArenaEnabledCopyConstructorArenaLeakTest) { // Set possible leaking field types for TestAllTypes with values // guaranteed to not be inlined string or Cord values. // TestAllTypes has unconditional ArenaDtor registration. - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; message1.set_optional_string(std::string(1000, 'a')); message1.add_repeated_string(std::string(1000, 'd')); Arena arena; - protobuf_unittest::TestAllTypes* message2 = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena, message1); + proto2_unittest::TestAllTypes* message2 = + Arena::Create<proto2_unittest::TestAllTypes>(&arena, message1); EXPECT_EQ(message2->optional_string(), message1.optional_string()); EXPECT_EQ(message2->repeated_string(0), message1.repeated_string(0)); diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.cc index 61d8cfe0b20e3..f7946cdf1feab 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.cc @@ -45,7 +45,11 @@ absl::flat_hash_map<absl::string_view, std::string> EnumVars( auto classname = ClassName(enum_, false); return { {"Enum", std::string(enum_->name())}, - {"Enum_", ResolveKeyword(enum_->name())}, + {"Enum_", ResolveKnownNameCollisions(enum_->name(), + enum_->containing_type() != nullptr + ? NameContext::kMessage + : NameContext::kFile, + NameKind::kType)}, {"Msg_Enum", classname}, {"::Msg_Enum", QualifiedClassName(enum_, options)}, {"Msg_Enum_", @@ -104,6 +108,16 @@ EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, size_t total_values = static_cast<size_t>(enum_->value_count()); should_cache_ = has_reflection_ && (values_range < 16u || values_range < total_values * 2u); + + sorted_unique_values_.reserve(enum_->value_count()); + for (int i = 0; i < enum_->value_count(); ++i) { + sorted_unique_values_.push_back(enum_->value(i)->number()); + } + // Sort and deduplicate + absl::c_sort(sorted_unique_values_); + sorted_unique_values_.erase( + std::unique(sorted_unique_values_.begin(), sorted_unique_values_.end()), + sorted_unique_values_.end()); } void EnumGenerator::GenerateDefinition(io::Printer* p) { @@ -167,27 +181,31 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { $open_enum_sentinels$, }; - $dllexport_decl $bool $Msg_Enum$_IsValid(int value); $dllexport_decl $extern const uint32_t $Msg_Enum$_internal_data_[]; - constexpr $Msg_Enum$ $Msg_Enum_Enum_MIN$ = static_cast<$Msg_Enum$>($kMin$); - constexpr $Msg_Enum$ $Msg_Enum_Enum_MAX$ = static_cast<$Msg_Enum$>($kMax$); + inline constexpr $Msg_Enum$ $Msg_Enum_Enum_MIN$ = + static_cast<$Msg_Enum$>($kMin$); + inline constexpr $Msg_Enum$ $Msg_Enum_Enum_MAX$ = + static_cast<$Msg_Enum$>($kMax$); )cc"); + // Generate the inline `_IsValid` function choosing the best implementation + // for the values. + GenerateIsValid(p); + if (generate_array_size_) { p->Emit({Sub("Msg_Enum_Enum_ARRAYSIZE", absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_ARRAYSIZE")) .AnnotatedAs(enum_)}, R"cc( - constexpr int $Msg_Enum_Enum_ARRAYSIZE$ = $kMax$ + 1; + inline constexpr int $Msg_Enum_Enum_ARRAYSIZE$ = $kMax$ + 1; )cc"); } if (has_reflection_) { - p->Emit(R"cc( - $dllexport_decl $const ::$proto_ns$::EnumDescriptor* - $Msg_Enum$_descriptor(); - )cc"); + p->Emit(R"( + $dllexport_decl $const $pb$::EnumDescriptor* $nonnull$ $Msg_Enum$_descriptor(); + )"); } else { p->Emit(R"cc( $return_type$ $Msg_Enum$_Name($Msg_Enum$ value); @@ -225,8 +243,7 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { p->Emit(R"cc( template <> inline $return_type$ $Msg_Enum$_Name($Msg_Enum$ value) { - return ::$proto_ns$::internal::NameOfDenseEnum<$Msg_Enum$_descriptor, - $kMin$, $kMax$>( + return $pbi$::NameOfDenseEnum<$Msg_Enum$_descriptor, $kMin$, $kMax$>( static_cast<int>(value)); } )cc"); @@ -236,21 +253,25 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { template <typename T> $return_type$ $Msg_Enum$_Name(T value) { $static_assert$; - return ::$proto_ns$::internal::NameOfEnum($Msg_Enum$_descriptor(), value); + return $pbi$::NameOfEnum($Msg_Enum$_descriptor(), value); } )cc"); } if (has_reflection_) { p->Emit(R"cc( - inline bool $Msg_Enum$_Parse(absl::string_view name, $Msg_Enum$* value) { - return ::$proto_ns$::internal::ParseNamedEnum<$Msg_Enum$>( - $Msg_Enum$_descriptor(), name, value); + inline bool $Msg_Enum$_Parse( + //~ + absl::string_view name, $Msg_Enum$* $nonnull$ value) { + return $pbi$::ParseNamedEnum<$Msg_Enum$>($Msg_Enum$_descriptor(), name, + value); } )cc"); } else { p->Emit(R"cc( - bool $Msg_Enum$_Parse(absl::string_view name, $Msg_Enum$* value); + bool $Msg_Enum$_Parse( + //~ + absl::string_view name, $Msg_Enum$* $nonnull$ value); )cc"); } } @@ -267,7 +288,7 @@ void EnumGenerator::GenerateGetEnumDescriptorSpecializations(io::Printer* p) { } p->Emit(R"cc( template <> - inline const EnumDescriptor* GetEnumDescriptor<$::Msg_Enum$>() { + inline const EnumDescriptor* $nonnull$ GetEnumDescriptor<$::Msg_Enum$>() { return $::Msg_Enum$_descriptor(); } )cc"); @@ -321,11 +342,11 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* p) const { } if (has_reflection_) { - p->Emit(R"cc( - static inline const ::$proto_ns$::EnumDescriptor* $Enum$_descriptor() { + p->Emit(R"( + static inline const $pb$::EnumDescriptor* $nonnull$ $Enum$_descriptor() { return $Msg_Enum$_descriptor(); } - )cc"); + )"); } p->Emit(R"cc( @@ -333,71 +354,42 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* p) const { static inline $return_type$ $Enum$_Name(T value) { return $Msg_Enum$_Name(value); } - static inline bool $Enum$_Parse(absl::string_view name, $Enum_$* value) { + static inline bool $Enum$_Parse( + //~ + absl::string_view name, $Enum_$* $nonnull$ value) { return $Msg_Enum$_Parse(name, value); } )cc"); } -void EnumGenerator::GenerateMethods(int idx, io::Printer* p) { +void EnumGenerator::GenerateIsValid(io::Printer* p) const { auto v = p->WithVars(EnumVars(enum_, options_, limits_.min, limits_.max)); - if (has_reflection_) { - p->Emit({{"idx", idx}}, R"cc( - const ::$proto_ns$::EnumDescriptor* $Msg_Enum$_descriptor() { - ::$proto_ns$::internal::AssignDescriptors(&$desc_table$); - return $file_level_enum_descriptors$[$idx$]; - } - )cc"); - } - - // Multiple values may have the same number. Sort and dedup. - std::vector<int> numbers; - numbers.reserve(enum_->value_count()); - for (int i = 0; i < enum_->value_count(); ++i) { - numbers.push_back(enum_->value(i)->number()); - } - // Sort and deduplicate `numbers`. - absl::c_sort(numbers); - numbers.erase(std::unique(numbers.begin(), numbers.end()), numbers.end()); - - // We now generate the XXX_IsValid functions, as well as their encoded enum - // data. // For simple enums we skip the generic ValidateEnum call and use better // codegen. It matches the speed of the previous switch-based codegen. // For more complex enums we use the new algorithm with the encoded data. - // Always generate the data array, even on the simple cases because someone - // might be using it for TDP entries. If it is not used in the end, the linker - // will drop it. - p->Emit({{"encoded", - [&] { - for (uint32_t n : google::protobuf::internal::GenerateEnumData(numbers)) { - p->Emit({{"n", n}}, "$n$u, "); - } - }}}, - R"cc( - PROTOBUF_CONSTINIT const uint32_t $Msg_Enum$_internal_data_[] = { - $encoded$}; - )cc"); - if (numbers.front() + static_cast<int64_t>(numbers.size()) - 1 == - numbers.back()) { + if (sorted_unique_values_.front() + + static_cast<int64_t>(sorted_unique_values_.size()) - 1 == + sorted_unique_values_.back()) { // They are sequential. Do a simple range check. - p->Emit({{"min", numbers.front()}, {"max", numbers.back()}}, + p->Emit({{"min", sorted_unique_values_.front()}, + {"max", sorted_unique_values_.back()}}, R"cc( - bool $Msg_Enum$_IsValid(int value) { + inline bool $Msg_Enum$_IsValid(int value) { return $min$ <= value && value <= $max$; } )cc"); - } else if (numbers.front() >= 0 && numbers.back() < 64) { + } else if (sorted_unique_values_.front() >= 0 && + sorted_unique_values_.back() < 64) { // Not sequential, but they fit in a 64-bit bitmap. uint64_t bitmap = 0; - for (int n : numbers) { + for (int n : sorted_unique_values_) { bitmap |= uint64_t{1} << n; } - p->Emit({{"bitmap", bitmap}, {"max", numbers.back()}}, + p->Emit({{"bitmap", bitmap}, {"max", sorted_unique_values_.back()}}, R"cc( - bool $Msg_Enum$_IsValid(int value) { + inline bool $Msg_Enum$_IsValid(int value) { return 0 <= value && value <= $max$ && (($bitmap$u >> value) & 1) != 0; } )cc"); @@ -405,11 +397,39 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* p) { // More complex struct. Use enum data structure for lookup. p->Emit( R"cc( - bool $Msg_Enum$_IsValid(int value) { - return ::_pbi::ValidateEnum(value, $Msg_Enum$_internal_data_); + inline bool $Msg_Enum$_IsValid(int value) { + return $pbi$::ValidateEnum(value, $Msg_Enum$_internal_data_); } )cc"); } +} + +void EnumGenerator::GenerateMethods(int idx, io::Printer* p) { + auto v = p->WithVars(EnumVars(enum_, options_, limits_.min, limits_.max)); + + if (has_reflection_) { + p->Emit({{"idx", idx}}, R"cc( + const $pb$::EnumDescriptor* $nonnull$ $Msg_Enum$_descriptor() { + $pbi$::AssignDescriptors(&$desc_table$); + return $file_level_enum_descriptors$[$idx$]; + } + )cc"); + } + + // Always generate the data array, even on the simple cases because someone + // might be using it for TDP entries. If it is not used in the end, the linker + // will drop it. + p->Emit({{"encoded", + [&] { + for (uint32_t n : + google::protobuf::internal::GenerateEnumData(sorted_unique_values_)) { + p->Emit({{"n", n}}, "$n$u, "); + } + }}}, + R"cc( + PROTOBUF_CONSTINIT const uint32_t $Msg_Enum$_internal_data_[] = { + $encoded$}; + )cc"); if (!has_reflection_) { // In lite mode (where descriptors are unavailable), we generate separate @@ -506,16 +526,15 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* p) { }}, }, R"cc( - static ::$proto_ns$::internal::ExplicitlyConstructed<std::string> + static $pbi$::ExplicitlyConstructed<std::string> $Msg_Enum$_strings[$num_unique$] = {}; static const char $Msg_Enum$_names[] = { $names$, }; - static const ::$proto_ns$::internal::EnumEntry $Msg_Enum$_entries[] = - { - $entries$, + static const $pbi$::EnumEntry $Msg_Enum$_entries[] = { + $entries$, }; static const int $Msg_Enum$_entries_by_number[] = { @@ -523,22 +542,20 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* p) { }; $return_type$ $Msg_Enum$_Name($Msg_Enum$ value) { - static const bool kDummy = - ::$proto_ns$::internal::InitializeEnumStrings( - $Msg_Enum$_entries, $Msg_Enum$_entries_by_number, - $num_unique$, $Msg_Enum$_strings); + static const bool kDummy = $pbi$::InitializeEnumStrings( + $Msg_Enum$_entries, $Msg_Enum$_entries_by_number, $num_unique$, + $Msg_Enum$_strings); (void)kDummy; - int idx = ::$proto_ns$::internal::LookUpEnumName( - $Msg_Enum$_entries, $Msg_Enum$_entries_by_number, $num_unique$, - value); - return idx == -1 ? ::$proto_ns$::internal::GetEmptyString() - : $Msg_Enum$_strings[idx].get(); + int idx = $pbi$::LookUpEnumName($Msg_Enum$_entries, + $Msg_Enum$_entries_by_number, + $num_unique$, value); + return idx == -1 ? $pbi$::GetEmptyString() : $Msg_Enum$_strings[idx].get(); } - bool $Msg_Enum$_Parse(absl::string_view name, $Msg_Enum$* value) { + bool $Msg_Enum$_Parse(absl::string_view name, $Msg_Enum$* $nonnull$ value) { int int_value; - bool success = ::$proto_ns$::internal::LookUpEnumValue( + bool success = $pbi$::LookUpEnumValue( $Msg_Enum$_entries, $num_declared$, name, &int_value); if (success) { *value = static_cast<$Msg_Enum$>(int_value); @@ -547,45 +564,6 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* p) { } )cc"); } - - if (enum_->containing_type() != nullptr) { - // 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 MSVC++ pre-2015 and post-2017 (version 15.5+) insists that we not. - p->Emit( - { - {"Msg_", ClassName(enum_->containing_type(), false)}, - {"constexpr_storage", - [&] { - for (int i = 0; i < enum_->value_count(); i++) { - p->Emit({{"VALUE", EnumValueName(enum_->value(i))}}, - R"cc( - constexpr $Msg_Enum$ $Msg_$::$VALUE$; - )cc"); - } - }}, - {"array_size", - [&] { - if (generate_array_size_) { - p->Emit(R"cc( - constexpr int $Msg_$::$Enum$_ARRAYSIZE; - )cc"); - } - }}, - }, - R"( - #if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - - $constexpr_storage$; - constexpr $Msg_Enum$ $Msg_$::$Enum$_MIN; - constexpr $Msg_Enum$ $Msg_$::$Enum$_MAX; - $array_size$; - - #endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - )"); - } } } // namespace cpp } // namespace compiler diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.h index 40c5099a13e7f..5a636ae6e30c8 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/enum.h @@ -47,6 +47,9 @@ class EnumGenerator { // header. void GenerateSymbolImports(io::Printer* p) const; + // Generate the `inline` implementation of the _IsValid function. + void GenerateIsValid(io::Printer* p) const; + // Source file stuff. // Generate non-inline methods related to the enum, such as IsValidValue(). @@ -66,6 +69,7 @@ class EnumGenerator { const EnumDescriptor* enum_; Options options_; + std::vector<int> sorted_unique_values_; bool generate_array_size_; bool should_cache_; diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/extension.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/extension.cc index 4dbfe5abe5368..3dd9410b8fabd 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/extension.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/extension.cc @@ -41,9 +41,7 @@ ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, case FieldDescriptor::CPPTYPE_ENUM: type_traits_.append("EnumTypeTraits< "); type_traits_.append(ClassName(descriptor_->enum_type(), true)); - type_traits_.append(", "); - type_traits_.append(ClassName(descriptor_->enum_type(), true)); - type_traits_.append("_IsValid>"); + type_traits_.append(">"); break; case FieldDescriptor::CPPTYPE_STRING: type_traits_.append("StringTypeTraits"); @@ -63,10 +61,20 @@ ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, variables_["extendee"] = QualifiedClassName(descriptor_->containing_type(), options_); variables_["type_traits"] = type_traits_; - variables_["name"] = ResolveKeyword(descriptor_->name()); + variables_["name"] = ResolveKnownNameCollisions( + descriptor_->name(), + descriptor_->extension_scope() != nullptr ? NameContext::kMessage + : NameContext::kFile, + NameKind::kValue); variables_["constant_name"] = FieldConstantName(descriptor_); variables_["field_type"] = absl::StrCat(static_cast<int>(descriptor_->type())); + // Downgrade string to bytes if it is not UTF8 validated. + if (descriptor_->type() == FieldDescriptor::TYPE_STRING && + !descriptor_->requires_utf8_validation()) { + variables_["field_type"] = + absl::StrCat(static_cast<int>(FieldDescriptor::TYPE_BYTES)); + } variables_["repeated"] = descriptor_->is_repeated() ? "true" : "false"; variables_["packed"] = descriptor_->is_packed() ? "true" : "false"; variables_["dllexport_decl"] = options.dllexport_decl; @@ -91,8 +99,13 @@ bool ExtensionGenerator::IsScoped() const { void ExtensionGenerator::GenerateDeclaration(io::Printer* p) const { auto var = p->WithVars(variables_); auto annotate = p->WithAnnotations({{"name", descriptor_}}); - - p->Emit({{"qualifier", + p->Emit({{"constant_qualifier", + // If this is a class member, it needs to be declared + // `static constexpr`. + // Otherwise, it will be + // `inline constexpr`. + IsScoped() ? "static" : ""}, + {"id_qualifier", // If this is a class member, it needs to be declared "static". // Otherwise, it needs to be "extern". In the latter case, it // also needs the DLL export/import specifier. @@ -101,10 +114,10 @@ void ExtensionGenerator::GenerateDeclaration(io::Printer* p) const { ? "extern" : absl::StrCat(options_.dllexport_decl, " extern")}}, R"cc( - static const int $constant_name$ = $number$; - $qualifier$ ::$proto_ns$::internal::ExtensionIdentifier< - $extendee$, ::$proto_ns$::internal::$type_traits$, $field_type$, - $packed$> + inline $constant_qualifier $constexpr int $constant_name$ = + $number$; + $id_qualifier$ $pbi$::ExtensionIdentifier< + $extendee$, $pbi$::$type_traits$, $field_type$, $packed$> $name$; )cc"); } @@ -149,32 +162,13 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* p) { const std::string $default_str$($default_val$); )cc"); }}, - {"declare_const_var", - [&] { - if (!IsScoped()) return; - // Likewise, class members need to declare the field constant - // variable. - p->Emit(R"cc( -#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912) - const int $scope$$constant_name$; -#endif - )cc"); - }}, - {"define_extension_id", - [&] { - p->Emit(R"cc( - PROTOBUF_CONSTINIT$ dllexport_decl$ - PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi:: - ExtensionIdentifier<$extendee$, ::_pbi::$type_traits$, - $field_type$, $packed$> - $scoped_name$($constant_name$, $default_str$); - )cc"); - }}, }, R"cc( $declare_default_str$; - $declare_const_var$; - $define_extension_id$; + PROTOBUF_CONSTINIT$ dllexport_decl$ + PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi::ExtensionIdentifier< + $extendee$, ::_pbi::$type_traits$, $field_type$, $packed$> + $scoped_name$($constant_name$, $default_str$); )cc"); } @@ -214,7 +208,7 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, ::_pbi::GetPrototypeForWeakDescriptor( &$extendee_table$, $extendee_index$, true), $number$, $field_type$, $repeated$, $packed$, - $enum_name$_IsValid) + $enum_name$_internal_data_) : (void)0), )cc"); } else if (priority == kInitPriority102) { @@ -222,7 +216,7 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, R"cc( ::_pbi::ExtensionSet::RegisterEnumExtension( &$extendee$::default_instance(), $number$, $field_type$, - $repeated$, $packed$, $enum_name$_IsValid), + $repeated$, $packed$, $enum_name$_internal_data_), )cc"); } @@ -240,9 +234,7 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, ? absl::StrCat("&", message_type, "::InternalVerify") : "nullptr"}, {"message_type", message_type}, - {"lazy", descriptor_->options().has_lazy() - ? descriptor_->options().lazy() ? "kLazy" : "kEager" - : "kUndefined"}}); + {"lazy", "kUndefined"}}); if (using_implicit_weak_descriptors) { p->Emit( { diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field.cc index b7a8d1f450fbd..a38518d96f4b1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field.cc @@ -227,6 +227,12 @@ void FieldGeneratorBase::GenerateCopyConstructorCode(io::Printer* p) const { } } +pb::CppFeatures::StringType FieldGeneratorBase::GetDeclaredStringType() const { + return CppGenerator::GetResolvedSourceFeatures(*field_) + .GetExtension(pb::cpp) + .string_type(); +} + namespace { std::unique_ptr<FieldGeneratorBase> MakeGenerator(const FieldDescriptor* field, const Options& options, diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/field.h index 4722fc5236257..6d4eef94f9b93 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field.h @@ -25,6 +25,7 @@ #include "absl/types/span.h" #include "google/protobuf/compiler/cpp/helpers.h" #include "google/protobuf/compiler/cpp/options.h" +#include "google/protobuf/cpp_features.pb.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/io/printer.h" @@ -199,6 +200,8 @@ class FieldGeneratorBase { MessageSCCAnalyzer* scc_; absl::flat_hash_map<absl::string_view, std::string> variables_; + pb::CppFeatures::StringType GetDeclaredStringType() const; + private: bool should_split_ = false; bool is_trivial_ = false; @@ -251,6 +254,8 @@ class FieldGenerator { // Properties: see FieldGeneratorBase for documentation bool should_split() const { return impl_->should_split(); } bool is_trivial() const { return impl_->is_trivial(); } + // Returns true if the field has trivial copy construction. + bool has_trivial_copy() const { return is_trivial(); } bool has_trivial_value() const { return impl_->has_trivial_value(); } bool has_trivial_zero_default() const { return impl_->has_trivial_zero_default(); diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/cord_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/cord_field.cc index e1c2116a20ed9..9a4f429205e85 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/cord_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/cord_field.cc @@ -39,7 +39,7 @@ void SetCordVariables( "\"", absl::CEscape(descriptor->default_value_string()), "\""); (*variables)["default_length"] = absl::StrCat(descriptor->default_value_string().length()); - (*variables)["full_name"] = descriptor->full_name(); + (*variables)["full_name"] = std::string(descriptor->full_name()); // For one of Cords (*variables)["default_variable_name"] = MakeDefaultName(descriptor); (*variables)["default_variable_field"] = MakeDefaultFieldName(descriptor); @@ -103,7 +103,7 @@ class CordFieldGenerator : public FieldGeneratorBase { void GenerateOneofCopyConstruct(io::Printer* p) const override { auto vars = p->WithVars(variables_); p->Emit(R"cc( - $field$ = ::$proto_ns$::Arena::Create<absl::Cord>(arena, *from.$field$); + $field$ = $pb$::Arena::Create<absl::Cord>(arena, *from.$field$); )cc"); } }; @@ -165,7 +165,7 @@ void CordFieldGenerator::GenerateAccessorDeclarations( "private:\n" "const ::absl::Cord& ${1$_internal_$name$$}$() const;\n" "void ${1$_internal_set_$name$$}$(const ::absl::Cord& value);\n" - "::absl::Cord* ${1$_internal_mutable_$name$$}$();\n" + "::absl::Cord* $nonnull$ ${1$_internal_mutable_$name$$}$();\n" "public:\n", field_); } @@ -214,7 +214,8 @@ void CordFieldGenerator::GenerateInlineAccessorDefinitions( } )cc"); printer->Emit(R"cc( - inline ::absl::Cord* $classname$::_internal_mutable_$name_internal$() { + inline ::absl::Cord* $nonnull$ + $classname$::_internal_mutable_$name_internal$() { $set_hasbit$; return &$field$; } @@ -275,7 +276,7 @@ void CordFieldGenerator::GenerateByteSize(io::Printer* printer) const { Formatter format(printer, variables_); format( "total_size += $tag_size$ +\n" - " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" + " $pbi$::WireFormatLite::$declared_type$Size(\n" " this_._internal_$name$());\n"); } @@ -317,7 +318,7 @@ CordOneofFieldGenerator::CordOneofFieldGenerator( void CordOneofFieldGenerator::GeneratePrivateMembers( io::Printer* printer) const { Formatter format(printer, variables_); - format("::absl::Cord *$name$_;\n"); + format("::absl::Cord* $nonnull$ $name$_;\n"); } void CordOneofFieldGenerator::GenerateStaticMembers( @@ -361,7 +362,7 @@ void CordOneofFieldGenerator::GenerateInlineAccessorDefinitions( clear_$oneof_name$(); set_has_$name_internal$(); $field$ = new ::absl::Cord; - ::$proto_ns$::Arena* arena = GetArena(); + $pb$::Arena* arena = GetArena(); if (arena != nullptr) { arena->Own($field$); } @@ -378,7 +379,7 @@ void CordOneofFieldGenerator::GenerateInlineAccessorDefinitions( clear_$oneof_name$(); set_has_$name_internal$(); $field$ = new ::absl::Cord; - ::$proto_ns$::Arena* arena = GetArena(); + $pb$::Arena* arena = GetArena(); if (arena != nullptr) { arena->Own($field$); } @@ -389,12 +390,13 @@ void CordOneofFieldGenerator::GenerateInlineAccessorDefinitions( } )cc"); printer->Emit(R"cc( - inline ::absl::Cord* $classname$::_internal_mutable_$name_internal$() { + inline ::absl::Cord* $nonnull$ + $classname$::_internal_mutable_$name_internal$() { if ($not_has_field$) { clear_$oneof_name$(); set_has_$name_internal$(); $field$ = new ::absl::Cord; - ::$proto_ns$::Arena* arena = GetArena(); + $pb$::Arena* arena = GetArena(); if (arena != nullptr) { arena->Own($field$); } @@ -445,7 +447,7 @@ void CordOneofFieldGenerator::GenerateArenaDestructorCode( void CordOneofFieldGenerator::GenerateMergingCode(io::Printer* printer) const { printer->Emit(R"cc( if (oneof_needs_init) { - _this->$field$ = ::$proto_ns$::Arena::Create<absl::Cord>(arena); + _this->$field$ = $pb$::Arena::Create<absl::Cord>(arena); } *_this->$field$ = *from.$field$; )cc"); diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc index ada4b098c2ee2..ad3bd0f137f91 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc @@ -41,9 +41,13 @@ std::vector<Sub> Vars(const FieldDescriptor* field, const Options& opts) { return { {"Enum", enum_name}, {"kDefault", Int32ToString(default_value->number())}, - Sub("assert_valid", - is_open ? "" - : absl::Substitute("assert($0_IsValid(value));", enum_name)) + Sub("assert_valid", is_open ? "" + : absl::Substitute( + R"cc( + assert(::$0::internal::ValidateEnum( + value, $1_internal_data_)); + )cc", + ProtobufNamespace(opts), enum_name)) .WithSuffix(";"), {"cached_size_name", MakeVarintCachedSizeName(field)}, @@ -385,11 +389,11 @@ void RepeatedEnum::GenerateAccessorDeclarations(io::Printer* p) const { $DEPRECATED$ void $set_name$(int index, $Enum$ value); $DEPRECATED$ void $add_name$($Enum$ value); $DEPRECATED$ const $pb$::RepeatedField<int>& $name$() const; - $DEPRECATED$ $pb$::RepeatedField<int>* $mutable_name$(); + $DEPRECATED$ $pb$::RepeatedField<int>* $nonnull$ $mutable_name$(); private: const $pb$::RepeatedField<int>& $_internal_name$() const; - $pb$::RepeatedField<int>* $_internal_mutable_name$(); + $pb$::RepeatedField<int>* $nonnull$ $_internal_mutable_name$(); public: )cc"); @@ -433,7 +437,7 @@ void RepeatedEnum::GenerateInlineAccessorDefinitions(io::Printer* p) const { } )cc"); p->Emit(R"cc( - inline $pb$::RepeatedField<int>* $Msg$::mutable_$name$() + inline $pb$::RepeatedField<int>* $nonnull$ $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $annotate_mutable_list$; @@ -449,7 +453,8 @@ void RepeatedEnum::GenerateInlineAccessorDefinitions(io::Printer* p) const { $TsanDetectConcurrentRead$; return *$field_$; } - inline $pb$::RepeatedField<int>* $Msg$::_internal_mutable_$name_internal$() { + inline $pb$::RepeatedField<int>* $nonnull$ + $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; $PrepareSplitMessageForWrite$; if ($field_$.IsDefault()) { @@ -465,7 +470,8 @@ void RepeatedEnum::GenerateInlineAccessorDefinitions(io::Printer* p) const { $TsanDetectConcurrentRead$; return $field_$; } - inline $pb$::RepeatedField<int>* $Msg$::_internal_mutable_$name_internal$() { + inline $pb$::RepeatedField<int>* $nonnull$ + $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; return &$field_$; } @@ -535,7 +541,7 @@ void RepeatedEnum::GenerateByteSize(io::Printer* p) const { data_size == 0 ? 0 : $kTagBytes$ + ::_pbi::WireFormatLite::Int32Size( - static_cast<int32_t>(data_size)); + static_cast<::int32_t>(data_size)); )cc"); } else { p->Emit(R"cc( diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/map_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/map_field.cc index bd6221732b96e..378e4c0c7952b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/map_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/map_field.cc @@ -46,7 +46,8 @@ std::vector<Sub> Vars(const FieldDescriptor* field, const Options& opts, } return { - {"Map", absl::Substitute("::google::protobuf::Map<$0, $1>", key_type, val_type)}, + {"Map", absl::Substitute("::$2::Map<$0, $1>", key_type, val_type, + ProtobufNamespace(opts))}, {"Entry", ClassName(field->message_type(), false)}, {"Key", PrimitiveTypeName(opts, key->cpp_type())}, {"Val", val_type}, @@ -203,11 +204,11 @@ void Map::GenerateAccessorDeclarations(io::Printer* p) const { io::AnnotationCollector::kAlias)); p->Emit(R"cc( $DEPRECATED$ const $Map$& $name$() const; - $DEPRECATED$ $Map$* $mutable_name$(); + $DEPRECATED$ $Map$* $nonnull$ $mutable_name$(); private: const $Map$& $_internal_name$() const; - $Map$* $_internal_mutable_name$(); + $Map$* $nonnull$ $_internal_mutable_name$(); public: )cc"); @@ -229,14 +230,15 @@ void Map::GenerateInlineAccessorDefinitions(io::Printer* p) const { } )cc"); p->Emit(R"cc( - inline $Map$* $Msg$::_internal_mutable_$name_internal$() { + inline $Map$* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { $PrepareSplitMessageForWrite$; $TsanDetectConcurrentMutation$; return $field_$.MutableMap(); } )cc"); p->Emit(R"cc( - inline $Map$* $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { + inline $Map$* $nonnull$ $Msg$::mutable_$name$() + ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $annotate_mutable$; // @@protoc_insertion_point(field_mutable_map:$pkg.Msg.field$) diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/message_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/message_field.cc index 7bfdaba27eeb8..30496c9522ac4 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/message_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/message_field.cc @@ -37,45 +37,38 @@ using ::google::protobuf::io::AnnotationCollector; using Sub = ::google::protobuf::io::Printer::Sub; std::vector<Sub> Vars(const FieldDescriptor* field, const Options& opts, - bool weak) { + bool is_weak, bool use_base_class) { bool split = ShouldSplit(field, opts); bool is_foreign = IsCrossFileMessage(field); std::string field_name = FieldMemberName(field, split); std::string qualified_type = FieldMessageTypeName(field, opts); std::string default_ref = QualifiedDefaultInstanceName(field->message_type(), opts); - std::string default_ptr = - QualifiedDefaultInstancePtr(field->message_type(), opts); - absl::string_view base = "::google::protobuf::MessageLite"; + std::string base = absl::StrCat( + "::", ProtobufNamespace(opts), "::", + HasDescriptorMethods(field->file(), opts) ? "Message" : "MessageLite"); return { {"Submsg", qualified_type}, - {"MemberType", !weak ? qualified_type : base}, - {"CompleteType", !is_foreign ? qualified_type : base}, + {"MemberType", use_base_class ? base : qualified_type}, {"kDefault", default_ref}, - {"kDefaultPtr", !weak - ? default_ptr - : absl::Substitute("reinterpret_cast<const $0*>($1)", - base, default_ptr)}, - {"base_cast", !is_foreign && !weak - ? "" - : absl::Substitute("reinterpret_cast<$0*>", base)}, - Sub{"weak_cast", - !weak ? "" : absl::Substitute("reinterpret_cast<$0*>", base)} + Sub{"cast_to_field", + use_base_class ? absl::Substitute("reinterpret_cast<$0*>", base) : ""} .ConditionalFunctionCall(), - Sub{"foreign_cast", + Sub{"arena_cast", !is_foreign ? "" : absl::Substitute("reinterpret_cast<$0*>", base)} .ConditionalFunctionCall(), - {"cast_field_", !weak ? field_name - : absl::Substitute("reinterpret_cast<$0*>($1)", - qualified_type, field_name)}, - {"Weak", weak ? "Weak" : ""}, - {".weak", weak ? ".weak" : ""}, - {"_weak", weak ? "_weak" : ""}, - Sub("StrongRef", - !weak ? "" - : absl::StrCat( - StrongReferenceToType(field->message_type(), opts), ";")) + {"cast_field_", use_base_class + ? absl::Substitute("reinterpret_cast<$0*>($1)", + qualified_type, field_name) + : field_name}, + {"Weak", is_weak ? "Weak" : ""}, + {".weak", is_weak ? ".weak" : ""}, + {"_weak", is_weak ? "_weak" : ""}, + Sub("StrongRef", !is_weak ? "" + : absl::StrCat(StrongReferenceToType( + field->message_type(), opts), + ";")) .WithSuffix(";"), }; } @@ -92,12 +85,12 @@ class SingularMessage : public FieldGeneratorBase { ~SingularMessage() override = default; std::vector<Sub> MakeVars() const override { - return Vars(field_, *opts_, is_weak()); + return Vars(field_, *opts_, is_weak(), is_weak()); } void GeneratePrivateMembers(io::Printer* p) const override { p->Emit(R"cc( - $MemberType$* $name$_; + $MemberType$* $nullable$ $name$_; )cc"); } @@ -131,13 +124,12 @@ class SingularMessage : public FieldGeneratorBase { } void GenerateMemberCopyConstructor(io::Printer* p) const override { - p->Emit( - "$name$_{$superclass$::CopyConstruct<$Submsg$>(arena, *from.$name$_)}"); + p->Emit("$name$_{$superclass$::CopyConstruct(arena, *from.$name$_)}"); } void GenerateOneofCopyConstruct(io::Printer* p) const override { p->Emit(R"cc( - $field$ = $superclass$::CopyConstruct<$Submsg$>(arena, *from.$field$); + $field$ = $superclass$::CopyConstruct(arena, *from.$field$); )cc"); } @@ -164,15 +156,15 @@ void SingularMessage::GenerateAccessorDeclarations(io::Printer* p) const { p->Emit(R"cc( $DEPRECATED$ const $Submsg$& $name$() const; - $DEPRECATED$ PROTOBUF_NODISCARD $Submsg$* $release_name$(); - $DEPRECATED$ $Submsg$* $mutable_name$(); - $DEPRECATED$ void $set_allocated_name$($Submsg$* value); - $DEPRECATED$ void $unsafe_arena_set_allocated_name$($Submsg$* value); - $DEPRECATED$ $Submsg$* $unsafe_arena_release_name$(); + $DEPRECATED$ [[nodiscard]] $Submsg$* $nullable$ $release_name$(); + $DEPRECATED$ $Submsg$* $nonnull$ $mutable_name$(); + $DEPRECATED$ void $set_allocated_name$($Submsg$* $nullable$ value); + $DEPRECATED$ void $unsafe_arena_set_allocated_name$($Submsg$* $nullable$ value); + $DEPRECATED$ $Submsg$* $nullable$ $unsafe_arena_release_name$(); private: const $Submsg$& _internal_$name$() const; - $Submsg$* _internal_mutable_$name$(); + $Submsg$* $nonnull$ _internal_mutable_$name$(); public: )cc"); @@ -182,132 +174,131 @@ void SingularMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { auto v = p->WithVars({{"release_name", SafeFunctionName(field_->containing_type(), field_, "release_")}}); - p->Emit( - { - {"update_hasbit", - [&] { - if (!has_hasbit_) return; - p->Emit(R"cc( - if (value != nullptr) { - $set_hasbit$ - } else { - $clear_hasbit$ - } - )cc"); - }}, - }, - R"cc( - inline const $Submsg$& $Msg$::_internal_$name_internal$() const { - $TsanDetectConcurrentRead$; - $StrongRef$; - const $Submsg$* p = $cast_field_$; - return p != nullptr ? *p : reinterpret_cast<const $Submsg$&>($kDefault$); - } - inline const $Submsg$& $Msg$::$name$() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $annotate_get$; - // @@protoc_insertion_point(field_get:$pkg.Msg.field$) - return _internal_$name_internal$(); - } - inline void $Msg$::unsafe_arena_set_allocated_$name$($Submsg$* value) { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - $PrepareSplitMessageForWrite$; - //~ If we're not on an arena, free whatever we were holding before. - //~ (If we are on arena, we can just forget the earlier pointer.) - if (GetArena() == nullptr) { - delete reinterpret_cast<$pb$::MessageLite*>($field_$); - } - $field_$ = reinterpret_cast<$MemberType$*>(value); - $update_hasbit$; - $annotate_set$; - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:$pkg.Msg.field$) - } - inline $Submsg$* $Msg$::$release_name$() { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - $StrongRef$; - $annotate_release$; - $PrepareSplitMessageForWrite$; + std::vector<Sub> subs = { + {"update_hasbit", + [&] { + if (!has_hasbit_) return; + p->Emit(R"cc( + if (value != nullptr) { + $set_hasbit$ + } else { + $clear_hasbit$ + } + )cc"); + }}, + }; + absl::string_view code = R"cc( + inline const $Submsg$& $Msg$::_internal_$name_internal$() const { + $TsanDetectConcurrentRead$; + $StrongRef$; + const $Submsg$* p = $cast_field_$; + return p != nullptr ? *p : reinterpret_cast<const $Submsg$&>($kDefault$); + } + inline const $Submsg$& $Msg$::$name$() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $annotate_get$; + // @@protoc_insertion_point(field_get:$pkg.Msg.field$) + return _internal_$name_internal$(); + } + inline void $Msg$::unsafe_arena_set_allocated_$name$( + $Submsg$* $nullable$ value) { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + $PrepareSplitMessageForWrite$; + //~ If we're not on an arena, free whatever we were holding before. + //~ (If we are on arena, we can just forget the earlier pointer.) + if (GetArena() == nullptr) { + delete reinterpret_cast<$pb$::MessageLite*>($field_$); + } + $field_$ = reinterpret_cast<$MemberType$*>(value); + $update_hasbit$; + $annotate_set$; + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:$pkg.Msg.field$) + } + inline $Submsg$* $nullable$ $Msg$::$release_name$() { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + $StrongRef$; + $annotate_release$; + $PrepareSplitMessageForWrite$; - $clear_hasbit$; - $Submsg$* released = $cast_field_$; - $field_$ = nullptr; - if ($pbi$::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<$pb$::MessageLite*>(released); - released = $pbi$::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = $pbi$::DuplicateIfNonNull(released); - } - } - return released; + $clear_hasbit$; + $Submsg$* released = $cast_field_$; + $field_$ = nullptr; + if ($pbi$::DebugHardenForceCopyInRelease()) { + auto* old = reinterpret_cast<$pb$::MessageLite*>(released); + released = $pbi$::DuplicateIfNonNull(released); + if (GetArena() == nullptr) { + delete old; } - inline $Submsg$* $Msg$::unsafe_arena_release_$name$() { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - $annotate_release$; - // @@protoc_insertion_point(field_release:$pkg.Msg.field$) - $StrongRef$; - $PrepareSplitMessageForWrite$; + } else { + if (GetArena() != nullptr) { + released = $pbi$::DuplicateIfNonNull(released); + } + } + return released; + } + inline $Submsg$* $nullable$ $Msg$::unsafe_arena_release_$name$() { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + $annotate_release$; + // @@protoc_insertion_point(field_release:$pkg.Msg.field$) + $StrongRef$; + $PrepareSplitMessageForWrite$; - $clear_hasbit$; - $Submsg$* temp = $cast_field_$; - $field_$ = nullptr; - return temp; - } - inline $Submsg$* $Msg$::_internal_mutable_$name_internal$() { - $TsanDetectConcurrentMutation$; - $StrongRef$; - if ($field_$ == nullptr) { - auto* p = $superclass$::DefaultConstruct<$Submsg$>(GetArena()); - $field_$ = reinterpret_cast<$MemberType$*>(p); - } - return $cast_field_$; - } - inline $Submsg$* $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { - //~ TODO: add tests to make sure all write accessors are - //~ able to prepare split message allocation. - $WeakDescriptorSelfPin$; - $PrepareSplitMessageForWrite$; - $set_hasbit$; - $Submsg$* _msg = _internal_mutable_$name_internal$(); - $annotate_mutable$; - // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$) - return _msg; - } - //~ We handle the most common case inline, and delegate less common - //~ cases to the slow fallback function. - inline void $Msg$::set_allocated_$name$($Submsg$* value) { - $WeakDescriptorSelfPin$; - $pb$::Arena* message_arena = GetArena(); - $TsanDetectConcurrentMutation$; - $PrepareSplitMessageForWrite$; - if (message_arena == nullptr) { - delete $base_cast$($field_$); - } + $clear_hasbit$; + $Submsg$* temp = $cast_field_$; + $field_$ = nullptr; + return temp; + } + inline $Submsg$* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { + $TsanDetectConcurrentMutation$; + $StrongRef$; + if ($field_$ == nullptr) { + auto* p = $superclass$::DefaultConstruct<$Submsg$>(GetArena()); + $field_$ = reinterpret_cast<$MemberType$*>(p); + } + return $cast_field_$; + } + inline $Submsg$* $nonnull$ $Msg$::mutable_$name$() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + //~ TODO: add tests to make sure all write accessors are + //~ able to prepare split message allocation. + $WeakDescriptorSelfPin$; + $PrepareSplitMessageForWrite$; + $set_hasbit$; + $Submsg$* _msg = _internal_mutable_$name_internal$(); + $annotate_mutable$; + // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$) + return _msg; + } + //~ We handle the most common case inline, and delegate less common + //~ cases to the slow fallback function. + inline void $Msg$::set_allocated_$name$($Submsg$* $nullable$ value) { + $WeakDescriptorSelfPin$; + $pb$::Arena* message_arena = GetArena(); + $TsanDetectConcurrentMutation$; + $PrepareSplitMessageForWrite$; + if (message_arena == nullptr) { + delete reinterpret_cast<$pb$::MessageLite*>($field_$); + } - if (value != nullptr) { - //~ When $Submsg$ is a cross-file type, have to read the arena - //~ through the virtual method, because the type isn't defined in - //~ this file, only forward-declared. - $pb$::Arena* submessage_arena = $base_cast$(value)->GetArena(); - if (message_arena != submessage_arena) { - value = $pbi$::GetOwnedMessage(message_arena, value, submessage_arena); - } - $set_hasbit$; - } else { - $clear_hasbit$; - } - - $field_$ = reinterpret_cast<$MemberType$*>(value); - $annotate_set$; - // @@protoc_insertion_point(field_set_allocated:$pkg.Msg.field$) + if (value != nullptr) { + $pb$::Arena* submessage_arena = $arena_cast$(value)->GetArena(); + if (message_arena != submessage_arena) { + value = $pbi$::GetOwnedMessage(message_arena, value, submessage_arena); } - )cc"); + $set_hasbit$; + } else { + $clear_hasbit$; + } + + $field_$ = reinterpret_cast<$MemberType$*>(value); + $annotate_set$; + // @@protoc_insertion_point(field_set_allocated:$pkg.Msg.field$) + } + )cc"; + p->Emit(subs, code); } void SingularMessage::GenerateClearingCode(io::Printer* p) const { @@ -359,8 +350,7 @@ void SingularMessage::GenerateMergingCode(io::Printer* p) const { p->Emit(R"cc( $DCHK$(from.$field_$ != nullptr); if (_this->$field_$ == nullptr) { - _this->$field_$ = - $superclass$::CopyConstruct<$Submsg$>(arena, *from.$field_$); + _this->$field_$ = $superclass$::CopyConstruct(arena, *from.$field_$); } else { _this->$field_$->MergeFrom(*from.$field_$); } @@ -388,8 +378,7 @@ void SingularMessage::GenerateCopyConstructorCode(io::Printer* p) const { ABSL_CHECK(has_hasbit_); p->Emit(R"cc( if ((from.$has_hasbit$) != 0) { - _this->$field_$ = - $superclass$::CopyConstruct<$Submsg$>(arena, *from.$field_$); + _this->$field_$ = $superclass$::CopyConstruct(arena, *from.$field_$); } )cc"); } @@ -467,10 +456,44 @@ class OneofMessage : public SingularMessage { public: OneofMessage(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer) - : SingularMessage(descriptor, options, scc_analyzer) {} + : SingularMessage(descriptor, options, scc_analyzer) { + auto* oneof = descriptor->containing_oneof(); + num_message_fields_in_oneof_ = 0; + for (int i = 0; i < oneof->field_count(); ++i) { + num_message_fields_in_oneof_ += + oneof->field(i)->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE; + } + } ~OneofMessage() override = default; + bool use_base_class() const { + if (is_weak()) return true; + + // For non-weak oneof fields, we choose to use a base class pointer when the + // oneof has many message fields in it. Using a base class here is not + // about correctness, but about performance and binary size. + // + // This allows the compiler to merge all the different switch cases (since + // the code is identical for all message alternatives) reducing binary size. + // The runtime dispatch is effectively changed from a switch statement to a + // virtual function call. For many oneofs, it completely elides the switch + // dispatch. + // + // This constant is a tradeoff. We want to allow optimizations (like + // inlining) on small oneofs. For small oneofs the compiler can use faster + // alternatives to table-based jumps. Also, the technique used here has less + // of a binary size win for small oneofs. + static constexpr int kMaxStaticTypeCount = 3; + return num_message_fields_in_oneof_ >= kMaxStaticTypeCount && + // Hot alternatives are kept as their static type for performance.. + !IsLikelyPresent(field_, *opts_); + } + + std::vector<Sub> MakeVars() const override { + return Vars(field_, *opts_, is_weak(), use_base_class()); + } + void GenerateInlineAccessorDefinitions(io::Printer* p) const override; void GenerateNonInlineAccessorDefinitions(io::Printer* p) const override; void GenerateClearingCode(io::Printer* p) const override; @@ -483,15 +506,18 @@ class OneofMessage : public SingularMessage { bool NeedsIsInitialized() const override; void GenerateMergingCode(io::Printer* p) const override; bool RequiresArena(GeneratorFunction func) const override; + + private: + int num_message_fields_in_oneof_; }; void OneofMessage::GenerateNonInlineAccessorDefinitions(io::Printer* p) const { p->Emit(R"cc( - void $Msg$::set_allocated_$name$($Submsg$* $name$) { + void $Msg$::set_allocated_$name$($Submsg$* $nullable$ $name$) { $pb$::Arena* message_arena = GetArena(); clear_$oneof_name$(); if ($name$) { - $pb$::Arena* submessage_arena = $foreign_cast$($name$)->GetArena(); + $pb$::Arena* submessage_arena = $arena_cast$($name$)->GetArena(); if (message_arena != submessage_arena) { $name$ = $pbi$::GetOwnedMessage(message_arena, $name$, submessage_arena); } @@ -510,7 +536,7 @@ void OneofMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { field_, "release_")}}); p->Emit(R"cc( - inline $Submsg$* $Msg$::$release_name$() { + inline $Submsg$* $nullable$ $Msg$::$release_name$() { $WeakDescriptorSelfPin$; $annotate_release$; // @@protoc_insertion_point(field_release:$pkg.Msg.field$) @@ -543,7 +569,7 @@ void OneofMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { } )cc"); p->Emit(R"cc( - inline $Submsg$* $Msg$::unsafe_arena_release_$name$() { + inline $Submsg$* $nullable$ $Msg$::unsafe_arena_release_$name$() { $WeakDescriptorSelfPin$; $annotate_release$; // @@protoc_insertion_point(field_unsafe_arena_release:$pkg.Msg.field$) @@ -559,7 +585,8 @@ void OneofMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { } )cc"); p->Emit(R"cc( - inline void $Msg$::unsafe_arena_set_allocated_$name$($Submsg$* value) { + inline void $Msg$::unsafe_arena_set_allocated_$name$( + $Submsg$* $nullable$ value) { $WeakDescriptorSelfPin$; // We rely on the oneof clear method to free the earlier contents // of this oneof. We can directly use the pointer we're given to @@ -567,26 +594,27 @@ void OneofMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { clear_$oneof_name$(); if (value) { set_has_$name_internal$(); - $field_$ = $weak_cast$(value); + $field_$ = $cast_to_field$(value); } $annotate_set$; // @@protoc_insertion_point(field_unsafe_arena_set_allocated:$pkg.Msg.field$) } )cc"); p->Emit(R"cc( - inline $Submsg$* $Msg$::_internal_mutable_$name_internal$() { + inline $Submsg$* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { $StrongRef$; if ($not_has_field$) { clear_$oneof_name$(); set_has_$name_internal$(); - $field_$ = - $weak_cast$($superclass$::DefaultConstruct<$Submsg$>(GetArena())); + $field_$ = $cast_to_field$( + $superclass$::DefaultConstruct<$Submsg$>(GetArena())); } return $cast_field_$; } )cc"); p->Emit(R"cc( - inline $Submsg$* $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { + inline $Submsg$* $nonnull$ $Msg$::mutable_$name$() + ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $Submsg$* _msg = _internal_mutable_$name_internal$(); $annotate_mutable$; @@ -642,8 +670,7 @@ void OneofMessage::GenerateCopyConstructorCode(io::Printer* p) const { ABSL_CHECK(!has_hasbit_); p->Emit(R"cc( if (from._internal_has_$name$()) { - _this->$field_$ = - $superclass$::CopyConstruct<$Submsg$>(arena, *from.$field_$); + _this->$field_$ = $superclass$::CopyConstruct(arena, *from.$field_$); } )cc"); } @@ -660,23 +687,17 @@ void OneofMessage::GenerateIsInitialized(io::Printer* p) const { bool OneofMessage::NeedsIsInitialized() const { return has_required_; } void OneofMessage::GenerateMergingCode(io::Printer* p) const { - if (is_weak()) { - p->Emit(R"cc( - if (oneof_needs_init) { - _this->$field_$ = from.$field_$->New(arena); - } - _this->$field_$->CheckTypeAndMergeFrom(*from.$field_$); - )cc"); - } else { - p->Emit(R"cc( - if (oneof_needs_init) { - _this->$field_$ = - $superclass$::CopyConstruct<$Submsg$>(arena, *from.$field_$); - } else { - _this->$field_$->MergeFrom(from._internal_$name$()); - } - )cc"); - } + p->Emit({{"merge", + use_base_class() && !HasDescriptorMethods(field_->file(), options_) + ? "CheckTypeAndMergeFrom" + : "MergeFrom"}}, + R"cc( + if (oneof_needs_init) { + _this->$field_$ = $superclass$::CopyConstruct(arena, *from.$field_$); + } else { + _this->$field_$->$merge$(*from.$field_$); + } + )cc"); } bool OneofMessage::RequiresArena(GeneratorFunction func) const { @@ -698,7 +719,7 @@ class RepeatedMessage : public FieldGeneratorBase { ~RepeatedMessage() override = default; std::vector<Sub> MakeVars() const override { - return Vars(field_, *opts_, is_weak()); + return Vars(field_, *opts_, is_weak(), is_weak()); } void GeneratePrivateMembers(io::Printer* p) const override; @@ -739,41 +760,43 @@ void RepeatedMessage::GenerateAccessorDeclarations(io::Printer* p) const { io::AnnotationCollector::kAlias)); p->Emit(R"cc( - $DEPRECATED$ $Submsg$* $mutable_name$(int index); - $DEPRECATED$ $pb$::RepeatedPtrField<$Submsg$>* $mutable_name$(); + $DEPRECATED$ $Submsg$* $nonnull$ $mutable_name$(int index); + $DEPRECATED$ $pb$::RepeatedPtrField<$Submsg$>* $nonnull$ $mutable_name$(); private: const $pb$::RepeatedPtrField<$Submsg$>& $_internal_name$() const; - $pb$::RepeatedPtrField<$Submsg$>* $_internal_mutable_name$(); + $pb$::RepeatedPtrField<$Submsg$>* $nonnull$ $_internal_mutable_name$(); )cc"); if (is_weak()) { p->Emit(R"cc( const $pb$::WeakRepeatedPtrField<$Submsg$>& _internal_weak_$name$() const; - $pb$::WeakRepeatedPtrField<$Submsg$>* _internal_mutable_weak_$name$(); + $pb$::WeakRepeatedPtrField<$Submsg$>* $nonnull$ _internal_mutable_weak_$name$(); )cc"); } p->Emit(R"cc( public: $DEPRECATED$ const $Submsg$& $name$(int index) const; - $DEPRECATED$ $Submsg$* $add_name$(); + $DEPRECATED$ $Submsg$* $nonnull$ $add_name$(); $DEPRECATED$ const $pb$::RepeatedPtrField<$Submsg$>& $name$() const; )cc"); } void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { // TODO: move insertion points + p->Emit({GetEmitRepeatedFieldMutableSub(*opts_, p)}, + R"cc( + inline $Submsg$* $nonnull$ $Msg$::mutable_$name$(int index) + ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $annotate_mutable$; + // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$) + $StrongRef$; + return $mutable$; + } + )cc"); + p->Emit(R"cc( - inline $Submsg$* $Msg$::mutable_$name$(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $annotate_mutable$; - // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$) - $StrongRef$; - return _internal_mutable_$name_internal$()->Mutable(index); - } - )cc"); - p->Emit(R"cc( - inline $pb$::RepeatedPtrField<$Submsg$>* $Msg$::mutable_$name$() + inline $pb$::RepeatedPtrField<$Submsg$>* $nonnull$ $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $annotate_mutable_list$; @@ -783,28 +806,20 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { return _internal_mutable_$name_internal$(); } )cc"); - p->Emit( - { - {"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"}, - {"GetExtraArg", - [&] { - p->Emit(opts_->safe_boundary_check - ? ", reinterpret_cast<const $Submsg$&>($kDefault$)" - : ""); - }}, - }, - R"cc( - inline const $Submsg$& $Msg$::$name$(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $annotate_get$; - // @@protoc_insertion_point(field_get:$pkg.Msg.field$) - $StrongRef$; - return _internal_$name_internal$().$Get$(index$GetExtraArg$); - } - )cc"); + p->Emit({GetEmitRepeatedFieldGetterSub(*opts_, p)}, + R"cc( + inline const $Submsg$& $Msg$::$name$(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $annotate_get$; + // @@protoc_insertion_point(field_get:$pkg.Msg.field$) + $StrongRef$; + return $getter$; + } + )cc"); p->Emit(R"cc( - inline $Submsg$* $Msg$::add_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { + inline $Submsg$* $nonnull$ $Msg$::add_$name$() + ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $TsanDetectConcurrentMutation$; $Submsg$* _add = _internal_mutable_$name_internal$()->Add(); @@ -831,7 +846,7 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { $TsanDetectConcurrentRead$; return *$field_$; } - inline $pb$::$Weak$RepeatedPtrField<$Submsg$>* + inline $pb$::$Weak$RepeatedPtrField<$Submsg$>* $nonnull$ $Msg$::_internal_mutable$_weak$_$name_internal$() { $TsanDetectConcurrentRead$; $PrepareSplitMessageForWrite$; @@ -849,7 +864,7 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { $TsanDetectConcurrentRead$; return $field_$; } - inline $pb$::$Weak$RepeatedPtrField<$Submsg$>* + inline $pb$::$Weak$RepeatedPtrField<$Submsg$>* $nonnull$ $Msg$::_internal_mutable$_weak$_$name_internal$() { $TsanDetectConcurrentRead$; return &$field_$; @@ -862,7 +877,7 @@ void RepeatedMessage::GenerateInlineAccessorDefinitions(io::Printer* p) const { $Msg$::_internal_$name_internal$() const { return _internal_weak_$name_internal$().weak; } - inline $pb$::RepeatedPtrField<$Submsg$>* + inline $pb$::RepeatedPtrField<$Submsg$>* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { return &_internal_mutable_weak_$name_internal$()->weak; } diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc index 5a40629d2c9bc..ffbce44c0d149 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc @@ -246,8 +246,8 @@ void SingularPrimitive::GenerateSerializeWithCachedSizesToArray( // template parameter that handles the EnsureSpace and the writing // of the tag+value to the array p->Emit(R"cc( - target = ::$proto_ns$::internal::WireFormatLite:: - Write$declared_type$ToArrayWithField<$number$>( + target = + $pbi$::WireFormatLite::Write$declared_type$ToArrayWithField<$number$>( stream, this_._internal_$name$(), target); )cc"); } else { @@ -454,11 +454,11 @@ void RepeatedPrimitive::GenerateAccessorDeclarations(io::Printer* p) const { $DEPRECATED$ void $set_name$(int index, $Type$ value); $DEPRECATED$ void $add_name$($Type$ value); $DEPRECATED$ const $pb$::RepeatedField<$Type$>& $name$() const; - $DEPRECATED$ $pb$::RepeatedField<$Type$>* $mutable_name$(); + $DEPRECATED$ $pb$::RepeatedField<$Type$>* $nonnull$ $mutable_name$(); private: const $pb$::RepeatedField<$Type$>& $_internal_name$() const; - $pb$::RepeatedField<$Type$>* $_internal_mutable_name$(); + $pb$::RepeatedField<$Type$>* $nonnull$ $_internal_mutable_name$(); public: )cc"); @@ -501,7 +501,7 @@ void RepeatedPrimitive::GenerateInlineAccessorDefinitions( } )cc"); p->Emit(R"cc( - inline $pb$::RepeatedField<$Type$>* $Msg$::mutable_$name$() + inline $pb$::RepeatedField<$Type$>* $nonnull$ $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $annotate_mutable_list$; @@ -518,7 +518,8 @@ void RepeatedPrimitive::GenerateInlineAccessorDefinitions( $TsanDetectConcurrentRead$; return *$field_$; } - inline $pb$::RepeatedField<$Type$>* $Msg$::_internal_mutable_$name_internal$() { + inline $pb$::RepeatedField<$Type$>* $nonnull$ + $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; $PrepareSplitMessageForWrite$; if ($field_$.IsDefault()) { @@ -534,7 +535,8 @@ void RepeatedPrimitive::GenerateInlineAccessorDefinitions( $TsanDetectConcurrentRead$; return $field_$; } - inline $pb$::RepeatedField<$Type$>* $Msg$::_internal_mutable_$name_internal$() { + inline $pb$::RepeatedField<$Type$>* $nonnull$ + $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; return &$field_$; } @@ -625,7 +627,7 @@ void RepeatedPrimitive::GenerateByteSize(io::Printer* p) const { data_size == 0 ? 0 : $kTagBytes$ + ::_pbi::WireFormatLite::Int32Size( - static_cast<int32_t>(data_size)); + static_cast<::int32_t>(data_size)); )cc"); } else { p->Emit(R"cc( diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_field.cc index 88635e3a88133..f135cd2f76462 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_field.cc @@ -16,6 +16,7 @@ #include "absl/log/absl_check.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "google/protobuf/compiler/cpp/field.h" #include "google/protobuf/compiler/cpp/field_generators/generators.h" #include "google/protobuf/compiler/cpp/helpers.h" @@ -234,10 +235,7 @@ void SingularString::GenerateAccessorDeclarations(io::Printer* p) const { // files that applied the ctype. The field can still be accessed via the // reflection interface since the reflection interface is independent of // the string's underlying representation. - bool unknown_ctype = - field_->options().ctype() != internal::cpp::EffectiveStringCType(field_); - - if (unknown_ctype) { + if (internal::cpp::IsStringFieldWithPrivatizedAccessors(*field_)) { p->Emit(R"cc( private: // Hidden due to unknown ctype option. )cc"); @@ -255,35 +253,33 @@ void SingularString::GenerateAccessorDeclarations(io::Printer* p) const { auto v3 = p->WithVars( AnnotatedAccessors(field_, {"mutable_"}, AnnotationCollector::kAlias)); - p->Emit( - {{"donated", - [&] { - if (!is_inlined()) return; - p->Emit(R"cc( - inline PROTOBUF_ALWAYS_INLINE bool _internal_$name$_donated() const; + p->Emit({{"donated", + [&] { + if (!is_inlined()) return; + p->Emit(R"cc( + PROTOBUF_ALWAYS_INLINE bool _internal_$name$_donated() const; + )cc"); + }}}, + R"cc( + $DEPRECATED$ const std::string& $name$() const; + //~ Using `Arg_ = const std::string&` will make the type of `arg` + //~ default to `const std::string&`, due to reference collapse. This + //~ is necessary because there are a handful of users that rely on + //~ this default. + template <typename Arg_ = const std::string&, typename... Args_> + $DEPRECATED$ void $set_name$(Arg_&& arg, Args_... args); + $DEPRECATED$ std::string* $nonnull$ $mutable_name$(); + $DEPRECATED$ [[nodiscard]] std::string* $nullable$ $release_name$(); + $DEPRECATED$ void $set_allocated_name$(std::string* $nullable$ value); + + private: + const std::string& _internal_$name$() const; + PROTOBUF_ALWAYS_INLINE void _internal_set_$name$(const std::string& value); + std::string* $nonnull$ _internal_mutable_$name$(); + $donated$; + + public: )cc"); - }}}, - R"cc( - $DEPRECATED$ const std::string& $name$() const; - //~ Using `Arg_ = const std::string&` will make the type of `arg` - //~ default to `const std::string&`, due to reference collapse. This is - //~ necessary because there are a handful of users that rely on this - //~ default. - template <typename Arg_ = const std::string&, typename... Args_> - $DEPRECATED$ void $set_name$(Arg_&& arg, Args_... args); - $DEPRECATED$ std::string* $mutable_name$(); - $DEPRECATED$ PROTOBUF_NODISCARD std::string* $release_name$(); - $DEPRECATED$ void $set_allocated_name$(std::string* value); - - private: - const std::string& _internal_$name$() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_$name$( - const std::string& value); - std::string* _internal_mutable_$name$(); - $donated$; - - public: - )cc"); } void UpdateHasbitSet(io::Printer* p, bool is_oneof) { @@ -414,95 +410,95 @@ void SingularString::SetAllocatedImpl(io::Printer* p) const { } void SingularString::GenerateInlineAccessorDefinitions(io::Printer* p) const { - p->Emit( - { - {"if_IsDefault", - [&] { - if (EmptyDefault() || is_oneof()) return; - p->Emit(R"cc( - if ($field_$.IsDefault()) { - return $default_variable_field$.get(); - } - )cc"); - }}, - {"update_hasbit", [&] { UpdateHasbitSet(p, is_oneof()); }}, - {"set_args", [&] { ArgsForSetter(p, is_inlined()); }}, - {"check_hasbit", - [&] { - if (!is_oneof()) return; - p->Emit(R"cc( - if ($not_has_field$) { - return $kDefaultStr$; - } - )cc"); - }}, - {"release_name", - SafeFunctionName(field_->containing_type(), field_, "release_")}, - {"release_impl", [&] { ReleaseImpl(p); }}, - {"set_allocated_impl", [&] { SetAllocatedImpl(p); }}, - }, + std::vector<Sub> vars = { + {"if_IsDefault", + [&] { + if (EmptyDefault() || is_oneof()) return; + p->Emit(R"cc( + if ($field_$.IsDefault()) { + return $default_variable_field$.get(); + } + )cc"); + }}, + {"update_hasbit", [&] { UpdateHasbitSet(p, is_oneof()); }}, + {"set_args", [&] { ArgsForSetter(p, is_inlined()); }}, + {"check_hasbit", + [&] { + if (!is_oneof()) return; + p->Emit(R"cc( + if ($not_has_field$) { + return $kDefaultStr$; + } + )cc"); + }}, + {"release_name", + SafeFunctionName(field_->containing_type(), field_, "release_")}, + {"release_impl", [&] { ReleaseImpl(p); }}, + {"set_allocated_impl", [&] { SetAllocatedImpl(p); }}, + }; + absl::string_view code = R"cc( - inline const std::string& $Msg$::$name$() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $annotate_get$; - // @@protoc_insertion_point(field_get:$pkg.Msg.field$) - $if_IsDefault$; - return _internal_$name_internal$(); - } - template <typename Arg_, typename... Args_> - inline PROTOBUF_ALWAYS_INLINE void $Msg$::set_$name$(Arg_&& arg, - Args_... args) { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - $PrepareSplitMessageForWrite$; - $update_hasbit$; - $field_$.$Set$(static_cast<Arg_&&>(arg), args..., $set_args$); - $annotate_set$; - // @@protoc_insertion_point(field_set:$pkg.Msg.field$) - } - inline std::string* $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $PrepareSplitMessageForWrite$; - std::string* _s = _internal_mutable_$name_internal$(); - $annotate_mutable$; - // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$) - return _s; - } - inline const std::string& $Msg$::_internal_$name_internal$() const { - $TsanDetectConcurrentRead$; - $check_hasbit$; - return $field_$.Get(); - } - inline void $Msg$::_internal_set_$name_internal$(const std::string& value) { - $TsanDetectConcurrentMutation$; - $update_hasbit$; - //~ Don't use $Set$ here; we always want the std::string variant - //~ regardless of whether this is a `bytes` field. - $field_$.Set(value, $set_args$); - } - inline std::string* $Msg$::_internal_mutable_$name_internal$() { - $TsanDetectConcurrentMutation$; - $update_hasbit$; - return $field_$.Mutable($lazy_args$, $set_args$); - } - inline std::string* $Msg$::$release_name$() { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - $annotate_release$; - $PrepareSplitMessageForWrite$; - // @@protoc_insertion_point(field_release:$pkg.Msg.field$) - $release_impl$; - } - inline void $Msg$::set_allocated_$name$(std::string* value) { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - $PrepareSplitMessageForWrite$; - $set_allocated_impl$; - $annotate_set$; - // @@protoc_insertion_point(field_set_allocated:$pkg.Msg.field$) - } - )cc"); + inline const std::string& $Msg$::$name$() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $annotate_get$; + // @@protoc_insertion_point(field_get:$pkg.Msg.field$) + $if_IsDefault$; + return _internal_$name_internal$(); + } + template <typename Arg_, typename... Args_> + PROTOBUF_ALWAYS_INLINE void $Msg$::set_$name$(Arg_&& arg, Args_... args) { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + $PrepareSplitMessageForWrite$; + $update_hasbit$; + $field_$.$Set$(static_cast<Arg_&&>(arg), args..., $set_args$); + $annotate_set$; + // @@protoc_insertion_point(field_set:$pkg.Msg.field$) + } + inline std::string* $nonnull$ $Msg$::mutable_$name$() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $PrepareSplitMessageForWrite$; + std::string* _s = _internal_mutable_$name_internal$(); + $annotate_mutable$; + // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$) + return _s; + } + inline const std::string& $Msg$::_internal_$name_internal$() const { + $TsanDetectConcurrentRead$; + $check_hasbit$; + return $field_$.Get(); + } + inline void $Msg$::_internal_set_$name_internal$(const std::string& value) { + $TsanDetectConcurrentMutation$; + $update_hasbit$; + //~ Don't use $Set$ here; we always want the std::string variant + //~ regardless of whether this is a `bytes` field. + $field_$.Set(value, $set_args$); + } + inline std::string* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { + $TsanDetectConcurrentMutation$; + $update_hasbit$; + return $field_$.Mutable($lazy_args$, $set_args$); + } + inline std::string* $nullable$ $Msg$::$release_name$() { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + $annotate_release$; + $PrepareSplitMessageForWrite$; + // @@protoc_insertion_point(field_release:$pkg.Msg.field$) + $release_impl$; + } + inline void $Msg$::set_allocated_$name$(std::string* $nullable$ value) { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + $PrepareSplitMessageForWrite$; + $set_allocated_impl$; + $annotate_set$; + // @@protoc_insertion_point(field_set_allocated:$pkg.Msg.field$) + })cc"; + p->Emit(vars, code); if (is_inlined()) { p->Emit(R"cc( @@ -820,10 +816,7 @@ class RepeatedString : public FieldGeneratorBase { }; void RepeatedString::GenerateAccessorDeclarations(io::Printer* p) const { - bool unknown_ctype = - field_->options().ctype() != internal::cpp::EffectiveStringCType(field_); - - if (unknown_ctype) { + if (internal::cpp::IsStringFieldWithPrivatizedAccessors(*field_)) { p->Emit(R"cc( private: // Hidden due to unknown ctype option. )cc"); @@ -837,18 +830,18 @@ void RepeatedString::GenerateAccessorDeclarations(io::Printer* p) const { p->Emit(R"cc( $DEPRECATED$ const std::string& $name$(int index) const; - $DEPRECATED$ std::string* $mutable_name$(int index); + $DEPRECATED$ std::string* $nonnull$ $mutable_name$(int index); template <typename Arg_ = const std::string&, typename... Args_> $DEPRECATED$ void set_$name$(int index, Arg_&& value, Args_... args); - $DEPRECATED$ std::string* $add_name$(); + $DEPRECATED$ std::string* $nonnull$ $add_name$(); template <typename Arg_ = const std::string&, typename... Args_> $DEPRECATED$ void $add_name$(Arg_&& value, Args_... args); $DEPRECATED$ const $pb$::RepeatedPtrField<std::string>& $name$() const; - $DEPRECATED$ $pb$::RepeatedPtrField<std::string>* $mutable_name$(); + $DEPRECATED$ $pb$::RepeatedPtrField<std::string>* $nonnull$ $mutable_name$(); private: const $pb$::RepeatedPtrField<std::string>& _internal_$name$() const; - $pb$::RepeatedPtrField<std::string>* _internal_mutable_$name$(); + $pb$::RepeatedPtrField<std::string>* $nonnull$ _internal_mutable_$name$(); public: )cc"); @@ -858,22 +851,18 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const { bool bytes = field_->type() == FieldDescriptor::TYPE_BYTES; p->Emit( { - {"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"}, - {"GetExtraArg", - [&] { - p->Emit(opts_->safe_boundary_check - ? ", $pbi$::GetEmptyStringAlreadyInited()" - : ""); - }}, + GetEmitRepeatedFieldGetterSub(*opts_, p), {"bytes_tag", [&] { if (bytes) { p->Emit(", $pbi$::BytesTag{}"); } }}, + GetEmitRepeatedFieldMutableSub(*opts_, p), }, R"cc( - inline std::string* $Msg$::add_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { + inline std::string* $nonnull$ $Msg$::add_$name$() + ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $TsanDetectConcurrentMutation$; std::string* _s = _internal_mutable_$name_internal$()->Add(); @@ -886,21 +875,20 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const { $WeakDescriptorSelfPin$; $annotate_get$; // @@protoc_insertion_point(field_get:$pkg.Msg.field$) - return _internal_$name_internal$().$Get$(index$GetExtraArg$); + return $getter$; } - inline std::string* $Msg$::mutable_$name$(int index) + inline std::string* $nonnull$ $Msg$::mutable_$name$(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $annotate_mutable$; // @@protoc_insertion_point(field_mutable:$pkg.Msg.field$) - return _internal_mutable_$name_internal$()->Mutable(index); + return $mutable$; } template <typename Arg_, typename... Args_> inline void $Msg$::set_$name$(int index, Arg_&& value, Args_... args) { $WeakDescriptorSelfPin$; - $pbi$::AssignToString( - *_internal_mutable_$name_internal$()->Mutable(index), - std::forward<Arg_>(value), args... $bytes_tag$); + $pbi$::AssignToString(*$mutable$, std::forward<Arg_>(value), + args... $bytes_tag$); $annotate_set$; // @@protoc_insertion_point(field_set:$pkg.Msg.field$) } @@ -914,14 +902,14 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const { $annotate_add$; // @@protoc_insertion_point(field_add:$pkg.Msg.field$) } - inline const ::$proto_ns$::RepeatedPtrField<std::string>& - $Msg$::$name$() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + inline const $pb$::RepeatedPtrField<std::string>& $Msg$::$name$() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $annotate_list$; // @@protoc_insertion_point(field_list:$pkg.Msg.field$) return _internal_$name_internal$(); } - inline ::$proto_ns$::RepeatedPtrField<std::string>* + inline $pb$::RepeatedPtrField<std::string>* $nonnull$ $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { $WeakDescriptorSelfPin$; $annotate_mutable_list$; @@ -937,7 +925,7 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const { $TsanDetectConcurrentRead$; return *$field_$; } - inline $pb$::RepeatedPtrField<std::string>* + inline $pb$::RepeatedPtrField<std::string>* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; $PrepareSplitMessageForWrite$; @@ -950,12 +938,12 @@ void RepeatedString::GenerateInlineAccessorDefinitions(io::Printer* p) const { )cc"); } else { p->Emit(R"cc( - inline const ::$proto_ns$::RepeatedPtrField<std::string>& + inline const $pb$::RepeatedPtrField<std::string>& $Msg$::_internal_$name_internal$() const { $TsanDetectConcurrentRead$; return $field_$; } - inline ::$proto_ns$::RepeatedPtrField<std::string>* + inline $pb$::RepeatedPtrField<std::string>* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; return &$field_$; diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc index 43a4beb8814b2..7c85ca9fa7974 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/field_generators/string_view_field.cc @@ -220,27 +220,25 @@ void SingularStringView::GenerateAccessorDeclarations(io::Printer* p) const { auto v2 = p->WithVars( AnnotatedAccessors(field_, {"set_"}, AnnotationCollector::kSet)); - p->Emit( - {{"donated", - [&] { - if (!is_inlined()) return; - p->Emit(R"cc( - inline PROTOBUF_ALWAYS_INLINE bool _internal_$name$_donated() const; + p->Emit({{"donated", + [&] { + if (!is_inlined()) return; + p->Emit(R"cc( + PROTOBUF_ALWAYS_INLINE bool _internal_$name$_donated() const; + )cc"); + }}}, + R"cc( + $DEPRECATED$ absl::string_view $name$() const; + template <typename Arg_ = std::string&&> + $DEPRECATED$ void $set_name$(Arg_&& arg); + + private: + const std::string& _internal_$name$() const; + PROTOBUF_ALWAYS_INLINE void _internal_set_$name$(absl::string_view value); + $donated$; + + public: )cc"); - }}}, - R"cc( - $DEPRECATED$ absl::string_view $name$() const; - template <typename Arg_ = std::string&&> - $DEPRECATED$ void $set_name$(Arg_&& arg); - - private: - const std::string& _internal_$name$() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_$name$( - absl::string_view value); - $donated$; - - public: - )cc"); } void UpdateHasbitSet(io::Printer* p, bool is_oneof) { @@ -306,7 +304,7 @@ void SingularStringView::GenerateInlineAccessorDefinitions( return _internal_$name_internal$(); } template <typename Arg_> - inline PROTOBUF_ALWAYS_INLINE void $Msg$::set_$name$(Arg_&& arg) { + PROTOBUF_ALWAYS_INLINE void $Msg$::set_$name$(Arg_&& arg) { $WeakDescriptorSelfPin$; $TsanDetectConcurrentMutation$; $PrepareSplitMessageForWrite$; @@ -637,14 +635,7 @@ class RepeatedStringView : public FieldGeneratorBase { }; void RepeatedStringView::GenerateAccessorDeclarations(io::Printer* p) const { - bool unknown_ctype = - field_->options().ctype() != internal::cpp::EffectiveStringCType(field_); - - if (unknown_ctype) { - p->Emit(R"cc( - private: // Hidden due to unknown ctype option. - )cc"); - } + ABSL_DCHECK(GetDeclaredStringType() == pb::CppFeatures::VIEW); auto v1 = p->WithVars(AnnotatedAccessors(field_, {"", "_internal_"})); auto v2 = p->WithVars( @@ -656,18 +647,18 @@ void RepeatedStringView::GenerateAccessorDeclarations(io::Printer* p) const { $DEPRECATED$ absl::string_view $name$(int index) const; $DEPRECATED$ void $set_name$(int index, const std::string& value); $DEPRECATED$ void $set_name$(int index, std::string&& value); - $DEPRECATED$ void $set_name$(int index, const char* value); + $DEPRECATED$ void $set_name$(int index, const char* $nonnull$ value); $DEPRECATED$ void $set_name$(int index, absl::string_view value); $DEPRECATED$ void $add_name$(const std::string& value); $DEPRECATED$ void $add_name$(std::string&& value); - $DEPRECATED$ void $add_name$(const char* value); + $DEPRECATED$ void $add_name$(const char* $nonnull$ value); $DEPRECATED$ void $add_name$(absl::string_view value); $DEPRECATED$ const $pb$::RepeatedPtrField<std::string>& $name$() const; - $DEPRECATED$ $pb$::RepeatedPtrField<std::string>* $mutable_name$(); + $DEPRECATED$ $pb$::RepeatedPtrField<std::string>* $nonnull$ $mutable_name$(); private: const $pb$::RepeatedPtrField<std::string>& _internal_$name$() const; - $pb$::RepeatedPtrField<std::string>* _internal_mutable_$name$(); + $pb$::RepeatedPtrField<std::string>* $nonnull$ _internal_mutable_$name$(); public: )cc"); @@ -675,93 +666,90 @@ void RepeatedStringView::GenerateAccessorDeclarations(io::Printer* p) const { void RepeatedStringView::GenerateInlineAccessorDefinitions( io::Printer* p) const { - p->Emit({{"Get", opts_->safe_boundary_check ? "InternalCheckedGet" : "Get"}, - {"GetExtraArg", - [&] { - p->Emit(opts_->safe_boundary_check - ? ", $pbi$::GetEmptyStringAlreadyInited()" - : ""); - }}}, - R"cc( - inline absl::string_view $Msg$::$name$(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $annotate_get$; - // @@protoc_insertion_point(field_get:$pkg.Msg.field$) - return _internal_$name_internal$().$Get$(index$GetExtraArg$); - } - inline void $Msg$::set_$name$(int index, const std::string& value) { - $WeakDescriptorSelfPin$; - _internal_mutable_$name_internal$()->Mutable(index)->assign(value); - $annotate_set$; - // @@protoc_insertion_point(field_set:$pkg.Msg.field$) - } - inline void $Msg$::set_$name$(int index, std::string&& value) { - $WeakDescriptorSelfPin$; - _internal_mutable_$name_internal$()->Mutable(index)->assign(std::move(value)); - $annotate_set$; - // @@protoc_insertion_point(field_set:$pkg.Msg.field$) - } - inline void $Msg$::set_$name$(int index, const char* value) { - $WeakDescriptorSelfPin$; - $DCHK$(value != nullptr); - _internal_mutable_$name_internal$()->Mutable(index)->assign(value); - $annotate_set$; - // @@protoc_insertion_point(field_set_char:$pkg.Msg.field$) - } - inline void $Msg$::set_$name$(int index, absl::string_view value) { - $WeakDescriptorSelfPin$; - _internal_mutable_$name_internal$()->Mutable(index)->assign( - value.data(), value.size()); - $annotate_set$; - // @@protoc_insertion_point(field_set_string_piece:$pkg.Msg.field$) - } - inline void $Msg$::add_$name$(const std::string& value) { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - _internal_mutable_$name_internal$()->Add()->assign(value); - $annotate_add$; - // @@protoc_insertion_point(field_add:$pkg.Msg.field$) - } - inline void $Msg$::add_$name$(std::string&& value) { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - _internal_mutable_$name_internal$()->Add(std::move(value)); - $annotate_add$; - // @@protoc_insertion_point(field_add:$pkg.Msg.field$) - } - inline void $Msg$::add_$name$(const char* value) { - $WeakDescriptorSelfPin$; - $DCHK$(value != nullptr); - $TsanDetectConcurrentMutation$; - _internal_mutable_$name_internal$()->Add()->assign(value); - $annotate_add$; - // @@protoc_insertion_point(field_add_char:$pkg.Msg.field$) - } - inline void $Msg$::add_$name$(absl::string_view value) { - $WeakDescriptorSelfPin$; - $TsanDetectConcurrentMutation$; - _internal_mutable_$name_internal$()->Add()->assign(value.data(), - value.size()); - $annotate_add$; - // @@protoc_insertion_point(field_add_string_piece:$pkg.Msg.field$) - } - inline const ::$proto_ns$::RepeatedPtrField<std::string>& - $Msg$::$name$() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $annotate_list$; - // @@protoc_insertion_point(field_list:$pkg.Msg.field$) - return _internal_$name_internal$(); - } - inline ::$proto_ns$::RepeatedPtrField<std::string>* - $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { - $WeakDescriptorSelfPin$; - $annotate_mutable_list$; - // @@protoc_insertion_point(field_mutable_list:$pkg.Msg.field$) - $TsanDetectConcurrentMutation$; - return _internal_mutable_$name_internal$(); - } - )cc"); + p->Emit( + { + {GetEmitRepeatedFieldGetterSub(*opts_, p)}, + {GetEmitRepeatedFieldMutableSub(*opts_, p)}, + }, + R"cc( + inline absl::string_view $Msg$::$name$(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $annotate_get$; + // @@protoc_insertion_point(field_get:$pkg.Msg.field$) + return $getter$; + } + inline void $Msg$::set_$name$(int index, const std::string& value) { + $WeakDescriptorSelfPin$; + $mutable$->assign(value); + $annotate_set$; + // @@protoc_insertion_point(field_set:$pkg.Msg.field$) + } + inline void $Msg$::set_$name$(int index, std::string&& value) { + $WeakDescriptorSelfPin$; + $mutable$->assign(std::move(value)); + $annotate_set$; + // @@protoc_insertion_point(field_set:$pkg.Msg.field$) + } + inline void $Msg$::set_$name$(int index, const char* $nonnull$ value) { + $WeakDescriptorSelfPin$; + $DCHK$(value != nullptr); + $mutable$->assign(value); + $annotate_set$; + // @@protoc_insertion_point(field_set_char:$pkg.Msg.field$) + } + inline void $Msg$::set_$name$(int index, absl::string_view value) { + $WeakDescriptorSelfPin$; + $mutable$->assign(value.data(), value.size()); + $annotate_set$; + // @@protoc_insertion_point(field_set_string_piece:$pkg.Msg.field$) + } + inline void $Msg$::add_$name$(const std::string& value) { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + _internal_mutable_$name_internal$()->Add()->assign(value); + $annotate_add$; + // @@protoc_insertion_point(field_add:$pkg.Msg.field$) + } + inline void $Msg$::add_$name$(std::string&& value) { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + _internal_mutable_$name_internal$()->Add(std::move(value)); + $annotate_add$; + // @@protoc_insertion_point(field_add:$pkg.Msg.field$) + } + inline void $Msg$::add_$name$(const char* $nonnull$ value) { + $WeakDescriptorSelfPin$; + $DCHK$(value != nullptr); + $TsanDetectConcurrentMutation$; + _internal_mutable_$name_internal$()->Add()->assign(value); + $annotate_add$; + // @@protoc_insertion_point(field_add_char:$pkg.Msg.field$) + } + inline void $Msg$::add_$name$(absl::string_view value) { + $WeakDescriptorSelfPin$; + $TsanDetectConcurrentMutation$; + _internal_mutable_$name_internal$()->Add()->assign(value.data(), + value.size()); + $annotate_add$; + // @@protoc_insertion_point(field_add_string_piece:$pkg.Msg.field$) + } + inline const $pb$::RepeatedPtrField<std::string>& $Msg$::$name$() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $annotate_list$; + // @@protoc_insertion_point(field_list:$pkg.Msg.field$) + return _internal_$name_internal$(); + } + inline $pb$::RepeatedPtrField<std::string>* $nonnull$ + $Msg$::mutable_$name$() ABSL_ATTRIBUTE_LIFETIME_BOUND { + $WeakDescriptorSelfPin$; + $annotate_mutable_list$; + // @@protoc_insertion_point(field_mutable_list:$pkg.Msg.field$) + $TsanDetectConcurrentMutation$; + return _internal_mutable_$name_internal$(); + } + )cc"); if (should_split()) { p->Emit(R"cc( inline const $pb$::RepeatedPtrField<std::string>& @@ -769,7 +757,7 @@ void RepeatedStringView::GenerateInlineAccessorDefinitions( $TsanDetectConcurrentRead$; return *$field_$; } - inline $pb$::RepeatedPtrField<std::string>* + inline $pb$::RepeatedPtrField<std::string>* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; $PrepareSplitMessageForWrite$; @@ -782,12 +770,12 @@ void RepeatedStringView::GenerateInlineAccessorDefinitions( )cc"); } else { p->Emit(R"cc( - inline const ::$proto_ns$::RepeatedPtrField<std::string>& + inline const $pb$::RepeatedPtrField<std::string>& $Msg$::_internal_$name_internal$() const { $TsanDetectConcurrentRead$; return $field_$; } - inline ::$proto_ns$::RepeatedPtrField<std::string>* + inline $pb$::RepeatedPtrField<std::string>* $nonnull$ $Msg$::_internal_mutable_$name_internal$() { $TsanDetectConcurrentRead$; return &$field_$; diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/file.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/file.cc index 8672b34a76967..132a5cd66b55f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/file.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/file.cc @@ -42,6 +42,7 @@ #include "google/protobuf/compiler/versions.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/descriptor_visitor.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/io/printer.h" @@ -547,9 +548,9 @@ void FileGenerator::GenerateSourcePrelude(io::Printer* p) { // required by the standard. p->Emit(R"cc( PROTOBUF_PRAGMA_INIT_SEG - namespace _pb = ::$proto_ns$; - namespace _pbi = ::$proto_ns$::internal; - namespace _fl = ::$proto_ns$::internal::field_layout; + namespace _pb = $pb$; + namespace _pbi = $pbi$; + namespace _fl = $pbi$::field_layout; )cc"); } @@ -854,7 +855,7 @@ void FileGenerator::GenerateStaticInitializer(io::Printer* p) { }}}, R"cc( PROTOBUF_ATTRIBUTE_INIT_PRIORITY$priority$ static ::std::false_type - _static_init$priority$_ PROTOBUF_UNUSED = + _static_init$priority$_ [[maybe_unused]] = ($expr$, ::std::false_type{}); )cc"); // Reset the vector because we might be generating many files. @@ -1140,23 +1141,26 @@ GetMessagesToPinGloballyForWeakDescriptors(const FileDescriptor* file, void FileGenerator::GenerateReflectionInitializationCode(io::Printer* p) { if (!enum_generators_.empty()) { p->Emit({{"len", enum_generators_.size()}}, R"cc( - static const ::_pb::EnumDescriptor* $file_level_enum_descriptors$[$len$]; + //~ Default initialized to null, but set to non-null values before use. + static const ::_pb::EnumDescriptor* $nonnull$ + $file_level_enum_descriptors$[$len$]; )cc"); } else { p->Emit(R"cc( - static constexpr const ::_pb::EnumDescriptor** + static constexpr const ::_pb::EnumDescriptor *$nonnull$ *$nullable$ $file_level_enum_descriptors$ = nullptr; )cc"); } if (HasGenericServices(file_, options_) && file_->service_count() > 0) { p->Emit({{"len", file_->service_count()}}, R"cc( - static const ::_pb::ServiceDescriptor* + //~ Default initialized to null, but set to non-null values before use. + static const ::_pb::ServiceDescriptor* $nonnull$ $file_level_service_descriptors$[$len$]; )cc"); } else { p->Emit(R"cc( - static constexpr const ::_pb::ServiceDescriptor** + static constexpr const ::_pb::ServiceDescriptor *$nonnull$ *$nullable$ $file_level_service_descriptors$ = nullptr; )cc"); } @@ -1195,25 +1199,26 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* p) { $schemas$, }; )cc"); + constexpr absl::string_view file_default_instances_code = R"cc( + static const ::_pb::Message* $nonnull$ const file_default_instances[] = { + $defaults$, + }; + )cc"; if (!UsingImplicitWeakDescriptor(file_, options_)) { - p->Emit({{"defaults", - [&] { - for (auto& gen : message_generators_) { - p->Emit( - { - {"ns", Namespace(gen->descriptor(), options_)}, - {"class", ClassName(gen->descriptor())}, - }, - R"cc( - &$ns$::_$class$_default_instance_._instance, - )cc"); - } - }}}, - R"cc( - static const ::_pb::Message* const file_default_instances[] = { - $defaults$, - }; - )cc"); + std::vector<Sub> subs = { + {"defaults", [&] { + for (auto& gen : message_generators_) { + p->Emit( + { + {"ns", Namespace(gen->descriptor(), options_)}, + {"class", ClassName(gen->descriptor())}, + }, + R"cc( + &$ns$::_$class$_default_instance_._instance, + )cc"); + } + }}}; + p->Emit(subs, file_default_instances_code); } } else { // Ee still need these symbols to exist. @@ -1221,8 +1226,9 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* p) { // MSVC doesn't like empty arrays, so we add a dummy. p->Emit(R"cc( const ::uint32_t $tablename$::offsets[1] = {}; - static constexpr ::_pbi::MigrationSchema* schemas = nullptr; - static constexpr ::_pb::Message* const* file_default_instances = nullptr; + static constexpr ::_pbi::MigrationSchema* $nullable$ schemas = nullptr; + static constexpr ::_pb::Message* $nonnull$ const* $nullable$ + file_default_instances = nullptr; )cc"); } @@ -1313,8 +1319,8 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* p) { }}, }, R"cc( - static const ::_pbi::DescriptorTable* const $desc_table$_deps[$len$] = - { + static const ::_pbi::DescriptorTable* $nonnull$ const + $desc_table$_deps[$len$] = { $deps$, }; )cc"); @@ -1419,10 +1425,16 @@ class FileGenerator::ForwardDeclarations { void Print(io::Printer* p, const Options& options) const { for (const auto& e : enums_) { - p->Emit({Sub("enum", e.first).AnnotatedAs(e.second)}, R"cc( - enum $enum$ : int; - bool $enum$_IsValid(int value); - )cc"); + p->Emit( + { + Sub("enum", e.first).AnnotatedAs(e.second), + {"DEPRECATED", + e.second->options().deprecated() ? "[[deprecated]]" : ""}, + }, + R"cc( + enum $DEPRECATED $$enum$ : int; + $dllexport_decl $extern const uint32_t $enum$_internal_data_[]; + )cc"); } for (const auto& c : classes_) { @@ -1432,11 +1444,13 @@ class FileGenerator::ForwardDeclarations { Sub("class", c.first).AnnotatedAs(desc), {"default_type", DefaultInstanceType(desc, options)}, {"default_name", DefaultInstanceName(desc, options)}, + {"classdata_type", ClassDataType(desc, options)}, }, R"cc( class $class$; struct $default_type$; $dllexport_decl $extern $default_type$ $default_name$; + $dllexport_decl $extern const $pbi$::$classdata_type$ $class$_class_data_; )cc"); } @@ -1457,6 +1471,14 @@ class FileGenerator::ForwardDeclarations { } void PrintTopLevelDecl(io::Printer* p, const Options& options) const { + for (const auto& e : enums_) { + p->Emit({{"enum", QualifiedClassName(e.second, options)}}, + R"cc( + template <> + internal::EnumTraitsT<$enum$_internal_data_> + internal::EnumTraitsImpl::value<$enum$>; + )cc"); + } if (ShouldGenerateExternSpecializations(options)) { for (const auto& c : classes_) { if (!ShouldGenerateClass(c.second, options)) continue; @@ -1469,14 +1491,13 @@ class FileGenerator::ForwardDeclarations { // in callers by having duplicate definitions of the template. // However, it increases the size of the pb.cc translation units so it // is a tradeoff. - p->Emit(R"cc( - extern template void* Arena::DefaultConstruct<$class$>(Arena*); - )cc"); + p->Emit(R"( + extern template void* $nonnull$ Arena::DefaultConstruct<$class$>(Arena* $nullable$); + )"); if (!IsMapEntryMessage(c.second)) { - p->Emit(R"cc( - extern template void* Arena::CopyConstruct<$class$>(Arena*, - const void*); - )cc"); + p->Emit(R"( + extern template void* $nonnull$ Arena::CopyConstruct<$class$>(Arena* $nullable$, const void* $nonnull$); + )"); } // We can't make a constexpr pointer to the global if we have DLL // linkage so skip this. @@ -1484,8 +1505,8 @@ class FileGenerator::ForwardDeclarations { if (options.dllexport_decl.empty()) { p->Emit(R"cc( template <> - internal::GeneratedMessageTraitsT<decltype($default_name$), - &$default_name$> + internal::GeneratedMessageTraitsT<&$default_name$, + &$class$_class_data_> internal::MessageTraitsImpl::value<$class$>; )cc"); } @@ -1528,6 +1549,10 @@ void FileGenerator::GenerateForwardDeclarations(io::Printer* p) { ListAllTypesForServices(file_, &classes); } + // List all enums in this file, to declare the traits. + google::protobuf::internal::VisitDescriptors( + *file_, [&](const EnumDescriptor& e) { enums.push_back(&e); }); + // Calculate the set of files whose definitions we get through include. // No need to forward declare types that are defined in these. absl::flat_hash_set<const FileDescriptor*> public_set; @@ -1662,6 +1687,7 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* p) { } if (HasMapFields(file_)) { IncludeFileAndExport("third_party/protobuf/map.h", p); + IncludeFileAndExport("third_party/protobuf/map_type_handler.h", p); if (HasDescriptorMethods(file_, options_)) { IncludeFile("third_party/protobuf/map_entry.h", p); IncludeFile("third_party/protobuf/map_field_inl.h", p); @@ -1744,9 +1770,13 @@ void FileGenerator::GenerateGlobalStateFunctionDeclarations(io::Printer* p) { )cc"); if (HasDescriptorMethods(file_, options_)) { + // The DescriptorTable needs to be extern "C" so that we can access it from + // Rust. We do not attempt to read the contents of the table in Rust, but + // just use the symbol to force-link the C++ generated code when necessary. p->Emit(R"cc( - $dllexport_decl $extern const ::$proto_ns$::internal::DescriptorTable - $desc_table$; + extern "C" { + $dllexport_decl $extern const $pbi$::DescriptorTable $desc_table$; + } // extern "C" )cc"); } } diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/file_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/file_unittest.cc index f7cec1d2d9ba0..86e9886be1332 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/file_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/file_unittest.cc @@ -7,13 +7,13 @@ #include "google/protobuf/compiler/cpp/file.h" -#include <algorithm> -#include <cstddef> +#include <string> #include <vector> +#include <gmock/gmock.h> #include <gtest/gtest.h> -#include "absl/strings/match.h" #include "absl/strings/string_view.h" +#include "absl/strings/strip.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/unittest.pb.h" @@ -37,7 +37,7 @@ namespace { // Test that the descriptors are ordered in a topological order. TEST(FileTest, TopologicallyOrderedDescriptors) { const FileDescriptor* fdesc = - protobuf_unittest::TestAllTypes::descriptor()->file(); + proto2_unittest::TestAllTypes::descriptor()->file(); FileGenerator fgen(fdesc, /*options=*/{}); static constexpr absl::string_view kExpectedDescriptorOrder[] = { "Uint64Message", @@ -47,6 +47,7 @@ TEST(FileTest, TopologicallyOrderedDescriptors) { "TestVerifyBigFieldNumberUint32.Nested", "TestUnpackedTypes", "TestUnpackedExtensions", + "TestString", "TestReservedFields", "TestRequiredOpenEnum", "TestRequiredOneof.NestedMessage", @@ -94,6 +95,7 @@ TEST(FileTest, TopologicallyOrderedDescriptors) { "TestExtensionInsideTable", "TestEmptyMessageWithExtensions", "TestEmptyMessage", + "TestEagerlyVerifiedLazyMessage.LazyMessage", "TestDynamicExtensions.DynamicMessageType", "TestDupFieldNumber.Foo", "TestDupFieldNumber.Bar", @@ -149,6 +151,7 @@ TEST(FileTest, TopologicallyOrderedDescriptors) { "TestGroup", "TestForeignNested", "TestFieldOrderings", + "TestEagerlyVerifiedLazyMessage", "TestEagerMaybeLazy.NestedMessage", "TestDynamicExtensions", "TestDupFieldNumber", @@ -196,23 +199,14 @@ TEST(FileTest, TopologicallyOrderedDescriptors) { "TestLazyMessageRepeated", "TestNestedRequiredForeign", }; - static constexpr size_t kExpectedDescriptorCount = - std::end(kExpectedDescriptorOrder) - std::begin(kExpectedDescriptorOrder); - std::vector<const Descriptor*> actual_descriptor_order = - FileGeneratorFriendForTesting::MessagesInTopologicalOrder(fgen); - EXPECT_TRUE(kExpectedDescriptorCount == actual_descriptor_order.size()) - << "Expected: " << kExpectedDescriptorCount - << ", got: " << actual_descriptor_order.size(); - - auto limit = - std::min(kExpectedDescriptorCount, actual_descriptor_order.size()); - for (auto i = 0u; i < limit; ++i) { - const Descriptor* desc = actual_descriptor_order[i]; - bool match = absl::EndsWith(desc->full_name(), kExpectedDescriptorOrder[i]); - EXPECT_TRUE(match) << "failed to match; expected " - << kExpectedDescriptorOrder[i] << ", got " - << desc->full_name(); + std::vector<std::string> actual_order; + for (const Descriptor* desc : + FileGeneratorFriendForTesting::MessagesInTopologicalOrder(fgen)) { + actual_order.emplace_back( + absl::StripPrefix(desc->full_name(), "proto2_unittest.")); } + EXPECT_THAT(actual_order, + ::testing::ElementsAreArray(kExpectedDescriptorOrder)); } } // namespace diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/generator.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/generator.cc index 790a5979ab116..c8ded6c509600 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/generator.cc @@ -52,7 +52,6 @@ absl::flat_hash_map<absl::string_view, std::string> CommonVars( const Options& options) { bool is_oss = options.opensource_runtime; return { - {"proto_ns", std::string(ProtobufNamespace(options))}, {"pb", absl::StrCat("::", ProtobufNamespace(options))}, {"pbi", absl::StrCat("::", ProtobufNamespace(options), "::internal")}, @@ -67,6 +66,9 @@ absl::flat_hash_map<absl::string_view, std::string> CommonVars( {"hrule_thick", kThickSeparator}, {"hrule_thin", kThinSeparator}, + {"nullable", "PROTOBUF_NULLABLE"}, + {"nonnull", "PROTOBUF_NONNULL"}, + // Warning: there is some clever naming/splitting here to avoid extract // script rewrites. The names of these variables must not be things that // the extract script will rewrite. That's why we use "CHK" (for example) @@ -131,7 +133,9 @@ bool CppGenerator::Generate(const FileDescriptor* file, if (key == "dllexport_decl") { file_options.dllexport_decl = value; } else if (key == "safe_boundary_check") { - file_options.safe_boundary_check = true; + file_options.bounds_check_mode = BoundsCheckMode::kReturnDefaultValue; + } else if (key == "enforced_boundary_check") { + file_options.bounds_check_mode = BoundsCheckMode::kAbort; } else if (key == "annotate_headers") { file_options.annotate_headers = true; } else if (key == "annotation_pragma_name") { @@ -192,7 +196,8 @@ bool CppGenerator::Generate(const FileDescriptor* file, // The safe_boundary_check option controls behavior for Google-internal // protobuf APIs. - if (file_options.safe_boundary_check && file_options.opensource_runtime) { + if ((file_options.bounds_check_mode != BoundsCheckMode::kNoEnforcement) && + file_options.opensource_runtime) { *error = "The safe_boundary_check option is not supported outside of Google."; return false; @@ -383,55 +388,28 @@ absl::Status CppGenerator::ValidateFeatures(const FileDescriptor* file) const { } } - if (unresolved_features.has_string_type()) { - if (field.cpp_type() != FieldDescriptor::CPPTYPE_STRING) { - status = absl::FailedPreconditionError(absl::StrCat( - "Field ", field.full_name(), - " specifies string_type, but is not a string nor bytes field.")); - } else if (unresolved_features.string_type() == pb::CppFeatures::CORD && - field.is_extension()) { - status = absl::FailedPreconditionError( - absl::StrCat("Extension ", field.full_name(), - " specifies string_type=CORD which is not supported " - "for extensions.")); - } else if (field.options().has_ctype()) { - // NOTE: this is just a sanity check. This case should never happen - // because descriptor builder makes string_type override ctype. - const FieldOptions::CType ctype = field.options().ctype(); - const pb::CppFeatures::StringType string_type = - unresolved_features.string_type(); - if ((ctype == FieldOptions::STRING && - string_type != pb::CppFeatures::STRING) || - (ctype == FieldOptions::CORD && - string_type != pb::CppFeatures::CORD)) { - status = absl::FailedPreconditionError( - absl::StrCat(field.full_name(), - " specifies inconsistent string_type and ctype.")); - } - } - } - - if (field.options().has_ctype()) { - if (field.cpp_type() != FieldDescriptor::CPPTYPE_STRING) { - status = absl::FailedPreconditionError(absl::StrCat( - "Field ", field.full_name(), - " specifies ctype, but is not a string nor bytes field.")); - } - if (field.options().ctype() == FieldOptions::CORD) { - if (field.is_extension()) { - status = absl::FailedPreconditionError(absl::StrCat( - "Extension ", field.full_name(), - " specifies Cord type which is not supported for extensions.")); - } - } - } - - if (field.cpp_type() == FieldDescriptor::CPPTYPE_STRING && - field.cpp_string_type() == FieldDescriptor::CppStringType::kCord && + if ((unresolved_features.string_type() == pb::CppFeatures::CORD || + field.legacy_proto_ctype() == FieldOptions::CORD) && field.is_extension()) { + status = absl::FailedPreconditionError( + absl::StrCat("Extension ", field.full_name(), + " specifies CORD string type which is not supported " + "for extensions.")); + } + + if ((unresolved_features.has_string_type() || + field.has_legacy_proto_ctype()) && + field.cpp_type() != FieldDescriptor::CPPTYPE_STRING) { status = absl::FailedPreconditionError(absl::StrCat( - "Extension ", field.full_name(), - " specifies Cord type which is not supported for extensions.")); + "Field ", field.full_name(), + " specifies string_type, but is not a string nor bytes field.")); + } + + if (unresolved_features.has_string_type() && + field.has_legacy_proto_ctype()) { + status = absl::FailedPreconditionError(absl::StrCat( + "Field ", field.full_name(), + " specifies both string_type and ctype which is not supported.")); } }); return status; diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/generator_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/generator_unittest.cc index 4f105e620c119..4320748843144 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/generator_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/generator_unittest.cc @@ -255,8 +255,8 @@ TEST_F(CppGeneratorTest, StringTypeCordNotForExtension) { "--experimental_editions foo.proto"); ExpectErrorSubstring( - "Extension bar specifies Cord type which is not supported for " - "extensions."); + "Extension bar specifies CORD string type which is not supported for " + "extensions"); } TEST_F(CppGeneratorTest, InheritedStringTypeCordNotForExtension) { @@ -280,7 +280,7 @@ TEST_F(CppGeneratorTest, InheritedStringTypeCordNotForExtension) { ExpectNoErrors(); } -TEST_F(CppGeneratorTest, CtypeOnNoneStringFieldTest) { +TEST_F(CppGeneratorTest, CtypeOnNonStringFieldTest) { CreateTempFile("foo.proto", R"schema( edition = "2023"; @@ -290,8 +290,8 @@ TEST_F(CppGeneratorTest, CtypeOnNoneStringFieldTest) { RunProtoc( "protocol_compiler --proto_path=$tmpdir --cpp_out=$tmpdir foo.proto"); ExpectErrorSubstring( - "Field Foo.bar specifies ctype, but is not " - "a string nor bytes field."); + "Field Foo.bar specifies string_type, but is not a string nor bytes " + "field."); } TEST_F(CppGeneratorTest, CtypeOnExtensionTest) { @@ -307,8 +307,8 @@ TEST_F(CppGeneratorTest, CtypeOnExtensionTest) { RunProtoc( "protocol_compiler --proto_path=$tmpdir --cpp_out=$tmpdir foo.proto"); ExpectErrorSubstring( - "Extension bar specifies Cord type which is " - "not supported for extensions."); + "Extension bar specifies CORD string type which is not supported for " + "extensions"); } } // namespace } // namespace cpp diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.cc index f515316381b81..b010c3d68c766 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.cc @@ -73,6 +73,50 @@ namespace { constexpr absl::string_view kAnyMessageName = "Any"; constexpr absl::string_view kAnyProtoFile = "google/protobuf/any.proto"; +const absl::flat_hash_set<absl::string_view>& FileScopeKnownNames() { + static constexpr const char* kValue[] = { + "swap", + }; + static const auto* const methods = new absl::flat_hash_set<absl::string_view>( + std::begin(kValue), std::end(kValue)); + return *methods; +} + +const absl::flat_hash_set<absl::string_view>& MessageKnownMethodsCamelCase() { + static constexpr const char* kMessageKnownMethods[] = { + "GetDescriptor", "GetReflection", "default_instance", + "Swap", "UnsafeArenaSwap", "New", + "CopyFrom", "MergeFrom", "IsInitialized", + "GetMetadata", "Clear", + }; + static const auto* const methods = new absl::flat_hash_set<absl::string_view>( + std::begin(kMessageKnownMethods), std::end(kMessageKnownMethods)); + return *methods; +} + +const absl::flat_hash_set<absl::string_view>& +MessageKnownNullaryMethodsSnakeCase() { + static constexpr const char* kMessageKnownMethods[] = { + "unknown_fields", + "mutable_unknown_fields", + "descriptor", + "default_instance", + }; + static const auto* const methods = new absl::flat_hash_set<absl::string_view>( + std::begin(kMessageKnownMethods), std::end(kMessageKnownMethods)); + return *methods; +} + +const absl::flat_hash_set<absl::string_view>& +MessageKnownNonNullaryMethodsSnakeCase() { + static constexpr const char* kMessageKnownMethods[] = { + "swap", + }; + static const auto* const methods = new absl::flat_hash_set<absl::string_view>( + std::begin(kMessageKnownMethods), std::end(kMessageKnownMethods)); + return *methods; +} + // TODO(crbug.com/332939935): This is used to allow generating an AnyLite proto // compatible with /third_party/medialite instead of checking in compiled // protobufs that complicate rolling. @@ -198,6 +242,10 @@ std::string IntTypeName(const Options& options, absl::string_view type) { +bool HasV2Table(const Descriptor* descriptor, const Options& options) { + return false; +} + } // namespace bool IsLazy(const FieldDescriptor* field, const Options& options, @@ -414,12 +462,14 @@ std::string ClassName(const Descriptor* descriptor) { if (parent) absl::StrAppend(&res, ClassName(parent), "_"); absl::StrAppend(&res, descriptor->name()); if (IsMapEntryMessage(descriptor)) absl::StrAppend(&res, "_DoNotUse"); - return ResolveKeyword(res); + // This is the mangled message name which always goes in file scope. + return ResolveKnownNameCollisions(res, NameContext::kFile, NameKind::kType); } std::string ClassName(const EnumDescriptor* enum_descriptor) { if (enum_descriptor->containing_type() == nullptr) { - return ResolveKeyword(enum_descriptor->name()); + return ResolveKnownNameCollisions(enum_descriptor->name(), + NameContext::kFile, NameKind::kType); } else { return absl::StrCat(ClassName(enum_descriptor->containing_type()), "_", enum_descriptor->name()); @@ -444,9 +494,14 @@ std::string QualifiedClassName(const EnumDescriptor* d) { } std::string ExtensionName(const FieldDescriptor* d) { - if (const Descriptor* scope = d->extension_scope()) - return absl::StrCat(ClassName(scope), "::", ResolveKeyword(d->name())); - return ResolveKeyword(d->name()); + if (const Descriptor* scope = d->extension_scope()) { + return absl::StrCat( + ClassName(scope), "::", + ResolveKnownNameCollisions(d->name(), NameContext::kMessage, + NameKind::kValue)); + } + return ResolveKnownNameCollisions(d->name(), NameContext::kFile, + NameKind::kValue); } std::string QualifiedExtensionName(const FieldDescriptor* d, @@ -460,23 +515,53 @@ std::string QualifiedExtensionName(const FieldDescriptor* d) { } std::string ResolveKeyword(absl::string_view name) { - if (Keywords().count(name) > 0) { + if (Keywords().contains(name)) { return absl::StrCat(name, "_"); } return std::string(name); } -std::string DotsToColons(absl::string_view name) { - std::vector<std::string> scope = absl::StrSplit(name, '.', absl::SkipEmpty()); - for (auto& word : scope) { - word = ResolveKeyword(word); +std::string ResolveKnownNameCollisions(absl::string_view name, + NameContext name_context, + NameKind name_kind) { + const auto has_conflict = [&] { + if (Keywords().contains(name)) return true; + + switch (name_kind) { + // We assume the style guide: types are CamelCase, fields are snake_case. + case NameKind::kType: + // Types can't overload names of existing functions. + return MessageKnownMethodsCamelCase().contains(name); + case NameKind::kValue: + if (name_context == NameContext::kFile) { + // At file scope we don't have the normal names, except a few. + return FileScopeKnownNames().contains(name); + } + // Values can't overload names of existing functions. + return MessageKnownNullaryMethodsSnakeCase().contains(name) || + MessageKnownNonNullaryMethodsSnakeCase().contains(name); + case NameKind::kFunction: + // For functions, we can't overload existing nullary functions. + // Non-nullary functions are fine. + return MessageKnownNullaryMethodsSnakeCase().contains(name); + } + return false; + }; + if (has_conflict()) { + return absl::StrCat(name, "_"); } - return absl::StrJoin(scope, "::"); + return std::string(name); } std::string Namespace(absl::string_view package) { if (package.empty()) return ""; - return absl::StrCat("::", DotsToColons(package)); + + std::vector<std::string> scope = + absl::StrSplit(package, '.', absl::SkipEmpty()); + for (auto& word : scope) { + word = ResolveKeyword(word); + } + return absl::StrCat("::", absl::StrJoin(scope, "::")); } std::string Namespace(const FileDescriptor* d) { return Namespace(d, {}); } @@ -529,6 +614,17 @@ std::string QualifiedDefaultInstancePtr(const Descriptor* descriptor, "ptr_"); } +std::string ClassDataType(const Descriptor* descriptor, + const Options& options) { + return HasDescriptorMethods(descriptor->file(), options) || + // Boostrap protos are always full, even when lite is forced + // via options. + IsBootstrapProto(options, descriptor->file()) + ? "ClassDataFull" + : absl::StrFormat("ClassDataLite<%d>", + descriptor->full_name().size() + 1); +} + std::string DescriptorTableName(const FileDescriptor* file, const Options& options) { return UniqueName("descriptor_table", file, options); @@ -552,12 +648,17 @@ std::string SuperClassName(const Descriptor* descriptor, } std::string FieldName(const FieldDescriptor* field) { + if (field->containing_type() != nullptr && + field->containing_type()->options().no_standard_descriptor_accessor() && + field->name() == "descriptor") { + // Special case for `optional no_standard_descriptor_accessor = true;` + return "descriptor"; + } std::string result = std::string(field->name()); absl::AsciiStrToLower(&result); - if (Keywords().count(result) > 0) { - result.append("_"); - } - return result; + ABSL_CHECK(field->containing_type() != nullptr); + return ResolveKnownNameCollisions(result, NameContext::kMessage, + NameKind::kFunction); } std::string FieldMemberName(const FieldDescriptor* field, bool split) { @@ -586,11 +687,7 @@ std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field) { } std::string EnumValueName(const EnumValueDescriptor* enum_value) { - std::string result = std::string(enum_value->name()); - if (Keywords().count(result) > 0) { - result.append("_"); - } - return result; + return ResolveKeyword(enum_value->name()); } int EstimateAlignmentSize(const FieldDescriptor* field) { @@ -953,9 +1050,26 @@ bool IsLikelyPresent(const FieldDescriptor* field, const Options& options) { return false; } -float GetPresenceProbability(const FieldDescriptor* field, - const Options& options) { - return 1.f; +absl::optional<float> GetPresenceProbability(const FieldDescriptor* field, + const Options& options) { + return absl::nullopt; +} + +absl::optional<float> GetFieldGroupPresenceProbability( + const std::vector<const FieldDescriptor*>& fields, const Options& options) { + ABSL_DCHECK(!fields.empty()); + if (!IsProfileDriven(options)) return absl::nullopt; + + double all_absent_probability = 1.0; + + for (const auto* field : fields) { + absl::optional<float> probability = GetPresenceProbability(field, options); + if (!probability) { + return absl::nullopt; + } + all_absent_probability *= 1.0 - *probability; + } + return 1.0 - all_absent_probability; } bool IsStringInliningEnabled(const Options& options) { @@ -1091,18 +1205,8 @@ bool HasRepeatedFields(const FileDescriptor* file) { return false; } -static bool IsStringPieceField(const FieldDescriptor* field, - const Options& options) { - return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - internal::cpp::EffectiveStringCType(field) == - FieldOptions::STRING_PIECE; -} - static bool HasStringPieceFields(const Descriptor* descriptor, const Options& options) { - for (int i = 0; i < descriptor->field_count(); ++i) { - if (IsStringPieceField(descriptor->field(i), options)) return true; - } for (int i = 0; i < descriptor->nested_type_count(); ++i) { if (HasStringPieceFields(descriptor->nested_type(i), options)) return true; } @@ -1116,15 +1220,10 @@ bool HasStringPieceFields(const FileDescriptor* file, const Options& options) { return false; } -static bool IsCordField(const FieldDescriptor* field, const Options& options) { - return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - internal::cpp::EffectiveStringCType(field) == FieldOptions::CORD; -} - static bool HasCordFields(const Descriptor* descriptor, const Options& options) { for (int i = 0; i < descriptor->field_count(); ++i) { - if (IsCordField(descriptor->field(i), options)) return true; + if (IsCord(descriptor->field(i))) return true; } for (int i = 0; i < descriptor->nested_type_count(); ++i) { if (HasCordFields(descriptor->nested_type(i), options)) return true; @@ -1177,17 +1276,26 @@ bool HasMapFields(const FileDescriptor* file) { return false; } -bool HasV2Table(const Descriptor* descriptor) { +bool IsV2EnabledForMessage(const Descriptor* descriptor, + const Options& options) { return false; } -bool HasV2Table(const FileDescriptor* file) { +bool HasV2MessageTable(const FileDescriptor* file, const Options& options) { for (int i = 0; i < file->message_type_count(); ++i) { - if (HasV2Table(file->message_type(i))) return true; + if (HasV2Table(file->message_type(i), options)) return true; } return false; } +bool IsV2ParseEnabledForMessage(const Descriptor* descriptor) { + return false; +} + +bool HasV2ParseTable(const FileDescriptor* file, const Options& options) { + return false; +} + static bool HasEnumDefinitions(const Descriptor* message_type) { if (message_type->enum_type_count() > 0) return true; for (int i = 0; i < message_type->nested_type_count(); ++i) { diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.h index 761c0adcb9a26..3f392ee9e46df 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/helpers.h @@ -173,6 +173,9 @@ std::string QualifiedDefaultInstancePtr(const Descriptor* descriptor, const Options& options, bool split = false); +// Name of the ClassData subclass used for a message. +std::string ClassDataType(const Descriptor* descriptor, const Options& options); + // DescriptorTable variable name. std::string DescriptorTableName(const FileDescriptor* file, const Options& options); @@ -185,6 +188,24 @@ std::string FileDllExport(const FileDescriptor* file, const Options& options); std::string SuperClassName(const Descriptor* descriptor, const Options& options); +// Add an underscore if necessary to prevent conflicting with known names and +// keywords. +// We use the context and the kind of entity to try to determine if mangling is +// necessary or not. +// For example, a message named `New` at file scope is fine, but at message +// scope it needs mangling because it collides with the `New` function. +enum class NameContext { + kFile, + kMessage, +}; +enum class NameKind { + kType, + kFunction, + kValue, +}; +std::string ResolveKnownNameCollisions(absl::string_view name, + NameContext name_context, + NameKind name_kind); // Adds an underscore if necessary to prevent conflicting with a keyword. std::string ResolveKeyword(absl::string_view name); @@ -327,18 +348,19 @@ inline bool IsWeak(const FieldDescriptor* field, const Options& options) { inline bool IsCord(const FieldDescriptor* field) { return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - internal::cpp::EffectiveStringCType(field) == FieldOptions::CORD; + field->cpp_string_type() == FieldDescriptor::CppStringType::kCord; } inline bool IsString(const FieldDescriptor* field) { return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - internal::cpp::EffectiveStringCType(field) == FieldOptions::STRING; + (field->cpp_string_type() == FieldDescriptor::CppStringType::kString || + field->cpp_string_type() == FieldDescriptor::CppStringType::kView); } -inline bool IsStringPiece(const FieldDescriptor* field) { - return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && - internal::cpp::EffectiveStringCType(field) == - FieldOptions::STRING_PIECE; + +inline bool IsArenaStringPtr(const FieldDescriptor* field) { + return field->cpp_string_type() == FieldDescriptor::CppStringType::kString || + field->cpp_string_type() == FieldDescriptor::CppStringType::kView; } bool IsProfileDriven(const Options& options); @@ -349,8 +371,15 @@ bool IsRarelyPresent(const FieldDescriptor* field, const Options& options); // Returns true if `field` is likely to be present based on PDProto profile. bool IsLikelyPresent(const FieldDescriptor* field, const Options& options); -float GetPresenceProbability(const FieldDescriptor* field, - const Options& options); +absl::optional<float> GetPresenceProbability(const FieldDescriptor* field, + const Options& options); + +// GetFieldGroupPresenceProbability computes presence probability for a group of +// fields. It uses the absence probability (easier to compute) +// (1 - p1) * (1 - p2) * ... * (1 - pn), and in the end the aggregate presence +// probability can be expressed as (1 - all_absent_probability). +absl::optional<float> GetFieldGroupPresenceProbability( + const std::vector<const FieldDescriptor*>& fields, const Options& options); bool IsStringInliningEnabled(const Options& options); @@ -467,11 +496,15 @@ bool HasMapFields(const FileDescriptor* file); // Does this file have any enum type definitions? bool HasEnumDefinitions(const FileDescriptor* file); -// Returns true if a message in the file can have v2 table. -bool HasV2Table(const FileDescriptor* file); +// Returns true if any message in the file can have v2 table. +bool HasV2MessageTable(const FileDescriptor* file, const Options& options); +bool HasV2ParseTable(const FileDescriptor* file, const Options& options); + +bool IsV2ParseEnabledForMessage(const Descriptor* descriptor); // Returns true if a message (descriptor) can have v2 table. -bool HasV2Table(const Descriptor* descriptor); +bool IsV2EnabledForMessage(const Descriptor* descriptor, + const Options& options); // Does this file have generated parsing, serialization, and other // standard methods for which reflection-based fallback implementations exist? @@ -922,12 +955,10 @@ class PROTOC_EXPORT Formatter { Formatter* format_; }; - PROTOBUF_NODISCARD ScopedIndenter ScopedIndent() { - return ScopedIndenter(this); - } + [[nodiscard]] ScopedIndenter ScopedIndent() { return ScopedIndenter(this); } template <typename... Args> - PROTOBUF_NODISCARD ScopedIndenter ScopedIndent(const char* format, - const Args&&... args) { + [[nodiscard]] ScopedIndenter ScopedIndent(const char* format, + const Args&&... args) { (*this)(format, static_cast<Args&&>(args)...); return ScopedIndenter(this); } @@ -1167,6 +1198,69 @@ bool HasOnDeserializeTracker(const Descriptor* descriptor, // signature. bool NeedsPostLoopHandler(const Descriptor* descriptor, const Options& options); +// Emit the repeated field getter for the custom options. +// Depending on the bounds check mode specified, this will emit the +// corresponding getter. +inline auto GetEmitRepeatedFieldGetterSub(const Options& options, + io::Printer* p) { + return io::Printer::Sub{ + "getter", + [&options, p] { + switch (options.bounds_check_mode) { + case BoundsCheckMode::kNoEnforcement: + p->Emit(R"cc(_internal_$name_internal$().Get(index))cc"); + break; + case BoundsCheckMode::kReturnDefaultValue: + p->Emit(R"cc( + $pbi$::CheckedGetOrDefault(_internal_$name_internal$(), index) + )cc"); + break; + case BoundsCheckMode::kAbort: + p->Emit(R"cc( + $pbi$::CheckedGetOrAbort(_internal_$name_internal$(), index) + )cc"); + break; + } + }} + .WithSuffix(""); +} + +// Emit the code for getting a mutable element from a repeated field. This will +// generate different code depending on the `bounds_check_mode` specified in the +// options. +// TODO: b/347304492 Harden this function by taking in the field and checking +// if splitting is supported. +inline auto GetEmitRepeatedFieldMutableSub(const Options& options, + io::Printer* p, + bool use_stringpiecefield = false) { + return io::Printer::Sub{ + "mutable", + [&options, p, use_stringpiecefield] { + switch (options.bounds_check_mode) { + case BoundsCheckMode::kNoEnforcement: + case BoundsCheckMode::kReturnDefaultValue: + if (use_stringpiecefield) { + p->Emit("$field$.Mutable(index)"); + } else { + p->Emit( + R"cc(_internal_mutable_$name_internal$()->Mutable(index))cc"); + } + break; + case BoundsCheckMode::kAbort: + if (use_stringpiecefield) { + p->Emit("$pbi$::CheckedMutableOrAbort(&$field$, index)"); + } else { + p->Emit(R"cc( + $pbi$::CheckedMutableOrAbort( + _internal_mutable_$name_internal$(), index) + )cc"); + } + break; + } + }} + .WithSuffix(""); +} + // Priority used for static initializers. enum InitPriority { kInitPriority101, diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc index bd5b8cc3818ec..9caa39c20af28 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/message.cc @@ -19,11 +19,12 @@ #include <iterator> #include <limits> #include <memory> -#include <new> +#include <optional> #include <string> #include <utility> #include <vector> +#include "absl/algorithm/container.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/functional/any_invocable.h" @@ -62,6 +63,8 @@ namespace cpp { namespace { using ::google::protobuf::internal::WireFormat; using ::google::protobuf::internal::WireFormatLite; +using ::google::protobuf::internal::cpp::GetFieldHasbitMode; +using ::google::protobuf::internal::cpp::HasbitMode; using ::google::protobuf::internal::cpp::HasHasbit; using Semantic = ::google::protobuf::io::AnnotationCollector::Semantic; using Sub = ::google::protobuf::io::Printer::Sub; @@ -92,9 +95,71 @@ std::string ConditionalToCheckBitmasks( return result + (return_success ? " == 0" : " != 0"); } +template <typename PredicateT> +void DebugAssertUniform(const std::vector<const FieldDescriptor*>& fields, + const Options& options, PredicateT&& pred) { + ABSL_DCHECK(!fields.empty() && absl::c_all_of(fields, [&](const auto* f) { + return pred(f) == pred(fields.front()); + })); +} + +void DebugAssertUniformLikelyPresence( + const std::vector<const FieldDescriptor*>& fields, const Options& options) { + DebugAssertUniform(fields, options, [&](const FieldDescriptor* f) { + return IsLikelyPresent(f, options); + }); +} + +// Generates a condition that checks presence of a field. If probability is +// provided, the condition will be wrapped with +// PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY. +// +// If use_cached_has_bits is true, the condition will be generated based on +// cached_has_bits. Otherwise, the condition will be generated based on the +// _has_bits_ array, with has_array_index indicating which element of the array +// to use. +std::string GenerateConditionMaybeWithProbability( + uint32_t mask, absl::optional<float> probability, bool use_cached_has_bits, + absl::optional<int> has_array_index) { + std::string condition; + if (use_cached_has_bits) { + condition = absl::StrFormat("(cached_has_bits & 0x%08xu) != 0", mask); + } else { + // We only use has_array_index when use_cached_has_bits is false, make sure + // we pas a valid index when we need it. + ABSL_DCHECK(has_array_index.has_value()); + condition = absl::StrFormat("(this_._impl_._has_bits_[%d] & 0x%08xu) != 0", + *has_array_index, mask); + } + if (probability.has_value()) { + return absl::StrFormat("PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY(%s, %.3f)", + condition, *probability); + } + return condition; +} + +std::string GenerateConditionMaybeWithProbabilityForField( + int has_bit_index, const FieldDescriptor* field, const Options& options) { + auto prob = GetPresenceProbability(field, options); + return GenerateConditionMaybeWithProbability( + 1u << (has_bit_index % 32), prob, + /*use_cached_has_bits*/ true, + /*has_array_index*/ absl::nullopt); +} + +std::string GenerateConditionMaybeWithProbabilityForGroup( + uint32_t mask, const std::vector<const FieldDescriptor*>& fields, + const Options& options) { + auto prob = GetFieldGroupPresenceProbability(fields, options); + return GenerateConditionMaybeWithProbability( + mask, prob, + /*use_cached_has_bits*/ true, + /*has_array_index*/ absl::nullopt); +} + void PrintPresenceCheck(const FieldDescriptor* field, const std::vector<int>& has_bit_indices, io::Printer* p, - int* cached_has_word_index) { + int* cached_has_word_index, const Options& options) { if (!field->options().weak()) { int has_bit_index = has_bit_indices[field->index()]; if (*cached_has_word_index != (has_bit_index / 32)) { @@ -104,9 +169,10 @@ void PrintPresenceCheck(const FieldDescriptor* field, cached_has_bits = $has_bits$[$index$]; )cc"); } - p->Emit({{"mask", absl::StrFormat("0x%08xu", 1u << (has_bit_index % 32))}}, + p->Emit({{"condition", GenerateConditionMaybeWithProbabilityForField( + has_bit_index, field, options)}}, R"cc( - if (cached_has_bits & $mask$) { + if ($condition$) { )cc"); } else { p->Emit(R"cc( @@ -185,9 +251,9 @@ RunMap FindRuns(const std::vector<const FieldDescriptor*>& fields, return runs; } -void EmitNonDefaultCheck(io::Printer* p, const std::string& prefix, +void EmitNonDefaultCheck(io::Printer* p, absl::string_view prefix, const FieldDescriptor* field) { - ABSL_CHECK(!HasHasbit(field)); + ABSL_CHECK(GetFieldHasbitMode(field) != HasbitMode::kTrueHasbit); ABSL_CHECK(!field->is_repeated()); ABSL_CHECK(!field->containing_oneof() || field->real_containing_oneof()); @@ -216,19 +282,69 @@ void EmitNonDefaultCheck(io::Printer* p, const std::string& prefix, } bool ShouldEmitNonDefaultCheck(const FieldDescriptor* field) { - return (!field->is_repeated() && !field->containing_oneof()) || - field->real_containing_oneof(); + if (GetFieldHasbitMode(field) == HasbitMode::kTrueHasbit) { + return false; + } + return !field->is_repeated(); +} + +void EmitNonDefaultCheckForString(io::Printer* p, absl::string_view prefix, + const FieldDescriptor* field, bool split, + absl::AnyInvocable<void()> emit_body) { + ABSL_DCHECK(field->cpp_type() == FieldDescriptor::CPPTYPE_STRING); + ABSL_DCHECK(IsArenaStringPtr(field)); + p->Emit( + { + {"condition", [&] { EmitNonDefaultCheck(p, prefix, field); }}, + {"emit_body", [&] { emit_body(); }}, + {"set_empty_string", + [&] { + p->Emit( + { + {"prefix", prefix}, + {"name", FieldName(field)}, + {"field", FieldMemberName(field, split)}, + }, + // The merge semantic is "overwrite if present". This statement + // is emitted when hasbit is set and src proto field is + // nonpresent (i.e. an empty string). Now, the destination + // string can be either empty or nonempty. + // - If dst is empty and pointing to the default instance, + // allocate a new empty instance. + // - If dst is already pointing to a nondefault instance, + // do nothing. + // This will allow destructors and Clear() to be simpler. + R"cc( + if (_this->$field$.IsDefault()) { + _this->_internal_set_$name$(""); + } + )cc"); + }}, + }, + R"cc( + if ($condition$) { + $emit_body$; + } else { + $set_empty_string$; + } + )cc"); } // Emits an if-statement with a condition that evaluates to true if |field| is // considered non-default (will be sent over the wire), for message types // without true field presence. Should only be called if // !HasHasbit(field). -void MayEmitIfNonDefaultCheck(io::Printer* p, const std::string& prefix, +// If |with_enclosing_braces_always| is set to true, will generate enclosing +// braces even if nondefault check is not emitted -- i.e. code may look like: +// { +// // code... +// } +// If |with_enclosing_braces_always| is set to false, enclosing braces will not +// be generated if nondefault check is not emitted. +void MayEmitIfNonDefaultCheck(io::Printer* p, absl::string_view prefix, const FieldDescriptor* field, - absl::AnyInvocable<void()> emit_body) { - ABSL_CHECK(!HasHasbit(field)); - + absl::AnyInvocable<void()> emit_body, + bool with_enclosing_braces_always) { if (ShouldEmitNonDefaultCheck(field)) { p->Emit( { @@ -240,7 +356,10 @@ void MayEmitIfNonDefaultCheck(io::Printer* p, const std::string& prefix, $emit_body$; } )cc"); - } else { + return; + } + + if (with_enclosing_braces_always) { // In repeated fields, the same variable name may be emitted multiple // times, hence the need for emitting braces even when the if condition is // not necessary, so that the code looks like: @@ -259,7 +378,34 @@ void MayEmitIfNonDefaultCheck(io::Printer* p, const std::string& prefix, $emit_body$; } )cc"); + return; } + + // If no enclosing braces need to be emitted, just emit the body directly. + emit_body(); +} + +void MayEmitMutableIfNonDefaultCheck(io::Printer* p, absl::string_view prefix, + const FieldDescriptor* field, bool split, + absl::AnyInvocable<void()> emit_body, + bool with_enclosing_braces_always) { + if (ShouldEmitNonDefaultCheck(field)) { + if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && + IsArenaStringPtr(field)) { + // If a field is backed by std::string, when default initialized it will + // point to a global empty std::string instance. We prefer to spend some + // extra cycles here to create a local string instance in the else branch, + // so that we can get rid of a branch when Clear() is called (if we do + // this, Clear() can always assume string instance is nonglobal). + EmitNonDefaultCheckForString(p, prefix, field, split, + std::move(emit_body)); + return; + } + } + + // Fall back to the default implementation. + return MayEmitIfNonDefaultCheck(p, prefix, field, std::move(emit_body), + with_enclosing_braces_always); } bool HasInternalHasMethod(const FieldDescriptor* field) { @@ -467,30 +613,30 @@ bool MaybeEmitHaswordsCheck(ChunkIterator it, ChunkIterator end, } // Emit has_bit check for each has_bit_dword index. - p->Emit( - {{"cond", - [&] { - int first_word = hasword_masks.front().word; - for (const auto& m : hasword_masks) { - uint32_t mask = m.mask; - int this_word = m.word; - if (this_word != first_word) { - p->Emit(R"cc( - || - )cc"); - } - auto v = p->WithVars({{"mask", absl::StrFormat("0x%08xu", mask)}}); - if (this_word == cached_has_word_index) { - p->Emit("(cached_has_bits & $mask$) != 0"); - } else { - p->Emit({{"from", from}, {"word", this_word}}, - "($from$_impl_._has_bits_[$word$] & $mask$) != 0"); - } - } - }}}, - R"cc( - if (PROTOBUF_PREDICT_FALSE($cond$)) { - )cc"); + p->Emit({{"cond", + [&] { + int first_word = hasword_masks.front().word; + for (const auto& m : hasword_masks) { + uint32_t mask = m.mask; + int this_word = m.word; + if (this_word != first_word) { + p->Emit(R"cc( + || + )cc"); + } + auto v = + p->WithVars({{"mask", absl::StrFormat("0x%08xu", mask)}}); + if (this_word == cached_has_word_index) { + p->Emit("(cached_has_bits & $mask$) != 0"); + } else { + p->Emit({{"from", from}, {"word", this_word}}, + "($from$_impl_._has_bits_[$word$] & $mask$) != 0"); + } + } + }}}, + R"cc( + if (ABSL_PREDICT_FALSE($cond$)) { + )cc"); p->Indent(); return true; } @@ -877,11 +1023,9 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* p) { } template <typename _proto_TypeTraits, $pbi$::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const $pbi$::ExtensionIdentifier< + $Msg$, _proto_TypeTraits, _field_type, _is_packed>& id) { $WeakDescriptorSelfPin$; $annotate_extension_release$; return _proto_TypeTraits::Release(id.number(), _field_type, &$extensions$); @@ -983,7 +1127,7 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* p) { template <typename _proto_TypeTraits, $pbi$::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* $nonnull$ MutableRepeatedExtension( const $pbi$::ExtensionIdentifier<$Msg$, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -1033,7 +1177,7 @@ void MessageGenerator::GenerateSingularFieldHasBits( )cc"); return; } - if (HasHasbit(field)) { + if (GetFieldHasbitMode(field) == HasbitMode::kTrueHasbit) { auto v = p->WithVars(HasBitVars(field)); p->Emit( {Sub{"ASSUME", @@ -1058,27 +1202,6 @@ void MessageGenerator::GenerateSingularFieldHasBits( return value; } )cc"); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - // Message fields have a has_$name$() method. - if (IsLazy(field, options_, scc_analyzer_)) { - p->Emit(R"cc( - inline bool $classname$::_internal_has_$name$() const { - return !$field$.IsCleared(); - } - )cc"); - } else { - p->Emit(R"cc( - inline bool $classname$::_internal_has_$name$() const { - return this != internal_default_instance() && $field$ != nullptr; - } - )cc"); - } - p->Emit(R"cc( - inline bool $classname$::has_$name$() const { - $annotate_has$; - return _internal_has_$name$(); - } - )cc"); } } @@ -1157,7 +1280,7 @@ void MessageGenerator::GenerateFieldClear(const FieldDescriptor* field, // TODO: figure out if early return breaks tracking if (ShouldSplit(field, options_)) { p->Emit(R"cc( - if (PROTOBUF_PREDICT_TRUE(IsSplitMessageDefault())) + if (ABSL_PREDICT_TRUE(IsSplitMessageDefault())) return; )cc"); } @@ -1243,7 +1366,8 @@ void MessageGenerator::EmitCheckAndUpdateByteSizeForField( }; if (!HasHasbit(field)) { - MayEmitIfNonDefaultCheck(p, "this_.", field, std::move(emit_body)); + MayEmitIfNonDefaultCheck(p, "this_.", field, std::move(emit_body), + /*with_enclosing_braces_always=*/true); return; } if (field->options().weak()) { @@ -1257,12 +1381,19 @@ void MessageGenerator::EmitCheckAndUpdateByteSizeForField( } int has_bit_index = has_bit_indices_[field->index()]; - p->Emit({{"mask", - absl::StrFormat("0x%08xu", uint32_t{1} << (has_bit_index % 32))}, - {"emit_body", [&] { emit_body(); }}}, + p->Emit({{"condition", GenerateConditionMaybeWithProbabilityForField( + has_bit_index, field, options_)}, + {"check_nondefault_and_emit_body", + [&] { + // Note that it's possible that the field has explicit presence. + // In that case, nondefault check will not be emitted but + // emit_body will still be emitted. + MayEmitIfNonDefaultCheck(p, "this_.", field, std::move(emit_body), + /*with_enclosing_braces_always=*/false); + }}}, R"cc( - if (cached_has_bits & $mask$) { - $emit_body$; + if ($condition$) { + $check_nondefault_and_emit_body$; } )cc"); } @@ -1370,40 +1501,41 @@ void MessageGenerator::GenerateMapEntryClassDefinition(io::Printer* p) { }}}, R"cc( class $classname$ final - : public ::$proto_ns$::internal::MapEntry< - $key_cpp$, $val_cpp$, - ::$proto_ns$::internal::WireFormatLite::$key_wire_type$, - ::$proto_ns$::internal::WireFormatLite::$val_wire_type$> { + : public $pbi$::MapEntry<$key_cpp$, $val_cpp$, + $pbi$::WireFormatLite::$key_wire_type$, + $pbi$::WireFormatLite::$val_wire_type$> { public: - using SuperType = ::$proto_ns$::internal::MapEntry< - $key_cpp$, $val_cpp$, - ::$proto_ns$::internal::WireFormatLite::$key_wire_type$, - ::$proto_ns$::internal::WireFormatLite::$val_wire_type$>; + using SuperType = + $pbi$::MapEntry<$key_cpp$, $val_cpp$, + $pbi$::WireFormatLite::$key_wire_type$, + $pbi$::WireFormatLite::$val_wire_type$>; $classname$(); template <typename = void> - explicit PROTOBUF_CONSTEXPR $classname$( - ::$proto_ns$::internal::ConstantInitialized); - explicit $classname$(::$proto_ns$::Arena* arena); - static const $classname$* internal_default_instance() { - return reinterpret_cast<const $classname$*>( - &_$classname$_default_instance_); + explicit PROTOBUF_CONSTEXPR $classname$($pbi$::ConstantInitialized); + explicit $classname$($pb$::Arena* $nullable$ arena); + static constexpr const void* $nonnull$ internal_default_instance() { + return &_$classname$_default_instance_; } $decl_verify_func$; + static constexpr auto InternalGenerateClassData_(); + private: - friend class ::$proto_ns$::MessageLite; + friend class $pb$::MessageLite; friend struct ::$tablename$; $parse_decls$; $decl_annotate$; - const $pbi$::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::$proto_ns$::Arena* arena); + const $pbi$::ClassData* $nonnull$ GetClassData() const PROTOBUF_FINAL; + static void* $nonnull$ PlacementNew_( + //~ + const void* $nonnull$, void* $nonnull$ mem, + $pb$::Arena* $nullable$ arena); static constexpr auto InternalNewImpl_(); - static const $pbi$::ClassDataFull _class_data_; }; + $dllexport_decl $extern const $pbi$::ClassDataFull $classname$_class_data_; )cc"); } @@ -1424,7 +1556,7 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { if (descriptor_->extension_range_count() == 0) return; p->Emit(R"cc( - ::$proto_ns$::internal::ExtensionSet _extensions_; + $pbi$::ExtensionSet _extensions_; )cc"); }}, {"tracker", @@ -1432,7 +1564,7 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { if (!HasTracker(descriptor_, options_)) return; p->Emit(R"cc( - static ::$proto_ns$::AccessListener<$Msg$> _tracker_; + static $pb$::AccessListener<$Msg$> _tracker_; static void TrackerOnGetMetadata() { $annotate_reflection$; } )cc"); }}, @@ -1445,8 +1577,7 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { p->Emit({{"donated_size", InlinedStringDonatedSize()}}, R"cc( - ::$proto_ns$::internal::HasBits<$donated_size$> - _inlined_string_donated_; + $pbi$::HasBits<$donated_size$> _inlined_string_donated_; )cc"); }}, {"has_bits", @@ -1458,11 +1589,11 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { // Placing _cached_size_ together with _has_bits_ improves cache // locality despite potential alignment padding. p->Emit({{"sizeof_has_bits", sizeof_has_bits}}, R"cc( - ::$proto_ns$::internal::HasBits<$sizeof_has_bits$> _has_bits_; + $pbi$::HasBits<$sizeof_has_bits$> _has_bits_; )cc"); if (need_to_emit_cached_size) { p->Emit(R"cc( - ::$proto_ns$::internal::CachedSize _cached_size_; + $pbi$::CachedSize _cached_size_; )cc"); need_to_emit_cached_size = false; } @@ -1495,7 +1626,7 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { }; static_assert(std::is_trivially_copy_constructible<Split>::value); static_assert(std::is_trivially_destructible<Split>::value); - Split* _split_; + Split* $nonnull$ _split_; )cc"); }}, {"oneof_members", @@ -1517,7 +1648,7 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { R"cc( union $camel_oneof_name$Union { constexpr $camel_oneof_name$Union() : _constinit_{} {} - ::$proto_ns$::internal::ConstantInitialized _constinit_; + $pbi$::ConstantInitialized _constinit_; $oneof_fields$; } $oneof_name$_; )cc"); @@ -1532,7 +1663,7 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { need_to_emit_cached_size = false; p->Emit(R"cc( - ::$proto_ns$::internal::CachedSize _cached_size_; + $pbi$::CachedSize _cached_size_; )cc"); }}, {"oneof_case", @@ -1550,7 +1681,7 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { if (num_weak_fields_ == 0) return; p->Emit(R"cc( - ::$proto_ns$::internal::WeakFieldMap _weak_field_map_; + $pbi$::WeakFieldMap _weak_field_map_; )cc"); }}, {"union_impl", @@ -1566,13 +1697,16 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) { struct Impl_ { //~ TODO: check if/when there is a need for an //~ outline dtor. - inline explicit constexpr Impl_( - ::$proto_ns$::internal::ConstantInitialized) noexcept; - inline explicit Impl_($pbi$::InternalVisibility visibility, - ::$proto_ns$::Arena* arena); - inline explicit Impl_($pbi$::InternalVisibility visibility, - ::$proto_ns$::Arena* arena, const Impl_& from, - const $classname$& from_msg); + inline explicit constexpr Impl_($pbi$::ConstantInitialized) noexcept; + inline explicit Impl_( + //~ + $pbi$::InternalVisibility visibility, + $pb$::Arena* $nullable$ arena); + inline explicit Impl_( + //~ + $pbi$::InternalVisibility visibility, + $pb$::Arena* $nullable$ arena, const Impl_& from, + const $classname$& from_msg); //~ Members assumed to align to 8 bytes: $extension_set$; $tracker$; @@ -1604,50 +1738,52 @@ void MessageGenerator::GenerateAnyMethodDefinition(io::Printer* p) { if (HasDescriptorMethods(descriptor_->file(), options_)) { p->Emit( R"cc( - bool PackFrom(const ::$proto_ns$::Message& message) { + bool PackFrom(const $pb$::Message& message) { $DCHK$_NE(&message, this); - return ::$proto_ns$::internal::InternalPackFrom( - message, mutable_type_url(), _internal_mutable_value()); + return $pbi$::InternalPackFrom(message, mutable_type_url(), + _internal_mutable_value()); } - bool PackFrom(const ::$proto_ns$::Message& message, + bool PackFrom(const $pb$::Message& message, ::absl::string_view type_url_prefix) { $DCHK$_NE(&message, this); - return ::$proto_ns$::internal::InternalPackFrom( - message, type_url_prefix, mutable_type_url(), - _internal_mutable_value()); + return $pbi$::InternalPackFrom(message, type_url_prefix, + mutable_type_url(), + _internal_mutable_value()); } - bool UnpackTo(::$proto_ns$::Message* message) const { - return ::$proto_ns$::internal::InternalUnpackTo( - _internal_type_url(), _internal_value(), message); + bool UnpackTo($pb$::Message* $nonnull$ message) const { + return $pbi$::InternalUnpackTo(_internal_type_url(), + _internal_value(), message); } static bool GetAnyFieldDescriptors( - const ::$proto_ns$::Message& message, - const ::$proto_ns$::FieldDescriptor** type_url_field, - const ::$proto_ns$::FieldDescriptor** value_field); + const $pb$::Message& message, + const $pb$::FieldDescriptor* $nullable$* $nonnull$ + type_url_field, + const $pb$::FieldDescriptor* $nullable$* $nonnull$ + value_field); template < typename T, class = typename std::enable_if<!std::is_convertible< - T, const ::$proto_ns$::Message&>::value>::type> + T, const $pb$::Message&>::value>::type> bool PackFrom(const T& message) { - return ::$proto_ns$::internal::InternalPackFrom<T>( + return $pbi$::InternalPackFrom<T>( message, mutable_type_url(), _internal_mutable_value()); } template < typename T, class = typename std::enable_if<!std::is_convertible< - T, const ::$proto_ns$::Message&>::value>::type> + T, const $pb$::Message&>::value>::type> bool PackFrom(const T& message, ::absl::string_view type_url_prefix) { - return ::$proto_ns$::internal::InternalPackFrom<T>( + return $pbi$::InternalPackFrom<T>( message, type_url_prefix, mutable_type_url(), _internal_mutable_value()); } template < typename T, class = typename std::enable_if<!std::is_convertible< - T, const ::$proto_ns$::Message&>::value>::type> - bool UnpackTo(T* message) const { - return ::$proto_ns$::internal::InternalUnpackTo<T>( + T, const $pb$::Message&>::value>::type> + bool UnpackTo(T* $nonnull$ message) const { + return $pbi$::InternalUnpackTo<T>( _internal_type_url(), _internal_value(), message); } )cc"); @@ -1656,20 +1792,20 @@ void MessageGenerator::GenerateAnyMethodDefinition(io::Printer* p) { R"cc( template <typename T> bool PackFrom(const T& message) { - return ::$proto_ns$::internal::InternalPackFrom( - message, mutable_type_url(), _internal_mutable_value()); + return $pbi$::InternalPackFrom(message, mutable_type_url(), + _internal_mutable_value()); } template <typename T> bool PackFrom(const T& message, ::absl::string_view type_url_prefix) { - return ::$proto_ns$::internal::InternalPackFrom( - message, type_url_prefix, mutable_type_url(), - _internal_mutable_value()); + return $pbi$::InternalPackFrom(message, type_url_prefix, + mutable_type_url(), + _internal_mutable_value()); } template <typename T> - bool UnpackTo(T* message) const { - return ::$proto_ns$::internal::InternalUnpackTo( - _internal_type_url(), _internal_value(), message); + bool UnpackTo(T* $nonnull$ message) const { + return $pbi$::InternalUnpackTo(_internal_type_url(), + _internal_value(), message); } )cc"); } @@ -1682,10 +1818,12 @@ void MessageGenerator::GenerateAnyMethodDefinition(io::Printer* p) { template <typename T> bool Is() const { - return ::$proto_ns$::internal::InternalIs<T>(_internal_type_url()); + return $pbi$::InternalIs<T>(_internal_type_url()); } - static bool ParseAnyTypeUrl(::absl::string_view type_url, - std::string* full_type_name); + static bool ParseAnyTypeUrl( + //~ + ::absl::string_view type_url, + std::string* $nonnull$ full_type_name); )cc"); } @@ -1722,7 +1860,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { } p->Emit(R"cc( - static const ::$proto_ns$::Descriptor* descriptor() { + static const $pb$::Descriptor* $nonnull$ descriptor() { return GetDescriptor(); } )cc"); @@ -1740,10 +1878,10 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { if (!HasDescriptorMethods(descriptor_->file(), options_)) return; p->Emit(R"cc( - static const ::$proto_ns$::Descriptor* GetDescriptor() { + static const $pb$::Descriptor* $nonnull$ GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::$proto_ns$::Reflection* GetReflection() { + static const $pb$::Reflection* $nonnull$ GetReflection() { return default_instance().GetMetadata().reflection; } )cc"); @@ -1803,9 +1941,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { void MergeFrom(const $classname$& from) { $classname$::MergeImpl(*this, from); } private: - static void MergeImpl( - ::$proto_ns$::MessageLite& to_msg, - const ::$proto_ns$::MessageLite& from_msg); + static void MergeImpl($pb$::MessageLite& to_msg, + const $pb$::MessageLite& from_msg); public: )cc"); @@ -1829,8 +1966,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { void MergeFrom(const $classname$& from) { $classname$::MergeImpl(*this, from); } private: - static void MergeImpl(::$proto_ns$::MessageLite& to_msg, - const ::$proto_ns$::MessageLite& from_msg); + static void MergeImpl($pb$::MessageLite& to_msg, + const $pb$::MessageLite& from_msg); public: )cc"); @@ -1868,23 +2005,24 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) private: - static ::size_t ByteSizeLong(const ::$proto_ns$::MessageLite& msg); - static $uint8$* _InternalSerialize( - const MessageLite& msg, $uint8$* target, - ::$proto_ns$::io::EpsCopyOutputStream* stream); + static ::size_t ByteSizeLong(const $pb$::MessageLite& msg); + static $uint8$* $nonnull$ _InternalSerialize( + const $pb$::MessageLite& msg, $uint8$* $nonnull$ target, + $pb$::io::EpsCopyOutputStream* $nonnull$ stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - $uint8$* _InternalSerialize( - $uint8$* target, - ::$proto_ns$::io::EpsCopyOutputStream* stream) const { + $uint8$* $nonnull$ _InternalSerialize( + $uint8$* $nonnull$ target, + $pb$::io::EpsCopyOutputStream* $nonnull$ stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - $uint8$* _InternalSerialize( - $uint8$* target, - ::$proto_ns$::io::EpsCopyOutputStream* stream) const final; + $uint8$* $nonnull$ _InternalSerialize( + //~ + $uint8$* $nonnull$ target, + $pb$::io::EpsCopyOutputStream* $nonnull$ stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE )cc"); } @@ -1906,9 +2044,9 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { int GetCachedSize() const { return $cached_size$.Get(); } private: - void SharedCtor(::$proto_ns$::Arena* arena); + void SharedCtor($pb$::Arena* $nullable$ arena); static void SharedDtor(MessageLite& self); - void InternalSwap($classname$* other); + void InternalSwap($classname$* $nonnull$ other); )cc"); }}, {"arena_dtor", @@ -1917,9 +2055,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { case ArenaDtorNeeds::kOnDemand: p->Emit(R"cc( private: - static void ArenaDtor(void* object); - static void OnDemandRegisterArenaDtor( - MessageLite& msg, ::$proto_ns$::Arena& arena) { + static void ArenaDtor(void* $nonnull$ object); + static void OnDemandRegisterArenaDtor(MessageLite& msg, $pb$::Arena& arena) { auto& this_ = static_cast<$classname$&>(msg); if ((this_.$inlined_string_donated_array$[0] & 0x1u) == 0) { return; @@ -1932,7 +2069,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { case ArenaDtorNeeds::kRequired: p->Emit(R"cc( private: - static void ArenaDtor(void* object); + static void ArenaDtor(void* $nonnull$ object); )cc"); break; case ArenaDtorNeeds::kNone: @@ -1944,7 +2081,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { if (!HasDescriptorMethods(descriptor_->file(), options_)) return; p->Emit(R"cc( - ::$proto_ns$::Metadata GetMetadata() const; + $pb$::Metadata GetMetadata() const; )cc"); }}, {"decl_split_methods", @@ -1973,7 +2110,10 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { { Sub{"nested_full_name", ClassName(nested_type, false)} .AnnotatedAs(nested_type), - Sub{"nested_name", ResolveKeyword(nested_type->name())} + Sub{"nested_name", + ResolveKnownNameCollisions(nested_type->name(), + NameContext::kMessage, + NameKind::kType)} .AnnotatedAs(nested_type), }, R"cc( @@ -2035,17 +2175,13 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { [&] { if (!NeedsPostLoopHandler(descriptor_, options_)) return; p->Emit(R"cc( - static const char* PostLoopHandler(MessageLite* msg, - const char* ptr, - $pbi$::ParseContext* ctx); + static const char* $nullable$ PostLoopHandler( + MessageLite* $nonnull$ msg, const char* $nullable$ ptr, + $pbi$::ParseContext* $nonnull$ ctx); )cc"); }}, {"decl_impl", [&] { GenerateImplDefinition(p); }}, - {"classdata_type", - HasDescriptorMethods(descriptor_->file(), options_) - ? "ClassDataFull" - : absl::StrFormat("ClassDataLite<%d>", - descriptor_->full_name().size() + 1)}, + {"classdata_type", ClassDataType(descriptor_, options_)}, {"split_friend", [&] { if (!ShouldSplit(descriptor_, options_)) return; @@ -2066,7 +2202,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { #if defined(PROTOBUF_CUSTOM_VTABLE) //~ Define a derived `operator delete` to avoid dynamic dispatch when //~ the type is statically known - void operator delete($classname$* msg, std::destroying_delete_t) { + void operator delete($classname$* $nonnull$ msg, std::destroying_delete_t) { SharedDtor(*msg); $pbi$::SizedDelete(msg, sizeof($classname$)); } @@ -2075,8 +2211,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { //~ Templatize constexpr constructor as a workaround for a bug in //~ gcc 12 (warning in gcc 13). template <typename = void> - explicit PROTOBUF_CONSTEXPR $classname$( - ::$proto_ns$::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR $classname$($pbi$::ConstantInitialized); inline $classname$(const $classname$& from) : $classname$(nullptr, from) {} inline $classname$($classname$&& from) noexcept @@ -2101,7 +2236,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { $annotate_unknown_fields$; return $unknown_fields$; } - inline $unknown_fields_type$* mutable_unknown_fields() + inline $unknown_fields_type$* $nonnull$ mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { $annotate_mutable_unknown_fields$; return $mutable_unknown_fields$; @@ -2110,19 +2245,14 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { $descriptor_accessor$; $get_descriptor$; static const $classname$& default_instance() { - return *internal_default_instance(); - } - $decl_oneof$; - //~ TODO make this private, while still granting other - //~ protos access. - static inline const $classname$* internal_default_instance() { - return reinterpret_cast<const $classname$*>( + return *reinterpret_cast<const $classname$*>( &_$classname$_default_instance_); } + $decl_oneof$; static constexpr int kIndexInFileMessages = $index_in_file_messages$; $decl_any_methods$; friend void swap($classname$& a, $classname$& b) { a.Swap(&b); } - PROTOBUF_NOINLINE void Swap($classname$* other) { + inline void Swap($classname$* $nonnull$ other) { if (other == this) return; if ($pbi$::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -2130,7 +2260,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { $pbi$::GenericSwap(this, other); } } - void UnsafeArenaSwap($classname$* other) { + void UnsafeArenaSwap($classname$* $nonnull$ other) { if (other == this) return; $DCHK$(GetArena() == other->GetArena()); InternalSwap(other); @@ -2138,7 +2268,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { // implements Message ---------------------------------------------- - $classname$* New(::$proto_ns$::Arena* arena = nullptr) const { + $classname$* $nonnull$ New($pb$::Arena* $nullable$ arena = nullptr) const { return $superclass$::DefaultConstruct<$classname$>(arena); } $generated_methods$; @@ -2152,8 +2282,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { //~ the absl::string_view namespace). private: template <typename T> - friend ::absl::string_view( - ::$proto_ns$::internal::GetAnyMessageName)(); + friend ::absl::string_view($pbi$::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "$full_name$"; } $decl_annotate$; @@ -2161,20 +2290,29 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { //~ deriving from protos to give access to this constructor, //~ breaking the invariants we rely on. protected: - explicit $classname$(::$proto_ns$::Arena* arena); - $classname$(::$proto_ns$::Arena* arena, const $classname$& from); - $classname$(::$proto_ns$::Arena* arena, $classname$&& from) noexcept + explicit $classname$($pb$::Arena* $nullable$ arena); + $classname$($pb$::Arena* $nullable$ arena, const $classname$& from); + $classname$( + //~ + $pb$::Arena* $nullable$ arena, $classname$&& from) noexcept : $classname$(arena) { *this = ::std::move(from); } $arena_dtor$; - const $pbi$::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::$proto_ns$::Arena* arena); + const $pbi$::ClassData* $nonnull$ GetClassData() const PROTOBUF_FINAL; + static void* $nonnull$ PlacementNew_( + //~ + const void* $nonnull$, void* $nonnull$ mem, + $pb$::Arena* $nullable$ arena); static constexpr auto InternalNewImpl_(); - static const $pbi$::$classdata_type$ _class_data_; public: + //~ We need this in the public section to call it from the initializer + //~ of T_class_data_. However, since it is `constexpr` and has an + //~ `auto` return type it is not callable from outside the .pb.cc + //~ without a definition so it is effectively private. + static constexpr auto InternalGenerateClassData_(); + $get_metadata$; $decl_split_methods$; // nested types ---------------------------------------------------- @@ -2196,10 +2334,10 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { $decl_data$; $post_loop_handler$; - friend class ::$proto_ns$::MessageLite; - friend class ::$proto_ns$::Arena; + friend class $pb$::MessageLite; + friend class $pb$::Arena; template <typename T> - friend class ::$proto_ns$::Arena::InternalHelper; + friend class $pb$::Arena::InternalHelper; using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; $decl_impl$; @@ -2208,6 +2346,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { //~ order to construct the offsets of all members. friend struct ::$tablename$; }; + + $dllexport_decl $extern const $pbi$::$classdata_type$ $classname$_class_data_; )cc"); } // NOLINT(readability/fn_size) @@ -2288,12 +2428,13 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { {"class_data", [&] { GenerateClassData(p); }}}, R"cc( #if defined(PROTOBUF_CUSTOM_VTABLE) - $classname$::$classname$() : SuperType(_class_data_.base()) {} - $classname$::$classname$(::$proto_ns$::Arena* arena) - : SuperType(arena, _class_data_.base()) {} + $classname$::$classname$() + : SuperType($classname$_class_data_.base()) {} + $classname$::$classname$($pb$::Arena* $nullable$ arena) + : SuperType(arena, $classname$_class_data_.base()) {} #else // PROTOBUF_CUSTOM_VTABLE $classname$::$classname$() : SuperType() {} - $classname$::$classname$(::$proto_ns$::Arena* arena) : SuperType(arena) {} + $classname$::$classname$($pb$::Arena* $nullable$ arena) : SuperType(arena) {} #endif // PROTOBUF_CUSTOM_VTABLE $annotate_accessors$; $verify$; @@ -2314,17 +2455,19 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { p->Emit( R"cc( bool $classname$::GetAnyFieldDescriptors( - const ::$proto_ns$::Message& message, - const ::$proto_ns$::FieldDescriptor** type_url_field, - const ::$proto_ns$::FieldDescriptor** value_field) { + const $pb$::Message& message, + const $pb$::FieldDescriptor** type_url_field, + const $pb$::FieldDescriptor** value_field) { return ::_pbi::GetAnyFieldDescriptors(message, type_url_field, value_field); } )cc"); }}}, R"cc( $any_field_descriptor$; - bool $classname$::ParseAnyTypeUrl(::absl::string_view type_url, - std::string* full_type_name) { + bool $classname$::ParseAnyTypeUrl( + //~ + ::absl::string_view type_url, + std::string* $nonnull$ full_type_name) { return ::_pbi::ParseAnyTypeUrl(type_url, full_type_name); } )cc"); @@ -2423,7 +2566,7 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { DefaultInstanceName(descriptor_, options_, /*split=*/false)}}, R"cc( void $classname$::PrepareSplitMessageForWrite() { - if (PROTOBUF_PREDICT_TRUE(IsSplitMessageDefault())) { + if (ABSL_PREDICT_TRUE(IsSplitMessageDefault())) { void* chunk = $pbi$::CreateSplitMessageGeneric( GetArena(), &$split_default$, sizeof(Impl_::Split), this, &$default$); @@ -2454,7 +2597,7 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { if (!HasDescriptorMethods(descriptor_->file(), options_)) return; // Same as the base class, but it avoids virtual dispatch. p->Emit(R"cc( - ::$proto_ns$::Metadata $classname$::GetMetadata() const { + $pb$::Metadata $classname$::GetMetadata() const { return $superclass$::GetMetadataImpl(GetClassData()->full()); } )cc"); @@ -2466,9 +2609,9 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { [&] { }}}, R"cc( - const char* $classname$::PostLoopHandler( - MessageLite* msg, const char* ptr, - ::_pbi::ParseContext* ctx) { + const char* $nullable$ $classname$::PostLoopHandler( + MessageLite* $nonnull$ msg, const char* $nullable$ ptr, + ::_pbi::ParseContext* $nonnull$ ctx) { $classname$* _this = static_cast<$classname$*>(msg); $annotate_deserialize$; $required$; @@ -2483,7 +2626,7 @@ void MessageGenerator::GenerateClassMethods(io::Printer* p) { [&] { if (!HasTracker(descriptor_, options_)) return; p->Emit(R"cc( - ::$proto_ns$::AccessListener<$classtype$> $classname$::$tracker$( + $pb$::AccessListener<$classtype$> $classname$::$tracker$( &FullMessageName); )cc"); }}}, @@ -2821,13 +2964,13 @@ void MessageGenerator::GenerateSharedConstructorCode(io::Printer* p) { p->Emit({{"init_impl", [&] { GenerateImplMemberInit(p, InitType::kArena); }}, {"zero_init", [&] { GenerateZeroInitFields(p); }}}, R"cc( - inline PROTOBUF_NDEBUG_INLINE $classname$::Impl_::Impl_( + PROTOBUF_NDEBUG_INLINE $classname$::Impl_::Impl_( $pbi$::InternalVisibility visibility, - ::$proto_ns$::Arena* arena) + $pb$::Arena* $nullable$ arena) //~ $init_impl$ {} - inline void $classname$::SharedCtor(::_pb::Arena* arena) { + inline void $classname$::SharedCtor(::_pb::Arena* $nullable$ arena) { new (&_impl_) Impl_(internal_visibility(), arena); $zero_init$; } @@ -2869,7 +3012,7 @@ void MessageGenerator::GenerateSharedDestructorCode(io::Printer* p) { [&] { emit_field_dtors(/* split_fields= */ true); }}, }, R"cc( - if (PROTOBUF_PREDICT_FALSE(!this_.IsSplitMessageDefault())) { + if (ABSL_PREDICT_FALSE(!this_.IsSplitMessageDefault())) { auto* $cached_split_ptr$ = this_.$split$; $split_field_dtors_impl$; delete $cached_split_ptr$; @@ -2961,8 +3104,7 @@ void MessageGenerator::GenerateArenaDestructorCode(io::Printer* p) { [&] { emit_field_dtors(/* split_fields= */ true); }}, }, R"cc( - if (PROTOBUF_PREDICT_FALSE( - !_this->IsSplitMessageDefault())) { + if (ABSL_PREDICT_FALSE(!_this->IsSplitMessageDefault())) { $split_field_dtors_impl$; } )cc"); @@ -2977,7 +3119,7 @@ void MessageGenerator::GenerateArenaDestructorCode(io::Printer* p) { }}, }, R"cc( - void $classname$::ArenaDtor(void* object) { + void $classname$::ArenaDtor(void* $nonnull$ object) { $classname$* _this = reinterpret_cast<$classname$*>(object); $field_dtors$; $split_field_dtors$; @@ -3009,7 +3151,7 @@ void MessageGenerator::GenerateConstexprConstructor(io::Printer* p) { template <typename> $constexpr$ $classname$::$classname$(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : $base$(_class_data_.base()){} + : $base$($classname$_class_data_.base()){} #else // PROTOBUF_CUSTOM_VTABLE : $base$() { } @@ -3036,7 +3178,7 @@ void MessageGenerator::GenerateConstexprConstructor(io::Printer* p) { template <typename> $constexpr$ $classname$::$classname$(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : $superclass$(_class_data_.base()), + : $superclass$($classname$_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : $superclass$(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -3045,32 +3187,18 @@ void MessageGenerator::GenerateConstexprConstructor(io::Printer* p) { )cc"); } -bool MessageGenerator::ImplHasCopyCtor() const { +bool MessageGenerator::CanUseTrivialCopy() const { if (ShouldSplit(descriptor_, options_)) return false; if (HasSimpleBaseClass(descriptor_, options_)) return false; if (descriptor_->extension_range_count() > 0) return false; - if (descriptor_->real_oneof_decl_count() > 0) return false; if (num_weak_fields_ > 0) return false; - // If the message contains only scalar fields (ints and enums), - // then we can copy the entire impl_ section with a single statement. - for (const auto* field : optimized_order_) { - if (field->is_repeated()) return false; - if (field->is_extension()) return false; - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_ENUM: - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT32: - case FieldDescriptor::CPPTYPE_UINT64: - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_DOUBLE: - case FieldDescriptor::CPPTYPE_BOOL: - break; - default: - return false; - } + // If all fields are trivially copyable then we can use the trivial copy + // constructor of Impl_ + for (const auto* field : FieldRange(descriptor_)) { + if (!field_generators_.get(field).has_trivial_copy()) return false; } + return true; } @@ -3123,9 +3251,10 @@ void MessageGenerator::GenerateCopyInitFields(io::Printer* p) const { if (has_bit_indices_.empty()) { p->Emit("from.$field$ != nullptr"); } else { - int index = has_bit_indices_[field->index()]; - std::string mask = absl::StrFormat("0x%08xu", 1u << (index % 32)); - p->Emit({{"mask", mask}}, "cached_has_bits & $mask$"); + int has_bit_index = has_bit_indices_[field->index()]; + p->Emit({{"condition", GenerateConditionMaybeWithProbabilityForField( + has_bit_index, field, options_)}}, + "$condition$"); } }; @@ -3134,9 +3263,9 @@ void MessageGenerator::GenerateCopyInitFields(io::Printer* p) const { p->Emit({{"has_msg", [&] { has_message(field); }}, {"submsg", FieldMessageTypeName(field, options_)}}, R"cc( - $field$ = ($has_msg$) ? $superclass$::CopyConstruct<$submsg$>( - arena, *from.$field$) - : nullptr; + $field$ = ($has_msg$) + ? $superclass$::CopyConstruct(arena, *from.$field$) + : nullptr; )cc"); }; @@ -3230,7 +3359,7 @@ void MessageGenerator::GenerateCopyInitFields(io::Printer* p) const { if (ShouldSplit(descriptor_, options_)) { p->Emit({{"copy_split_fields", generate_copy_split_fields}}, R"cc( - if (PROTOBUF_PREDICT_FALSE(!from.IsSplitMessageDefault())) { + if (ABSL_PREDICT_FALSE(!from.IsSplitMessageDefault())) { PrepareSplitMessageForWrite(); $copy_split_fields$; } @@ -3244,9 +3373,10 @@ void MessageGenerator::GenerateArenaEnabledCopyConstructor(io::Printer* p) { p->Emit( {{"init", [&] { GenerateImplMemberInit(p, InitType::kArenaCopy); }}}, R"cc( - inline PROTOBUF_NDEBUG_INLINE $classname$::Impl_::Impl_( - $pbi$::InternalVisibility visibility, ::$proto_ns$::Arena* arena, - const Impl_& from, const $classtype$& from_msg) + PROTOBUF_NDEBUG_INLINE $classname$::Impl_::Impl_( + $pbi$::InternalVisibility visibility, + $pb$::Arena* $nullable$ arena, const Impl_& from, + const $classtype$& from_msg) //~ $init$ {} )cc"); @@ -3300,11 +3430,11 @@ void MessageGenerator::GenerateArenaEnabledCopyConstructor(io::Printer* p) { R"cc( $classname$::$classname$( //~ force alignment - ::$proto_ns$::Arena* arena, + $pb$::Arena* $nullable$ arena, //~ force alignment const $classname$& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : $superclass$(arena, _class_data_.base()) { + : $superclass$(arena, $classname$_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : $superclass$(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -3352,9 +3482,9 @@ void MessageGenerator::GenerateStructors(io::Printer* p) { }}, }, R"cc( - $classname$::$classname$(::$proto_ns$::Arena* arena) + $classname$::$classname$($pb$::Arena* $nullable$ arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : $superclass$(arena, _class_data_.base()) { + : $superclass$(arena, $classname$_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : $superclass$(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -3372,18 +3502,24 @@ void MessageGenerator::GenerateStructors(io::Printer* p) { p->Emit(R"cc( $classname$::$classname$( //~ Force alignment - ::$proto_ns$::Arena* arena, const $classname$& from) + $pb$::Arena* $nullable$ arena, const $classname$& from) : $classname$(arena) { MergeFrom(from); } )cc"); - } else if (ImplHasCopyCtor()) { + } else if (CanUseTrivialCopy()) { p->Emit(R"cc( $classname$::$classname$( //~ Force alignment - ::$proto_ns$::Arena* arena, const $classname$& from) - : $classname$(arena) { - MergeFrom(from); + $pb$::Arena* $nullable$ arena, const $classname$& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : $superclass$(arena, $classname$_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : $superclass$(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<$unknown_fields_type$>( + from._internal_metadata_); } )cc"); } else { @@ -3425,13 +3561,13 @@ void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* p) { Formatter format(p); if (ShouldGenerateExternSpecializations(options_) && ShouldGenerateClass(descriptor_, options_)) { - p->Emit(R"cc( - template void* Arena::DefaultConstruct<$classtype$>(Arena*); - )cc"); + p->Emit(R"( + template void* $nonnull$ Arena::DefaultConstruct<$classtype$>(Arena* $nullable$); + )"); if (!IsMapEntryMessage(descriptor_)) { - p->Emit(R"cc( - template void* Arena::CopyConstruct<$classtype$>(Arena*, const void*); - )cc"); + p->Emit(R"( + template void* $nonnull$ Arena::CopyConstruct<$classtype$>(Arena* $nullable$, const void* $nonnull$); + )"); } } } @@ -3533,11 +3669,11 @@ void MessageGenerator::GenerateClear(io::Printer* p) { !IsLikelyPresent(fields.back(), options_) && (memset_end != fields.back() || merge_zero_init); + DebugAssertUniformLikelyPresence(fields, options_); + if (check_has_byte) { // Emit an if() that will let us skip the whole chunk if none are set. uint32_t chunk_mask = GenChunkMask(fields, has_bit_indices_); - std::string chunk_mask_str = - absl::StrCat(absl::Hex(chunk_mask, absl::kZeroPad8)); // Check (up to) 8 has_bits at a time if we have more than one field in // this chunk. Due to field layout ordering, we may check @@ -3549,7 +3685,9 @@ void MessageGenerator::GenerateClear(io::Printer* p) { cached_has_word_index = HasWordIndex(fields.front()); format("cached_has_bits = $has_bits$[$1$];\n", cached_has_word_index); } - format("if (cached_has_bits & 0x$1$u) {\n", chunk_mask_str); + + format("if ($1$) {\n", GenerateConditionMaybeWithProbabilityForGroup( + chunk_mask, fields, options_)); format.Indent(); } @@ -3582,8 +3720,8 @@ void MessageGenerator::GenerateClear(io::Printer* p) { field->cpp_type() == FieldDescriptor::CPPTYPE_STRING); if (have_enclosing_if) { - PrintPresenceCheck(field, has_bit_indices_, p, - &cached_has_word_index); + PrintPresenceCheck(field, has_bit_indices_, p, &cached_has_word_index, + options_); format.Indent(); } @@ -3690,8 +3828,8 @@ void MessageGenerator::GenerateSwap(io::Printer* p) { Formatter format(p); format( - "void $classname$::InternalSwap($classname$* PROTOBUF_RESTRICT other) " - "{\n"); + "void $classname$::InternalSwap($classname$* PROTOBUF_RESTRICT " + "$nonnull$ other) {\n"); format.Indent(); format("using std::swap;\n"); format("$WeakDescriptorSelfPin$"); @@ -3876,21 +4014,16 @@ MessageGenerator::NewOpRequirements MessageGenerator::GetNewOp( break; case FieldDescriptor::CPPTYPE_STRING: - switch (internal::cpp::EffectiveStringCType(field)) { - case FieldOptions::STRING_PIECE: - op.needs_arena_seeding = true; - print_arena_offset(); - break; - case FieldOptions::CORD: + switch (field->cpp_string_type()) { + case FieldDescriptor::CppStringType::kCord: // Cord fields are currently rejected above because of ArenaDtor // requirements. ABSL_CHECK(op.needs_to_run_constructor); break; - case FieldOptions::STRING: + case FieldDescriptor::CppStringType::kView: + case FieldDescriptor::CppStringType::kString: op.needs_memcpy = true; break; - default: - ABSL_LOG(FATAL); } break; case FieldDescriptor::CPPTYPE_MESSAGE: @@ -3923,8 +4056,10 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { // object might be too large for arena seeding. // We mark `inline` to avoid library bloat if the function is unused. p->Emit(R"cc( - inline void* $classname$::PlacementNew_(const void*, void* mem, - ::$proto_ns$::Arena* arena) { + inline void* $nonnull$ $classname$::PlacementNew_( + //~ + const void* $nonnull$, void* $nonnull$ mem, + $pb$::Arena* $nullable$ arena) { return ::new (mem) $classname$(arena); } )cc"); @@ -3999,14 +4134,16 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { )cc"); } else { p->Emit(R"cc( - static_cast<void (::$proto_ns$::MessageLite::*)()>( - &$classname$::ClearImpl), + static_cast<void ($pb$::MessageLite::*)()>(&$classname$::ClearImpl), $superclass$::ByteSizeLongImpl, $superclass$::_InternalSerializeImpl , )cc"); } }; + const auto emit_v2_data = [&] { + }; + if (HasDescriptorMethods(descriptor_->file(), options_)) { const auto pin_weak_descriptor = [&] { if (!UsingImplicitWeakDescriptor(descriptor_->file(), options_)) return; @@ -4035,9 +4172,7 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { {"is_initialized", is_initialized}, {"pin_weak_descriptor", pin_weak_descriptor}, {"custom_vtable_methods", custom_vtable_methods}, - {"v2_msg_table", - [&] { - }}, + {"v2_data", emit_v2_data}, {"tracker_on_get_metadata", [&] { if (HasTracker(descriptor_, options_)) { @@ -4052,33 +4187,39 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { }}, }, R"cc( - PROTOBUF_CONSTINIT_WITH_PTR - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 - const $pbi$::ClassDataFull $classname$::_class_data_ = { - $pbi$::ClassData{ - $default_instance$, - &_table_.header, - $on_demand_register_arena_dtor$, - $is_initialized$, - &$classname$::MergeImpl, - $superclass$::GetNewImpl<$classname$>(), + constexpr auto $classname$::InternalGenerateClassData_() { + return $pbi$::ClassDataFull{ + $pbi$::ClassData{ + $default_instance$, + &_table_.header, + $on_demand_register_arena_dtor$, + $is_initialized$, + &$classname$::MergeImpl, + $superclass$::GetNewImpl<$classname$>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &$classname$::SharedDtor, - $custom_vtable_methods$, + &$classname$::SharedDtor, + $custom_vtable_methods$, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), - false, - $v2_msg_table$, - }, - &$classname$::kDescriptorMethods, - &$desc_table$, - $tracker_on_get_metadata$, - }; - const $pbi$::ClassData* $classname$::GetClassData() const { + PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), + false, + $v2_data$, + }, + &$classname$::kDescriptorMethods, + &$desc_table$, + $tracker_on_get_metadata$, + }; + } + + PROTOBUF_CONSTINIT_WITH_PTR$ dllexport_decl$ + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const $pbi$::ClassDataFull + $classname$_class_data_ = + $classname$::InternalGenerateClassData_(); + + const $pbi$::ClassData* $nonnull$ $classname$::GetClassData() const { $pin_weak_descriptor$; - $pbi$::PrefetchToLocalCache(&_class_data_); - $pbi$::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + $pbi$::PrefetchToLocalCache(&$classname$_class_data_); + $pbi$::PrefetchToLocalCache($classname$_class_data_.tc_table); + return $classname$_class_data_.base(); } )cc"); } else { @@ -4088,33 +4229,37 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { {"on_demand_register_arena_dtor", on_demand_register_arena_dtor}, {"is_initialized", is_initialized}, {"custom_vtable_methods", custom_vtable_methods}, - {"v2_msg_table", - [&] { - }}, + {"v2_data", emit_v2_data}, }, R"cc( + constexpr auto $classname$::InternalGenerateClassData_() { + return $pbi$::ClassDataLite<$type_size$>{ + { + $default_instance$, + &_table_.header, + $on_demand_register_arena_dtor$, + $is_initialized$, + &$classname$::MergeImpl, + $superclass$::GetNewImpl<$classname$>(), +#if defined(PROTOBUF_CUSTOM_VTABLE) + &$classname$::SharedDtor, + $custom_vtable_methods$, +#endif // PROTOBUF_CUSTOM_VTABLE + PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), + true, + $v2_data$, + }, + "$full_name$", + }; + } + PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 - const $pbi$::ClassDataLite<$type_size$> $classname$::_class_data_ = { - { - $default_instance$, - &_table_.header, - $on_demand_register_arena_dtor$, - $is_initialized$, - &$classname$::MergeImpl, - $superclass$::GetNewImpl<$classname$>(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &$classname$::SharedDtor, - $custom_vtable_methods$, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), - true, - $v2_msg_table$, - }, - "$full_name$", - }; - const $pbi$::ClassData* $classname$::GetClassData() const { - return _class_data_.base(); + const $pbi$::ClassDataLite<$type_size$> $classname$_class_data_ = + $classname$::InternalGenerateClassData_(); + + const $pbi$::ClassData* $nonnull$ $classname$::GetClassData() const { + return $classname$_class_data_.base(); } )cc"); } @@ -4135,15 +4280,15 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { // cast. Formatter format(p); format( - "void $classname$::MergeImpl(::$proto_ns$::MessageLite& to_msg, const " - "::$proto_ns$::MessageLite& from_msg) {\n" + "void $classname$::MergeImpl($pb$::MessageLite& to_msg, const " + "$pb$::MessageLite& from_msg) {\n" "$WeakDescriptorSelfPin$" " auto* const _this = static_cast<$classname$*>(&to_msg);\n" " auto& from = static_cast<const $classname$&>(from_msg);\n"); format.Indent(); if (RequiresArena(GeneratorFunction::kMergeFrom)) { p->Emit(R"cc( - ::$proto_ns$::Arena* arena = _this->GetArena(); + $pb$::Arena* arena = _this->GetArena(); )cc"); } format( @@ -4158,7 +4303,7 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { if (ShouldSplit(descriptor_, options_)) { format( - "if (PROTOBUF_PREDICT_FALSE(!from.IsSplitMessageDefault())) {\n" + "if (ABSL_PREDICT_FALSE(!from.IsSplitMessageDefault())) {\n" " _this->PrepareSplitMessageForWrite();\n" "}\n"); } @@ -4189,6 +4334,8 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { const bool check_has_byte = cache_has_bits && fields.size() > 1 && !IsLikelyPresent(fields.back(), options_); + DebugAssertUniformLikelyPresence(fields, options_); + if (cache_has_bits && cached_has_word_index != HasWordIndex(fields.front())) { cached_has_word_index = HasWordIndex(fields.front()); @@ -4199,8 +4346,6 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { if (check_has_byte) { // Emit an if() that will let us skip the whole chunk if none are set. uint32_t chunk_mask = GenChunkMask(fields, has_bit_indices_); - std::string chunk_mask_str = - absl::StrCat(absl::Hex(chunk_mask, absl::kZeroPad8)); // Check (up to) 8 has_bits at a time if we have more than one field in // this chunk. Due to field layout ordering, we may check @@ -4208,7 +4353,8 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { ABSL_DCHECK_LE(2, popcnt(chunk_mask)); ABSL_DCHECK_GE(8, popcnt(chunk_mask)); - format("if (cached_has_bits & 0x$1$u) {\n", chunk_mask_str); + format("if ($1$) {\n", GenerateConditionMaybeWithProbabilityForGroup( + chunk_mask, fields, options_)); format.Indent(); } @@ -4221,9 +4367,10 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { } else if (field->is_optional() && !HasHasbit(field)) { // Merge semantics without true field presence: primitive fields are // merged only if non-zero (numeric) or non-empty (string). - MayEmitIfNonDefaultCheck(p, "from.", field, /*emit_body=*/[&]() { - generator.GenerateMergingCode(p); - }); + MayEmitMutableIfNonDefaultCheck( + p, "from.", field, ShouldSplit(field, options_), + /*emit_body=*/[&]() { generator.GenerateMergingCode(p); }, + /*with_enclosing_braces_always=*/true); } else if (field->options().weak() || cached_has_word_index != HasWordIndex(field)) { // Check hasbit, not using cached bits. @@ -4239,15 +4386,24 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { // Check hasbit, using cached bits. ABSL_CHECK(HasHasbit(field)); int has_bit_index = has_bit_indices_[field->index()]; - const std::string mask = absl::StrCat( - absl::Hex(1u << (has_bit_index % 32), absl::kZeroPad8)); - format("if (cached_has_bits & 0x$1$u) {\n", mask); + format("if ($1$) {\n", GenerateConditionMaybeWithProbabilityForField( + has_bit_index, field, options_)); format.Indent(); - if (check_has_byte && IsPOD(field)) { - generator.GenerateCopyConstructorCode(p); + if (GetFieldHasbitMode(field) == HasbitMode::kHintHasbit) { + // Merge semantics without true field presence: primitive fields are + // merged only if non-zero (numeric) or non-empty (string). + MayEmitMutableIfNonDefaultCheck( + p, "from.", field, ShouldSplit(field, options_), + /*emit_body=*/[&]() { generator.GenerateMergingCode(p); }, + /*with_enclosing_braces_always=*/false); } else { - generator.GenerateMergingCode(p); + ABSL_DCHECK(GetFieldHasbitMode(field) == HasbitMode::kTrueHasbit); + if (check_has_byte && IsPOD(field)) { + generator.GenerateCopyConstructorCode(p); + } else { + generator.GenerateMergingCode(p); + } } format.Outdent(); @@ -4337,9 +4493,9 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) { // Merging of extensions and unknown fields is done last, to maximize // the opportunity for tail calls. if (descriptor_->extension_range_count() > 0) { - format( - "_this->$extensions$.MergeFrom(internal_default_instance(), " - "from.$extensions$);\n"); + p->Emit(R"cc( + _this->$extensions$.MergeFrom(&default_instance(), from.$extensions$); + )cc"); } format( @@ -4468,21 +4624,21 @@ void MessageGenerator::GenerateSerializeOneField(io::Printer* p, PrintFieldComment(Formatter{p}, field, options_); if (HasHasbit(field)) { + int has_bit_index = HasBitIndex(field); + int has_word_index = has_bit_index / 32; + bool use_cached_has_bits = cached_has_bits_index == has_word_index; p->Emit( { - {"body", emit_body}, - {"cond", - [&] { - int has_bit_index = HasBitIndex(field); - auto v = p->WithVars(HasBitVars(field)); - // Attempt to use the state of cached_has_bits, if possible. - if (cached_has_bits_index == has_bit_index / 32) { - p->Emit("cached_has_bits & $has_mask$"); - } else { - p->Emit( - "(this_.$has_bits$[$has_array_index$] & $has_mask$) != 0"); - } + {"body", + [&]() { + MayEmitIfNonDefaultCheck(p, "this_.", field, + std::move(emit_body), + /*with_enclosing_braces_always=*/false); }}, + {"cond", GenerateConditionMaybeWithProbability( + 1u << (has_bit_index % 32), + GetPresenceProbability(field, options_), + use_cached_has_bits, has_word_index)}, }, R"cc( if ($cond$) { @@ -4490,7 +4646,8 @@ void MessageGenerator::GenerateSerializeOneField(io::Printer* p, } )cc"); } else if (field->is_optional()) { - MayEmitIfNonDefaultCheck(p, "this_.", field, std::move(emit_body)); + MayEmitIfNonDefaultCheck(p, "this_.", field, std::move(emit_body), + /*with_enclosing_braces_always=*/true); } else { emit_body(); } @@ -4500,12 +4657,23 @@ void MessageGenerator::GenerateSerializeOneField(io::Printer* p, void MessageGenerator::GenerateSerializeOneExtensionRange(io::Printer* p, int start, int end) { auto v = p->WithVars(variables_); - p->Emit({{"start", start}, {"end", end}}, - R"cc( - // Extension range [$start$, $end$) - target = this_.$extensions$._InternalSerialize( - internal_default_instance(), $start$, $end$, target, stream); - )cc"); + p->Emit( // + {{"start", start}, {"end", end}}, + R"cc( + // Extension range [$start$, $end$) + target = this_.$extensions$._InternalSerialize( + &default_instance(), $start$, $end$, target, stream); + )cc"); +} + +void MessageGenerator::GenerateSerializeAllExtensions(io::Printer* p) { + auto v = p->WithVars(variables_); + p->Emit( + R"cc( + // All extensions. + target = this_.$extensions$._InternalSerializeAll(&default_instance(), + target, stream); + )cc"); } void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) { @@ -4514,20 +4682,20 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) { // Special-case MessageSet. p->Emit(R"cc( #if defined(PROTOBUF_CUSTOM_VTABLE) - $uint8$* $classname$::_InternalSerialize( - const MessageLite& base, $uint8$* target, - ::$proto_ns$::io::EpsCopyOutputStream* stream) { + $uint8$* $nonnull$ $classname$::_InternalSerialize( + const $pb$::MessageLite& base, $uint8$* $nonnull$ target, + $pb$::io::EpsCopyOutputStream* $nonnull$ stream) { const $classname$& this_ = static_cast<const $classname$&>(base); #else // PROTOBUF_CUSTOM_VTABLE - $uint8$* $classname$::_InternalSerialize( - $uint8$* target, - ::$proto_ns$::io::EpsCopyOutputStream* stream) const { + $uint8$* $nonnull$ $classname$::_InternalSerialize( + $uint8$* $nonnull$ target, + $pb$::io::EpsCopyOutputStream* $nonnull$ stream) const { const $classname$& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE $annotate_serialize$ target = this_.$extensions$ .InternalSerializeMessageSetWithCachedSizesToArray( - internal_default_instance(), target, stream); + &default_instance(), target, stream); target = ::_pbi::InternalSerializeUnknownMessageSetItemsToArray( this_.$unknown_fields$, target, stream); return target; @@ -4549,7 +4717,6 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) { p->Emit("$ndebug$"); } else { p->Emit(R"cc( - //~ force indenting level #ifdef NDEBUG $ndebug$; #else // NDEBUG @@ -4561,14 +4728,14 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) { }, R"cc( #if defined(PROTOBUF_CUSTOM_VTABLE) - $uint8$* $classname$::_InternalSerialize( - const MessageLite& base, $uint8$* target, - ::$proto_ns$::io::EpsCopyOutputStream* stream) { + $uint8$* $nonnull$ $classname$::_InternalSerialize( + const $pb$::MessageLite& base, $uint8$* $nonnull$ target, + $pb$::io::EpsCopyOutputStream* $nonnull$ stream) { const $classname$& this_ = static_cast<const $classname$&>(base); #else // PROTOBUF_CUSTOM_VTABLE - $uint8$* $classname$::_InternalSerialize( - $uint8$* target, - ::$proto_ns$::io::EpsCopyOutputStream* stream) const { + $uint8$* $nonnull$ $classname$::_InternalSerialize( + $uint8$* $nonnull$ target, + $pb$::io::EpsCopyOutputStream* $nonnull$ stream) const { const $classname$& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE $annotate_serialize$; @@ -4671,16 +4838,23 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody(io::Printer* p) { } } - void Flush() { - if (has_current_range_) { - mg_->GenerateSerializeOneExtensionRange(p_, min_start_, max_end_); + void Flush(bool is_last_range) { + if (!has_current_range_) { + return; } has_current_range_ = false; + ++range_count_; + if (is_last_range && range_count_ == 1) { + mg_->GenerateSerializeAllExtensions(p_); + } else { + mg_->GenerateSerializeOneExtensionRange(p_, min_start_, max_end_); + } } private: MessageGenerator* mg_; io::Printer* p_; + int range_count_ = 0; bool has_current_range_ = false; int min_start_ = 0; int max_end_ = 0; @@ -4738,12 +4912,13 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody(io::Printer* p) { size_t i, j; for (i = 0, j = 0; i < ordered_fields.size() || j < sorted_extensions.size();) { - if ((j == sorted_extensions.size()) || + bool no_more_extensions = j == sorted_extensions.size(); + if (no_more_extensions || (i < static_cast<size_t>(descriptor_->field_count()) && ordered_fields[i]->number() < sorted_extensions[j]->start_number())) { const FieldDescriptor* field = ordered_fields[i++]; - re.Flush(); + re.Flush(no_more_extensions); if (field->options().weak()) { largest_weak_field.ReplaceIfLarger(field); PrintFieldComment(Formatter{p}, field, options_); @@ -4757,7 +4932,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody(io::Printer* p) { re.AddToRange(sorted_extensions[j++]); } } - re.Flush(); + re.Flush(/*is_last_range=*/true); e.EmitIfNotNull(largest_weak_field.Release()); }}, {"handle_unknown_fields", @@ -4783,7 +4958,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody(io::Printer* p) { (void)cached_has_bits; $handle_lazy_fields$; - if (PROTOBUF_PREDICT_FALSE(this_.$have_unknown_fields$)) { + if (ABSL_PREDICT_FALSE(this_.$have_unknown_fields$)) { $handle_unknown_fields$; } )cc"); @@ -4878,7 +5053,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBodyShuffled( } } } - if (PROTOBUF_PREDICT_FALSE(this_.$have_unknown_fields$)) { + if (ABSL_PREDICT_FALSE(this_.$have_unknown_fields$)) { $handle_unknown_fields$; } )cc"); @@ -4900,6 +5075,34 @@ std::vector<uint32_t> MessageGenerator::RequiredFieldsBitMask() const { return masks; } +static std::optional<int> FixedSize(const FieldDescriptor* field) { + if (field->is_repeated() || field->real_containing_oneof() || + !field->has_presence()) { + return std::nullopt; + } + + const size_t tag_size = WireFormat::TagSize(field->number(), field->type()); + + switch (field->type()) { + case FieldDescriptor::TYPE_FIXED32: + return tag_size + WireFormatLite::kFixed32Size; + case FieldDescriptor::TYPE_FIXED64: + return tag_size + WireFormatLite::kFixed64Size; + case FieldDescriptor::TYPE_SFIXED32: + return tag_size + WireFormatLite::kSFixed32Size; + case FieldDescriptor::TYPE_SFIXED64: + return tag_size + WireFormatLite::kSFixed64Size; + case FieldDescriptor::TYPE_FLOAT: + return tag_size + WireFormatLite::kFloatSize; + case FieldDescriptor::TYPE_DOUBLE: + return tag_size + WireFormatLite::kDoubleSize; + case FieldDescriptor::TYPE_BOOL: + return tag_size + WireFormatLite::kBoolSize; + default: + return std::nullopt; + } +} + void MessageGenerator::GenerateByteSize(io::Printer* p) { if (HasSimpleBaseClass(descriptor_, options_)) return; @@ -4929,14 +5132,45 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { return; } - std::vector<FieldChunk> chunks = CollectFields( - optimized_order_, options_, - [&](const FieldDescriptor* a, const FieldDescriptor* b) -> bool { + std::vector<const FieldDescriptor*> fixed; + std::vector<const FieldDescriptor*> rest; + for (auto* f : optimized_order_) { + if (FixedSize(f).has_value()) { + fixed.push_back(f); + } else { + rest.push_back(f); + } + } + + // Sort the fixed fields to ensure maximum grouping. + // The layout of the fields is irrelevant because we are not going to read + // them. We only look at the hasbits. + const auto fixed_tuple = [&](auto* f) { + return std::make_tuple(HasWordIndex(f), FixedSize(f)); + }; + absl::c_sort( + fixed, [&](auto* a, auto* b) { return fixed_tuple(a) < fixed_tuple(b); }); + std::vector<FieldChunk> fixed_chunks = + CollectFields(fixed, options_, [&](const auto* a, const auto* b) { + return fixed_tuple(a) == fixed_tuple(b); + }); + + std::vector<FieldChunk> chunks = + CollectFields(rest, options_, [&](const auto* a, const auto* b) { return a->label() == b->label() && HasByteIndex(a) == HasByteIndex(b) && IsLikelyPresent(a, options_) == IsLikelyPresent(b, options_) && ShouldSplit(a, options_) == ShouldSplit(b, options_); }); + // Interleave the fixed chunks in the right place to be able to reuse + // cached_has_bits if available. Otherwise, add them to the end. + for (auto& chunk : fixed_chunks) { + auto it = std::find_if(chunks.begin(), chunks.end(), [&](auto& c) { + return HasWordIndex(c.fields[0]) == HasWordIndex(chunk.fields[0]); + }); + chunks.insert(it, std::move(chunk)); + } + p->Emit( {{"handle_extension_set", [&] { @@ -4976,6 +5210,15 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { auto it = chunks.begin(); auto end = chunks.end(); int cached_has_word_index = -1; + const auto update_cached_has_bits = [&](auto& fields) { + if (cached_has_word_index == HasWordIndex(fields.front())) return; + + cached_has_word_index = HasWordIndex(fields.front()); + p->Emit({{"index", cached_has_word_index}}, + R"cc( + cached_has_bits = this_.$has_bits$[$index$]; + )cc"); + }; while (it != end) { auto next = @@ -4986,9 +5229,29 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { while (it != next) { const auto& fields = it->fields; + + // If the chunk is a fixed size singular chunk, use a branchless + // approach for it. + if (std::optional<int> fsize = FixedSize(fields[0])) { + update_cached_has_bits(fields); + uint32_t mask = GenChunkMask(fields, has_bit_indices_); + p->Emit({{"mask", absl::StrFormat("0x%08xu", mask)}, + {"popcount", absl::has_single_bit(mask) + ? "static_cast<bool>" + : "::absl::popcount"}, + {"fsize", *fsize}}, + R"cc( + //~ + total_size += $popcount$($mask$ & cached_has_bits) * $fsize$; + )cc"); + ++it; + continue; + } + const bool check_has_byte = fields.size() > 1 && HasWordIndex(fields[0]) != kNoHasbit && !IsLikelyPresent(fields.back(), options_); + DebugAssertUniformLikelyPresence(fields, options_); p->Emit( {{"update_byte_size_for_chunk", [&] { @@ -5002,14 +5265,7 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { {"may_update_cached_has_word_index", [&] { if (!check_has_byte) return; - if (cached_has_word_index == HasWordIndex(fields.front())) - return; - - cached_has_word_index = HasWordIndex(fields.front()); - p->Emit({{"index", cached_has_word_index}}, - R"cc( - cached_has_bits = this_.$has_bits$[$index$]; - )cc"); + update_cached_has_bits(fields); }}, {"check_if_chunk_present", [&] { @@ -5029,9 +5285,10 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { ABSL_DCHECK_LE(2, popcnt(chunk_mask)); ABSL_DCHECK_GE(8, popcnt(chunk_mask)); - p->Emit( - {{"mask", absl::StrFormat("0x%08xu", chunk_mask)}}, - "if (cached_has_bits & $mask$)"); + p->Emit({{"condition", + GenerateConditionMaybeWithProbabilityForGroup( + chunk_mask, fields, options_)}}, + "if ($condition$)"); }}}, R"cc( $may_update_cached_has_word_index$; @@ -5122,7 +5379,7 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { // even relaxed memory order might have perf impact to replace it // with ordinary loads and stores. p->Emit(R"cc( - if (PROTOBUF_PREDICT_FALSE(this_.$have_unknown_fields$)) { + if (ABSL_PREDICT_FALSE(this_.$have_unknown_fields$)) { total_size += this_.$unknown_fields$.size(); } this_.$cached_size$.Set(::_pbi::ToCachedSize(total_size)); @@ -5196,8 +5453,7 @@ void MessageGenerator::GenerateIsInitialized(io::Printer* p) { [&] { if (descriptor_->extension_range_count() == 0) return; p->Emit(R"cc( - if (!this_.$extensions$.IsInitialized( - internal_default_instance())) { + if (!this_.$extensions$.IsInitialized(&default_instance())) { return false; } )cc"); diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/message.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/message.h index f77eaadd88968..b0a6d6a095f05 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/message.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/message.h @@ -157,6 +157,7 @@ class MessageGenerator { void GenerateSerializeOneofFields( io::Printer* p, const std::vector<const FieldDescriptor*>& fields); void GenerateSerializeOneExtensionRange(io::Printer* p, int start, int end); + void GenerateSerializeAllExtensions(io::Printer* p); // Generates has_foo() functions and variables for singular field has-bits. void GenerateSingularFieldHasBits(const FieldDescriptor* field, @@ -173,8 +174,9 @@ class MessageGenerator { // the current message's arena, reducing `GetArena()` call churn. bool RequiresArena(GeneratorFunction function) const; - // Returns whether impl_ has a copy ctor. - bool ImplHasCopyCtor() const; + // Returns true if all fields are trivially copayble, and has no non-field + // state (eg extensions). + bool CanUseTrivialCopy() const; // Returns the level that this message needs ArenaDtor. If the message has // a field that is not arena-exclusive, it needs an ArenaDtor diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/message_size_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/message_size_unittest.cc index 48314b7f766a3..4eb72e8002483 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/message_size_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/message_size_unittest.cc @@ -80,12 +80,12 @@ TEST(GeneratedMessageTest, MockSizes) { } TEST(GeneratedMessageTest, EmptyMessageSize) { - EXPECT_EQ(sizeof(protobuf_unittest::TestEmptyMessage), + EXPECT_EQ(sizeof(proto2_unittest::TestEmptyMessage), sizeof(MockZeroFieldsBase)); } TEST(GeneratedMessageTest, ReservedSize) { - EXPECT_EQ(sizeof(protobuf_unittest::TestReservedFields), + EXPECT_EQ(sizeof(proto2_unittest::TestReservedFields), sizeof(MockZeroFieldsBase)); } @@ -97,7 +97,7 @@ TEST(GeneratedMessageTest, EmptyMessageWithExtensionsSize) { // + 0-4 bytes of padding }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 48); - EXPECT_EQ(sizeof(protobuf_unittest::TestEmptyMessageWithExtensions), + EXPECT_EQ(sizeof(proto2_unittest::TestEmptyMessageWithExtensions), sizeof(MockGenerated)); } @@ -124,7 +124,7 @@ TEST(GeneratedMessageTest, RecursiveMessageSize) { ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); #endif // PROTOBUF_FORCE_SPLIT - EXPECT_EQ(sizeof(protobuf_unittest::TestRecursiveMessage), + EXPECT_EQ(sizeof(proto2_unittest::TestRecursiveMessage), sizeof(MockGenerated)); } @@ -137,7 +137,7 @@ TEST(GeneratedMessageTest, OneStringSize) { void* data; // 8 bytes }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); - EXPECT_EQ(sizeof(protobuf_unittest::OneString), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::OneString), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, MoreStringSize) { @@ -159,7 +159,7 @@ TEST(GeneratedMessageTest, MoreStringSize) { }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); #endif // PROTOBUF_FORCE_SPLIT - EXPECT_EQ(sizeof(protobuf_unittest::MoreString), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::MoreString), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, Int32MessageSize) { @@ -171,7 +171,7 @@ TEST(GeneratedMessageTest, Int32MessageSize) { int32_t data; // 4 bytes }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); - EXPECT_EQ(sizeof(protobuf_unittest::Int32Message), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::Int32Message), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, Int64MessageSize) { @@ -183,7 +183,7 @@ TEST(GeneratedMessageTest, Int64MessageSize) { int64_t data; // 8 bytes }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); - EXPECT_EQ(sizeof(protobuf_unittest::Int64Message), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::Int64Message), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, BoolMessageSize) { @@ -196,7 +196,7 @@ TEST(GeneratedMessageTest, BoolMessageSize) { // + 3 bytes padding }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); - EXPECT_EQ(sizeof(protobuf_unittest::BoolMessage), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::BoolMessage), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, OneofSize) { @@ -208,7 +208,7 @@ TEST(GeneratedMessageTest, OneofSize) { uint32_t oneof_case[1]; // 4 bytes }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); - EXPECT_EQ(sizeof(protobuf_unittest::TestOneof), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::TestOneof), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, Oneof2Size) { @@ -240,7 +240,7 @@ TEST(GeneratedMessageTest, Oneof2Size) { }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 56); #endif // PROTOBUF_FORCE_SPLIT - EXPECT_EQ(sizeof(protobuf_unittest::TestOneof2), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::TestOneof2), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, FieldOrderingsSize) { @@ -269,7 +269,7 @@ TEST(GeneratedMessageTest, FieldOrderingsSize) { }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 56); #endif // PROTOBUF_FORCE_SPLIT - EXPECT_EQ(sizeof(protobuf_unittest::TestFieldOrderings), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::TestFieldOrderings), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, TestMessageSize) { @@ -300,7 +300,7 @@ TEST(GeneratedMessageTest, TestMessageSize) { }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); #endif // PROTOBUF_FORCE_SPLIT - EXPECT_EQ(sizeof(protobuf_unittest::TestMessageSize), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::TestMessageSize), sizeof(MockGenerated)); } TEST(GeneratedMessageTest, PackedTypesSize) { @@ -342,7 +342,7 @@ TEST(GeneratedMessageTest, PackedTypesSize) { }; ABSL_CHECK_MESSAGE_SIZE(MockGenerated, 32); #endif // PROTOBUF_FORCE_SPLIT - EXPECT_EQ(sizeof(protobuf_unittest::TestPackedTypes), sizeof(MockGenerated)); + EXPECT_EQ(sizeof(proto2_unittest::TestPackedTypes), sizeof(MockGenerated)); } } // namespace cpp_unittest diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/move_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/move_unittest.cc index 0944370f49d97..70ea38c46d09f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/move_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/move_unittest.cc @@ -26,11 +26,11 @@ namespace cpp_unittest { #if LANG_CXX11 TEST(MovableMessageTest, MoveConstructor) { - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; TestUtil::SetAllFields(&message1); const auto* nested = &message1.optional_nested_message(); - protobuf_unittest::TestAllTypes message2(std::move(message1)); + proto2_unittest::TestAllTypes message2(std::move(message1)); TestUtil::ExpectAllFieldsSet(message2); // Check if the optional_nested_message was actually moved (and not just @@ -40,11 +40,11 @@ TEST(MovableMessageTest, MoveConstructor) { } TEST(MovableMessageTest, MoveAssignmentOperator) { - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; TestUtil::SetAllFields(&message1); const auto* nested = &message1.optional_nested_message(); - protobuf_unittest::TestAllTypes message2; + proto2_unittest::TestAllTypes message2; message2 = std::move(message1); TestUtil::ExpectAllFieldsSet(message2); @@ -56,7 +56,7 @@ TEST(MovableMessageTest, MoveAssignmentOperator) { TEST(MovableMessageTest, SelfMoveAssignment) { // The `self` reference is necessary to defeat -Wself-move. - protobuf_unittest::TestAllTypes message, &self = message; + proto2_unittest::TestAllTypes message, &self = message; TestUtil::SetAllFields(&message); message = std::move(self); TestUtil::ExpectAllFieldsSet(message); @@ -66,12 +66,12 @@ TEST(MovableMessageTest, MoveSameArena) { Arena arena; auto* message1_on_arena = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena); + Arena::Create<proto2_unittest::TestAllTypes>(&arena); TestUtil::SetAllFields(message1_on_arena); const auto* nested = &message1_on_arena->optional_nested_message(); auto* message2_on_arena = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena); + Arena::Create<proto2_unittest::TestAllTypes>(&arena); // Moving messages on the same arena should lead to swapped pointers. *message2_on_arena = std::move(*message1_on_arena); @@ -82,12 +82,12 @@ TEST(MovableMessageTest, MoveDifferentArenas) { Arena arena1, arena2; auto* message1_on_arena = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena1); + Arena::Create<proto2_unittest::TestAllTypes>(&arena1); TestUtil::SetAllFields(message1_on_arena); const auto* nested = &message1_on_arena->optional_nested_message(); auto* message2_on_arena = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena2); + Arena::Create<proto2_unittest::TestAllTypes>(&arena2); // Moving messages on two different arenas should lead to a copy. *message2_on_arena = std::move(*message1_on_arena); @@ -100,11 +100,11 @@ TEST(MovableMessageTest, MoveFromArena) { Arena arena; auto* message1_on_arena = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena); + Arena::Create<proto2_unittest::TestAllTypes>(&arena); TestUtil::SetAllFields(message1_on_arena); const auto* nested = &message1_on_arena->optional_nested_message(); - protobuf_unittest::TestAllTypes message2; + proto2_unittest::TestAllTypes message2; // Moving from a message on the arena should lead to a copy. message2 = std::move(*message1_on_arena); @@ -116,12 +116,12 @@ TEST(MovableMessageTest, MoveFromArena) { TEST(MovableMessageTest, MoveToArena) { Arena arena; - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; TestUtil::SetAllFields(&message1); const auto* nested = &message1.optional_nested_message(); auto* message2_on_arena = - Arena::Create<protobuf_unittest::TestAllTypes>(&arena); + Arena::Create<proto2_unittest::TestAllTypes>(&arena); // Moving to a message on the arena should lead to a copy. *message2_on_arena = std::move(message1); @@ -132,8 +132,8 @@ TEST(MovableMessageTest, MoveToArena) { TEST(MovableMessageTest, Noexcept) { EXPECT_TRUE( - std::is_nothrow_move_constructible<protobuf_unittest::TestAllTypes>()); - EXPECT_TRUE(std::is_nothrow_move_assignable<protobuf_unittest::TestAllTypes>()); + std::is_nothrow_move_constructible<proto2_unittest::TestAllTypes>()); + EXPECT_TRUE(std::is_nothrow_move_assignable<proto2_unittest::TestAllTypes>()); } #endif // LANG_CXX11 diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/options.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/options.h index 9cd7acc90cc9c..9be8ae77d7be2 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/options.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/options.h @@ -29,6 +29,12 @@ enum class EnforceOptimizeMode { kLiteRuntime, }; +enum class BoundsCheckMode { + kNoEnforcement, // No enforcement. + kReturnDefaultValue, // Return default value if out of bounds. + kAbort, // TrapOrAbort if out of bounds. +}; + struct FieldListenerOptions { bool inject_field_listener_events = false; absl::flat_hash_set<std::string> forbidden_field_listener_events; @@ -45,7 +51,7 @@ struct Options { FieldListenerOptions field_listener_options; EnforceOptimizeMode enforce_mode = EnforceOptimizeMode::kNoEnforcement; int num_cc_files = 0; - bool safe_boundary_check = false; + BoundsCheckMode bounds_check_mode = BoundsCheckMode::kNoEnforcement; bool proto_h = false; bool transitive_pb_h = true; bool annotate_headers = false; diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc index 283e9cc3b2d5b..355be7d4730e8 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/parse_function_generator.cc @@ -36,7 +36,7 @@ using internal::TailCallTableInfo; using internal::cpp::Utf8CheckMode; std::vector<const FieldDescriptor*> GetOrderedFields( - const Descriptor* descriptor, const Options& options) { + const Descriptor* descriptor) { std::vector<const FieldDescriptor*> ordered_fields; for (auto field : FieldRange(descriptor)) { ordered_fields.push_back(field); @@ -62,7 +62,7 @@ ParseFunctionGenerator::ParseFunctionGenerator( options_(options), variables_(vars), inlined_string_indices_(inlined_string_indices), - ordered_fields_(GetOrderedFields(descriptor_, options_)), + ordered_fields_(GetOrderedFields(descriptor_)), num_hasbits_(max_has_bit_index), index_in_file_messages_(index_in_file_messages) { std::vector<TailCallTableInfo::FieldOptions> fields; @@ -74,7 +74,9 @@ ParseFunctionGenerator::ParseFunctionGenerator( fields.push_back({ field, index < has_bit_indices.size() ? has_bit_indices[index] : -1, - GetPresenceProbability(field, options_), + // When not present, we're not sure how likely "field" is present. + // Assign a 50% probability to avoid pessimizing it. + GetPresenceProbability(field, options_).value_or(0.5f), GetLazyStyle(field, options_, scc_analyzer_), IsStringInlined(field, options_), IsImplicitWeakField(field, options_, scc_analyzer_), @@ -162,11 +164,11 @@ void ParseFunctionGenerator::GenerateDataDecls(io::Printer* p) { {"field_lookup_size", field_num_to_entry_table.size16()}, }, R"cc( - friend class ::$proto_ns$::internal::TcParser; + friend class $pbi$::TcParser; $SECTION$ - static const ::$proto_ns$::internal::TcParseTable< - $table_size_log2$, $num_field_entries$, $num_field_aux$, - $name_table_size$, $field_lookup_size$> + static const $pbi$::TcParseTable<$table_size_log2$, $num_field_entries$, + $num_field_aux$, $name_table_size$, + $field_lookup_size$> _table_; )cc"); } @@ -209,7 +211,7 @@ static NumToEntryTable MakeNumToEntryTable( if (start_new_block == false) { // If the next field number is within 15 of the last_skip_entry_start, we // continue writing just to that entry. If it's between 16 and 31 more, - // then we just extend the current block by one. If it's more than 31 + // then we just extend the current block by one. If it's greater than 31 // more, we have to add empty skip entries in order to continue using the // existing block. Obviously it's just 32 more, it doesn't make sense to // start a whole new block, since new blocks mean having to write out @@ -226,6 +228,7 @@ static NumToEntryTable MakeNumToEntryTable( start_new_block = false; } + ABSL_DCHECK(block != nullptr); auto skip_entry_num = (fnum - block->first_fnum) / 16; auto skip_entry_index = (fnum - block->first_fnum) % 16; while (skip_entry_num >= block->entries.size()) @@ -249,8 +252,8 @@ static std::string TcParseFunctionName(internal::TcParseFunction func) { return absl::StrCat(ns, kNames[func_index]); } -void ParseFunctionGenerator::GenerateTailCallTable(io::Printer* printer) { - Formatter format(printer, variables_); +void ParseFunctionGenerator::GenerateTailCallTable(io::Printer* p) { + auto v = p->WithVars(variables_); // For simplicity and speed, the table is not covering all proto // configurations. This model uses a fallback to cover all situations that // the table can't accommodate, together with unknown fields or extensions. @@ -258,252 +261,320 @@ void ParseFunctionGenerator::GenerateTailCallTable(io::Printer* printer) { // maps, weak fields, lazy, more than 1 extension range. In the cases // the table is sufficient we can use a generic routine, that just handles // unknown fields and potentially an extension range. - auto field_num_to_entry_table = MakeNumToEntryTable(ordered_fields_); - format( - "$1$ ::_pbi::TcParseTable<$2$, $3$, $4$, $5$, $6$> " - "$classname$::_table_ = " - "{\n", - // FileDescriptorProto's table must be constant initialized. For MSVC this - // means using `constexpr`. However, we can't use `constexpr` for all - // tables because it breaks when crossing DLL boundaries. - // FileDescriptorProto is safe from this. - IsFileDescriptorProto(descriptor_->file(), options_) - ? "constexpr" - : "PROTOBUF_CONSTINIT_WITH_PTR PROTOBUF_ATTRIBUTE_INIT_PRIORITY1\nconst", - tc_table_info_->table_size_log2, ordered_fields_.size(), - tc_table_info_->aux_entries.size(), - FieldNameDataSize(tc_table_info_->field_name_data), - field_num_to_entry_table.size16()); - { - auto table_scope = format.ScopedIndent(); - format("{\n"); - { - auto header_scope = format.ScopedIndent(); - if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) { - format("PROTOBUF_FIELD_OFFSET($classname$, _impl_._has_bits_),\n"); - } else { - format("0, // no _has_bits_\n"); - } - if (descriptor_->extension_range_count() != 0) { - format("PROTOBUF_FIELD_OFFSET($classname$, $extensions$),\n"); - } else { - format("0, // no _extensions_\n"); - } - format("$1$, $2$, // max_field_number, fast_idx_mask\n", - (ordered_fields_.empty() ? 0 : ordered_fields_.back()->number()), - (((1 << tc_table_info_->table_size_log2) - 1) << 3)); - format( - "offsetof(decltype(_table_), field_lookup_table),\n" - "$1$, // skipmap\n", - field_num_to_entry_table.skipmap32); - if (ordered_fields_.empty()) { - format( - "offsetof(decltype(_table_), field_names), // no field_entries\n"); - } else { - format("offsetof(decltype(_table_), field_entries),\n"); - } + NumToEntryTable field_num_to_entry_table = + MakeNumToEntryTable(ordered_fields_); - format( - "$1$, // num_field_entries\n" - "$2$, // num_aux_entries\n", - ordered_fields_.size(), tc_table_info_->aux_entries.size()); - if (tc_table_info_->aux_entries.empty()) { - format( - "offsetof(decltype(_table_), field_names), // no aux_entries\n"); - } else { - format("offsetof(decltype(_table_), aux_entries),\n"); - } - format("_class_data_.base(),\n"); - if (NeedsPostLoopHandler(descriptor_, options_)) { - printer->Emit(R"cc( - &$classname$::PostLoopHandler, - )cc"); - } else { - printer->Emit(R"cc( - nullptr, // post_loop_handler - )cc"); - } - format("$1$, // fallback\n", - TcParseFunctionName(tc_table_info_->fallback_function)); - std::vector<const FieldDescriptor*> subtable_fields; - for (const auto& aux : tc_table_info_->aux_entries) { - if (aux.type == internal::TailCallTableInfo::kSubTable) { - subtable_fields.push_back(aux.field); - } - } - const auto* hottest = FindHottestField(subtable_fields, options_); - // We'll prefetch `to_prefetch->to_prefetch` unconditionally to avoid - // branches. Set the pointer to itself to avoid nullptr. - printer->Emit( - {{"hottest_type_name", - QualifiedClassName( - hottest == nullptr ? descriptor_ : hottest->message_type(), - options_)}}, - // clang-format off - R"cc( -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE -::_pbi::TcParser::GetTable<$hottest_type_name$>(), // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE - )cc"); - // clang-format on - } - format("}, {{\n"); - { - // fast_entries[] - auto fast_scope = format.ScopedIndent(); - GenerateFastFieldEntries(format); - } - format("}}, {{\n"); - { - // field_lookup_table[] - auto field_lookup_scope = format.ScopedIndent(); - int line_entries = 0; - for (auto& entry_block : field_num_to_entry_table.blocks) { - format("$1$, $2$, $3$,\n", entry_block.first_fnum & 65535, - entry_block.first_fnum / 65536, entry_block.entries.size()); - for (auto se16 : entry_block.entries) { - if (line_entries == 0) { - format("$1$, $2$,", se16.skipmap, se16.field_entry_offset); - ++line_entries; - } else if (line_entries < 5) { - format(" $1$, $2$,", se16.skipmap, se16.field_entry_offset); - ++line_entries; - } else { - format(" $1$, $2$,\n", se16.skipmap, se16.field_entry_offset); - line_entries = 0; - } - } - } - if (line_entries) format("\n"); - format("65535, 65535\n"); - } - if (ordered_fields_.empty() && - !descriptor_->options().message_set_wire_format()) { - ABSL_DLOG_IF(FATAL, !tc_table_info_->aux_entries.empty()) - << "Invalid message: " << descriptor_->full_name() << " has " - << tc_table_info_->aux_entries.size() - << " auxiliary field entries, but no fields"; - format( - "}},\n" - "// no field_entries, or aux_entries\n" - "{{\n"); - } else { - format("}}, {{\n"); - { - // field_entries[] - auto field_scope = format.ScopedIndent(); - GenerateFieldEntries(format); - } - if (tc_table_info_->aux_entries.empty()) { - format( - "}},\n" - "// no aux_entries\n" - "{{\n"); - } else { - format("}}, {{\n"); - { - // aux_entries[] - auto aux_scope = format.ScopedIndent(); - for (const auto& aux_entry : tc_table_info_->aux_entries) { - switch (aux_entry.type) { - case TailCallTableInfo::kNothing: - format("{},\n"); - break; - case TailCallTableInfo::kInlinedStringDonatedOffset: - format( - "{_fl::Offset{offsetof($classname$, " - "_impl_._inlined_string_donated_)}},\n"); - break; - case TailCallTableInfo::kSplitOffset: - format( - "{_fl::Offset{offsetof($classname$, _impl_._split_)}},\n"); - break; - case TailCallTableInfo::kSplitSizeof: - format("{_fl::Offset{sizeof($classname$::Impl_::Split)}},\n"); - break; - case TailCallTableInfo::kSubMessage: - format("{::_pbi::FieldAuxDefaultMessage{}, &$1$},\n", - QualifiedDefaultInstanceName( - aux_entry.field->message_type(), options_)); - break; - case TailCallTableInfo::kSubTable: - format("{::_pbi::TcParser::GetTable<$1$>()},\n", - QualifiedClassName(aux_entry.field->message_type(), - options_)); - break; - case TailCallTableInfo::kSubMessageWeak: - format("{::_pbi::FieldAuxDefaultMessage{}, &$1$},\n", - QualifiedDefaultInstancePtr( - aux_entry.field->message_type(), options_)); - break; - case TailCallTableInfo::kMessageVerifyFunc: - format("{$1$::InternalVerify},\n", - QualifiedClassName(aux_entry.field->message_type(), - options_)); - break; - case TailCallTableInfo::kSelfVerifyFunc: - if (ShouldVerify(descriptor_, options_, scc_analyzer_)) { - format("{&InternalVerify},\n"); - } else { - format("{},\n"); - } - break; - case TailCallTableInfo::kEnumRange: - format("{$1$, $2$},\n", aux_entry.enum_range.start, - aux_entry.enum_range.size); - break; - case TailCallTableInfo::kEnumValidator: - format( - "{::_pbi::FieldAuxEnumData{}, $1$_internal_data_},\n", - QualifiedClassName(aux_entry.field->enum_type(), options_)); - break; - case TailCallTableInfo::kNumericOffset: - format("{_fl::Offset{$1$}},\n", aux_entry.offset); - break; - case TailCallTableInfo::kMapAuxInfo: { - auto utf8_check = internal::cpp::GetUtf8CheckMode( - aux_entry.field, - GetOptimizeFor(aux_entry.field->file(), options_) == - FileOptions::LITE_RUNTIME); - auto* map_key = aux_entry.field->message_type()->map_key(); - auto* map_value = aux_entry.field->message_type()->map_value(); - const bool validated_enum = - map_value->type() == FieldDescriptor::TYPE_ENUM && - !internal::cpp::HasPreservingUnknownEnumSemantics( - map_value); - printer->Emit( - { - {"field", FieldMemberName( - aux_entry.field, - ShouldSplit(aux_entry.field, options_))}, - {"strict", utf8_check == Utf8CheckMode::kStrict}, - {"verify", utf8_check == Utf8CheckMode::kVerify}, - {"validate", validated_enum}, - {"key_wire", map_key->type()}, - {"value_wire", map_value->type()}, - }, - R"cc( - {::_pbi::TcParser::GetMapAuxInfo< - decltype($classname$().$field$)>( - $strict$, $verify$, $validate$, $key_wire$, - $value_wire$)}, - )cc"); - break; + auto GenerateTableBase = [&] { + p->Emit( + {{"has_bits_offset", + [&] { + if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) { + p->Emit( + "PROTOBUF_FIELD_OFFSET($classname$, _impl_._has_bits_),\n"); + } else { + p->Emit("0, // no _has_bits_\n"); + } + }}, + {"extension_offset", + [&] { + if (descriptor_->extension_range_count() != 0) { + p->Emit("PROTOBUF_FIELD_OFFSET($classname$, $extensions$),\n"); + } else { + p->Emit("0, // no _extensions_\n"); + } + }}, + {"max_field_number", + ordered_fields_.empty() ? 0 : ordered_fields_.back()->number()}, + {"fast_idx_mask", (((1 << tc_table_info_->table_size_log2) - 1) << 3)}, + {"skipmap32", field_num_to_entry_table.skipmap32}, + {"field_entries_offset", + [&] { + if (ordered_fields_.empty()) { + p->Emit(R"cc( + offsetof(decltype(_table_), field_names), // no field_entries + )cc"); + } else { + p->Emit(R"cc( + offsetof(decltype(_table_), field_entries), + )cc"); + } + }}, + {"num_field_entries", ordered_fields_.size()}, + {"num_aux_entries", tc_table_info_->aux_entries.size()}, + {"aux_offset", + [&] { + if (tc_table_info_->aux_entries.empty()) { + p->Emit(R"cc( + offsetof(decltype(_table_), field_names), // no aux_entries + )cc"); + } else { + p->Emit(R"cc( + offsetof(decltype(_table_), aux_entries), + )cc"); + } + }}, + {"class_data", [&] { p->Emit("$classname$_class_data_.base(),\n"); }}, + {"post_loop_handler", + [&] { + if (NeedsPostLoopHandler(descriptor_, options_)) { + p->Emit("&$classname$::PostLoopHandler,\n"); + } else { + p->Emit("nullptr, // post_loop_handler\n"); + } + }}, + {"fallback", TcParseFunctionName(tc_table_info_->fallback_function)}, + {"to_prefetch", + [&] { + std::vector<const FieldDescriptor*> subtable_fields; + for (const auto& aux : tc_table_info_->aux_entries) { + if (aux.type == internal::TailCallTableInfo::kSubTable) { + subtable_fields.push_back(aux.field); } } + const auto* hottest = FindHottestField(subtable_fields, options_); + p->Emit( + {{"hot_type", QualifiedClassName(hottest == nullptr + ? descriptor_ + : hottest->message_type(), + options_)}}, + R"cc( +#ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<$hot_type$>(), // to_prefetch +#endif // PROTOBUF_PREFETCH_PARSE_TABLE)cc"); + }}}, + // clang-format off + R"cc( + $has_bits_offset$, + $extension_offset$, + $max_field_number$, $fast_idx_mask$, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + $skipmap32$, // skipmap + $field_entries_offset$, + $num_field_entries$, // num_field_entries + $num_aux_entries$, // num_aux_entries + $aux_offset$, + $class_data$, + $post_loop_handler$, + $fallback$, // fallback + $to_prefetch$)cc" + // clang-format on + ); + }; + + auto GenerateAuxEntries = [&] { + for (const auto& aux_entry : tc_table_info_->aux_entries) { + switch (aux_entry.type) { + case TailCallTableInfo::kNothing: + p->Emit("{},\n"); + break; + case TailCallTableInfo::kInlinedStringDonatedOffset: + p->Emit( + "{_fl::Offset{offsetof($classname$, " + "_impl_._inlined_string_donated_)}},\n"); + break; + case TailCallTableInfo::kSplitOffset: + p->Emit("{_fl::Offset{offsetof($classname$, _impl_._split_)}},\n"); + break; + case TailCallTableInfo::kSplitSizeof: + p->Emit("{_fl::Offset{sizeof($classname$::Impl_::Split)}},\n"); + break; + case TailCallTableInfo::kSubMessage: + p->Emit({{"name", QualifiedDefaultInstanceName( + aux_entry.field->message_type(), options_)}}, + "{::_pbi::FieldAuxDefaultMessage{}, &$name$},\n"); + break; + case TailCallTableInfo::kSubTable: + p->Emit({{"name", QualifiedClassName(aux_entry.field->message_type(), + options_)}}, + "{::_pbi::TcParser::GetTable<$name$>()},\n"); + break; + case TailCallTableInfo::kSubMessageWeak: + p->Emit({{"ptr", QualifiedDefaultInstancePtr( + aux_entry.field->message_type(), options_)}}, + "{::_pbi::FieldAuxDefaultMessage{}, &$ptr$},\n"); + break; + case TailCallTableInfo::kMessageVerifyFunc: + p->Emit({{"name", QualifiedClassName(aux_entry.field->message_type(), + options_)}}, + "{$name$::InternalVerify},\n"); + break; + case TailCallTableInfo::kSelfVerifyFunc: + if (ShouldVerify(descriptor_, options_, scc_analyzer_)) { + p->Emit("{&InternalVerify},\n"); + } else { + p->Emit("{},\n"); } + break; + case TailCallTableInfo::kEnumRange: + p->Emit( + { + {"start", aux_entry.enum_range.start}, + {"size", aux_entry.enum_range.size}, + }, + "{$start$, $size$},\n"); + break; + case TailCallTableInfo::kEnumValidator: + p->Emit({{"name", QualifiedClassName(aux_entry.field->enum_type(), + options_)}}, + "{::_pbi::FieldAuxEnumData{}, $name$_internal_data_},\n"); + break; + case TailCallTableInfo::kNumericOffset: + p->Emit( + { + {"offset", aux_entry.offset}, + }, + "{_fl::Offset{$offset$}},\n"); + break; + case TailCallTableInfo::kMapAuxInfo: { + auto utf8_check = internal::cpp::GetUtf8CheckMode( + aux_entry.field, + GetOptimizeFor(aux_entry.field->file(), options_) == + FileOptions::LITE_RUNTIME); + auto* map_key = aux_entry.field->message_type()->map_key(); + auto* map_value = aux_entry.field->message_type()->map_value(); + const bool validated_enum = + map_value->type() == FieldDescriptor::TYPE_ENUM && + !internal::cpp::HasPreservingUnknownEnumSemantics(map_value); + p->Emit( + { + {"strict", utf8_check == Utf8CheckMode::kStrict}, + {"verify", utf8_check == Utf8CheckMode::kVerify}, + {"validate", validated_enum}, + {"key_wire", map_key->type()}, + {"value_wire", map_value->type()}, + {"is_lite", + !HasDescriptorMethods(aux_entry.field->file(), options_)}, + }, + R"cc( + {::_pbi::TcParser::GetMapAuxInfo($strict$, $verify$, $validate$, + $key_wire$, $value_wire$, + $is_lite$)}, + )cc"); + break; } - format("}}, {{\n"); } - } // ordered_fields_.empty() - { - // field_names[] - auto field_name_scope = format.ScopedIndent(); - GenerateFieldNames(format); } - format("}},\n"); - } - format("};\n\n"); // _table_ + }; + + p->Emit( + {{"const", + // FileDescriptorProto's table must be constant initialized. For MSVC + // this means using `constexpr`. However, we can't use `constexpr` + // for all tables because it breaks when crossing DLL boundaries. + // FileDescriptorProto is safe from this. + IsFileDescriptorProto(descriptor_->file(), options_) + ? "constexpr" + : "PROTOBUF_CONSTINIT_WITH_PTR PROTOBUF_ATTRIBUTE_INIT_PRIORITY1\nconst"}, + {"table_size_log2", tc_table_info_->table_size_log2}, + {"ordered_size", ordered_fields_.size()}, + {"aux_size", tc_table_info_->aux_entries.size()}, + {"data_size", FieldNameDataSize(tc_table_info_->field_name_data)}, + {"field_num_to_entry_table_size", field_num_to_entry_table.size16()}, + {"table_base", GenerateTableBase}, + {"fast_entries", + [&] { + // TODO: refactor this to use Emit. + Formatter format(p, variables_); + GenerateFastFieldEntries(format); + }}, + {"field_lookup_table", + [&] { + for (SkipEntryBlock& entry_block : field_num_to_entry_table.blocks) { + p->Emit( + { + {"lower", entry_block.first_fnum & 65535}, + {"upper", entry_block.first_fnum / 65536}, + {"size", entry_block.entries.size()}, + }, + "$lower$, $upper$, $size$,\n"); + + for (SkipEntry16 se16 : entry_block.entries) { + p->Emit({{"skipmap", se16.skipmap}, + {"offset", se16.field_entry_offset}}, + R"cc( + $skipmap$, $offset$, + )cc"); + } + } + + // The last entry of the skipmap are all 1's. + p->Emit("65535, 65535\n"); + }}, + {"field_and_aux_entries", + [&] { + if (ordered_fields_.empty() && + !descriptor_->options().message_set_wire_format()) { + ABSL_DLOG_IF(FATAL, !tc_table_info_->aux_entries.empty()) + << "Invalid message: " << descriptor_->full_name() << " has " + << tc_table_info_->aux_entries.size() + << " auxiliary field entries, but no fields"; + p->Emit("// no field_entries, or aux_entries\n"); + return; + } + + p->Emit( + { + {"field_entries", + [&] { + // TODO: refactor this to use Emit. + Formatter format(p, variables_); + GenerateFieldEntries(format); + }}, + {"aux_entries", + [&] { + if (tc_table_info_->aux_entries.empty()) { + p->Emit("// no aux_entries\n"); + } else { + p->Emit( + { + {"aux_entries_list", GenerateAuxEntries}, + }, + // clang-format off + R"cc( + {{ + $aux_entries_list$ + }}, + )cc" + // clang-format on + ); + } + }}, + }, + // clang-format off + R"cc( + {{ + $field_entries$, + }}, + $aux_entries$)cc" + // clang-format on + ); + }}, + {"field_names", + [&] { + Formatter format(p, variables_); + GenerateFieldNames(format); + }}}, + // Disable clang-format, as we want to generate a denser table + // representation than what clang-format typically wants. clang would + // insert a newline at every brace, whereas we prefer {{ ... }} here. + // clang-format off +R"cc( +$const$ ::_pbi::TcParseTable<$table_size_log2$, $ordered_size$, $aux_size$, $data_size$, $field_num_to_entry_table_size$> +$classname$::_table_ = { + { + $table_base$ + }, {{ + $fast_entries$ + }}, {{ + $field_lookup_table$ + }}, $field_and_aux_entries$, + {{ + $field_names$, + }}, +}; +)cc" + // clang-format on + ); } void ParseFunctionGenerator::GenerateFastFieldEntries(Formatter& format) { diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/service.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/service.cc index 3c50fccfe4396..e876c29decc0f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/service.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/service.cc @@ -31,7 +31,7 @@ void ServiceGenerator::GenerateDeclarations(io::Printer* printer) { }, R"cc( class $classname$_Stub; - class $dllexport_decl $$classname$ : public ::$proto_ns$::Service { + class $dllexport_decl $$classname$ : public $pb$::Service { protected: $classname$() = default; @@ -42,44 +42,48 @@ void ServiceGenerator::GenerateDeclarations(io::Printer* printer) { $classname$& operator=(const $classname$&) = delete; virtual ~$classname$() = default; - static const ::$proto_ns$::ServiceDescriptor* descriptor(); + static const $pb$::ServiceDescriptor* $nonnull$ descriptor(); $virts$; // implements Service ---------------------------------------------- - const ::$proto_ns$::ServiceDescriptor* GetDescriptor() override; + const $pb$::ServiceDescriptor* $nonnull$ GetDescriptor() override; - void CallMethod(const ::$proto_ns$::MethodDescriptor* method, - ::$proto_ns$::RpcController* controller, - const ::$proto_ns$::Message* request, - ::$proto_ns$::Message* response, - ::google::protobuf::Closure* done) override; + void CallMethod( + //~ + const $pb$::MethodDescriptor* $nonnull$ method, + $pb$::RpcController* $nullable$ controller, + const $pb$::Message* $nonnull$ request, + $pb$::Message* $nonnull$ response, + ::google::protobuf::Closure* $nullable$ done) override; - const ::$proto_ns$::Message& GetRequestPrototype( - const ::$proto_ns$::MethodDescriptor* method) const override; + const $pb$::Message& GetRequestPrototype( + const $pb$::MethodDescriptor* $nonnull$ method) const override; - const ::$proto_ns$::Message& GetResponsePrototype( - const ::$proto_ns$::MethodDescriptor* method) const override; + const $pb$::Message& GetResponsePrototype( + const $pb$::MethodDescriptor* $nonnull$ method) const override; }; class $dllexport_decl $$classname$_Stub final : public $classname$ { public: - $classname$_Stub(::$proto_ns$::RpcChannel* channel); - $classname$_Stub(::$proto_ns$::RpcChannel* channel, - ::$proto_ns$::Service::ChannelOwnership ownership); + //~ It seems like channel should be nonnull, but some tests use + //~ nullptr. TODO: clean up and switch to nonnull. + $classname$_Stub($pb$::RpcChannel* $nullable$ channel); + $classname$_Stub($pb$::RpcChannel* $nullable$ channel, + $pb$::Service::ChannelOwnership ownership); $classname$_Stub(const $classname$_Stub&) = delete; $classname$_Stub& operator=(const $classname$_Stub&) = delete; ~$classname$_Stub() override; - inline ::$proto_ns$::RpcChannel* channel() { return channel_; } + inline $pb$::RpcChannel* $nullable$ channel() { return channel_; } // implements $classname$ ------------------------------------------ $impls$; private: - ::$proto_ns$::RpcChannel* channel_; + $pb$::RpcChannel* $nullable$ channel_; bool owns_channel_; }; )cc"); @@ -101,10 +105,10 @@ void ServiceGenerator::GenerateMethodSignatures(VirtualOrNot virtual_or_not, // No cc, clang-format does not format this string well due to the // $ override$ substitution. R"( - $virtual $void $name$(::$proto_ns$::RpcController* controller, - const $input$* request, - $output$* response, - ::google::protobuf::Closure* done)$ override$; + $virtual $void $name$($pb$::RpcController* $nullable$ controller, + const $input$* $nonnull$ request, + $output$* $nonnull$ response, + ::google::protobuf::Closure* $nullable$ done)$ override$; )"); } } @@ -123,12 +127,12 @@ void ServiceGenerator::GenerateImplementation(io::Printer* printer) { {"stub_methods", [&] { GenerateStubMethods(printer); }}, }, R"cc( - const ::$proto_ns$::ServiceDescriptor* $classname$::descriptor() { - ::$proto_ns$::internal::AssignDescriptors(&$desc_table$); + const $pb$::ServiceDescriptor* $nonnull$ $classname$::descriptor() { + $pbi$::AssignDescriptors(&$desc_table$); return $file_level_service_descriptors$[$index$]; } - const ::$proto_ns$::ServiceDescriptor* $classname$::GetDescriptor() { + const $pb$::ServiceDescriptor* $nonnull$ $classname$::GetDescriptor() { return descriptor(); } @@ -140,15 +144,14 @@ void ServiceGenerator::GenerateImplementation(io::Printer* printer) { $get_response$; - $classname$_Stub::$classname$_Stub(::$proto_ns$::RpcChannel* channel) + $classname$_Stub::$classname$_Stub($pb$::RpcChannel* $nullable$ channel) : channel_(channel), owns_channel_(false) {} $classname$_Stub::$classname$_Stub( - ::$proto_ns$::RpcChannel* channel, - ::$proto_ns$::Service::ChannelOwnership ownership) + $pb$::RpcChannel* $nullable$ channel, + $pb$::Service::ChannelOwnership ownership) : channel_(channel), - owns_channel_(ownership == - ::$proto_ns$::Service::STUB_OWNS_CHANNEL) {} + owns_channel_(ownership == $pb$::Service::STUB_OWNS_CHANNEL) {} $classname$_Stub::~$classname$_Stub() { if (owns_channel_) delete channel_; @@ -169,8 +172,10 @@ void ServiceGenerator::GenerateNotImplementedMethods(io::Printer* printer) { {"output", QualifiedClassName(method->output_type(), *options_)}, }, R"cc( - void $classname$::$name$(::$proto_ns$::RpcController* controller, - const $input$*, $output$*, ::google::protobuf::Closure* done) { + void $classname$::$name$($pb$::RpcController* $nullable$ controller, + const $input$* $nonnull$, + $output$* $nonnull$, + ::google::protobuf::Closure* $nullable$ done) { controller->SetFailed("Method $name$() not implemented."); done->Run(); } @@ -186,10 +191,10 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) { }, R"cc( void $classname$::CallMethod( - const ::$proto_ns$::MethodDescriptor* method, - ::$proto_ns$::RpcController* controller, - const ::$proto_ns$::Message* request, - ::$proto_ns$::Message* response, ::google::protobuf::Closure* done) { + const $pb$::MethodDescriptor* $nonnull$ method, + $pb$::RpcController* $nullable$ controller, + const $pb$::Message* $nonnull$ request, + $pb$::Message* $nonnull$ response, ::google::protobuf::Closure* $nullable$ done) { ABSL_DCHECK_EQ(method->service(), $file_level_service_descriptors$[$index$]); switch (method->index()) { $cases$; @@ -229,16 +234,16 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which, }}, }, R"cc( - const ::$proto_ns$::Message& $classname$::Get$which$Prototype( - const ::$proto_ns$::MethodDescriptor* method) const { + const $pb$::Message& $classname$::Get$which$Prototype( + const $pb$::MethodDescriptor* $nonnull$ method) const { ABSL_DCHECK_EQ(method->service(), descriptor()); switch (method->index()) { $cases$; default: ABSL_LOG(FATAL) << "Bad method index; this should never happen."; - return *::$proto_ns$::MessageFactory::generated_factory() - ->GetPrototype(method->$which_type$_type()); + return *$pb$::MessageFactory::generated_factory()->GetPrototype( + method->$which_type$_type()); } } )cc"); @@ -256,10 +261,8 @@ void ServiceGenerator::GenerateCallMethodCases(io::Printer* printer) { }, R"cc( case $index$: - this->$name$(controller, - ::$proto_ns$::DownCastMessage<$input$>(request), - ::$proto_ns$::DownCastMessage<$output$>(response), - done); + this->$name$(controller, $pb$::DownCastMessage<$input$>(request), + $pb$::DownCastMessage<$output$>(response), done); break; )cc"); } @@ -277,9 +280,10 @@ void ServiceGenerator::GenerateStubMethods(io::Printer* printer) { {"index", absl::StrCat(i)}, }, R"cc( - void $classname$_Stub::$name$(::$proto_ns$::RpcController* controller, - const $input$* request, - $output$* response, ::google::protobuf::Closure* done) { + void $classname$_Stub::$name$( + $pb$::RpcController* $nullable$ controller, + const $input$* $nonnull$ request, $output$* $nonnull$ response, + ::google::protobuf::Closure* $nullable$ done) { channel_->CallMethod(descriptor()->method($index$), controller, request, response, done); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/service.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/service.h index bcca36ac58ef0..342d22cd840e5 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/service.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/service.h @@ -32,8 +32,8 @@ class ServiceGenerator { const absl::flat_hash_map<absl::string_view, std::string>& vars, const Options& options) : descriptor_(descriptor), options_(&options), vars_(vars) { - vars_["classname"] = descriptor_->name(); - vars_["full_name"] = descriptor_->full_name(); + vars_["classname"] = std::string(descriptor_->name()); + vars_["full_name"] = std::string(descriptor_->full_name()); } ServiceGenerator(const ServiceGenerator&) = delete; diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto b/third_party/protobuf/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto index e375362aaa60d..226c87f73fd40 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto @@ -22,7 +22,7 @@ option cc_generic_services = true; // auto-added // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -package protobuf_unittest; +package proto2_unittest; // Test that fields can have names like "input" and "i" which are also used // internally by the code generator for local variables. @@ -115,6 +115,42 @@ message TestConflictingSymbolNames { optional uint32 typedecl = 39; optional uint32 auto = 40; + // Methods generated in the parent type + message BadKnownNamesFields { + optional int32 unknown_fields = 1; + optional int32 mutable_unknown_fields = 2; + optional int32 descriptor = 3; + optional int32 default_instance = 4; + optional int32 swap = 5; + } + message BadKnownNamesFieldsNoStandardDescriptor { + option no_standard_descriptor_accessor = true; + + optional int32 descriptor = 3; + } + message BadKnownNamesTypes { + message GetDescriptor {} + message GetReflection {} + message Swap {} + message UnsafeArenaSwap {} + message New {} + message CopyFrom {} + message MergeFrom {} + message GetMetadata {} + message Clear {} + message IsInitialized {} + } + message BadKnownNamesValues { // NO_PROTO3 + extensions 1 to 100; // NO_PROTO3 + extend BadKnownNamesValues { // NO_PROTO3 + optional int32 unknown_fields = 1; // NO_PROTO3 + optional int32 mutable_unknown_fields = 2; // NO_PROTO3 + optional int32 descriptor = 3; // NO_PROTO3 + optional int32 default_instance = 4; // NO_PROTO3 + optional int32 swap = 5; // NO_PROTO3 + } // NO_PROTO3 + } // NO_PROTO3 + // The generator used to #define a macro called "DO" inside the .cc file. message DO {} optional DO do = 32; @@ -134,9 +170,31 @@ message TestConflictingSymbolNames { // For clashing local variables in Serialize and ByteSize calculation. optional string target = 38; + // clang-format off extensions 1000 to max [verification = UNVERIFIED]; // NO_PROTO3 + // clang-format on } +// Special names as above, but at file scope. +message GetDescriptor {} +message GetReflection {} +message Swap {} +message UnsafeArenaSwap {} +message New {} +message CopyFrom {} +message MergeFrom {} +message GetMetadata {} +message Clear {} +message IsInitialized {} + +extend TestConflictingSymbolNames.BadKnownNamesValues { // NO_PROTO3 + optional int32 unknown_fields = 11; // NO_PROTO3 + optional int32 mutable_unknown_fields = 12; // NO_PROTO3 + optional int32 descriptor = 13; // NO_PROTO3 + optional int32 default_instance = 14; // NO_PROTO3 + optional int32 swap = 15; // NO_PROTO3 +} // NO_PROTO3 + message TestConflictingSymbolNamesExtension { // NO_PROTO3 extend TestConflictingSymbolNames { // NO_PROTO3 repeated int32 repeated_int32_ext = 20423638 [packed = true]; // NO_PROTO3 diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/test_large_enum_value.proto b/third_party/protobuf/src/google/protobuf/compiler/cpp/test_large_enum_value.proto index 4031e107aea64..321adbd04cf18 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/test_large_enum_value.proto +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/test_large_enum_value.proto @@ -10,7 +10,7 @@ // referenced in any C++ code. syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; message TestLargeEnumValue { enum EnumWithLargeValue { diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.cc index 1da40b5a35ecf..de4910685ada5 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.cc @@ -32,6 +32,7 @@ #include "absl/strings/cord.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/str_replace.h" #include "absl/strings/string_view.h" #include "google/protobuf/compiler/cpp/cpp_access_info_parse_helper.h" @@ -54,6 +55,7 @@ struct PDProtoAnalysis { PDProtoScale usage = PDProtoScale::kDefault; uint64_t presence_count = 0; uint64_t usage_count = 0; + float presence_probability = 0.0; }; std::ostream& operator<<(std::ostream& s, PDProtoScale scale) { @@ -119,6 +121,8 @@ class PDProtoAnalyzer { return analysis; } + analysis.presence_probability = GetPresenceProbability(field); + if (IsLikelyPresent(field)) { analysis.presence = PDProtoScale::kLikely; } else if (IsRarelyPresent(field)) { @@ -182,6 +186,13 @@ class PDProtoAnalyzer { info_map_.IsCold(field, AccessInfoMap::kWrite, kColdRatio); } + float GetPresenceProbability(const FieldDescriptor* field) { + // Since message count is max(#parse, #serialization), return the max of + // access ratio of both parse and serialization. + return std::max(info_map_.AccessRatio(field, AccessInfoMap::kWrite), + info_map_.AccessRatio(field, AccessInfoMap::kRead)); + } + cpp::Options options_; AccessInfoMap info_map_; SplitMap split_map_; @@ -270,7 +281,7 @@ absl::StatusOr<AccessInfo> AccessInfoFromFile(absl::string_view profile) { } AccessInfo access_info_proto; - if (!access_info_proto.ParseFromCord(cord)) { + if (!access_info_proto.ParseFromString(cord)) { return absl::DataLossError("Failed to parse AccessInfo"); } @@ -436,8 +447,12 @@ static absl::StatusOr<Stats> AnalyzeProfileProto( stream << " " << TypeName(field) << " " << field->name() << ":"; if (options.print_analysis) { - if (analysis.presence != PDProtoScale::kDefault) { - stream << " " << analysis.presence << "_PRESENT"; + if (analysis.presence != PDProtoScale::kDefault || + options.print_analysis_all) { + stream << " " << analysis.presence << "_PRESENT" + << absl::StrFormat( + "(%.2f%%)", + analysis.presence_probability * 100); } if (analysis.usage != PDProtoScale::kDefault) { stream << " " << analysis.usage << "_USED(" diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.h index 289d29441535d..a5f140b6a4169 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto.h @@ -26,6 +26,9 @@ struct AnalyzeProfileProtoOptions { // true to include presence and usage info instead of only optimization info bool print_analysis = false; + // true to include presence probability info + bool print_analysis_all = false; + // Descriptor pool to use. Must not be null. const DescriptorPool* pool = nullptr; diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_main.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_main.cc index b0756a3977373..f7e4f05949f31 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_main.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_main.cc @@ -26,6 +26,9 @@ ABSL_FLAG(bool, all, false, "Print all fields"); ABSL_FLAG(bool, analysis, false, "Print field analysis"); +ABSL_FLAG(bool, analysis_all, false, + "Print detailed field analysis, such as field presence probability, " + "for all fields, not just hot or cold ones."); ABSL_FLAG(std::string, message_filter, "", "Regex match for message name"); ABSL_FLAG(bool, aggregate_analysis, false, "If set, will recursively find proto.profile in the given dir and " @@ -45,6 +48,7 @@ int main(int argc, char* argv[]) { if (!absl::GetFlag(FLAGS_aggregate_analysis)) { options.print_all_fields = absl::GetFlag(FLAGS_all); options.print_analysis = absl::GetFlag(FLAGS_analysis); + options.print_analysis_all = absl::GetFlag(FLAGS_analysis_all); options.message_filter = absl::GetFlag(FLAGS_message_filter); status = AnalyzeProfileProtoToText(std::cout, argv[1], options); } else { diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_test.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_test.cc index a288702f82a59..f2d0999fb211e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_test.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/tools/analyze_profile_proto_test.cc @@ -186,9 +186,9 @@ TEST(AnalyzeProfileProtoTest, PrintStatistics) { R"(Message google::protobuf::compiler::tools::AnalyzeThis int32 id: RARELY_USED(100) string optional_string: RARELY_USED(100) - string[] repeated_string: LIKELY_PRESENT RARELY_USED(100) - AnalyzeChild optional_child: LIKELY_PRESENT RARELY_USED(1) LAZY - AnalyzeChild[] repeated_child: LIKELY_PRESENT RARELY_USED(100) + string[] repeated_string: LIKELY_PRESENT(100.00%) RARELY_USED(100) + AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY + AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%) RARELY_USED(100) Nested nested: RARELY_USED(100) ======== singular_lazy_num=1 @@ -209,6 +209,53 @@ repeated_lazy_pcount/repeated_total_pcount=0 )"); } +TEST(AnalyzeProfileProtoTest, PrintStatisticsAll) { + AccessInfo info = ParseTextOrDie(R"pb( + language: "cpp" + message { + name: "google::protobuf::compiler::tools::AnalyzeThis" + count: 100 + field { name: "id" getters_count: 1 configs_count: 100 } + field { name: "optional_string" getters_count: 1 configs_count: 100 } + field { name: "optional_child" getters_count: 100 configs_count: 1 } + field { name: "repeated_string" getters_count: 100 configs_count: 100 } + field { name: "repeated_child" getters_count: 100 configs_count: 100 } + field { name: "nested" getters_count: 1 configs_count: 100 } + } + )pb"); + AnalyzeProfileProtoOptions options; + options.print_unused_threshold = false; + options.print_optimized = false; + options.print_analysis = true; + options.print_analysis_all = true; + options.pool = DescriptorPool::generated_pool(); + EXPECT_STREQ(AnalyzeToText(info, options).c_str(), + R"(Message google::protobuf::compiler::tools::AnalyzeThis + int32 id: DEFAULT_PRESENT(1.00%) RARELY_USED(100) + string optional_string: DEFAULT_PRESENT(1.00%) RARELY_USED(100) + string[] repeated_string: LIKELY_PRESENT(100.00%) RARELY_USED(100) + AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY + AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%) RARELY_USED(100) + Nested nested: DEFAULT_PRESENT(1.00%) RARELY_USED(100) +======== +singular_lazy_num=1 +singular_lazy_0usage_num=0 +repeated_lazy_num=0 +singular_total_pcount=101 +repeated_total_pcount=100 +singular_lazy_pcount=100 +singular_lazy_0usage_pcount=0 +repeated_lazy_pcount=0 +max_pcount=100 +max_ucount=100 +repeated_lazy_num/singular_lazy_num=0 +repeated_lazy_pcount/singular_lazy_pcount=0 +singular_lazy_pcount/singular_total_pcount=0.990099 +singular_lazy_0usage_pcount/singular_total_pcount=0 +repeated_lazy_pcount/repeated_total_pcount=0 +)"); +} + } // namespace } // namespace tools } // namespace compiler diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/tracker.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/tracker.cc index 477672d41fb8b..0f539bf2dd7e1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/tracker.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/tracker.cc @@ -13,7 +13,6 @@ #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" -#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/strings/substitute.h" #include "absl/types/optional.h" diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.cc index 31a34948c1de7..46a8d5ff76b5c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.cc @@ -28,6 +28,7 @@ #include "google/protobuf/unittest_embed_optimize_for.pb.h" #include "google/protobuf/unittest_optimize_for.pb.h" + #define MESSAGE_TEST_NAME MessageTest #define GENERATED_DESCRIPTOR_TEST_NAME GeneratedDescriptorTest #define GENERATED_MESSAGE_TEST_NAME GeneratedMessageTest @@ -37,8 +38,8 @@ #define DESCRIPTOR_INIT_TEST_NAME DescriptorInitializationTest #define UNITTEST_PROTO_PATH "google/protobuf/unittest.proto" -#define UNITTEST ::protobuf_unittest -#define UNITTEST_IMPORT ::protobuf_unittest_import +#define UNITTEST ::proto2_unittest +#define UNITTEST_IMPORT ::proto2_unittest_import // Must include after the above macros. #include "google/protobuf/compiler/cpp/unittest.inc" @@ -51,14 +52,14 @@ namespace cpp { // Can't use an anonymous namespace here due to brokenness of Tru64 compiler. namespace cpp_unittest { -namespace protobuf_unittest = ::protobuf_unittest; +namespace proto2_unittest = ::proto2_unittest; TEST(GENERATED_MESSAGE_TEST_NAME, TestConflictingSymbolNames) { // test_bad_identifiers.proto successfully compiled, then it works. The // following is just a token usage to insure that the code is, in fact, // being compiled and linked. - protobuf_unittest::TestConflictingSymbolNames message; + proto2_unittest::TestConflictingSymbolNames message; message.set_uint32(1); EXPECT_EQ(3, message.ByteSizeLong()); @@ -70,37 +71,73 @@ TEST(GENERATED_MESSAGE_TEST_NAME, TestConflictingSymbolNames) { // Instantiate extension template functions to test conflicting template // parameter names. - typedef protobuf_unittest::TestConflictingSymbolNamesExtension ExtensionMessage; + typedef proto2_unittest::TestConflictingSymbolNamesExtension ExtensionMessage; message.AddExtension(ExtensionMessage::repeated_int32_ext, 123); EXPECT_EQ(123, message.GetExtension(ExtensionMessage::repeated_int32_ext, 0)); } + +TEST(GENERATED_MESSAGE_TEST_NAME, TestSwapNameIsNotMangledForFields) { + // For backwards compatibility we do not mangle `swap`. It works thanks to + // overload resolution. + int v [[maybe_unused]] = + proto2_unittest::TestConflictingSymbolNames::BadKnownNamesFields().swap(); + + // But we do mangle `swap` for extensions because there is no overloading + // there. + v = proto2_unittest::TestConflictingSymbolNames::BadKnownNamesValues() + .GetExtension(proto2_unittest::TestConflictingSymbolNames:: + BadKnownNamesValues::swap_); +} + +TEST(GENERATED_MESSAGE_TEST_NAME, TestNoStandardDescriptorOption) { + // When no_standard_descriptor_accessor = true, we should not mangle fields + // named `descriptor`. + int v [[maybe_unused]] = + proto2_unittest::TestConflictingSymbolNames::BadKnownNamesFields() + .descriptor_(); + v = proto2_unittest::TestConflictingSymbolNames:: + BadKnownNamesFieldsNoStandardDescriptor() + .descriptor(); +} + +TEST(GENERATED_MESSAGE_TEST_NAME, TestFileVsMessageScope) { + // Special names at message scope are mangled, + int v [[maybe_unused]] = + proto2_unittest::TestConflictingSymbolNames::BadKnownNamesValues() + .GetExtension(proto2_unittest::TestConflictingSymbolNames:: + BadKnownNamesValues::unknown_fields_); + // But not at file scope. + v = proto2_unittest::TestConflictingSymbolNames::BadKnownNamesValues() + .GetExtension(proto2_unittest::unknown_fields); +} + TEST(GENERATED_MESSAGE_TEST_NAME, TestConflictingEnumNames) { - protobuf_unittest::TestConflictingEnumNames message; + proto2_unittest::TestConflictingEnumNames message; message.set_conflicting_enum( - protobuf_unittest::TestConflictingEnumNames_while_and_); + proto2_unittest::TestConflictingEnumNames_while_and_); EXPECT_EQ(1, message.conflicting_enum()); message.set_conflicting_enum( - protobuf_unittest::TestConflictingEnumNames_while_XOR); + proto2_unittest::TestConflictingEnumNames_while_XOR); EXPECT_EQ(5, message.conflicting_enum()); - protobuf_unittest::bool_ conflicting_enum; - conflicting_enum = protobuf_unittest::NOT_EQ; + proto2_unittest::bool_ conflicting_enum; + conflicting_enum = proto2_unittest::NOT_EQ; EXPECT_EQ(1, conflicting_enum); - conflicting_enum = protobuf_unittest::return_; + conflicting_enum = proto2_unittest::return_; EXPECT_EQ(3, conflicting_enum); } TEST(GENERATED_MESSAGE_TEST_NAME, TestConflictingMessageNames) { - protobuf_unittest::NULL_ message; + proto2_unittest::NULL_ message; message.set_int_(123); EXPECT_EQ(message.int_(), 123); } TEST(GENERATED_MESSAGE_TEST_NAME, TestConflictingExtension) { - protobuf_unittest::TestConflictingSymbolNames message; - message.SetExtension(protobuf_unittest::void_, 123); - EXPECT_EQ(123, message.GetExtension(protobuf_unittest::void_)); + proto2_unittest::TestConflictingSymbolNames message; + message.SetExtension(proto2_unittest::void_, 123); + EXPECT_EQ(123, message.GetExtension(proto2_unittest::void_)); } } // namespace cpp_unittest diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.h index b876d0e6e0fbc..2c5fbf0991b8a 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.h +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.h @@ -5,14 +5,14 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -// This header declares the namespace google::protobuf::protobuf_unittest in order to expose +// This header declares the namespace google::protobuf::proto2_unittest in order to expose // any problems with the generated class names. We use this header to ensure // unittest.cc will declare the namespace prior to other includes, while obeying // normal include ordering. // // When generating a class name of "foo.Bar" we must ensure we prefix the class // name with "::", in case the namespace google::protobuf::foo exists. We intentionally -// trigger that case here by declaring google::protobuf::protobuf_unittest. +// trigger that case here by declaring google::protobuf::proto2_unittest. // // See ClassName in helpers.h for more details. @@ -21,7 +21,7 @@ namespace google { namespace protobuf { -namespace protobuf_unittest {} +namespace proto2_unittest {} } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.inc b/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.inc index 1b66273f0918d..346d076b73d9f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.inc +++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/unittest.inc @@ -126,7 +126,7 @@ TEST(GENERATED_DESCRIPTOR_TEST_NAME, IdenticalDescriptors) { // limit for string literal size TEST(GENERATED_DESCRIPTOR_TEST_NAME, EnormousDescriptor) { const Descriptor* generated_descriptor = - ::protobuf_unittest::TestEnormousDescriptor::descriptor(); + ::proto2_unittest::TestEnormousDescriptor::descriptor(); EXPECT_TRUE(generated_descriptor != nullptr); } @@ -2146,12 +2146,12 @@ namespace cpp_unittest { TEST_F(GENERATED_SERVICE_TEST_NAME, NoGenericServices) { // Verify that non-services in unittest_no_generic_services.proto were // generated. - ::protobuf_unittest::no_generic_services_test::TestMessage message; + ::proto2_unittest::no_generic_services_test::TestMessage message; message.set_a(1); message.SetExtension( - ::protobuf_unittest::no_generic_services_test::test_extension, 123); - ::protobuf_unittest::no_generic_services_test::TestEnum e = - ::protobuf_unittest::no_generic_services_test::FOO; + ::proto2_unittest::no_generic_services_test::test_extension, 123); + ::proto2_unittest::no_generic_services_test::TestEnum e = + ::proto2_unittest::no_generic_services_test::FOO; EXPECT_EQ(e, 1); // Verify that a ServiceDescriptor is generated for the service even if the diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/csharp/BUILD.bazel index a0e45c699be1e..c140fc3882aef 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/BUILD.bazel @@ -16,7 +16,7 @@ cc_library( deps = [ "//src/google/protobuf", "//src/google/protobuf:port", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -78,10 +78,10 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/io:printer", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -105,10 +105,10 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -123,8 +123,8 @@ cc_test( "//src/google/protobuf/compiler:command_line_interface", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc index 638230a72516a..4f73c0c83f355 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -72,7 +72,7 @@ void FieldGeneratorBase::SetCommonFieldVariables( (*variables)["type_name"] = type_name(); (*variables)["extended_type"] = GetClassName(descriptor_->containing_type()); (*variables)["name"] = name(); - (*variables)["descriptor_name"] = descriptor_->name(); + (*variables)["descriptor_name"] = std::string(descriptor_->name()); (*variables)["default_value"] = default_value(); (*variables)["capitalized_type_name"] = capitalized_type_name(); (*variables)["number"] = number(); diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc index 9cc23761dc9f3..c31750afc314a 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -212,7 +212,7 @@ void MessageGenerator::Generate(io::Printer* printer) { const OneofDescriptor* oneof = descriptor_->oneof_decl(i); vars["name"] = UnderscoresToCamelCase(oneof->name(), false); vars["property_name"] = UnderscoresToCamelCase(oneof->name(), true); - vars["original_name"] = oneof->name(); + vars["original_name"] = std::string(oneof->name()); printer->Print(vars, "private object $name$_;\n" "/// <summary>Enum of possible cases for the " diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h index 6d55b01a2c2d5..eeb5a83517149 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_names.h @@ -2,5 +2,5 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Redirect for GRPC's sake. See third_party/protobuf/README.chromium +// Redirect for GRPC's sake. See README.chromium #include "google/protobuf/compiler/csharp/names.h" diff --git a/third_party/protobuf/src/google/protobuf/compiler/importer.cc b/third_party/protobuf/src/google/protobuf/compiler/importer.cc index 4b38df4e04126..b38c28cd70c23 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/importer.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/importer.cc @@ -11,6 +11,8 @@ #include "google/protobuf/compiler/importer.h" +#include <string> + #ifdef _MSC_VER #include <direct.h> #else @@ -21,21 +23,27 @@ #include <sys/stat.h> #include <sys/types.h> -#include <algorithm> #include <memory> #include <vector> #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_join.h" -#include "absl/strings/str_replace.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" #include "google/protobuf/compiler/parser.h" -#include "google/protobuf/io/io_win32.h" #include "google/protobuf/io/tokenizer.h" #include "google/protobuf/io/zero_copy_stream_impl.h" +#ifdef _WIN32 +#include "absl/strings/str_replace.h" +#include "google/protobuf/io/io_win32.h" +#endif + +#if defined(_WIN32) || defined(__CYGWIN__) +#include "absl/strings/ascii.h" +#endif + namespace google { namespace protobuf { namespace compiler { @@ -47,10 +55,6 @@ using google::protobuf::io::win32::access; using google::protobuf::io::win32::open; #endif -#if defined(_WIN32) || defined(__CYGWIN__) -#include "absl/strings/ascii.h" -#endif - // Returns true if the text looks like a Windows-style absolute path, starting // with a drive letter. Example: "C:\foo". TODO: Share this with // copy in command_line_interface.cc? @@ -90,6 +94,13 @@ class SourceTreeDescriptorDatabase::SingleFileErrorCollector had_errors_ = true; } + void RecordWarning(int line, int column, absl::string_view message) override { + if (multi_file_error_collector_ != nullptr) { + multi_file_error_collector_->RecordWarning(filename_, line, column, + message); + } + } + private: std::string filename_; MultiFileErrorCollector* multi_file_error_collector_; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/java/BUILD.bazel index 7bb380d4e8892..16c2128df4f28 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/java/BUILD.bazel @@ -35,6 +35,7 @@ cc_library( hdrs = [ "context.h", "doc_comment.h", + "generator.h", "helpers.h", "name_resolver.h", "names.h", @@ -48,18 +49,19 @@ cc_library( "//src/google/protobuf/compiler/kotlin:__subpackages__", ], deps = [ + ":java_features_bootstrap", "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/compiler:versions", "//src/google/protobuf/io:printer", "//src/google/protobuf/io:tokenizer", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -71,16 +73,19 @@ cc_library( "internal_helpers.h", ], strip_include_prefix = "/src", - visibility = ["//src/google/protobuf/compiler/java:__subpackages__"], + visibility = [ + "//src/google/protobuf/compiler/java:__subpackages__", + "//src/google/protobuf/compiler/kotlin:__subpackages__", + ], deps = [ ":helpers", ":java_features_bootstrap", "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -124,6 +129,7 @@ cc_library( deps = [ ":generator_common", ":helpers", + ":internal_helpers", ":java_features_bootstrap", ":names", "//src/google/protobuf", @@ -137,13 +143,13 @@ cc_library( "//src/google/protobuf/compiler/java/lite", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -165,12 +171,12 @@ cc_library( "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:string_view", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", ], ) @@ -184,8 +190,22 @@ cc_library( ":helpers", "//src/google/protobuf", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:span", + ], +) + +cc_test( + name = "generator_unittest", + srcs = ["generator_unittest.cc"], + deps = [ + ":java", + ":java_features_bootstrap", + "//:protobuf", + "//src/google/protobuf", + "//src/google/protobuf/compiler:command_line_interface_tester", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -199,8 +219,8 @@ cc_test( ], deps = [ ":helpers", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -216,10 +236,34 @@ cc_test( "//src/google/protobuf/stubs:lite", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "name_resolver_test", + size = "small", + srcs = ["name_resolver_test.cc"], + deps = [ + ":helpers", + ":java", + "//:protobuf", + "//src/google/protobuf", + "//src/google/protobuf:port", + "//src/google/protobuf/compiler:importer", + "//src/google/protobuf/io", + "//src/google/protobuf/io:tokenizer", + "//src/google/protobuf/stubs:lite", + "//src/google/protobuf/testing", + "//src/google/protobuf/testing:file", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -245,3 +289,9 @@ filegroup( ), visibility = ["//src/google/protobuf/compiler:__pkg__"], ) + +filegroup( + name = "test_proto_srcs", + srcs = glob(["*.proto"]), + visibility = ["//src/google/protobuf/compiler:__pkg__"], +) diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/context.cc b/third_party/protobuf/src/google/protobuf/compiler/java/context.cc index 1469b59a98a8c..f4af24a41de4e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/context.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/context.cc @@ -15,6 +15,7 @@ #include "absl/strings/strip.h" #include "google/protobuf/compiler/java/field_common.h" #include "google/protobuf/compiler/java/helpers.h" +#include "google/protobuf/compiler/java/internal_helpers.h" #include "google/protobuf/compiler/java/name_resolver.h" #include "google/protobuf/descriptor.h" @@ -41,48 +42,71 @@ bool EqualWithSuffix(absl::string_view name1, absl::string_view suffix, return name1 == name2; } +bool IsRepeatedFieldConflicting(const FieldDescriptor* field1, + absl::string_view name1, + const FieldDescriptor* field2, + absl::string_view name2, std::string* info) { + if (field1->is_repeated() && !field2->is_repeated()) { + if (EqualWithSuffix(name1, "Count", name2)) { + *info = + absl::StrCat("both repeated field \"", field1->name(), + "\" and singular ", "field \"", field2->name(), + "\" generate the method \"", "get", name1, "Count()\""); + return true; + } + if (EqualWithSuffix(name1, "List", name2)) { + *info = + absl::StrCat("both repeated field \"", field1->name(), + "\" and singular ", "field \"", field2->name(), + "\" generate the method \"", "get", name1, "List()\""); + return true; + } + } + + return false; +} + +bool IsEnumFieldConflicting(const FieldDescriptor* field1, + absl::string_view name1, + const FieldDescriptor* field2, + absl::string_view name2, std::string* info) { + if (field1->type() == FieldDescriptor::TYPE_ENUM && + SupportUnknownEnumValue(field1) && + EqualWithSuffix(name1, "Value", name2)) { + *info = absl::StrCat( + "both enum field \"", field1->name(), "\" and regular ", "field \"", + field2->name(), "\" generate the method \"", "get", name1, "Value()\""); + return true; + } + + return false; +} + +// Field 1 and 2 will be called the other way around as well, so no need to +// check both ways here +bool IsConflictingOneWay(const FieldDescriptor* field1, absl::string_view name1, + const FieldDescriptor* field2, absl::string_view name2, + std::string* info) { + return IsRepeatedFieldConflicting(field1, name1, field2, name2, info) || + IsEnumFieldConflicting(field1, name1, field2, name2, info); + + // Well, there are obviously many more conflicting cases, but it probably + // doesn't worth the effort to exhaust all of them because they rarely + // happen and as we are continuing adding new methods/changing existing + // methods the number of different conflicting cases will keep growing. + // We can just add more cases here when they are found in the real world. +} + // Whether two fields have conflicting accessors (assuming name1 and name2 // are different). name1 and name2 are field1 and field2's camel-case name // respectively. bool IsConflicting(const FieldDescriptor* field1, absl::string_view name1, const FieldDescriptor* field2, absl::string_view name2, std::string* info) { - if (field1->is_repeated()) { - if (field2->is_repeated()) { - // Both fields are repeated. - return false; - } else { - // field1 is repeated, and field2 is not. - if (EqualWithSuffix(name1, "Count", name2)) { - *info = absl::StrCat("both repeated field \"", field1->name(), - "\" and singular ", "field \"", field2->name(), - "\" generate the method \"", "get", name1, - "Count()\""); - return true; - } - if (EqualWithSuffix(name1, "List", name2)) { - *info = - absl::StrCat("both repeated field \"", field1->name(), - "\" and singular ", "field \"", field2->name(), - "\" generate the method \"", "get", name1, "List()\""); - return true; - } - // Well, there are obviously many more conflicting cases, but it probably - // doesn't worth the effort to exhaust all of them because they rarely - // happen and as we are continuing adding new methods/changing existing - // methods the number of different conflicting cases will keep growing. - // We can just add more cases here when they are found in the real world. - return false; - } - } else { - if (field2->is_repeated()) { - return IsConflicting(field2, name2, field1, name1, info); - } else { - // None of the two fields are repeated. - return false; - } - } + return IsConflictingOneWay(field1, name1, field2, name2, info) || + IsConflictingOneWay(field2, name2, field1, name1, info); } + } // namespace void Context::InitializeFieldGeneratorInfo(const FileDescriptor* file) { diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/doc_comment.cc b/third_party/protobuf/src/google/protobuf/compiler/java/doc_comment.cc index 2243ac1c3fa6b..c0c4e3de91681 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/doc_comment.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/doc_comment.cc @@ -210,7 +210,7 @@ static void WriteDebugString(io::Printer* printer, const FieldDescriptor* field, const Options options, const bool kdoc) { std::string field_comment = FirstLineOf(field->DebugString()); if (options.strip_nonfunctional_codegen) { - field_comment = field->name(); + field_comment = std::string(field->name()); } if (kdoc) { printer->Print(" * `$def$`\n", "def", EscapeKdoc(field_comment)); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/field_common.cc b/third_party/protobuf/src/google/protobuf/compiler/java/field_common.cc index 29a712aaa661c..ea847e93c5292 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/field_common.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/field_common.cc @@ -16,9 +16,10 @@ namespace java { void SetCommonFieldVariables( const FieldDescriptor* descriptor, const FieldGeneratorInfo* info, absl::flat_hash_map<absl::string_view, std::string>* variables) { - (*variables)["field_name"] = descriptor->name(); + (*variables)["field_name"] = std::string(descriptor->name()); (*variables)["name"] = info->name; - (*variables)["classname"] = descriptor->containing_type()->name(); + (*variables)["classname"] = + std::string(descriptor->containing_type()->name()); (*variables)["capitalized_name"] = info->capitalized_name; (*variables)["disambiguated_reason"] = info->disambiguated_reason; (*variables)["constant_name"] = FieldConstantName(descriptor); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/file.cc b/third_party/protobuf/src/google/protobuf/compiler/java/file.cc index d59b0dcdc476e..d471d9f624b5b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/file.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/file.cc @@ -26,6 +26,7 @@ #include "google/protobuf/compiler/java/generator_factory.h" #include "google/protobuf/compiler/java/helpers.h" #include "google/protobuf/compiler/java/full/generator_factory.h" +#include "google/protobuf/compiler/java/internal_helpers.h" #include "google/protobuf/compiler/java/lite/generator_factory.h" #include "google/protobuf/compiler/java/name_resolver.h" #include "google/protobuf/compiler/java/options.h" @@ -33,6 +34,7 @@ #include "google/protobuf/compiler/retention.h" #include "google/protobuf/compiler/versions.h" #include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/descriptor_visitor.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/io/printer.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -100,44 +102,34 @@ bool CollectExtensions(const Message& message, FieldDescriptorSet* extensions) { return true; } -// Finds all extensions in the given message and its sub-messages. If the -// message contains unknown fields (which could be extensions), then those -// extensions are defined in alternate_pool. -// The message will be converted to a DynamicMessage backed by alternate_pool -// in order to handle this case. -void CollectExtensions(const FileDescriptorProto& file_proto, - const DescriptorPool& alternate_pool, - FieldDescriptorSet* extensions, - const std::string& file_data) { - if (!CollectExtensions(file_proto, extensions)) { - // There are unknown fields in the file_proto, which are probably - // extensions. We need to parse the data into a dynamic message based on the - // builder-pool to find out all extensions. - const Descriptor* file_proto_desc = alternate_pool.FindMessageTypeByName( - file_proto.GetDescriptor()->full_name()); - ABSL_CHECK(file_proto_desc) - << "Find unknown fields in FileDescriptorProto when building " - << file_proto.name() - << ". It's likely that those fields are custom options, however, " - "descriptor.proto is not in the transitive dependencies. " - "This normally should not happen. Please report a bug."; - DynamicMessageFactory factory; - std::unique_ptr<Message> dynamic_file_proto( - factory.GetPrototype(file_proto_desc)->New()); - ABSL_CHECK(dynamic_file_proto.get() != nullptr); - ABSL_CHECK(dynamic_file_proto->ParseFromString(file_data)); +// Finds all extensions for custom options in the given file descriptor with the +// builder pool which resolves Java features instead of the generated pool. +void CollectExtensions(const FileDescriptor& file, + FieldDescriptorSet* extensions) { + FileDescriptorProto file_proto = StripSourceRetentionOptions(file); + std::string file_data; + file_proto.SerializeToString(&file_data); + const Descriptor* file_proto_desc = file.pool()->FindMessageTypeByName( + file_proto.GetDescriptor()->full_name()); - // Collect the extensions again from the dynamic message. There should be no - // more unknown fields this time, i.e. all the custom options should be - // parsed as extensions now. - extensions->clear(); - ABSL_CHECK(CollectExtensions(*dynamic_file_proto, extensions)) - << "Find unknown fields in FileDescriptorProto when building " - << file_proto.name() - << ". It's likely that those fields are custom options, however, " - "those options cannot be recognized in the builder pool. " - "This normally should not happen. Please report a bug."; - } + // descriptor.proto is not found in the builder pool, meaning there are no + // custom options. + if (file_proto_desc == nullptr) return; + + DynamicMessageFactory factory; + std::unique_ptr<Message> dynamic_file_proto( + factory.GetPrototype(file_proto_desc)->New()); + ABSL_CHECK(dynamic_file_proto.get() != nullptr); + ABSL_CHECK(dynamic_file_proto->ParseFromString(file_data)); + + // Collect the extensions again from the dynamic message. + extensions->clear(); + ABSL_CHECK(CollectExtensions(*dynamic_file_proto, extensions)) + << "Found unknown fields in FileDescriptorProto when building " + << file_proto.name() + << ". It's likely that those fields are custom options, however, " + "those options cannot be recognized in the builder pool. " + "This normally should not happen. Please report a bug."; } // Our static initialization methods can become very, very large. @@ -213,12 +205,11 @@ bool FileGenerator::Validate(std::string* error) { // end up overwriting the outer class with one of the inner ones. if (name_resolver_->HasConflictingClassName(file_, classname_, NameEquality::EXACT_EQUAL)) { - error->assign(file_->name()); - error->append( + *error = absl::StrCat( + file_->name(), ": Cannot generate Java output because the file's outer class name, " - "\""); - error->append(classname_); - error->append( + "\"", + classname_, "\", matches the name of one of the types declared inside it. " "Please either rename the type or use the java_outer_classname " "option to specify a different outer class name for the .proto file."); @@ -238,6 +229,17 @@ bool FileGenerator::Validate(std::string* error) { << "name for the .proto file to be safe."; } + // Check that no field is a closed enum with implicit presence. For normal + // cases this will be rejected by protoc before the generator is invoked, but + // for cases like legacy_closed_enum it may reach the generator. + google::protobuf::internal::VisitDescriptors(*file_, [&](const FieldDescriptor& field) { + if (field.enum_type() != nullptr && !SupportUnknownEnumValue(&field) && + !field.has_presence() && !field.is_repeated()) { + absl::StrAppend(error, "Field ", field.full_name(), + " has a closed enum type with implicit presence.\n"); + } + }); + // Print a warning if optimize_for = LITE_RUNTIME is used. if (file_->options().optimize_for() == FileOptions::LITE_RUNTIME && !options_.enforce_lite) { @@ -250,7 +252,8 @@ bool FileGenerator::Validate(std::string* error) { "https://github.com/protocolbuffers/protobuf/blob/main/java/" "lite.md"; } - return true; + + return error->empty(); } void FileGenerator::Generate(io::Printer* printer) { @@ -460,11 +463,8 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable( // To find those extensions, we need to parse the data into a dynamic message // of the FileDescriptor based on the builder-pool, then we can use // reflections to find all extension fields - FileDescriptorProto file_proto = StripSourceRetentionOptions(*file_); - std::string file_data; - file_proto.SerializeToString(&file_data); FieldDescriptorSet extensions; - CollectExtensions(file_proto, *file_->pool(), &extensions, file_data); + CollectExtensions(*file_, &extensions); if (options_.strip_nonfunctional_codegen) { // Skip feature extensions, which are a visible (but non-functional) diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/java/full/BUILD.bazel index 1fb6f079c432c..bdc1cded928c4 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/BUILD.bazel @@ -1,8 +1,12 @@ # We use abbreviated target names in this directory to work around: # https://github.com/bazelbuild/bazel/issues/18683 + +load("//build_defs:cpp_opts.bzl", "COPTS") + cc_library( name = "fg", hdrs = ["field_generator.h"], + copts = COPTS, strip_include_prefix = "/src", visibility = ["//src/google/protobuf/compiler/kotlin:__subpackages__"], deps = [ @@ -29,6 +33,7 @@ cc_library( "primitive_field.h", "string_field.h", ], + copts = COPTS, strip_include_prefix = "/src", deps = [ ":fg", @@ -38,10 +43,11 @@ cc_library( "//src/google/protobuf/compiler/java:helpers", "//src/google/protobuf/compiler/java:internal_helpers", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -49,6 +55,7 @@ cc_library( name = "mfg", srcs = ["make_field_gens.cc"], hdrs = ["make_field_gens.h"], + copts = COPTS, strip_include_prefix = "/src", visibility = ["//src/google/protobuf/compiler/kotlin:__subpackages__"], deps = [ @@ -64,6 +71,7 @@ cc_library( name = "service", srcs = ["service.cc"], hdrs = ["service.h"], + copts = COPTS, strip_include_prefix = "/src", visibility = ["//src/google/protobuf/compiler/java/lite:__pkg__"], deps = [ @@ -72,8 +80,8 @@ cc_library( "//src/google/protobuf/compiler/java:generator_common", "//src/google/protobuf/compiler/java:helpers", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -81,6 +89,7 @@ cc_library( name = "eg", srcs = ["enum.cc"], hdrs = ["enum.h"], + copts = COPTS, strip_include_prefix = "/src", deps = [ "//src/google/protobuf", @@ -89,8 +98,8 @@ cc_library( "//src/google/protobuf/compiler/java:helpers", "//src/google/protobuf/compiler/java:internal_helpers", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/strings", ], ) @@ -113,6 +122,7 @@ cc_library( "extension.h", "message_builder.h", ], + copts = COPTS, strip_include_prefix = "/src", visibility = [ "//src/google/protobuf/compiler/java:__pkg__", @@ -125,14 +135,15 @@ cc_library( ":service", "//src/google/protobuf", "//src/google/protobuf:port", + "//src/google/protobuf:protobuf_lite", "//src/google/protobuf/compiler/java:generator_common", "//src/google/protobuf/compiler/java:helpers", "//src/google/protobuf/compiler/java:message_serialization", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/enum.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/enum.cc index 30db3b4130cf2..11aea592b26b1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/enum.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/enum.cc @@ -17,6 +17,7 @@ #include "absl/container/flat_hash_map.h" #include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "google/protobuf/compiler/java/context.h" #include "google/protobuf/compiler/java/doc_comment.h" #include "google/protobuf/compiler/java/helpers.h" @@ -82,14 +83,13 @@ void EnumNonLiteGenerator::Generate(io::Printer* printer) { } } - for (int i = 0; i < canonical_values_.size(); i++) { + for (const EnumValueDescriptor* value : canonical_values_) { absl::flat_hash_map<absl::string_view, std::string> vars; - vars["name"] = canonical_values_[i]->name(); - vars["index"] = absl::StrCat(canonical_values_[i]->index()); - vars["number"] = absl::StrCat(canonical_values_[i]->number()); - WriteEnumValueDocComment(printer, canonical_values_[i], - context_->options()); - if (canonical_values_[i]->options().deprecated()) { + vars["name"] = std::string(value->name()); + vars["index"] = absl::StrCat(value->index()); + vars["number"] = absl::StrCat(value->number()); + WriteEnumValueDocComment(printer, value, context_->options()); + if (value->options().deprecated()) { printer->Print("@java.lang.Deprecated\n"); } if (ordinal_is_index) { @@ -97,7 +97,7 @@ void EnumNonLiteGenerator::Generate(io::Printer* printer) { } else { printer->Print(vars, "$name$($index$, $number$),\n"); } - printer->Annotate("name", canonical_values_[i]); + printer->Annotate("name", value); } if (!descriptor_->is_closed()) { @@ -122,20 +122,20 @@ void EnumNonLiteGenerator::Generate(io::Printer* printer) { printer->Outdent(); printer->Print("}\n"); - for (int i = 0; i < aliases_.size(); i++) { + for (const Alias& alias : aliases_) { absl::flat_hash_map<absl::string_view, std::string> vars; - vars["classname"] = descriptor_->name(); - vars["name"] = aliases_[i].value->name(); - vars["canonical_name"] = aliases_[i].canonical_value->name(); - WriteEnumValueDocComment(printer, aliases_[i].value, context_->options()); + vars["classname"] = std::string(descriptor_->name()); + vars["name"] = std::string(alias.value->name()); + vars["canonical_name"] = std::string(alias.canonical_value->name()); + WriteEnumValueDocComment(printer, alias.value, context_->options()); printer->Print( vars, "public static final $classname$ $name$ = $canonical_name$;\n"); - printer->Annotate("name", aliases_[i].value); + printer->Annotate("name", alias.value); } for (int i = 0; i < descriptor_->value_count(); i++) { absl::flat_hash_map<absl::string_view, std::string> vars; - vars["name"] = descriptor_->value(i)->name(); + vars["name"] = std::string(descriptor_->value(i)->name()); vars["number"] = absl::StrCat(descriptor_->value(i)->number()); vars["{"] = ""; vars["}"] = ""; @@ -206,10 +206,9 @@ void EnumNonLiteGenerator::Generate(io::Printer* printer) { printer->Indent(); printer->Indent(); - for (int i = 0; i < canonical_values_.size(); i++) { - printer->Print("case $number$: return $name$;\n", "name", - canonical_values_[i]->name(), "number", - absl::StrCat(canonical_values_[i]->number())); + for (const EnumValueDescriptor* value : canonical_values_) { + printer->Print("case $number$: return $name$;\n", "name", value->name(), + "number", absl::StrCat(value->number())); } printer->Outdent(); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.cc index e0ea6eea65917..14a2b596cacf4 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.cc @@ -47,7 +47,6 @@ void SetEnumVariables( (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->enum_type()); - variables->insert({"kt_type", EscapeKotlinKeywords((*variables)["type"])}); (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->enum_type()); (*variables)["default"] = @@ -62,15 +61,8 @@ void SetEnumVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); // Note that these have a trailing ";". (*variables)["set_has_field_bit_message"] = absl::StrCat(GenerateSetBit(messageBitIndex), ";"); @@ -169,7 +161,7 @@ void ImmutableEnumFieldGenerator::GenerateMembers(io::Printer* printer) const { printer->Print(variables_, "@java.lang.Override $deprecation$public boolean " "${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" + " return $is_field_present_message$;\n" "}\n"); printer->Annotate("{", "}", descriptor_); } @@ -267,51 +259,6 @@ void ImmutableEnumFieldGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void ImmutableEnumFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print(variables_, - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - - if (SupportUnknownEnumValue(descriptor_)) { - printer->Print( - variables_, - "$kt_deprecation$public var $kt_name$Value: kotlin.Int\n" - " @JvmName(\"${$get$kt_capitalized_name$Value$}$\")\n" - " get() = $kt_dsl_builder$.${$$kt_property_name$Value$}$\n" - " @JvmName(\"${$set$kt_capitalized_name$Value$}$\")\n" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_property_name$Value$}$ = value\n" - " }\n"); - } - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); - - if (descriptor_->has_presence()) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - } -} - void ImmutableEnumFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // noop for enums @@ -330,19 +277,21 @@ void ImmutableEnumFieldGenerator::GenerateBuilderClearCode( void ImmutableEnumFieldGenerator::GenerateMergingCode( io::Printer* printer) const { if (descriptor_->has_presence()) { - printer->Print(variables_, - "if (other.has$capitalized_name$()) {\n" - " set$capitalized_name$(other.get$capitalized_name$());\n" - "}\n"); - } else if (SupportUnknownEnumValue(descriptor_)) { + printer->Print(variables_, "if (other.has$capitalized_name$()) {\n"); + } else { + printer->Print(variables_, "if (other.$name$_ != $default_number$) {\n"); + } + printer->Indent(); + if (SupportUnknownEnumValue(descriptor_)) { printer->Print( variables_, - "if (other.$name$_ != $default_number$) {\n" - " set$capitalized_name$Value(other.get$capitalized_name$Value());\n" - "}\n"); + "set$capitalized_name$Value(other.get$capitalized_name$Value());\n"); } else { - ABSL_LOG(FATAL) << "Can't reach here."; + printer->Print(variables_, + "set$capitalized_name$(other.get$capitalized_name$());\n"); } + printer->Outdent(); + printer->Print("}\n"); } void ImmutableEnumFieldGenerator::GenerateBuildingCode( @@ -1077,107 +1026,6 @@ void RepeatedImmutableEnumFieldGenerator::GenerateHashCode( "}\n"); } -void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print(variables_, - "$kt_deprecation$public val $kt_name$: " - "com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" - " @kotlin.jvm.JvmSynthetic\n" - " get() = com.google.protobuf.kotlin.DslList(\n" - " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" - " )\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "public fun com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}"); -} - std::string RepeatedImmutableEnumFieldGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->enum_type()); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.h index c238fad42cb77..bfd6184ab5e23 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/enum_field.h @@ -65,7 +65,6 @@ class ImmutableEnumFieldGenerator : public ImmutableFieldGenerator { 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; std::string GetBoxedType() const override; @@ -131,7 +130,6 @@ class RepeatedImmutableEnumFieldGenerator : public ImmutableEnumFieldGenerator { 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; std::string GetBoxedType() const override; }; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.cc index be36f7dc16fd3..e081504346b94 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.cc @@ -42,17 +42,6 @@ std::string TypeName(const FieldDescriptor* field, } } -std::string KotlinTypeName(const FieldDescriptor* field, - ClassNameResolver* name_resolver) { - if (GetJavaType(field) == JAVATYPE_MESSAGE) { - return name_resolver->GetImmutableClassName(field->message_type()); - } else if (GetJavaType(field) == JAVATYPE_ENUM) { - return name_resolver->GetImmutableClassName(field->enum_type()); - } else { - return std::string(KotlinTypeName(GetJavaType(field))); - } -} - std::string WireType(const FieldDescriptor* field) { return absl::StrCat("com.google.protobuf.WireFormat.FieldType.", FieldTypeName(field->type())); @@ -93,8 +82,6 @@ void ImmutableMapFieldGenerator::SetMessageVariables( variables_["key_type"] = TypeName(key, name_resolver, false); std::string boxed_key_type = TypeName(key, name_resolver, true); variables_["boxed_key_type"] = boxed_key_type; - variables_["kt_key_type"] = KotlinTypeName(key, name_resolver); - variables_["kt_value_type"] = KotlinTypeName(value, name_resolver); // Used for calling the serialization function. variables_["short_key_type"] = boxed_key_type.substr(boxed_key_type.rfind('.') + 1); @@ -170,12 +157,6 @@ void ImmutableMapFieldGenerator::SetMessageVariables( // by the proto compiler variables_["deprecation"] = descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables_.insert( - {"kt_deprecation", - descriptor_->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - variables_["name"], " is deprecated\") ") - : ""}); variables_["on_changed"] = "onChanged();"; variables_.insert( @@ -959,95 +940,6 @@ void ImmutableMapFieldGenerator::GenerateMessageMapGetters( printer->Annotate("{", "}", descriptor_); } -void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - variables_, - "$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" - " @JvmName(\"get$kt_capitalized_name$Map\")\n" - " get() = com.google.protobuf.kotlin.DslMap(\n" - " $kt_dsl_builder$.${$$kt_property_name$Map$}$\n" - " )\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - variables_, - "@JvmName(\"put$kt_capitalized_name$\")\n" - "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" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@JvmName(\"set$kt_capitalized_name$\")\n" - "@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" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@JvmName(\"remove$kt_capitalized_name$\")\n" - "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" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@JvmName(\"putAll$kt_capitalized_name$\")\n" - "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" - " $kt_dsl_builder$.${$putAll$capitalized_name$$}$(map)\n" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@JvmName(\"clear$kt_capitalized_name$\")\n" - "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" - " }\n"); -} - void ImmutableMapFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // Nothing to initialize. diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.h index c41205c4cb1bc..563532491d439 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/map_field.h @@ -44,7 +44,6 @@ class ImmutableMapFieldGenerator : public ImmutableFieldGenerator { 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; std::string GetBoxedType() const override; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/message.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/message.cc index 3e3e49999311c..aca5d0fbafeee 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/message.cc @@ -15,6 +15,7 @@ #include <cstdint> #include <memory> #include <string> +#include <utility> #include <vector> #include "absl/container/flat_hash_map.h" @@ -27,6 +28,7 @@ #include "google/protobuf/compiler/java/doc_comment.h" #include "google/protobuf/compiler/java/field_common.h" #include "google/protobuf/compiler/java/generator_common.h" +#include "google/protobuf/compiler/java/generator_factory.h" #include "google/protobuf/compiler/java/helpers.h" #include "google/protobuf/compiler/java/full/enum.h" #include "google/protobuf/compiler/java/full/extension.h" @@ -48,9 +50,6 @@ namespace protobuf { namespace compiler { namespace java { -using internal::WireFormat; -using internal::WireFormatLite; - namespace { std::string MapValueImmutableClassdName(const Descriptor* descriptor, ClassNameResolver* name_resolver) { @@ -72,7 +71,7 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor) } } -MessageGenerator::~MessageGenerator() {} +MessageGenerator::~MessageGenerator() = default; // =================================================================== ImmutableMessageGenerator::ImmutableMessageGenerator( @@ -86,7 +85,7 @@ ImmutableMessageGenerator::ImmutableMessageGenerator( "generate lite messages."; } -ImmutableMessageGenerator::~ImmutableMessageGenerator() {} +ImmutableMessageGenerator::~ImmutableMessageGenerator() = default; void ImmutableMessageGenerator::GenerateStaticVariables( io::Printer* printer, int* bytecode_estimate) { @@ -273,7 +272,7 @@ void ImmutableMessageGenerator::GenerateInterface(io::Printer* printer) { field_generators_.get(descriptor_->field(i)) .GenerateInterfaceMembers(printer); } - for (auto& kv : oneofs_) { + for (const auto& kv : oneofs_) { printer->Print( "\n" "$classname$.$oneof_capitalized_name$Case " @@ -295,7 +294,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { absl::flat_hash_map<absl::string_view, std::string> variables; variables["static"] = is_own_file ? "" : "static "; - variables["classname"] = descriptor_->name(); + variables["classname"] = std::string(descriptor_->name()); variables["extra_interfaces"] = ExtraMessageInterfaces(descriptor_); variables["deprecation"] = descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""; @@ -394,7 +393,7 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { // oneof absl::flat_hash_map<absl::string_view, std::string> vars; - for (auto& kv : oneofs_) { + for (const auto& kv : oneofs_) { const OneofDescriptor* oneof = kv.second; vars["oneof_name"] = context_->GetOneofGeneratorInfo(oneof)->name; vars["oneof_capitalized_name"] = @@ -804,8 +803,7 @@ void ImmutableMessageGenerator::GenerateDescriptorMethods( " switch (number) {\n"); printer->Indent(); printer->Indent(); - for (int i = 0; i < map_fields.size(); ++i) { - const FieldDescriptor* field = map_fields[i]; + for (const FieldDescriptor* field : map_fields) { const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); printer->Print( "case $number$:\n" @@ -994,7 +992,7 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( } // Compare oneofs. - for (auto& kv : oneofs_) { + for (const auto& kv : oneofs_) { const OneofDescriptor* oneof = kv.second; printer->Print( "if (!get$oneof_capitalized_name$Case().equals(" @@ -1074,7 +1072,7 @@ void ImmutableMessageGenerator::GenerateEqualsAndHashCode( } // hashCode oneofs. - for (auto& kv : oneofs_) { + for (const auto& kv : oneofs_) { const OneofDescriptor* oneof = kv.second; printer->Print("switch ($oneof_name$Case_) {\n", "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/message_builder.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/message_builder.cc index 53de5d324622b..8b0c0fc3c04f0 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/message_builder.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/message_builder.cc @@ -35,6 +35,7 @@ #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/io/printer.h" #include "google/protobuf/wire_format.h" +#include "google/protobuf/wire_format_lite.h" // Must be last. #include "google/protobuf/port_def.inc" @@ -92,7 +93,7 @@ MessageBuilderGenerator::MessageBuilderGenerator(const Descriptor* descriptor, } } -MessageBuilderGenerator::~MessageBuilderGenerator() {} +MessageBuilderGenerator::~MessageBuilderGenerator() = default; void MessageBuilderGenerator::Generate(io::Printer* printer) { WriteMessageDocComment(printer, descriptor_, context_->options()); @@ -211,8 +212,7 @@ void MessageBuilderGenerator::GenerateDescriptorMethods(io::Printer* printer) { " switch (number) {\n"); printer->Indent(); printer->Indent(); - for (int i = 0; i < map_fields.size(); ++i) { - const FieldDescriptor* field = map_fields[i]; + for (const FieldDescriptor* field : map_fields) { const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); printer->Print( "case $number$:\n" @@ -237,8 +237,7 @@ void MessageBuilderGenerator::GenerateDescriptorMethods(io::Printer* printer) { " switch (number) {\n"); printer->Indent(); printer->Indent(); - for (int i = 0; i < map_fields.size(); ++i) { - const FieldDescriptor* field = map_fields[i]; + for (const FieldDescriptor* field : map_fields) { const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field); printer->Print( "case $number$:\n" diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.cc index f26c57b072454..16f4300981ef5 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.cc @@ -43,7 +43,6 @@ void SetMessageVariables( (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->message_type()); - variables->insert({"kt_type", EscapeKotlinKeywords((*variables)["type"])}); (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->message_type()); (*variables)["group_or_message"] = @@ -53,19 +52,11 @@ void SetMessageVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); (*variables)["on_changed"] = "onChanged();"; (*variables)["get_parser"] = "parser()"; if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - // Note that these have a trailing ";". (*variables)["set_has_field_bit_to_local"] = GenerateSetBitToLocal(messageBitIndex); @@ -148,27 +139,15 @@ void ImmutableMessageFieldGenerator::GenerateMembers( printer->Print(variables_, "private $type$ $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (HasHasbit(descriptor_)) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options()); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } else { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options()); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $name$_ != null;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, + context_->options()); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $is_field_present_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); + WriteFieldAccessorDocComment(printer, descriptor_, GETTER, context_->options()); printer->Print( @@ -334,7 +313,8 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( "${$get$capitalized_name$Builder$}$() {\n" " $set_has_field_bit_builder$\n" " $on_changed$\n" - " return get$capitalized_name$FieldBuilder().getBuilder();\n" + " return " + "internalGet$capitalized_name$FieldBuilder().getBuilder();\n" "}\n"); printer->Annotate("{", "}", descriptor_, Semantic::kSet); @@ -358,7 +338,7 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( variables_, "private com.google.protobuf.SingleFieldBuilder<\n" " $type$, $type$.Builder, $type$OrBuilder> \n" - " get$capitalized_name$FieldBuilder() {\n" + " internalGet$capitalized_name$FieldBuilder() {\n" " if ($name$Builder_ == null) {\n" " $name$Builder_ = new com.google.protobuf.SingleFieldBuilder<\n" " $type$, $type$.Builder, $type$OrBuilder>(\n" @@ -371,53 +351,9 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers( "}\n"); } -void ImmutableMessageFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print(variables_, - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.clear$capitalized_name$()\n" - "}\n"); - printer->Annotate("{", "}", descriptor_, Semantic::kSet); - - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - - GenerateKotlinOrNull(printer); -} - -void ImmutableMessageFieldGenerator::GenerateKotlinOrNull(io::Printer* printer) const { - if (descriptor_->has_presence() && - descriptor_->real_containing_oneof() == nullptr) { - printer->Print(variables_, - "$kt_deprecation$\n" - "public val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n" - " get() = $kt_dsl_builder$.$name$OrNull\n"); - } -} - void ImmutableMessageFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { - printer->Print(variables_, "get$capitalized_name$FieldBuilder();\n"); + printer->Print(variables_, "internalGet$capitalized_name$FieldBuilder();\n"); } void ImmutableMessageFieldGenerator::GenerateInitializationCode( @@ -460,13 +396,15 @@ void ImmutableMessageFieldGenerator::GenerateBuilderParsingCode( if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { printer->Print(variables_, "input.readGroup($number$,\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " " + "internalGet$capitalized_name$FieldBuilder().getBuilder(),\n" " extensionRegistry);\n" "$set_has_field_bit_builder$\n"); } else { printer->Print(variables_, "input.readMessage(\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " " + "internalGet$capitalized_name$FieldBuilder().getBuilder(),\n" " extensionRegistry);\n" "$set_has_field_bit_builder$\n"); } @@ -683,11 +621,13 @@ void ImmutableMessageOneofFieldGenerator::GenerateBuilderMembers( "return this;\n", Semantic::kSet); + // $type$.Builder getFieldBuilder WriteFieldDocComment(printer, descriptor_, context_->options()); printer->Print(variables_, "$deprecation$public $type$.Builder " "${$get$capitalized_name$Builder$}$() {\n" - " return get$capitalized_name$FieldBuilder().getBuilder();\n" + " return " + "internalGet$capitalized_name$FieldBuilder().getBuilder();\n" "}\n"); printer->Annotate("{", "}", descriptor_, Semantic::kSet); WriteFieldDocComment(printer, descriptor_, context_->options()); @@ -706,12 +646,14 @@ void ImmutableMessageOneofFieldGenerator::GenerateBuilderMembers( " }\n" "}\n"); printer->Annotate("{", "}", descriptor_); + + // SingleFieldBuilder internalGetFieldFieldBuilder WriteFieldDocComment(printer, descriptor_, context_->options()); printer->Print( variables_, "private com.google.protobuf.SingleFieldBuilder<\n" " $type$, $type$.Builder, $type$OrBuilder> \n" - " ${$get$capitalized_name$FieldBuilder$}$() {\n" + " ${$internalGet$capitalized_name$FieldBuilder$}$() {\n" " if ($name$Builder_ == null) {\n" " if (!($has_oneof_case_message$)) {\n" " $oneof_name$_ = $type$.getDefaultInstance();\n" @@ -759,13 +701,15 @@ void ImmutableMessageOneofFieldGenerator::GenerateBuilderParsingCode( if (GetType(descriptor_) == FieldDescriptor::TYPE_GROUP) { printer->Print(variables_, "input.readGroup($number$,\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " " + "internalGet$capitalized_name$FieldBuilder().getBuilder(),\n" " extensionRegistry);\n" "$set_oneof_case_message$;\n"); } else { printer->Print(variables_, "input.readMessage(\n" - " get$capitalized_name$FieldBuilder().getBuilder(),\n" + " " + "internalGet$capitalized_name$FieldBuilder().getBuilder(),\n" " extensionRegistry);\n" "$set_oneof_case_message$;\n"); } @@ -1143,7 +1087,9 @@ void RepeatedImmutableMessageFieldGenerator::GenerateBuilderMembers( variables_, "$deprecation$public $type$.Builder ${$get$capitalized_name$Builder$}$(\n" " int index) {\n" - " return get$capitalized_name$FieldBuilder().getBuilder(index);\n" + " return " + "internalGet$capitalized_name$FieldBuilder().getBuilder(index);" + "\n" "}\n"); printer->Annotate("{", "}", descriptor_, Semantic::kSet); @@ -1180,7 +1126,8 @@ void RepeatedImmutableMessageFieldGenerator::GenerateBuilderMembers( printer->Print(variables_, "$deprecation$public $type$.Builder " "${$add$capitalized_name$Builder$}$() {\n" - " return get$capitalized_name$FieldBuilder().addBuilder(\n" + " return " + "internalGet$capitalized_name$FieldBuilder().addBuilder(\n" " $type$.getDefaultInstance());\n" "}\n"); printer->Annotate("{", "}", descriptor_, Semantic::kSet); @@ -1191,40 +1138,42 @@ void RepeatedImmutableMessageFieldGenerator::GenerateBuilderMembers( variables_, "$deprecation$public $type$.Builder ${$add$capitalized_name$Builder$}$(\n" " int index) {\n" - " return get$capitalized_name$FieldBuilder().addBuilder(\n" + " return " + "internalGet$capitalized_name$FieldBuilder().addBuilder(\n" " index, $type$.getDefaultInstance());\n" "}\n"); printer->Annotate("{", "}", descriptor_, Semantic::kSet); // List<Field.Builder> getRepeatedFieldBuilderList() WriteFieldDocComment(printer, descriptor_, context_->options()); - printer->Print( - variables_, - "$deprecation$public java.util.List<$type$.Builder> \n" - " ${$get$capitalized_name$BuilderList$}$() {\n" - " return get$capitalized_name$FieldBuilder().getBuilderList();\n" - "}\n" - "private com.google.protobuf.RepeatedFieldBuilder<\n" - " $type$, $type$.Builder, $type$OrBuilder> \n" - " get$capitalized_name$FieldBuilder() {\n" - " if ($name$Builder_ == null) {\n" - " $name$Builder_ = new " - "com.google.protobuf.RepeatedFieldBuilder<\n" - " $type$, $type$.Builder, $type$OrBuilder>(\n" - " $name$_,\n" - " $get_mutable_bit_builder$,\n" - " getParentForChildren(),\n" - " isClean());\n" - " $name$_ = null;\n" - " }\n" - " return $name$Builder_;\n" - "}\n"); + printer->Print(variables_, + "$deprecation$public java.util.List<$type$.Builder> \n" + " ${$get$capitalized_name$BuilderList$}$() {\n" + " return " + "internalGet$capitalized_name$FieldBuilder()." + "getBuilderList();\n" + "}\n" + "private com.google.protobuf.RepeatedFieldBuilder<\n" + " $type$, $type$.Builder, $type$OrBuilder> \n" + " internalGet$capitalized_name$FieldBuilder() {\n" + " if ($name$Builder_ == null) {\n" + " $name$Builder_ = new " + "com.google.protobuf.RepeatedFieldBuilder<\n" + " $type$, $type$.Builder, $type$OrBuilder>(\n" + " $name$_,\n" + " $get_mutable_bit_builder$,\n" + " getParentForChildren(),\n" + " isClean());\n" + " $name$_ = null;\n" + " }\n" + " return $name$Builder_;\n" + "}\n"); printer->Annotate("{", "}", descriptor_, Semantic::kSet); } void RepeatedImmutableMessageFieldGenerator:: GenerateFieldBuilderInitializationCode(io::Printer* printer) const { - printer->Print(variables_, "get$capitalized_name$FieldBuilder();\n"); + printer->Print(variables_, "internalGet$capitalized_name$FieldBuilder();\n"); } void RepeatedImmutableMessageFieldGenerator::GenerateInitializationCode( @@ -1272,7 +1221,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateMergingCode( " $name$Builder_ = \n" " com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders " "?\n" - " get$capitalized_name$FieldBuilder() : null;\n" + " internalGet$capitalized_name$FieldBuilder() : null;\n" " } else {\n" " $name$Builder_.addAllMessages(other.$name$_);\n" " }\n" @@ -1356,107 +1305,6 @@ std::string RepeatedImmutableMessageFieldGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->message_type()); } -void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print(variables_, - "$kt_deprecation$ public val $kt_name$: " - "com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" - " @kotlin.jvm.JvmSynthetic\n" - " get() = com.google.protobuf.kotlin.DslList(\n" - " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" - " )\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "@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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "@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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "public fun com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n\n"); -} - } // namespace java } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.h index 709ea4309d673..ee9c407d8f5fd 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/message_field.h @@ -66,7 +66,6 @@ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator { 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; std::string GetBoxedType() const override; @@ -87,9 +86,6 @@ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator { const char* trailing_code, absl::optional<io::AnnotationCollector::Semantic> semantic = absl::nullopt) const; - - private: - void GenerateKotlinOrNull(io::Printer* printer) const; }; class ImmutableMessageOneofFieldGenerator @@ -143,7 +139,6 @@ class RepeatedImmutableMessageFieldGenerator 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; std::string GetBoxedType() const override; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.cc index b9fe799f4d025..d21656f62c6e7 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.cc @@ -14,9 +14,12 @@ #include <cstdint> #include <string> +#include "absl/container/flat_hash_map.h" +#include "absl/functional/function_ref.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "google/protobuf/compiler/java/context.h" #include "google/protobuf/compiler/java/doc_comment.h" #include "google/protobuf/compiler/java/field_common.h" @@ -30,15 +33,34 @@ namespace google { namespace protobuf { namespace compiler { namespace java { +namespace { using internal::WireFormat; using Semantic = ::google::protobuf::io::AnnotationCollector::Semantic; -namespace { +// Adds two variables to (*variables) that operate on a particular field value, +// both for use locally and on another instance named 'other'. This ensures that +// we treat these values the same way, whether it's in the current instance or +// another. +// +// `this_variable_name` and `other_variable_name` MUST be string constants. +// +// The `create_value` FunctionRef takes the representation of the value and +// should use it to create and return the code that operates on this value. +void AddPrimitiveVariableForThisAndOther( + absl::string_view this_variable_name, absl::string_view other_variable_name, + absl::FunctionRef<std::string(absl::string_view)> create_value, + absl::flat_hash_map<absl::string_view, std::string>* variables) { + (*variables)[this_variable_name] = + create_value(absl::StrCat((*variables)["name"], "_")); + (*variables)[other_variable_name] = create_value( + absl::StrCat("other.get", (*variables)["capitalized_name"], "()")); +} void SetPrimitiveVariables( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - const FieldGeneratorInfo* info, ClassNameResolver* name_resolver, + const FieldDescriptor* descriptor, int message_bit_index, + int builder_bit_index, const FieldGeneratorInfo* info, + ClassNameResolver* name_resolver, absl::flat_hash_map<absl::string_view, std::string>* variables, Context* context) { SetCommonFieldVariables(descriptor, info, variables); @@ -46,7 +68,6 @@ void SetPrimitiveVariables( (*variables)["type"] = std::string(PrimitiveTypeName(javaType)); (*variables)["boxed_type"] = std::string(BoxedPrimitiveTypeName(javaType)); - (*variables)["kt_type"] = std::string(KotlinTypeName(javaType)); variables->insert({"field_type", (*variables)["type"]}); std::string name = (*variables)["name"]; @@ -100,11 +121,6 @@ void SetPrimitiveVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - (*variables)["kt_deprecation"] = - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", name, - " is deprecated\") ") - : ""; int fixed_size = FixedSize(GetType(descriptor)); if (fixed_size != -1) { (*variables)["fixed_size"] = absl::StrCat(fixed_size); @@ -113,43 +129,62 @@ void SetPrimitiveVariables( if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); // Note that these have a trailing ";". (*variables)["set_has_field_bit_to_local"] = - absl::StrCat(GenerateSetBitToLocal(messageBitIndex), ";"); - (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); + absl::StrCat(GenerateSetBitToLocal(message_bit_index), ";"); + (*variables)["is_field_present_message"] = + GenerateGetBit(message_bit_index); + (*variables)["is_other_field_present_message"] = + absl::StrCat("other.has", (*variables)["capitalized_name"], "()"); } else { (*variables)["set_has_field_bit_to_local"] = ""; switch (descriptor->type()) { case FieldDescriptor::TYPE_BYTES: - (*variables)["is_field_present_message"] = - absl::StrCat("!", name, "_.isEmpty()"); + AddPrimitiveVariableForThisAndOther( + "is_field_present_message", "is_other_field_present_message", + [](absl::string_view value) { + return absl::StrCat("!", value, ".isEmpty()"); + }, + variables); break; case FieldDescriptor::TYPE_FLOAT: - (*variables)["is_field_present_message"] = - absl::StrCat("java.lang.Float.floatToRawIntBits(", name, "_) != 0"); + AddPrimitiveVariableForThisAndOther( + "is_field_present_message", "is_other_field_present_message", + [](absl::string_view value) { + return absl::StrCat("java.lang.Float.floatToRawIntBits(", value, + ") != 0"); + }, + variables); break; case FieldDescriptor::TYPE_DOUBLE: - (*variables)["is_field_present_message"] = absl::StrCat( - "java.lang.Double.doubleToRawLongBits(", name, "_) != 0"); + AddPrimitiveVariableForThisAndOther( + "is_field_present_message", "is_other_field_present_message", + [](absl::string_view value) { + return absl::StrCat("java.lang.Double.doubleToRawLongBits(", + value, ") != 0"); + }, + variables); break; default: - variables->insert( - {"is_field_present_message", - absl::StrCat(name, "_ != ", (*variables)["default"])}); + AddPrimitiveVariableForThisAndOther( + "is_field_present_message", "is_other_field_present_message", + [variables](absl::string_view value) { + return absl::StrCat(value, " != ", (*variables)["default"]); + }, + variables); break; } } // Always track the presence of a field explicitly in the builder, regardless // of syntax. - (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builderBitIndex); + (*variables)["get_has_field_bit_builder"] = GenerateGetBit(builder_bit_index); (*variables)["get_has_field_bit_from_local"] = - GenerateGetBitFromLocal(builderBitIndex); + GenerateGetBitFromLocal(builder_bit_index); (*variables)["set_has_field_bit_builder"] = - absl::StrCat(GenerateSetBit(builderBitIndex), ";"); + absl::StrCat(GenerateSetBit(builder_bit_index), ";"); (*variables)["clear_has_field_bit_builder"] = - absl::StrCat(GenerateClearBit(builderBitIndex), ";"); + absl::StrCat(GenerateClearBit(builder_bit_index), ";"); } } // namespace @@ -157,14 +192,14 @@ void SetPrimitiveVariables( // =================================================================== ImmutablePrimitiveFieldGenerator::ImmutablePrimitiveFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) + const FieldDescriptor* descriptor, int message_bit_index, + int builder_bit_index, Context* context) : descriptor_(descriptor), - message_bit_index_(messageBitIndex), - builder_bit_index_(builderBitIndex), + message_bit_index_(message_bit_index), + builder_bit_index_(builder_bit_index), context_(context), name_resolver_(context->GetNameResolver()) { - SetPrimitiveVariables(descriptor, messageBitIndex, builderBitIndex, + SetPrimitiveVariables(descriptor, message_bit_index, builder_bit_index, context->GetFieldGeneratorInfo(descriptor), name_resolver_, &variables_, context); } @@ -209,7 +244,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateMembers( variables_, "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" + " return $is_field_present_message$;\n" "}\n"); printer->Annotate("{", "}", descriptor_); } @@ -287,52 +322,6 @@ void ImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( "}\n"); } -void ImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - if (descriptor_->name() == "is_initialized") { - printer->Print( - variables_, - "// TODO: remove this hack; we should access properties\n" - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" - " get() = $kt_dsl_builder$.${$get$kt_capitalized_name$$}$()\n" - " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" - " set(value) {\n" - " $kt_dsl_builder$.${$set$kt_capitalized_name$$}$(value)\n" - " }\n"); - } else { - printer->Print(variables_, - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - } - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); - - if (descriptor_->has_presence()) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - } -} - void ImmutablePrimitiveFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // noop for primitives @@ -353,17 +342,10 @@ void ImmutablePrimitiveFieldGenerator::GenerateBuilderClearCode( void ImmutablePrimitiveFieldGenerator::GenerateMergingCode( io::Printer* printer) const { - if (descriptor_->has_presence()) { - printer->Print(variables_, - "if (other.has$capitalized_name$()) {\n" - " set$capitalized_name$(other.get$capitalized_name$());\n" - "}\n"); - } else { - printer->Print(variables_, - "if (other.get$capitalized_name$() != $default$) {\n" - " set$capitalized_name$(other.get$capitalized_name$());\n" - "}\n"); - } + printer->Print(variables_, + "if ($is_other_field_present_message$) {\n" + " set$capitalized_name$(other.get$capitalized_name$());\n" + "}\n"); } void ImmutablePrimitiveFieldGenerator::GenerateBuildingCode( @@ -502,10 +484,10 @@ std::string ImmutablePrimitiveFieldGenerator::GetBoxedType() const { // =================================================================== ImmutablePrimitiveOneofFieldGenerator::ImmutablePrimitiveOneofFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, int builderBitIndex, - Context* context) - : ImmutablePrimitiveFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) { + const FieldDescriptor* descriptor, int message_bit_index, + int builder_bit_index, Context* context) + : ImmutablePrimitiveFieldGenerator(descriptor, message_bit_index, + builder_bit_index, context) { const OneofGeneratorInfo* info = context->GetOneofGeneratorInfo(descriptor->containing_oneof()); SetCommonOneofVariables(descriptor, info, &variables_); @@ -655,11 +637,11 @@ void ImmutablePrimitiveOneofFieldGenerator::GenerateSerializedSizeCode( RepeatedImmutablePrimitiveFieldGenerator:: RepeatedImmutablePrimitiveFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, + int message_bit_index, + int builder_bit_index, Context* context) - : ImmutablePrimitiveFieldGenerator(descriptor, messageBitIndex, - builderBitIndex, context) {} + : ImmutablePrimitiveFieldGenerator(descriptor, message_bit_index, + builder_bit_index, context) {} RepeatedImmutablePrimitiveFieldGenerator:: ~RepeatedImmutablePrimitiveFieldGenerator() {} @@ -840,107 +822,6 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print(variables_, - "$kt_deprecation$ public val $kt_name$: " - "com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" - " @kotlin.jvm.JvmSynthetic\n" - " get() = com.google.protobuf.kotlin.DslList(\n" - " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" - " )\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "public fun com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}"); -} - void RepeatedImmutablePrimitiveFieldGenerator:: GenerateFieldBuilderInitializationCode(io::Printer* printer) const { // noop for primitives diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.h index 6533228ce3e7c..5aaeee8e24cd0 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/primitive_field.h @@ -36,8 +36,8 @@ namespace java { class ImmutablePrimitiveFieldGenerator : public ImmutableFieldGenerator { public: explicit ImmutablePrimitiveFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, + int message_bit_index, + int builder_bit_index, Context* context); ImmutablePrimitiveFieldGenerator(const ImmutablePrimitiveFieldGenerator&) = delete; @@ -65,7 +65,6 @@ class ImmutablePrimitiveFieldGenerator : public ImmutableFieldGenerator { 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; std::string GetBoxedType() const override; @@ -82,8 +81,9 @@ class ImmutablePrimitiveOneofFieldGenerator : public ImmutablePrimitiveFieldGenerator { public: ImmutablePrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor, - int messageBitIndex, - int builderBitIndex, Context* context); + int message_bit_index, + int builder_bit_index, + Context* context); ImmutablePrimitiveOneofFieldGenerator( const ImmutablePrimitiveOneofFieldGenerator&) = delete; ImmutablePrimitiveOneofFieldGenerator& operator=( @@ -104,8 +104,8 @@ class RepeatedImmutablePrimitiveFieldGenerator : public ImmutablePrimitiveFieldGenerator { public: explicit RepeatedImmutablePrimitiveFieldGenerator( - const FieldDescriptor* descriptor, int messageBitIndex, - int builderBitIndex, Context* context); + const FieldDescriptor* descriptor, int message_bit_index, + int builder_bit_index, Context* context); RepeatedImmutablePrimitiveFieldGenerator( const RepeatedImmutablePrimitiveFieldGenerator&) = delete; RepeatedImmutablePrimitiveFieldGenerator& operator=( @@ -131,7 +131,6 @@ class RepeatedImmutablePrimitiveFieldGenerator 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; std::string GetBoxedType() const override; }; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.cc index d5b5d582bcfc6..fd60cacf88674 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.cc @@ -71,17 +71,10 @@ void SetPrimitiveVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); (*variables)["on_changed"] = "onChanged();"; if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); (*variables)["set_has_field_bit_to_local"] = GenerateSetBitToLocal(messageBitIndex); @@ -91,7 +84,6 @@ void SetPrimitiveVariables( (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex); } else { - (*variables)["get_has_field_bit_message"] = ""; (*variables)["set_has_field_bit_to_local"] = ""; (*variables)["set_has_field_bit_message"] = ""; @@ -206,7 +198,7 @@ void ImmutableStringFieldGenerator::GenerateMembers( variables_, "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" + " return $is_field_present_message$;\n" "}\n"); printer->Annotate("{", "}", descriptor_); } @@ -366,39 +358,6 @@ void ImmutableStringFieldGenerator::GenerateBuilderMembers( "}\n"); } -void ImmutableStringFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print(variables_, - "$kt_deprecation$public var $kt_name$: kotlin.String\n" - " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); - - if (descriptor_->has_presence()) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - } -} - void ImmutableStringFieldGenerator::GenerateFieldBuilderInitializationCode( io::Printer* printer) const { // noop for primitives @@ -970,115 +929,6 @@ void RepeatedImmutableStringFieldGenerator::GenerateBuilderMembers( "}\n"); } -void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - printer->Print( - variables_, - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - // property for List<String> - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - 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$.${$$kt_property_name$List$}$\n" - " )\n"); - - // List<String>.add(String) - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "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" - "}\n"); - - // List<String> += String - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "@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" - "}\n"); - - // List<String>.addAll(Iterable<String>) - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "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" - "}\n"); - - // List<String> += Iterable<String> - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "@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" - "}\n"); - - // List<String>[Int] = String - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print(variables_, - "@kotlin.jvm.JvmSynthetic\n" - "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "public fun com.google.protobuf.kotlin.DslList" - "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}"); -} - void RepeatedImmutableStringFieldGenerator:: GenerateFieldBuilderInitializationCode(io::Printer* printer) const { // noop for primitives diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.h index 1d2d1b76b50a7..d9373967f7611 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/full/string_field.h @@ -64,7 +64,6 @@ class ImmutableStringFieldGenerator : public ImmutableFieldGenerator { 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; std::string GetBoxedType() const override; @@ -129,7 +128,6 @@ class RepeatedImmutableStringFieldGenerator 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; std::string GetBoxedType() const override; }; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/generator_common.h b/third_party/protobuf/src/google/protobuf/compiler/java/generator_common.h index 33843a0597ef8..c2c8859d0fec0 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/generator_common.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/generator_common.h @@ -23,7 +23,6 @@ class FieldGenerator { public: virtual ~FieldGenerator() = default; virtual void GenerateSerializationCode(io::Printer* printer) const = 0; - virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0; }; // Convenience class which constructs FieldGenerators for a Descriptor. diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/generator_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/java/generator_unittest.cc new file mode 100644 index 0000000000000..55725d3b3d0f9 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/compiler/java/generator_unittest.cc @@ -0,0 +1,95 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2023 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include "google/protobuf/compiler/java/generator.h" + +#include <memory> +#include <string> + +#include "google/protobuf/descriptor.pb.h" +#include <gtest/gtest.h> +#include "google/protobuf/compiler/java/java_features.pb.h" +#include "google/protobuf/compiler/command_line_interface_tester.h" + +namespace google { +namespace protobuf { +namespace compiler { +namespace java { +namespace { + +class JavaGeneratorTest : public CommandLineInterfaceTester { + protected: + JavaGeneratorTest() { + RegisterGenerator("--java_out", "--java_opt", + std::make_unique<JavaGenerator>(), "Java test generator"); + + // Generate built-in protos. + CreateTempFile( + "google/protobuf/descriptor.proto", + google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); + CreateTempFile("third_party/java/protobuf/java_features.proto", + pb::JavaFeatures::descriptor()->file()->DebugString()); + } +}; + +TEST_F(JavaGeneratorTest, Basic) { + CreateTempFile("foo.proto", + R"schema( + syntax = "proto2"; + message Foo { + optional int32 bar = 1; + })schema"); + + RunProtoc( + "protocol_compiler --proto_path=$tmpdir --java_out=$tmpdir foo.proto"); + + ExpectNoErrors(); +} + +TEST_F(JavaGeneratorTest, BasicError) { + CreateTempFile("foo.proto", + R"schema( + syntax = "proto2"; + message Foo { + int32 bar = 1; + })schema"); + + RunProtoc( + "protocol_compiler --proto_path=$tmpdir --java_out=$tmpdir foo.proto"); + + ExpectErrorSubstring( + "foo.proto:4:7: Expected \"required\", \"optional\", or \"repeated\""); +} + +TEST_F(JavaGeneratorTest, ImplicitPresenceLegacyClosedEnumDisallowed) { + CreateTempFile("foo.proto", + R"schema( + edition = "2023"; + import "third_party/java/protobuf/java_features.proto"; + option features.field_presence = IMPLICIT; + enum Bar { + AAA = 0; + } + message Foo { + Bar bar = 1 [features.(pb.java).legacy_closed_enum = true]; + } + )schema"); + + RunProtoc( + "protocol_compiler --proto_path=$tmpdir --java_out=$tmpdir foo.proto"); + + ExpectErrorSubstring( + "foo.proto: Field Foo.bar has a closed enum type with implicit " + "presence."); +} + + +} // namespace +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/helpers.h b/third_party/protobuf/src/google/protobuf/compiler/java/helpers.h index 7e002f11901af..ab21758a7e166 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/helpers.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/helpers.h @@ -14,7 +14,10 @@ #include <cstdint> #include <string> +#include <utility> +#include <vector> +#include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" #include "google/protobuf/compiler/java/names.h" #include "google/protobuf/compiler/java/options.h" @@ -338,7 +341,7 @@ bool HasRequiredFields(const Descriptor* descriptor); bool IsRealOneof(const FieldDescriptor* descriptor); inline bool HasHasbit(const FieldDescriptor* descriptor) { - return internal::cpp::HasHasbit(descriptor); + return descriptor->has_presence() && !descriptor->real_containing_oneof(); } // Check whether a message has repeated fields. diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.cc index 3ed055a016822..2261a6891101e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/compiler/java/java_features.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/compiler/java/java_features.pb.h" @@ -29,13 +29,14 @@ namespace pb { inline constexpr JavaFeatures::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, + utf8_validation_{static_cast< ::pb::JavaFeatures_Utf8Validation >(0)}, legacy_closed_enum_{false}, - utf8_validation_{static_cast< ::pb::JavaFeatures_Utf8Validation >(0)} {} + use_old_outer_classname_default_{false} {} template <typename> PROTOBUF_CONSTEXPR JavaFeatures::JavaFeatures(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(JavaFeatures_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -52,8 +53,9 @@ struct JavaFeaturesDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOC_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 JavaFeaturesDefaultTypeInternal _JavaFeatures_default_instance_; } // namespace pb -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto[1]; -static constexpr const ::_pb::ServiceDescriptor** +static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL + file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto[1]; +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -68,22 +70,24 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_.legacy_closed_enum_), PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_.utf8_validation_), - 0, + PROTOBUF_FIELD_OFFSET(::pb::JavaFeatures, _impl_.use_old_outer_classname_default_), 1, + 0, + 2, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 10, -1, sizeof(::pb::JavaFeatures)}, + {0, 11, -1, sizeof(::pb::JavaFeatures)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::pb::_JavaFeatures_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { "\n1google/protobuf/compiler/java/java_fea" "tures.proto\022\002pb\032 google/protobuf/descrip" - "tor.proto\"\371\004\n\014JavaFeatures\022\376\001\n\022legacy_cl" + "tor.proto\"\314\005\n\014JavaFeatures\022\376\001\n\022legacy_cl" "osed_enum\030\001 \001(\010B\341\001\210\001\001\230\001\004\230\001\001\242\001\t\022\004true\030\204\007\242" "\001\n\022\005false\030\347\007\262\001\273\001\010\350\007\020\350\007\032\262\001The legacy clos" "ed enum behavior in Java is deprecated a" @@ -97,21 +101,23 @@ const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fjava_2fjava_ "d is scheduled to be removed in edition " "2025. Utf8 validation behavior should u" "se the global cross-language utf8_valida" - "tion feature.\"F\n\016Utf8Validation\022\033\n\027UTF8_" - "VALIDATION_UNKNOWN\020\000\022\013\n\007DEFAULT\020\001\022\n\n\006VER" - "IFY\020\002:<\n\004java\022\033.google.protobuf.FeatureS" - "et\030\351\007 \001(\0132\020.pb.JavaFeaturesB(\n\023com.googl" - "e.protobufB\021JavaFeaturesProto" + "tion feature.\022Q\n\037use_old_outer_classname" + "_default\030\004 \001(\010B(\210\001\001\230\001\001\242\001\t\022\004true\030\204\007\242\001\n\022\005f" + "alse\030\351\007\262\001\006\010\351\007 \351\007\"F\n\016Utf8Validation\022\033\n\027UT" + "F8_VALIDATION_UNKNOWN\020\000\022\013\n\007DEFAULT\020\001\022\n\n\006" + "VERIFY\020\002:<\n\004java\022\033.google.protobuf.Featu" + "reSet\030\351\007 \001(\0132\020.pb.JavaFeaturesB(\n\023com.go" + "ogle.protobufB\021JavaFeaturesProto" }; -static const ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto_deps[1] = - { +static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const + descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto_deps[1] = { &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, }; static ::absl::once_flag descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto_once; PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto = { false, false, - 829, + 912, descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto, "google/protobuf/compiler/java/java_features.proto", &descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto_once, @@ -125,27 +131,12 @@ PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fproto file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto, }; namespace pb { -const ::google::protobuf::EnumDescriptor* JavaFeatures_Utf8Validation_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL JavaFeatures_Utf8Validation_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto[0]; } PROTOBUF_CONSTINIT const uint32_t JavaFeatures_Utf8Validation_internal_data_[] = { 196608u, 0u, }; -bool JavaFeatures_Utf8Validation_IsValid(int value) { - return 0 <= value && value <= 2; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr JavaFeatures_Utf8Validation JavaFeatures::UTF8_VALIDATION_UNKNOWN; -constexpr JavaFeatures_Utf8Validation JavaFeatures::DEFAULT; -constexpr JavaFeatures_Utf8Validation JavaFeatures::VERIFY; -constexpr JavaFeatures_Utf8Validation JavaFeatures::Utf8Validation_MIN; -constexpr JavaFeatures_Utf8Validation JavaFeatures::Utf8Validation_MAX; -constexpr int JavaFeatures::Utf8Validation_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) // =================================================================== class JavaFeatures::_Internal { @@ -156,9 +147,9 @@ class JavaFeatures::_Internal { 8 * PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_._has_bits_); }; -JavaFeatures::JavaFeatures(::google::protobuf::Arena* arena) +JavaFeatures::JavaFeatures(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, JavaFeatures_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -166,23 +157,29 @@ JavaFeatures::JavaFeatures(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:pb.JavaFeatures) } JavaFeatures::JavaFeatures( - ::google::protobuf::Arena* arena, const JavaFeatures& from) - : JavaFeatures(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const JavaFeatures& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, JavaFeatures_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE JavaFeatures::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE JavaFeatures::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void JavaFeatures::SharedCtor(::_pb::Arena* arena) { +inline void JavaFeatures::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + - offsetof(Impl_, legacy_closed_enum_), + offsetof(Impl_, utf8_validation_), 0, - offsetof(Impl_, utf8_validation_) - - offsetof(Impl_, legacy_closed_enum_) + - sizeof(Impl_::utf8_validation_)); + offsetof(Impl_, use_old_outer_classname_default_) - + offsetof(Impl_, utf8_validation_) + + sizeof(Impl_::use_old_outer_classname_default_)); } JavaFeatures::~JavaFeatures() { // @@protoc_insertion_point(destructor:pb.JavaFeatures) @@ -195,81 +192,97 @@ inline void JavaFeatures::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* JavaFeatures::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL JavaFeatures::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) JavaFeatures(arena); } constexpr auto JavaFeatures::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(JavaFeatures), alignof(JavaFeatures)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull JavaFeatures::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_JavaFeatures_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &JavaFeatures::MergeImpl, - ::google::protobuf::Message::GetNewImpl<JavaFeatures>(), +constexpr auto JavaFeatures::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_JavaFeatures_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &JavaFeatures::MergeImpl, + ::google::protobuf::Message::GetNewImpl<JavaFeatures>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &JavaFeatures::SharedDtor, - ::google::protobuf::Message::GetClearImpl<JavaFeatures>(), &JavaFeatures::ByteSizeLong, - &JavaFeatures::_InternalSerialize, + &JavaFeatures::SharedDtor, + ::google::protobuf::Message::GetClearImpl<JavaFeatures>(), &JavaFeatures::ByteSizeLong, + &JavaFeatures::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_._cached_size_), - false, - }, - &JavaFeatures::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* JavaFeatures::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_._cached_size_), + false, + }, + &JavaFeatures::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOC_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + JavaFeatures_class_data_ = + JavaFeatures::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL JavaFeatures::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&JavaFeatures_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(JavaFeatures_class_data_.tc_table); + return JavaFeatures_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 1, 0, 2> JavaFeatures::_table_ = { +const ::_pbi::TcParseTable<2, 3, 1, 0, 2> +JavaFeatures::_table_ = { { PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_._has_bits_), 0, // no _extensions_ - 2, 8, // max_field_number, fast_idx_mask + 4, 24, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967292, // skipmap + 4294967284, // skipmap offsetof(decltype(_table_), field_entries), - 2, // num_field_entries + 3, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + JavaFeatures_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE ::_pbi::TcParser::GetTable<::pb::JavaFeatures>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ + // optional bool use_old_outer_classname_default = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FILE, edition_defaults = { + {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(JavaFeatures, _impl_.use_old_outer_classname_default_), 2>(), + {32, 2, 0, PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.use_old_outer_classname_default_)}}, + // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(JavaFeatures, _impl_.legacy_closed_enum_), 1>(), + {8, 1, 0, PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.legacy_closed_enum_)}}, // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, - {16, 1, 2, PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.utf8_validation_)}}, - // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(JavaFeatures, _impl_.legacy_closed_enum_), 0>(), - {8, 0, 0, PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.legacy_closed_enum_)}}, + {16, 0, 2, PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.utf8_validation_)}}, + {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.legacy_closed_enum_), _Internal::kHasBitsOffset + 0, 0, + {PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.legacy_closed_enum_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.utf8_validation_), _Internal::kHasBitsOffset + 1, 0, + {PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.utf8_validation_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, - }}, {{ - {0, 3}, - }}, {{ + // optional bool use_old_outer_classname_default = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FILE, edition_defaults = { + {PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.use_old_outer_classname_default_), _Internal::kHasBitsOffset + 2, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, + }}, + {{ + {0, 3}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void JavaFeatures::Clear() { // @@protoc_insertion_point(message_clear_start:pb.JavaFeatures) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -278,84 +291,88 @@ PROTOBUF_NOINLINE void JavaFeatures::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - ::memset(&_impl_.legacy_closed_enum_, 0, static_cast<::size_t>( - reinterpret_cast<char*>(&_impl_.utf8_validation_) - - reinterpret_cast<char*>(&_impl_.legacy_closed_enum_)) + sizeof(_impl_.utf8_validation_)); + if ((cached_has_bits & 0x00000007u) != 0) { + ::memset(&_impl_.utf8_validation_, 0, static_cast<::size_t>( + reinterpret_cast<char*>(&_impl_.use_old_outer_classname_default_) - + reinterpret_cast<char*>(&_impl_.utf8_validation_)) + sizeof(_impl_.use_old_outer_classname_default_)); } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* JavaFeatures::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const JavaFeatures& this_ = static_cast<const JavaFeatures&>(base); +::uint8_t* PROTOBUF_NONNULL JavaFeatures::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const JavaFeatures& this_ = static_cast<const JavaFeatures&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* JavaFeatures::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const JavaFeatures& this_ = *this; +::uint8_t* PROTOBUF_NONNULL JavaFeatures::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const JavaFeatures& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:pb.JavaFeatures) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:pb.JavaFeatures) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000001u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_legacy_closed_enum(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 1, this_._internal_legacy_closed_enum(), target); + } - // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 2, this_._internal_utf8_validation(), target); - } + // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000001u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this_._internal_utf8_validation(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:pb.JavaFeatures) - return target; - } + // optional bool use_old_outer_classname_default = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 4, this_._internal_use_old_outer_classname_default(), target); + } + + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:pb.JavaFeatures) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t JavaFeatures::ByteSizeLong(const MessageLite& base) { - const JavaFeatures& this_ = static_cast<const JavaFeatures&>(base); +::size_t JavaFeatures::ByteSizeLong(const MessageLite& base) { + const JavaFeatures& this_ = static_cast<const JavaFeatures&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t JavaFeatures::ByteSizeLong() const { - const JavaFeatures& this_ = *this; +::size_t JavaFeatures::ByteSizeLong() const { + const JavaFeatures& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:pb.JavaFeatures) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:pb.JavaFeatures) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000001u) { - total_size += 2; - } - // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_utf8_validation()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x00000006u & cached_has_bits) * 2; + { + // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_utf8_validation()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void JavaFeatures::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<JavaFeatures*>(&to_msg); @@ -366,12 +383,15 @@ void JavaFeatures::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::go (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _this->_impl_.utf8_validation_ = from._impl_.utf8_validation_; + } + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.legacy_closed_enum_ = from._impl_.legacy_closed_enum_; } - if (cached_has_bits & 0x00000002u) { - _this->_impl_.utf8_validation_ = from._impl_.utf8_validation_; + if ((cached_has_bits & 0x00000004u) != 0) { + _this->_impl_.use_old_outer_classname_default_ = from._impl_.use_old_outer_classname_default_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; @@ -386,26 +406,25 @@ void JavaFeatures::CopyFrom(const JavaFeatures& from) { } -void JavaFeatures::InternalSwap(JavaFeatures* PROTOBUF_RESTRICT other) { +void JavaFeatures::InternalSwap(JavaFeatures* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.utf8_validation_) - + sizeof(JavaFeatures::_impl_.utf8_validation_) - - PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.legacy_closed_enum_)>( - reinterpret_cast<char*>(&_impl_.legacy_closed_enum_), - reinterpret_cast<char*>(&other->_impl_.legacy_closed_enum_)); + PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.use_old_outer_classname_default_) + + sizeof(JavaFeatures::_impl_.use_old_outer_classname_default_) + - PROTOBUF_FIELD_OFFSET(JavaFeatures, _impl_.utf8_validation_)>( + reinterpret_cast<char*>(&_impl_.utf8_validation_), + reinterpret_cast<char*>(&other->_impl_.utf8_validation_)); } ::google::protobuf::Metadata JavaFeatures::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } PROTOBUF_CONSTINIT PROTOC_EXPORT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi:: - ExtensionIdentifier<::google::protobuf::FeatureSet, ::_pbi::MessageTypeTraits< ::pb::JavaFeatures >, - 11, false> - java(kJavaFieldNumber, &::pb::_JavaFeatures_default_instance_); + PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi::ExtensionIdentifier< + ::google::protobuf::FeatureSet, ::_pbi::MessageTypeTraits< ::pb::JavaFeatures >, 11, false> + java(kJavaFieldNumber, &::pb::_JavaFeatures_default_instance_); // @@protoc_insertion_point(namespace_scope) } // namespace pb namespace google { @@ -414,7 +433,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto), ::_pbi::ExtensionSet::RegisterMessageExtension( &::google::protobuf::FeatureSet::default_instance(), 1001, 11, diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.h index ac56b1a13953a..83d6a661d8cfc 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_features.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/compiler/java/java_features.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto_2epb_2eh #define google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -51,15 +51,22 @@ template <typename T> struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto { static const ::uint32_t offsets[]; }; -PROTOC_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto; +extern "C" { +PROTOC_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto; +} // extern "C" namespace pb { +enum JavaFeatures_Utf8Validation : int; +PROTOC_EXPORT extern const uint32_t JavaFeatures_Utf8Validation_internal_data_[]; class JavaFeatures; struct JavaFeaturesDefaultTypeInternal; PROTOC_EXPORT extern JavaFeaturesDefaultTypeInternal _JavaFeatures_default_instance_; +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull JavaFeatures_class_data_; } // namespace pb namespace google { namespace protobuf { +template <> +internal::EnumTraitsT<::pb::JavaFeatures_Utf8Validation_internal_data_> + internal::EnumTraitsImpl::value<::pb::JavaFeatures_Utf8Validation>; } // namespace protobuf } // namespace google @@ -70,13 +77,16 @@ enum JavaFeatures_Utf8Validation : int { JavaFeatures_Utf8Validation_VERIFY = 2, }; -PROTOC_EXPORT bool JavaFeatures_Utf8Validation_IsValid(int value); PROTOC_EXPORT extern const uint32_t JavaFeatures_Utf8Validation_internal_data_[]; -constexpr JavaFeatures_Utf8Validation JavaFeatures_Utf8Validation_Utf8Validation_MIN = static_cast<JavaFeatures_Utf8Validation>(0); -constexpr JavaFeatures_Utf8Validation JavaFeatures_Utf8Validation_Utf8Validation_MAX = static_cast<JavaFeatures_Utf8Validation>(2); -constexpr int JavaFeatures_Utf8Validation_Utf8Validation_ARRAYSIZE = 2 + 1; -PROTOC_EXPORT const ::google::protobuf::EnumDescriptor* -JavaFeatures_Utf8Validation_descriptor(); +inline constexpr JavaFeatures_Utf8Validation JavaFeatures_Utf8Validation_Utf8Validation_MIN = + static_cast<JavaFeatures_Utf8Validation>(0); +inline constexpr JavaFeatures_Utf8Validation JavaFeatures_Utf8Validation_Utf8Validation_MAX = + static_cast<JavaFeatures_Utf8Validation>(2); +inline bool JavaFeatures_Utf8Validation_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int JavaFeatures_Utf8Validation_Utf8Validation_ARRAYSIZE = 2 + 1; +PROTOC_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL JavaFeatures_Utf8Validation_descriptor(); template <typename T> const std::string& JavaFeatures_Utf8Validation_Name(T value) { static_assert(std::is_same<T, JavaFeatures_Utf8Validation>::value || @@ -86,13 +96,13 @@ const std::string& JavaFeatures_Utf8Validation_Name(T value) { } template <> inline const std::string& JavaFeatures_Utf8Validation_Name(JavaFeatures_Utf8Validation value) { - return ::google::protobuf::internal::NameOfDenseEnum<JavaFeatures_Utf8Validation_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<JavaFeatures_Utf8Validation_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool JavaFeatures_Utf8Validation_Parse(absl::string_view name, JavaFeatures_Utf8Validation* value) { - return ::google::protobuf::internal::ParseNamedEnum<JavaFeatures_Utf8Validation>( - JavaFeatures_Utf8Validation_descriptor(), name, value); +inline bool JavaFeatures_Utf8Validation_Parse( + absl::string_view name, JavaFeatures_Utf8Validation* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<JavaFeatures_Utf8Validation>(JavaFeatures_Utf8Validation_descriptor(), name, + value); } // =================================================================== @@ -107,15 +117,14 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message ~JavaFeatures() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(JavaFeatures* msg, std::destroying_delete_t) { + void operator delete(JavaFeatures* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(JavaFeatures)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR JavaFeatures( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR JavaFeatures(::google::protobuf::internal::ConstantInitialized); inline JavaFeatures(const JavaFeatures& from) : JavaFeatures(nullptr, from) {} inline JavaFeatures(JavaFeatures&& from) noexcept @@ -138,30 +147,27 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const JavaFeatures& default_instance() { - return *internal_default_instance(); - } - static inline const JavaFeatures* internal_default_instance() { - return reinterpret_cast<const JavaFeatures*>( + return *reinterpret_cast<const JavaFeatures*>( &_JavaFeatures_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(JavaFeatures& a, JavaFeatures& b) { a.Swap(&b); } - inline void Swap(JavaFeatures* other) { + inline void Swap(JavaFeatures* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -169,7 +175,7 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(JavaFeatures* other) { + void UnsafeArenaSwap(JavaFeatures* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -177,7 +183,7 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - JavaFeatures* New(::google::protobuf::Arena* arena = nullptr) const { + JavaFeatures* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<JavaFeatures>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -186,9 +192,8 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message void MergeFrom(const JavaFeatures& from) { JavaFeatures::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -198,49 +203,51 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(JavaFeatures* other); + void InternalSwap(JavaFeatures* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "pb.JavaFeatures"; } protected: - explicit JavaFeatures(::google::protobuf::Arena* arena); - JavaFeatures(::google::protobuf::Arena* arena, const JavaFeatures& from); - JavaFeatures(::google::protobuf::Arena* arena, JavaFeatures&& from) noexcept + explicit JavaFeatures(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + JavaFeatures(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const JavaFeatures& from); + JavaFeatures( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, JavaFeatures&& from) noexcept : JavaFeatures(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using Utf8Validation = JavaFeatures_Utf8Validation; @@ -253,33 +260,24 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message static constexpr Utf8Validation Utf8Validation_MIN = JavaFeatures_Utf8Validation_Utf8Validation_MIN; static constexpr Utf8Validation Utf8Validation_MAX = JavaFeatures_Utf8Validation_Utf8Validation_MAX; static constexpr int Utf8Validation_ARRAYSIZE = JavaFeatures_Utf8Validation_Utf8Validation_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Utf8Validation_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Utf8Validation_descriptor() { return JavaFeatures_Utf8Validation_descriptor(); } template <typename T> static inline const std::string& Utf8Validation_Name(T value) { return JavaFeatures_Utf8Validation_Name(value); } - static inline bool Utf8Validation_Parse(absl::string_view name, Utf8Validation* value) { + static inline bool Utf8Validation_Parse( + absl::string_view name, Utf8Validation* PROTOBUF_NONNULL value) { return JavaFeatures_Utf8Validation_Parse(name, value); } // accessors ------------------------------------------------------- enum : int { - kLegacyClosedEnumFieldNumber = 1, kUtf8ValidationFieldNumber = 2, + kLegacyClosedEnumFieldNumber = 1, + kUseOldOuterClassnameDefaultFieldNumber = 4, }; - // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - bool has_legacy_closed_enum() const; - void clear_legacy_closed_enum() ; - bool legacy_closed_enum() const; - void set_legacy_closed_enum(bool value); - - private: - bool _internal_legacy_closed_enum() const; - void _internal_set_legacy_closed_enum(bool value); - - public: // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { bool has_utf8_validation() const; void clear_utf8_validation() ; @@ -290,14 +288,36 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message ::pb::JavaFeatures_Utf8Validation _internal_utf8_validation() const; void _internal_set_utf8_validation(::pb::JavaFeatures_Utf8Validation value); + public: + // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + bool has_legacy_closed_enum() const; + void clear_legacy_closed_enum() ; + bool legacy_closed_enum() const; + void set_legacy_closed_enum(bool value); + + private: + bool _internal_legacy_closed_enum() const; + void _internal_set_legacy_closed_enum(bool value); + + public: + // optional bool use_old_outer_classname_default = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FILE, edition_defaults = { + bool has_use_old_outer_classname_default() const; + void clear_use_old_outer_classname_default() ; + bool use_old_outer_classname_default() const; + void set_use_old_outer_classname_default(bool value); + + private: + bool _internal_use_old_outer_classname_default() const; + void _internal_set_use_old_outer_classname_default(bool value); + public: // @@protoc_insertion_point(class_scope:pb.JavaFeatures) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 1, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 1, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -307,31 +327,35 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const JavaFeatures& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const JavaFeatures& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; - bool legacy_closed_enum_; int utf8_validation_; + bool legacy_closed_enum_; + bool use_old_outer_classname_default_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto; }; +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull JavaFeatures_class_data_; + // =================================================================== -static const int kJavaFieldNumber = 1001; +inline constexpr int kJavaFieldNumber = + 1001; PROTOC_EXPORT extern ::google::protobuf::internal::ExtensionIdentifier< - ::google::protobuf::FeatureSet, ::google::protobuf::internal::MessageTypeTraits< ::pb::JavaFeatures >, 11, - false> + ::google::protobuf::FeatureSet, ::google::protobuf::internal::MessageTypeTraits< ::pb::JavaFeatures >, 11, false> java; // =================================================================== @@ -347,13 +371,13 @@ PROTOC_EXPORT extern ::google::protobuf::internal::ExtensionIdentifier< // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool JavaFeatures::has_legacy_closed_enum() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; return value; } inline void JavaFeatures::clear_legacy_closed_enum() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.legacy_closed_enum_ = false; - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } inline bool JavaFeatures::legacy_closed_enum() const { // @@protoc_insertion_point(field_get:pb.JavaFeatures.legacy_closed_enum) @@ -361,7 +385,7 @@ inline bool JavaFeatures::legacy_closed_enum() const { } inline void JavaFeatures::set_legacy_closed_enum(bool value) { _internal_set_legacy_closed_enum(value); - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000002u; // @@protoc_insertion_point(field_set:pb.JavaFeatures.legacy_closed_enum) } inline bool JavaFeatures::_internal_legacy_closed_enum() const { @@ -375,13 +399,13 @@ inline void JavaFeatures::_internal_set_legacy_closed_enum(bool value) { // optional .pb.JavaFeatures.Utf8Validation utf8_validation = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool JavaFeatures::has_utf8_validation() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; return value; } inline void JavaFeatures::clear_utf8_validation() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.utf8_validation_ = 0; - _impl_._has_bits_[0] &= ~0x00000002u; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::pb::JavaFeatures_Utf8Validation JavaFeatures::utf8_validation() const { // @@protoc_insertion_point(field_get:pb.JavaFeatures.utf8_validation) @@ -389,7 +413,7 @@ inline ::pb::JavaFeatures_Utf8Validation JavaFeatures::utf8_validation() const { } inline void JavaFeatures::set_utf8_validation(::pb::JavaFeatures_Utf8Validation value) { _internal_set_utf8_validation(value); - _impl_._has_bits_[0] |= 0x00000002u; + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:pb.JavaFeatures.utf8_validation) } inline ::pb::JavaFeatures_Utf8Validation JavaFeatures::_internal_utf8_validation() const { @@ -398,8 +422,38 @@ inline ::pb::JavaFeatures_Utf8Validation JavaFeatures::_internal_utf8_validation } inline void JavaFeatures::_internal_set_utf8_validation(::pb::JavaFeatures_Utf8Validation value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::pb::JavaFeatures_Utf8Validation_IsValid(value)); - _impl_.utf8_validation_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::pb::JavaFeatures_Utf8Validation_internal_data_)); + _impl_.utf8_validation_ = value; +} + +// optional bool use_old_outer_classname_default = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FILE, edition_defaults = { +inline bool JavaFeatures::has_use_old_outer_classname_default() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline void JavaFeatures::clear_use_old_outer_classname_default() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.use_old_outer_classname_default_ = false; + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline bool JavaFeatures::use_old_outer_classname_default() const { + // @@protoc_insertion_point(field_get:pb.JavaFeatures.use_old_outer_classname_default) + return _internal_use_old_outer_classname_default(); +} +inline void JavaFeatures::set_use_old_outer_classname_default(bool value) { + _internal_set_use_old_outer_classname_default(value); + _impl_._has_bits_[0] |= 0x00000004u; + // @@protoc_insertion_point(field_set:pb.JavaFeatures.use_old_outer_classname_default) +} +inline bool JavaFeatures::_internal_use_old_outer_classname_default() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.use_old_outer_classname_default_; +} +inline void JavaFeatures::_internal_set_use_old_outer_classname_default(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.use_old_outer_classname_default_ = value; } #ifdef __GNUC__ @@ -416,7 +470,7 @@ namespace protobuf { template <> struct is_proto_enum<::pb::JavaFeatures_Utf8Validation> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::pb::JavaFeatures_Utf8Validation>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::pb::JavaFeatures_Utf8Validation>() { return ::pb::JavaFeatures_Utf8Validation_descriptor(); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/java/lite/BUILD.bazel index 10467390f69a8..f7800133d422b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/BUILD.bazel @@ -1,3 +1,5 @@ +load("//build_defs:cpp_opts.bzl", "COPTS") + cc_library( name = "field_generators", srcs = [ @@ -23,6 +25,7 @@ cc_library( "primitive_field.h", "string_field.h", ], + copts = COPTS, strip_include_prefix = "/src", visibility = [ "//src/google/protobuf/compiler/java:__subpackages__", @@ -35,10 +38,10 @@ cc_library( "//src/google/protobuf/compiler/java:helpers", "//src/google/protobuf/compiler/java:internal_helpers", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -62,6 +65,7 @@ cc_library( "message.h", "message_builder.h", ], + copts = COPTS, strip_include_prefix = "/src", visibility = [ "//src/google/protobuf/compiler/java:__subpackages__", @@ -77,9 +81,9 @@ cc_library( "//src/google/protobuf/compiler/java/full:service", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum.cc b/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum.cc index 8e3c57cf9c1bc..af48b0e39a4bb 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum.cc @@ -17,11 +17,13 @@ #include "absl/container/flat_hash_map.h" #include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "google/protobuf/compiler/java/context.h" #include "google/protobuf/compiler/java/doc_comment.h" #include "google/protobuf/compiler/java/helpers.h" #include "google/protobuf/compiler/java/internal_helpers.h" #include "google/protobuf/compiler/java/name_resolver.h" +#include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/io/printer.h" @@ -67,17 +69,16 @@ void EnumLiteGenerator::Generate(io::Printer* printer) { printer->Annotate("classname", descriptor_); printer->Indent(); - for (int i = 0; i < canonical_values_.size(); i++) { + for (const EnumValueDescriptor* value : canonical_values_) { absl::flat_hash_map<absl::string_view, std::string> vars; - vars["name"] = canonical_values_[i]->name(); - vars["number"] = absl::StrCat(canonical_values_[i]->number()); - WriteEnumValueDocComment(printer, canonical_values_[i], - context_->options()); - if (canonical_values_[i]->options().deprecated()) { + vars["name"] = std::string(value->name()); + vars["number"] = absl::StrCat(value->number()); + WriteEnumValueDocComment(printer, value, context_->options()); + if (value->options().deprecated()) { printer->Print("@java.lang.Deprecated\n"); } printer->Print(vars, "$name$($number$),\n"); - printer->Annotate("name", canonical_values_[i]); + printer->Annotate("name", value); } if (!descriptor_->is_closed()) { @@ -91,20 +92,20 @@ void EnumLiteGenerator::Generate(io::Printer* printer) { // ----------------------------------------------------------------- - for (int i = 0; i < aliases_.size(); i++) { + for (const Alias& alias : aliases_) { absl::flat_hash_map<absl::string_view, std::string> vars; - vars["classname"] = descriptor_->name(); - vars["name"] = aliases_[i].value->name(); - vars["canonical_name"] = aliases_[i].canonical_value->name(); - WriteEnumValueDocComment(printer, aliases_[i].value, context_->options()); + vars["classname"] = std::string(descriptor_->name()); + vars["name"] = std::string(alias.value->name()); + vars["canonical_name"] = std::string(alias.canonical_value->name()); + WriteEnumValueDocComment(printer, alias.value, context_->options()); printer->Print( vars, "public static final $classname$ $name$ = $canonical_name$;\n"); - printer->Annotate("name", aliases_[i].value); + printer->Annotate("name", alias.value); } for (int i = 0; i < descriptor_->value_count(); i++) { absl::flat_hash_map<absl::string_view, std::string> vars; - vars["name"] = descriptor_->value(i)->name(); + vars["name"] = std::string(descriptor_->value(i)->name()); vars["number"] = absl::StrCat(descriptor_->value(i)->number()); vars["{"] = ""; vars["}"] = ""; @@ -162,10 +163,9 @@ void EnumLiteGenerator::Generate(io::Printer* printer) { printer->Indent(); printer->Indent(); - for (int i = 0; i < canonical_values_.size(); i++) { - printer->Print("case $number$: return $name$;\n", "name", - canonical_values_[i]->name(), "number", - absl::StrCat(canonical_values_[i]->number())); + for (const EnumValueDescriptor* value : canonical_values_) { + printer->Print("case $number$: return $name$;\n", "name", value->name(), + "number", absl::StrCat(value->number())); } printer->Outdent(); @@ -195,8 +195,8 @@ void EnumLiteGenerator::Generate(io::Printer* printer) { "\n" "private static final class $classname$Verifier implements \n" " com.google.protobuf.Internal.EnumVerifier { \n" - " static final com.google.protobuf.Internal.EnumVerifier " - " INSTANCE = new $classname$Verifier();\n" + " static final com.google.protobuf.Internal.EnumVerifier\n" + " INSTANCE = new $classname$Verifier();\n" " @java.lang.Override\n" " public boolean isInRange(int number) {\n" " return $classname$.forNumber(number) != null;\n" diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.cc index 4d488767f9938..bc55f2c75bf2d 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.cc @@ -53,7 +53,6 @@ void SetEnumVariables( (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->enum_type()); - variables->insert({"kt_type", EscapeKotlinKeywords((*variables)["type"])}); (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->enum_type()); (*variables)["default"] = @@ -68,12 +67,6 @@ void SetEnumVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); (*variables)["required"] = descriptor->is_required() ? "true" : "false"; if (HasHasbit(descriptor)) { @@ -84,8 +77,6 @@ void SetEnumVariables( absl::StrCat(1 << (messageBitIndex % 32)); } // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - // Note that these have a trailing ";". (*variables)["set_has_field_bit_message"] = absl::StrCat(GenerateSetBit(messageBitIndex), ";"); @@ -180,7 +171,7 @@ void ImmutableEnumFieldLiteGenerator::GenerateMembers( variables_, "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" + " return $is_field_present_message$;\n" "}\n"); printer->Annotate("{", "}", descriptor_); } @@ -298,63 +289,6 @@ void ImmutableEnumFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void ImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name_get", - [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, - {"jvm_name_set", - [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, - }, - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " $jvm_name_get$" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " $jvm_name_set$" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - - if (SupportUnknownEnumValue(descriptor_)) { - printer->Emit( - { - {"jvm_name_get", - [&] { JvmName("${$get$kt_capitalized_name$Value$}$", name_ctx); }}, - {"jvm_name_set", - [&] { JvmName("${$set$kt_capitalized_name$Value$}$", name_ctx); }}, - }, - "$kt_deprecation$public var $kt_name$Value: kotlin.Int\n" - " $jvm_name_get$" - " get() = $kt_dsl_builder$.${$$kt_property_name$Value$}$\n" - " $jvm_name_set$" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_property_name$Value$}$ = value\n" - " }\n"); - } - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); - - if (descriptor_->has_presence()) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - } -} - void ImmutableEnumFieldLiteGenerator::GenerateInitializationCode( io::Printer* printer) const { if (!IsDefaultValueJavaDefault(descriptor_)) { @@ -903,128 +837,6 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateInitializationCode( printer->Print(variables_, "$name$_ = emptyIntList();\n"); } -void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - printer->Print( - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - "$kt_deprecation$ public val $kt_name$: " - "com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" - "$ jvm_synthetic$" - " get() = com.google.protobuf.kotlin.DslList(\n" - " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" - " )\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "public fun com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}"); -} - std::string RepeatedImmutableEnumFieldLiteGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->enum_type()); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.h index 5bcc00dba510e..44090d3f6bf9d 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/enum_field.h @@ -55,7 +55,6 @@ class ImmutableEnumFieldLiteGenerator : public ImmutableFieldLiteGenerator { void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; @@ -103,7 +102,6 @@ class RepeatedImmutableEnumFieldLiteGenerator void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.cc index 29d285c2e324d..433af226adccf 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.cc @@ -41,17 +41,6 @@ std::string TypeName(const FieldDescriptor* field, } } -std::string KotlinTypeName(const FieldDescriptor* field, - ClassNameResolver* name_resolver) { - if (GetJavaType(field) == JAVATYPE_MESSAGE) { - return name_resolver->GetImmutableClassName(field->message_type()); - } else if (GetJavaType(field) == JAVATYPE_ENUM) { - return name_resolver->GetImmutableClassName(field->enum_type()); - } else { - return std::string(KotlinTypeName(GetJavaType(field))); - } -} - std::string WireType(const FieldDescriptor* field) { return absl::StrCat("com.google.protobuf.WireFormat.FieldType.", FieldTypeName(field->type())); @@ -78,8 +67,6 @@ void SetMessageVariables( (*variables)["key_type"] = TypeName(key, name_resolver, false); (*variables)["boxed_key_type"] = TypeName(key, name_resolver, true); - (*variables)["kt_key_type"] = KotlinTypeName(key, name_resolver); - (*variables)["kt_value_type"] = KotlinTypeName(value, name_resolver); (*variables)["key_wire_type"] = WireType(key); (*variables)["key_default_value"] = DefaultValue(key, true, name_resolver, context->options()); @@ -141,12 +128,6 @@ void SetMessageVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); variables->insert( {"default_entry", absl::StrCat((*variables)["capitalized_name"], @@ -835,111 +816,6 @@ void ImmutableMapFieldLiteGenerator::GenerateBuilderMembers( } } -void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - printer->Print( - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("get$kt_capitalized_name$Map", name_ctx); }}, - }, - "$kt_deprecation$ public val $kt_name$: " - "com.google.protobuf.kotlin.DslMap" - "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" - "$ jvm_synthetic$" - "$jvm_name$" - " get() = com.google.protobuf.kotlin.DslMap(\n" - " $kt_dsl_builder$.${$$kt_property_name$Map$}$\n" - " )\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("put$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_name$" - "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" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("remove$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("putAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - " $kt_dsl_builder$.${$putAll$capitalized_name$$}$(map)\n" - " }\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - " }\n"); -} - void ImmutableMapFieldLiteGenerator::GenerateInitializationCode( io::Printer* printer) const { // Nothing to initialize. diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.h index eb72891ac5a35..846ccc28bd639 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/map_field.h @@ -38,7 +38,6 @@ class ImmutableMapFieldLiteGenerator : public ImmutableFieldLiteGenerator { void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/message.cc b/third_party/protobuf/src/google/protobuf/compiler/java/lite/message.cc index 79c3c3e642ed7..3b4b4842d33f1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/message.cc @@ -149,7 +149,7 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { absl::flat_hash_map<absl::string_view, std::string> variables = {{"{", ""}, {"}", ""}}; variables["static"] = is_own_file ? " " : " static "; - variables["classname"] = descriptor_->name(); + variables["classname"] = std::string(descriptor_->name()); variables["extra_interfaces"] = ExtraMessageInterfaces(descriptor_); variables["deprecation"] = descriptor_->options().deprecated() ? "@java.lang.Deprecated " : ""; @@ -328,7 +328,7 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { printer->Print( "@java.lang.Override\n" - "@java.lang.SuppressWarnings({\"unchecked\", \"fallthrough\"})\n" + "@java.lang.SuppressWarnings({\"ThrowNull\"})\n" "protected final java.lang.Object dynamicMethod(\n" " com.google.protobuf.GeneratedMessageLite.MethodToInvoke method,\n" " java.lang.Object arg0, java.lang.Object arg1) {\n" @@ -357,7 +357,6 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { printer->Print( "}\n" - "// fall through\n" "case GET_DEFAULT_INSTANCE: {\n" " return DEFAULT_INSTANCE;\n" "}\n" @@ -384,8 +383,6 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { " return parser;\n", "classname", name_resolver_->GetImmutableClassName(descriptor_)); - printer->Outdent(); - if (HasRequiredFields(descriptor_)) { printer->Print( "}\n" @@ -402,18 +399,21 @@ void ImmutableMessageLiteGenerator::Generate(io::Printer* printer) { "case GET_MEMOIZED_IS_INITIALIZED: {\n" " return (byte) 1;\n" "}\n" - "case SET_MEMOIZED_IS_INITIALIZED: {\n" - " return null;\n" - "}\n"); + "// SET_MEMOIZED_IS_INITIALIZED is never called for this message.\n" + "// So it can do anything. Combine with default case for smaller " + "codegen.\n" + "case SET_MEMOIZED_IS_INITIALIZED:\n"); } printer->Outdent(); printer->Print( - " }\n" - " throw new UnsupportedOperationException();\n" "}\n" - "\n", - "classname", name_resolver_->GetImmutableClassName(descriptor_)); + "// Should never happen. Generates tight code to throw an exception.\n" + "throw null;\n"); + printer->Outdent(); + printer->Print( + "}\n" + "\n"); printer->Print( "\n" @@ -499,7 +499,7 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodNewBuildMessageInfo( WriteIntToUtf16CharSequence(descriptor_->field_count(), &chars); if (descriptor_->field_count() == 0) { - printer->Print("java.lang.Object[] objects = null;"); + printer->Print("java.lang.Object[] objects = null;\n"); } else { // A single array of all fields (including oneof, oneofCase, hasBits). printer->Print("java.lang.Object[] objects = new java.lang.Object[] {\n"); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.cc index 2346747205d82..77c74a0d26a63 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.cc @@ -44,7 +44,6 @@ void SetMessageVariables( (*variables)["type"] = name_resolver->GetImmutableClassName(descriptor->message_type()); - variables->insert({"kt_type", EscapeKotlinKeywords((*variables)["type"])}); (*variables)["mutable_type"] = name_resolver->GetMutableClassName(descriptor->message_type()); (*variables)["group_or_message"] = @@ -54,18 +53,10 @@ void SetMessageVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); (*variables)["required"] = descriptor->is_required() ? "true" : "false"; if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - // Note that these have a trailing ";". (*variables)["set_has_field_bit_message"] = absl::StrCat(GenerateSetBit(messageBitIndex), ";"); @@ -136,41 +127,21 @@ void ImmutableMessageFieldLiteGenerator::GenerateMembers( printer->Print(variables_, "private $type$ $name$_;\n"); PrintExtraFieldInfo(variables_, printer); - if (HasHasbit(descriptor_)) { - WriteFieldDocComment(printer, descriptor_, context_->options()); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_, context_->options()); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } else { - WriteFieldDocComment(printer, descriptor_, context_->options()); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $name$_ != null;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - WriteFieldDocComment(printer, descriptor_, context_->options()); - printer->Print( - variables_, - "@java.lang.Override\n" - "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" - " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" - "}\n"); - printer->Annotate("{", "}", descriptor_); - } + WriteFieldDocComment(printer, descriptor_, context_->options()); + printer->Print(variables_, + "@java.lang.Override\n" + "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" + " return $is_field_present_message$;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); + WriteFieldDocComment(printer, descriptor_, context_->options()); + printer->Print( + variables_, + "@java.lang.Override\n" + "$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n" + " return $name$_ == null ? $type$.getDefaultInstance() : $name$_;\n" + "}\n"); + printer->Annotate("{", "}", descriptor_); // Field.Builder setField(Field value) WriteFieldDocComment(printer, descriptor_, context_->options()); @@ -180,7 +151,7 @@ void ImmutableMessageFieldLiteGenerator::GenerateMembers( " value.getClass(); // minimal bytecode null check\n" " $name$_ = value;\n" " $set_has_field_bit_message$\n" - " }\n"); + "}\n"); // Field.Builder mergeField(Field value) WriteFieldDocComment(printer, descriptor_, context_->options()); @@ -203,7 +174,7 @@ void ImmutableMessageFieldLiteGenerator::GenerateMembers( // Field.Builder clearField() WriteFieldDocComment(printer, descriptor_, context_->options()); printer->Print(variables_, - "private void clear$capitalized_name$() {" + "private void clear$capitalized_name$() {\n" " $name$_ = null;\n" " $clear_has_field_bit_message$\n" "}\n"); @@ -276,56 +247,6 @@ void ImmutableMessageFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void ImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name_get", - [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, - {"jvm_name_set", - [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, - }, - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " $jvm_name_get$" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " $jvm_name_set$" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - GenerateKotlinOrNull(printer); -} - -void ImmutableMessageFieldLiteGenerator::GenerateKotlinOrNull( - io::Printer* printer) const { - if (descriptor_->has_presence() && - descriptor_->real_containing_oneof() == nullptr) { - printer->Print( - "$kt_deprecation$\n" - "public val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n" - " get() = $kt_dsl_builder$.$name$OrNull\n"); - } -} - void ImmutableMessageFieldLiteGenerator::GenerateFieldInfo( io::Printer* printer, std::vector<uint16_t>* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); @@ -810,130 +731,6 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateInitializationCode( std::string RepeatedImmutableMessageFieldLiteGenerator::GetBoxedType() const { return name_resolver_->GetImmutableClassName(descriptor_->message_type()); } - -void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - printer->Print( - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Print( - "$kt_deprecation$ public val $kt_name$: " - "com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" - "$ jvm_synthetic$" - " get() = com.google.protobuf.kotlin.DslList(\n" - " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" - " )\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, - }, - - "$jvm_synthetic$" - "$jvm_name$" - "public fun com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); -} - } // namespace java } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.h index 495b3933b937f..8424bf3da4bda 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/message_field.h @@ -57,7 +57,6 @@ class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator { void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; @@ -69,7 +68,6 @@ class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator { Context* context_; private: - void GenerateKotlinOrNull(io::Printer* printer) const; }; class ImmutableMessageOneofFieldLiteGenerator @@ -110,7 +108,6 @@ class RepeatedImmutableMessageFieldLiteGenerator void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.cc index 3e0d174671350..035d19f85ddc9 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.cc @@ -52,7 +52,6 @@ void SetPrimitiveVariables( JavaType javaType = GetJavaType(descriptor); (*variables)["type"] = std::string(PrimitiveTypeName(javaType)); (*variables)["boxed_type"] = std::string(BoxedPrimitiveTypeName(javaType)); - (*variables)["kt_type"] = std::string(KotlinTypeName(javaType)); variables->insert({"field_type", (*variables)["type"]}); (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver, context->options()); @@ -121,11 +120,6 @@ void SetPrimitiveVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - (*variables)["kt_deprecation"] = - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", name, - " is deprecated\") ") - : ""; int fixed_size = FixedSize(GetType(descriptor)); if (fixed_size != -1) { (*variables)["fixed_size"] = absl::StrCat(fixed_size); @@ -133,8 +127,6 @@ void SetPrimitiveVariables( if (HasHasbit(descriptor)) { // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - // Note that these have a trailing ";". (*variables)["set_has_field_bit_message"] = absl::StrCat(GenerateSetBit(messageBitIndex), ";"); @@ -237,7 +229,7 @@ void ImmutablePrimitiveFieldLiteGenerator::GenerateMembers( variables_, "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" + " return $is_field_present_message$;\n" "}\n"); printer->Annotate("{", "}", descriptor_); } @@ -326,63 +318,6 @@ void ImmutablePrimitiveFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void ImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - WriteFieldDocComment(printer, descriptor_, context_->options()); - if (descriptor_->name() == "is_initialized") { - printer->Emit( - { - {"jvm_name_get", - [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, - {"jvm_name_set", - [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, - }, - "// TODO: b/336400327 - remove this hack; we should access properties\n" - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " $jvm_name_get$" - " get() = $kt_dsl_builder$.get${$$kt_capitalized_name$$}$()\n" - " $jvm_name_set$" - " set(value) {\n" - " $kt_dsl_builder$.${$set$kt_capitalized_name$$}$(value)\n" - " }\n"); - } else { - printer->Emit( - { - {"jvm_name_get", - [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, - {"jvm_name_set", - [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, - }, - "$kt_deprecation$public var $kt_name$: $kt_type$\n" - " $jvm_name_get$" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " $jvm_name_set$" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - } - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); - - if (descriptor_->has_presence()) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - } -} - void ImmutablePrimitiveFieldLiteGenerator::GenerateFieldInfo( io::Printer* printer, std::vector<uint16_t>* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); @@ -723,127 +658,6 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - printer->Print( - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - WriteFieldDocComment(printer, descriptor_, context_->options()); - printer->Print( - "$kt_deprecation$ public val $kt_name$: " - "com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" - "$ jvm_synthetic$" - " get() = com.google.protobuf.kotlin.DslList(\n" - " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" - " )\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "public fun com.google.protobuf.kotlin.DslList" - "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}"); -} - void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateFieldInfo( io::Printer* printer, std::vector<uint16_t>* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.h index 56b6fc7b775df..eb6d5f5590e4b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/primitive_field.h @@ -57,7 +57,6 @@ class ImmutablePrimitiveFieldLiteGenerator void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; @@ -107,7 +106,6 @@ class RepeatedImmutablePrimitiveFieldLiteGenerator void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.cc index 05237fc1fd7a4..ca5e858f073ce 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.cc @@ -62,12 +62,6 @@ void SetPrimitiveVariables( // by the proto compiler (*variables)["deprecation"] = descriptor->options().deprecated() ? "@java.lang.Deprecated " : ""; - variables->insert( - {"kt_deprecation", - descriptor->options().deprecated() - ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", - (*variables)["name"], " is deprecated\") ") - : ""}); (*variables)["required"] = descriptor->is_required() ? "true" : "false"; if (!context->options().opensource_runtime) { (*variables)["enforce_utf8"] = CheckUtf8(descriptor) ? "true" : "false"; @@ -81,8 +75,6 @@ void SetPrimitiveVariables( absl::StrCat(1 << (messageBitIndex % 32)); } // For singular messages and builders, one bit is used for the hasField bit. - (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex); - // Note that these have a trailing ";". (*variables)["set_has_field_bit_message"] = absl::StrCat(GenerateSetBit(messageBitIndex), ";"); @@ -196,7 +188,7 @@ void ImmutableStringFieldLiteGenerator::GenerateMembers( variables_, "@java.lang.Override\n" "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n" - " return $get_has_field_bit_message$;\n" + " return $is_field_present_message$;\n" "}\n"); printer->Annotate("{", "}", descriptor_); } @@ -327,46 +319,6 @@ void ImmutableStringFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void ImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - WriteFieldDocComment(printer, descriptor_, context_->options(), - /* kdoc */ true); - printer->Emit( - { - {"jvm_name_get", - [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, - {"jvm_name_set", - [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, - }, - "$kt_deprecation$public var $kt_name$: kotlin.String\n" - " $jvm_name_get$" - " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" - " $jvm_name_set$" - " set(value) {\n" - " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" - " }\n"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$clear$kt_capitalized_name$$}$() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}\n"); - - if (descriptor_->has_presence()) { - WriteFieldAccessorDocComment(printer, descriptor_, HAZZER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); - } -} - void ImmutableStringFieldLiteGenerator::GenerateFieldInfo( io::Printer* printer, std::vector<uint16_t>* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); @@ -808,135 +760,6 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateBuilderMembers( printer->Annotate("{", "}", descriptor_, Semantic::kSet); } -void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( - io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - JvmNameContext name_ctx = {context_->options(), printer}; - printer->Print( - "/**\n" - " * An uninstantiable, behaviorless type to represent the field in\n" - " * generics.\n" - " */\n" - "@kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" - " : com.google.protobuf.kotlin.DslProxy()\n"); - - // property for List<String> - WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Print( - "$kt_deprecation$public 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$.${$$kt_property_name$List$}$\n" - " )\n"); - - // List<String>.add(String) - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}\n"); - - // List<String> += String - WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}\n"); - - // List<String>.addAll(Iterable<String>) - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}\n"); - - // List<String> += Iterable<String> - WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", - [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "@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" - "}\n"); - - // List<String>[Int] = String - WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "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" - "}"); - - WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, - context_->options(), - /* builder */ false, /* kdoc */ true); - printer->Emit( - { - {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, - }, - "$jvm_synthetic$" - "$jvm_name$" - "public fun com.google.protobuf.kotlin.DslList" - "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." - "clear() {\n" - " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" - "}"); -} - void RepeatedImmutableStringFieldLiteGenerator::GenerateFieldInfo( io::Printer* printer, std::vector<uint16_t>* output) const { WriteIntToUtf16CharSequence(descriptor_->number(), output); diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.h b/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.h index 59291869c0df4..2a83e88f5e84a 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/lite/string_field.h @@ -58,7 +58,6 @@ class ImmutableStringFieldLiteGenerator : public ImmutableFieldLiteGenerator { void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; @@ -107,7 +106,6 @@ class RepeatedImmutableStringFieldLiteGenerator void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, std::vector<uint16_t>* output) const override; - void GenerateKotlinDslMembers(io::Printer* printer) const override; std::string GetBoxedType() const override; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/message_serialization_unittest.proto b/third_party/protobuf/src/google/protobuf/compiler/java/message_serialization_unittest.proto index 33408e0300674..cafa4e9ad4012 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/message_serialization_unittest.proto +++ b/third_party/protobuf/src/google/protobuf/compiler/java/message_serialization_unittest.proto @@ -7,7 +7,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; option java_multiple_files = true; option java_package = ""; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.cc b/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.cc index 0446173e2a3d3..77d7482f53b6d 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.cc @@ -7,13 +7,18 @@ #include "google/protobuf/compiler/java/name_resolver.h" +#include <cstddef> #include <string> #include "absl/log/absl_check.h" #include "absl/strings/ascii.h" +#include "absl/strings/match.h" +#include "absl/strings/str_cat.h" #include "absl/strings/str_replace.h" -#include "absl/strings/substitute.h" +#include "absl/strings/string_view.h" +#include "google/protobuf/compiler/java/java_features.pb.h" #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/compiler/java/generator.h" #include "google/protobuf/compiler/java/helpers.h" #include "google/protobuf/compiler/java/names.h" #include "google/protobuf/descriptor.h" @@ -32,6 +37,15 @@ namespace { // conflicts with some other types defined in the file. const char* kOuterClassNameSuffix = "OuterClass"; +inline bool UseOldFileClassNameDefault(const FileDescriptor* file) { + // TODO b/373884685 - Clean up this check once when we have a way to query + // Java features in the C++ runtime. + if (JavaGenerator::GetEdition(*file) < EDITION_2024) return true; + return JavaGenerator::GetResolvedSourceFeatures(*file) + .GetExtension(pb::java) + .use_old_outer_classname_default(); +} + // Strip package name from a descriptor's full name. // For example: // Full name : foo.Bar.Baz @@ -128,11 +142,13 @@ std::string ClassNameResolver::GetFileDefaultImmutableClassName( std::string basename; std::string::size_type last_slash = file->name().find_last_of('/'); if (last_slash == std::string::npos) { - basename = file->name(); + basename = std::string(file->name()); } else { - basename = file->name().substr(last_slash + 1); + basename = std::string(file->name().substr(last_slash + 1)); } - return UnderscoresToCamelCase(StripProto(basename), true); + // foo_bar_baz.proto -> FooBarBaz + std::string ret = UnderscoresToCamelCase(StripProto(basename), true); + return UseOldFileClassNameDefault(file) ? ret : ret + "Proto"; } std::string ClassNameResolver::GetFileImmutableClassName( @@ -143,7 +159,11 @@ std::string ClassNameResolver::GetFileImmutableClassName( class_name = file->options().java_outer_classname(); } else { class_name = GetFileDefaultImmutableClassName(file); - if (HasConflictingClassName(file, class_name, + + // This disambiguation logic is deprecated and only enabled when using + // the old default scheme. + if (UseOldFileClassNameDefault(file) && + HasConflictingClassName(file, class_name, NameEquality::EXACT_EQUAL)) { class_name += kOuterClassNameSuffix; } diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.h b/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.h index b3b0b2eab8c3a..85b80177596a2 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver.h @@ -34,7 +34,7 @@ enum NameEquality { NO_MATCH, EXACT_EQUAL, EQUAL_IGNORE_CASE }; // Used to get the Java class related names for a given descriptor. It caches // the results to avoid redundant calculation across multiple name queries. // Thread-safety note: This class is *not* thread-safe. -class ClassNameResolver { +class PROTOC_EXPORT ClassNameResolver { public: explicit ClassNameResolver(const Options& options = {}) : options_(options) {} ~ClassNameResolver() = default; diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver_test.cc b/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver_test.cc new file mode 100644 index 0000000000000..8b73a3299e490 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/compiler/java/name_resolver_test.cc @@ -0,0 +1,282 @@ +#include "google/protobuf/compiler/java/name_resolver.h" + +#include <string> + +#include "google/protobuf/descriptor.pb.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include "absl/log/absl_check.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "google/protobuf/compiler/java/generator.h" +#include "google/protobuf/compiler/parser.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/io/tokenizer.h" +#include "google/protobuf/io/zero_copy_stream_impl_lite.h" + +// Must be last. +#include "google/protobuf/port_def.inc" + +namespace google { +namespace protobuf { +namespace compiler { +namespace java { +namespace { + +#define ASSERT_OK(x) ASSERT_TRUE(x.ok()) +#define PACKAGE_PREFIX "" + +class SimpleErrorCollector : public io::ErrorCollector { + public: + void RecordError(int line, int column, absl::string_view message) override { + last_error_ = absl::StrFormat("%d:%d:%s", line, column, message); + } + + const std::string& last_error() { return last_error_; } + + private: + std::string last_error_; +}; + +// Gets descriptors with protos built on the fly to go around the "redefinition +// error" with bazel in OSS. This also avoids using the descriptors generated +// from the C++ code generator for Java features; instead, we use a custom +// descriptor pool with feature set defaults built from JavaGenerator. +class NameResolverTest : public testing::Test { + protected: + void SetUp() override { + // Set the Java FeatureSet defaults from JavaGenerator. + JavaGenerator generator; + ASSERT_OK( + pool_.SetFeatureSetDefaults(*generator.BuildFeatureSetDefaults())); + + // Parse and build built-in protos. + BuildFileAndPopulatePool( + "google/protobuf/descriptor.proto", + google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); + } + + void BuildFileAndPopulatePool(absl::string_view filename, + absl::string_view contents) { + io::ArrayInputStream input_stream(contents.data(), contents.size()); + SimpleErrorCollector error_collector; + io::Tokenizer tokenizer(&input_stream, &error_collector); + compiler::Parser parser; + parser.RecordErrorsTo(&error_collector); + FileDescriptorProto proto; + ABSL_CHECK(parser.Parse(&tokenizer, &proto)) + << error_collector.last_error() << "\n" + << contents; + ABSL_CHECK_EQ("", error_collector.last_error()); + proto.set_name(filename); + pool_.BuildFile(proto); + } + + DescriptorPool pool_; +}; + +TEST_F(NameResolverTest, FileImmutableClassNameEdition2024) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2024"; + + package proto2_unittest; + + message TestFileName2024 { + int32 field = 1; + } + + // Conflicting names in edition 2024. + message FooProto { + int32 field = 1; + } + )schema"); + + ClassNameResolver resolver; + auto file = pool_.FindFileByName("foo.proto"); + EXPECT_EQ(resolver.GetFileDefaultImmutableClassName(file), "FooProto"); + EXPECT_EQ(resolver.GetFileImmutableClassName(file), "FooProto"); +} + +TEST_F(NameResolverTest, FileImmutableClassNameDefaultOverriddenEdition2024) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2024"; + + package proto2_unittest; + + option java_outer_classname = "BarBuz"; + + message FooProto { + int32 field = 1; + } + )schema"); + + ClassNameResolver resolver; + auto file = pool_.FindFileByName("foo.proto"); + EXPECT_EQ(resolver.GetFileDefaultImmutableClassName(file), "FooProto"); + EXPECT_EQ(resolver.GetFileImmutableClassName(file), "BarBuz"); +} + +TEST_F(NameResolverTest, FileImmutableClassNameEdition2023) { + BuildFileAndPopulatePool("conflicting_file_class_name.proto", + R"schema( + edition = "2023"; + + package proto2_unittest; + + message ConflictingFileClassName { + int32 field = 1; + } + )schema"); + + ClassNameResolver resolver; + auto file = pool_.FindFileByName("conflicting_file_class_name.proto"); + EXPECT_EQ(resolver.GetFileDefaultImmutableClassName(file), + "ConflictingFileClassName"); + EXPECT_EQ(resolver.GetFileImmutableClassName(file), + "ConflictingFileClassNameOuterClass"); +} + +TEST_F(NameResolverTest, MultipleFilesServiceEdition2023) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2023"; + + option java_generic_services = true; + option java_multiple_files = true; + + package proto2_unittest; + + message Dummy {} + service FooService { + rpc FooMethod(Dummy) returns (Dummy) {} + } + )schema"); + + auto service_descriptor = + pool_.FindServiceByName("proto2_unittest.FooService"); + ClassNameResolver resolver; + EXPECT_EQ(resolver.GetClassName(service_descriptor, /* immutable = */ true), + PACKAGE_PREFIX "proto2_unittest.FooService"); + EXPECT_EQ(resolver.GetJavaImmutableClassName(service_descriptor), + PACKAGE_PREFIX "proto2_unittest.FooService"); +} + +TEST_F(NameResolverTest, SingleFileServiceEdition2023) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2023"; + + option java_generic_services = true; + + package proto2_unittest; + + message Dummy {} + service FooService { + rpc FooMethod(Dummy) returns (Dummy) {} + } + )schema"); + + auto service_descriptor = + pool_.FindServiceByName("proto2_unittest.FooService"); + ClassNameResolver resolver; + EXPECT_EQ(resolver.GetClassName(service_descriptor, /* immutable = */ true), + PACKAGE_PREFIX "proto2_unittest.Foo.FooService"); + EXPECT_EQ(resolver.GetJavaImmutableClassName(service_descriptor), + PACKAGE_PREFIX "proto2_unittest.Foo$FooService"); +} + +TEST_F(NameResolverTest, MultipleFilesMessageEdition2023) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2023"; + + option java_multiple_files = true; + + package proto2_unittest; + + message FooMessage {} + )schema"); + + auto message_descriptor = + pool_.FindMessageTypeByName("proto2_unittest.FooMessage"); + ClassNameResolver resolver; + + EXPECT_EQ(resolver.GetClassName(message_descriptor, /* immutable = */ true), + PACKAGE_PREFIX "proto2_unittest.FooMessage"); + EXPECT_EQ(resolver.GetJavaImmutableClassName(message_descriptor), + PACKAGE_PREFIX "proto2_unittest.FooMessage"); +} + +TEST_F(NameResolverTest, SingleFileMessageEdition2023) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2023"; + + package proto2_unittest; + + message FooMessage {} + )schema"); + + auto message_descriptor = + pool_.FindMessageTypeByName("proto2_unittest.FooMessage"); + ClassNameResolver resolver; + + EXPECT_EQ(resolver.GetClassName(message_descriptor, /* immutable = */ true), + PACKAGE_PREFIX "proto2_unittest.Foo.FooMessage"); + EXPECT_EQ(resolver.GetJavaImmutableClassName(message_descriptor), + PACKAGE_PREFIX "proto2_unittest.Foo$FooMessage"); +} + +TEST_F(NameResolverTest, MultipleFilesEnumEdition2023) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2023"; + + package proto2_unittest; + + option java_multiple_files = true; + + enum FooEnum { + FOO_ENUM_UNSPECIFIED = 0; + } + )schema"); + + auto enum_descriptor = pool_.FindEnumTypeByName("proto2_unittest.FooEnum"); + ClassNameResolver resolver; + + EXPECT_EQ(resolver.GetClassName(enum_descriptor, /* immutable = */ true), + PACKAGE_PREFIX "proto2_unittest.FooEnum"); + EXPECT_EQ(resolver.GetJavaImmutableClassName(enum_descriptor), + PACKAGE_PREFIX "proto2_unittest.FooEnum"); +} + +TEST_F(NameResolverTest, SingleFileEnumEdition2023) { + BuildFileAndPopulatePool("foo.proto", + R"schema( + edition = "2023"; + + package proto2_unittest; + + enum FooEnum { + FOO_ENUM_UNSPECIFIED = 0; + } + )schema"); + + auto enum_descriptor = pool_.FindEnumTypeByName("proto2_unittest.FooEnum"); + ClassNameResolver resolver; + + EXPECT_EQ(resolver.GetClassName(enum_descriptor, /* immutable = */ true), + PACKAGE_PREFIX "proto2_unittest.Foo.FooEnum"); + EXPECT_EQ(resolver.GetJavaImmutableClassName(enum_descriptor), + PACKAGE_PREFIX "proto2_unittest.Foo$FooEnum"); +} + +} // namespace +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google + +#include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/names.cc b/third_party/protobuf/src/google/protobuf/compiler/java/names.cc index e1381c78ca201..745c9cc9735d7 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/names.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/names.cc @@ -86,9 +86,9 @@ std::string FieldName(const FieldDescriptor* field) { // of the group type. In Java, though, we would like to retain the original // capitalization of the type name. if (internal::cpp::IsGroupLike(*field)) { - field_name = field->message_type()->name(); + field_name = std::string(field->message_type()->name()); } else { - field_name = field->name(); + field_name = std::string(field->name()); } if (IsForbidden(field_name)) { // Append a trailing "#" to indicate that the name should be decorated to @@ -130,7 +130,7 @@ std::string FileJavaPackage(const FileDescriptor* file, bool immutable, result = DefaultPackage(options); if (!file->package().empty()) { if (!result.empty()) result += '.'; - result += file->package(); + absl::StrAppend(&result, file->package()); } } diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/names.h b/third_party/protobuf/src/google/protobuf/compiler/java/names.h index c2eb34cb37659..6d39ccf25e8ce 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/names.h +++ b/third_party/protobuf/src/google/protobuf/compiler/java/names.h @@ -41,87 +41,96 @@ namespace java { // // Returns: // The fully-qualified Java class name. -std::string ClassName(const Descriptor* descriptor); +PROTOC_EXPORT std::string ClassName(const Descriptor* descriptor); // Requires: // descriptor != NULL // // Returns: // The fully-qualified Java class name. -std::string ClassName(const EnumDescriptor* descriptor); +PROTOC_EXPORT std::string ClassName(const EnumDescriptor* descriptor); // Requires: // descriptor != NULL // // Returns: // The fully-qualified Java class name. -std::string ClassName(const FileDescriptor* descriptor); +PROTOC_EXPORT std::string ClassName(const FileDescriptor* descriptor); // Requires: // descriptor != NULL // // Returns: // The fully-qualified Java class name. -std::string ClassName(const ServiceDescriptor* descriptor); +PROTOC_EXPORT std::string ClassName(const ServiceDescriptor* descriptor); // Requires: // descriptor != NULL // // Returns: // Java package name. -std::string FileJavaPackage(const FileDescriptor* descriptor, - Options options = {}); +PROTOC_EXPORT std::string FileJavaPackage(const FileDescriptor* descriptor, + Options options = {}); // Requires: // descriptor != NULL // // Returns: // Java package directory. -std::string JavaPackageDirectory(const FileDescriptor* file); +PROTOC_EXPORT std::string JavaPackageDirectory(const FileDescriptor* file); // Requires: // descriptor != NULL // // Returns: // The unqualified Java class name. -std::string FileClassName(const FileDescriptor* file); +PROTOC_EXPORT std::string FileClassName(const FileDescriptor* file); // Requires: // descriptor != NULL // Returns: // Capitalized camel case field name. -std::string CapitalizedFieldName(const FieldDescriptor* field); +PROTOC_EXPORT std::string CapitalizedFieldName(const FieldDescriptor* field); // Requires: // descriptor != NULL // Returns: // Capitalized camel case oneof name. -std::string CapitalizedOneofName(const OneofDescriptor* oneof); +PROTOC_EXPORT std::string CapitalizedOneofName(const OneofDescriptor* oneof); // Returns: // Converts a name to camel-case. If cap_first_letter is true, capitalize the // first letter. -std::string UnderscoresToCamelCase(absl::string_view input, - bool cap_next_letter); +PROTOC_EXPORT std::string UnderscoresToCamelCase(absl::string_view input, + bool cap_next_letter); // Requires: // field != NULL // Returns: // Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes // "fooBarBaz" or "FooBarBaz", respectively. -std::string UnderscoresToCamelCase(const FieldDescriptor* field); +PROTOC_EXPORT std::string UnderscoresToCamelCase(const FieldDescriptor* field); // Requires: // method != NULL // Returns: // Similar, but for method names. (Typically, this merely has the effect // of lower-casing the first letter of the name.) -std::string UnderscoresToCamelCase(const MethodDescriptor* method); +PROTOC_EXPORT std::string UnderscoresToCamelCase( + const MethodDescriptor* method); // Requires: // field != NULL // Returns: // Same as UnderscoresToCamelCase, but checks for reserved keywords -std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field); +PROTOC_EXPORT std::string UnderscoresToCamelCaseCheckReserved( + const FieldDescriptor* field); + +// Requires: +// field != NULL +// Returns: +// Same as UnderscoresToCamelCase, but capitalizes the first letter +PROTOC_EXPORT std::string UnderscoresToCapitalizedCamelCase( + const FieldDescriptor* field); } // namespace java diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc index ddbdda5ac738f..619da6fb74c80 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/java/shared_code_generator.cc @@ -88,7 +88,7 @@ void SharedCodeGenerator::Generate( " /* This variable is to be called by generated code only. It " "returns\n" " * an incomplete descriptor for internal use only. */\n" - " public static com.google.protobuf.Descriptors.FileDescriptor\n" + " public static final com.google.protobuf.Descriptors.FileDescriptor\n" " descriptor;\n", "classname", classname); printer->Annotate("classname", file_->name()); diff --git a/third_party/protobuf/src/google/protobuf/compiler/kotlin/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/kotlin/BUILD.bazel index 5555adef0fa9e..3ae6340a59d18 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/kotlin/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/kotlin/BUILD.bazel @@ -1,7 +1,10 @@ +load("//build_defs:cpp_opts.bzl", "COPTS") + cc_library( name = "kotlin", srcs = ["generator.cc"], hdrs = ["generator.h"], + copts = COPTS, strip_include_prefix = "/src", visibility = [ "//pkg:__pkg__", @@ -15,20 +18,23 @@ cc_library( "//src/google/protobuf/compiler/java", "//src/google/protobuf/compiler/java:helpers", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) cc_library( name = "kotlin_internal", srcs = [ + "field.cc", "file.cc", "message.cc", ], hdrs = [ + "field.h", "file.h", "message.h", ], + copts = COPTS, strip_include_prefix = "/src", visibility = [ "//pkg:__pkg__", @@ -42,13 +48,15 @@ cc_library( "//src/google/protobuf/compiler/java", "//src/google/protobuf/compiler/java:generator_common", "//src/google/protobuf/compiler/java:helpers", + "//src/google/protobuf/compiler/java:internal_helpers", "//src/google/protobuf/compiler/java/full:fg", "//src/google/protobuf/compiler/java/full:mfg", "//src/google/protobuf/compiler/java/lite:field_generators", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/kotlin/field.cc b/third_party/protobuf/src/google/protobuf/compiler/kotlin/field.cc new file mode 100644 index 0000000000000..1f085d1219ac4 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/compiler/kotlin/field.cc @@ -0,0 +1,868 @@ +#include "google/protobuf/compiler/kotlin/field.h" + +#include <string> + +#include "absl/container/flat_hash_map.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" +#include "google/protobuf/compiler/java/context.h" +#include "google/protobuf/compiler/java/doc_comment.h" +#include "google/protobuf/compiler/java/field_common.h" +#include "google/protobuf/compiler/java/helpers.h" +#include "google/protobuf/compiler/java/internal_helpers.h" +#include "google/protobuf/compiler/java/name_resolver.h" +#include "google/protobuf/descriptor.h" + +namespace google { +namespace protobuf { +namespace compiler { +namespace kotlin { + +FieldGenerator::FieldGenerator(const FieldDescriptor* descriptor, + java::Context* context, bool lite) + : descriptor_(descriptor), context_(context), lite_(lite) { + java::SetCommonFieldVariables( + descriptor, context->GetFieldGeneratorInfo(descriptor), &variables_); + variables_.insert( + {"kt_deprecation", + descriptor->options().deprecated() + ? absl::StrCat("@kotlin.Deprecated(message = \"Field ", + variables_["name"], " is deprecated\") ") + : ""}); +} + +void FieldGenerator::Generate(io::Printer* printer) const { + auto cleanup = printer->WithVars(variables_); + switch (java::GetJavaType(descriptor_)) { + case java::JAVATYPE_MESSAGE: + if (descriptor_->is_repeated() && + java::IsMapEntry(descriptor_->message_type())) { + GenerateMapField(printer); + } else { + GenerateMessageField(printer); + } + break; + case java::JAVATYPE_STRING: + GenerateStringField(printer); + break; + case java::JAVATYPE_ENUM: + GenerateEnumField(printer); + break; + default: + GeneratePritimiveField(printer); + break; + } +} + +void FieldGenerator::GeneratePritimiveField(io::Printer* printer) const { + java::JavaType javaType = java::GetJavaType(descriptor_); + auto cleanup = printer->WithVars( + {{"kt_type", std::string(java::KotlinTypeName(javaType))}}); + + if (descriptor_->is_repeated()) { + GenerateRepeatedPritimiveField(printer); + return; + } + + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + java::WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + if (descriptor_->name() == "is_initialized") { + printer->Emit( + { + {"jvm_name_get", + [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, + {"jvm_name_set", + [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, + }, + "// TODO: b/336400327 - remove this hack; we should access properties\n" + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " $jvm_name_get$" + " get() = $kt_dsl_builder$.get${$$kt_capitalized_name$$}$()\n" + " $jvm_name_set$" + " set(value) {\n" + " $kt_dsl_builder$.${$set$kt_capitalized_name$$}$(value)\n" + " }\n"); + } else { + printer->Emit( + { + {"jvm_name_get", + [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, + {"jvm_name_set", + [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, + }, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " $jvm_name_get$" + " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" + " $jvm_name_set$" + " set(value) {\n" + " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" + " }\n"); + } + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), /* kdoc */ true); + printer->Print( + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (descriptor_->has_presence()) { + WriteFieldAccessorDocComment(printer, descriptor_, java::HAZZER, + context_->options(), /* kdoc */ true); + printer->Print( + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + +void FieldGenerator::GenerateRepeatedPritimiveField( + io::Printer* printer) const { + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + printer->Print( + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Print( + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + "$ jvm_synthetic$" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_INDEXED_SETTER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + +void FieldGenerator::GenerateMessageField(io::Printer* printer) const { + auto name_resolver = context_->GetNameResolver(); + auto cleanup = printer->WithVars( + {{"kt_type", + java::EscapeKotlinKeywords(name_resolver->GetImmutableClassName( + descriptor_->message_type()))}}); + + if (descriptor_->is_repeated()) { + GenerateRepeatedMessageField(printer); + return; + } + + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name_get", + [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, + {"jvm_name_set", + [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, + }, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " $jvm_name_get$" + " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" + " $jvm_name_set$" + " set(value) {\n" + " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), /* kdoc */ true); + printer->Print( + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::HAZZER, + context_->options(), /* kdoc */ true); + printer->Print( + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + if (descriptor_->has_presence() && + descriptor_->real_containing_oneof() == nullptr) { + printer->Print( + "$kt_deprecation$\n" + "public val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n" + " get() = $kt_dsl_builder$.$name$OrNull\n"); + } +} + +void FieldGenerator::GenerateRepeatedMessageField(io::Printer* printer) const { + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + printer->Print( + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Print( + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + "$ jvm_synthetic$" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_INDEXED_SETTER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, + }, + + "$jvm_synthetic$" + "$jvm_name$" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); +} + +void FieldGenerator::GenerateStringField(io::Printer* printer) const { + if (descriptor_->is_repeated()) { + GenerateRepeatedStringField(printer); + return; + } + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name_get", + [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, + {"jvm_name_set", + [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, + }, + "$kt_deprecation$public var $kt_name$: kotlin.String\n" + " $jvm_name_get$" + " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" + " $jvm_name_set$" + " set(value) {\n" + " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" + " }\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), /* kdoc */ true); + printer->Print( + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (descriptor_->has_presence()) { + WriteFieldAccessorDocComment(printer, descriptor_, java::HAZZER, + context_->options(), /* kdoc */ true); + printer->Print( + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + +void FieldGenerator::GenerateRepeatedStringField(io::Printer* printer) const { + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + printer->Print( + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + // property for List<String> + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_GETTER, + context_->options(), /* kdoc */ true); + printer->Print( + "$kt_deprecation$public 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$.${$$kt_property_name$List$}$\n" + " )\n"); + + // List<String>.add(String) + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}\n"); + + // List<String> += String + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}\n"); + + // List<String>.addAll(Iterable<String>) + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}\n"); + + // List<String> += Iterable<String> + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}\n"); + + // List<String>[Int] = String + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_INDEXED_SETTER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "public fun com.google.protobuf.kotlin.DslList" + "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + +void FieldGenerator::GenerateEnumField(io::Printer* printer) const { + auto name_resolver = context_->GetNameResolver(); + auto cleanup = printer->WithVars( + {{"kt_type", + java::EscapeKotlinKeywords( + name_resolver->GetImmutableClassName(descriptor_->enum_type()))}}); + + if (descriptor_->is_repeated()) { + GenerateRepeatedEnumField(printer); + return; + } + + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name_get", + [&] { JvmName("${$get$kt_capitalized_name$$}$", name_ctx); }}, + {"jvm_name_set", + [&] { JvmName("${$set$kt_capitalized_name$$}$", name_ctx); }}, + }, + "$kt_deprecation$public var $kt_name$: $kt_type$\n" + " $jvm_name_get$" + " get() = $kt_dsl_builder$.${$$kt_safe_name$$}$\n" + " $jvm_name_set$" + " set(value) {\n" + " $kt_dsl_builder$.${$$kt_safe_name$$}$ = value\n" + " }\n"); + + if (java::SupportUnknownEnumValue(descriptor_)) { + printer->Emit( + { + {"jvm_name_get", + [&] { JvmName("${$get$kt_capitalized_name$Value$}$", name_ctx); }}, + {"jvm_name_set", + [&] { JvmName("${$set$kt_capitalized_name$Value$}$", name_ctx); }}, + }, + "$kt_deprecation$public var $kt_name$Value: kotlin.Int\n" + " $jvm_name_get$" + " get() = $kt_dsl_builder$.${$$kt_property_name$Value$}$\n" + " $jvm_name_set$" + " set(value) {\n" + " $kt_dsl_builder$.${$$kt_property_name$Value$}$ = value\n" + " }\n"); + } + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), + /* kdoc */ true); + printer->Print( + "public fun ${$clear$kt_capitalized_name$$}$() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}\n"); + + if (descriptor_->has_presence()) { + WriteFieldAccessorDocComment(printer, descriptor_, java::HAZZER, + context_->options(), + /* kdoc */ true); + printer->Print( + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); + } +} + +void FieldGenerator::GenerateRepeatedEnumField(io::Printer* printer) const { + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + printer->Print( + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Print( + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + "$ jvm_synthetic$" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$$kt_property_name$List$}$\n" + " )\n"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("add$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssign$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("addAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_MULTI_ADDER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("plusAssignAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::LIST_INDEXED_SETTER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + "}"); + + WriteFieldAccessorDocComment(printer, descriptor_, java::CLEARER, + context_->options(), /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "public fun com.google.protobuf.kotlin.DslList" + "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." + "clear() {\n" + " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" + "}"); +} + +namespace { +std::string KotlinTypeName(const FieldDescriptor* field, + java::ClassNameResolver* name_resolver) { + if (java::GetJavaType(field) == java::JAVATYPE_MESSAGE) { + return name_resolver->GetImmutableClassName(field->message_type()); + } else if (java::GetJavaType(field) == java::JAVATYPE_ENUM) { + return name_resolver->GetImmutableClassName(field->enum_type()); + } else { + return std::string(java::KotlinTypeName(java::GetJavaType(field))); + } +} +} // namespace + +void FieldGenerator::GenerateMapField(io::Printer* printer) const { + auto name_resolver = context_->GetNameResolver(); + const FieldDescriptor* key = java::MapKeyField(descriptor_); + const FieldDescriptor* value = java::MapValueField(descriptor_); + auto cleanup = printer->WithVars( + {{"kt_key_type", KotlinTypeName(key, name_resolver)}, + {"kt_value_type", KotlinTypeName(value, name_resolver)}}); + + java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; + printer->Print( + "/**\n" + " * An uninstantiable, behaviorless type to represent the field in\n" + " * generics.\n" + " */\n" + "@kotlin.OptIn" + "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + " : com.google.protobuf.kotlin.DslProxy()\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("get$kt_capitalized_name$Map", name_ctx); }}, + }, + "$kt_deprecation$ public val $kt_name$: " + "com.google.protobuf.kotlin.DslMap" + "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" + "$ jvm_synthetic$" + "$jvm_name$" + " get() = com.google.protobuf.kotlin.DslMap(\n" + " $kt_dsl_builder$.${$$kt_property_name$Map$}$\n" + " )\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("put$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_name$" + "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" + " }\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name", [&] { JvmName("set$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "@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" + " }\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("remove$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + " }\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("putAll$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + " $kt_dsl_builder$.${$putAll$capitalized_name$$}$(map)\n" + " }\n"); + + WriteFieldDocComment(printer, descriptor_, context_->options(), + /* kdoc */ true); + printer->Emit( + { + {"jvm_name", + [&] { JvmName("clear$kt_capitalized_name$", name_ctx); }}, + }, + "$jvm_synthetic$" + "$jvm_name$" + "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" + " }\n"); +} + +} // namespace kotlin +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/third_party/protobuf/src/google/protobuf/compiler/kotlin/field.h b/third_party/protobuf/src/google/protobuf/compiler/kotlin/field.h new file mode 100644 index 0000000000000..f9ce4cdfa336a --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/compiler/kotlin/field.h @@ -0,0 +1,50 @@ +#ifndef GOOGLE_PROTOBUF_COMPILER_KOTLIN_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_KOTLIN_FIELD_H__ + +#include <string> + +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "google/protobuf/compiler/java/context.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/io/printer.h" + +namespace google { +namespace protobuf { +namespace compiler { +namespace kotlin { + +class FieldGenerator { + public: + FieldGenerator(const FieldDescriptor* descriptor, java::Context* context, + bool lite); + FieldGenerator(const FieldGenerator&) = delete; + FieldGenerator& operator=(const FieldGenerator&) = delete; + ~FieldGenerator() = default; + + void Generate(io::Printer* printer) const; + + private: + const FieldDescriptor* descriptor_; + absl::flat_hash_map<absl::string_view, std::string> variables_; + java::Context* context_; + bool lite_; + + void GeneratePritimiveField(io::Printer* printer) const; + void GenerateMessageField(io::Printer* printer) const; + void GenerateMapField(io::Printer* printer) const; + void GenerateStringField(io::Printer* printer) const; + void GenerateEnumField(io::Printer* printer) const; + + void GenerateRepeatedPritimiveField(io::Printer* printer) const; + void GenerateRepeatedMessageField(io::Printer* printer) const; + void GenerateRepeatedStringField(io::Printer* printer) const; + void GenerateRepeatedEnumField(io::Printer* printer) const; +}; + +} // namespace kotlin +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_KOTLIN_FIELD_H__ diff --git a/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.cc b/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.cc index e64a0987e6e8f..9026dfaee17db 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.cc @@ -7,7 +7,9 @@ #include "google/protobuf/compiler/kotlin/message.h" +#include <memory> #include <string> +#include <utility> #include "absl/log/absl_check.h" #include "absl/strings/str_cat.h" @@ -16,11 +18,8 @@ #include "google/protobuf/compiler/java/field_common.h" #include "google/protobuf/compiler/java/generator_common.h" #include "google/protobuf/compiler/java/helpers.h" -#include "google/protobuf/compiler/java/full/field_generator.h" -#include "google/protobuf/compiler/java/full/make_field_gens.h" -#include "google/protobuf/compiler/java/lite/field_generator.h" -#include "google/protobuf/compiler/java/lite/make_field_gens.h" #include "google/protobuf/compiler/java/name_resolver.h" +#include "google/protobuf/compiler/kotlin/field.h" #include "google/protobuf/io/printer.h" // Must be last. @@ -39,36 +38,17 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor, lite_(!java::HasDescriptorMethods(descriptor_->file(), context->EnforceLite())), jvm_dsl_(!lite_ || context->options().jvm_dsl), - lite_field_generators_( - java::FieldGeneratorMap<java::ImmutableFieldLiteGenerator>( - descriptor_)), - field_generators_( - java::FieldGeneratorMap<java::ImmutableFieldGenerator>(descriptor_)) { + field_generators_(java::FieldGeneratorMap<FieldGenerator>(descriptor_)) { for (int i = 0; i < descriptor_->field_count(); i++) { if (java::IsRealOneof(descriptor_->field(i))) { const OneofDescriptor* oneof = descriptor_->field(i)->containing_oneof(); ABSL_CHECK(oneofs_.emplace(oneof->index(), oneof).first->second == oneof); } } - if (lite_) { - lite_field_generators_ = - java::MakeImmutableFieldLiteGenerators(descriptor_, context_); - } else { - field_generators_ = - java::MakeImmutableFieldGenerators(descriptor_, context_); - } -} - -void MessageGenerator::GenerateFieldMembers(io::Printer* printer) const { for (int i = 0; i < descriptor_->field_count(); i++) { - printer->Print("\n"); - if (lite_) { - lite_field_generators_.get(descriptor_->field(i)) - .GenerateKotlinDslMembers(printer); - } else { - field_generators_.get(descriptor_->field(i)) - .GenerateKotlinDslMembers(printer); - } + const FieldDescriptor* field = descriptor->field(i); + auto generator = std::make_unique<FieldGenerator>(field, context_, lite_); + field_generators_.Add(field, std::move(generator)); } } @@ -97,7 +77,10 @@ void MessageGenerator::Generate(io::Printer* printer) const { printer->Indent(); - GenerateFieldMembers(printer); + for (int i = 0; i < descriptor_->field_count(); i++) { + printer->Print("\n"); + field_generators_.get(descriptor_->field(i)).Generate(printer); + } for (auto& kv : oneofs_) { java::JvmNameContext name_ctx = {context_->options(), printer, lite_}; diff --git a/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.h b/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.h index 28bb428b721a4..9c10476618f52 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.h +++ b/third_party/protobuf/src/google/protobuf/compiler/kotlin/message.h @@ -11,9 +11,8 @@ #include "absl/container/btree_map.h" #include "google/protobuf/compiler/java/context.h" #include "google/protobuf/compiler/java/generator_common.h" -#include "google/protobuf/compiler/java/full/field_generator.h" -#include "google/protobuf/compiler/java/lite/field_generator.h" #include "google/protobuf/compiler/java/name_resolver.h" +#include "google/protobuf/compiler/kotlin/field.h" #include "google/protobuf/descriptor.h" namespace google { @@ -40,11 +39,7 @@ class MessageGenerator { bool lite_; bool jvm_dsl_; - // TODO: b/366047913 - These can be simplified once lite and full field - // generators are unified. - java::FieldGeneratorMap<java::ImmutableFieldLiteGenerator> - lite_field_generators_; - java::FieldGeneratorMap<java::ImmutableFieldGenerator> field_generators_; + java::FieldGeneratorMap<FieldGenerator> field_generators_; void GenerateExtensions(io::Printer* printer) const; void GenerateOrNull(io::Printer* printer) const; diff --git a/third_party/protobuf/src/google/protobuf/compiler/mock_code_generator.h b/third_party/protobuf/src/google/protobuf/compiler/mock_code_generator.h index 0e40b17df1fe3..6cf95dece87c1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/mock_code_generator.h +++ b/third_party/protobuf/src/google/protobuf/compiler/mock_code_generator.h @@ -119,8 +119,8 @@ class MockCodeGenerator : public CodeGenerator { private: std::string name_; uint64_t suppressed_features_ = 0; - mutable Edition minimum_edition_ = MinimumAllowedEdition(); - mutable Edition maximum_edition_ = MaximumAllowedEdition(); + mutable Edition minimum_edition_ = ProtocMinimumEdition(); + mutable Edition maximum_edition_ = ProtocMaximumEdition(); std::vector<const FieldDescriptor*> feature_extensions_ = { GetExtensionReflection(pb::test)}; diff --git a/third_party/protobuf/src/google/protobuf/compiler/notices.h b/third_party/protobuf/src/google/protobuf/compiler/notices.h new file mode 100644 index 0000000000000..a37ae10ee8e24 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/compiler/notices.h @@ -0,0 +1,242 @@ +#ifndef GOOGLE_PROTOBUF_COMPILER_NOTICES_H__ +#define GOOGLE_PROTOBUF_COMPILER_NOTICES_H__ + +const char* notices_text = R"(Protoc uses the following open source libraries: + +Abseil +Apache 2.0 + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. +============================================================================= +utf8_range +MIT License + +Copyright (c) 2019 Yibo Cai +Copyright 2022 Google LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +============================================================================= +zlib + +Copyright notice: + + (C) 1995-2024 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu +============================================================================= +rules_cc + +Copyright 2024 The Bazel Authors. +Apache License 2.0 +============================================================================= +Bazel + +Copyright 2014 The Bazel Authors. +Apache License 2.0)"; + +#endif // GOOGLE_PROTOBUF_COMPILER_NOTICES_H__ diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/objectivec/BUILD.bazel index dbc714c84b888..b74a135a5623c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/BUILD.bazel @@ -34,10 +34,10 @@ cc_library( "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -53,7 +53,7 @@ cc_library( "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/io", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -108,13 +108,13 @@ cc_library( "//src/google/protobuf/io:printer", "//src/google/protobuf/io:tokenizer", "//src/google/protobuf/stubs", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", ], ) @@ -125,10 +125,10 @@ cc_test( ":line_consumer", "//src/google/protobuf/io", "//src/google/protobuf/stubs", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -138,8 +138,8 @@ cc_test( deps = [ ":names", "//src/google/protobuf/io", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -149,8 +149,8 @@ cc_test( deps = [ ":objectivec", "//src/google/protobuf:port", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum.cc index 1c4b86f657e5c..c8bfcbc3dfe74 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum.cc @@ -170,7 +170,7 @@ void EnumGenerator::GenerateSource(io::Printer* printer) const { text_blob += short_name + '\0'; if (UnCamelCaseEnumShortName(short_name) != v->name()) { text_format_decode_data.AddString(enum_value_description_key, short_name, - std::string(v->name())); + v->name()); } } diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum_field.cc index a51bcb3978641..0de12e14a29d0 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/enum_field.cc @@ -10,11 +10,11 @@ #include <string> #include "absl/container/btree_set.h" -#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "google/protobuf/compiler/objectivec/field.h" +#include "google/protobuf/compiler/objectivec/helpers.h" #include "google/protobuf/compiler/objectivec/names.h" #include "google/protobuf/compiler/objectivec/options.h" #include "google/protobuf/descriptor.h" @@ -27,13 +27,12 @@ namespace objectivec { namespace { -void SetEnumVariables( - const FieldDescriptor* descriptor, - const GenerationOptions& generation_options, - absl::flat_hash_map<absl::string_view, std::string>* variables) { +void SetEnumVariables(const FieldDescriptor* descriptor, + const GenerationOptions& generation_options, + SubstitutionMap& variables) { const std::string type = EnumName(descriptor->enum_type()); const std::string enum_desc_func = absl::StrCat(type, "_EnumDescriptor"); - (*variables)["enum_name"] = type; + variables.Set("enum_name", type); // When using fwd decls, for non repeated fields, if it was defined in a // different file, the property decls need to use "enum NAME" rather than just // "NAME" to support the forward declaration of the enums. @@ -41,16 +40,16 @@ void SetEnumVariables( !descriptor->is_repeated() && !IsProtobufLibraryBundledProtoFile(descriptor->enum_type()->file()) && (descriptor->file() != descriptor->enum_type()->file())) { - (*variables)["property_type"] = absl::StrCat("enum ", type, " "); + variables.Set("property_type", absl::StrCat("enum ", type, " ")); } - (*variables)["enum_verifier"] = absl::StrCat(type, "_IsValidValue"); - (*variables)["enum_desc_func"] = enum_desc_func; + variables.Set("enum_verifier", absl::StrCat(type, "_IsValidValue")); + variables.Set("enum_desc_func", enum_desc_func); - (*variables)["dataTypeSpecific_name"] = "enumDescFunc"; - (*variables)["dataTypeSpecific_value"] = enum_desc_func; + variables.Set("dataTypeSpecific_name", "enumDescFunc"); + variables.Set("dataTypeSpecific_value", enum_desc_func); const Descriptor* msg_descriptor = descriptor->containing_type(); - (*variables)["owning_message_class"] = ClassName(msg_descriptor); + variables.Set("owning_message_class", ClassName(msg_descriptor)); } } // namespace @@ -58,7 +57,7 @@ EnumFieldGenerator::EnumFieldGenerator( const FieldDescriptor* descriptor, const GenerationOptions& generation_options) : SingleFieldGenerator(descriptor, generation_options) { - SetEnumVariables(descriptor, generation_options, &variables_); + SetEnumVariables(descriptor, generation_options, variables_); } void EnumFieldGenerator::GenerateCFunctionDeclarations( @@ -67,7 +66,7 @@ void EnumFieldGenerator::GenerateCFunctionDeclarations( return; } - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit(R"objc( /** * Fetches the raw value of a @c $owning_message_class$'s @c $name$ property, even @@ -90,7 +89,7 @@ void EnumFieldGenerator::GenerateCFunctionImplementations( return; } - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit(R"objc( int32_t $owning_message_class$_$capitalized_name$_RawValue($owning_message_class$ *message) { GPBDescriptor *descriptor = [$owning_message_class$ descriptor]; @@ -134,11 +133,11 @@ RepeatedEnumFieldGenerator::RepeatedEnumFieldGenerator( const FieldDescriptor* descriptor, const GenerationOptions& generation_options) : RepeatedFieldGenerator(descriptor, generation_options) { - SetEnumVariables(descriptor, generation_options, &variables_); + SetEnumVariables(descriptor, generation_options, variables_); } void RepeatedEnumFieldGenerator::EmitArrayComment(io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit(R"objc( // |$name$| contains |$enum_name$| )objc"); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.cc index f72b6a99bb2ac..8c33b21871aa3 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.cc @@ -12,7 +12,6 @@ #include <vector> #include "absl/container/btree_set.h" -#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" @@ -34,43 +33,49 @@ namespace compiler { namespace objectivec { namespace { +using Sub = ::google::protobuf::io::Printer::Sub; -void SetCommonFieldVariables( - const FieldDescriptor* descriptor, - absl::flat_hash_map<absl::string_view, std::string>* variables) { +void SetCommonFieldVariables(const FieldDescriptor* descriptor, + SubstitutionMap& variables) { std::string camel_case_name = FieldName(descriptor); - std::string raw_field_name; - if (internal::cpp::IsGroupLike(*descriptor)) { - raw_field_name = descriptor->message_type()->name(); - } else { - raw_field_name = descriptor->name(); - } + std::string raw_field_name(internal::cpp::IsGroupLike(*descriptor) + ? descriptor->message_type()->name() + : descriptor->name()); // The logic here has to match -[GGPBFieldDescriptor textFormatName]. const std::string un_camel_case_name( UnCamelCaseFieldName(camel_case_name, descriptor)); const bool needs_custom_name = (raw_field_name != un_camel_case_name); - const std::string& classname = ClassName(descriptor->containing_type()); - (*variables)["classname"] = classname; - (*variables)["name"] = camel_case_name; - const std::string& capitalized_name = FieldNameCapitalized(descriptor); - (*variables)["capitalized_name"] = capitalized_name; - (*variables)["raw_field_name"] = raw_field_name; - (*variables)["field_number_name"] = - absl::StrCat(classname, "_FieldNumber_", capitalized_name); - (*variables)["field_number"] = absl::StrCat(descriptor->number()); - (*variables)["property_type"] = FieldObjCType( - descriptor, static_cast<FieldObjCTypeOptions>( - kFieldObjCTypeOptions_IncludeSpaceAfterBasicTypes | - kFieldObjCTypeOptions_IncludeSpaceBeforeStar)); - (*variables)["storage_type"] = FieldObjCType( - descriptor, static_cast<FieldObjCTypeOptions>( - kFieldObjCTypeOptions_IncludeSpaceAfterBasicTypes | - kFieldObjCTypeOptions_OmitLightweightGenerics | - kFieldObjCTypeOptions_IncludeSpaceBeforeStar)); - (*variables)["field_type"] = GetCapitalizedType(descriptor); - (*variables)["deprecated_attribute"] = - GetOptionalDeprecatedAttribute(descriptor); + const std::string classname = ClassName(descriptor->containing_type()); + variables.Set(Sub("classname", classname).AnnotatedAs(descriptor)); + variables.Set(Sub("name", camel_case_name).AnnotatedAs(descriptor)); + + const std::string capitalized_name = FieldNameCapitalized(descriptor); + variables.Set( + Sub("hazzer_name", "has" + capitalized_name).AnnotatedAs(descriptor)); + variables.Set( + Sub("capitalized_name", capitalized_name).AnnotatedAs(descriptor)); + variables.Set("raw_field_name", raw_field_name); + variables.Set(Sub("field_number_name", + absl::StrCat(classname, "_FieldNumber_", capitalized_name)) + .AnnotatedAs(descriptor)); + variables.Set("field_number", absl::StrCat(descriptor->number())); + variables.Set( + "property_type", + FieldObjCType(descriptor, + static_cast<FieldObjCTypeOptions>( + kFieldObjCTypeOptions_IncludeSpaceAfterBasicTypes | + kFieldObjCTypeOptions_IncludeSpaceBeforeStar))); + variables.Set( + "storage_type", + FieldObjCType(descriptor, + static_cast<FieldObjCTypeOptions>( + kFieldObjCTypeOptions_IncludeSpaceAfterBasicTypes | + kFieldObjCTypeOptions_OmitLightweightGenerics | + kFieldObjCTypeOptions_IncludeSpaceBeforeStar))); + variables.Set("field_type", GetCapitalizedType(descriptor)); + variables.Set("deprecated_attribute", + GetOptionalDeprecatedAttribute(descriptor)); std::vector<std::string> field_flags; if (descriptor->is_repeated()) field_flags.push_back("GPBFieldRepeated"); if (descriptor->is_required()) field_flags.push_back("GPBFieldRequired"); @@ -96,20 +101,21 @@ void SetCommonFieldVariables( field_flags.push_back("GPBFieldClearHasIvarOnZero"); } - (*variables)["fieldflags"] = BuildFlagsString(FLAGTYPE_FIELD, field_flags); + variables.Set("fieldflags", BuildFlagsString(FLAGTYPE_FIELD, field_flags)); - (*variables)["default"] = DefaultValue(descriptor); - (*variables)["default_name"] = GPBGenericValueFieldName(descriptor); + variables.Set("default", DefaultValue(descriptor)); + variables.Set("default_name", GPBGenericValueFieldName(descriptor)); - (*variables)["dataTypeSpecific_name"] = "clazz"; - (*variables)["dataTypeSpecific_value"] = "Nil"; + variables.Set("dataTypeSpecific_name", "clazz"); + variables.Set("dataTypeSpecific_value", "Nil"); - (*variables)["storage_offset_value"] = absl::StrCat( - "(uint32_t)offsetof(", classname, "__storage_, ", camel_case_name, ")"); - (*variables)["storage_offset_comment"] = ""; + variables.Set("storage_offset_value", + absl::StrCat("(uint32_t)offsetof(", classname, "__storage_, ", + camel_case_name, ")")); + variables.Set("storage_offset_comment", ""); // Clear some common things so they can be set just when needed. - (*variables)["storage_attribute"] = ""; + variables.Set("storage_attribute", ""); } bool HasNonZeroDefaultValue(const FieldDescriptor* field) { @@ -192,11 +198,11 @@ FieldGenerator* FieldGenerator::Make( FieldGenerator::FieldGenerator(const FieldDescriptor* descriptor, const GenerationOptions& generation_options) : descriptor_(descriptor), generation_options_(generation_options) { - SetCommonFieldVariables(descriptor, &variables_); + SetCommonFieldVariables(descriptor, variables_); } void FieldGenerator::GenerateFieldNumberConstant(io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit("$field_number_name$ = $field_number$,\n"); } @@ -228,7 +234,7 @@ void FieldGenerator::DetermineNeededFiles( void FieldGenerator::GenerateFieldDescription(io::Printer* printer, bool include_default) const { // Printed in the same order as the structure decl. - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit( {{"prefix", include_default ? ".core" : ""}, {"maybe_default", @@ -252,10 +258,12 @@ void FieldGenerator::GenerateFieldDescription(io::Printer* printer, } void FieldGenerator::SetRuntimeHasBit(int has_index) { - variables_["has_index"] = absl::StrCat(has_index); + variables_.Set("has_index", has_index); } -void FieldGenerator::SetNoHasBit() { variables_["has_index"] = "GPBNoHasBit"; } +void FieldGenerator::SetNoHasBit() { + variables_.Set("has_index", "GPBNoHasBit"); +} int FieldGenerator::ExtraRuntimeHasBitsNeeded() const { return 0; } @@ -269,7 +277,7 @@ void FieldGenerator::SetOneofIndexBase(int index_base) { if (oneof != nullptr) { int index = oneof->index() + index_base; // Flip the sign to mark it as a oneof. - variables_["has_index"] = absl::StrCat(-index); + variables_.Set("has_index", -index); } } @@ -286,13 +294,13 @@ SingleFieldGenerator::SingleFieldGenerator( void SingleFieldGenerator::GenerateFieldStorageDeclaration( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit("$storage_type$$name$;\n"); } void SingleFieldGenerator::GeneratePropertyDeclaration( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit({{"comments", [&] { EmitCommentsString(printer, generation_options_, @@ -304,7 +312,7 @@ void SingleFieldGenerator::GeneratePropertyDeclaration( )objc"); if (WantsHasProperty()) { printer->Emit(R"objc( - @property(nonatomic, readwrite) BOOL has$capitalized_name$$ deprecated_attribute$; + @property(nonatomic, readwrite) BOOL $hazzer_name$$ deprecated_attribute$; )objc"); } printer->Emit("\n"); @@ -312,9 +320,9 @@ void SingleFieldGenerator::GeneratePropertyDeclaration( void SingleFieldGenerator::GeneratePropertyImplementation( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); if (WantsHasProperty()) { - printer->Emit("@dynamic has$capitalized_name$, $name$;\n"); + printer->Emit("@dynamic $hazzer_name$, $name$;\n"); } else { printer->Emit("@dynamic $name$;\n"); } @@ -332,15 +340,15 @@ ObjCObjFieldGenerator::ObjCObjFieldGenerator( const FieldDescriptor* descriptor, const GenerationOptions& generation_options) : SingleFieldGenerator(descriptor, generation_options) { - variables_["property_storage_attribute"] = "strong"; - if (IsRetainedName(variables_["name"])) { - variables_["storage_attribute"] = " NS_RETURNS_NOT_RETAINED"; + variables_.Set("property_storage_attribute", "strong"); + if (IsRetainedName(variable("name"))) { + variables_.Set("storage_attribute", " NS_RETURNS_NOT_RETAINED"); } } void ObjCObjFieldGenerator::GenerateFieldStorageDeclaration( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit("$storage_type$$name$;\n"); } @@ -350,7 +358,7 @@ void ObjCObjFieldGenerator::GeneratePropertyDeclaration( // it uses pointers and deals with Objective-C's rules around storage name // conventions (init*, new*, etc.) - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit({{"comments", [&] { EmitCommentsString(printer, generation_options_, @@ -363,10 +371,10 @@ void ObjCObjFieldGenerator::GeneratePropertyDeclaration( if (WantsHasProperty()) { printer->Emit(R"objc( /** Test to see if @c $name$ has been set. */ - @property(nonatomic, readwrite) BOOL has$capitalized_name$$ deprecated_attribute$; + @property(nonatomic, readwrite) BOOL $hazzer_name$$ deprecated_attribute$; )objc"); } - if (IsInitName(variables_.find("name")->second)) { + if (IsInitName(variable("name"))) { // If property name starts with init we need to annotate it to get past ARC. // http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227 printer->Emit(R"objc( @@ -383,13 +391,13 @@ RepeatedFieldGenerator::RepeatedFieldGenerator( void RepeatedFieldGenerator::GenerateFieldStorageDeclaration( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit("$storage_type$$name$;\n"); } void RepeatedFieldGenerator::GeneratePropertyImplementation( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit("@dynamic $name$, $name$_Count;\n"); } @@ -401,7 +409,7 @@ void RepeatedFieldGenerator::GeneratePropertyDeclaration( // dealing with needing Objective-C's rules around storage name conventions // (init*, new*, etc.) - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit( {{"comments", [&] { EmitCommentsString(printer, generation_options_, descriptor_); }}, @@ -413,7 +421,7 @@ void RepeatedFieldGenerator::GeneratePropertyDeclaration( /** The number of items in @c $name$ without causing the container to be created. */ @property(nonatomic, readonly) NSUInteger $name$_Count$ deprecated_attribute$; )objc"); - if (IsInitName(variables_.find("name")->second)) { + if (IsInitName(variable("name"))) { // If property name starts with init we need to annotate it to get past ARC. // http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227 printer->Emit(R"objc( @@ -436,7 +444,7 @@ FieldGeneratorMap::FieldGeneratorMap( : descriptor_(descriptor), field_generators_(static_cast<size_t>(descriptor->field_count())) { for (int i = 0; i < descriptor->field_count(); i++) { - field_generators_[i].reset( + field_generators_[(size_t)i].reset( FieldGenerator::Make(descriptor->field(i), generation_options)); } } @@ -444,21 +452,21 @@ FieldGeneratorMap::FieldGeneratorMap( const FieldGenerator& FieldGeneratorMap::get( const FieldDescriptor* field) const { ABSL_CHECK_EQ(field->containing_type(), descriptor_); - return *field_generators_[field->index()]; + return *field_generators_[(size_t)field->index()]; } int FieldGeneratorMap::CalculateHasBits() { int total_bits = 0; for (int i = 0; i < descriptor_->field_count(); i++) { - if (field_generators_[i]->RuntimeUsesHasBit()) { - field_generators_[i]->SetRuntimeHasBit(total_bits); + if (field_generators_[(size_t)i]->RuntimeUsesHasBit()) { + field_generators_[(size_t)i]->SetRuntimeHasBit(total_bits); ++total_bits; } else { - field_generators_[i]->SetNoHasBit(); + field_generators_[(size_t)i]->SetNoHasBit(); } - int extra_bits = field_generators_[i]->ExtraRuntimeHasBitsNeeded(); + int extra_bits = field_generators_[(size_t)i]->ExtraRuntimeHasBitsNeeded(); if (extra_bits) { - field_generators_[i]->SetExtraRuntimeHasBitsBase(total_bits); + field_generators_[(size_t)i]->SetExtraRuntimeHasBitsBase(total_bits); total_bits += extra_bits; } } @@ -467,7 +475,7 @@ int FieldGeneratorMap::CalculateHasBits() { void FieldGeneratorMap::SetOneofIndexBase(int index_base) { for (int i = 0; i < descriptor_->field_count(); i++) { - field_generators_[i]->SetOneofIndexBase(index_base); + field_generators_[(size_t)i]->SetOneofIndexBase(index_base); } } diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.h index 06e08e1f0a04b..428384312f654 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/field.h @@ -13,10 +13,10 @@ #include <vector> #include "absl/container/btree_set.h" -#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/strings/match.h" #include "absl/strings/string_view.h" +#include "google/protobuf/compiler/objectivec/helpers.h" #include "google/protobuf/compiler/objectivec/options.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/io/printer.h" @@ -70,8 +70,8 @@ class FieldGenerator { virtual void SetExtraRuntimeHasBitsBase(int index_base); void SetOneofIndexBase(int index_base); - std::string variable(const char* key) const { - return variables_.find(key)->second; + std::string variable(absl::string_view key) const { + return variables_.Value(key); } bool needs_textformat_name_support() const { @@ -89,7 +89,7 @@ class FieldGenerator { const FieldDescriptor* descriptor_; const GenerationOptions& generation_options_; - absl::flat_hash_map<absl::string_view, std::string> variables_; + SubstitutionMap variables_; }; class SingleFieldGenerator : public FieldGenerator { diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.cc index 6020d415507c3..d768761b0cdd1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.cc @@ -303,7 +303,8 @@ FileGenerator::FileGenerator(Edition edition, const FileDescriptor* file, } } -void FileGenerator::GenerateHeader(io::Printer* p) const { +void FileGenerator::GenerateHeader(io::Printer* p, + absl::string_view info_path) const { GenerateFile(p, GeneratedFileType::kHeader, [&] { absl::btree_set<std::string> fwd_decls; for (const auto& generator : message_generators_) { @@ -321,6 +322,18 @@ void FileGenerator::GenerateHeader(io::Printer* p) const { p->Emit("NS_ASSUME_NONNULL_BEGIN\n\n"); + if (!info_path.empty()) { + p->Emit({{"info_path", info_path}, + {"guard", generation_options_.annotation_guard_name}, + {"pragma", generation_options_.annotation_pragma_name}}, + R"objc( + #ifdef $guard$ + #pragma $pragma$ "$info_path$" + #endif // $guard$ + )objc"); + p->Emit("\n"); + } + for (const auto& generator : enum_generators_) { generator->GenerateHeader(p); } @@ -459,7 +472,7 @@ void FileGenerator::GenerateSourceForEnums(io::Printer* p) const { }); } -void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* p) const { +void FileGenerator::GenerateSourceForMessage(size_t idx, io::Printer* p) const { ABSL_CHECK(!is_bundled_proto_) << "Bundled protos aren't expected to use multi source generation."; const auto& generator = message_generators_[idx]; diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.h index baef5a0a2d884..93c03bd7e7e47 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/file.h @@ -16,6 +16,7 @@ #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/strings/string_view.h" #include "google/protobuf/compiler/objectivec/enum.h" #include "google/protobuf/compiler/objectivec/extension.h" #include "google/protobuf/compiler/objectivec/message.h" @@ -63,14 +64,14 @@ class FileGenerator { FileGenerator(const FileGenerator&) = delete; FileGenerator& operator=(const FileGenerator&) = delete; - void GenerateHeader(io::Printer* p) const; + void GenerateHeader(io::Printer* p, absl::string_view info_path) const; void GenerateSource(io::Printer* p) const; - int NumEnums() const { return enum_generators_.size(); } - int NumMessages() const { return message_generators_.size(); } + size_t NumEnums() const { return enum_generators_.size(); } + size_t NumMessages() const { return message_generators_.size(); } void GenerateGlobalSource(io::Printer* p) const; - void GenerateSourceForMessage(int idx, io::Printer* p) const; + void GenerateSourceForMessage(size_t idx, io::Printer* p) const; void GenerateSourceForEnums(io::Printer* p) const; private: diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.cc index ded47b82587d4..ea4a7166cd740 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.cc @@ -64,8 +64,6 @@ std::string NumberedObjCMFileName(absl::string_view basename, int number) { } // namespace -bool ObjectiveCGenerator::HasGenerateAll() const { return true; } - bool ObjectiveCGenerator::Generate(const FileDescriptor* file, const std::string& parameter, GeneratorContext* context, @@ -296,6 +294,10 @@ bool ObjectiveCGenerator::GenerateAll( options[i].second); return false; } + } else if (options[i].first == "annotation_pragma_name") { + generation_options.annotation_pragma_name = options[i].second; + } else if (options[i].first == "annotation_guard_name") { + generation_options.annotation_guard_name = options[i].second; } else { *error = absl::StrCat("error: Unknown generator option: ", options[i].first); @@ -386,6 +388,19 @@ bool ObjectiveCGenerator::GenerateAll( // ----------------------------------------------------------------- + if (generation_options.annotation_guard_name.empty() != + generation_options.annotation_pragma_name.empty()) { + *error = + "error: both annotation_guard_name and annotation_pragma_name must " + "be set to output annotations"; + return false; + } + bool should_annotate_headers = + !generation_options.annotation_pragma_name.empty() && + !generation_options.annotation_guard_name.empty(); + + // ----------------------------------------------------------------- + // Validate the objc prefix/package pairings. if (!ValidateObjCClassPrefixes(files, validation_options, error)) { // *error will have been filled in. @@ -402,13 +417,31 @@ bool ObjectiveCGenerator::GenerateAll( { auto output = absl::WrapUnique(context->Open(absl::StrCat(filepath, ".pbobjc.h"))); - io::Printer printer(output.get()); - file_generator.GenerateHeader(&printer); + GeneratedCodeInfo annotations; + io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector( + &annotations); + io::Printer::Options options; + std::string info_path = ""; + if (should_annotate_headers) { + info_path = absl::StrCat(filepath, ".pbobjc.h.meta"); + options.annotation_collector = &annotation_collector; + } + io::Printer printer(output.get(), options); + file_generator.GenerateHeader(&printer, info_path); if (printer.failed()) { *error = absl::StrCat("error: internal error generating a header: ", file->name()); return false; } + + if (should_annotate_headers) { + auto info_output = absl::WrapUnique(context->Open(info_path)); + if (!annotations.SerializeToZeroCopyStream(info_output.get())) { + *error = absl::StrCat("error: internal error writing annotations: ", + info_path); + return false; + } + } } // Generate m file(s). diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.h index be5a6a4488815..2abc4db9e2c40 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/generator.h @@ -39,7 +39,6 @@ class PROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator { ObjectiveCGenerator& operator=(const ObjectiveCGenerator&) = delete; // implements CodeGenerator ---------------------------------------- - bool HasGenerateAll() const override; bool Generate(const FileDescriptor* file, const std::string& parameter, GeneratorContext* context, std::string* error) const override; bool GenerateAll(const std::vector<const FileDescriptor*>& files, diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.cc index 6e380baa49bbb..233cbe6ed856f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.cc @@ -11,6 +11,7 @@ #include <cstddef> #include <cstdint> #include <string> +#include <utility> #include <vector> #include "absl/log/absl_check.h" @@ -283,7 +284,7 @@ std::string DefaultValue(const FieldDescriptor* field) { // Must convert to a standard byte order for packing length into // a cstring. - uint32_t length = ghtonl(default_string.length()); + uint32_t length = ghtonl((uint32_t)default_string.length()); std::string bytes((const char*)&length, sizeof(length)); absl::StrAppend(&bytes, default_string); return absl::StrCat("(NSData*)\"", @@ -428,6 +429,15 @@ bool IsWKTWithObjCCategory(const Descriptor* descriptor) { return false; } +void SubstitutionMap::Set(io::Printer::Sub&& sub) { + if (auto [it, inserted] = subs_map_.try_emplace(sub.key(), subs_.size()); + !inserted) { + subs_[it->second] = std::move(sub); + } else { + subs_.emplace_back(std::move(sub)); + } +} + } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.h index edd0c1c096710..3c65b83ab3f9b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/helpers.h @@ -10,9 +10,13 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_HELPERS_H__ #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_HELPERS_H__ +#include <cstddef> #include <string> +#include <utility> #include <vector> +#include "absl/container/flat_hash_map.h" +#include "absl/log/absl_log.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "google/protobuf/compiler/objectivec/options.h" @@ -156,6 +160,53 @@ std::string GetOptionalDeprecatedAttribute( bool HasWKTWithObjCCategory(const FileDescriptor* file); bool IsWKTWithObjCCategory(const Descriptor* descriptor); +// A map of `io::Printer::Sub`s, where entries can be overwritten. +// +// This exists because `io::Printer::WithVars` only accepts a flat list of +// substitutions, and will break if there are any duplicated entries. At the +// same time, a lot of code in this generator depends on modifying, overwriting, +// and looking up variables in the list of substitutions. +class SubstitutionMap { + public: + SubstitutionMap() = default; + SubstitutionMap(const SubstitutionMap&) = delete; + SubstitutionMap& operator=(const SubstitutionMap&) = delete; + + auto Install(io::Printer* printer) const { return printer->WithVars(subs_); } + + std::string Value(absl::string_view key) const { + if (auto it = subs_map_.find(key); it != subs_map_.end()) { + return std::string(subs_.at(it->second).value()); + } + ABSL_LOG(FATAL) << " Unknown variable: " << key; + } + + // Sets or replaces a variable in the map. + // All arguments are forwarded to `io::Printer::Sub`. + template <typename... Args> + void Set(std::string key, Args&&... args); + // Same as above, but takes a `io::Printer::Sub` directly. + // + // This is necessary to use advanced features of `io::Printer::Sub` like + // annotations. + void Set(io::Printer::Sub&& sub); + + private: + std::vector<io::Printer::Sub> subs_; + absl::flat_hash_map<std::string, size_t> subs_map_; +}; + +template <typename... Args> +void SubstitutionMap::Set(std::string key, Args&&... args) { + if (auto [it, inserted] = subs_map_.try_emplace(key, subs_.size()); + !inserted) { + subs_[it->second] = + io::Printer::Sub(std::move(key), std::forward<Args>(args)...); + } else { + subs_.emplace_back(std::move(key), std::forward<Args>(args)...); + } +} + } // namespace objectivec } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/import_writer.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/import_writer.cc index 85641dc9a97bf..616c618409c6d 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/import_writer.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/import_writer.cc @@ -7,6 +7,7 @@ #include "google/protobuf/compiler/objectivec/import_writer.h" +#include <cstddef> #include <iostream> #include <ostream> #include <string> @@ -48,7 +49,7 @@ class ProtoFrameworkCollector : public LineConsumer { bool ProtoFrameworkCollector::ConsumeLine(absl::string_view line, std::string* out_error) { - int offset = line.find(':'); + size_t offset = line.find(':'); if (offset == absl::string_view::npos) { *out_error = absl::StrCat( "Framework/proto file mapping line without colon sign: '", line, "'."); @@ -59,7 +60,7 @@ bool ProtoFrameworkCollector::ConsumeLine(absl::string_view line, absl::string_view proto_file_list = absl::StripAsciiWhitespace(line.substr(offset + 1)); - int start = 0; + size_t start = 0; while (start < proto_file_list.length()) { offset = proto_file_list.find(',', start); if (offset == absl::string_view::npos) { diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer.cc index 2b2fc1613446e..6a3b2a9625701 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer.cc @@ -45,7 +45,7 @@ namespace { bool ascii_isnewline(char c) { return c == '\n' || c == '\r'; } bool ReadLine(absl::string_view* input, absl::string_view* line) { - for (int len = 0; len < input->size(); ++len) { + for (size_t len = 0; len < input->size(); ++len) { if (ascii_isnewline((*input)[len])) { *line = absl::string_view(input->data(), len); ++len; // advance over the newline @@ -57,7 +57,7 @@ bool ReadLine(absl::string_view* input, absl::string_view* line) { } void RemoveComment(absl::string_view* input) { - int offset = input->find('#'); + size_t offset = input->find('#'); if (offset != absl::string_view::npos) { input->remove_suffix(input->length() - offset); } @@ -162,7 +162,7 @@ bool ParseSimpleStream(io::ZeroCopyInputStream& input_stream, } if (!parser.ParseChunk( - absl::string_view(static_cast<const char*>(buf), buf_len), + absl::string_view(static_cast<const char*>(buf), (size_t)buf_len), &local_error)) { *out_error = absl::StrCat("error: ", stream_name, " Line ", parser.last_line(), ", ", local_error); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer_unittest.cc index fb25b1660bd4a..2a59c1015096d 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/line_consumer_unittest.cc @@ -68,7 +68,7 @@ TEST(ObjCHelper, ParseSimple_BasicsSuccess) { for (const auto& test : tests) { for (int i = 0; i < kBlockSizeCount; i++) { - io::ArrayInputStream input(test.first.data(), test.first.size(), + io::ArrayInputStream input(test.first.data(), (int)test.first.size(), kBlockSizes[i]); std::string err_str; std::vector<std::string> lines; @@ -97,7 +97,7 @@ TEST(ObjCHelper, ParseSimple_DropsComments) { for (const auto& test : tests) { for (int i = 0; i < kBlockSizeCount; i++) { - io::ArrayInputStream input(test.first.data(), test.first.size(), + io::ArrayInputStream input(test.first.data(), (int)test.first.size(), kBlockSizes[i]); std::string err_str; std::vector<std::string> lines; @@ -120,7 +120,7 @@ TEST(ObjCHelper, ParseSimple_RejectLines) { for (const auto& test : tests) { for (int i = 0; i < kBlockSizeCount; i++) { io::ArrayInputStream input(std::get<0>(test).data(), - std::get<0>(test).size(), kBlockSizes[i]); + (int)std::get<0>(test).size(), kBlockSizes[i]); std::string err_str; TestLineCollector collector(nullptr, &std::get<1>(test)); EXPECT_FALSE(ParseSimpleStream(input, "dummy", &collector, &err_str)); @@ -143,7 +143,7 @@ TEST(ObjCHelper, ParseSimple_RejectLinesNoMessage) { for (const auto& test : tests) { for (int i = 0; i < kBlockSizeCount; i++) { io::ArrayInputStream input(std::get<0>(test).data(), - std::get<0>(test).size(), kBlockSizes[i]); + (int)std::get<0>(test).size(), kBlockSizes[i]); std::string err_str; TestLineCollector collector(nullptr, &std::get<1>(test), true /* skip msg */); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/map_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/map_field.cc index 27f4db69ab98e..3eaeae82d7229 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/map_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/map_field.cc @@ -40,16 +40,17 @@ MapFieldGenerator::MapFieldGenerator( FieldGenerator::Make(value_descriptor, generation_options)); // Pull over some variables_ from the value. - variables_["field_type"] = value_field_generator_->variable("field_type"); - variables_["default"] = value_field_generator_->variable("default"); - variables_["default_name"] = value_field_generator_->variable("default_name"); + variables_.Set("field_type", value_field_generator_->variable("field_type")); + variables_.Set("default", value_field_generator_->variable("default")); + variables_.Set("default_name", + value_field_generator_->variable("default_name")); // Build custom field flags. std::vector<std::string> field_flags; field_flags.push_back( absl::StrCat("GPBFieldMapKey", GetCapitalizedType(key_descriptor))); // Pull over the current text format custom name values that was calculated. - if (absl::StrContains(variables_["fieldflags"], + if (absl::StrContains(variable("fieldflags"), "GPBFieldTextFormatNameCustom")) { field_flags.push_back("GPBFieldTextFormatNameCustom"); } @@ -66,12 +67,12 @@ MapFieldGenerator::MapFieldGenerator( } } - variables_["fieldflags"] = BuildFlagsString(FLAGTYPE_FIELD, field_flags); + variables_.Set("fieldflags", BuildFlagsString(FLAGTYPE_FIELD, field_flags)); - variables_["dataTypeSpecific_name"] = - value_field_generator_->variable("dataTypeSpecific_name"); - variables_["dataTypeSpecific_value"] = - value_field_generator_->variable("dataTypeSpecific_value"); + variables_.Set("dataTypeSpecific_name", + value_field_generator_->variable("dataTypeSpecific_name")); + variables_.Set("dataTypeSpecific_value", + value_field_generator_->variable("dataTypeSpecific_value")); } void MapFieldGenerator::EmitArrayComment(io::Printer* printer) const { diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.cc index d41fd1483791c..60a47033e7c93 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.cc @@ -37,6 +37,7 @@ namespace compiler { namespace objectivec { namespace { +using Sub = ::google::protobuf::io::Printer::Sub; struct FieldOrderingByNumber { inline bool operator()(const FieldDescriptor* a, @@ -143,7 +144,7 @@ struct SimpleExtensionRange { static std::vector<SimpleExtensionRange> Normalize( const Descriptor* descriptor) { std::vector<const Descriptor::ExtensionRange*> sorted_extensions; - sorted_extensions.reserve(descriptor->extension_range_count()); + sorted_extensions.reserve((size_t)descriptor->extension_range_count()); for (int i = 0; i < descriptor->extension_range_count(); ++i) { sorted_extensions.push_back(descriptor->extension_range(i)); } @@ -168,7 +169,7 @@ struct SimpleExtensionRange { // and return it. const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor) { const FieldDescriptor** fields = - new const FieldDescriptor*[descriptor->field_count()]; + new const FieldDescriptor*[(size_t)descriptor->field_count()]; for (int i = 0; i < descriptor->field_count(); i++) { fields[i] = descriptor->field(i); } @@ -181,7 +182,7 @@ const FieldDescriptor** SortFieldsByNumber(const Descriptor* descriptor) { // array and return it. const FieldDescriptor** SortFieldsByStorageSize(const Descriptor* descriptor) { const FieldDescriptor** fields = - new const FieldDescriptor*[descriptor->field_count()]; + new const FieldDescriptor*[(size_t)descriptor->field_count()]; for (int i = 0; i < descriptor->field_count(); i++) { fields[i] = descriptor->field(i); } @@ -218,8 +219,8 @@ MessageGenerator::MessageGenerator(const std::string& file_description_name, // who needs has bits and assigning them. // 2. FieldGenerator::SetOneofIndexBase() overrides has_bit with a negative // index that groups all the elements in the oneof. - size_t num_has_bits = field_generators_.CalculateHasBits(); - size_t sizeof_has_storage = (num_has_bits + 31) / 32; + int num_has_bits = field_generators_.CalculateHasBits(); + int sizeof_has_storage = (num_has_bits + 31) / 32; if (sizeof_has_storage == 0) { // In the case where no field needs has bits, don't let the _has_storage_ // end up as zero length (zero length arrays are sort of a grey area @@ -290,10 +291,10 @@ void MessageGenerator::DetermineObjectiveCClassDefinitions( } void MessageGenerator::GenerateMessageHeader(io::Printer* printer) const { - auto vars = printer->WithVars({{"classname", class_name_}}); + auto vars = printer->WithVars( + {Sub("classname", class_name_).AnnotatedAs(descriptor_)}); printer->Emit( - {io::Printer::Sub("deprecated_attribute", deprecated_attribute_) - .WithSuffix(";"), + {Sub("deprecated_attribute", deprecated_attribute_).WithSuffix(";"), {"message_comments", [&] { EmitCommentsString(printer, generation_options_, descriptor_, @@ -302,8 +303,12 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) const { {"message_fieldnum_enum", [&] { if (descriptor_->field_count() == 0) return; - printer->Emit(R"objc( - typedef GPB_ENUM($classname$_FieldNumber) { + printer->Emit({Sub("field_number_enum_name", + absl::StrCat(printer->LookupVar("classname"), + "_FieldNumber")) + .AnnotatedAs(descriptor_)}, + R"objc( + typedef GPB_ENUM($field_number_enum_name$) { $message_fieldnum_enum_values$, }; )objc"); @@ -409,7 +414,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) const { bool need_defaults = field_generators_.DoesAnyFieldHaveNonZeroDefault(); TextFormatDecodeData text_format_decode_data; - for (int i = 0; i < descriptor_->field_count(); ++i) { + for (size_t i = 0; i < (size_t)descriptor_->field_count(); ++i) { const FieldGenerator& field_generator = field_generators_.get(sorted_fields[i]); if (field_generator.needs_textformat_name_support()) { @@ -468,7 +473,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) const { {"sizeof_has_storage", sizeof_has_storage_}, {"storage_fields", [&] { - for (int i = 0; i < descriptor_->field_count(); i++) { + for (size_t i = 0; i < (size_t)descriptor_->field_count(); i++) { field_generators_.get(size_order_fields[i]) .GenerateFieldStorageDeclaration(printer); } @@ -501,7 +506,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) const { }}, {"declare_fields_static_fields", [&] { - for (int i = 0; i < descriptor_->field_count(); ++i) { + for (size_t i = 0; i < (size_t)descriptor_->field_count(); ++i) { const FieldGenerator& field_generator = field_generators_.get(sorted_fields[i]); field_generator.GenerateFieldDescription(printer, need_defaults); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.h index b87ad569ed25d..2e846bb371d0a 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/message.h @@ -8,7 +8,6 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ -#include <cstddef> #include <memory> #include <string> #include <vector> @@ -62,7 +61,7 @@ class MessageGenerator { const std::string deprecated_attribute_; std::vector<const ExtensionGenerator*> extension_generators_; std::vector<std::unique_ptr<OneofGenerator>> oneof_generators_; - size_t sizeof_has_storage_; + int sizeof_has_storage_; }; } // namespace objectivec diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/message_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/message_field.cc index cac852cd93009..f13c3aab16b83 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/message_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/message_field.cc @@ -27,15 +27,14 @@ namespace objectivec { namespace { -void SetMessageVariables( - const FieldDescriptor* descriptor, - absl::flat_hash_map<absl::string_view, std::string>* variables) { +void SetMessageVariables(const FieldDescriptor* descriptor, + SubstitutionMap& variables) { const std::string& message_type = ClassName(descriptor->message_type()); const std::string& containing_class = ClassName(descriptor->containing_type()); - (*variables)["msg_type"] = message_type; - (*variables)["containing_class"] = containing_class; - (*variables)["dataTypeSpecific_value"] = ObjCClass(message_type); + variables.Set("msg_type", message_type); + variables.Set("containing_class", containing_class); + variables.Set("dataTypeSpecific_value", ObjCClass(message_type)); } } // namespace @@ -44,7 +43,7 @@ MessageFieldGenerator::MessageFieldGenerator( const FieldDescriptor* descriptor, const GenerationOptions& generation_options) : ObjCObjFieldGenerator(descriptor, generation_options) { - SetMessageVariables(descriptor, &variables_); + SetMessageVariables(descriptor, variables_); } void MessageFieldGenerator::DetermineForwardDeclarations( @@ -78,7 +77,7 @@ RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( const FieldDescriptor* descriptor, const GenerationOptions& generation_options) : RepeatedFieldGenerator(descriptor, generation_options) { - SetMessageVariables(descriptor, &variables_); + SetMessageVariables(descriptor, variables_); } void RepeatedMessageFieldGenerator::DetermineForwardDeclarations( diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.cc index 3cd722491f2e8..a3be55e06ac2a 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.cc @@ -21,34 +21,39 @@ namespace protobuf { namespace compiler { namespace objectivec { +using Sub = ::google::protobuf::io::Printer::Sub; + OneofGenerator::OneofGenerator(const OneofDescriptor* descriptor, const GenerationOptions& generation_options) : descriptor_(descriptor), generation_options_(generation_options) { - variables_["enum_name"] = OneofEnumName(descriptor_); - variables_["name"] = OneofName(descriptor_); - variables_["capitalized_name"] = OneofNameCapitalized(descriptor_); - variables_["raw_index"] = absl::StrCat(descriptor_->index()); + variables_.Set("enum_name", OneofEnumName(descriptor_)); + variables_.Set("name", OneofName(descriptor_)); + variables_.Set("capitalized_name", OneofNameCapitalized(descriptor_)); + variables_.Set("raw_index", absl::StrCat(descriptor_->index())); const Descriptor* msg_descriptor = descriptor_->containing_type(); - variables_["owning_message_class"] = ClassName(msg_descriptor); + variables_.Set("owning_message_class", ClassName(msg_descriptor)); } void OneofGenerator::SetOneofIndexBase(int index_base) { int index = descriptor_->index() + index_base; // Flip the sign to mark it as a oneof. - variables_["index"] = absl::StrCat(-index); + variables_.Set("index", absl::StrCat(-index)); } void OneofGenerator::GenerateCaseEnum(io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit({{"cases", [&] { for (int j = 0; j < descriptor_->field_count(); j++) { const FieldDescriptor* field = descriptor_->field(j); printer->Emit( - {{"field_name", FieldNameCapitalized(field)}, - {"field_number", field->number()}}, + {Sub("enum_entry_name", + absl::StrCat(printer->LookupVar("enum_name"), + "_", FieldNameCapitalized(field))) + .AnnotatedAs(field), + Sub("field_number", field->number())}, R"objc( - $enum_name$_$field_name$ = $field_number$, + $enum_entry_name$ = $field_number$, )objc"); } }}}, @@ -63,33 +68,41 @@ void OneofGenerator::GenerateCaseEnum(io::Printer* printer) const { void OneofGenerator::GeneratePublicCasePropertyDeclaration( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - printer->Emit({{"comments", + auto vars = variables_.Install(printer); + printer->Emit({Sub("oneof_getter_name", + absl::StrCat(printer->LookupVar("name"), "OneOfCase")) + .AnnotatedAs(descriptor_), + {"comments", [&] { EmitCommentsString(printer, generation_options_, descriptor_); }}}, R"objc( $comments$; - @property(nonatomic, readonly) $enum_name$ $name$OneOfCase; + @property(nonatomic, readonly) $enum_name$ $oneof_getter_name$; )objc"); printer->Emit("\n"); } void OneofGenerator::GenerateClearFunctionDeclaration( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); - printer->Emit(R"objc( + auto vars = variables_.Install(printer); + printer->Emit( + {Sub("clear_function_name", + absl::StrCat(printer->LookupVar("owning_message_class"), "_Clear", + printer->LookupVar("capitalized_name"), "OneOfCase")) + .AnnotatedAs(descriptor_)}, + R"objc( /** * Clears whatever value was set for the oneof '$name$'. **/ - void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message); + void $clear_function_name$($owning_message_class$ *message); )objc"); } void OneofGenerator::GeneratePropertyImplementation( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit(R"objc( @dynamic $name$OneOfCase; )objc"); @@ -97,7 +110,7 @@ void OneofGenerator::GeneratePropertyImplementation( void OneofGenerator::GenerateClearFunctionImplementation( io::Printer* printer) const { - auto vars = printer->WithVars(variables_); + auto vars = variables_.Install(printer); printer->Emit(R"objc( void $owning_message_class$_Clear$capitalized_name$OneOfCase($owning_message_class$ *message) { GPBDescriptor *descriptor = [$owning_message_class$ descriptor]; @@ -108,11 +121,11 @@ void OneofGenerator::GenerateClearFunctionImplementation( } std::string OneofGenerator::DescriptorName() const { - return variables_.find("name")->second; + return variables_.Value("name"); } std::string OneofGenerator::HasIndexAsString() const { - return variables_.find("index")->second; + return variables_.Value("index"); } } // namespace objectivec diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.h index c849e885127a1..abe9a6121203c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/oneof.h @@ -10,8 +10,7 @@ #include <string> -#include "absl/container/flat_hash_map.h" -#include "absl/strings/string_view.h" +#include "google/protobuf/compiler/objectivec/helpers.h" #include "google/protobuf/compiler/objectivec/options.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/io/printer.h" @@ -46,7 +45,7 @@ class OneofGenerator { private: const OneofDescriptor* descriptor_; const GenerationOptions& generation_options_; - absl::flat_hash_map<absl::string_view, std::string> variables_; + SubstitutionMap variables_; }; } // namespace objectivec diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/options.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/options.h index 8c80ae4aa4ba2..8ac947674c468 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/options.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/options.h @@ -29,6 +29,15 @@ struct GenerationOptions { // in behavior or go away at any time. bool experimental_multi_source_generation = false; bool experimental_strip_nonfunctional_codegen = false; + + // The name of the pragma that will be used to indicate the start of the + // metadata annotations. Must be set (along with `annotation_guard_name`) for + // cross-references to be generated. + std::string annotation_pragma_name; + // The name of the preprocessor guard that will be used to guard the metadata + // annotations. Must be set (along with `annotation_pragma_name`) for + // cross-references to be generated. + std::string annotation_guard_name; }; } // namespace objectivec diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/primitive_field.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/primitive_field.cc index b9428a85b1955..7a4b9cfa3071d 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/primitive_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/primitive_field.cc @@ -47,9 +47,9 @@ int PrimitiveFieldGenerator::ExtraRuntimeHasBitsNeeded() const { void PrimitiveFieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) { if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) { // Set into the offset the has bit to use for the actual value. - variables_["storage_offset_value"] = absl::StrCat(index_base); - variables_["storage_offset_comment"] = - " // Stored in _has_storage_ to save space."; + variables_.Set("storage_offset_value", absl::StrCat(index_base)); + variables_.Set("storage_offset_comment", + " // Stored in _has_storage_ to save space."); } } @@ -57,7 +57,7 @@ PrimitiveObjFieldGenerator::PrimitiveObjFieldGenerator( const FieldDescriptor* descriptor, const GenerationOptions& generation_options) : ObjCObjFieldGenerator(descriptor, generation_options) { - variables_["property_storage_attribute"] = "copy"; + variables_.Set("property_storage_attribute", "copy"); } RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.cc b/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.cc index 8eade5d17a617..d54138f043b05 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.cc @@ -7,6 +7,7 @@ #include "google/protobuf/compiler/objectivec/tf_decode_data.h" +#include <cstddef> #include <cstdint> #include <sstream> #include <string> @@ -16,6 +17,8 @@ #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" @@ -136,10 +139,10 @@ bool DecodeDataBuilder::AddCharacter(char desired, char input) { // If decode data can't be generated, a directive for the raw string // is used instead. -std::string DirectDecodeString(const std::string& str) { +std::string DirectDecodeString(absl::string_view str) { std::string result; result += (char)'\0'; // Marker for full string. - result += str; + absl::StrAppend(&result, str); result += (char)'\0'; // End of string. return result; } @@ -147,8 +150,8 @@ std::string DirectDecodeString(const std::string& str) { } // namespace void TextFormatDecodeData::AddString(int32_t key, - const std::string& input_for_decode, - const std::string& desired_output) { + absl::string_view input_for_decode, + absl::string_view desired_output) { for (std::vector<DataEntry>::const_iterator i = entries_.begin(); i != entries_.end(); ++i) { ABSL_CHECK(i->first != key) @@ -157,7 +160,7 @@ void TextFormatDecodeData::AddString(int32_t key, << "\", desired: \"" << desired_output << "\"."; } - const std::string& data = TextFormatDecodeData::DecodeDataForString( + const std::string data = TextFormatDecodeData::DecodeDataForString( input_for_decode, desired_output); entries_.push_back(DataEntry(key, data)); } @@ -169,10 +172,10 @@ std::string TextFormatDecodeData::Data() const { io::OstreamOutputStream data_outputstream(&data_stringstream); io::CodedOutputStream output_stream(&data_outputstream); - output_stream.WriteVarint32(num_entries()); + output_stream.WriteVarint32((uint32_t)num_entries()); for (std::vector<DataEntry>::const_iterator i = entries_.begin(); i != entries_.end(); ++i) { - output_stream.WriteVarint32(i->first); + output_stream.WriteVarint32((uint32_t)i->first); output_stream.WriteString(i->second); } } @@ -183,7 +186,7 @@ std::string TextFormatDecodeData::Data() const { // static std::string TextFormatDecodeData::DecodeDataForString( - const std::string& input_for_decode, const std::string& desired_output) { + absl::string_view input_for_decode, absl::string_view desired_output) { ABSL_CHECK(!input_for_decode.empty() && !desired_output.empty()) << "error: got empty string for making TextFormat data, input: \"" << input_for_decode << "\", desired: \"" << desired_output << "\"."; @@ -196,8 +199,8 @@ std::string TextFormatDecodeData::DecodeDataForString( DecodeDataBuilder builder; // Walk the output building it from the input. - int x = 0; - for (int y = 0; y < desired_output.size(); y++) { + size_t x = 0; + for (size_t y = 0; y < desired_output.size(); y++) { const char d = desired_output[y]; if (d == '_') { builder.AddUnderscore(); diff --git a/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.h b/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.h index 1e7932afa2b5f..b9eda2bd26371 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.h +++ b/third_party/protobuf/src/google/protobuf/compiler/objectivec/tf_decode_data.h @@ -14,6 +14,8 @@ #include <utility> #include <vector> +#include "absl/strings/string_view.h" + // Must be included last #include "google/protobuf/port_def.inc" @@ -35,13 +37,13 @@ class PROTOC_EXPORT TextFormatDecodeData { TextFormatDecodeData(const TextFormatDecodeData&) = delete; TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete; - void AddString(int32_t key, const std::string& input_for_decode, - const std::string& desired_output); + void AddString(int32_t key, absl::string_view input_for_decode, + absl::string_view desired_output); size_t num_entries() const { return entries_.size(); } std::string Data() const; - static std::string DecodeDataForString(const std::string& input_for_decode, - const std::string& desired_output); + static std::string DecodeDataForString(absl::string_view input_for_decode, + absl::string_view desired_output); private: typedef std::pair<int32_t, std::string> DataEntry; diff --git a/third_party/protobuf/src/google/protobuf/compiler/parser.cc b/third_party/protobuf/src/google/protobuf/compiler/parser.cc index bc17e7a70ac43..298f0714560a9 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/parser.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/parser.cc @@ -13,7 +13,6 @@ #include "google/protobuf/compiler/parser.h" -#include <float.h> #include <cstddef> #include <cstdint> @@ -23,7 +22,6 @@ #include <utility> #include <vector> -#include "absl/base/casts.h" #include "absl/cleanup/cleanup.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" @@ -39,8 +37,6 @@ #include "google/protobuf/io/strtod.h" #include "google/protobuf/io/tokenizer.h" #include "google/protobuf/message_lite.h" -#include "google/protobuf/port.h" -#include "google/protobuf/wire_format.h" // Must be included last. #include "google/protobuf/port_def.inc" @@ -106,57 +102,6 @@ std::string MapEntryName(absl::string_view field_name) { return result; } -bool IsUppercase(char c) { return c >= 'A' && c <= 'Z'; } - -bool IsLowercase(char c) { return c >= 'a' && c <= 'z'; } - -bool IsNumber(char c) { return c >= '0' && c <= '9'; } - -bool IsUpperCamelCase(absl::string_view name) { - if (name.empty()) { - return true; - } - // Name must start with an upper case character. - if (!IsUppercase(name[0])) { - return false; - } - // Must not contains underscore. - for (const char c : name) { - if (c == '_') { - return false; - } - } - return true; -} - -bool IsUpperUnderscore(absl::string_view name) { - for (const char c : name) { - if (!IsUppercase(c) && c != '_' && !IsNumber(c)) { - return false; - } - } - return true; -} - -bool IsLowerUnderscore(absl::string_view name) { - for (const char c : name) { - if (!IsLowercase(c) && c != '_' && !IsNumber(c)) { - return false; - } - } - return true; -} - -bool IsNumberFollowUnderscore(absl::string_view name) { - for (int i = 1; i < name.length(); i++) { - const char c = name[i]; - if (IsNumber(c) && name[i - 1] == '_') { - return true; - } - } - return false; -} - } // anonymous namespace // Makes code slightly more readable. The meaning of "DO(foo)" is @@ -626,22 +571,6 @@ bool Parser::ValidateEnum(const EnumDescriptorProto* proto) { return false; } - // Enforce that enum constants must be UPPER_CASE except in case of - // enum_alias. - if (!allow_alias) { - for (const auto& enum_value : proto->value()) { - if (!IsUpperUnderscore(enum_value.name())) { - RecordWarning([&] { - return absl::StrCat( - "Enum constant should be in UPPER_CASE. Found: ", - enum_value.name(), - ". See " - "https://developers.google.com/protocol-buffers/docs/style"); - }); - } - } - } - return true; } @@ -866,14 +795,6 @@ bool Parser::ParseMessageDefinition( location.RecordLegacyLocation(message, DescriptorPool::ErrorCollector::NAME); DO(ConsumeIdentifier(message->mutable_name(), "Expected message name.")); - if (!IsUpperCamelCase(message->name())) { - RecordWarning([=] { - return absl::StrCat( - "Message name should be in UpperCamelCase. Found: ", - message->name(), - ". See https://developers.google.com/protocol-buffers/docs/style"); - }); - } } DO(ParseMessageBlock(message, message_location, containing_file)); @@ -1101,22 +1022,6 @@ bool Parser::ParseMessageFieldNoLabel( FieldDescriptorProto::kNameFieldNumber); location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::NAME); DO(ConsumeIdentifier(field->mutable_name(), "Expected field name.")); - - if (!IsLowerUnderscore(field->name())) { - RecordWarning([=] { - return absl::StrCat( - "Field name should be lowercase. Found: ", field->name(), - ". See: https://developers.google.com/protocol-buffers/docs/style"); - }); - } - if (IsNumberFollowUnderscore(field->name())) { - RecordWarning([=] { - return absl::StrCat( - "Number should not come right after an underscore. Found: ", - field->name(), - ". See: https://developers.google.com/protocol-buffers/docs/style"); - }); - } } DO(Consume("=", "Missing field number.")); @@ -1861,6 +1766,11 @@ bool Parser::ParseReservedName(std::string* name, ErrorMaker error_message) { int col = input_->current().column; DO(ConsumeString(name, error_message)); if (!io::Tokenizer::IsIdentifier(*name)) { + // Before Edition 2023, it was possible to reserve any string literal. This + // doesn't really make sense if the string literal wasn't a valid + // identifier, so warn about it here. + // Note that this warning is also load-bearing for tests that intend to + // verify warnings work as expected today. RecordWarning(line, col, [=] { return absl::StrFormat("Reserved name \"%s\" is not a valid identifier.", *name); diff --git a/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc index 46f3db1633817..880cca4936616 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc @@ -235,43 +235,6 @@ TEST_F(ParserTest, WarnIfSyntaxIdentifierOmitted) { std::string::npos); } -TEST_F(ParserTest, WarnIfFieldNameIsNotUpperCamel) { - SetupParser( - "syntax = \"proto2\";" - "message abc {}"); - FileDescriptorProto file; - EXPECT_TRUE(parser_->Parse(input_.get(), &file)); - EXPECT_TRUE(error_collector_.warning_.find( - "Message name should be in UpperCamelCase. Found: abc.") != - std::string::npos); -} - -TEST_F(ParserTest, WarnIfFieldNameIsNotLowerUnderscore) { - SetupParser( - "syntax = \"proto2\";" - "message A {" - " optional string SongName = 1;" - "}"); - FileDescriptorProto file; - EXPECT_TRUE(parser_->Parse(input_.get(), &file)); - EXPECT_TRUE(error_collector_.warning_.find( - "Field name should be lowercase. Found: SongName") != - std::string::npos); -} - -TEST_F(ParserTest, WarnIfFieldNameContainsNumberImmediatelyFollowUnderscore) { - SetupParser( - "syntax = \"proto2\";" - "message A {" - " optional string song_name_1 = 1;" - "}"); - FileDescriptorProto file; - EXPECT_TRUE(parser_->Parse(input_.get(), &file)); - EXPECT_TRUE(error_collector_.warning_.find( - "Number should not come right after an underscore. Found: " - "song_name_1.") != std::string::npos); -} - TEST_F(ParserTest, RegressionNestedOpenBraceDoNotStackOverflow) { std::string input("edition=\"a\000;", 12); input += std::string(100000, '{'); @@ -1465,38 +1428,38 @@ TEST_F(ParseMiscTest, InterpretedOptions) { // values from that file's descriptor in the generated code. { const MessageOptions& options = - protobuf_unittest::SettingRealsFromInf ::descriptor()->options(); - float float_val = options.GetExtension(protobuf_unittest::float_opt); + proto2_unittest::SettingRealsFromInf ::descriptor()->options(); + float float_val = options.GetExtension(proto2_unittest::float_opt); ASSERT_TRUE(std::isinf(float_val)); ASSERT_GT(float_val, 0); - double double_val = options.GetExtension(protobuf_unittest::double_opt); + double double_val = options.GetExtension(proto2_unittest::double_opt); ASSERT_TRUE(std::isinf(double_val)); ASSERT_GT(double_val, 0); } { const MessageOptions& options = - protobuf_unittest::SettingRealsFromNegativeInf ::descriptor()->options(); - float float_val = options.GetExtension(protobuf_unittest::float_opt); + proto2_unittest::SettingRealsFromNegativeInf ::descriptor()->options(); + float float_val = options.GetExtension(proto2_unittest::float_opt); ASSERT_TRUE(std::isinf(float_val)); ASSERT_LT(float_val, 0); - double double_val = options.GetExtension(protobuf_unittest::double_opt); + double double_val = options.GetExtension(proto2_unittest::double_opt); ASSERT_TRUE(std::isinf(double_val)); ASSERT_LT(double_val, 0); } { const MessageOptions& options = - protobuf_unittest::SettingRealsFromNan ::descriptor()->options(); - float float_val = options.GetExtension(protobuf_unittest::float_opt); + proto2_unittest::SettingRealsFromNan ::descriptor()->options(); + float float_val = options.GetExtension(proto2_unittest::float_opt); ASSERT_TRUE(std::isnan(float_val)); - double double_val = options.GetExtension(protobuf_unittest::double_opt); + double double_val = options.GetExtension(proto2_unittest::double_opt); ASSERT_TRUE(std::isnan(double_val)); } { const MessageOptions& options = - protobuf_unittest::SettingRealsFromNegativeNan ::descriptor()->options(); - float float_val = options.GetExtension(protobuf_unittest::float_opt); + proto2_unittest::SettingRealsFromNegativeNan ::descriptor()->options(); + float float_val = options.GetExtension(proto2_unittest::float_opt); ASSERT_TRUE(std::isnan(float_val)); - double double_val = options.GetExtension(protobuf_unittest::double_opt); + double double_val = options.GetExtension(proto2_unittest::double_opt); ASSERT_TRUE(std::isnan(double_val)); } } @@ -2759,7 +2722,7 @@ void StripEmptyOptions(FileDescriptorProto& file_proto) { TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) { const FileDescriptor* original_file = - protobuf_unittest::TestAllTypes::descriptor()->file(); + proto2_unittest::TestAllTypes::descriptor()->file(); FileDescriptorProto expected; original_file->CopyTo(&expected); StripEmptyOptions(expected); @@ -2781,12 +2744,12 @@ TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) { parsed.set_name("google/protobuf/unittest.proto"); // We need the imported dependency before we can build our parsed proto const FileDescriptor* public_import = - protobuf_unittest_import::PublicImportMessage::descriptor()->file(); + proto2_unittest_import::PublicImportMessage::descriptor()->file(); FileDescriptorProto public_import_proto; public_import->CopyTo(&public_import_proto); ASSERT_TRUE(pool_.BuildFile(public_import_proto) != nullptr); const FileDescriptor* import = - protobuf_unittest_import::ImportMessage::descriptor()->file(); + proto2_unittest_import::ImportMessage::descriptor()->file(); FileDescriptorProto import_proto; import->CopyTo(&import_proto); ASSERT_TRUE(pool_.BuildFile(import_proto) != nullptr); @@ -2810,7 +2773,7 @@ TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) { TEST_F(ParseDescriptorDebugTest, TestCustomOptions) { const FileDescriptor* original_file = - protobuf_unittest::AggregateMessage::descriptor()->file(); + proto2_unittest::AggregateMessage::descriptor()->file(); FileDescriptorProto expected; original_file->CopyTo(&expected); diff --git a/third_party/protobuf/src/google/protobuf/compiler/php/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/php/BUILD.bazel index 7e21518f4c124..930db4476125b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/php/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/php/BUILD.bazel @@ -17,7 +17,7 @@ cc_library( "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -39,10 +39,10 @@ cc_library( "//src/google/protobuf/compiler:retention", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -53,8 +53,8 @@ cc_test( ":php", "//:protobuf", "//src/google/protobuf/compiler:command_line_interface_tester", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/php/php_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/php/php_generator.cc index d7f5fa65e0b00..f9b27a8ea5f3b 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/php/php_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/php/php_generator.cc @@ -541,7 +541,7 @@ std::string BinaryToPhpString(const std::string& src) { bool GenerateField(const FieldDescriptor* field, io::Printer* printer, const Options& options, std::string* error) { - if (field->is_required()) { + if (!options.is_descriptor && field->is_required()) { *error = absl::StrCat("Can't generate PHP code for required field ", field->full_name(), ".\n"); return false; @@ -1155,7 +1155,7 @@ void GenerateMetadataFile(const FileDescriptor* file, const Options& options, bool GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en, const Options& options, GeneratorContext* generator_context, std::string* error) { - if (en->is_closed()) { + if (!options.is_descriptor && en->is_closed()) { *error = absl::StrCat("Can't generate PHP code for closed enum ", en->full_name(), ". Please use either proto3 or editions without " diff --git a/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc b/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc index fdcbe467a406b..3d1321d3af3f9 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/compiler/plugin.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/compiler/plugin.pb.h" @@ -41,7 +41,7 @@ inline constexpr Version::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR Version::Version(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Version_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -75,7 +75,7 @@ inline constexpr CodeGeneratorResponse_File::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR CodeGeneratorResponse_File::CodeGeneratorResponse_File(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(CodeGeneratorResponse_File_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -106,7 +106,7 @@ inline constexpr CodeGeneratorResponse::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR CodeGeneratorResponse::CodeGeneratorResponse(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(CodeGeneratorResponse_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -137,7 +137,7 @@ inline constexpr CodeGeneratorRequest::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR CodeGeneratorRequest::CodeGeneratorRequest(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(CodeGeneratorRequest_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -156,8 +156,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOC_EXPORT } // namespace compiler } // namespace protobuf } // namespace google -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1]; -static constexpr const ::_pb::ServiceDescriptor** +static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL + file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1]; +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -239,7 +240,7 @@ static const ::_pbi::MigrationSchema {34, 46, -1, sizeof(::google::protobuf::compiler::CodeGeneratorResponse_File)}, {50, 63, -1, sizeof(::google::protobuf::compiler::CodeGeneratorResponse)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::compiler::_Version_default_instance_._instance, &::google::protobuf::compiler::_CodeGeneratorRequest_default_instance_._instance, &::google::protobuf::compiler::_CodeGeneratorResponse_File_default_instance_._instance, @@ -272,8 +273,8 @@ const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2epro "osZ)google.golang.org/protobuf/types/plu" "ginpb\252\002\030Google.Protobuf.Compiler" }; -static const ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps[1] = - { +static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const + descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps[1] = { &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, }; static ::absl::once_flag descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once; @@ -296,27 +297,12 @@ PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fproto namespace google { namespace protobuf { namespace compiler { -const ::google::protobuf::EnumDescriptor* CodeGeneratorResponse_Feature_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL CodeGeneratorResponse_Feature_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[0]; } PROTOBUF_CONSTINIT const uint32_t CodeGeneratorResponse_Feature_internal_data_[] = { 196608u, 0u, }; -bool CodeGeneratorResponse_Feature_IsValid(int value) { - return 0 <= value && value <= 2; -} -#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_SUPPORTS_EDITIONS; -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 && _MSC_VER < 1912)) // =================================================================== class Version::_Internal { @@ -327,27 +313,28 @@ class Version::_Internal { 8 * PROTOBUF_FIELD_OFFSET(Version, _impl_._has_bits_); }; -Version::Version(::google::protobuf::Arena* arena) +Version::Version(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Version_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.Version) } -inline PROTOBUF_NDEBUG_INLINE Version::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::compiler::Version& from_msg) +PROTOBUF_NDEBUG_INLINE Version::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::compiler::Version& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, suffix_(arena, from.suffix_) {} Version::Version( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Version& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Version_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -366,13 +353,13 @@ Version::Version( // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) } -inline PROTOBUF_NDEBUG_INLINE Version::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Version::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, suffix_(arena) {} -inline void Version::SharedCtor(::_pb::Arena* arena) { +inline void Version::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, major_), @@ -393,43 +380,51 @@ inline void Version::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Version::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Version::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Version(arena); } constexpr auto Version::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Version), alignof(Version)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Version::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Version_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Version::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Version>(), +constexpr auto Version::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Version_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Version::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Version>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Version::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Version>(), &Version::ByteSizeLong, - &Version::_InternalSerialize, + &Version::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Version>(), &Version::ByteSizeLong, + &Version::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Version, _impl_._cached_size_), - false, - }, - &Version::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Version::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Version, _impl_._cached_size_), + false, + }, + &Version::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOC_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Version_class_data_ = + Version::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Version::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Version_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Version_class_data_.tc_table); + return Version_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 4, 0, 47, 2> Version::_table_ = { +const ::_pbi::TcParseTable<2, 4, 0, 47, 2> +Version::_table_ = { { PROTOBUF_FIELD_OFFSET(Version, _impl_._has_bits_), 0, // no _extensions_ @@ -440,7 +435,7 @@ const ::_pbi::TcParseTable<2, 4, 0, 47, 2> Version::_table_ = { 4, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Version_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -482,7 +477,6 @@ const ::_pbi::TcParseTable<2, 4, 0, 47, 2> Version::_table_ = { "suffix" }}, }; - PROTOBUF_NOINLINE void Version::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -491,10 +485,10 @@ PROTOBUF_NOINLINE void Version::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.suffix_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x0000000eu) { + if ((cached_has_bits & 0x0000000eu) != 0) { ::memset(&_impl_.major_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.patch_) - reinterpret_cast<char*>(&_impl_.major_)) + sizeof(_impl_.patch_)); @@ -504,100 +498,100 @@ PROTOBUF_NOINLINE void Version::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Version::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Version& this_ = static_cast<const Version&>(base); +::uint8_t* PROTOBUF_NONNULL Version::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Version& this_ = static_cast<const Version&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Version::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Version& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Version::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Version& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 major = 1; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this_._internal_major(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional int32 major = 1; + if ((cached_has_bits & 0x00000002u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( + stream, this_._internal_major(), target); + } - // optional int32 minor = 2; - if (cached_has_bits & 0x00000004u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_minor(), target); - } + // optional int32 minor = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_minor(), target); + } - // optional int32 patch = 3; - if (cached_has_bits & 0x00000008u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this_._internal_patch(), target); - } + // optional int32 patch = 3; + if ((cached_has_bits & 0x00000008u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<3>( + stream, this_._internal_patch(), target); + } - // optional string suffix = 4; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_suffix(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.Version.suffix"); - target = stream->WriteStringMaybeAliased(4, _s, target); - } + // optional string suffix = 4; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_suffix(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.Version.suffix"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.Version) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.Version) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Version::ByteSizeLong(const MessageLite& base) { - const Version& this_ = static_cast<const Version&>(base); +::size_t Version::ByteSizeLong(const MessageLite& base) { + const Version& this_ = static_cast<const Version&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Version::ByteSizeLong() const { - const Version& this_ = *this; +::size_t Version::ByteSizeLong() const { + const Version& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional string suffix = 4; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_suffix()); - } - // optional int32 major = 1; - if (cached_has_bits & 0x00000002u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_major()); - } - // optional int32 minor = 2; - if (cached_has_bits & 0x00000004u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_minor()); - } - // optional int32 patch = 3; - if (cached_has_bits & 0x00000008u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_patch()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // optional string suffix = 4; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_suffix()); + } + // optional int32 major = 1; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_major()); + } + // optional int32 minor = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_minor()); + } + // optional int32 patch = 3; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_patch()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Version::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Version*>(&to_msg); @@ -608,17 +602,17 @@ void Version::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google: (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_suffix(from._internal_suffix()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.major_ = from._impl_.major_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.minor_ = from._impl_.minor_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.patch_ = from._impl_.patch_; } } @@ -634,7 +628,7 @@ void Version::CopyFrom(const Version& from) { } -void Version::InternalSwap(Version* PROTOBUF_RESTRICT other) { +void Version::InternalSwap(Version* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -670,18 +664,19 @@ void CodeGeneratorRequest::clear_source_file_descriptors() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.source_file_descriptors_.Clear(); } -CodeGeneratorRequest::CodeGeneratorRequest(::google::protobuf::Arena* arena) +CodeGeneratorRequest::CodeGeneratorRequest(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, CodeGeneratorRequest_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorRequest) } -inline PROTOBUF_NDEBUG_INLINE CodeGeneratorRequest::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::compiler::CodeGeneratorRequest& from_msg) +PROTOBUF_NDEBUG_INLINE CodeGeneratorRequest::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::compiler::CodeGeneratorRequest& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, file_to_generate_{visibility, arena, from.file_to_generate_}, @@ -690,10 +685,10 @@ inline PROTOBUF_NDEBUG_INLINE CodeGeneratorRequest::Impl_::Impl_( parameter_(arena, from.parameter_) {} CodeGeneratorRequest::CodeGeneratorRequest( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CodeGeneratorRequest& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, CodeGeneratorRequest_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -703,22 +698,22 @@ CodeGeneratorRequest::CodeGeneratorRequest( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.compiler_version_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::compiler::Version>( - arena, *from._impl_.compiler_version_) - : nullptr; + _impl_.compiler_version_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.compiler_version_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest) } -inline PROTOBUF_NDEBUG_INLINE CodeGeneratorRequest::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE CodeGeneratorRequest::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, file_to_generate_{visibility, arena}, proto_file_{visibility, arena}, source_file_descriptors_{visibility, arena}, parameter_(arena) {} -inline void CodeGeneratorRequest::SharedCtor(::_pb::Arena* arena) { +inline void CodeGeneratorRequest::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.compiler_version_ = {}; } @@ -735,8 +730,9 @@ inline void CodeGeneratorRequest::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* CodeGeneratorRequest::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL CodeGeneratorRequest::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) CodeGeneratorRequest(arena); } constexpr auto CodeGeneratorRequest::InternalNewImpl_() { @@ -763,35 +759,42 @@ constexpr auto CodeGeneratorRequest::InternalNewImpl_() { alignof(CodeGeneratorRequest)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull CodeGeneratorRequest::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_CodeGeneratorRequest_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - CodeGeneratorRequest::IsInitializedImpl, - &CodeGeneratorRequest::MergeImpl, - ::google::protobuf::Message::GetNewImpl<CodeGeneratorRequest>(), +constexpr auto CodeGeneratorRequest::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_CodeGeneratorRequest_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + CodeGeneratorRequest::IsInitializedImpl, + &CodeGeneratorRequest::MergeImpl, + ::google::protobuf::Message::GetNewImpl<CodeGeneratorRequest>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &CodeGeneratorRequest::SharedDtor, - ::google::protobuf::Message::GetClearImpl<CodeGeneratorRequest>(), &CodeGeneratorRequest::ByteSizeLong, - &CodeGeneratorRequest::_InternalSerialize, + &CodeGeneratorRequest::SharedDtor, + ::google::protobuf::Message::GetClearImpl<CodeGeneratorRequest>(), &CodeGeneratorRequest::ByteSizeLong, + &CodeGeneratorRequest::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_._cached_size_), - false, - }, - &CodeGeneratorRequest::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* CodeGeneratorRequest::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_._cached_size_), + false, + }, + &CodeGeneratorRequest::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOC_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + CodeGeneratorRequest_class_data_ = + CodeGeneratorRequest::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL CodeGeneratorRequest::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&CodeGeneratorRequest_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(CodeGeneratorRequest_class_data_.tc_table); + return CodeGeneratorRequest_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 5, 3, 79, 2> CodeGeneratorRequest::_table_ = { +const ::_pbi::TcParseTable<3, 5, 3, 79, 2> +CodeGeneratorRequest::_table_ = { { PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_._has_bits_), 0, // no _extensions_ @@ -802,7 +805,7 @@ const ::_pbi::TcParseTable<3, 5, 3, 79, 2> CodeGeneratorRequest::_table_ = { 5, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + CodeGeneratorRequest_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -843,18 +846,19 @@ const ::_pbi::TcParseTable<3, 5, 3, 79, 2> CodeGeneratorRequest::_table_ = { // repeated .google.protobuf.FileDescriptorProto source_file_descriptors = 17; {PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_.source_file_descriptors_), -1, 2, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::compiler::Version>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorProto>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::compiler::Version>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorProto>()}, + }}, + {{ "\55\20\11\0\0\0\0\0" "google.protobuf.compiler.CodeGeneratorRequest" "file_to_generate" "parameter" }}, }; - PROTOBUF_NOINLINE void CodeGeneratorRequest::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -866,11 +870,11 @@ PROTOBUF_NOINLINE void CodeGeneratorRequest::Clear() { _impl_.proto_file_.Clear(); _impl_.source_file_descriptors_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.parameter_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.compiler_version_ != nullptr); _impl_.compiler_version_->Clear(); } @@ -880,131 +884,131 @@ PROTOBUF_NOINLINE void CodeGeneratorRequest::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* CodeGeneratorRequest::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const CodeGeneratorRequest& this_ = static_cast<const CodeGeneratorRequest&>(base); +::uint8_t* PROTOBUF_NONNULL CodeGeneratorRequest::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const CodeGeneratorRequest& this_ = static_cast<const CodeGeneratorRequest&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* CodeGeneratorRequest::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const CodeGeneratorRequest& this_ = *this; +::uint8_t* PROTOBUF_NONNULL CodeGeneratorRequest::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const CodeGeneratorRequest& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated string file_to_generate = 1; - for (int i = 0, n = this_._internal_file_to_generate_size(); i < n; ++i) { - const auto& s = this_._internal_file_to_generate().Get(i); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); - target = stream->WriteString(1, s, target); - } + // repeated string file_to_generate = 1; + for (int i = 0, n = this_._internal_file_to_generate_size(); i < n; ++i) { + const auto& s = this_._internal_file_to_generate().Get(i); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate"); + target = stream->WriteString(1, s, target); + } - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string parameter = 2; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_parameter(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorRequest.parameter"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string parameter = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_parameter(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorRequest.parameter"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // optional .google.protobuf.compiler.Version compiler_version = 3; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.compiler_version_, this_._impl_.compiler_version_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.compiler.Version compiler_version = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, *this_._impl_.compiler_version_, this_._impl_.compiler_version_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_proto_file_size()); - i < n; i++) { - const auto& repfield = this_._internal_proto_file().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 15, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_proto_file_size()); + i < n; i++) { + const auto& repfield = this_._internal_proto_file().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 15, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.FileDescriptorProto source_file_descriptors = 17; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_source_file_descriptors_size()); - i < n; i++) { - const auto& repfield = this_._internal_source_file_descriptors().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 17, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FileDescriptorProto source_file_descriptors = 17; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_source_file_descriptors_size()); + i < n; i++) { + const auto& repfield = this_._internal_source_file_descriptors().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 17, repfield, repfield.GetCachedSize(), + target, stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorRequest) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorRequest) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t CodeGeneratorRequest::ByteSizeLong(const MessageLite& base) { - const CodeGeneratorRequest& this_ = static_cast<const CodeGeneratorRequest&>(base); +::size_t CodeGeneratorRequest::ByteSizeLong(const MessageLite& base) { + const CodeGeneratorRequest& this_ = static_cast<const CodeGeneratorRequest&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t CodeGeneratorRequest::ByteSizeLong() const { - const CodeGeneratorRequest& this_ = *this; +::size_t CodeGeneratorRequest::ByteSizeLong() const { + const CodeGeneratorRequest& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated string file_to_generate = 1; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_file_to_generate().size()); - for (int i = 0, n = this_._internal_file_to_generate().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_file_to_generate().Get(i)); - } - } - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; - { - total_size += 1UL * this_._internal_proto_file_size(); - for (const auto& msg : this_._internal_proto_file()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.FileDescriptorProto source_file_descriptors = 17; - { - total_size += 2UL * this_._internal_source_file_descriptors_size(); - for (const auto& msg : this_._internal_source_file_descriptors()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string parameter = 2; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_parameter()); - } - // optional .google.protobuf.compiler.Version compiler_version = 3; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.compiler_version_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated string file_to_generate = 1; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_file_to_generate().size()); + for (int i = 0, n = this_._internal_file_to_generate().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_file_to_generate().Get(i)); + } + } + // repeated .google.protobuf.FileDescriptorProto proto_file = 15; + { + total_size += 1UL * this_._internal_proto_file_size(); + for (const auto& msg : this_._internal_proto_file()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.FileDescriptorProto source_file_descriptors = 17; + { + total_size += 2UL * this_._internal_source_file_descriptors_size(); + for (const auto& msg : this_._internal_source_file_descriptors()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional string parameter = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_parameter()); + } + // optional .google.protobuf.compiler.Version compiler_version = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.compiler_version_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void CodeGeneratorRequest::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<CodeGeneratorRequest*>(&to_msg); @@ -1021,15 +1025,14 @@ void CodeGeneratorRequest::MergeImpl(::google::protobuf::MessageLite& to_msg, co _this->_internal_mutable_source_file_descriptors()->MergeFrom( from._internal_source_file_descriptors()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_parameter(from._internal_parameter()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.compiler_version_ != nullptr); if (_this->_impl_.compiler_version_ == nullptr) { - _this->_impl_.compiler_version_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::compiler::Version>(arena, *from._impl_.compiler_version_); + _this->_impl_.compiler_version_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.compiler_version_); } else { _this->_impl_.compiler_version_->MergeFrom(*from._impl_.compiler_version_); } @@ -1056,7 +1059,7 @@ PROTOBUF_NOINLINE bool CodeGeneratorRequest::IsInitializedImpl( return true; } -void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* PROTOBUF_RESTRICT other) { +void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -1087,18 +1090,19 @@ void CodeGeneratorResponse_File::clear_generated_code_info() { if (_impl_.generated_code_info_ != nullptr) _impl_.generated_code_info_->Clear(); _impl_._has_bits_[0] &= ~0x00000008u; } -CodeGeneratorResponse_File::CodeGeneratorResponse_File(::google::protobuf::Arena* arena) +CodeGeneratorResponse_File::CodeGeneratorResponse_File(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, CodeGeneratorResponse_File_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) } -inline PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse_File::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::compiler::CodeGeneratorResponse_File& from_msg) +PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse_File::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::compiler::CodeGeneratorResponse_File& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_(arena, from.name_), @@ -1106,10 +1110,10 @@ inline PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse_File::Impl_::Impl_( content_(arena, from.content_) {} CodeGeneratorResponse_File::CodeGeneratorResponse_File( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CodeGeneratorResponse_File& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, CodeGeneratorResponse_File_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1119,21 +1123,21 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.generated_code_info_ = (cached_has_bits & 0x00000008u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::GeneratedCodeInfo>( - arena, *from._impl_.generated_code_info_) - : nullptr; + _impl_.generated_code_info_ = ((cached_has_bits & 0x00000008u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.generated_code_info_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) } -inline PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse_File::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse_File::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_(arena), insertion_point_(arena), content_(arena) {} -inline void CodeGeneratorResponse_File::SharedCtor(::_pb::Arena* arena) { +inline void CodeGeneratorResponse_File::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.generated_code_info_ = {}; } @@ -1152,43 +1156,51 @@ inline void CodeGeneratorResponse_File::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* CodeGeneratorResponse_File::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL CodeGeneratorResponse_File::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) CodeGeneratorResponse_File(arena); } constexpr auto CodeGeneratorResponse_File::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(CodeGeneratorResponse_File), alignof(CodeGeneratorResponse_File)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse_File::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_CodeGeneratorResponse_File_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &CodeGeneratorResponse_File::MergeImpl, - ::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse_File>(), +constexpr auto CodeGeneratorResponse_File::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_CodeGeneratorResponse_File_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &CodeGeneratorResponse_File::MergeImpl, + ::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse_File>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &CodeGeneratorResponse_File::SharedDtor, - ::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse_File>(), &CodeGeneratorResponse_File::ByteSizeLong, - &CodeGeneratorResponse_File::_InternalSerialize, + &CodeGeneratorResponse_File::SharedDtor, + ::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse_File>(), &CodeGeneratorResponse_File::ByteSizeLong, + &CodeGeneratorResponse_File::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse_File, _impl_._cached_size_), - false, - }, - &CodeGeneratorResponse_File::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* CodeGeneratorResponse_File::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse_File, _impl_._cached_size_), + false, + }, + &CodeGeneratorResponse_File::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOC_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + CodeGeneratorResponse_File_class_data_ = + CodeGeneratorResponse_File::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL CodeGeneratorResponse_File::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&CodeGeneratorResponse_File_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(CodeGeneratorResponse_File_class_data_.tc_table); + return CodeGeneratorResponse_File_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 4, 1, 86, 2> CodeGeneratorResponse_File::_table_ = { +const ::_pbi::TcParseTable<2, 4, 1, 86, 2> +CodeGeneratorResponse_File::_table_ = { { PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse_File, _impl_._has_bits_), 0, // no _extensions_ @@ -1199,7 +1211,7 @@ const ::_pbi::TcParseTable<2, 4, 1, 86, 2> CodeGeneratorResponse_File::_table_ = 4, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + CodeGeneratorResponse_File_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1233,9 +1245,11 @@ const ::_pbi::TcParseTable<2, 4, 1, 86, 2> CodeGeneratorResponse_File::_table_ = // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; {PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse_File, _impl_.generated_code_info_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::GeneratedCodeInfo>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::GeneratedCodeInfo>()}, + }}, + {{ "\63\4\17\7\0\0\0\0" "google.protobuf.compiler.CodeGeneratorResponse.File" "name" @@ -1243,7 +1257,6 @@ const ::_pbi::TcParseTable<2, 4, 1, 86, 2> CodeGeneratorResponse_File::_table_ = "content" }}, }; - PROTOBUF_NOINLINE void CodeGeneratorResponse_File::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1252,17 +1265,17 @@ PROTOBUF_NOINLINE void CodeGeneratorResponse_File::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.insertion_point_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _impl_.content_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { ABSL_DCHECK(_impl_.generated_code_info_ != nullptr); _impl_.generated_code_info_->Clear(); } @@ -1272,102 +1285,102 @@ PROTOBUF_NOINLINE void CodeGeneratorResponse_File::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* CodeGeneratorResponse_File::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const CodeGeneratorResponse_File& this_ = static_cast<const CodeGeneratorResponse_File&>(base); +::uint8_t* PROTOBUF_NONNULL CodeGeneratorResponse_File::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const CodeGeneratorResponse_File& this_ = static_cast<const CodeGeneratorResponse_File&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* CodeGeneratorResponse_File::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const CodeGeneratorResponse_File& this_ = *this; +::uint8_t* PROTOBUF_NONNULL CodeGeneratorResponse_File::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const CodeGeneratorResponse_File& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.File.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.File.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional string insertion_point = 2; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_insertion_point(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + // optional string insertion_point = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_insertion_point(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // optional string content = 15; - if (cached_has_bits & 0x00000004u) { - const std::string& _s = this_._internal_content(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.File.content"); - target = stream->WriteStringMaybeAliased(15, _s, target); - } + // optional string content = 15; + if ((cached_has_bits & 0x00000004u) != 0) { + const std::string& _s = this_._internal_content(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.File.content"); + target = stream->WriteStringMaybeAliased(15, _s, target); + } - // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; - if (cached_has_bits & 0x00000008u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 16, *this_._impl_.generated_code_info_, this_._impl_.generated_code_info_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; + if ((cached_has_bits & 0x00000008u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 16, *this_._impl_.generated_code_info_, this_._impl_.generated_code_info_->GetCachedSize(), target, + stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse.File) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse.File) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t CodeGeneratorResponse_File::ByteSizeLong(const MessageLite& base) { - const CodeGeneratorResponse_File& this_ = static_cast<const CodeGeneratorResponse_File&>(base); +::size_t CodeGeneratorResponse_File::ByteSizeLong(const MessageLite& base) { + const CodeGeneratorResponse_File& this_ = static_cast<const CodeGeneratorResponse_File&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t CodeGeneratorResponse_File::ByteSizeLong() const { - const CodeGeneratorResponse_File& this_ = *this; +::size_t CodeGeneratorResponse_File::ByteSizeLong() const { + const CodeGeneratorResponse_File& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional string insertion_point = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_insertion_point()); - } - // optional string content = 15; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_content()); - } - // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; - if (cached_has_bits & 0x00000008u) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.generated_code_info_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional string insertion_point = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_insertion_point()); + } + // optional string content = 15; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_content()); + } + // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.generated_code_info_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void CodeGeneratorResponse_File::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<CodeGeneratorResponse_File*>(&to_msg); @@ -1379,21 +1392,20 @@ void CodeGeneratorResponse_File::MergeImpl(::google::protobuf::MessageLite& to_m (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_insertion_point(from._internal_insertion_point()); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_internal_set_content(from._internal_content()); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { ABSL_DCHECK(from._impl_.generated_code_info_ != nullptr); if (_this->_impl_.generated_code_info_ == nullptr) { - _this->_impl_.generated_code_info_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::GeneratedCodeInfo>(arena, *from._impl_.generated_code_info_); + _this->_impl_.generated_code_info_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.generated_code_info_); } else { _this->_impl_.generated_code_info_->MergeFrom(*from._impl_.generated_code_info_); } @@ -1411,7 +1423,7 @@ void CodeGeneratorResponse_File::CopyFrom(const CodeGeneratorResponse_File& from } -void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* PROTOBUF_RESTRICT other) { +void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -1436,28 +1448,29 @@ class CodeGeneratorResponse::_Internal { 8 * PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_._has_bits_); }; -CodeGeneratorResponse::CodeGeneratorResponse(::google::protobuf::Arena* arena) +CodeGeneratorResponse::CodeGeneratorResponse(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, CodeGeneratorResponse_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.compiler.CodeGeneratorResponse) } -inline PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::compiler::CodeGeneratorResponse& from_msg) +PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::compiler::CodeGeneratorResponse& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, file_{visibility, arena, from.file_}, error_(arena, from.error_) {} CodeGeneratorResponse::CodeGeneratorResponse( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CodeGeneratorResponse& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, CodeGeneratorResponse_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1476,14 +1489,14 @@ CodeGeneratorResponse::CodeGeneratorResponse( // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse) } -inline PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE CodeGeneratorResponse::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, file_{visibility, arena}, error_(arena) {} -inline void CodeGeneratorResponse::SharedCtor(::_pb::Arena* arena) { +inline void CodeGeneratorResponse::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, supported_features_), @@ -1504,8 +1517,9 @@ inline void CodeGeneratorResponse::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* CodeGeneratorResponse::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL CodeGeneratorResponse::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) CodeGeneratorResponse(arena); } constexpr auto CodeGeneratorResponse::InternalNewImpl_() { @@ -1524,35 +1538,42 @@ constexpr auto CodeGeneratorResponse::InternalNewImpl_() { alignof(CodeGeneratorResponse)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_CodeGeneratorResponse_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &CodeGeneratorResponse::MergeImpl, - ::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse>(), +constexpr auto CodeGeneratorResponse::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_CodeGeneratorResponse_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &CodeGeneratorResponse::MergeImpl, + ::google::protobuf::Message::GetNewImpl<CodeGeneratorResponse>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &CodeGeneratorResponse::SharedDtor, - ::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse>(), &CodeGeneratorResponse::ByteSizeLong, - &CodeGeneratorResponse::_InternalSerialize, + &CodeGeneratorResponse::SharedDtor, + ::google::protobuf::Message::GetClearImpl<CodeGeneratorResponse>(), &CodeGeneratorResponse::ByteSizeLong, + &CodeGeneratorResponse::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_._cached_size_), - false, - }, - &CodeGeneratorResponse::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* CodeGeneratorResponse::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_._cached_size_), + false, + }, + &CodeGeneratorResponse::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOC_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + CodeGeneratorResponse_class_data_ = + CodeGeneratorResponse::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL CodeGeneratorResponse::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&CodeGeneratorResponse_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(CodeGeneratorResponse_class_data_.tc_table); + return CodeGeneratorResponse_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 5, 1, 60, 2> CodeGeneratorResponse::_table_ = { +const ::_pbi::TcParseTable<3, 5, 1, 60, 2> +CodeGeneratorResponse::_table_ = { { PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_._has_bits_), 0, // no _extensions_ @@ -1563,7 +1584,7 @@ const ::_pbi::TcParseTable<3, 5, 1, 60, 2> CodeGeneratorResponse::_table_ = { 5, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + CodeGeneratorResponse_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1606,15 +1627,16 @@ const ::_pbi::TcParseTable<3, 5, 1, 60, 2> CodeGeneratorResponse::_table_ = { // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; {PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_.file_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::compiler::CodeGeneratorResponse_File>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::compiler::CodeGeneratorResponse_File>()}, + }}, + {{ "\56\5\0\0\0\0\0\0" "google.protobuf.compiler.CodeGeneratorResponse" "error" }}, }; - PROTOBUF_NOINLINE void CodeGeneratorResponse::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1624,10 +1646,10 @@ PROTOBUF_NOINLINE void CodeGeneratorResponse::Clear() { _impl_.file_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.error_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x0000000eu) { + if ((cached_has_bits & 0x0000000eu) != 0) { ::memset(&_impl_.supported_features_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.maximum_edition_) - reinterpret_cast<char*>(&_impl_.supported_features_)) + sizeof(_impl_.maximum_edition_)); @@ -1637,120 +1659,120 @@ PROTOBUF_NOINLINE void CodeGeneratorResponse::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* CodeGeneratorResponse::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const CodeGeneratorResponse& this_ = static_cast<const CodeGeneratorResponse&>(base); +::uint8_t* PROTOBUF_NONNULL CodeGeneratorResponse::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const CodeGeneratorResponse& this_ = static_cast<const CodeGeneratorResponse&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* CodeGeneratorResponse::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const CodeGeneratorResponse& this_ = *this; +::uint8_t* PROTOBUF_NONNULL CodeGeneratorResponse::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const CodeGeneratorResponse& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string error = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_error(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.compiler.CodeGeneratorResponse.error"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string error = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_error(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.compiler.CodeGeneratorResponse.error"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional uint64 supported_features = 2; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 2, this_._internal_supported_features(), target); - } + // optional uint64 supported_features = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray( + 2, this_._internal_supported_features(), target); + } - // optional int32 minimum_edition = 3; - if (cached_has_bits & 0x00000004u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this_._internal_minimum_edition(), target); - } + // optional int32 minimum_edition = 3; + if ((cached_has_bits & 0x00000004u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<3>( + stream, this_._internal_minimum_edition(), target); + } - // optional int32 maximum_edition = 4; - if (cached_has_bits & 0x00000008u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<4>( - stream, this_._internal_maximum_edition(), target); - } + // optional int32 maximum_edition = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<4>( + stream, this_._internal_maximum_edition(), target); + } - // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_file_size()); - i < n; i++) { - const auto& repfield = this_._internal_file().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 15, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_file_size()); + i < n; i++) { + const auto& repfield = this_._internal_file().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 15, repfield, repfield.GetCachedSize(), + target, stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.compiler.CodeGeneratorResponse) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t CodeGeneratorResponse::ByteSizeLong(const MessageLite& base) { - const CodeGeneratorResponse& this_ = static_cast<const CodeGeneratorResponse&>(base); +::size_t CodeGeneratorResponse::ByteSizeLong(const MessageLite& base) { + const CodeGeneratorResponse& this_ = static_cast<const CodeGeneratorResponse&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t CodeGeneratorResponse::ByteSizeLong() const { - const CodeGeneratorResponse& this_ = *this; +::size_t CodeGeneratorResponse::ByteSizeLong() const { + const CodeGeneratorResponse& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; - { - total_size += 1UL * this_._internal_file_size(); - for (const auto& msg : this_._internal_file()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional string error = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_error()); - } - // optional uint64 supported_features = 2; - if (cached_has_bits & 0x00000002u) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_supported_features()); - } - // optional int32 minimum_edition = 3; - if (cached_has_bits & 0x00000004u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_minimum_edition()); - } - // optional int32 maximum_edition = 4; - if (cached_has_bits & 0x00000008u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_maximum_edition()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; + { + total_size += 1UL * this_._internal_file_size(); + for (const auto& msg : this_._internal_file()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // optional string error = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_error()); + } + // optional uint64 supported_features = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( + this_._internal_supported_features()); + } + // optional int32 minimum_edition = 3; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_minimum_edition()); + } + // optional int32 maximum_edition = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_maximum_edition()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void CodeGeneratorResponse::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<CodeGeneratorResponse*>(&to_msg); @@ -1763,17 +1785,17 @@ void CodeGeneratorResponse::MergeImpl(::google::protobuf::MessageLite& to_msg, c _this->_internal_mutable_file()->MergeFrom( from._internal_file()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_error(from._internal_error()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.supported_features_ = from._impl_.supported_features_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.minimum_edition_ = from._impl_.minimum_edition_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.maximum_edition_ = from._impl_.maximum_edition_; } } @@ -1789,7 +1811,7 @@ void CodeGeneratorResponse::CopyFrom(const CodeGeneratorResponse& from) { } -void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* PROTOBUF_RESTRICT other) { +void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -1818,7 +1840,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.h b/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.h index ec6db2f33133f..4ff61ab87d89c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.h +++ b/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/compiler/plugin.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fcompiler_2fplugin_2eproto_2epb_2eh #define google_2fprotobuf_2fcompiler_2fplugin_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -57,24 +57,34 @@ template <typename T> struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto { static const ::uint32_t offsets[]; }; -PROTOC_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto; +extern "C" { +PROTOC_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto; +} // extern "C" namespace google { namespace protobuf { namespace compiler { +enum CodeGeneratorResponse_Feature : int; +PROTOC_EXPORT extern const uint32_t CodeGeneratorResponse_Feature_internal_data_[]; class CodeGeneratorRequest; struct CodeGeneratorRequestDefaultTypeInternal; PROTOC_EXPORT extern CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_; +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull CodeGeneratorRequest_class_data_; class CodeGeneratorResponse; struct CodeGeneratorResponseDefaultTypeInternal; PROTOC_EXPORT extern CodeGeneratorResponseDefaultTypeInternal _CodeGeneratorResponse_default_instance_; +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse_class_data_; class CodeGeneratorResponse_File; struct CodeGeneratorResponse_FileDefaultTypeInternal; PROTOC_EXPORT extern CodeGeneratorResponse_FileDefaultTypeInternal _CodeGeneratorResponse_File_default_instance_; +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse_File_class_data_; class Version; struct VersionDefaultTypeInternal; PROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_; +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull Version_class_data_; } // namespace compiler +template <> +internal::EnumTraitsT<::google::protobuf::compiler::CodeGeneratorResponse_Feature_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::compiler::CodeGeneratorResponse_Feature>; } // namespace protobuf } // namespace google @@ -87,13 +97,16 @@ enum CodeGeneratorResponse_Feature : int { CodeGeneratorResponse_Feature_FEATURE_SUPPORTS_EDITIONS = 2, }; -PROTOC_EXPORT bool CodeGeneratorResponse_Feature_IsValid(int value); PROTOC_EXPORT extern const uint32_t CodeGeneratorResponse_Feature_internal_data_[]; -constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MIN = static_cast<CodeGeneratorResponse_Feature>(0); -constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MAX = static_cast<CodeGeneratorResponse_Feature>(2); -constexpr int CodeGeneratorResponse_Feature_Feature_ARRAYSIZE = 2 + 1; -PROTOC_EXPORT const ::google::protobuf::EnumDescriptor* -CodeGeneratorResponse_Feature_descriptor(); +inline constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MIN = + static_cast<CodeGeneratorResponse_Feature>(0); +inline constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MAX = + static_cast<CodeGeneratorResponse_Feature>(2); +inline bool CodeGeneratorResponse_Feature_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int CodeGeneratorResponse_Feature_Feature_ARRAYSIZE = 2 + 1; +PROTOC_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL CodeGeneratorResponse_Feature_descriptor(); template <typename T> const std::string& CodeGeneratorResponse_Feature_Name(T value) { static_assert(std::is_same<T, CodeGeneratorResponse_Feature>::value || @@ -103,13 +116,13 @@ const std::string& CodeGeneratorResponse_Feature_Name(T value) { } template <> inline const std::string& CodeGeneratorResponse_Feature_Name(CodeGeneratorResponse_Feature value) { - return ::google::protobuf::internal::NameOfDenseEnum<CodeGeneratorResponse_Feature_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<CodeGeneratorResponse_Feature_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool CodeGeneratorResponse_Feature_Parse(absl::string_view name, CodeGeneratorResponse_Feature* value) { - return ::google::protobuf::internal::ParseNamedEnum<CodeGeneratorResponse_Feature>( - CodeGeneratorResponse_Feature_descriptor(), name, value); +inline bool CodeGeneratorResponse_Feature_Parse( + absl::string_view name, CodeGeneratorResponse_Feature* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<CodeGeneratorResponse_Feature>(CodeGeneratorResponse_Feature_descriptor(), name, + value); } // =================================================================== @@ -124,15 +137,14 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message ~Version() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Version* msg, std::destroying_delete_t) { + void operator delete(Version* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Version)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Version( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Version(::google::protobuf::internal::ConstantInitialized); inline Version(const Version& from) : Version(nullptr, from) {} inline Version(Version&& from) noexcept @@ -155,30 +167,27 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Version& default_instance() { - return *internal_default_instance(); - } - static inline const Version* internal_default_instance() { - return reinterpret_cast<const Version*>( + return *reinterpret_cast<const Version*>( &_Version_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(Version& a, Version& b) { a.Swap(&b); } - inline void Swap(Version* other) { + inline void Swap(Version* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -186,7 +195,7 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Version* other) { + void UnsafeArenaSwap(Version* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -194,7 +203,7 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Version* New(::google::protobuf::Arena* arena = nullptr) const { + Version* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Version>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -203,9 +212,8 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message void MergeFrom(const Version& from) { Version::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -215,49 +223,51 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Version* other); + void InternalSwap(Version* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.compiler.Version"; } protected: - explicit Version(::google::protobuf::Arena* arena); - Version(::google::protobuf::Arena* arena, const Version& from); - Version(::google::protobuf::Arena* arena, Version&& from) noexcept + explicit Version(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Version(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Version& from); + Version( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Version&& from) noexcept : Version(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -274,15 +284,14 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message const std::string& suffix() const; template <typename Arg_ = const std::string&, typename... Args_> void set_suffix(Arg_&& arg, Args_... args); - std::string* mutable_suffix(); - PROTOBUF_NODISCARD std::string* release_suffix(); - void set_allocated_suffix(std::string* value); + std::string* PROTOBUF_NONNULL mutable_suffix(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_suffix(); + void set_allocated_suffix(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_suffix() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_suffix( - const std::string& value); - std::string* _internal_mutable_suffix(); + PROTOBUF_ALWAYS_INLINE void _internal_set_suffix(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_suffix(); public: // optional int32 major = 1; @@ -322,9 +331,9 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 4, 0, - 47, 2> + static const ::google::protobuf::internal::TcParseTable<2, 4, + 0, 47, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -334,13 +343,14 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Version& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Version& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr suffix_; @@ -352,6 +362,8 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; + +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull Version_class_data_; // ------------------------------------------------------------------- class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf::Message @@ -361,15 +373,14 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf ~CodeGeneratorResponse_File() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(CodeGeneratorResponse_File* msg, std::destroying_delete_t) { + void operator delete(CodeGeneratorResponse_File* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(CodeGeneratorResponse_File)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR CodeGeneratorResponse_File( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR CodeGeneratorResponse_File(::google::protobuf::internal::ConstantInitialized); inline CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from) : CodeGeneratorResponse_File(nullptr, from) {} inline CodeGeneratorResponse_File(CodeGeneratorResponse_File&& from) noexcept @@ -392,30 +403,27 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const CodeGeneratorResponse_File& default_instance() { - return *internal_default_instance(); - } - static inline const CodeGeneratorResponse_File* internal_default_instance() { - return reinterpret_cast<const CodeGeneratorResponse_File*>( + return *reinterpret_cast<const CodeGeneratorResponse_File*>( &_CodeGeneratorResponse_File_default_instance_); } static constexpr int kIndexInFileMessages = 2; friend void swap(CodeGeneratorResponse_File& a, CodeGeneratorResponse_File& b) { a.Swap(&b); } - inline void Swap(CodeGeneratorResponse_File* other) { + inline void Swap(CodeGeneratorResponse_File* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -423,7 +431,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(CodeGeneratorResponse_File* other) { + void UnsafeArenaSwap(CodeGeneratorResponse_File* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -431,7 +439,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf // implements Message ---------------------------------------------- - CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena = nullptr) const { + CodeGeneratorResponse_File* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<CodeGeneratorResponse_File>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -440,9 +448,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf void MergeFrom(const CodeGeneratorResponse_File& from) { CodeGeneratorResponse_File::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -452,49 +459,51 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(CodeGeneratorResponse_File* other); + void InternalSwap(CodeGeneratorResponse_File* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.compiler.CodeGeneratorResponse.File"; } protected: - explicit CodeGeneratorResponse_File(::google::protobuf::Arena* arena); - CodeGeneratorResponse_File(::google::protobuf::Arena* arena, const CodeGeneratorResponse_File& from); - CodeGeneratorResponse_File(::google::protobuf::Arena* arena, CodeGeneratorResponse_File&& from) noexcept + explicit CodeGeneratorResponse_File(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + CodeGeneratorResponse_File(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CodeGeneratorResponse_File& from); + CodeGeneratorResponse_File( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, CodeGeneratorResponse_File&& from) noexcept : CodeGeneratorResponse_File(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -511,15 +520,14 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional string insertion_point = 2; @@ -528,15 +536,14 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf const std::string& insertion_point() const; template <typename Arg_ = const std::string&, typename... Args_> void set_insertion_point(Arg_&& arg, Args_... args); - std::string* mutable_insertion_point(); - PROTOBUF_NODISCARD std::string* release_insertion_point(); - void set_allocated_insertion_point(std::string* value); + std::string* PROTOBUF_NONNULL mutable_insertion_point(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_insertion_point(); + void set_allocated_insertion_point(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_insertion_point() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_insertion_point( - const std::string& value); - std::string* _internal_mutable_insertion_point(); + PROTOBUF_ALWAYS_INLINE void _internal_set_insertion_point(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_insertion_point(); public: // optional string content = 15; @@ -545,39 +552,38 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf const std::string& content() const; template <typename Arg_ = const std::string&, typename... Args_> void set_content(Arg_&& arg, Args_... args); - std::string* mutable_content(); - PROTOBUF_NODISCARD std::string* release_content(); - void set_allocated_content(std::string* value); + std::string* PROTOBUF_NONNULL mutable_content(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_content(); + void set_allocated_content(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_content() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_content( - const std::string& value); - std::string* _internal_mutable_content(); + PROTOBUF_ALWAYS_INLINE void _internal_set_content(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_content(); public: // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; bool has_generated_code_info() const; void clear_generated_code_info() ; const ::google::protobuf::GeneratedCodeInfo& generated_code_info() const; - PROTOBUF_NODISCARD ::google::protobuf::GeneratedCodeInfo* release_generated_code_info(); - ::google::protobuf::GeneratedCodeInfo* mutable_generated_code_info(); - void set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* value); - void unsafe_arena_set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* value); - ::google::protobuf::GeneratedCodeInfo* unsafe_arena_release_generated_code_info(); + [[nodiscard]] ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE release_generated_code_info(); + ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NONNULL mutable_generated_code_info(); + void set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE value); + ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE unsafe_arena_release_generated_code_info(); private: const ::google::protobuf::GeneratedCodeInfo& _internal_generated_code_info() const; - ::google::protobuf::GeneratedCodeInfo* _internal_mutable_generated_code_info(); + ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NONNULL _internal_mutable_generated_code_info(); public: // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 4, 1, - 86, 2> + static const ::google::protobuf::internal::TcParseTable<2, 4, + 1, 86, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -587,24 +593,27 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const CodeGeneratorResponse_File& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const CodeGeneratorResponse_File& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr insertion_point_; ::google::protobuf::internal::ArenaStringPtr content_; - ::google::protobuf::GeneratedCodeInfo* generated_code_info_; + ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE generated_code_info_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; + +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse_File_class_data_; // ------------------------------------------------------------------- class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Message @@ -614,15 +623,14 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes ~CodeGeneratorResponse() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(CodeGeneratorResponse* msg, std::destroying_delete_t) { + void operator delete(CodeGeneratorResponse* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(CodeGeneratorResponse)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR CodeGeneratorResponse( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR CodeGeneratorResponse(::google::protobuf::internal::ConstantInitialized); inline CodeGeneratorResponse(const CodeGeneratorResponse& from) : CodeGeneratorResponse(nullptr, from) {} inline CodeGeneratorResponse(CodeGeneratorResponse&& from) noexcept @@ -645,30 +653,27 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const CodeGeneratorResponse& default_instance() { - return *internal_default_instance(); - } - static inline const CodeGeneratorResponse* internal_default_instance() { - return reinterpret_cast<const CodeGeneratorResponse*>( + return *reinterpret_cast<const CodeGeneratorResponse*>( &_CodeGeneratorResponse_default_instance_); } static constexpr int kIndexInFileMessages = 3; friend void swap(CodeGeneratorResponse& a, CodeGeneratorResponse& b) { a.Swap(&b); } - inline void Swap(CodeGeneratorResponse* other) { + inline void Swap(CodeGeneratorResponse* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -676,7 +681,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(CodeGeneratorResponse* other) { + void UnsafeArenaSwap(CodeGeneratorResponse* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -684,7 +689,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - CodeGeneratorResponse* New(::google::protobuf::Arena* arena = nullptr) const { + CodeGeneratorResponse* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<CodeGeneratorResponse>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -693,9 +698,8 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes void MergeFrom(const CodeGeneratorResponse& from) { CodeGeneratorResponse::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -705,49 +709,51 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(CodeGeneratorResponse* other); + void InternalSwap(CodeGeneratorResponse* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.compiler.CodeGeneratorResponse"; } protected: - explicit CodeGeneratorResponse(::google::protobuf::Arena* arena); - CodeGeneratorResponse(::google::protobuf::Arena* arena, const CodeGeneratorResponse& from); - CodeGeneratorResponse(::google::protobuf::Arena* arena, CodeGeneratorResponse&& from) noexcept + explicit CodeGeneratorResponse(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + CodeGeneratorResponse(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CodeGeneratorResponse& from); + CodeGeneratorResponse( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, CodeGeneratorResponse&& from) noexcept : CodeGeneratorResponse(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using File = CodeGeneratorResponse_File; @@ -761,14 +767,15 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes static constexpr Feature Feature_MIN = CodeGeneratorResponse_Feature_Feature_MIN; static constexpr Feature Feature_MAX = CodeGeneratorResponse_Feature_Feature_MAX; static constexpr int Feature_ARRAYSIZE = CodeGeneratorResponse_Feature_Feature_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Feature_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Feature_descriptor() { return CodeGeneratorResponse_Feature_descriptor(); } template <typename T> static inline const std::string& Feature_Name(T value) { return CodeGeneratorResponse_Feature_Name(value); } - static inline bool Feature_Parse(absl::string_view name, Feature* value) { + static inline bool Feature_Parse( + absl::string_view name, Feature* PROTOBUF_NONNULL value) { return CodeGeneratorResponse_Feature_Parse(name, value); } @@ -787,15 +794,15 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes public: void clear_file() ; - ::google::protobuf::compiler::CodeGeneratorResponse_File* mutable_file(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* mutable_file(); + ::google::protobuf::compiler::CodeGeneratorResponse_File* PROTOBUF_NONNULL mutable_file(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* PROTOBUF_NONNULL mutable_file(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>& _internal_file() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* _internal_mutable_file(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* PROTOBUF_NONNULL _internal_mutable_file(); public: const ::google::protobuf::compiler::CodeGeneratorResponse_File& file(int index) const; - ::google::protobuf::compiler::CodeGeneratorResponse_File* add_file(); + ::google::protobuf::compiler::CodeGeneratorResponse_File* PROTOBUF_NONNULL add_file(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>& file() const; // optional string error = 1; bool has_error() const; @@ -803,15 +810,14 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes const std::string& error() const; template <typename Arg_ = const std::string&, typename... Args_> void set_error(Arg_&& arg, Args_... args); - std::string* mutable_error(); - PROTOBUF_NODISCARD std::string* release_error(); - void set_allocated_error(std::string* value); + std::string* PROTOBUF_NONNULL mutable_error(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_error(); + void set_allocated_error(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_error() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_error( - const std::string& value); - std::string* _internal_mutable_error(); + PROTOBUF_ALWAYS_INLINE void _internal_set_error(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_error(); public: // optional uint64 supported_features = 2; @@ -851,9 +857,9 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 1, - 60, 2> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 1, 60, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -863,13 +869,14 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const CodeGeneratorResponse& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const CodeGeneratorResponse& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File > file_; @@ -882,6 +889,8 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; + +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull CodeGeneratorResponse_class_data_; // ------------------------------------------------------------------- class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Message @@ -891,15 +900,14 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess ~CodeGeneratorRequest() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(CodeGeneratorRequest* msg, std::destroying_delete_t) { + void operator delete(CodeGeneratorRequest* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(CodeGeneratorRequest)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR CodeGeneratorRequest( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR CodeGeneratorRequest(::google::protobuf::internal::ConstantInitialized); inline CodeGeneratorRequest(const CodeGeneratorRequest& from) : CodeGeneratorRequest(nullptr, from) {} inline CodeGeneratorRequest(CodeGeneratorRequest&& from) noexcept @@ -922,30 +930,27 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const CodeGeneratorRequest& default_instance() { - return *internal_default_instance(); - } - static inline const CodeGeneratorRequest* internal_default_instance() { - return reinterpret_cast<const CodeGeneratorRequest*>( + return *reinterpret_cast<const CodeGeneratorRequest*>( &_CodeGeneratorRequest_default_instance_); } static constexpr int kIndexInFileMessages = 1; friend void swap(CodeGeneratorRequest& a, CodeGeneratorRequest& b) { a.Swap(&b); } - inline void Swap(CodeGeneratorRequest* other) { + inline void Swap(CodeGeneratorRequest* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -953,7 +958,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(CodeGeneratorRequest* other) { + void UnsafeArenaSwap(CodeGeneratorRequest* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -961,7 +966,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess // implements Message ---------------------------------------------- - CodeGeneratorRequest* New(::google::protobuf::Arena* arena = nullptr) const { + CodeGeneratorRequest* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<CodeGeneratorRequest>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -970,9 +975,8 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess void MergeFrom(const CodeGeneratorRequest& from) { CodeGeneratorRequest::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -987,49 +991,51 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(CodeGeneratorRequest* other); + void InternalSwap(CodeGeneratorRequest* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.compiler.CodeGeneratorRequest"; } protected: - explicit CodeGeneratorRequest(::google::protobuf::Arena* arena); - CodeGeneratorRequest(::google::protobuf::Arena* arena, const CodeGeneratorRequest& from); - CodeGeneratorRequest(::google::protobuf::Arena* arena, CodeGeneratorRequest&& from) noexcept + explicit CodeGeneratorRequest(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + CodeGeneratorRequest(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CodeGeneratorRequest& from); + CodeGeneratorRequest( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, CodeGeneratorRequest&& from) noexcept : CodeGeneratorRequest(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1049,18 +1055,18 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess public: void clear_file_to_generate() ; const std::string& file_to_generate(int index) const; - std::string* mutable_file_to_generate(int index); + std::string* PROTOBUF_NONNULL mutable_file_to_generate(int index); template <typename Arg_ = const std::string&, typename... Args_> void set_file_to_generate(int index, Arg_&& value, Args_... args); - std::string* add_file_to_generate(); + std::string* PROTOBUF_NONNULL add_file_to_generate(); template <typename Arg_ = const std::string&, typename... Args_> void add_file_to_generate(Arg_&& value, Args_... args); const ::google::protobuf::RepeatedPtrField<std::string>& file_to_generate() const; - ::google::protobuf::RepeatedPtrField<std::string>* mutable_file_to_generate(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL mutable_file_to_generate(); private: const ::google::protobuf::RepeatedPtrField<std::string>& _internal_file_to_generate() const; - ::google::protobuf::RepeatedPtrField<std::string>* _internal_mutable_file_to_generate(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL _internal_mutable_file_to_generate(); public: // repeated .google.protobuf.FileDescriptorProto proto_file = 15; @@ -1070,15 +1076,15 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess public: void clear_proto_file() ; - ::google::protobuf::FileDescriptorProto* mutable_proto_file(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* mutable_proto_file(); + ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL mutable_proto_file(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL mutable_proto_file(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& _internal_proto_file() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* _internal_mutable_proto_file(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_proto_file(); public: const ::google::protobuf::FileDescriptorProto& proto_file(int index) const; - ::google::protobuf::FileDescriptorProto* add_proto_file(); + ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL add_proto_file(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& proto_file() const; // repeated .google.protobuf.FileDescriptorProto source_file_descriptors = 17; int source_file_descriptors_size() const; @@ -1087,15 +1093,15 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess public: void clear_source_file_descriptors() ; - ::google::protobuf::FileDescriptorProto* mutable_source_file_descriptors(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* mutable_source_file_descriptors(); + ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL mutable_source_file_descriptors(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL mutable_source_file_descriptors(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& _internal_source_file_descriptors() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* _internal_mutable_source_file_descriptors(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_source_file_descriptors(); public: const ::google::protobuf::FileDescriptorProto& source_file_descriptors(int index) const; - ::google::protobuf::FileDescriptorProto* add_source_file_descriptors(); + ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL add_source_file_descriptors(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& source_file_descriptors() const; // optional string parameter = 2; bool has_parameter() const; @@ -1103,39 +1109,38 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess const std::string& parameter() const; template <typename Arg_ = const std::string&, typename... Args_> void set_parameter(Arg_&& arg, Args_... args); - std::string* mutable_parameter(); - PROTOBUF_NODISCARD std::string* release_parameter(); - void set_allocated_parameter(std::string* value); + std::string* PROTOBUF_NONNULL mutable_parameter(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_parameter(); + void set_allocated_parameter(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_parameter() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_parameter( - const std::string& value); - std::string* _internal_mutable_parameter(); + PROTOBUF_ALWAYS_INLINE void _internal_set_parameter(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_parameter(); public: // optional .google.protobuf.compiler.Version compiler_version = 3; bool has_compiler_version() const; void clear_compiler_version() ; const ::google::protobuf::compiler::Version& compiler_version() const; - PROTOBUF_NODISCARD ::google::protobuf::compiler::Version* release_compiler_version(); - ::google::protobuf::compiler::Version* mutable_compiler_version(); - void set_allocated_compiler_version(::google::protobuf::compiler::Version* value); - void unsafe_arena_set_allocated_compiler_version(::google::protobuf::compiler::Version* value); - ::google::protobuf::compiler::Version* unsafe_arena_release_compiler_version(); + [[nodiscard]] ::google::protobuf::compiler::Version* PROTOBUF_NULLABLE release_compiler_version(); + ::google::protobuf::compiler::Version* PROTOBUF_NONNULL mutable_compiler_version(); + void set_allocated_compiler_version(::google::protobuf::compiler::Version* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_compiler_version(::google::protobuf::compiler::Version* PROTOBUF_NULLABLE value); + ::google::protobuf::compiler::Version* PROTOBUF_NULLABLE unsafe_arena_release_compiler_version(); private: const ::google::protobuf::compiler::Version& _internal_compiler_version() const; - ::google::protobuf::compiler::Version* _internal_mutable_compiler_version(); + ::google::protobuf::compiler::Version* PROTOBUF_NONNULL _internal_mutable_compiler_version(); public: // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 3, - 79, 2> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 3, 79, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1145,26 +1150,29 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const CodeGeneratorRequest& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const CodeGeneratorRequest& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField<std::string> file_to_generate_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > proto_file_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > source_file_descriptors_; ::google::protobuf::internal::ArenaStringPtr parameter_; - ::google::protobuf::compiler::Version* compiler_version_; + ::google::protobuf::compiler::Version* PROTOBUF_NULLABLE compiler_version_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; +PROTOC_EXPORT extern const ::google::protobuf::internal::ClassDataFull CodeGeneratorRequest_class_data_; + // =================================================================== @@ -1281,14 +1289,14 @@ inline const std::string& Version::suffix() const return _internal_suffix(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Version::set_suffix(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Version::set_suffix(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.suffix_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix) } -inline std::string* Version::mutable_suffix() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Version::mutable_suffix() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_suffix(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.Version.suffix) return _s; @@ -1302,12 +1310,12 @@ inline void Version::_internal_set_suffix(const std::string& value) { _impl_._has_bits_[0] |= 0x00000001u; _impl_.suffix_.Set(value, GetArena()); } -inline std::string* Version::_internal_mutable_suffix() { +inline std::string* PROTOBUF_NONNULL Version::_internal_mutable_suffix() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.suffix_.Mutable( GetArena()); } -inline std::string* Version::release_suffix() { +inline std::string* PROTOBUF_NULLABLE Version::release_suffix() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -1320,7 +1328,7 @@ inline std::string* Version::release_suffix() { } return released; } -inline void Version::set_allocated_suffix(std::string* value) { +inline void Version::set_allocated_suffix(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -1349,7 +1357,8 @@ inline void CodeGeneratorRequest::clear_file_to_generate() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.file_to_generate_.Clear(); } -inline std::string* CodeGeneratorRequest::add_file_to_generate() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL CodeGeneratorRequest::add_file_to_generate() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); std::string* _s = _internal_mutable_file_to_generate()->Add(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) @@ -1360,16 +1369,15 @@ inline const std::string& CodeGeneratorRequest::file_to_generate(int index) cons // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return _internal_file_to_generate().Get(index); } -inline std::string* CodeGeneratorRequest::mutable_file_to_generate(int index) +inline std::string* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_file_to_generate(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return _internal_mutable_file_to_generate()->Mutable(index); } template <typename Arg_, typename... Args_> inline void CodeGeneratorRequest::set_file_to_generate(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString( - *_internal_mutable_file_to_generate()->Mutable(index), - std::forward<Arg_>(value), args... ); + ::google::protobuf::internal::AssignToString(*_internal_mutable_file_to_generate()->Mutable(index), std::forward<Arg_>(value), + args... ); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } template <typename Arg_, typename... Args_> @@ -1380,12 +1388,12 @@ inline void CodeGeneratorRequest::add_file_to_generate(Arg_&& value, Args_... ar args... ); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } -inline const ::google::protobuf::RepeatedPtrField<std::string>& -CodeGeneratorRequest::file_to_generate() const ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline const ::google::protobuf::RepeatedPtrField<std::string>& CodeGeneratorRequest::file_to_generate() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return _internal_file_to_generate(); } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_file_to_generate() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1396,7 +1404,7 @@ CodeGeneratorRequest::_internal_file_to_generate() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.file_to_generate_; } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL CodeGeneratorRequest::_internal_mutable_file_to_generate() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.file_to_generate_; @@ -1418,14 +1426,14 @@ inline const std::string& CodeGeneratorRequest::parameter() const return _internal_parameter(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorRequest::set_parameter(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void CodeGeneratorRequest::set_parameter(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.parameter_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter) } -inline std::string* CodeGeneratorRequest::mutable_parameter() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_parameter() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_parameter(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.parameter) return _s; @@ -1439,12 +1447,12 @@ inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& val _impl_._has_bits_[0] |= 0x00000001u; _impl_.parameter_.Set(value, GetArena()); } -inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() { +inline std::string* PROTOBUF_NONNULL CodeGeneratorRequest::_internal_mutable_parameter() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.parameter_.Mutable( GetArena()); } -inline std::string* CodeGeneratorRequest::release_parameter() { +inline std::string* PROTOBUF_NULLABLE CodeGeneratorRequest::release_parameter() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -1457,7 +1465,7 @@ inline std::string* CodeGeneratorRequest::release_parameter() { } return released; } -inline void CodeGeneratorRequest::set_allocated_parameter(std::string* value) { +inline void CodeGeneratorRequest::set_allocated_parameter(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -1478,12 +1486,12 @@ inline int CodeGeneratorRequest::_internal_proto_file_size() const { inline int CodeGeneratorRequest::proto_file_size() const { return _internal_proto_file_size(); } -inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) +inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_proto_file(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _internal_mutable_proto_file()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* CodeGeneratorRequest::mutable_proto_file() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_proto_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1494,7 +1502,8 @@ inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::prot // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _internal_proto_file().Get(index); } -inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL CodeGeneratorRequest::add_proto_file() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_proto_file()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) @@ -1510,7 +1519,7 @@ CodeGeneratorRequest::_internal_proto_file() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.proto_file_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL CodeGeneratorRequest::_internal_mutable_proto_file() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.proto_file_; @@ -1523,12 +1532,12 @@ inline int CodeGeneratorRequest::_internal_source_file_descriptors_size() const inline int CodeGeneratorRequest::source_file_descriptors_size() const { return _internal_source_file_descriptors_size(); } -inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_source_file_descriptors(int index) +inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_source_file_descriptors(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors) return _internal_mutable_source_file_descriptors()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* CodeGeneratorRequest::mutable_source_file_descriptors() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_source_file_descriptors() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1539,7 +1548,8 @@ inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::sour // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors) return _internal_source_file_descriptors().Get(index); } -inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_source_file_descriptors() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL CodeGeneratorRequest::add_source_file_descriptors() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_source_file_descriptors()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.source_file_descriptors) @@ -1555,7 +1565,7 @@ CodeGeneratorRequest::_internal_source_file_descriptors() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.source_file_descriptors_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL CodeGeneratorRequest::_internal_mutable_source_file_descriptors() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.source_file_descriptors_; @@ -1581,7 +1591,8 @@ inline const ::google::protobuf::compiler::Version& CodeGeneratorRequest::compil // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return _internal_compiler_version(); } -inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version(::google::protobuf::compiler::Version* value) { +inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version( + ::google::protobuf::compiler::Version* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.compiler_version_); @@ -1594,7 +1605,7 @@ inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version(:: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) } -inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_compiler_version() { +inline ::google::protobuf::compiler::Version* PROTOBUF_NULLABLE CodeGeneratorRequest::release_compiler_version() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -1613,7 +1624,7 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_comp } return released; } -inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::unsafe_arena_release_compiler_version() { +inline ::google::protobuf::compiler::Version* PROTOBUF_NULLABLE CodeGeneratorRequest::unsafe_arena_release_compiler_version() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) @@ -1622,7 +1633,7 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::unsafe_arena _impl_.compiler_version_ = nullptr; return temp; } -inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { +inline ::google::protobuf::compiler::Version* PROTOBUF_NONNULL CodeGeneratorRequest::_internal_mutable_compiler_version() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.compiler_version_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::compiler::Version>(GetArena()); @@ -1630,21 +1641,22 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::_internal_mu } return _impl_.compiler_version_; } -inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::compiler::Version* PROTOBUF_NONNULL CodeGeneratorRequest::mutable_compiler_version() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::compiler::Version* _msg = _internal_mutable_compiler_version(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return _msg; } -inline void CodeGeneratorRequest::set_allocated_compiler_version(::google::protobuf::compiler::Version* value) { +inline void CodeGeneratorRequest::set_allocated_compiler_version(::google::protobuf::compiler::Version* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.compiler_version_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.compiler_version_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -1677,14 +1689,14 @@ inline const std::string& CodeGeneratorResponse_File::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name) } -inline std::string* CodeGeneratorResponse_File::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse_File::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.name) return _s; @@ -1698,12 +1710,12 @@ inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& va _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse_File::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* CodeGeneratorResponse_File::release_name() { +inline std::string* PROTOBUF_NULLABLE CodeGeneratorResponse_File::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -1716,7 +1728,7 @@ inline std::string* CodeGeneratorResponse_File::release_name() { } return released; } -inline void CodeGeneratorResponse_File::set_allocated_name(std::string* value) { +inline void CodeGeneratorResponse_File::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -1746,14 +1758,14 @@ inline const std::string& CodeGeneratorResponse_File::insertion_point() const return _internal_insertion_point(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_insertion_point(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_insertion_point(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.insertion_point_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } -inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse_File::mutable_insertion_point() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_insertion_point(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) return _s; @@ -1767,12 +1779,12 @@ inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std: _impl_._has_bits_[0] |= 0x00000002u; _impl_.insertion_point_.Set(value, GetArena()); } -inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse_File::_internal_mutable_insertion_point() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.insertion_point_.Mutable( GetArena()); } -inline std::string* CodeGeneratorResponse_File::release_insertion_point() { +inline std::string* PROTOBUF_NULLABLE CodeGeneratorResponse_File::release_insertion_point() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -1785,7 +1797,7 @@ inline std::string* CodeGeneratorResponse_File::release_insertion_point() { } return released; } -inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* value) { +inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -1815,14 +1827,14 @@ inline const std::string& CodeGeneratorResponse_File::content() const return _internal_content(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_content(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse_File::set_content(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; _impl_.content_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content) } -inline std::string* CodeGeneratorResponse_File::mutable_content() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse_File::mutable_content() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_content(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.content) return _s; @@ -1836,12 +1848,12 @@ inline void CodeGeneratorResponse_File::_internal_set_content(const std::string& _impl_._has_bits_[0] |= 0x00000004u; _impl_.content_.Set(value, GetArena()); } -inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse_File::_internal_mutable_content() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; return _impl_.content_.Mutable( GetArena()); } -inline std::string* CodeGeneratorResponse_File::release_content() { +inline std::string* PROTOBUF_NULLABLE CodeGeneratorResponse_File::release_content() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content) if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { @@ -1854,7 +1866,7 @@ inline std::string* CodeGeneratorResponse_File::release_content() { } return released; } -inline void CodeGeneratorResponse_File::set_allocated_content(std::string* value) { +inline void CodeGeneratorResponse_File::set_allocated_content(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000004u; @@ -1883,7 +1895,8 @@ inline const ::google::protobuf::GeneratedCodeInfo& CodeGeneratorResponse_File:: // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) return _internal_generated_code_info(); } -inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* value) { +inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_code_info( + ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.generated_code_info_); @@ -1896,7 +1909,7 @@ inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_cod } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) } -inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::release_generated_code_info() { +inline ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE CodeGeneratorResponse_File::release_generated_code_info() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000008u; @@ -1915,7 +1928,7 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::releas } return released; } -inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() { +inline ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) @@ -1924,7 +1937,7 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe _impl_.generated_code_info_ = nullptr; return temp; } -inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { +inline ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NONNULL CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.generated_code_info_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::GeneratedCodeInfo>(GetArena()); @@ -1932,13 +1945,14 @@ inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::_inter } return _impl_.generated_code_info_; } -inline ::google::protobuf::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::GeneratedCodeInfo* PROTOBUF_NONNULL CodeGeneratorResponse_File::mutable_generated_code_info() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000008u; ::google::protobuf::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) return _msg; } -inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* value) { +inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::google::protobuf::GeneratedCodeInfo* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { @@ -1946,7 +1960,7 @@ inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::goog } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -1979,14 +1993,14 @@ inline const std::string& CodeGeneratorResponse::error() const return _internal_error(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse::set_error(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void CodeGeneratorResponse::set_error(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.error_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error) } -inline std::string* CodeGeneratorResponse::mutable_error() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse::mutable_error() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_error(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.error) return _s; @@ -2000,12 +2014,12 @@ inline void CodeGeneratorResponse::_internal_set_error(const std::string& value) _impl_._has_bits_[0] |= 0x00000001u; _impl_.error_.Set(value, GetArena()); } -inline std::string* CodeGeneratorResponse::_internal_mutable_error() { +inline std::string* PROTOBUF_NONNULL CodeGeneratorResponse::_internal_mutable_error() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.error_.Mutable( GetArena()); } -inline std::string* CodeGeneratorResponse::release_error() { +inline std::string* PROTOBUF_NULLABLE CodeGeneratorResponse::release_error() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -2018,7 +2032,7 @@ inline std::string* CodeGeneratorResponse::release_error() { } return released; } -inline void CodeGeneratorResponse::set_allocated_error(std::string* value) { +inline void CodeGeneratorResponse::set_allocated_error(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -2127,12 +2141,12 @@ inline void CodeGeneratorResponse::clear_file() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.file_.Clear(); } -inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) +inline ::google::protobuf::compiler::CodeGeneratorResponse_File* PROTOBUF_NONNULL CodeGeneratorResponse::mutable_file(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file) return _internal_mutable_file()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* CodeGeneratorResponse::mutable_file() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* PROTOBUF_NONNULL CodeGeneratorResponse::mutable_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2143,7 +2157,8 @@ inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGener // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file) return _internal_file().Get(index); } -inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::compiler::CodeGeneratorResponse_File* PROTOBUF_NONNULL CodeGeneratorResponse::add_file() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::compiler::CodeGeneratorResponse_File* _add = _internal_mutable_file()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) @@ -2159,7 +2174,7 @@ CodeGeneratorResponse::_internal_file() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.file_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::compiler::CodeGeneratorResponse_File>* PROTOBUF_NONNULL CodeGeneratorResponse::_internal_mutable_file() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.file_; @@ -2181,7 +2196,7 @@ namespace protobuf { template <> struct is_proto_enum<::google::protobuf::compiler::CodeGeneratorResponse_Feature> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::compiler::CodeGeneratorResponse_Feature>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::compiler::CodeGeneratorResponse_Feature>() { return ::google::protobuf::compiler::CodeGeneratorResponse_Feature_descriptor(); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/python/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/python/BUILD.bazel index bc38a94fc1633..f3b00be1496ad 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/python/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/python/BUILD.bazel @@ -34,14 +34,14 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/io:printer", "//src/google/protobuf/io:tokenizer", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", ], ) @@ -51,15 +51,19 @@ cc_test( copts = COPTS, deps = [ ":python", + "//src/google/protobuf", + "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/compiler:command_line_interface", + "//src/google/protobuf/compiler:command_line_interface_tester", + "//src/google/protobuf/compiler/cpp", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/python/generator.cc b/third_party/protobuf/src/google/protobuf/compiler/python/generator.cc index 41be7df168c94..d74042725fd98 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/python/generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/python/generator.cc @@ -361,13 +361,6 @@ void Generator::PrintTopBoilerplate() const { "protobuf_python_version", PROTOBUF_PYTHON_VERSION_STRING); } printer_->Print("\"\"\"Generated protocol buffer code.\"\"\"\n"); - if (!opensource_runtime_) { - // This import is needed so that compatibility proto1 compiler output - // inserted at protoc_insertion_point can refer to other protos like - // google3.a.b.c. Code generated by proto2 compiler doesn't do it, and - // instead uses aliases assigned when importing modules. - printer_->Print("import google3\n"); - } bool runtime_version_disabled = false; printer_->Print( "from google.protobuf import descriptor as _descriptor\n" @@ -486,8 +479,17 @@ std::string Generator::GetResolvedFeatures( // Assume these are all enums. If we add non-enum global features or any // python-specific features, we will need to come back and improve this // logic. - ABSL_CHECK(field->enum_type() != nullptr) - << "Unexpected non-enum field found!"; + if (field->type() != FieldDescriptor::TYPE_ENUM) { + ABSL_CHECK(field->is_extension()) + << "Unsupported non-enum global feature found: " + << field->full_name(); + // Placeholder for python-specific features. + ABSL_CHECK(field->number() != 1003) + << "Unsupported python-specific feature found: " + << field->full_name(); + // Skip any non-python language-specific features. + continue; + } if (field->options().retention() == FieldOptions::RETENTION_SOURCE) { // Skip any source-retention features. continue; @@ -569,8 +571,8 @@ void Generator::PrintResolvedFeatures() const { void Generator::PrintFileDescriptor() const { absl::flat_hash_map<absl::string_view, std::string> m; m["descriptor_name"] = kDescriptorKey; - m["name"] = file_->name(); - m["package"] = file_->package(); + m["name"] = std::string(file_->name()); + m["package"] = std::string(file_->package()); m["syntax"] = GetLegacySyntaxName(GetEdition(*file_)); m["edition"] = Edition_Name(GetEdition(*file_)); m["options"] = OptionsValue(proto_.options().SerializeAsString()); @@ -652,8 +654,8 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor, std::string module_level_descriptor_name = ModuleLevelDescriptorName(enum_descriptor); m["descriptor_name"] = module_level_descriptor_name; - m["name"] = enum_descriptor.name(); - m["full_name"] = enum_descriptor.full_name(); + m["name"] = std::string(enum_descriptor.name()); + m["full_name"] = std::string(enum_descriptor.full_name()); m["file"] = kDescriptorKey; const char enum_descriptor_template[] = "$descriptor_name$ = _descriptor.EnumDescriptor(\n" @@ -708,6 +710,7 @@ void Generator::PrintMessageDescriptors() const { } } +// TODO: Remove python service code from opensource. void Generator::PrintServiceDescriptors() const { for (int i = 0; i < file_->service_count(); ++i) { PrintServiceDescriptor(*file_->service(i)); @@ -726,7 +729,7 @@ void Generator::PrintServiceDescriptor( const ServiceDescriptor& descriptor) const { absl::flat_hash_map<absl::string_view, std::string> m; m["service_name"] = ModuleLevelServiceDescriptorName(descriptor); - m["name"] = descriptor.name(); + m["name"] = std::string(descriptor.name()); m["file"] = kDescriptorKey; printer_->Print(m, "$service_name$ = $file$.services_by_name['$name$']\n"); } @@ -776,8 +779,8 @@ void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const { void Generator::PrintDescriptor(const Descriptor& message_descriptor, const DescriptorProto& proto) const { absl::flat_hash_map<absl::string_view, std::string> m; - m["name"] = message_descriptor.name(); - m["full_name"] = message_descriptor.full_name(); + m["name"] = std::string(message_descriptor.name()); + m["full_name"] = std::string(message_descriptor.full_name()); m["file"] = kDescriptorKey; PrintNestedDescriptors(message_descriptor, proto); @@ -842,8 +845,8 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor, for (int i = 0; i < message_descriptor.oneof_decl_count(); ++i) { const OneofDescriptor* desc = message_descriptor.oneof_decl(i); m.clear(); - m["name"] = desc->name(); - m["full_name"] = desc->full_name(); + m["name"] = std::string(desc->name()); + m["full_name"] = std::string(desc->full_name()); m["index"] = absl::StrCat(desc->index()); options_string = OptionsValue(proto.oneof_decl(i).options().SerializeAsString()); @@ -986,9 +989,9 @@ void Generator::FixForeignFieldsInDescriptor( absl::flat_hash_map<absl::string_view, std::string> m; const OneofDescriptor* oneof = descriptor.oneof_decl(i); m["descriptor_name"] = ModuleLevelDescriptorName(descriptor); - m["oneof_name"] = oneof->name(); + m["oneof_name"] = std::string(oneof->name()); for (int j = 0; j < oneof->field_count(); ++j) { - m["field_name"] = oneof->field(j)->name(); + m["field_name"] = std::string(oneof->field(j)->name()); printer_->Print( m, "$descriptor_name$.oneofs_by_name['$oneof_name$'].fields.append(\n" @@ -1004,7 +1007,7 @@ void Generator::FixForeignFieldsInDescriptor( void Generator::AddMessageToFileDescriptor(const Descriptor& descriptor) const { absl::flat_hash_map<absl::string_view, std::string> m; m["descriptor_name"] = kDescriptorKey; - m["message_name"] = descriptor.name(); + m["message_name"] = std::string(descriptor.name()); m["message_descriptor_name"] = ModuleLevelDescriptorName(descriptor); const char file_descriptor_template[] = "$descriptor_name$.message_types_by_name['$message_name$'] = " @@ -1016,7 +1019,7 @@ void Generator::AddServiceToFileDescriptor( const ServiceDescriptor& descriptor) const { absl::flat_hash_map<absl::string_view, std::string> m; m["descriptor_name"] = kDescriptorKey; - m["service_name"] = descriptor.name(); + m["service_name"] = std::string(descriptor.name()); m["service_descriptor_name"] = ModuleLevelServiceDescriptorName(descriptor); const char file_descriptor_template[] = "$descriptor_name$.services_by_name['$service_name$'] = " @@ -1028,7 +1031,7 @@ void Generator::AddEnumToFileDescriptor( const EnumDescriptor& descriptor) const { absl::flat_hash_map<absl::string_view, std::string> m; m["descriptor_name"] = kDescriptorKey; - m["enum_name"] = descriptor.name(); + m["enum_name"] = std::string(descriptor.name()); m["enum_descriptor_name"] = ModuleLevelDescriptorName(descriptor); const char file_descriptor_template[] = "$descriptor_name$.enum_types_by_name['$enum_name$'] = " @@ -1040,7 +1043,7 @@ void Generator::AddExtensionToFileDescriptor( const FieldDescriptor& descriptor) const { absl::flat_hash_map<absl::string_view, std::string> m; m["descriptor_name"] = kDescriptorKey; - m["field_name"] = descriptor.name(); + m["field_name"] = std::string(descriptor.name()); m["resolved_name"] = ResolveKeyword(descriptor.name()); const char file_descriptor_template[] = "$descriptor_name$.extensions_by_name['$field_name$'] = " @@ -1149,7 +1152,7 @@ void Generator::PrintEnumValueDescriptor( std::string options_string; proto.options().SerializeToString(&options_string); absl::flat_hash_map<absl::string_view, std::string> m; - m["name"] = descriptor.name(); + m["name"] = std::string(descriptor.name()); m["index"] = absl::StrCat(descriptor.index()); m["number"] = absl::StrCat(descriptor.number()); m["options"] = OptionsValue(options_string); @@ -1167,8 +1170,8 @@ void Generator::PrintFieldDescriptor(const FieldDescriptor& field, std::string options_string; proto.options().SerializeToString(&options_string); absl::flat_hash_map<absl::string_view, std::string> m; - m["name"] = field.name(); - m["full_name"] = field.full_name(); + m["name"] = std::string(field.name()); + m["full_name"] = std::string(field.full_name()); m["index"] = absl::StrCat(field.index()); m["number"] = absl::StrCat(field.number()); m["type"] = absl::StrCat(field.type()); @@ -1462,7 +1465,7 @@ void Generator::FixOptionsForField(const FieldDescriptor& field, if (field.is_extension()) { if (field.extension_scope() == nullptr) { // Top level extensions. - field_name = field.name(); + field_name = std::string(field.name()); } else { field_name = FieldReferencingExpression(field.extension_scope(), field, "extensions_by_name"); diff --git a/third_party/protobuf/src/google/protobuf/compiler/python/plugin_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/python/plugin_unittest.cc index 6d9148432eaa3..a9f9a0ca9ee41 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/python/plugin_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/python/plugin_unittest.cc @@ -9,15 +9,20 @@ #include <memory> #include <string> +#include <utility> #include <vector> #include "google/protobuf/testing/file.h" -#include "google/protobuf/testing/file.h" -#include "google/protobuf/compiler/command_line_interface.h" -#include "google/protobuf/compiler/python/generator.h" #include <gtest/gtest.h> #include "absl/log/absl_check.h" +#include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" +#include "absl/strings/substitute.h" +#include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/compiler/command_line_interface_tester.h" +#include "google/protobuf/compiler/cpp/generator.h" +#include "google/protobuf/compiler/python/generator.h" +#include "google/protobuf/cpp_features.pb.h" #include "google/protobuf/io/printer.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -100,6 +105,58 @@ TEST(PythonPluginTest, ImportTest) { EXPECT_TRUE(found_expected_import); } +class PythonGeneratorTest : public CommandLineInterfaceTester, + public testing::WithParamInterface<bool> { + protected: + PythonGeneratorTest() { + auto generator = std::make_unique<Generator>(); + generator->set_opensource_runtime(GetParam()); + RegisterGenerator("--python_out", "--python_opt", std::move(generator), + "Python test generator"); + + // Generate built-in protos. + CreateTempFile( + google::protobuf::DescriptorProto::descriptor()->file()->name(), + google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); + } +}; + +TEST_P(PythonGeneratorTest, PythonWithCppFeatures) { + // Test that the presence of C++ features does not break Python generation. + RegisterGenerator("--cpp_out", "--cpp_opt", + std::make_unique<cpp::CppGenerator>(), + "C++ test generator"); + CreateTempFile("google/protobuf/cpp_features.proto", + pb::CppFeatures::descriptor()->file()->DebugString()); + CreateTempFile("foo.proto", + R"schema( + edition = "2023"; + + import "google/protobuf/cpp_features.proto"; + + package foo; + + enum Bar { + AAA = 0; + BBB = 1; + } + + message Foo { + Bar bar_enum = 1 [features.(pb.cpp).legacy_closed_enum = true]; + })schema"); + + RunProtoc(absl::Substitute( + "protocol_compiler --proto_path=$$tmpdir --cpp_out=$$tmpdir " + "--python_out=$$tmpdir foo.proto $0 " + "google/protobuf/cpp_features.proto", + google::protobuf::DescriptorProto::descriptor()->file()->name())); + + ExpectNoErrors(); +} + +INSTANTIATE_TEST_SUITE_P(PythonGeneratorTest, PythonGeneratorTest, + testing::Bool()); + } // namespace } // namespace python } // namespace compiler diff --git a/third_party/protobuf/src/google/protobuf/compiler/python/pyi_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/python/pyi_generator.cc index f86777c2c2b3d..a6c0faa986253 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/python/pyi_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/python/pyi_generator.cc @@ -7,6 +7,8 @@ #include "google/protobuf/compiler/python/pyi_generator.h" +#include <cstddef> +#include <memory> #include <string> #include <utility> #include <vector> @@ -16,8 +18,10 @@ #include "absl/log/absl_log.h" #include "absl/strings/ascii.h" #include "absl/strings/match.h" +#include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" #include "google/protobuf/compiler/code_generator.h" #include "google/protobuf/compiler/python/helpers.h" #include "google/protobuf/descriptor.h" @@ -32,7 +36,7 @@ namespace python { PyiGenerator::PyiGenerator() : file_(nullptr) {} -PyiGenerator::~PyiGenerator() {} +PyiGenerator::~PyiGenerator() = default; template <typename DescriptorT> std::string PyiGenerator::ModuleLevelName(const DescriptorT& descriptor) const { @@ -60,13 +64,14 @@ std::string PyiGenerator::InternalPackage() const { struct ImportModules { bool has_repeated = false; // _containers - bool has_iterable = false; // typing.Iterable + bool has_iterable = false; // collections.abc.Iterable bool has_messages = false; // _message bool has_enums = false; // _enum_type_wrapper bool has_extendable = false; // _python_message - bool has_mapping = false; // typing.Mapping + bool has_mapping = false; // collections.abc.Mapping bool has_optional = false; // typing.Optional bool has_union = false; // typing.Union + bool has_callable = false; // typing.Callable bool has_well_known_type = false; }; @@ -189,6 +194,7 @@ void PyiGenerator::PrintImports() const { import_modules.has_enums = true; } if (!opensource_runtime_ && file_->service_count() > 0) { + import_modules.has_callable = true; import_modules.has_optional = true; import_modules.has_union = true; } @@ -240,17 +246,27 @@ void PyiGenerator::PrintImports() const { "from google3.net.rpc.python import rpcserver as _rpcserver\n"); } } + if (import_modules.has_iterable || import_modules.has_mapping) { + printer_->Print("from collections.abc import"); + if (import_modules.has_iterable) { + printer_->Print(" Iterable as _Iterable"); + if (import_modules.has_mapping) { + printer_->Print(","); + } + } + if (import_modules.has_mapping) { + printer_->Print(" Mapping as _Mapping"); + } + printer_->Print("\n"); + } printer_->Print("from typing import "); if (!opensource_runtime_ && file_->service_count() > 0) { printer_->Print("Any as _Any, "); } + if (import_modules.has_callable) { + printer_->Print("Callable as _Callable, "); + } printer_->Print("ClassVar as _ClassVar"); - if (import_modules.has_iterable) { - printer_->Print(", Iterable as _Iterable"); - } - if (import_modules.has_mapping) { - printer_->Print(", Mapping as _Mapping"); - } if (import_modules.has_optional) { printer_->Print(", Optional as _Optional"); } @@ -276,7 +292,7 @@ void PyiGenerator::PrintImports() const { public_dep->enum_type(i)->name()); } } -printer_->Print("\n"); + printer_->Print("\n"); } // Annotate wrapper for debugging purposes @@ -284,7 +300,7 @@ printer_->Print("\n"); template <typename DescriptorT> void PyiGenerator::Annotate(const std::string& label, const DescriptorT* descriptor) const { -printer_->Annotate(label.c_str(), descriptor); + printer_->Annotate(label, descriptor); } void PyiGenerator::PrintEnum(const EnumDescriptor& enum_descriptor) const { @@ -475,23 +491,25 @@ void PyiGenerator::PrintMessage( } // Prints __init__ - printer_->Print("def __init__(self"); - bool has_key_words = false; - bool is_first = true; + printer_->Print("def __init__("); + // If the message has a field named "self" (see b/144146793), it can still be + // passed to the initializer, which takes those as **kwargs. To avoid name + // collision, we rename the self parameter by appending underscores until it + // no longer collides. The self-parameter is in fact positional-only, so the + // name in the pyi doesn't matter with regard to what runtime usage is valid. + std::string self_arg_name = "self"; + while (message_descriptor.FindFieldByName(self_arg_name) != nullptr) { + self_arg_name.append("_"); + } + printer_->Print(self_arg_name); + bool has_python_keywords = false; for (int i = 0; i < message_descriptor.field_count(); ++i) { const FieldDescriptor* field_des = message_descriptor.field(i); if (IsPythonKeyword(field_des->name())) { - has_key_words = true; + has_python_keywords = true; continue; } std::string field_name = std::string(field_des->name()); - if (is_first && field_name == "self") { - // See b/144146793 for an example of real code that generates a (self, - // self) method signature. Since repeating a parameter name is illegal in - // Python, we rename the duplicate self. - field_name = "self_"; - } - is_first = false; printer_->Print(", $field_name$: ", "field_name", field_name); Annotate("field_name", field_des); if (field_des->is_repeated() || @@ -533,7 +551,7 @@ void PyiGenerator::PrintMessage( } printer_->Print(" = ..."); } - if (has_key_words) { + if (has_python_keywords) { printer_->Print(", **kwargs"); } printer_->Print(") -> None: ...\n"); diff --git a/third_party/protobuf/src/google/protobuf/compiler/ruby/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/ruby/BUILD.bazel index 4137ef0e87696..21091399c4948 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/ruby/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/ruby/BUILD.bazel @@ -23,9 +23,9 @@ cc_library( "//src/google/protobuf/compiler:retention", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -53,8 +53,8 @@ cc_test( "//src/google/protobuf/io:printer", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc index 82f1a9556a54c..ce97996a2d8e9 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -170,7 +170,7 @@ int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) { << " 'A::B::C' and not 'A.B.C'"; } } else { - package_name = file->package(); + package_name = std::string(file->package()); } // Use the appropriate delimiter diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/rust/BUILD.bazel index 91c81451af5a4..d53c2605ae575 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/BUILD.bazel @@ -1,3 +1,10 @@ +# Copyright (c) 2025, Google LLC +# All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd + ################################################################################ # Protocol Buffers Compiler - Rust code generator ################################################################################ @@ -25,20 +32,21 @@ cc_library( "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", + "//src/google/protobuf/compiler:versions", "//src/google/protobuf/compiler/cpp:names", "//src/google/protobuf/io", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", ], ) @@ -46,15 +54,15 @@ cc_library( name = "crate_mapping", srcs = ["crate_mapping.cc"], hdrs = ["crate_mapping.h"], + copts = COPTS, strip_include_prefix = "/src", deps = [ ":context", "//src/google/protobuf", - "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", ], ) @@ -66,12 +74,12 @@ cc_test( ":crate_mapping", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -91,10 +99,10 @@ cc_library( "//src/google/protobuf/compiler/cpp:names", "//src/google/protobuf/compiler/cpp:names_internal", "//src/google/protobuf/compiler/rust/accessors", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -111,14 +119,14 @@ cc_library( "//src/google/protobuf", "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/io:printer", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:span", ], ) @@ -133,11 +141,11 @@ cc_library( ":naming", "//src/google/protobuf", "//src/google/protobuf/compiler/cpp:names", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:span", ], ) @@ -146,9 +154,9 @@ cc_test( srcs = ["enum_test.cc"], deps = [ ":enum", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -174,11 +182,11 @@ cc_library( "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/compiler/cpp:names_internal", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -197,9 +205,9 @@ cc_library( "//src/google/protobuf/compiler/cpp:names", "//src/google/protobuf/compiler/cpp:names_internal", "//src/google/protobuf/compiler/rust/accessors", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) @@ -207,11 +215,12 @@ cc_library( name = "relative_path", srcs = ["relative_path.cc"], hdrs = ["relative_path.h"], + copts = COPTS, strip_include_prefix = "/src", deps = [ - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", ], ) @@ -220,8 +229,8 @@ cc_test( srcs = ["relative_path_test.cc"], deps = [ ":relative_path", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -229,6 +238,7 @@ cc_library( name = "rust_field_type", srcs = ["rust_field_type.cc"], hdrs = ["rust_field_type.h"], + copts = COPTS, strip_include_prefix = "/src", visibility = [ "//src/google/protobuf/compiler/rust:__subpackages__", @@ -236,7 +246,7 @@ cc_library( deps = [ "//src/google/protobuf", "//src/google/protobuf:port", - "@com_google_absl//absl/log:absl_log", + "@abseil-cpp//absl/log:absl_log", ], ) @@ -244,6 +254,7 @@ cc_library( name = "upb_helpers", srcs = ["upb_helpers.cc"], hdrs = ["upb_helpers.h"], + copts = COPTS, strip_include_prefix = "/src", visibility = [ "//src/google/protobuf/compiler/rust:__subpackages__", @@ -251,6 +262,6 @@ cc_library( deps = [ "//src/google/protobuf", "//upb_generator/minitable:names", - "@com_google_absl//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_check", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/BUILD.bazel b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/BUILD.bazel index ccd7f7b94a1a5..71bd3ab285d66 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/BUILD.bazel @@ -42,9 +42,9 @@ cc_library( "//src/google/protobuf/compiler/rust:rust_field_type", "//src/google/protobuf/compiler/rust:upb_helpers", "//src/google/protobuf/io:tokenizer", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.cc index ed1e7fcfdf16b..d85f76a3ea5f9 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.cc @@ -23,18 +23,35 @@ namespace protobuf { namespace compiler { namespace rust { +bool IsSupportedField(Context& ctx, const FieldDescriptor& field) { + if (ctx.is_upb()) { + // All fields supported on upb kernel. + return true; + } + + // TODO: We do not support repeated strings on C++ kernel if + // they are not string_view or string type. + if (field.is_repeated() && + field.cpp_type() == FieldDescriptor::CPPTYPE_STRING && + field.cpp_string_type() != FieldDescriptor::CppStringType::kView && + field.cpp_string_type() != FieldDescriptor::CppStringType::kString) { + return false; + } + + // If cpp has made the accessors private, we can't make accessors on top. + if (internal::cpp::IsStringFieldWithPrivatizedAccessors(field)) { + return false; + } + + return true; +} + namespace { std::unique_ptr<AccessorGenerator> AccessorGeneratorFor( Context& ctx, const FieldDescriptor& field) { - // TODO: We do not support ctype=CORD fields or repeated - // ctype=STRING_PIECE fields on cpp kernel yet (upb doesn't care about ctype). - auto ctype = field.options().ctype(); - if (ctx.is_cpp() && - (ctype == FieldOptions::CORD || ctype == FieldOptions::STRING_PIECE) && - field.is_repeated()) { - return std::make_unique<UnsupportedField>( - "fields has an unsupported ctype"); + if (!IsSupportedField(ctx, field)) { + return std::make_unique<UnsupportedField>(); } if (field.is_map()) { @@ -57,7 +74,8 @@ std::unique_ptr<AccessorGenerator> AccessorGeneratorFor( return std::make_unique<SingularScalar>(); case RustFieldType::BYTES: case RustFieldType::STRING: - if (ctype == FieldOptions::CORD) { + if (ctx.is_cpp() && + field.cpp_string_type() == FieldDescriptor::CppStringType::kCord) { return std::make_unique<SingularCord>(); } return std::make_unique<SingularString>(); diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.h b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.h index 222c096c6b57a..a6c528537fe59 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.h +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/accessors.h @@ -17,6 +17,11 @@ namespace protobuf { namespace compiler { namespace rust { +// Returns true if the field will have accessors generated for it. This will +// return true for nearly all fields; there are a few edge cases of string +// types that we don't generate accessors for. +bool IsSupportedField(Context& ctx, const FieldDescriptor& field); + // Generates the Rust accessors: expected to be called once each for each // Message, MessageMut and MessageView's impl. void GenerateAccessorMsgImpl(Context& ctx, const FieldDescriptor& field, diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/generator.h b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/generator.h index 8b7da67a1072a..701c18d9752d2 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/generator.h +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/generator.h @@ -124,13 +124,9 @@ class RepeatedField final : public AccessorGenerator { class UnsupportedField final : public AccessorGenerator { public: - explicit UnsupportedField(std::string reason) : reason_(std::move(reason)) {} ~UnsupportedField() override = default; void InMsgImpl(Context& ctx, const FieldDescriptor& field, AccessorCase accessor_case) const override; - - private: - std::string reason_; }; class Map final : public AccessorGenerator { diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/map.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/map.cc index 2952df9ec7e0a..c166b01527fbe 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/map.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/map.cc @@ -129,12 +129,47 @@ void Map::InMsgImpl(Context& ctx, const FieldDescriptor& field, if (accessor_case == AccessorCase::VIEW) { return; } - ctx.Emit({}, R"rs( - pub fn set_$raw_field_name$(&mut self, src: impl $pb$::IntoProxied<$pb$::Map<$Key$, $Value$>>) { - // TODO: b/355493062 - Fix this extra copy. - self.$field$_mut().copy_from(src.into_proxied($pbi$::Private).as_view()); - } - )rs"); + if (ctx.is_upb()) { + ctx.Emit({}, R"rs( + pub fn set_$raw_field_name$( + &mut self, + src: impl $pb$::IntoProxied<$pb$::Map<$Key$, $Value$>>) { + let minitable_field = unsafe { + $pbr$::upb_MiniTable_GetFieldByIndex( + <Self as $pbr$::AssociatedMiniTable>::mini_table(), + $upb_mt_field_index$ + ) + }; + let mut val = src.into_proxied($pbi$::Private); + let val_as_mut = val.as_mut(); + let mut inner = val_as_mut.inner($pbi$::Private); + + self.arena().fuse(inner.arena()); + unsafe { + let value_ptr: *const *const $std$::ffi::c_void = + &(inner.as_raw().as_ptr() as *const $std$::ffi::c_void); + $pbr$::upb_Message_SetBaseField(self.raw_msg(), + minitable_field, + value_ptr as *const $std$::ffi::c_void); + } + } + )rs"); + } else { + ctx.Emit({{"move_setter_thunk", ThunkName(ctx, field, "set")}}, + R"rs( + pub fn set_$raw_field_name$( + &mut self, + src: impl $pb$::IntoProxied<$pb$::Map<$Key$, $Value$>>) { + let val = $std$::mem::ManuallyDrop::new( + src.into_proxied($pbi$::Private)); + unsafe { + $move_setter_thunk$( + self.raw_msg(), + val.as_raw($pbi$::Private)); + } + } + )rs"); + } }}}, R"rs( $getter$ @@ -150,6 +185,7 @@ void Map::InExternC(Context& ctx, const FieldDescriptor& field) const { { {"getter_thunk", ThunkName(ctx, field, "get")}, {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, + {"move_setter_thunk", ThunkName(ctx, field, "set")}, {"getter", [&] { if (ctx.is_upb()) { @@ -163,6 +199,9 @@ void Map::InExternC(Context& ctx, const FieldDescriptor& field) const { ctx.Emit({}, R"rs( fn $getter_thunk$(msg: $pbr$::RawMessage) -> $pbr$::RawMap; fn $getter_mut_thunk$(msg: $pbr$::RawMessage,) -> $pbr$::RawMap; + fn $move_setter_thunk$( + raw_msg: $pbr$::RawMessage, + value: $pbr$::RawMap); )rs"); } }}, @@ -175,23 +214,30 @@ void Map::InExternC(Context& ctx, const FieldDescriptor& field) const { void Map::InThunkCc(Context& ctx, const FieldDescriptor& field) const { ABSL_CHECK(ctx.is_cpp()); - ctx.Emit({{"field", cpp::FieldName(&field)}, - {"Key", MapElementTypeName(*field.message_type()->map_key())}, - {"Value", MapElementTypeName(*field.message_type()->map_value())}, - {"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, - {"getter_thunk", ThunkName(ctx, field, "get")}, - {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, - {"impls", - [&] { - ctx.Emit( - R"cc( - const void* $getter_thunk$(const $QualifiedMsg$* msg) { - return &msg->$field$(); - } - void* $getter_mut_thunk$($QualifiedMsg$* msg) { return msg->mutable_$field$(); } - )cc"); - }}}, - "$impls$"); + ctx.Emit( + {{"field", cpp::FieldName(&field)}, + {"Key", MapElementTypeName(*field.message_type()->map_key())}, + {"Value", MapElementTypeName(*field.message_type()->map_value())}, + {"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, + {"getter_thunk", ThunkName(ctx, field, "get")}, + {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, + {"move_setter_thunk", ThunkName(ctx, field, "set")}, + {"impls", + [&] { + ctx.Emit( + R"cc( + const void* $getter_thunk$(const $QualifiedMsg$* msg) { + return &msg->$field$(); + } + void* $getter_mut_thunk$($QualifiedMsg$* msg) { return msg->mutable_$field$(); } + void $move_setter_thunk$($QualifiedMsg$* msg, + google::protobuf::Map<$Key$, $Value$>* value) { + *msg->mutable_$field$() = std::move(*value); + delete value; + } + )cc"); + }}}, + "$impls$"); } } // namespace rust diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/unsupported_field.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/unsupported_field.cc index 1ca66f63ef98b..2131b479b75c1 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/unsupported_field.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/unsupported_field.cc @@ -18,10 +18,10 @@ namespace rust { void UnsupportedField::InMsgImpl(Context& ctx, const FieldDescriptor& field, AccessorCase accessor_case) const { - ctx.Emit({{"reason", reason_}}, R"rs( - // Unsupported! :( Reason: $reason$ + ctx.Emit(R"rs( + // Unsupported field! :( + )rs"); - ctx.printer().PrintRaw("\n"); } } // namespace rust diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/with_presence.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/with_presence.cc index 7f2f15f77ae0d..d5e9b18c9f5fd 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/with_presence.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/accessors/with_presence.cc @@ -83,7 +83,12 @@ void WithPresenceAccessorsInMsgImpl(Context& ctx, const FieldDescriptor& field, {"opt_getter", [&] { // Cord fields don't support the _opt getter. - if (field.options().ctype() == FieldOptions::CORD) return; + if (ctx.is_cpp() && + field.cpp_type() == FieldDescriptor::CPPTYPE_STRING && + field.cpp_string_type() == + FieldDescriptor::CppStringType::kCord) { + return; + } ctx.Emit( R"rs( pub fn $raw_field_name$_opt($view_self$) -> $pb$::Optional<$view_type$> { diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/context.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/context.cc index 8c41b4dee6570..6d5ab938d336e 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/context.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/context.cc @@ -78,6 +78,15 @@ absl::StatusOr<Options> Options::Parse(absl::string_view param) { opts.strip_nonfunctional_codegen = true; } + auto generated_entry_point_rs_file_name_arg = + absl::c_find_if(args, [](auto& arg) { + return arg.first == "generated_entry_point_rs_file_name"; + }); + if (generated_entry_point_rs_file_name_arg != args.end()) { + opts.generated_entry_point_rs_file_name = + generated_entry_point_rs_file_name_arg->second; + } + return opts; } diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/context.h b/third_party/protobuf/src/google/protobuf/compiler/rust/context.h index 23a1e6234d63d..ec77dccda2731 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/context.h +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/context.h @@ -10,6 +10,7 @@ #include <algorithm> #include <string> +#include <utility> #include <vector> #include "absl/container/flat_hash_map.h" @@ -48,6 +49,9 @@ struct Options { std::string mapping_file_path; bool strip_nonfunctional_codegen = false; + // The name to use for the generated entry point rs file. + std::string generated_entry_point_rs_file_name = "generated.rs"; + static absl::StatusOr<Options> Parse(absl::string_view param); }; @@ -83,10 +87,11 @@ class Context { public: Context(const Options* opts, const RustGeneratorContext* rust_generator_context, - io::Printer* printer) + io::Printer* printer, std::vector<std::string> modules) : opts_(opts), rust_generator_context_(rust_generator_context), - printer_(printer) {} + printer_(printer), + modules_(std::move(modules)) {} Context(const Context&) = delete; Context& operator=(const Context&) = delete; @@ -105,7 +110,7 @@ class Context { io::Printer& printer() const { return *printer_; } Context WithPrinter(io::Printer* printer) const { - return Context(opts_, rust_generator_context_, printer); + return Context(opts_, rust_generator_context_, printer, modules_); } // Forwards to Emit(), which will likely be called all the time. @@ -127,19 +132,43 @@ class Context { auto it = rust_generator_context_->import_path_to_crate_name_.find(import_path); if (it == rust_generator_context_->import_path_to_crate_name_.end()) { - ABSL_LOG(FATAL) + ABSL_LOG(ERROR) << "Path " << import_path - << " not found in crate mapping. Crate mapping has " + << " not found in crate mapping. Crate mapping contains " << rust_generator_context_->import_path_to_crate_name_.size() - << " entries"; + << " entries:"; + for (const auto& entry : + rust_generator_context_->import_path_to_crate_name_) { + ABSL_LOG(ERROR) << " " << entry.first << " : " << entry.second << "\n"; + } + ABSL_LOG(FATAL) << "Cannot continue with missing crate mapping."; } return it->second; } + // Opening and closing modules should always be done with PushModule() and + // PopModule(). Knowing what module we are in is important, because it allows + // us to unambiguously reference other identifiers in the same crate. We + // cannot just use crate::, because when we are building with Cargo, the + // generated code does not necessarily live in the crate root. + void PushModule(absl::string_view name) { + Emit({{"mod_name", name}}, "pub mod $mod_name$ {"); + modules_.emplace_back(name); + } + + void PopModule() { + Emit({{"mod_name", modules_.back()}}, "} // pub mod $mod_name$"); + modules_.pop_back(); + } + + // Returns the current depth of module nesting. + size_t GetModuleDepth() const { return modules_.size(); } + private: const Options* opts_; const RustGeneratorContext* rust_generator_context_; io::Printer* printer_; + std::vector<std::string> modules_; }; bool IsInCurrentlyGeneratingCrate(Context& ctx, const FileDescriptor& file); diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/crate_mapping.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/crate_mapping.cc index ebea7dc2633c6..ae881fc41a034 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/crate_mapping.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/crate_mapping.cc @@ -7,7 +7,6 @@ #include <string> #include <vector> -#include "google/protobuf/testing/file.h" #include "absl/container/flat_hash_map.h" #include "absl/status/status.h" #include "absl/status/statusor.h" @@ -22,6 +21,33 @@ namespace protobuf { namespace compiler { namespace rust { +// We would love to use //file/base here, but that creates a dependency cycle, +// since //file/base transitively depends on protoc. +namespace { +struct File { + static absl::Status ReadFileToString(const std::string& name, + std::string* output, bool text_mode) { + char buffer[1024]; + FILE* file = fopen(name.c_str(), text_mode ? "rt" : "rb"); + if (file == nullptr) return absl::NotFoundError("Could not open file"); + + while (true) { + size_t n = fread(buffer, 1, sizeof(buffer), file); + if (n <= 0) break; + output->append(buffer, n); + } + + int error = ferror(file); + if (fclose(file) != 0) return absl::InternalError("Failed to close file"); + if (error != 0) { + return absl::InternalError(absl::StrCat("Failed to read the file ", name, + ". Error code: ", error)); + } + return absl::OkStatus(); + } +}; +} // namespace + absl::StatusOr<absl::flat_hash_map<std::string, std::string>> GetImportPathToCrateNameMap(const Options* opts) { absl::flat_hash_map<std::string, std::string> mapping; diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/enum.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/enum.cc index 7e35ff2e058d8..3be4fce4eb623 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/enum.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/enum.cc @@ -45,106 +45,26 @@ std::vector<std::pair<absl::string_view, int32_t>> EnumValuesInput( return result; } -void EnumProxiedInMapValue(Context& ctx, const EnumDescriptor& desc) { +void TypeConversions(Context& ctx, const EnumDescriptor& desc) { switch (ctx.opts().kernel) { case Kernel::kCpp: - for (const auto& t : kMapKeyTypes) { - ctx.Emit( - {{"map_new_thunk", RawMapThunk(ctx, desc, t.thunk_ident, "new")}, - {"map_free_thunk", RawMapThunk(ctx, desc, t.thunk_ident, "free")}, - {"map_clear_thunk", - RawMapThunk(ctx, desc, t.thunk_ident, "clear")}, - {"map_size_thunk", RawMapThunk(ctx, desc, t.thunk_ident, "size")}, - {"map_insert_thunk", - RawMapThunk(ctx, desc, t.thunk_ident, "insert")}, - {"map_get_thunk", RawMapThunk(ctx, desc, t.thunk_ident, "get")}, - {"map_remove_thunk", - RawMapThunk(ctx, desc, t.thunk_ident, "remove")}, - {"map_iter_thunk", RawMapThunk(ctx, desc, t.thunk_ident, "iter")}, - {"map_iter_get_thunk", - RawMapThunk(ctx, desc, t.thunk_ident, "iter_get")}, - {"to_ffi_key_expr", t.rs_to_ffi_key_expr}, - io::Printer::Sub("ffi_key_t", [&] { ctx.Emit(t.rs_ffi_key_t); }) - .WithSuffix(""), - io::Printer::Sub("key_t", [&] { ctx.Emit(t.rs_key_t); }) - .WithSuffix(""), - io::Printer::Sub("from_ffi_key_expr", - [&] { ctx.Emit(t.rs_from_ffi_key_expr); }) - .WithSuffix("")}, - R"rs( - impl $pb$::ProxiedInMapValue<$key_t$> for $name$ { - fn map_new(_private: $pbi$::Private) -> $pb$::Map<$key_t$, Self> { - unsafe { - $pb$::Map::from_inner( - $pbi$::Private, - $pbr$::InnerMap::new($pbr$::$map_new_thunk$()) - ) - } - } + ctx.Emit( + R"rs( + impl $pbr$::CppMapTypeConversions for $name$ { + fn get_prototype() -> $pbr$::MapValue { + Self::to_map_value(Self::default()) + } - unsafe fn map_free(_private: $pbi$::Private, map: &mut $pb$::Map<$key_t$, Self>) { - unsafe { $pbr$::$map_free_thunk$(map.as_raw($pbi$::Private)); } - } + fn to_map_value(self) -> $pbr$::MapValue { + $pbr$::MapValue::make_u32(self.0 as u32) + } - fn map_clear(mut map: $pb$::MapMut<$key_t$, Self>) { - unsafe { $pbr$::$map_clear_thunk$(map.as_raw($pbi$::Private)); } - } - - fn map_len(map: $pb$::MapView<$key_t$, Self>) -> usize { - unsafe { $pbr$::$map_size_thunk$(map.as_raw($pbi$::Private)) } - } - - fn map_insert(mut map: $pb$::MapMut<$key_t$, Self>, key: $pb$::View<'_, $key_t$>, value: impl $pb$::IntoProxied<Self>) -> bool { - unsafe { $pbr$::$map_insert_thunk$(map.as_raw($pbi$::Private), $to_ffi_key_expr$, value.into_proxied($pbi$::Private).0) } - } - - fn map_get<'a>(map: $pb$::MapView<'a, $key_t$, Self>, key: $pb$::View<'_, $key_t$>) -> $Option$<$pb$::View<'a, Self>> { - let key = $to_ffi_key_expr$; - let mut value = $std$::mem::MaybeUninit::uninit(); - let found = unsafe { $pbr$::$map_get_thunk$(map.as_raw($pbi$::Private), key, value.as_mut_ptr()) }; - if !found { - return None; - } - Some(unsafe { $name$(value.assume_init()) }) - } - - fn map_remove(mut map: $pb$::MapMut<$key_t$, Self>, key: $pb$::View<'_, $key_t$>) -> bool { - let mut value = $std$::mem::MaybeUninit::uninit(); - unsafe { $pbr$::$map_remove_thunk$(map.as_raw($pbi$::Private), $to_ffi_key_expr$, value.as_mut_ptr()) } - } - - fn map_iter(map: $pb$::MapView<$key_t$, Self>) -> $pb$::MapIter<$key_t$, Self> { - // SAFETY: - // - The backing map for `map.as_raw` is valid for at least '_. - // - A View that is live for '_ guarantees the backing map is unmodified for '_. - // - The `iter` function produces an iterator that is valid for the key - // and value types, and live for at least '_. - unsafe { - $pb$::MapIter::from_raw( - $pbi$::Private, - $pbr$::$map_iter_thunk$(map.as_raw($pbi$::Private)) - ) - } - } - - fn map_iter_next<'a>(iter: &mut $pb$::MapIter<'a, $key_t$, Self>) -> $Option$<($pb$::View<'a, $key_t$>, $pb$::View<'a, Self>)> { - // SAFETY: - // - The `MapIter` API forbids the backing map from being mutated for 'a, - // and guarantees that it's the correct key and value types. - // - The thunk is safe to call as long as the iterator isn't at the end. - // - The thunk always writes to key and value fields and does not read. - // - The thunk does not increment the iterator. - unsafe { - iter.as_raw_mut($pbi$::Private).next_unchecked::<$key_t$, Self, _, _>( - |iter, key, value| { $pbr$::$map_iter_get_thunk$(iter, key, value) }, - |ffi_key| $from_ffi_key_expr$, - |value| $name$(value), - ) - } - } - } - )rs"); - } + unsafe fn from_map_value<'a>(value: $pbr$::MapValue) -> $pb$::View<'a, Self> { + debug_assert_eq!(value.tag, $pbr$::MapValueTag::U32); + $name$(unsafe { value.val.u as i32 }) + } + } + )rs"); return; case Kernel::kUpb: ctx.Emit(R"rs( @@ -159,7 +79,7 @@ void EnumProxiedInMapValue(Context& ctx, const EnumDescriptor& desc) { } unsafe fn into_message_value_fuse_if_required( - raw_parent_arena: $pbr$::RawArena, + _raw_parent_arena: $pbr$::RawArena, val: Self) -> $pbr$::upb_MessageValue { $pbr$::upb_MessageValue { int32_val: val.0 } } @@ -242,6 +162,29 @@ void GenerateEnumDefinition(Context& ctx, const EnumDescriptor& desc) { } } }}, + {"constant_name_fn", + [&] { + ctx.Emit({{"name_cases", + [&] { + for (const auto& value : values) { + std::string number_str = absl::StrCat(value.number); + ctx.Emit({{"variant_name", value.name}, + {"number", number_str}}, + R"rs( + $number$ => "$variant_name$", + )rs"); + } + }}}, + R"rs( + fn constant_name(&self) -> $Option$<&'static str> { + #[allow(unreachable_patterns)] // In the case of aliases, just emit them all and let the first one match. + Some(match self.0 { + $name_cases$ + _ => return None + }) + } + )rs"); + }}, // The default value of an enum is the first listed value. // The compiler checks that this is equal to 0 for open enums. {"default_int_value", absl::StrCat(desc.value(0)->number())}, @@ -277,16 +220,18 @@ void GenerateEnumDefinition(Context& ctx, const EnumDescriptor& desc) { )rs"); } }}, - {"impl_proxied_in_map", [&] { EnumProxiedInMapValue(ctx, desc); }}, + {"type_conversions_impl", [&] { TypeConversions(ctx, desc); }}, }, R"rs( #[repr(transparent)] - #[derive(Clone, Copy, PartialEq, Eq)] + #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct $name$(i32); #[allow(non_upper_case_globals)] impl $name$ { $variants$ + + $constant_name_fn$ } impl $std$::convert::From<$name$> for i32 { @@ -305,7 +250,11 @@ void GenerateEnumDefinition(Context& ctx, const EnumDescriptor& desc) { impl $std$::fmt::Debug for $name$ { fn fmt(&self, f: &mut $std$::fmt::Formatter<'_>) -> $std$::fmt::Result { - f.debug_tuple(stringify!($name$)).field(&self.0).finish() + if let Some(constant_name) = self.constant_name() { + write!(f, "$name$::{}", constant_name) + } else { + write!(f, "$name$::from({})", self.0) + } } } @@ -411,7 +360,7 @@ void GenerateEnumDefinition(Context& ctx, const EnumDescriptor& desc) { } } - $impl_proxied_in_map$ + $type_conversions_impl$ )rs"); } diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/generator.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/generator.cc index ecadf48fb0bde..64187f02dd70f 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/generator.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/generator.cc @@ -9,6 +9,7 @@ #include <memory> #include <string> +#include <utility> #include <vector> #include "absl/algorithm/container.h" @@ -17,7 +18,9 @@ #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "absl/strings/strip.h" #include "absl/types/span.h" #include "google/protobuf/compiler/code_generator.h" #include "google/protobuf/compiler/cpp/names.h" @@ -27,6 +30,7 @@ #include "google/protobuf/compiler/rust/message.h" #include "google/protobuf/compiler/rust/naming.h" #include "google/protobuf/compiler/rust/relative_path.h" +#include "google/protobuf/compiler/versions.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/io/printer.h" @@ -37,19 +41,6 @@ namespace compiler { namespace rust { namespace { -// Emits `pub use <internal submodule name>::Type` for all messages and enums of -// a `non_primary_src` into the `primary_file`. -// -// `non_primary_src` has to be a non-primary src of the current `proto_library`. -void EmitPubUseOfOwnTypes(Context& ctx, const FileDescriptor& primary_file, - const FileDescriptor& non_primary_src) { - auto mod = RustInternalModuleName(ctx, non_primary_src); - ctx.Emit({{"mod", mod}}, R"rs( - #[allow(unused_imports)] - pub use crate::$mod$::*; - )rs"); -} - // Emits `pub use <crate_name>::<modules for parent types>::Type` for all // messages and enums of a `dep`. This should only be // called for 'import public' deps. @@ -57,20 +48,20 @@ void EmitPublicImportsForDepFile(Context& ctx, const FileDescriptor* dep) { std::string crate_name = GetCrateName(ctx, *dep); for (int i = 0; i < dep->message_type_count(); ++i) { auto* msg = dep->message_type(i); - auto path = GetCrateRelativeQualifiedPath(ctx, *msg); - ctx.Emit({{"crate", crate_name}, {"pkg::Msg", path}}, + auto path = RsTypePath(ctx, *msg); + ctx.Emit({{"pkg::Msg", path}}, R"rs( - pub use $crate$::$pkg::Msg$; - pub use $crate$::$pkg::Msg$View; - pub use $crate$::$pkg::Msg$Mut; + pub use $pkg::Msg$; + pub use $pkg::Msg$View; + pub use $pkg::Msg$Mut; )rs"); } for (int i = 0; i < dep->enum_type_count(); ++i) { auto* enum_ = dep->enum_type(i); - auto path = GetCrateRelativeQualifiedPath(ctx, *enum_); - ctx.Emit({{"crate", crate_name}, {"pkg::Enum", path}}, + auto path = RsTypePath(ctx, *enum_); + ctx.Emit({{"pkg::Enum", path}}, R"rs( - pub use $crate$::$pkg::Enum$; + pub use $pkg::Enum$; )rs"); } } @@ -85,53 +76,56 @@ void EmitPublicImportsForDepFile(Context& ctx, const FileDescriptor* dep) { // Note we don't reexport entire crates, only messages and enums from files that // have been explicitly publicly imported. It may happen that a `proto_library` // defines multiple files, but not all are publicly imported. -void EmitPublicImports(Context& ctx, - const std::vector<const FileDescriptor*>& srcs) { - absl::flat_hash_set<const FileDescriptor*> files_in_current_target( - srcs.begin(), srcs.end()); - std::vector<const FileDescriptor*> files_to_visit(srcs.begin(), srcs.end()); - absl::c_reverse(files_to_visit); +void EmitPublicImports(const RustGeneratorContext& rust_generator_context, + Context& ctx, const FileDescriptor& file) { + std::vector<const FileDescriptor*> files_to_visit{&file}; while (!files_to_visit.empty()) { - const FileDescriptor* file = files_to_visit.back(); + const FileDescriptor* f = files_to_visit.back(); files_to_visit.pop_back(); - if (!files_in_current_target.contains(file)) { - EmitPublicImportsForDepFile(ctx, file); + if (!rust_generator_context.is_file_in_current_crate(*f)) { + EmitPublicImportsForDepFile(ctx, f); } - for (int i = 0; i < file->public_dependency_count(); ++i) { - files_to_visit.push_back(file->dependency(i)); + for (int i = 0; i < f->public_dependency_count(); ++i) { + files_to_visit.push_back(f->public_dependency(i)); } } } -// Emits submodule declarations so `rustc` can find non primary sources from -// the primary file. -void DeclareSubmodulesForNonPrimarySrcs( - Context& ctx, const FileDescriptor& primary_file, - absl::Span<const FileDescriptor* const> non_primary_srcs) { - std::string primary_file_path = GetRsFile(ctx, primary_file); - RelativePath primary_relpath(primary_file_path); - for (const FileDescriptor* non_primary_src : non_primary_srcs) { - std::string non_primary_file_path = GetRsFile(ctx, *non_primary_src); +void EmitEntryPointRsFile(GeneratorContext* generator_context, + Context& ctx_without_printer, + const std::vector<const FileDescriptor*>& files) { + // Besides the one .rs file per .proto file, we additional emit one + // entry_point rs file here which re-exports all of the types generated by + // this same proto_library. + std::string entry_point_rs_file_path = + GetEntryPointRsFilePath(ctx_without_printer, *files.front()); + auto outfile = + absl::WrapUnique(generator_context->Open(entry_point_rs_file_path)); + io::Printer printer(outfile.get()); + Context ctx = ctx_without_printer.WithPrinter(&printer); + + // Declare the submodules for all of the the generated code and pub re-export + // all of them into a flat namespace. + RelativePath primary_relpath(entry_point_rs_file_path); + for (const FileDescriptor* file : files) { + std::string non_primary_file_path = GetRsFile(ctx, *file); std::string relative_mod_path = primary_relpath.Relative(RelativePath(non_primary_file_path)); + // Temporarily emit these re-exported mods as pub to avoid issues with + // Crubit. In a future change we should change these back to be private + // mods. ctx.Emit({{"file_path", relative_mod_path}, - {"mod_name", RustInternalModuleName(ctx, *non_primary_src)}}, + {"mod_name", RustInternalModuleName(*file)}}, R"rs( - #[path="$file_path$"] - #[allow(non_snake_case)] - pub mod $mod_name$; - )rs"); - } -} + #[path="$file_path$"] + #[allow(nonstandard_style)] + pub mod internal_do_not_use_$mod_name$; -// Emits `pub use <...>::Msg` for all messages in non primary sources. -void ReexportMessagesFromSubmodules( - Context& ctx, const FileDescriptor& primary_file, - absl::Span<const FileDescriptor* const> non_primary_srcs) { - for (const FileDescriptor* file : non_primary_srcs) { - EmitPubUseOfOwnTypes(ctx, primary_file, *file); + #[allow(unused_imports, nonstandard_style)] + pub use internal_do_not_use_$mod_name$::*; + )rs"); } } @@ -160,7 +154,10 @@ bool RustGenerator::Generate(const FileDescriptor* file, RustGeneratorContext rust_generator_context(&files_in_current_crate, &*import_path_to_crate_name); - Context ctx_without_printer(&*opts, &rust_generator_context, nullptr); + std::vector<std::string> modules; + modules.emplace_back(RustInternalModuleName(*file)); + Context ctx_without_printer(&*opts, &rust_generator_context, nullptr, + std::move(modules)); auto outfile = absl::WrapUnique( generator_context->Open(GetRsFile(ctx_without_printer, *file))); @@ -169,31 +166,32 @@ bool RustGenerator::Generate(const FileDescriptor* file, // Convenience shorthands for common symbols. auto v = ctx.printer().WithVars({ - {"std", "::__std"}, - {"pb", "::__pb"}, - {"pbi", "::__pb::__internal"}, - {"pbr", "::__pb::__runtime"}, - {"NonNull", "::__std::ptr::NonNull"}, - {"Phantom", "::__std::marker::PhantomData"}, - {"Result", "::__std::result::Result"}, - {"Option", "::__std::option::Option"}, + {"std", "::std"}, + {"pb", "::protobuf"}, + {"pbi", "::protobuf::__internal"}, + {"pbr", "::protobuf::__internal::runtime"}, + {"NonNull", "::std::ptr::NonNull"}, + {"Phantom", "::std::marker::PhantomData"}, + {"Result", "::std::result::Result"}, + {"Option", "::std::option::Option"}, }); - ctx.Emit({{"kernel", KernelRsName(ctx.opts().kernel)}}, R"rs( - extern crate protobuf_$kernel$ as __pb; - extern crate std as __std; + std::string expected_runtime_version = absl::StrCat( + absl::StripSuffix(PROTOBUF_RUST_VERSION_STRING, "-dev"), "-beta2"); + ctx.Emit({{"expected_runtime_version", expected_runtime_version}}, + R"rs( + const _: () = $pbi$::assert_compatible_gencode_version("$expected_runtime_version$"); )rs"); std::vector<const FileDescriptor*> file_contexts( files_in_current_crate.begin(), files_in_current_crate.end()); - // Generating the primary file? - if (file == &rust_generator_context.primary_file()) { - auto non_primary_srcs = absl::MakeConstSpan(file_contexts).subspan(1); - DeclareSubmodulesForNonPrimarySrcs(ctx, *file, non_primary_srcs); - ReexportMessagesFromSubmodules(ctx, *file, non_primary_srcs); - EmitPublicImports(ctx, file_contexts); + // When the generator is called for the 'first' file we also want to emit the + // 'entry point' rs file. This is the file that will simply pub re-export all + // everything from all of the other generated .rs files. + if (file == files_in_current_crate.front()) { + EmitEntryPointRsFile(generator_context, ctx_without_printer, file_contexts); } std::unique_ptr<io::ZeroCopyOutputStream> thunks_cc; @@ -225,12 +223,13 @@ bool RustGenerator::Generate(const FileDescriptor* file, #include "google/protobuf/map.h" #include "google/protobuf/repeated_field.h" #include "google/protobuf/repeated_ptr_field.h" -#include "rust/cpp_kernel/map.h" #include "rust/cpp_kernel/serialized_data.h" #include "rust/cpp_kernel/strings.h" )cc"); } + EmitPublicImports(rust_generator_context, ctx, *file); + for (int i = 0; i < file->message_type_count(); ++i) { auto& msg = *file->message_type(i); diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/message.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/message.cc index 18efb64c043dc..1a11c8c7290b3 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/message.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/message.cc @@ -7,11 +7,8 @@ #include "google/protobuf/compiler/rust/message.h" -#include <string> - #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" -#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "google/protobuf/compiler/cpp/helpers.h" #include "google/protobuf/compiler/cpp/names.h" @@ -195,30 +192,10 @@ void CppMessageExterns(Context& ctx, const Descriptor& msg) { ABSL_CHECK(ctx.is_cpp()); ctx.Emit( {{"new_thunk", ThunkName(ctx, msg, "new")}, - {"default_instance_thunk", ThunkName(ctx, msg, "default_instance")}, - {"repeated_new_thunk", ThunkName(ctx, msg, "repeated_new")}, - {"repeated_free_thunk", ThunkName(ctx, msg, "repeated_free")}, - {"repeated_len_thunk", ThunkName(ctx, msg, "repeated_len")}, - {"repeated_get_thunk", ThunkName(ctx, msg, "repeated_get")}, - {"repeated_get_mut_thunk", ThunkName(ctx, msg, "repeated_get_mut")}, - {"repeated_add_thunk", ThunkName(ctx, msg, "repeated_add")}, - {"repeated_clear_thunk", ThunkName(ctx, msg, "repeated_clear")}, - {"repeated_copy_from_thunk", ThunkName(ctx, msg, "repeated_copy_from")}, - {"repeated_reserve_thunk", ThunkName(ctx, msg, "repeated_reserve")}, - {"map_size_info_thunk", ThunkName(ctx, msg, "size_info")}}, + {"default_instance_thunk", ThunkName(ctx, msg, "default_instance")}}, R"rs( fn $new_thunk$() -> $pbr$::RawMessage; fn $default_instance_thunk$() -> $pbr$::RawMessage; - fn $repeated_new_thunk$() -> $pbr$::RawRepeatedField; - fn $repeated_free_thunk$(raw: $pbr$::RawRepeatedField); - fn $repeated_len_thunk$(raw: $pbr$::RawRepeatedField) -> usize; - fn $repeated_add_thunk$(raw: $pbr$::RawRepeatedField) -> $pbr$::RawMessage; - fn $repeated_get_thunk$(raw: $pbr$::RawRepeatedField, index: usize) -> $pbr$::RawMessage; - fn $repeated_get_mut_thunk$(raw: $pbr$::RawRepeatedField, index: usize) -> $pbr$::RawMessage; - fn $repeated_clear_thunk$(raw: $pbr$::RawRepeatedField); - fn $repeated_copy_from_thunk$(dst: $pbr$::RawRepeatedField, src: $pbr$::RawRepeatedField); - fn $repeated_reserve_thunk$(raw: $pbr$::RawRepeatedField, additional: usize); - fn $map_size_info_thunk$(i: $pbr$::MapNodeSizeInfoIndex) -> $pbr$::MapNodeSizeInfo; )rs"); } @@ -367,18 +344,6 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { ctx.Emit( { {"Msg", RsSafeName(msg.name())}, - {"repeated_len_thunk", ThunkName(ctx, msg, "repeated_len")}, - {"repeated_get_thunk", ThunkName(ctx, msg, "repeated_get")}, - {"repeated_get_mut_thunk", - ThunkName(ctx, msg, "repeated_get_mut")}, - {"repeated_add_thunk", ThunkName(ctx, msg, "repeated_add")}, - {"repeated_new_thunk", ThunkName(ctx, msg, "repeated_new")}, - {"repeated_free_thunk", ThunkName(ctx, msg, "repeated_free")}, - {"repeated_clear_thunk", ThunkName(ctx, msg, "repeated_clear")}, - {"repeated_copy_from_thunk", - ThunkName(ctx, msg, "repeated_copy_from")}, - {"repeated_reserve_thunk", - ThunkName(ctx, msg, "repeated_reserve")}, }, R"rs( unsafe impl $pb$::ProxiedInRepeated for $Msg$ { @@ -387,8 +352,7 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { // - The thunk returns an unaliased and valid `RepeatedPtrField*` unsafe { $pb$::Repeated::from_inner($pbi$::Private, - $pbr$::InnerRepeated::from_raw($repeated_new_thunk$() - ) + $pbr$::InnerRepeated::from_raw($pbr$::proto2_rust_RepeatedField_Message_new()) ) } } @@ -396,12 +360,12 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { unsafe fn repeated_free(_private: $pbi$::Private, f: &mut $pb$::Repeated<Self>) { // SAFETY // - `f.raw()` is a valid `RepeatedPtrField*`. - unsafe { $repeated_free_thunk$(f.as_view().as_raw($pbi$::Private)) } + unsafe { $pbr$::proto2_rust_RepeatedField_Message_free(f.as_view().as_raw($pbi$::Private)) } } fn repeated_len(f: $pb$::View<$pb$::Repeated<Self>>) -> usize { // SAFETY: `f.as_raw()` is a valid `RepeatedPtrField*`. - unsafe { $repeated_len_thunk$(f.as_raw($pbi$::Private)) } + unsafe { $pbr$::proto2_rust_RepeatedField_Message_size(f.as_raw($pbi$::Private)) } } unsafe fn repeated_set_unchecked( @@ -415,7 +379,7 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { // - `v.raw_msg()` is a valid `const Message&`. unsafe { $pbr$::proto2_rust_Message_copy_from( - $repeated_get_mut_thunk$(f.as_raw($pbi$::Private), i), + $pbr$::proto2_rust_RepeatedField_Message_get_mut(f.as_raw($pbi$::Private), i), v.into_proxied($pbi$::Private).raw_msg(), ); } @@ -428,13 +392,13 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { // SAFETY: // - `f.as_raw()` is a valid `const RepeatedPtrField&`. // - `i < len(f)` is promised by caller. - let msg = unsafe { $repeated_get_thunk$(f.as_raw($pbi$::Private), i) }; + let msg = unsafe { $pbr$::proto2_rust_RepeatedField_Message_get(f.as_raw($pbi$::Private), i) }; $pb$::View::<Self>::new($pbi$::Private, msg) } fn repeated_clear(mut f: $pb$::Mut<$pb$::Repeated<Self>>) { // SAFETY: // - `f.as_raw()` is a valid `RepeatedPtrField*`. - unsafe { $repeated_clear_thunk$(f.as_raw($pbi$::Private)) }; + unsafe { $pbr$::proto2_rust_RepeatedField_Message_clear(f.as_raw($pbi$::Private)) }; } fn repeated_push(mut f: $pb$::Mut<$pb$::Repeated<Self>>, v: impl $pb$::IntoProxied<Self>) { @@ -442,7 +406,8 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { // - `f.as_raw()` is a valid `RepeatedPtrField*`. // - `v.raw_msg()` is a valid `const Message&`. unsafe { - let new_elem = $repeated_add_thunk$(f.as_raw($pbi$::Private)); + let prototype = <$Msg$View as $std$::default::Default>::default().raw_msg(); + let new_elem = $pbr$::proto2_rust_RepeatedField_Message_add(f.as_raw($pbi$::Private), prototype); $pbr$::proto2_rust_Message_copy_from(new_elem, v.into_proxied($pbi$::Private).raw_msg()); } } @@ -455,7 +420,7 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { // - `dest.as_raw()` is a valid `RepeatedPtrField*`. // - `src.as_raw()` is a valid `const RepeatedPtrField&`. unsafe { - $repeated_copy_from_thunk$(dest.as_raw($pbi$::Private), src.as_raw($pbi$::Private)); + $pbr$::proto2_rust_RepeatedField_Message_copy_from(dest.as_raw($pbi$::Private), src.as_raw($pbi$::Private)); } } @@ -465,7 +430,7 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { ) { // SAFETY: // - `f.as_raw()` is a valid `RepeatedPtrField*`. - unsafe { $repeated_reserve_thunk$(f.as_raw($pbi$::Private), additional) } + unsafe { $pbr$::proto2_rust_RepeatedField_Message_reserve(f.as_raw($pbi$::Private), additional) } } } )rs"); @@ -575,126 +540,26 @@ void MessageProxiedInRepeated(Context& ctx, const Descriptor& msg) { ABSL_LOG(FATAL) << "unreachable"; } -void MessageProxiedInMapValue(Context& ctx, const Descriptor& msg) { +void TypeConversions(Context& ctx, const Descriptor& msg) { switch (ctx.opts().kernel) { case Kernel::kCpp: - for (const auto& t : kMapKeyTypes) { - ctx.Emit( - {{"map_size_info_thunk", ThunkName(ctx, msg, "size_info")}, - {"map_insert", - absl::StrCat("proto2_rust_map_insert_", t.thunk_ident)}, - {"map_remove", - absl::StrCat("proto2_rust_map_remove_", t.thunk_ident)}, - {"map_get", absl::StrCat("proto2_rust_map_get_", t.thunk_ident)}, - {"map_iter_get", - absl::StrCat("proto2_rust_map_iter_get_", t.thunk_ident)}, - {"key_expr", t.rs_to_ffi_key_expr}, - {"key_is_string", - t.thunk_ident == "ProtoString" ? "true" : "false"}, - io::Printer::Sub("ffi_key_t", [&] { ctx.Emit(t.rs_ffi_key_t); }) - .WithSuffix(""), - io::Printer::Sub("key_t", [&] { ctx.Emit(t.rs_key_t); }) - .WithSuffix(""), - io::Printer::Sub("from_ffi_key_expr", - [&] { ctx.Emit(t.rs_from_ffi_key_expr); }) - .WithSuffix("")}, - R"rs( - impl $pb$::ProxiedInMapValue<$key_t$> for $Msg$ { - fn map_new(_private: $pbi$::Private) -> $pb$::Map<$key_t$, Self> { - unsafe { - $pb$::Map::from_inner( - $pbi$::Private, - $pbr$::InnerMap::new($pbr$::proto2_rust_map_new()) - ) - } - } + ctx.Emit( + R"rs( + impl $pbr$::CppMapTypeConversions for $Msg$ { + fn get_prototype() -> $pbr$::MapValue { + $pbr$::MapValue::make_message(<$Msg$View as $std$::default::Default>::default().raw_msg()) + } - unsafe fn map_free(_private: $pbi$::Private, map: &mut $pb$::Map<$key_t$, Self>) { - use $pbr$::MapNodeSizeInfoIndexForType; - unsafe { $pbr$::proto2_rust_map_free(map.as_raw($pbi$::Private), $key_is_string$, $map_size_info_thunk$($key_t$::SIZE_INFO_INDEX)); } - } + fn to_map_value(self) -> $pbr$::MapValue { + $pbr$::MapValue::make_message(std::mem::ManuallyDrop::new(self).raw_msg()) + } - fn map_clear(mut map: $pb$::MapMut<$key_t$, Self>) { - use $pbr$::MapNodeSizeInfoIndexForType; - unsafe { $pbr$::proto2_rust_map_clear(map.as_raw($pbi$::Private), $key_is_string$, $map_size_info_thunk$($key_t$::SIZE_INFO_INDEX)); } - } - - fn map_len(map: $pb$::MapView<$key_t$, Self>) -> usize { - unsafe { $pbr$::proto2_rust_map_size(map.as_raw($pbi$::Private)) } - } - - fn map_insert(mut map: $pb$::MapMut<$key_t$, Self>, key: $pb$::View<'_, $key_t$>, value: impl $pb$::IntoProxied<Self>) -> bool { - use $pbr$::MapNodeSizeInfoIndexForType; - unsafe { - $pbr$::$map_insert$( - map.as_raw($pbi$::Private), - $map_size_info_thunk$($key_t$::SIZE_INFO_INDEX), - $key_expr$, - value.into_proxied($pbi$::Private).raw_msg()) - } - } - - fn map_get<'a>(map: $pb$::MapView<'a, $key_t$, Self>, key: $pb$::View<'_, $key_t$>) -> $Option$<$pb$::View<'a, Self>> { - use $pbr$::MapNodeSizeInfoIndexForType; - let key = $key_expr$; - let mut value = $std$::mem::MaybeUninit::uninit(); - let found = unsafe { - $pbr$::$map_get$( - map.as_raw($pbi$::Private), - $map_size_info_thunk$($key_t$::SIZE_INFO_INDEX), - key, - value.as_mut_ptr()) - }; - if !found { - return None; - } - Some($Msg$View::new($pbi$::Private, unsafe { value.assume_init() })) - } - - fn map_remove(mut map: $pb$::MapMut<$key_t$, Self>, key: $pb$::View<'_, $key_t$>) -> bool { - use $pbr$::MapNodeSizeInfoIndexForType; - unsafe { - $pbr$::$map_remove$( - map.as_raw($pbi$::Private), - $map_size_info_thunk$($key_t$::SIZE_INFO_INDEX), - $key_expr$) - } - } - - fn map_iter(map: $pb$::MapView<$key_t$, Self>) -> $pb$::MapIter<$key_t$, Self> { - // SAFETY: - // - The backing map for `map.as_raw` is valid for at least '_. - // - A View that is live for '_ guarantees the backing map is unmodified for '_. - // - The `iter` function produces an iterator that is valid for the key - // and value types, and live for at least '_. - unsafe { - $pb$::MapIter::from_raw( - $pbi$::Private, - $pbr$::proto2_rust_map_iter(map.as_raw($pbi$::Private)) - ) - } - } - - fn map_iter_next<'a>(iter: &mut $pb$::MapIter<'a, $key_t$, Self>) -> $Option$<($pb$::View<'a, $key_t$>, $pb$::View<'a, Self>)> { - use $pbr$::MapNodeSizeInfoIndexForType; - // SAFETY: - // - The `MapIter` API forbids the backing map from being mutated for 'a, - // and guarantees that it's the correct key and value types. - // - The thunk is safe to call as long as the iterator isn't at the end. - // - The thunk always writes to key and value fields and does not read. - // - The thunk does not increment the iterator. - unsafe { - iter.as_raw_mut($pbi$::Private).next_unchecked::<$key_t$, Self, _, _>( - |iter, key, value| { $pbr$::$map_iter_get$( - iter, $map_size_info_thunk$($key_t$::SIZE_INFO_INDEX), key, value) }, - |ffi_key| $from_ffi_key_expr$, - |raw_msg| $Msg$View::new($pbi$::Private, raw_msg) - ) - } - } - } - )rs"); - } + unsafe fn from_map_value<'b>(value: $pbr$::MapValue) -> $Msg$View<'b> { + debug_assert_eq!(value.tag, $pbr$::MapValueTag::Message); + unsafe { $Msg$View::new($pbi$::Private, value.val.m) } + } + } + )rs"); return; case Kernel::kUpb: ctx.Emit( @@ -716,7 +581,7 @@ void MessageProxiedInMapValue(Context& ctx, const Descriptor& msg) { raw_parent_arena: $pbr$::RawArena, mut val: Self) -> $pbr$::upb_MessageValue { // SAFETY: The arena memory is not freed due to `ManuallyDrop`. - let parent_arena = core::mem::ManuallyDrop::new( + let parent_arena = $std$::mem::ManuallyDrop::new( unsafe { $pbr$::Arena::from_raw(raw_parent_arena) }); parent_arena.fuse(val.as_mutator_message_ref($pbi$::Private).arena()); @@ -753,119 +618,122 @@ void GenerateRs(Context& ctx, const Descriptor& msg) { return; } ctx.Emit( - {{"Msg", RsSafeName(msg.name())}, - {"Msg::new", [&] { MessageNew(ctx, msg); }}, - {"Msg::serialize", [&] { MessageSerialize(ctx, msg); }}, - {"MsgMut::clear", [&] { MessageMutClear(ctx, msg); }}, - {"Msg::clear_and_parse", [&] { MessageClearAndParse(ctx, msg); }}, - {"Msg::drop", [&] { MessageDrop(ctx, msg); }}, - {"Msg::debug", [&] { MessageDebug(ctx, msg); }}, - {"MsgMut::merge_from", [&] { MessageMutMergeFrom(ctx, msg); }}, - {"default_instance_impl", - [&] { GenerateDefaultInstanceImpl(ctx, msg); }}, - {"accessor_fns", - [&] { - for (int i = 0; i < msg.field_count(); ++i) { - GenerateAccessorMsgImpl(ctx, *msg.field(i), AccessorCase::OWNED); - } - for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { - GenerateOneofAccessors(ctx, *msg.real_oneof_decl(i), - AccessorCase::OWNED); - } - }}, - {"nested_in_msg", - [&] { - // If we have no nested types, enums, or oneofs, bail out without - // emitting an empty mod some_msg. - if (msg.nested_type_count() == 0 && msg.enum_type_count() == 0 && - msg.real_oneof_decl_count() == 0) { - return; - } - ctx.Emit({{"mod_name", RsSafeName(CamelToSnakeCase(msg.name()))}, - {"nested_msgs", - [&] { - for (int i = 0; i < msg.nested_type_count(); ++i) { - GenerateRs(ctx, *msg.nested_type(i)); - } - }}, - {"nested_enums", - [&] { - for (int i = 0; i < msg.enum_type_count(); ++i) { - GenerateEnumDefinition(ctx, *msg.enum_type(i)); - } - }}, - {"oneofs", - [&] { - for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { - GenerateOneofDefinition(ctx, *msg.real_oneof_decl(i)); - } - }}}, - R"rs( - pub mod $mod_name$ { + { + {"Msg", RsSafeName(msg.name())}, + {"Msg::new", [&] { MessageNew(ctx, msg); }}, + {"Msg::serialize", [&] { MessageSerialize(ctx, msg); }}, + {"MsgMut::clear", [&] { MessageMutClear(ctx, msg); }}, + {"Msg::clear_and_parse", [&] { MessageClearAndParse(ctx, msg); }}, + {"Msg::drop", [&] { MessageDrop(ctx, msg); }}, + {"Msg::debug", [&] { MessageDebug(ctx, msg); }}, + {"MsgMut::merge_from", [&] { MessageMutMergeFrom(ctx, msg); }}, + {"default_instance_impl", + [&] { GenerateDefaultInstanceImpl(ctx, msg); }}, + {"accessor_fns", + [&] { + for (int i = 0; i < msg.field_count(); ++i) { + GenerateAccessorMsgImpl(ctx, *msg.field(i), AccessorCase::OWNED); + } + for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { + GenerateOneofAccessors(ctx, *msg.real_oneof_decl(i), + AccessorCase::OWNED); + } + }}, + {"nested_in_msg", + [&] { + // If we have no nested types, enums, or oneofs, bail out without + // emitting an empty mod some_msg. + if (msg.nested_type_count() == 0 && msg.enum_type_count() == 0 && + msg.real_oneof_decl_count() == 0) { + return; + } + ctx.PushModule(RsSafeName(CamelToSnakeCase(msg.name()))); + ctx.Emit( + {{"nested_msgs", + [&] { + for (int i = 0; i < msg.nested_type_count(); ++i) { + GenerateRs(ctx, *msg.nested_type(i)); + } + }}, + {"nested_enums", + [&] { + for (int i = 0; i < msg.enum_type_count(); ++i) { + GenerateEnumDefinition(ctx, *msg.enum_type(i)); + } + }}, + {"oneofs", + [&] { + for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { + GenerateOneofDefinition(ctx, *msg.real_oneof_decl(i)); + } + }}}, + R"rs( $nested_msgs$ $nested_enums$ $oneofs$ - } // mod $mod_name$ )rs"); - }}, - {"raw_arena_getter_for_message", - [&] { - if (ctx.is_upb()) { - ctx.Emit({}, R"rs( + ctx.PopModule(); + }}, + {"raw_arena_getter_for_message", + [&] { + if (ctx.is_upb()) { + ctx.Emit({}, R"rs( fn arena(&self) -> &$pbr$::Arena { &self.inner.arena } )rs"); - } - }}, - {"raw_arena_getter_for_msgmut", - [&] { - if (ctx.is_upb()) { - ctx.Emit({}, R"rs( + } + }}, + {"raw_arena_getter_for_msgmut", + [&] { + if (ctx.is_upb()) { + ctx.Emit({}, R"rs( fn arena(&self) -> &$pbr$::Arena { self.inner.arena() } )rs"); - } - }}, - {"accessor_fns_for_views", - [&] { - for (int i = 0; i < msg.field_count(); ++i) { - GenerateAccessorMsgImpl(ctx, *msg.field(i), AccessorCase::VIEW); - } - for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { - GenerateOneofAccessors(ctx, *msg.real_oneof_decl(i), - AccessorCase::VIEW); - } - }}, - {"accessor_fns_for_muts", - [&] { - for (int i = 0; i < msg.field_count(); ++i) { - GenerateAccessorMsgImpl(ctx, *msg.field(i), AccessorCase::MUT); - } - for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { - GenerateOneofAccessors(ctx, *msg.real_oneof_decl(i), - AccessorCase::MUT); - } - }}, - {"into_proxied_impl", [&] { IntoProxiedForMessage(ctx, msg); }}, - {"upb_generated_message_trait_impls", - [&] { UpbGeneratedMessageTraitImpls(ctx, msg); }}, - {"repeated_impl", [&] { MessageProxiedInRepeated(ctx, msg); }}, - {"map_value_impl", [&] { MessageProxiedInMapValue(ctx, msg); }}, - {"unwrap_upb", - [&] { - if (ctx.is_upb()) { - ctx.Emit(".unwrap_or_else(||$pbr$::ScratchSpace::zeroed_block())"); - } - }}, - {"upb_arena", - [&] { - if (ctx.is_upb()) { - ctx.Emit(", inner.msg_ref().arena().raw()"); - } - }}}, + } + }}, + {"accessor_fns_for_views", + [&] { + for (int i = 0; i < msg.field_count(); ++i) { + GenerateAccessorMsgImpl(ctx, *msg.field(i), AccessorCase::VIEW); + } + for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { + GenerateOneofAccessors(ctx, *msg.real_oneof_decl(i), + AccessorCase::VIEW); + } + }}, + {"accessor_fns_for_muts", + [&] { + for (int i = 0; i < msg.field_count(); ++i) { + GenerateAccessorMsgImpl(ctx, *msg.field(i), AccessorCase::MUT); + } + for (int i = 0; i < msg.real_oneof_decl_count(); ++i) { + GenerateOneofAccessors(ctx, *msg.real_oneof_decl(i), + AccessorCase::MUT); + } + }}, + {"into_proxied_impl", [&] { IntoProxiedForMessage(ctx, msg); }}, + {"upb_generated_message_trait_impls", + [&] { UpbGeneratedMessageTraitImpls(ctx, msg); }}, + {"repeated_impl", [&] { MessageProxiedInRepeated(ctx, msg); }}, + {"type_conversions_impl", [&] { TypeConversions(ctx, msg); }}, + {"unwrap_upb", + [&] { + if (ctx.is_upb()) { + ctx.Emit( + ".unwrap_or_else(||$pbr$::ScratchSpace::zeroed_block())"); + } + }}, + {"upb_arena", + [&] { + if (ctx.is_upb()) { + ctx.Emit(", inner.msg_ref().arena().raw()"); + } + }}, + }, R"rs( #[allow(non_camel_case_types)] pub struct $Msg$ { @@ -907,7 +775,8 @@ void GenerateRs(Context& ctx, const Descriptor& msg) { impl $pb$::Clear for $Msg$ { fn clear(&mut self) { - self.as_mut().clear() + let mut m = self.as_mut(); + $pb$::Clear::clear(&mut m) } } @@ -1016,7 +885,7 @@ void GenerateRs(Context& ctx, const Descriptor& msg) { $into_proxied_impl$ $repeated_impl$ - $map_value_impl$ + $type_conversions_impl$ #[allow(dead_code)] #[allow(non_camel_case_types)] @@ -1388,16 +1257,6 @@ void GenerateThunksCc(Context& ctx, const Descriptor& msg) { {"QualifiedMsg", cpp::QualifiedClassName(&msg)}, {"new_thunk", ThunkName(ctx, msg, "new")}, {"default_instance_thunk", ThunkName(ctx, msg, "default_instance")}, - {"repeated_new_thunk", ThunkName(ctx, msg, "repeated_new")}, - {"repeated_free_thunk", ThunkName(ctx, msg, "repeated_free")}, - {"repeated_len_thunk", ThunkName(ctx, msg, "repeated_len")}, - {"repeated_get_thunk", ThunkName(ctx, msg, "repeated_get")}, - {"repeated_get_mut_thunk", ThunkName(ctx, msg, "repeated_get_mut")}, - {"repeated_add_thunk", ThunkName(ctx, msg, "repeated_add")}, - {"repeated_clear_thunk", ThunkName(ctx, msg, "repeated_clear")}, - {"repeated_copy_from_thunk", ThunkName(ctx, msg, "repeated_copy_from")}, - {"repeated_reserve_thunk", ThunkName(ctx, msg, "repeated_reserve")}, - {"map_size_info_thunk", ThunkName(ctx, msg, "size_info")}, {"nested_msg_thunks", [&] { for (int i = 0; i < msg.nested_type_count(); ++i) { @@ -1428,61 +1287,6 @@ void GenerateThunksCc(Context& ctx, const Descriptor& msg) { return &$QualifiedMsg$::default_instance(); } - void* $repeated_new_thunk$() { - return new google::protobuf::RepeatedPtrField<$QualifiedMsg$>(); - } - - void $repeated_free_thunk$(void* ptr) { - delete static_cast<google::protobuf::RepeatedPtrField<$QualifiedMsg$>*>(ptr); - } - - size_t $repeated_len_thunk$(google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field) { - return field->size(); - } - const $QualifiedMsg$* $repeated_get_thunk$( - google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field, - size_t index) { - return &field->Get(index); - } - $QualifiedMsg$* $repeated_get_mut_thunk$( - google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field, - size_t index) { - return field->Mutable(index); - } - $QualifiedMsg$* $repeated_add_thunk$(google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field) { - return field->Add(); - } - void $repeated_clear_thunk$(google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field) { - field->Clear(); - } - void $repeated_copy_from_thunk$( - google::protobuf::RepeatedPtrField<$QualifiedMsg$>& dst, - const google::protobuf::RepeatedPtrField<$QualifiedMsg$>& src) { - dst = src; - } - void $repeated_reserve_thunk$( - google::protobuf::RepeatedPtrField<$QualifiedMsg$>* field, - size_t additional) { - field->Reserve(field->size() + additional); - } - google::protobuf::internal::MapNodeSizeInfoT $map_size_info_thunk$(int32_t i) { - static constexpr google::protobuf::internal::MapNodeSizeInfoT size_infos[] = {)cc" - // LINT.IfChange(size_info_mapping) - R"cc( - google::protobuf::internal::RustMapHelper::SizeInfo<int32_t, $QualifiedMsg$>(), - google::protobuf::internal::RustMapHelper::SizeInfo<int64_t, - $QualifiedMsg$>(), - google::protobuf::internal::RustMapHelper::SizeInfo<bool, $QualifiedMsg$>(), - google::protobuf::internal::RustMapHelper::SizeInfo<std::string, - $QualifiedMsg$>() - )cc" - // LINT.ThenChange(//depot/google3/third_party/protobuf/rust/cpp.rs:size_info_mapping) - R"cc( - } - ; - return size_infos[i]; - } - $accessor_thunks$ $oneof_thunks$ diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/naming.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/naming.cc index 1b207fa80b113..647eadf4c2a50 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/naming.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/naming.cc @@ -8,6 +8,7 @@ #include "google/protobuf/compiler/rust/naming.h" #include <algorithm> +#include <cstddef> #include <string> #include <vector> @@ -21,7 +22,6 @@ #include "absl/strings/str_replace.h" #include "absl/strings/string_view.h" #include "absl/strings/strip.h" -#include "absl/strings/substitute.h" #include "google/protobuf/compiler/code_generator.h" #include "google/protobuf/compiler/cpp/helpers.h" #include "google/protobuf/compiler/rust/context.h" @@ -39,7 +39,15 @@ namespace compiler { namespace rust { std::string GetCrateName(Context& ctx, const FileDescriptor& dep) { - return RsSafeName(ctx.ImportPathToCrateName(dep.name())); + return absl::StrCat("::", RsSafeName(ctx.ImportPathToCrateName(dep.name()))); +} + +std::string GetEntryPointRsFilePath(Context& ctx, const FileDescriptor& file) { + size_t last_slash = file.name().find_last_of('/'); + return absl::StrCat(last_slash == std::string::npos + ? "" + : file.name().substr(0, last_slash + 1), + ctx.opts().generated_entry_point_rs_file_name); } std::string GetRsFile(Context& ctx, const FileDescriptor& file) { @@ -102,15 +110,6 @@ std::string ThunkName(Context& ctx, const Descriptor& msg, op); } -template <typename Desc> -std::string GetFullyQualifiedPath(Context& ctx, const Desc& desc) { - auto rel_path = GetCrateRelativeQualifiedPath(ctx, desc); - if (IsInCurrentlyGeneratingCrate(ctx, desc)) { - return absl::StrCat("crate::", rel_path); - } - return absl::StrCat(GetCrateName(ctx, *desc.file()), "::", rel_path); -} - template <typename Desc> std::string GetUnderscoreDelimitedFullName(Context& ctx, const Desc& desc) { return UnderscoreDelimitFullName(ctx, desc.full_name()); @@ -140,18 +139,26 @@ std::string RsTypePath(Context& ctx, const FieldDescriptor& field) { case RustFieldType::DOUBLE: return "f64"; case RustFieldType::BYTES: - return "::__pb::ProtoBytes"; + return "::protobuf::ProtoBytes"; case RustFieldType::STRING: - return "::__pb::ProtoString"; + return "::protobuf::ProtoString"; case RustFieldType::MESSAGE: - return GetFullyQualifiedPath(ctx, *field.message_type()); + return RsTypePath(ctx, *field.message_type()); case RustFieldType::ENUM: - return GetFullyQualifiedPath(ctx, *field.enum_type()); + return RsTypePath(ctx, *field.enum_type()); } ABSL_LOG(ERROR) << "Unknown field type: " << field.type_name(); internal::Unreachable(); } +std::string RsTypePath(Context& ctx, const Descriptor& message) { + return absl::StrCat(RustModule(ctx, message), RsSafeName(message.name())); +} + +std::string RsTypePath(Context& ctx, const EnumDescriptor& descriptor) { + return absl::StrCat(RustModule(ctx, descriptor), EnumRsName(descriptor)); +} + std::string RsViewType(Context& ctx, const FieldDescriptor& field, absl::string_view lifetime) { switch (GetRustFieldType(field)) { @@ -169,23 +176,23 @@ std::string RsViewType(Context& ctx, const FieldDescriptor& field, case RustFieldType::BYTES: return absl::StrFormat("&%s [u8]", lifetime); case RustFieldType::STRING: - return absl::StrFormat("&%s ::__pb::ProtoStr", lifetime); + return absl::StrFormat("&%s ::protobuf::ProtoStr", lifetime); case RustFieldType::MESSAGE: if (lifetime.empty()) { - return absl::StrFormat( - "%sView", GetFullyQualifiedPath(ctx, *field.message_type())); + return absl::StrFormat("%sView", + RsTypePath(ctx, *field.message_type())); } else { return absl::StrFormat( - "%sView<%s>", GetFullyQualifiedPath(ctx, *field.message_type()), - lifetime); + "%sView<%s>", RsTypePath(ctx, *field.message_type()), lifetime); } } ABSL_LOG(FATAL) << "Unsupported field type: " << field.type_name(); internal::Unreachable(); } -std::string RustModuleForContainingType(Context& ctx, - const Descriptor* containing_type) { +static std::string RustModuleForContainingType( + Context& ctx, const Descriptor* containing_type, + const FileDescriptor& file) { std::vector<std::string> modules; // Innermost to outermost order. @@ -204,33 +211,39 @@ std::string RustModuleForContainingType(Context& ctx, modules.push_back(""); } - return absl::StrJoin(modules, "::"); + std::string crate_relative = absl::StrJoin(modules, "::"); + + if (IsInCurrentlyGeneratingCrate(ctx, file)) { + std::string prefix; + for (size_t i = 0; i < ctx.GetModuleDepth(); ++i) { + prefix += "super::"; + } + return absl::StrCat(prefix, crate_relative); + } + return absl::StrCat(GetCrateName(ctx, file), "::", crate_relative); } std::string RustModule(Context& ctx, const Descriptor& msg) { - return RustModuleForContainingType(ctx, msg.containing_type()); + return RustModuleForContainingType(ctx, msg.containing_type(), *msg.file()); } std::string RustModule(Context& ctx, const EnumDescriptor& enum_) { - return RustModuleForContainingType(ctx, enum_.containing_type()); + return RustModuleForContainingType(ctx, enum_.containing_type(), + *enum_.file()); } std::string RustModule(Context& ctx, const OneofDescriptor& oneof) { - return RustModuleForContainingType(ctx, oneof.containing_type()); + return RustModuleForContainingType(ctx, oneof.containing_type(), + *oneof.file()); } -std::string RustInternalModuleName(Context& ctx, const FileDescriptor& file) { +std::string RustInternalModuleName(const FileDescriptor& file) { return RsSafeName( - absl::StrReplaceAll(StripProto(file.name()), {{"_", "__"}, {"/", "_s"}})); -} - -std::string GetCrateRelativeQualifiedPath(Context& ctx, const Descriptor& msg) { - return absl::StrCat(RustModule(ctx, msg), RsSafeName(msg.name())); -} - -std::string GetCrateRelativeQualifiedPath(Context& ctx, - const EnumDescriptor& enum_) { - return absl::StrCat(RustModule(ctx, enum_), EnumRsName(enum_)); + absl::StrReplaceAll(StripProto(file.name()), { + {"_", "__"}, + {"/", "_s"}, + {"-", "__"}, + })); } std::string FieldInfoComment(Context& ctx, const FieldDescriptor& field) { @@ -321,12 +334,14 @@ std::string EnumValueRsName(const MultiCasePrefixStripper& stripper, } std::string OneofViewEnumRsName(const OneofDescriptor& oneof) { - return RsSafeName(SnakeToUpperCamelCase(oneof.name())); + return SnakeToUpperCamelCase(oneof.name()) + "Oneof"; } std::string OneofCaseEnumRsName(const OneofDescriptor& oneof) { - // Note: This is the name used for the cpp Case enum, we use it for both - // the Rust Case enum as well as for the cpp case enum in the cpp thunk. + return SnakeToUpperCamelCase(oneof.name()) + "Case"; +} + +std::string OneofCaseEnumCppName(const OneofDescriptor& oneof) { return SnakeToUpperCamelCase(oneof.name()) + "Case"; } @@ -405,44 +420,6 @@ absl::string_view MultiCasePrefixStripper::StripPrefix( return name; } -PROTOBUF_CONSTINIT const MapKeyType kMapKeyTypes[] = { - {/*thunk_ident=*/"i32", /*rs_key_t=*/"i32", /*rs_ffi_key_t=*/"i32", - /*rs_to_ffi_key_expr=*/"key", /*rs_from_ffi_key_expr=*/"ffi_key", - /*cc_key_t=*/"int32_t", /*cc_ffi_key_t=*/"int32_t", - /*cc_from_ffi_key_expr=*/"key", - /*cc_to_ffi_key_expr=*/"cpp_key"}, - {/*thunk_ident=*/"u32", /*rs_key_t=*/"u32", /*rs_ffi_key_t=*/"u32", - /*rs_to_ffi_key_expr=*/"key", /*rs_from_ffi_key_expr=*/"ffi_key", - /*cc_key_t=*/"uint32_t", /*cc_ffi_key_t=*/"uint32_t", - /*cc_from_ffi_key_expr=*/"key", - /*cc_to_ffi_key_expr=*/"cpp_key"}, - {/*thunk_ident=*/"i64", /*rs_key_t=*/"i64", /*rs_ffi_key_t=*/"i64", - /*rs_to_ffi_key_expr=*/"key", /*rs_from_ffi_key_expr=*/"ffi_key", - /*cc_key_t=*/"int64_t", /*cc_ffi_key_t=*/"int64_t", - /*cc_from_ffi_key_expr=*/"key", - /*cc_to_ffi_key_expr=*/"cpp_key"}, - {/*thunk_ident=*/"u64", /*rs_key_t=*/"u64", /*rs_ffi_key_t=*/"u64", - /*rs_to_ffi_key_expr=*/"key", /*rs_from_ffi_key_expr=*/"ffi_key", - /*cc_key_t=*/"uint64_t", /*cc_ffi_key_t=*/"uint64_t", - /*cc_from_ffi_key_expr=*/"key", - /*cc_to_ffi_key_expr=*/"cpp_key"}, - {/*thunk_ident=*/"bool", /*rs_key_t=*/"bool", /*rs_ffi_key_t=*/"bool", - /*rs_to_ffi_key_expr=*/"key", /*rs_from_ffi_key_expr=*/"ffi_key", - /*cc_key_t=*/"bool", /*cc_ffi_key_t=*/"bool", - /*cc_from_ffi_key_expr=*/"key", - /*cc_to_ffi_key_expr=*/"cpp_key"}, - {/*thunk_ident=*/"ProtoString", - /*rs_key_t=*/"$pb$::ProtoString", - /*rs_ffi_key_t=*/"$pbr$::PtrAndLen", - /*rs_to_ffi_key_expr=*/"key.as_bytes().into()", - /*rs_from_ffi_key_expr=*/ - "$pb$::ProtoStr::from_utf8_unchecked(ffi_key.as_ref())", - /*cc_key_t=*/"std::string", - /*cc_ffi_key_t=*/"google::protobuf::rust::PtrAndLen", - /*cc_from_ffi_key_expr=*/ - "std::string(key.ptr, key.len)", /*cc_to_ffi_key_expr=*/ - "google::protobuf::rust::PtrAndLen{cpp_key.data(), cpp_key.size()}"}}; - } // namespace rust } // namespace compiler } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/naming.h b/third_party/protobuf/src/google/protobuf/compiler/rust/naming.h index 2707d8576a1f4..3ddcbe1f47462 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/naming.h +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/naming.h @@ -22,6 +22,12 @@ namespace compiler { namespace rust { std::string GetCrateName(Context& ctx, const FileDescriptor& dep); +// Gets the file name for the entry point rs file. This path will be in the same +// directory as the provided file. This will be the path provided by command +// line flag, or a default path relative to the provided `file` (which should +// be the first .proto src proto file). +std::string GetEntryPointRsFilePath(Context& ctx, const FileDescriptor& file); + std::string GetRsFile(Context& ctx, const FileDescriptor& file); std::string GetThunkCcFile(Context& ctx, const FileDescriptor& file); std::string GetHeaderFile(Context& ctx, const FileDescriptor& file); @@ -38,10 +44,12 @@ std::string RawMapThunk(Context& ctx, const Descriptor& msg, std::string RawMapThunk(Context& ctx, const EnumDescriptor& desc, absl::string_view key_t, absl::string_view op); -// Returns an absolute path to the Proxied Rust type of the given field. -// The absolute path is guaranteed to work in the crate that defines the field. -// It may be crate-relative, or directly reference the owning crate of the type. +// Returns a path to the Proxied Rust type of the given field. The path will be +// relative if the type is in the same crate, or absolute if it is in a +// different crate. std::string RsTypePath(Context& ctx, const FieldDescriptor& field); +std::string RsTypePath(Context& ctx, const Descriptor& message); +std::string RsTypePath(Context& ctx, const EnumDescriptor& descriptor); // Returns the 'simple spelling' of the Rust View type for the provided field. // For example, `i32` for int32 fields and `SomeMsgView<'$lifetime$>` for @@ -57,6 +65,8 @@ std::string EnumValueRsName(const EnumValueDescriptor& value); std::string OneofViewEnumRsName(const OneofDescriptor& oneof); std::string OneofCaseEnumRsName(const OneofDescriptor& oneof); + +std::string OneofCaseEnumCppName(const OneofDescriptor& oneof); std::string OneofCaseRsName(const FieldDescriptor& oneof_field); std::string FieldInfoComment(Context& ctx, const FieldDescriptor& field); @@ -84,27 +94,18 @@ std::string FieldNameWithCollisionAvoidance(const FieldDescriptor& field); // verbatim unless it is a Rust keyword that isn't a legal symbol name. std::string RsSafeName(absl::string_view name); -// Constructs a string of the Rust modules which will contain the message. +// Constructs a string of the Rust modules which will contain the entity. // // Example: Given a message 'NestedMessage' which is defined in package 'x.y' // which is inside 'ParentMessage', the message will be placed in the -// x::y::ParentMessage_ Rust module, so this function will return the string -// "x::y::ParentMessage_::". -// -// If the message has no package and no containing messages then this returns -// empty string. -std::string RustModuleForContainingType(Context& ctx, - const Descriptor* containing_type); +// x::y::parent_message Rust module, so this function will return +// "x::y::parent_message::", with the necessary prefix to make it relative to +// the current scope, or absolute if the entity is in a different crate. std::string RustModule(Context& ctx, const Descriptor& msg); std::string RustModule(Context& ctx, const EnumDescriptor& enum_); std::string RustModule(Context& ctx, const OneofDescriptor& oneof); -std::string RustInternalModuleName(Context& ctx, const FileDescriptor& file); -std::string GetCrateRelativeQualifiedPath(Context& ctx, const Descriptor& msg); -std::string GetCrateRelativeQualifiedPath(Context& ctx, - const EnumDescriptor& enum_); -std::string GetCrateRelativeQualifiedPath(Context& ctx, - const OneofDescriptor& oneof); +std::string RustInternalModuleName(const FileDescriptor& file); template <typename Desc> std::string GetUnderscoreDelimitedFullName(Context& ctx, const Desc& desc); diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/naming_test.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/naming_test.cc index b1acd7b83a464..f2564114815dc 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/naming_test.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/naming_test.cc @@ -5,19 +5,12 @@ #include <gtest/gtest.h> #include "absl/container/flat_hash_map.h" -#include "google/protobuf/compiler/rust/context.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" using google::protobuf::compiler::rust::CamelToSnakeCase; -using google::protobuf::compiler::rust::Context; -using google::protobuf::compiler::rust::Kernel; -using google::protobuf::compiler::rust::Options; -using google::protobuf::compiler::rust::RustGeneratorContext; using google::protobuf::compiler::rust::RustInternalModuleName; using google::protobuf::compiler::rust::ScreamingSnakeToUpperCamelCase; -using google::protobuf::io::Printer; -using google::protobuf::io::StringOutputStream; namespace { TEST(RustProtoNaming, RustInternalModuleName) { @@ -25,17 +18,7 @@ TEST(RustProtoNaming, RustInternalModuleName) { foo_file.set_name("strong_bad/lol.proto"); google::protobuf::DescriptorPool pool; const google::protobuf::FileDescriptor* fd = pool.BuildFile(foo_file); - - const Options opts = {Kernel::kUpb}; - std::vector<const google::protobuf::FileDescriptor*> files{fd}; - absl::flat_hash_map<std::string, std::string> mapping; - const RustGeneratorContext rust_generator_context(&files, &mapping); - std::string output; - StringOutputStream stream{&output}; - Printer printer(&stream); - Context c = Context(&opts, &rust_generator_context, &printer); - - EXPECT_EQ(RustInternalModuleName(c, *fd), "strong__bad_slol"); + EXPECT_EQ(RustInternalModuleName(*fd), "strong__bad_slol"); } TEST(RustProtoNaming, CamelToSnakeCase) { diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/oneof.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/oneof.cc index a7e40c219ffbc..c787aed3dcfa6 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/oneof.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/oneof.cc @@ -15,6 +15,7 @@ #include "absl/strings/string_view.h" #include "google/protobuf/compiler/cpp/helpers.h" #include "google/protobuf/compiler/rust/accessors/accessor_case.h" +#include "google/protobuf/compiler/rust/accessors/accessors.h" #include "google/protobuf/compiler/rust/context.h" #include "google/protobuf/compiler/rust/naming.h" #include "google/protobuf/compiler/rust/rust_field_type.h" @@ -36,7 +37,7 @@ namespace rust { // Example: // For this oneof: // message SomeMsg { -// oneof some_oneof { +// oneof some { // int32 field_a = 7; // SomeMsg field_b = 9; // } @@ -51,7 +52,7 @@ namespace rust { // } // // #[repr(C)] -// pub enum SomeOneofCase { +// pub enum SomeCase { // FieldA = 7, // FieldB = 9, // not_set = 0 @@ -59,33 +60,40 @@ namespace rust { // } // impl SomeMsg { // pub fn some_oneof(&self) -> SomeOneof {...} -// pub fn some_oneof_case(&self) -> SomeOneofCase {...} +// pub fn some_oneof_case(&self) -> SomeCase {...} // } // impl SomeMsgMut { // pub fn some_oneof(&self) -> SomeOneof {...} -// pub fn some_oneof_case(&self) -> SomeOneofCase {...} +// pub fn some_oneof_case(&self) -> SomeCase {...} // } // impl SomeMsgView { // pub fn some_oneof(self) -> SomeOneof {...} -// pub fn some_oneof_case(self) -> SomeOneofCase {...} -// } -// -// An additional "Case" enum which just reflects the corresponding slot numbers -// is emitted for usage with the FFI (exactly matching the Case struct that both -// cpp and upb generate). -// -// #[repr(C)] pub(super) enum SomeOneofCase { -// FieldA = 7, -// FieldB = 9, -// not_set = 0 +// pub fn some_oneof_case(self) -> SomeCase {...} // } namespace { + +bool IsSupportedOneofFieldCase(Context& ctx, const FieldDescriptor& field) { + if (!IsSupportedField(ctx, field)) { + return false; + } + + // In addition to any fields that are otherwise unsupported, if the + // oneof contains a string or bytes field which is not string_view or string + // representation (namely, Cord or StringPiece), we don't support it + // currently. + if (ctx.is_cpp() && field.cpp_type() == FieldDescriptor::CPPTYPE_STRING && + field.cpp_string_type() != FieldDescriptor::CppStringType::kString && + field.cpp_string_type() != FieldDescriptor::CppStringType::kView) { + return false; + } + return true; +} + // A user-friendly rust type for a view of this field with lifetime 'msg. std::string RsTypeNameView(Context& ctx, const FieldDescriptor& field) { - if (field.options().has_ctype()) { - return ""; // TODO: b/308792377 - ctype fields not supported yet. - } + ABSL_CHECK(IsSupportedOneofFieldCase(ctx, field)); + switch (GetRustFieldType(field.type())) { case RustFieldType::INT32: case RustFieldType::INT64: @@ -98,11 +106,13 @@ std::string RsTypeNameView(Context& ctx, const FieldDescriptor& field) { case RustFieldType::BYTES: return "&'msg [u8]"; case RustFieldType::STRING: - return "&'msg ::__pb::ProtoStr"; + return "&'msg ::protobuf::ProtoStr"; case RustFieldType::MESSAGE: - return absl::StrCat("::__pb::View<'msg, ", RsTypePath(ctx, field), ">"); + return absl::StrCat("::protobuf::View<'msg, ", RsTypePath(ctx, field), + ">"); case RustFieldType::ENUM: - return absl::StrCat("::__pb::View<'msg, ", RsTypePath(ctx, field), ">"); + return absl::StrCat("::protobuf::View<'msg, ", RsTypePath(ctx, field), + ">"); } ABSL_LOG(FATAL) << "Unexpected field type: " << field.type_name(); @@ -119,10 +129,10 @@ void GenerateOneofDefinition(Context& ctx, const OneofDescriptor& oneof) { [&] { for (int i = 0; i < oneof.field_count(); ++i) { auto& field = *oneof.field(i); - std::string rs_type = RsTypeNameView(ctx, field); - if (rs_type.empty()) { + if (!IsSupportedOneofFieldCase(ctx, field)) { continue; } + std::string rs_type = RsTypeNameView(ctx, field); ctx.Emit({{"name", OneofCaseRsName(field)}, {"type", rs_type}, {"number", std::to_string(field.number())}}, @@ -131,7 +141,6 @@ void GenerateOneofDefinition(Context& ctx, const OneofDescriptor& oneof) { } }}, }, - // TODO: Revisit if isize is the optimal repr for this enum. // Note: This enum deliberately has a 'msg lifetime associated with it // even if all fields were scalars; we could conditionally exclude the // lifetime under that case, but it would mean changing the .proto file @@ -141,11 +150,10 @@ void GenerateOneofDefinition(Context& ctx, const OneofDescriptor& oneof) { #[non_exhaustive] #[derive(Debug, Clone, Copy)] #[allow(dead_code)] - #[repr(isize)] + #[repr(u32)] pub enum $view_enum_name$<'msg> { $view_fields$ - #[allow(non_camel_case_types)] not_set(std::marker::PhantomData<&'msg ()>) = 0 } )rs"); @@ -157,6 +165,9 @@ void GenerateOneofDefinition(Context& ctx, const OneofDescriptor& oneof) { [&] { for (int i = 0; i < oneof.field_count(); ++i) { auto& field = *oneof.field(i); + if (!IsSupportedOneofFieldCase(ctx, field)) { + continue; + } ctx.Emit({{"name", OneofCaseRsName(field)}, {"number", std::to_string(field.number())}}, R"rs($name$ = $number$, @@ -167,6 +178,9 @@ void GenerateOneofDefinition(Context& ctx, const OneofDescriptor& oneof) { [&] { for (int i = 0; i < oneof.field_count(); ++i) { auto& field = *oneof.field(i); + if (!IsSupportedOneofFieldCase(ctx, field)) { + continue; + } ctx.Emit({{"name", OneofCaseRsName(field)}, {"number", std::to_string(field.number())}}, R"rs($number$ => Some($case_enum_name$::$name$), @@ -180,7 +194,6 @@ void GenerateOneofDefinition(Context& ctx, const OneofDescriptor& oneof) { pub enum $case_enum_name$ { $cases$ - #[allow(non_camel_case_types)] not_set = 0 } @@ -206,19 +219,17 @@ void GenerateOneofAccessors(Context& ctx, const OneofDescriptor& oneof, {{"oneof_name", RsSafeName(oneof.name())}, {"view_lifetime", ViewLifetime(accessor_case)}, {"self", ViewReceiver(accessor_case)}, - {"oneof_enum_module", - absl::StrCat("crate::", RustModuleForContainingType( - ctx, oneof.containing_type()))}, + {"oneof_enum_module", RustModule(ctx, oneof)}, {"view_enum_name", OneofViewEnumRsName(oneof)}, {"case_enum_name", OneofCaseEnumRsName(oneof)}, {"view_cases", [&] { for (int i = 0; i < oneof.field_count(); ++i) { auto& field = *oneof.field(i); - std::string rs_type = RsTypeNameView(ctx, field); - if (rs_type.empty()) { + if (!IsSupportedOneofFieldCase(ctx, field)) { continue; } + std::string rs_type = RsTypeNameView(ctx, field); std::string field_name = FieldNameWithCollisionAvoidance(field); ctx.Emit( { @@ -275,9 +286,7 @@ void GenerateOneofExternC(Context& ctx, const OneofDescriptor& oneof) { ctx.Emit( { - {"oneof_enum_module", - absl::StrCat("crate::", RustModuleForContainingType( - ctx, oneof.containing_type()))}, + {"oneof_enum_module", RustModule(ctx, oneof)}, {"case_enum_rs_name", OneofCaseEnumRsName(oneof)}, {"case_thunk", ThunkName(ctx, oneof, "case")}, }, @@ -292,7 +301,7 @@ void GenerateOneofThunkCc(Context& ctx, const OneofDescriptor& oneof) { ctx.Emit( { {"oneof_name", oneof.name()}, - {"case_enum_name", OneofCaseEnumRsName(oneof)}, + {"case_enum_name", OneofCaseEnumCppName(oneof)}, {"case_thunk", ThunkName(ctx, oneof, "case")}, {"QualifiedMsg", cpp::QualifiedClassName(oneof.containing_type())}, }, diff --git a/third_party/protobuf/src/google/protobuf/compiler/rust/relative_path.cc b/third_party/protobuf/src/google/protobuf/compiler/rust/relative_path.cc index e214dada43295..80d5495f1140c 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/rust/relative_path.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/rust/relative_path.cc @@ -7,10 +7,12 @@ #include "google/protobuf/compiler/rust/relative_path.h" +#include <cstddef> #include <string> #include <vector> #include "absl/algorithm/container.h" +#include "absl/log/absl_check.h" #include "absl/strings/match.h" #include "absl/strings/str_join.h" #include "absl/strings/str_split.h" @@ -62,7 +64,7 @@ std::string RelativePath::Relative(const RelativePath& dest) const { result.push_back(segment); } // Push `..` from the common ancestor to the current path. - for (int i = 0; i < current_segments.size(); ++i) { + for (size_t i = 0; i < current_segments.size(); ++i) { result.push_back(".."); } absl::c_reverse(result); diff --git a/third_party/protobuf/src/google/protobuf/compiler/test_plugin_injection.bzl b/third_party/protobuf/src/google/protobuf/compiler/test_plugin_injection.bzl index aec25441e806d..1ff815c621adc 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/test_plugin_injection.bzl +++ b/third_party/protobuf/src/google/protobuf/compiler/test_plugin_injection.bzl @@ -31,8 +31,9 @@ load("//build_defs:cpp_opts.bzl", "COPTS") # This works around https://github.com/bazelbuild/bazel/issues/19124 by using a generated header to -# inject the Bazel path of the test plugins. The simpler alternative is broken in Bazel 6.3.0, -# which is to just inject these via copts. +# inject the Bazel path of the test plugins. +# TODO: Replace this with simpler alternative injecting these via copts once we drop +# support for Bazel 6.3.0. def inject_plugin_paths(name): hdr = name + ".h" native.genrule( @@ -51,6 +52,7 @@ cat <<'EOF' >$(OUTS) #define GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH "$(rootpath :fake_plugin)" #endif // GOOGLE_PROTOBUF_COMPILER_TEST_PLUGIN_PATHS_H__ +EOF """, visibility = ["//visibility:private"], testonly = True, diff --git a/third_party/protobuf/src/google/protobuf/compiler/versions.h b/third_party/protobuf/src/google/protobuf/compiler/versions.h index d592ffc5cdb6a..964e6204e2fe0 100644 --- a/third_party/protobuf/src/google/protobuf/compiler/versions.h +++ b/third_party/protobuf/src/google/protobuf/compiler/versions.h @@ -53,9 +53,10 @@ // // Please avoid changing them manually, as they should be updated automatically // by Protobuf release process. -#define PROTOBUF_CPP_VERSION_STRING "5.29.3" -#define PROTOBUF_JAVA_VERSION_STRING "4.29.3" -#define PROTOBUF_PYTHON_VERSION_STRING "5.29.3" +#define PROTOBUF_CPP_VERSION_STRING "6.30.1" +#define PROTOBUF_JAVA_VERSION_STRING "4.30.1" +#define PROTOBUF_PYTHON_VERSION_STRING "6.30.1" +#define PROTOBUF_RUST_VERSION_STRING "4.30.1" namespace google { diff --git a/third_party/protobuf/src/google/protobuf/cpp_edition_defaults.h b/third_party/protobuf/src/google/protobuf/cpp_edition_defaults.h index 52e5fd65aef7f..7f64ab099df5d 100644 --- a/third_party/protobuf/src/google/protobuf/cpp_edition_defaults.h +++ b/third_party/protobuf/src/google/protobuf/cpp_edition_defaults.h @@ -5,7 +5,7 @@ // the C++ runtime. This is used for feature resolution under Editions. // NOLINTBEGIN // clang-format off -#define PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS "\n\037\030\204\007\"\003\302>\000*\025\010\001\020\002\030\002 \003(\0010\002\302>\006\010\001\020\003\030\000\n\037\030\347\007\"\003\302>\000*\025\010\002\020\001\030\001 \002(\0010\001\302>\006\010\000\020\003\030\000\n\037\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\005\302>\002\030\000\n\037\030\351\007\"\025\010\001\020\001\030\001 \002(\0010\001\302>\006\010\000\020\001\030\001*\003\302>\000 \346\007(\351\007" +#define PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS "\n!\030\204\007\"\003\302>\000*\027\010\001\020\002\030\002 \003(\0010\0028\002\302>\006\010\001\020\003\030\000\n!\030\347\007\"\003\302>\000*\027\010\002\020\001\030\001 \002(\0010\0018\002\302>\006\010\000\020\003\030\000\n!\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\0078\002\302>\002\030\000\n!\030\351\007\"\027\010\001\020\001\030\001 \002(\0010\0018\001\302>\006\010\000\020\001\030\001*\003\302>\000 \346\007(\351\007" // clang-format on // NOLINTEND diff --git a/third_party/protobuf/src/google/protobuf/cpp_features.pb.cc b/third_party/protobuf/src/google/protobuf/cpp_features.pb.cc index 816a1c241c36b..ace8e5da81562 100644 --- a/third_party/protobuf/src/google/protobuf/cpp_features.pb.cc +++ b/third_party/protobuf/src/google/protobuf/cpp_features.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/cpp_features.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/cpp_features.pb.h" @@ -36,7 +36,7 @@ inline constexpr CppFeatures::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR CppFeatures::CppFeatures(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(CppFeatures_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -53,8 +53,9 @@ struct CppFeaturesDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CppFeaturesDefaultTypeInternal _CppFeatures_default_instance_; } // namespace pb -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcpp_5ffeatures_2eproto[1]; -static constexpr const ::_pb::ServiceDescriptor** +static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL + file_level_enum_descriptors_google_2fprotobuf_2fcpp_5ffeatures_2eproto[1]; +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fcpp_5ffeatures_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fcpp_5ffeatures_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -79,7 +80,7 @@ static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, 11, -1, sizeof(::pb::CppFeatures)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::pb::_CppFeatures_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2fcpp_5ffeatures_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -102,8 +103,8 @@ const char descriptor_table_protodef_google_2fprotobuf_2fcpp_5ffeatures_2eproto[ "e.protobuf.FeatureSet\030\350\007 \001(\0132\017.pb.CppFea" "tures" }; -static const ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto_deps[1] = - { +static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const + descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto_deps[1] = { &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, }; static ::absl::once_flag descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto_once; @@ -124,28 +125,12 @@ PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fproto file_level_service_descriptors_google_2fprotobuf_2fcpp_5ffeatures_2eproto, }; namespace pb { -const ::google::protobuf::EnumDescriptor* CppFeatures_StringType_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL CppFeatures_StringType_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fcpp_5ffeatures_2eproto[0]; } PROTOBUF_CONSTINIT const uint32_t CppFeatures_StringType_internal_data_[] = { 262144u, 0u, }; -bool CppFeatures_StringType_IsValid(int value) { - return 0 <= value && value <= 3; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr CppFeatures_StringType CppFeatures::STRING_TYPE_UNKNOWN; -constexpr CppFeatures_StringType CppFeatures::VIEW; -constexpr CppFeatures_StringType CppFeatures::CORD; -constexpr CppFeatures_StringType CppFeatures::STRING; -constexpr CppFeatures_StringType CppFeatures::StringType_MIN; -constexpr CppFeatures_StringType CppFeatures::StringType_MAX; -constexpr int CppFeatures::StringType_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) // =================================================================== class CppFeatures::_Internal { @@ -156,9 +141,9 @@ class CppFeatures::_Internal { 8 * PROTOBUF_FIELD_OFFSET(CppFeatures, _impl_._has_bits_); }; -CppFeatures::CppFeatures(::google::protobuf::Arena* arena) +CppFeatures::CppFeatures(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, CppFeatures_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -166,16 +151,22 @@ CppFeatures::CppFeatures(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:pb.CppFeatures) } CppFeatures::CppFeatures( - ::google::protobuf::Arena* arena, const CppFeatures& from) - : CppFeatures(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CppFeatures& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, CppFeatures_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE CppFeatures::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE CppFeatures::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void CppFeatures::SharedCtor(::_pb::Arena* arena) { +inline void CppFeatures::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, string_type_), @@ -195,43 +186,51 @@ inline void CppFeatures::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* CppFeatures::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL CppFeatures::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) CppFeatures(arena); } constexpr auto CppFeatures::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(CppFeatures), alignof(CppFeatures)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull CppFeatures::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_CppFeatures_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &CppFeatures::MergeImpl, - ::google::protobuf::Message::GetNewImpl<CppFeatures>(), +constexpr auto CppFeatures::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_CppFeatures_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &CppFeatures::MergeImpl, + ::google::protobuf::Message::GetNewImpl<CppFeatures>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &CppFeatures::SharedDtor, - ::google::protobuf::Message::GetClearImpl<CppFeatures>(), &CppFeatures::ByteSizeLong, - &CppFeatures::_InternalSerialize, + &CppFeatures::SharedDtor, + ::google::protobuf::Message::GetClearImpl<CppFeatures>(), &CppFeatures::ByteSizeLong, + &CppFeatures::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(CppFeatures, _impl_._cached_size_), - false, - }, - &CppFeatures::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* CppFeatures::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(CppFeatures, _impl_._cached_size_), + false, + }, + &CppFeatures::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + CppFeatures_class_data_ = + CppFeatures::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL CppFeatures::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&CppFeatures_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(CppFeatures_class_data_.tc_table); + return CppFeatures_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 1, 0, 2> CppFeatures::_table_ = { +const ::_pbi::TcParseTable<2, 3, 1, 0, 2> +CppFeatures::_table_ = { { PROTOBUF_FIELD_OFFSET(CppFeatures, _impl_._has_bits_), 0, // no _extensions_ @@ -242,7 +241,7 @@ const ::_pbi::TcParseTable<2, 3, 1, 0, 2> CppFeatures::_table_ = { 3, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + CppFeatures_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -271,12 +270,13 @@ const ::_pbi::TcParseTable<2, 3, 1, 0, 2> CppFeatures::_table_ = { // optional bool enum_name_uses_string_view = 3 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { {PROTOBUF_FIELD_OFFSET(CppFeatures, _impl_.enum_name_uses_string_view_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - }}, {{ - {0, 4}, - }}, {{ + }}, + {{ + {0, 4}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void CppFeatures::Clear() { // @@protoc_insertion_point(message_clear_start:pb.CppFeatures) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -285,7 +285,7 @@ PROTOBUF_NOINLINE void CppFeatures::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { + if ((cached_has_bits & 0x00000007u) != 0) { ::memset(&_impl_.string_type_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.enum_name_uses_string_view_) - reinterpret_cast<char*>(&_impl_.string_type_)) + sizeof(_impl_.enum_name_uses_string_view_)); @@ -295,85 +295,78 @@ PROTOBUF_NOINLINE void CppFeatures::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* CppFeatures::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const CppFeatures& this_ = static_cast<const CppFeatures&>(base); +::uint8_t* PROTOBUF_NONNULL CppFeatures::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const CppFeatures& this_ = static_cast<const CppFeatures&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* CppFeatures::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const CppFeatures& this_ = *this; +::uint8_t* PROTOBUF_NONNULL CppFeatures::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const CppFeatures& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:pb.CppFeatures) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:pb.CppFeatures) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_legacy_closed_enum(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 1, this_._internal_legacy_closed_enum(), target); + } - // optional .pb.CppFeatures.StringType string_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000001u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 2, this_._internal_string_type(), target); - } + // optional .pb.CppFeatures.StringType string_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000001u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this_._internal_string_type(), target); + } - // optional bool enum_name_uses_string_view = 3 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_enum_name_uses_string_view(), target); - } + // optional bool enum_name_uses_string_view = 3 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this_._internal_enum_name_uses_string_view(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:pb.CppFeatures) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:pb.CppFeatures) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t CppFeatures::ByteSizeLong(const MessageLite& base) { - const CppFeatures& this_ = static_cast<const CppFeatures&>(base); +::size_t CppFeatures::ByteSizeLong(const MessageLite& base) { + const CppFeatures& this_ = static_cast<const CppFeatures&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t CppFeatures::ByteSizeLong() const { - const CppFeatures& this_ = *this; +::size_t CppFeatures::ByteSizeLong() const { + const CppFeatures& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:pb.CppFeatures) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:pb.CppFeatures) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - // optional .pb.CppFeatures.StringType string_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_string_type()); - } - // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { - total_size += 2; - } - // optional bool enum_name_uses_string_view = 3 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000004u) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x00000006u & cached_has_bits) * 2; + { + // optional .pb.CppFeatures.StringType string_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_string_type()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void CppFeatures::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<CppFeatures*>(&to_msg); @@ -384,14 +377,14 @@ void CppFeatures::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_impl_.string_type_ = from._impl_.string_type_; } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.legacy_closed_enum_ = from._impl_.legacy_closed_enum_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.enum_name_uses_string_view_ = from._impl_.enum_name_uses_string_view_; } } @@ -407,7 +400,7 @@ void CppFeatures::CopyFrom(const CppFeatures& from) { } -void CppFeatures::InternalSwap(CppFeatures* PROTOBUF_RESTRICT other) { +void CppFeatures::InternalSwap(CppFeatures* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); @@ -423,10 +416,9 @@ void CppFeatures::InternalSwap(CppFeatures* PROTOBUF_RESTRICT other) { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } PROTOBUF_CONSTINIT PROTOBUF_EXPORT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi:: - ExtensionIdentifier<::google::protobuf::FeatureSet, ::_pbi::MessageTypeTraits< ::pb::CppFeatures >, - 11, false> - cpp(kCppFieldNumber, &::pb::_CppFeatures_default_instance_); + PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi::ExtensionIdentifier< + ::google::protobuf::FeatureSet, ::_pbi::MessageTypeTraits< ::pb::CppFeatures >, 11, false> + cpp(kCppFieldNumber, &::pb::_CppFeatures_default_instance_); // @@protoc_insertion_point(namespace_scope) } // namespace pb namespace google { diff --git a/third_party/protobuf/src/google/protobuf/cpp_features.pb.h b/third_party/protobuf/src/google/protobuf/cpp_features.pb.h index e6e55e682f4ae..249d1e9c63253 100644 --- a/third_party/protobuf/src/google/protobuf/cpp_features.pb.h +++ b/third_party/protobuf/src/google/protobuf/cpp_features.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/cpp_features.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fcpp_5ffeatures_2eproto_2epb_2eh #define google_2fprotobuf_2fcpp_5ffeatures_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -51,15 +51,22 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fcpp_5ffeatures_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcpp_5ffeatures_2eproto; +} // extern "C" namespace pb { +enum CppFeatures_StringType : int; +PROTOBUF_EXPORT extern const uint32_t CppFeatures_StringType_internal_data_[]; class CppFeatures; struct CppFeaturesDefaultTypeInternal; PROTOBUF_EXPORT extern CppFeaturesDefaultTypeInternal _CppFeatures_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull CppFeatures_class_data_; } // namespace pb namespace google { namespace protobuf { +template <> +internal::EnumTraitsT<::pb::CppFeatures_StringType_internal_data_> + internal::EnumTraitsImpl::value<::pb::CppFeatures_StringType>; } // namespace protobuf } // namespace google @@ -71,13 +78,16 @@ enum CppFeatures_StringType : int { CppFeatures_StringType_STRING = 3, }; -PROTOBUF_EXPORT bool CppFeatures_StringType_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t CppFeatures_StringType_internal_data_[]; -constexpr CppFeatures_StringType CppFeatures_StringType_StringType_MIN = static_cast<CppFeatures_StringType>(0); -constexpr CppFeatures_StringType CppFeatures_StringType_StringType_MAX = static_cast<CppFeatures_StringType>(3); -constexpr int CppFeatures_StringType_StringType_ARRAYSIZE = 3 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -CppFeatures_StringType_descriptor(); +inline constexpr CppFeatures_StringType CppFeatures_StringType_StringType_MIN = + static_cast<CppFeatures_StringType>(0); +inline constexpr CppFeatures_StringType CppFeatures_StringType_StringType_MAX = + static_cast<CppFeatures_StringType>(3); +inline bool CppFeatures_StringType_IsValid(int value) { + return 0 <= value && value <= 3; +} +inline constexpr int CppFeatures_StringType_StringType_ARRAYSIZE = 3 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL CppFeatures_StringType_descriptor(); template <typename T> const std::string& CppFeatures_StringType_Name(T value) { static_assert(std::is_same<T, CppFeatures_StringType>::value || @@ -87,13 +97,13 @@ const std::string& CppFeatures_StringType_Name(T value) { } template <> inline const std::string& CppFeatures_StringType_Name(CppFeatures_StringType value) { - return ::google::protobuf::internal::NameOfDenseEnum<CppFeatures_StringType_descriptor, - 0, 3>( + return ::google::protobuf::internal::NameOfDenseEnum<CppFeatures_StringType_descriptor, 0, 3>( static_cast<int>(value)); } -inline bool CppFeatures_StringType_Parse(absl::string_view name, CppFeatures_StringType* value) { - return ::google::protobuf::internal::ParseNamedEnum<CppFeatures_StringType>( - CppFeatures_StringType_descriptor(), name, value); +inline bool CppFeatures_StringType_Parse( + absl::string_view name, CppFeatures_StringType* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<CppFeatures_StringType>(CppFeatures_StringType_descriptor(), name, + value); } // =================================================================== @@ -108,15 +118,14 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message ~CppFeatures() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(CppFeatures* msg, std::destroying_delete_t) { + void operator delete(CppFeatures* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(CppFeatures)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR CppFeatures( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR CppFeatures(::google::protobuf::internal::ConstantInitialized); inline CppFeatures(const CppFeatures& from) : CppFeatures(nullptr, from) {} inline CppFeatures(CppFeatures&& from) noexcept @@ -139,30 +148,27 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const CppFeatures& default_instance() { - return *internal_default_instance(); - } - static inline const CppFeatures* internal_default_instance() { - return reinterpret_cast<const CppFeatures*>( + return *reinterpret_cast<const CppFeatures*>( &_CppFeatures_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(CppFeatures& a, CppFeatures& b) { a.Swap(&b); } - inline void Swap(CppFeatures* other) { + inline void Swap(CppFeatures* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -170,7 +176,7 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(CppFeatures* other) { + void UnsafeArenaSwap(CppFeatures* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -178,7 +184,7 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - CppFeatures* New(::google::protobuf::Arena* arena = nullptr) const { + CppFeatures* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<CppFeatures>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -187,9 +193,8 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message void MergeFrom(const CppFeatures& from) { CppFeatures::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -199,49 +204,51 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(CppFeatures* other); + void InternalSwap(CppFeatures* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "pb.CppFeatures"; } protected: - explicit CppFeatures(::google::protobuf::Arena* arena); - CppFeatures(::google::protobuf::Arena* arena, const CppFeatures& from); - CppFeatures(::google::protobuf::Arena* arena, CppFeatures&& from) noexcept + explicit CppFeatures(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + CppFeatures(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const CppFeatures& from); + CppFeatures( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, CppFeatures&& from) noexcept : CppFeatures(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using StringType = CppFeatures_StringType; @@ -255,14 +262,15 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message static constexpr StringType StringType_MIN = CppFeatures_StringType_StringType_MIN; static constexpr StringType StringType_MAX = CppFeatures_StringType_StringType_MAX; static constexpr int StringType_ARRAYSIZE = CppFeatures_StringType_StringType_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* StringType_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL StringType_descriptor() { return CppFeatures_StringType_descriptor(); } template <typename T> static inline const std::string& StringType_Name(T value) { return CppFeatures_StringType_Name(value); } - static inline bool StringType_Parse(absl::string_view name, StringType* value) { + static inline bool StringType_Parse( + absl::string_view name, StringType* PROTOBUF_NONNULL value) { return CppFeatures_StringType_Parse(name, value); } @@ -309,9 +317,9 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 3, 1, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 1, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -321,13 +329,14 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const CppFeatures& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const CppFeatures& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; int string_type_; @@ -339,14 +348,16 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message friend struct ::TableStruct_google_2fprotobuf_2fcpp_5ffeatures_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull CppFeatures_class_data_; + // =================================================================== -static const int kCppFieldNumber = 1000; +inline constexpr int kCppFieldNumber = + 1000; PROTOBUF_EXPORT extern ::google::protobuf::internal::ExtensionIdentifier< - ::google::protobuf::FeatureSet, ::google::protobuf::internal::MessageTypeTraits< ::pb::CppFeatures >, 11, - false> + ::google::protobuf::FeatureSet, ::google::protobuf::internal::MessageTypeTraits< ::pb::CppFeatures >, 11, false> cpp; // =================================================================== @@ -413,8 +424,10 @@ inline ::pb::CppFeatures_StringType CppFeatures::_internal_string_type() const { } inline void CppFeatures::_internal_set_string_type(::pb::CppFeatures_StringType value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::pb::CppFeatures_StringType_IsValid(value)); - _impl_.string_type_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::pb::CppFeatures_StringType_internal_data_)); + _impl_.string_type_ = value; } // optional bool enum_name_uses_string_view = 3 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { @@ -459,7 +472,7 @@ namespace protobuf { template <> struct is_proto_enum<::pb::CppFeatures_StringType> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::pb::CppFeatures_StringType>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::pb::CppFeatures_StringType>() { return ::pb::CppFeatures_StringType_descriptor(); } diff --git a/third_party/protobuf/src/google/protobuf/debug_counter_test.cc b/third_party/protobuf/src/google/protobuf/debug_counter_test.cc index d77f1c5bfd699..aa2cf9fe9b3ef 100644 --- a/third_party/protobuf/src/google/protobuf/debug_counter_test.cc +++ b/third_party/protobuf/src/google/protobuf/debug_counter_test.cc @@ -24,12 +24,16 @@ using testing::Not; auto MatchOutput(bool expect_output) { const auto header = HasSubstr("Protobuf debug counters:"); - const auto foo = HasSubstr("Foo :"); - const auto bar = HasSubstr("Bar : 1 (33.33%)"); - const auto baz = HasSubstr("Baz : 2 (66.67%)"); - const auto total = HasSubstr("Total : 3"); - return expect_output ? testing::Matcher<const std::string&>( - AllOf(header, foo, bar, baz, total)) + const auto all = AllOf(header, // + HasSubstr("Foo :"), + HasSubstr(" Bar : 1 (33.33%)"), + HasSubstr(" Baz : 2 (66.67%)"), + HasSubstr(" Total : 3"), // + HasSubstr("Num :"), + HasSubstr(" 32 : 3 (75.00%)"), + HasSubstr(" 128 : 1 (25.00%)"), + HasSubstr(" Total : 4")); + return expect_output ? testing::Matcher<const std::string&>(all) : testing::Matcher<const std::string&>(Not(header)); } @@ -39,9 +43,15 @@ TEST(DebugCounterTest, RealProvidesReportAtExit) { { static google::protobuf::internal::RealDebugCounter counter1("Foo.Bar"); static google::protobuf::internal::RealDebugCounter counter2("Foo.Baz"); + static google::protobuf::internal::RealDebugCounter counter3("Num.32"); + static google::protobuf::internal::RealDebugCounter counter4("Num.128"); counter1.Inc(); counter2.Inc(); counter2.Inc(); + counter3.Inc(); + counter3.Inc(); + counter3.Inc(); + counter4.Inc(); exit(0); }, ExitedWithCode(0), MatchOutput(true)); @@ -79,6 +89,10 @@ TEST(DebugCounterTest, MacroProvidesReportAtExitDependingOnBuild) { for (int i = 0; i < 2; ++i) { PROTOBUF_DEBUG_COUNTER("Foo.Baz").Inc(); } + for (int i = 0; i < 3; ++i) { + PROTOBUF_DEBUG_COUNTER("Num.32").Inc(); + } + PROTOBUF_DEBUG_COUNTER("Num.128").Inc(); exit(0); }, ExitedWithCode(0), MatchOutput(match_output)); diff --git a/third_party/protobuf/src/google/protobuf/descriptor.cc b/third_party/protobuf/src/google/protobuf/descriptor.cc index b649e2d5f08b6..dcbea63f535e3 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.cc +++ b/third_party/protobuf/src/google/protobuf/descriptor.cc @@ -33,10 +33,13 @@ #include <utility> #include <vector> +#include "absl/algorithm/container.h" #include "absl/base/attributes.h" #include "absl/base/call_once.h" #include "absl/base/casts.h" #include "absl/base/const_init.h" +#include "absl/base/dynamic_annotations.h" +#include "absl/base/optimization.h" #include "absl/base/thread_annotations.h" #include "absl/cleanup/cleanup.h" #include "absl/container/btree_map.h" @@ -257,6 +260,16 @@ using IntT = int; template <typename T> using PointerT = T*; +// State that we gather during EstimatedMemoryUsed while on the lock, but we +// will use outside the lock. +struct EstimatedMemoryUsedState { + // We can't call SpaceUsed under the lock because it uses reflection and can + // potentially deadlock if it requires to load new files into the pool. + // NOTE: Messages added here must not be modified or destroyed outside the + // lock while the pool is alive. + std::vector<const Message*> messages; +}; + // Manages an allocation of sequential arrays of type `T...`. // It is more space efficient than storing N (ptr, size) pairs, by storing only // the pointer to the head and the boundaries between the arrays. @@ -535,21 +548,17 @@ class FlatAllocatorImpl { return pointers_.template Get<char>() != nullptr; } - static bool IsLower(char c) { return 'a' <= c && c <= 'z'; } - static bool IsDigit(char c) { return '0' <= c && c <= '9'; } - static bool IsLowerOrDigit(char c) { return IsLower(c) || IsDigit(c); } - enum class FieldNameCase { kAllLower, kSnakeCase, kOther }; FieldNameCase GetFieldNameCase(const absl::string_view name) { - if (!name.empty() && !IsLower(name[0])) return FieldNameCase::kOther; + if (!name.empty() && !absl::ascii_islower(name[0])) { + return FieldNameCase::kOther; + } FieldNameCase best = FieldNameCase::kAllLower; for (char c : name) { - if (IsLowerOrDigit(c)) { - // nothing to do + if (absl::ascii_isupper(c)) { + return FieldNameCase::kOther; } else if (c == '_') { best = FieldNameCase::kSnakeCase; - } else { - return FieldNameCase::kOther; } } return best; @@ -566,17 +575,11 @@ class FlatAllocatorImpl { TypeMap<IntT, T...> used_; }; -// Allows us to disable tracking in the current thread while certain build steps -// are happening. -bool& is_tracking_enabled() { - static PROTOBUF_THREAD_LOCAL bool value = true; - return value; -} - -auto DisableTracking() { - bool old_value = is_tracking_enabled(); - is_tracking_enabled() = false; - return absl::MakeCleanup([=] { is_tracking_enabled() = old_value; }); +static auto DisableTracking() { + bool old_value = internal::cpp::IsTrackingEnabled(); + internal::cpp::IsTrackingEnabledVar() = false; + return absl::MakeCleanup( + [=] { internal::cpp::IsTrackingEnabledVar() = old_value; }); } } // namespace @@ -955,12 +958,30 @@ struct SymbolByFullNameEq { using SymbolsByNameSet = absl::flat_hash_set<Symbol, SymbolByFullNameHash, SymbolByFullNameEq>; -struct ParentNameQuery { +struct ParentNameQueryBase { std::pair<const void*, absl::string_view> query; std::pair<const void*, absl::string_view> parent_name_key() const { return query; } }; +struct ParentNameQuery : public ParentNameQueryBase { + using SymbolT = Symbol; + + template <typename It> + static SymbolT IterToSymbol(It it) { + return *it; + } +}; +struct ParentNameFieldQuery : public ParentNameQueryBase { + using SymbolT = const FieldDescriptor*; + + template <typename It> + static SymbolT IterToSymbol(It it) { + SymbolT field = it->field_descriptor(); + ABSL_ASSUME(field != nullptr); + return field; + } +}; struct SymbolByParentHash { using is_transparent = void; @@ -972,6 +993,14 @@ struct SymbolByParentHash { struct SymbolByParentEq { using is_transparent = void; + bool operator()(const Symbol& symbol, + const ParentNameFieldQuery& query) const { + const FieldDescriptor* field = symbol.field_descriptor(); + return field != nullptr && !field->is_extension() && + field->containing_type() == query.query.first && + field->name() == query.query.second; + } + template <typename T, typename U> bool operator()(const T& a, const U& b) const { return a.parent_name_key() == b.parent_name_key(); @@ -1095,20 +1124,6 @@ bool AllowedExtendeeInProto3(const absl::string_view name) { allowed_proto3_extendees->end(); } -const FeatureSetDefaults& GetCppFeatureSetDefaults() { - static const FeatureSetDefaults* default_spec = - internal::OnShutdownDelete([] { - auto* defaults = new FeatureSetDefaults(); - internal::ParseNoReflection( - absl::string_view{ - PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS, - sizeof(PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS) - 1}, - *defaults); - return defaults; - }()); - return *default_spec; -} - template <typename ProtoT> void RestoreFeaturesToOptions(const FeatureSet* features, ProtoT* proto) { if (features != &FeatureSet::default_instance()) { @@ -1218,8 +1233,9 @@ class FileDescriptorTables { // TODO: All callers to this function know the type they are looking // for. If we propagate that information statically we can make the query // faster. - inline Symbol FindNestedSymbol(const void* parent, - absl::string_view name) const; + template <typename K = ParentNameQuery> + inline auto FindNestedSymbol(const void* parent, + absl::string_view name) const; // These return nullptr if not found. inline const FieldDescriptor* FindFieldByNumber(const Descriptor* parent, @@ -1688,10 +1704,12 @@ inline Symbol DescriptorPool::Tables::FindSymbol(absl::string_view key) const { return it == symbols_by_name_.end() ? Symbol() : *it; } -inline Symbol FileDescriptorTables::FindNestedSymbol( +template <typename K> +inline auto FileDescriptorTables::FindNestedSymbol( const void* parent, absl::string_view name) const { - auto it = symbols_by_parent_.find(ParentNameQuery{{parent, name}}); - return it == symbols_by_parent_.end() ? Symbol() : *it; + auto it = symbols_by_parent_.find(K{{{parent, name}}}); + return it == symbols_by_parent_.end() ? typename K::SymbolT() + : K::IterToSymbol(it); } Symbol DescriptorPool::Tables::FindByNameHelper(const DescriptorPool* pool, @@ -2097,7 +2115,7 @@ DescriptorPool::DescriptorPool() lazily_build_dependencies_(false), allow_unknown_(false), enforce_weak_(false), - enforce_extension_declarations_(false), + enforce_extension_declarations_(ExtDeclEnforcementLevel::kNoEnforcement), disallow_enforce_utf8_(false), deprecated_legacy_json_field_conflicts_(false) {} @@ -2112,7 +2130,7 @@ DescriptorPool::DescriptorPool(DescriptorDatabase* fallback_database, lazily_build_dependencies_(false), allow_unknown_(false), enforce_weak_(false), - enforce_extension_declarations_(false), + enforce_extension_declarations_(ExtDeclEnforcementLevel::kNoEnforcement), disallow_enforce_utf8_(false), deprecated_legacy_json_field_conflicts_(false) {} @@ -2126,7 +2144,7 @@ DescriptorPool::DescriptorPool(const DescriptorPool* underlay) lazily_build_dependencies_(false), allow_unknown_(false), enforce_weak_(false), - enforce_extension_declarations_(false), + enforce_extension_declarations_(ExtDeclEnforcementLevel::kNoEnforcement), disallow_enforce_utf8_(false), deprecated_legacy_json_field_conflicts_(false) {} @@ -2512,9 +2530,7 @@ const FieldDescriptor* Descriptor::FindFieldByCamelcaseName( const FieldDescriptor* Descriptor::FindFieldByName( absl::string_view name) const { - const FieldDescriptor* field = - file()->tables_->FindNestedSymbol(this, name).field_descriptor(); - return field != nullptr && !field->is_extension() ? field : nullptr; + return file()->tables_->FindNestedSymbol<ParentNameFieldQuery>(this, name); } const OneofDescriptor* Descriptor::FindOneofByName( @@ -3028,7 +3044,7 @@ void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const { if (!containing_type()->is_unqualified_placeholder_) { proto->set_extendee("."); } - proto->mutable_extendee()->append(containing_type()->full_name()); + absl::StrAppend(proto->mutable_extendee(), containing_type()->full_name()); } if (cpp_type() == CPPTYPE_MESSAGE) { @@ -3041,12 +3057,12 @@ void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const { if (!message_type()->is_unqualified_placeholder_) { proto->set_type_name("."); } - proto->mutable_type_name()->append(message_type()->full_name()); + absl::StrAppend(proto->mutable_type_name(), message_type()->full_name()); } else if (cpp_type() == CPPTYPE_ENUM) { if (!enum_type()->is_unqualified_placeholder_) { proto->set_type_name("."); } - proto->mutable_type_name()->append(enum_type()->full_name()); + absl::StrAppend(proto->mutable_type_name(), enum_type()->full_name()); } if (has_default_value()) { @@ -3059,10 +3075,10 @@ void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const { if (&options() != &FieldOptions::default_instance()) { *proto->mutable_options() = options(); - if (proto_features_->GetExtension(pb::cpp).has_string_type()) { - // ctype must have been set in InferLegacyProtoFeatures so avoid copying. - proto->mutable_options()->clear_ctype(); - } + } + if (has_legacy_proto_ctype()) { + proto->mutable_options()->set_ctype( + static_cast<FieldOptions::CType>(legacy_proto_ctype())); } RestoreFeaturesToOptions(proto_features_, proto); @@ -3130,12 +3146,12 @@ void MethodDescriptor::CopyTo(MethodDescriptorProto* proto) const { if (!input_type()->is_unqualified_placeholder_) { proto->set_input_type("."); } - proto->mutable_input_type()->append(input_type()->full_name()); + absl::StrAppend(proto->mutable_input_type(), input_type()->full_name()); if (!output_type()->is_unqualified_placeholder_) { proto->set_output_type("."); } - proto->mutable_output_type()->append(output_type()->full_name()); + absl::StrAppend(proto->mutable_output_type(), output_type()->full_name()); if (&options() != &MethodOptions::default_instance()) { *proto->mutable_options() = options(); @@ -3201,7 +3217,7 @@ bool RetrieveOptionsAssumingRightPool( if (field->is_extension()) { name = absl::StrCat("(.", field->full_name(), ")"); } else { - name = field->name(); + name = std::string(field->name()); } option_entries->push_back(absl::StrCat(name, " = ", fieldval)); } @@ -3669,6 +3685,10 @@ void FieldDescriptor::DebugString( FieldOptions full_options = options(); CopyFeaturesToOptions(proto_features_, &full_options); + if (has_legacy_proto_ctype()) { + full_options.set_ctype( + static_cast<FieldOptions::CType>(legacy_proto_ctype())); + } std::string formatted_options; if (FormatBracketedOptions(depth, full_options, file()->pool(), &formatted_options)) { @@ -3910,6 +3930,10 @@ void MethodDescriptor::DebugString( // Feature methods =============================================== +bool FieldDescriptor::has_legacy_proto_ctype() const { + return legacy_proto_ctype_ <= FieldOptions::CType_MAX; +} + bool EnumDescriptor::is_closed() const { return features().enum_type() == FeatureSet::CLOSED; } @@ -3952,16 +3976,15 @@ bool FieldDescriptor::has_optional_keyword() const { FieldDescriptor::CppStringType FieldDescriptor::cpp_string_type() const { ABSL_DCHECK(cpp_type() == FieldDescriptor::CPPTYPE_STRING); + + if (internal::cpp::IsStringFieldWithPrivatizedAccessors(*this)) { + return CppStringType::kString; + } + switch (features().GetExtension(pb::cpp).string_type()) { case pb::CppFeatures::VIEW: return CppStringType::kView; case pb::CppFeatures::CORD: - // In open-source, protobuf CORD is only supported for singular bytes - // fields. - if (type() != FieldDescriptor::TYPE_BYTES || is_repeated() || - is_extension()) { - return CppStringType::kString; - } return CppStringType::kCord; case pb::CppFeatures::STRING: return CppStringType::kString; @@ -4783,6 +4806,36 @@ absl::Status DescriptorPool::SetFeatureSetDefaults(FeatureSetDefaults spec) { return absl::OkStatus(); } +const FeatureSetDefaults& DescriptorPool::GetFeatureSetDefaults() const { + if (feature_set_defaults_spec_ != nullptr) return *feature_set_defaults_spec_; + static const FeatureSetDefaults* cpp_default_spec = + internal::OnShutdownDelete([] { + auto* defaults = new FeatureSetDefaults(); + internal::ParseNoReflection( + absl::string_view{ + PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS, + sizeof(PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS) - 1}, + *defaults); + return defaults; + }()); + return *cpp_default_spec; +} + +bool DescriptorPool::ResolvesFeaturesForImpl(int extension_number) const { + for (const auto& edition_default : GetFeatureSetDefaults().defaults()) { + std::vector<const FieldDescriptor*> fields; + auto features = edition_default.fixed_features(); + features.MergeFrom(edition_default.overridable_features()); + features.GetReflection()->ListFields(features, &fields); + if (absl::c_find_if(fields, [&](const FieldDescriptor* field) { + return field->number() == extension_number; + }) == fields.end()) { + return false; + } + } + return true; +} + DescriptorBuilder::DescriptorBuilder( const DescriptorPool* pool, DescriptorPool::Tables* tables, DescriptorPool::DeferredValidation& deferred_validation, @@ -4799,7 +4852,7 @@ DescriptorBuilder::DescriptorBuilder( // have to avoid registering these pre-main, because we need to ensure that // the linker --gc-sections step can strip out the full runtime if it is // unused. - PROTOBUF_UNUSED static std::true_type lazy_register = + [[maybe_unused]] static std::true_type lazy_register = (internal::ExtensionSet::RegisterMessageExtension( &FeatureSet::default_instance(), pb::cpp.number(), FieldDescriptor::TYPE_MESSAGE, false, false, @@ -5478,7 +5531,7 @@ static void InferLegacyProtoFeatures(const ProtoT& proto, static void InferLegacyProtoFeatures(const FieldDescriptorProto& proto, const FieldOptions& options, Edition edition, FeatureSet& features) { - if (!features.MutableExtension(pb::cpp)->has_string_type()) { + if (!features.GetExtension(pb::cpp).has_string_type()) { if (options.ctype() == FieldOptions::CORD) { features.MutableExtension(pb::cpp)->set_string_type( pb::CppFeatures::CORD); @@ -5504,23 +5557,6 @@ static void InferLegacyProtoFeatures(const FieldDescriptorProto& proto, } } -// TODO: we should update proto code to not need ctype to be set -// when string_type is set. -static void EnforceCTypeStringTypeConsistency( - Edition edition, FieldDescriptor::CppType type, - const pb::CppFeatures& cpp_features, FieldOptions& options) { - if (&options == &FieldOptions::default_instance()) return; - if (type == FieldDescriptor::CPPTYPE_STRING) { - switch (cpp_features.string_type()) { - case pb::CppFeatures::CORD: - options.set_ctype(FieldOptions::CORD); - break; - default: - break; - } - } -} - template <class DescriptorT> void DescriptorBuilder::ResolveFeaturesImpl( Edition edition, const typename DescriptorT::Proto& proto, @@ -5612,6 +5648,13 @@ void DescriptorBuilder::PostProcessFieldFeatures( field.type_ = FieldDescriptor::TYPE_GROUP; } } + + if (field.options_->has_ctype()) { + field.legacy_proto_ctype_ = field.options_->ctype(); + const_cast<FieldOptions*>( // NOLINT(google3-runtime-proto-const-cast) + field.options_) + ->clear_ctype(); + } } // A common pattern: We want to convert a repeated field in the descriptor @@ -5915,10 +5958,7 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( }); } - const FeatureSetDefaults& defaults = - pool_->feature_set_defaults_spec_ == nullptr - ? GetCppFeatureSetDefaults() - : *pool_->feature_set_defaults_spec_; + const FeatureSetDefaults& defaults = pool_->GetFeatureSetDefaults(); absl::StatusOr<FeatureResolver> feature_resolver = FeatureResolver::Create(file_->edition_, defaults); @@ -6147,24 +6187,6 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( option_interpreter.InterpretNonExtensionOptions(&(*iter)); } - // TODO: move this check back to generator.cc once we no longer - // need to set both ctype and string_type internally. - internal::VisitDescriptors( - *result, proto, - [&](const FieldDescriptor& field, const FieldDescriptorProto& proto) { - if (field.options_->has_ctype() && field.options_->features() - .GetExtension(pb::cpp) - .has_string_type()) { - AddError(field.full_name(), proto, - DescriptorPool::ErrorCollector::TYPE, [&] { - return absl::StrFormat( - "Field %s specifies both string_type and ctype " - "which is not supported.", - field.full_name()); - }); - } - }); - // Handle feature resolution. This must occur after option interpretation, // but before validation. { @@ -6186,22 +6208,6 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( }); } - internal::VisitDescriptors(*result, [&](const FieldDescriptor& field) { - if (result->edition() >= Edition::EDITION_2024 && - field.options().has_ctype()) { - // "ctype" is no longer supported in edition 2024 and beyond. - AddError( - field.full_name(), proto, DescriptorPool::ErrorCollector::NAME, - "ctype option is not allowed under edition 2024 and beyond. Use " - "the feature string_type = VIEW|CORD|STRING|... instead."); - } - EnforceCTypeStringTypeConsistency( - field.file()->edition(), field.cpp_type(), - field.merged_features_->GetExtension(pb::cpp), - const_cast< // NOLINT(google3-runtime-proto-const-cast) - FieldOptions&>(*field.options_)); - }); - // Post-process cleanup for field features. internal::VisitDescriptors( *result, proto, @@ -6597,6 +6603,7 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, result->is_oneof_ = false; result->in_real_oneof_ = false; result->proto3_optional_ = proto.proto3_optional(); + result->legacy_proto_ctype_ = FieldOptions::CType_MAX + 1; if (proto.proto3_optional() && file_->edition() != Edition::EDITION_PROTO3) { AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, @@ -7157,9 +7164,9 @@ void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, // scope. Let's print an additional error to explain this. std::string outer_scope; if (parent->containing_type() == nullptr) { - outer_scope = file_->package(); + outer_scope = std::string(file_->package()); } else { - outer_scope = parent->containing_type()->full_name(); + outer_scope = std::string(parent->containing_type()->full_name()); } if (outer_scope.empty()) { @@ -7355,7 +7362,7 @@ void DescriptorBuilder::CheckExtensionDeclarationFieldType( const FieldDescriptor& field, const FieldDescriptorProto& proto, absl::string_view type) { if (had_errors_) return; - std::string actual_type = field.type_name(); + std::string actual_type(field.type_name()); std::string expected_type(type); if (field.message_type() || field.enum_type()) { // Field message type descriptor can be in a partial state which will cause @@ -7945,6 +7952,13 @@ void DescriptorBuilder::ValidateOptions(const FieldDescriptor* field, ValidateFieldFeatures(field, proto); + if (field->file()->edition() >= Edition::EDITION_2024 && + field->has_legacy_proto_ctype()) { + AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, + "ctype option is not allowed under edition 2024 and beyond. Use " + "the feature string_type = VIEW|CORD|STRING|... instead."); + } + // Only message type fields may be lazy. if (field->options().lazy() || field->options().unverified_lazy()) { if (field->type() != FieldDescriptor::TYPE_MESSAGE) { @@ -8039,7 +8053,7 @@ void DescriptorBuilder::ValidateOptions(const FieldDescriptor* field, return; } - if (pool_->enforce_extension_declarations_) { + if (pool_->EnforceCustomExtensionDeclarations()) { for (const auto& declaration : extension_range->options_->declaration()) { if (declaration.number() != field->number()) continue; if (declaration.reserved()) { @@ -8148,14 +8162,12 @@ void DescriptorBuilder::ValidateFieldFeatures( AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::NAME, "Implicit presence fields can't specify defaults."); } - if (field->enum_type() != nullptr && - field->enum_type()->features().enum_type() != FeatureSet::OPEN) { + if (field->enum_type() != nullptr && field->enum_type()->is_closed()) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::NAME, "Implicit presence enum fields must always be open."); } } - if (field->is_extension() && - field->features().field_presence() == FeatureSet::LEGACY_REQUIRED) { + if (field->is_extension() && field->is_required()) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::NAME, "Extensions can't be required."); } @@ -9791,9 +9803,28 @@ bool HasPreservingUnknownEnumSemantics(const FieldDescriptor* field) { return field->enum_type() != nullptr && !field->enum_type()->is_closed(); } +HasbitMode GetFieldHasbitMode(const FieldDescriptor* field) { + // Do not generate hasbits for "real-oneof", weak, or extension fields. + if (field->real_containing_oneof() || field->options().weak() || + field->is_extension()) { + return HasbitMode::kNoHasbit; + } + + // Explicit-presence fields always have true hasbits. + if (field->has_presence()) { + return HasbitMode::kTrueHasbit; + } + + // Implicit presence fields. + if (!field->is_repeated()) { + return HasbitMode::kHintHasbit; + } + // We currently don't implement hasbits for implicit repeated fields. + return HasbitMode::kNoHasbit; +} + bool HasHasbit(const FieldDescriptor* field) { - return field->has_presence() && !field->real_containing_oneof() && - !field->options().weak(); + return GetFieldHasbitMode(field) != HasbitMode::kNoHasbit; } static bool IsVerifyUtf8(const FieldDescriptor* field, bool is_lite) { @@ -9845,7 +9876,21 @@ bool IsLazilyInitializedFile(absl::string_view filename) { filename == "google/protobuf/descriptor.proto"; } -bool IsTrackingEnabled() { return is_tracking_enabled(); } +bool IsStringFieldWithPrivatizedAccessors(const FieldDescriptor& field) { + // In open-source, protobuf CORD is only supported for singular bytes + // fields. + if (field.cpp_type() == FieldDescriptor::CPPTYPE_STRING && + InternalFeatureHelper::GetFeatures(field) + .GetExtension(pb::cpp) + .string_type() == pb::CppFeatures::CORD && + (field.type() != FieldDescriptor::TYPE_BYTES || field.is_repeated() || + field.is_extension()) + ) { + return true; + } + + return false; +} } // namespace cpp } // namespace internal diff --git a/third_party/protobuf/src/google/protobuf/descriptor.h b/third_party/protobuf/src/google/protobuf/descriptor.h index ccbc409746b87..f52182de6f666 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.h +++ b/third_party/protobuf/src/google/protobuf/descriptor.h @@ -36,13 +36,14 @@ #include <iterator> #include <memory> #include <string> +#include <type_traits> #include <utility> #include <vector> -#include "google/protobuf/stubs/common.h" #include "absl/base/attributes.h" #include "absl/base/call_once.h" -#include "absl/container/btree_map.h" +#include "absl/base/optimization.h" +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/functional/any_invocable.h" #include "absl/functional/function_ref.h" @@ -51,7 +52,6 @@ #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" -#include "absl/types/optional.h" #include "google/protobuf/descriptor_lite.h" #include "google/protobuf/extension_set.h" #include "google/protobuf/port.h" @@ -129,12 +129,14 @@ namespace compiler { class CodeGenerator; class CommandLineInterface; namespace cpp { +class CppGenerator; // Defined in helpers.h class Formatter; } // namespace cpp } // namespace compiler namespace descriptor_unittest { +class DescriptorPoolMemoizationTest; class DescriptorTest; class ValidationErrorTest; } // namespace descriptor_unittest @@ -409,7 +411,9 @@ class PROTOBUF_EXPORT Descriptor : private internal::SymbolBase { // The number of fields in this message type. int field_count() const; // Gets a field by index, where 0 <= index < field_count(). - // These are returned in the order they were defined in the .proto file. + // These are returned in the order they were defined in the .proto file, not + // the field number order. (Use `FindFieldByNumber()` for + // tag number -> value lookup). const FieldDescriptor* field(int index) const; // Looks up a field by declared tag number. Returns nullptr if no such field @@ -869,11 +873,13 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase, // when parsing formats which prefer to use camel-case naming style. internal::DescriptorStringView camelcase_name() const; - Type type() const; // Declared type of this field. - const char* type_name() const; // Name of the declared type. - CppType cpp_type() const; // C++ type of this field. - const char* cpp_type_name() const; // Name of the C++ type. - Label label() const; // optional/required/repeated + Type type() const; // Declared type of this field. + // Name of the declared type. + absl::string_view type_name() const; + CppType cpp_type() const; // C++ type of this field. + // Name of the C++ type. + absl::string_view cpp_type_name() const; + Label label() const; // optional/required/repeated #ifndef SWIG CppStringType cpp_string_type() const; // The C++ string type of this field. @@ -1024,10 +1030,10 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase, static CppType TypeToCppType(Type type); // Helper method to get the name of a Type. - static const char* TypeName(Type type); + static absl::string_view TypeName(Type type); // Helper method to get the name of a CppType. - static const char* CppTypeName(CppType cpp_type); + static absl::string_view CppTypeName(CppType cpp_type); // Return true iff [packed = true] is valid for fields of this type. static inline bool IsTypePackable(Type field_type); @@ -1066,6 +1072,14 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase, friend const std::string& internal::DefaultValueStringAsString( const FieldDescriptor* field); + // Returns the original ctype specified in the .proto file. This should not + // be relied on, as it no longer uniquely determines behavior. The + // cpp_string_type() method should be used instead, which takes feature + // settings into account. Needed by CppGenerator for validation only. + friend class compiler::cpp::CppGenerator; + int legacy_proto_ctype() const { return legacy_proto_ctype_; } + bool has_legacy_proto_ctype() const; + // Returns true if this field was syntactically written with "optional" in the // .proto file. Excludes singular proto3 fields that do not have a label. bool has_optional_keyword() const; @@ -1129,6 +1143,10 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase, // Located here for bitpacking. bool in_real_oneof_ : 1; + // Actually an optional `CType`, but stored as uint8_t to save space. This + // contains the original ctype option specified in the .proto file. + uint8_t legacy_proto_ctype_ : 2; + // Sadly, `number_` located here to reduce padding. Unrelated to all_names_ // and its indices above. int number_; @@ -1186,7 +1204,7 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase, friend class OneofDescriptor; }; -PROTOBUF_INTERNAL_CHECK_CLASS_SIZE(FieldDescriptor, 88); +PROTOBUF_INTERNAL_CHECK_CLASS_SIZE(FieldDescriptor, 96); // Describes a oneof defined in a message type. class PROTOBUF_EXPORT OneofDescriptor : private internal::SymbolBase { @@ -1321,7 +1339,8 @@ class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase { // than zero. int value_count() const; // Gets a value by index, where 0 <= index < value_count(). - // These are returned in the order they were defined in the .proto file. + // These are returned in the order they were defined in the .proto file, not + // the enum value order. (Use `FindValueByNumber()` for enum -> value lookup). const EnumValueDescriptor* value(int index) const; // Looks up a value by name. Returns nullptr if no such value exists. @@ -2040,6 +2059,18 @@ class PROTOBUF_EXPORT FileDescriptor : private internal::SymbolBase { PROTOBUF_INTERNAL_CHECK_CLASS_SIZE(FileDescriptor, 168); +#ifndef SWIG +enum class ExtDeclEnforcementLevel : uint8_t { + // No enforcement. + kNoEnforcement = 0, + // All extensions excluding descriptor.proto extensions + // (go/extension-declarations#descriptor-proto) + kCustomExtensions = 1, + // All extensions including descriptor.proto extensions. + kAllExtensions = 2, +}; +#endif // !SWIG + // =================================================================== // Used to construct descriptors. @@ -2261,14 +2292,35 @@ class PROTOBUF_EXPORT DescriptorPool { // be enforced while building proto files. absl::Status SetFeatureSetDefaults(FeatureSetDefaults spec); + // Returns true if the descriptor pool resolves features for the given + // extension. + template <typename TypeTraitsT, uint8_t field_type, bool is_packed> + bool ResolvesFeaturesFor( + const google::protobuf::internal::ExtensionIdentifier< + FeatureSet, TypeTraitsT, field_type, is_packed>& extension) const { + return ResolvesFeaturesForImpl(extension.number()); + } + // Toggles enforcement of extension declarations. // This enforcement is disabled by default because it requires full // descriptors with source-retention options, which are generally not // available at runtime. - void EnforceExtensionDeclarations(bool enforce) { + void EnforceExtensionDeclarations(google::protobuf::ExtDeclEnforcementLevel enforce) { enforce_extension_declarations_ = enforce; } + bool EnforceDescriptorExtensionDeclarations() const { + return enforce_extension_declarations_ == + ExtDeclEnforcementLevel::kAllExtensions; + } + + bool EnforceCustomExtensionDeclarations() const { + return enforce_extension_declarations_ == + ExtDeclEnforcementLevel::kAllExtensions || + enforce_extension_declarations_ == + ExtDeclEnforcementLevel::kCustomExtensions; + } + #ifndef SWIG // Dispatch recursive builds to a callback that may stick them onto a separate // thread. This is primarily to avoid stack overflows on untrusted inputs. @@ -2398,9 +2450,49 @@ class PROTOBUF_EXPORT DescriptorPool { friend class FileDescriptor; friend class DescriptorBuilder; friend class FileDescriptorTables; + friend class google::protobuf::descriptor_unittest::DescriptorPoolMemoizationTest; friend class google::protobuf::descriptor_unittest::ValidationErrorTest; friend class ::google::protobuf::compiler::CommandLineInterface; + friend class TextFormat; + struct MemoBase { + virtual ~MemoBase() = default; + }; + template <typename T> + struct MemoData : MemoBase { + T value; + }; + + // Memoize a projection of a field. This is used to cache the results of + // calling a function on a field, used for expensive descriptor calculations. + template <typename Func> + const auto& MemoizeProjection(const FieldDescriptor* field, Func func) const { + using ResultT = std::decay_t<decltype(func(field))>; + ABSL_DCHECK(field->file()->pool() == this); + static_assert(std::is_empty_v<Func>); + // This static bool is unique per-Func, so its address can be used as a key. + static bool type_key; + auto key = std::pair<const void*, const void*>(field, &type_key); + { + absl::ReaderMutexLock lock(&field_memo_table_mutex_); + auto it = field_memo_table_.find(key); + if (it != field_memo_table_.end()) { + return internal::DownCast<const MemoData<ResultT>&>(*it->second).value; + } + } + auto result = std::make_unique<MemoData<ResultT>>(); + result->value = func(field); + { + absl::MutexLock lock(&field_memo_table_mutex_); + auto& res = field_memo_table_[key]; + // Only initialize the first time. We don't want to invalidate old + // references. + if (res == nullptr) { + res = std::move(result); + } + return internal::DownCast<const MemoData<ResultT>&>(*res).value; + } + } // Return true if the given name is a sub-symbol of any non-package // descriptor that already exists in the descriptor pool. (The full // definition of such types is already known.) @@ -2459,6 +2551,13 @@ class PROTOBUF_EXPORT DescriptorPool { Symbol NewPlaceholderWithMutexHeld(absl::string_view name, PlaceholderType placeholder_type) const; +#ifndef SWIG + mutable absl::Mutex field_memo_table_mutex_; + mutable absl::flat_hash_map<std::pair<const void*, const void*>, + std::unique_ptr<MemoBase>> + field_memo_table_ ABSL_GUARDED_BY(field_memo_table_mutex_); +#endif // SWIG + // If fallback_database_ is nullptr, this is nullptr. Otherwise, this is a // mutex which must be locked while accessing tables_. absl::Mutex* mutex_; @@ -2483,7 +2582,7 @@ class PROTOBUF_EXPORT DescriptorPool { bool lazily_build_dependencies_; bool allow_unknown_; bool enforce_weak_; - bool enforce_extension_declarations_; + ExtDeclEnforcementLevel enforce_extension_declarations_; bool disallow_enforce_utf8_; bool deprecated_legacy_json_field_conflicts_; mutable bool build_started_ = false; @@ -2500,6 +2599,10 @@ class PROTOBUF_EXPORT DescriptorPool { bool IsReadyForCheckingDescriptorExtDecl( absl::string_view message_name) const; + + bool ResolvesFeaturesForImpl(int extension_number) const; + + const FeatureSetDefaults& GetFeatureSetDefaults() const; }; @@ -2826,7 +2929,7 @@ inline int MethodDescriptor::index() const { return static_cast<int>(this - service_->methods_); } -inline const char* FieldDescriptor::type_name() const { +inline absl::string_view FieldDescriptor::type_name() const { return kTypeToName[type()]; } @@ -2834,7 +2937,7 @@ inline FieldDescriptor::CppType FieldDescriptor::cpp_type() const { return kTypeToCppTypeMap[type()]; } -inline const char* FieldDescriptor::cpp_type_name() const { +inline absl::string_view FieldDescriptor::cpp_type_name() const { return kCppTypeToName[kTypeToCppTypeMap[type()]]; } @@ -2842,11 +2945,11 @@ inline FieldDescriptor::CppType FieldDescriptor::TypeToCppType(Type type) { return kTypeToCppTypeMap[type]; } -inline const char* FieldDescriptor::TypeName(Type type) { +inline absl::string_view FieldDescriptor::TypeName(Type type) { return kTypeToName[type]; } -inline const char* FieldDescriptor::CppTypeName(CppType cpp_type) { +inline absl::string_view FieldDescriptor::CppTypeName(CppType cpp_type) { return kCppTypeToName[cpp_type]; } @@ -2946,23 +3049,33 @@ constexpr int MaxMessageDeclarationNestingDepth() { return 32; } PROTOBUF_EXPORT bool HasPreservingUnknownEnumSemantics( const FieldDescriptor* field); -PROTOBUF_EXPORT bool HasHasbit(const FieldDescriptor* field); - #ifndef SWIG -// For a string field, returns the effective ctype. If the actual ctype is -// not supported, returns the default of STRING. -template <typename FieldDesc = FieldDescriptor, - typename FieldOpts = FieldOptions> -typename FieldOpts::CType EffectiveStringCType(const FieldDesc* field) { - // TODO Replace this function with - // FieldDescriptor::cpp_string_type; - switch (field->cpp_string_type()) { - case FieldDescriptor::CppStringType::kCord: - return FieldOpts::CORD; - default: - return FieldOpts::STRING; - } -} +enum class HasbitMode : uint8_t { + // Hasbits do not exist for the field. + kNoHasbit, + // Hasbits exist and indicate field presence. + // Hasbit is set if and only if field is present. + kTrueHasbit, + // Hasbits exist and "hint at" field presence. + // When hasbit is set, field is 'probably' present, but field accessors must + // still check for field presence (i.e. false positives are possible). + // When hasbit is unset, field is guaranteed to be not present. + kHintHasbit, +}; + +// Returns the "hasbit mode" of the field. Depending on the implementation, a +// field can: +// - have no hasbits in its internal object (kNoHasbit); +// - have hasbits where hasbit == 1 indicates field presence and hasbit == 0 +// indicates an unset field (kTrueHasbit); +// - have hasbits where hasbit == 1 indicates "field is possibly modified" and +// hasbit == 0 indicates "field is definitely missing" (kHintHasbit). +PROTOBUF_EXPORT HasbitMode GetFieldHasbitMode(const FieldDescriptor* field); + +// Returns true if there are hasbits for the field. +// Note that this does not correlate with "hazzer"s, i.e., whether has_foo APIs +// are emitted. +PROTOBUF_EXPORT bool HasHasbit(const FieldDescriptor* field); enum class Utf8CheckMode : uint8_t { kStrict = 0, // Parsing will fail if non UTF-8 data is in string fields. @@ -2987,7 +3100,13 @@ PROTOBUF_EXPORT bool IsLazilyInitializedFile(absl::string_view filename); // Returns true during internal calls that should avoid calling trackers. These // calls can be particularly dangerous during build steps like feature // resolution, where a MergeFrom call can wind up in a deadlock. -PROTOBUF_EXPORT bool IsTrackingEnabled(); +PROTOBUF_EXPORT inline bool& IsTrackingEnabledVar() { + static PROTOBUF_THREAD_LOCAL bool is_tracking_enabled = true; + return is_tracking_enabled; +} +PROTOBUF_EXPORT inline bool IsTrackingEnabled() { + return ABSL_PREDICT_TRUE(IsTrackingEnabledVar()); +} template <typename F> auto VisitDescriptorsInFileOrder(const Descriptor* desc, @@ -3018,6 +3137,14 @@ auto VisitDescriptorsInFileOrder(const FileDescriptor* file, } #endif // !SWIG +// Whether the given string field should have the accessors be privatized due +// to it being an unsupported type. If this returns true, cpp_string_type() +// returns kString for the storage, the C++ Generator will not generate +// public accessors for the type, but the field will sill be accessible via +// reflection. +PROTOBUF_EXPORT bool IsStringFieldWithPrivatizedAccessors( + const FieldDescriptor& field); + } // namespace cpp } // namespace internal diff --git a/third_party/protobuf/src/google/protobuf/descriptor.pb.cc b/third_party/protobuf/src/google/protobuf/descriptor.pb.cc index 7fb5d83b7df50..0c82234ae9537 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.pb.cc +++ b/third_party/protobuf/src/google/protobuf/descriptor.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/descriptor.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/descriptor.pb.h" @@ -38,7 +38,7 @@ inline constexpr UninterpretedOption_NamePart::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR UninterpretedOption_NamePart::UninterpretedOption_NamePart(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(UninterpretedOption_NamePart_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -78,7 +78,7 @@ inline constexpr SourceCodeInfo_Location::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR SourceCodeInfo_Location::SourceCodeInfo_Location(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(SourceCodeInfo_Location_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -115,7 +115,7 @@ inline constexpr GeneratedCodeInfo_Annotation::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(GeneratedCodeInfo_Annotation_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -150,7 +150,7 @@ inline constexpr FieldOptions_FeatureSupport::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FieldOptions_FeatureSupport::FieldOptions_FeatureSupport(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FieldOptions_FeatureSupport_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -183,7 +183,7 @@ inline constexpr FieldOptions_EditionDefault::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FieldOptions_EditionDefault::FieldOptions_EditionDefault(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FieldOptions_EditionDefault_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -213,12 +213,13 @@ inline constexpr FeatureSet::Impl_::Impl_( repeated_field_encoding_{static_cast< ::google::protobuf::FeatureSet_RepeatedFieldEncoding >(0)}, utf8_validation_{static_cast< ::google::protobuf::FeatureSet_Utf8Validation >(0)}, message_encoding_{static_cast< ::google::protobuf::FeatureSet_MessageEncoding >(0)}, - json_format_{static_cast< ::google::protobuf::FeatureSet_JsonFormat >(0)} {} + json_format_{static_cast< ::google::protobuf::FeatureSet_JsonFormat >(0)}, + enforce_naming_style_{static_cast< ::google::protobuf::FeatureSet_EnforceNamingStyle >(0)} {} template <typename> PROTOBUF_CONSTEXPR FeatureSet::FeatureSet(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FeatureSet_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -256,7 +257,7 @@ inline constexpr ExtensionRangeOptions_Declaration::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR ExtensionRangeOptions_Declaration::ExtensionRangeOptions_Declaration(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(ExtensionRangeOptions_Declaration_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -287,7 +288,7 @@ inline constexpr EnumDescriptorProto_EnumReservedRange::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(EnumDescriptorProto_EnumReservedRange_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -318,7 +319,7 @@ inline constexpr DescriptorProto_ReservedRange::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(DescriptorProto_ReservedRange_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -360,7 +361,7 @@ inline constexpr UninterpretedOption::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR UninterpretedOption::UninterpretedOption(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(UninterpretedOption_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -390,7 +391,7 @@ inline constexpr SourceCodeInfo::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR SourceCodeInfo::SourceCodeInfo(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(SourceCodeInfo_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -420,7 +421,7 @@ inline constexpr GeneratedCodeInfo::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR GeneratedCodeInfo::GeneratedCodeInfo(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(GeneratedCodeInfo_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -452,7 +453,7 @@ inline constexpr FeatureSetDefaults_FeatureSetEditionDefault::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaults_FeatureSetEditionDefault(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FeatureSetDefaults_FeatureSetEditionDefault_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -484,7 +485,7 @@ inline constexpr ServiceOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR ServiceOptions::ServiceOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(ServiceOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -515,7 +516,7 @@ inline constexpr OneofOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR OneofOptions::OneofOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(OneofOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -548,7 +549,7 @@ inline constexpr MethodOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR MethodOptions::MethodOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(MethodOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -584,7 +585,7 @@ inline constexpr MessageOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR MessageOptions::MessageOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(MessageOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -654,7 +655,7 @@ inline constexpr FileOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FileOptions::FileOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FileOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -697,7 +698,7 @@ inline constexpr FieldOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FieldOptions::FieldOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FieldOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -729,7 +730,7 @@ inline constexpr FeatureSetDefaults::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FeatureSetDefaults::FeatureSetDefaults(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FeatureSetDefaults_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -762,7 +763,7 @@ inline constexpr ExtensionRangeOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR ExtensionRangeOptions::ExtensionRangeOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(ExtensionRangeOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -796,7 +797,7 @@ inline constexpr EnumValueOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR EnumValueOptions::EnumValueOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(EnumValueOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -830,7 +831,7 @@ inline constexpr EnumOptions::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR EnumOptions::EnumOptions(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(EnumOptions_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -863,7 +864,7 @@ inline constexpr OneofDescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR OneofDescriptorProto::OneofDescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(OneofDescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -904,7 +905,7 @@ inline constexpr MethodDescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR MethodDescriptorProto::MethodDescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(MethodDescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -954,7 +955,7 @@ inline constexpr FieldDescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FieldDescriptorProto::FieldDescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FieldDescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -988,7 +989,7 @@ inline constexpr EnumValueDescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR EnumValueDescriptorProto::EnumValueDescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(EnumValueDescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -1020,7 +1021,7 @@ inline constexpr DescriptorProto_ExtensionRange::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(DescriptorProto_ExtensionRange_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -1054,7 +1055,7 @@ inline constexpr ServiceDescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR ServiceDescriptorProto::ServiceDescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(ServiceDescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -1090,7 +1091,7 @@ inline constexpr EnumDescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR EnumDescriptorProto::EnumDescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(EnumDescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -1131,7 +1132,7 @@ inline constexpr DescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR DescriptorProto::DescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(DescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -1179,7 +1180,7 @@ inline constexpr FileDescriptorProto::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FileDescriptorProto::FileDescriptorProto(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FileDescriptorProto_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -1209,7 +1210,7 @@ inline constexpr FileDescriptorSet::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FileDescriptorSet::FileDescriptorSet(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FileDescriptorSet_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -1232,8 +1233,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FileDescriptorSetDefaultTypeInternal _FileDescriptorSet_default_instance_; } // namespace protobuf } // namespace google -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[17]; -static constexpr const ::_pb::ServiceDescriptor** +static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL + file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[18]; +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fdescriptor_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -1751,12 +1753,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.utf8_validation_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.message_encoding_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.json_format_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.enforce_naming_style_), 0, 1, 2, 3, 4, 5, + 6, PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _internal_metadata_), ~0u, // no _extensions_ @@ -1869,15 +1873,15 @@ static const ::_pbi::MigrationSchema {449, 461, -1, sizeof(::google::protobuf::MethodOptions)}, {465, 475, -1, sizeof(::google::protobuf::UninterpretedOption_NamePart)}, {477, 492, -1, sizeof(::google::protobuf::UninterpretedOption)}, - {499, 513, -1, sizeof(::google::protobuf::FeatureSet)}, - {519, 530, -1, sizeof(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault)}, - {533, 544, -1, sizeof(::google::protobuf::FeatureSetDefaults)}, - {547, 560, -1, sizeof(::google::protobuf::SourceCodeInfo_Location)}, - {565, -1, -1, sizeof(::google::protobuf::SourceCodeInfo)}, - {574, 587, -1, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, - {592, -1, -1, sizeof(::google::protobuf::GeneratedCodeInfo)}, + {499, 514, -1, sizeof(::google::protobuf::FeatureSet)}, + {521, 532, -1, sizeof(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault)}, + {535, 546, -1, sizeof(::google::protobuf::FeatureSetDefaults)}, + {549, 562, -1, sizeof(::google::protobuf::SourceCodeInfo_Location)}, + {567, -1, -1, sizeof(::google::protobuf::SourceCodeInfo)}, + {576, 589, -1, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, + {594, -1, -1, sizeof(::google::protobuf::GeneratedCodeInfo)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_FileDescriptorSet_default_instance_._instance, &::google::protobuf::_FileDescriptorProto_default_instance_._instance, &::google::protobuf::_DescriptorProto_ExtensionRange_default_instance_._instance, @@ -2102,7 +2106,7 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] AB "\030\005 \001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_v" "alue\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010N" "amePart\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extensi" - "on\030\002 \002(\010\"\311\t\n\nFeatureSet\022\202\001\n\016field_presen" + "on\030\002 \002(\010\"\274\013\n\nFeatureSet\022\202\001\n\016field_presen" "ce\030\001 \001(\0162).google.protobuf.FeatureSet.Fi" "eldPresenceB\?\210\001\001\230\001\004\230\001\001\242\001\r\022\010EXPLICIT\030\204\007\242\001" "\r\022\010IMPLICIT\030\347\007\242\001\r\022\010EXPLICIT\030\350\007\262\001\003\010\350\007\022b\n\t" @@ -2120,59 +2124,65 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] AB "ED\030\204\007\262\001\003\010\350\007\022v\n\013json_format\030\006 \001(\0162&.googl" "e.protobuf.FeatureSet.JsonFormatB9\210\001\001\230\001\003" "\230\001\006\230\001\001\242\001\027\022\022LEGACY_BEST_EFFORT\030\204\007\242\001\n\022\005ALL" - "OW\030\347\007\262\001\003\010\350\007\"\\\n\rFieldPresence\022\032\n\026FIELD_PR" - "ESENCE_UNKNOWN\020\000\022\014\n\010EXPLICIT\020\001\022\014\n\010IMPLIC" - "IT\020\002\022\023\n\017LEGACY_REQUIRED\020\003\"7\n\010EnumType\022\025\n" - "\021ENUM_TYPE_UNKNOWN\020\000\022\010\n\004OPEN\020\001\022\n\n\006CLOSED" - "\020\002\"V\n\025RepeatedFieldEncoding\022#\n\037REPEATED_" - "FIELD_ENCODING_UNKNOWN\020\000\022\n\n\006PACKED\020\001\022\014\n\010" - "EXPANDED\020\002\"I\n\016Utf8Validation\022\033\n\027UTF8_VAL" - "IDATION_UNKNOWN\020\000\022\n\n\006VERIFY\020\002\022\010\n\004NONE\020\003\"" - "\004\010\001\020\001\"S\n\017MessageEncoding\022\034\n\030MESSAGE_ENCO" - "DING_UNKNOWN\020\000\022\023\n\017LENGTH_PREFIXED\020\001\022\r\n\tD" - "ELIMITED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_FORMAT_" - "UNKNOWN\020\000\022\t\n\005ALLOW\020\001\022\026\n\022LEGACY_BEST_EFFO" - "RT\020\002*\006\010\350\007\020\213N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007\020\350\007\"\230\003\n" - "\022FeatureSetDefaults\022N\n\010defaults\030\001 \003(\0132<." - "google.protobuf.FeatureSetDefaults.Featu" - "reSetEditionDefault\0221\n\017minimum_edition\030\004" - " \001(\0162\030.google.protobuf.Edition\0221\n\017maximu" - "m_edition\030\005 \001(\0162\030.google.protobuf.Editio" - "n\032\313\001\n\030FeatureSetEditionDefault\022)\n\007editio" - "n\030\003 \001(\0162\030.google.protobuf.Edition\0229\n\024ove" - "rridable_features\030\004 \001(\0132\033.google.protobu" - "f.FeatureSet\0223\n\016fixed_features\030\005 \001(\0132\033.g" - "oogle.protobuf.FeatureSetJ\004\010\001\020\002J\004\010\002\020\003R\010f" - "eatures\"\343\001\n\016SourceCodeInfo\022:\n\010location\030\001" - " \003(\0132(.google.protobuf.SourceCodeInfo.Lo" - "cation\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n" - "\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(" - "\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_" - "detached_comments\030\006 \003(\t*\014\010\200\354\312\377\001\020\201\354\312\377\001\"\234\002" - "\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(\0132" - "-.google.protobuf.GeneratedCodeInfo.Anno" - "tation\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022" - "\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003e" - "nd\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626.google.prot" - "obuf.GeneratedCodeInfo.Annotation.Semant" - "ic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALI" - "AS\020\002*\247\002\n\007Edition\022\023\n\017EDITION_UNKNOWN\020\000\022\023\n" - "\016EDITION_LEGACY\020\204\007\022\023\n\016EDITION_PROTO2\020\346\007\022" - "\023\n\016EDITION_PROTO3\020\347\007\022\021\n\014EDITION_2023\020\350\007\022" - "\021\n\014EDITION_2024\020\351\007\022\027\n\023EDITION_1_TEST_ONL" - "Y\020\001\022\027\n\023EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITION_" - "99997_TEST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_TES" - "T_ONLY\020\236\215\006\022\035\n\027EDITION_99999_TEST_ONLY\020\237\215" - "\006\022\023\n\013EDITION_MAX\020\377\377\377\377\007B~\n\023com.google.pro" - "tobufB\020DescriptorProtosH\001Z-google.golang" - ".org/protobuf/types/descriptorpb\370\001\001\242\002\003GP" - "B\252\002\032Google.Protobuf.Reflection" + "OW\030\347\007\262\001\003\010\350\007\022\227\001\n\024enforce_naming_style\030\007 \001" + "(\0162..google.protobuf.FeatureSet.EnforceN" + "amingStyleBI\210\001\002\230\001\001\230\001\002\230\001\003\230\001\004\230\001\005\230\001\006\230\001\007\230\001\010\230" + "\001\t\242\001\021\022\014STYLE_LEGACY\030\204\007\242\001\016\022\tSTYLE2024\030\351\007\262" + "\001\003\010\351\007\"\\\n\rFieldPresence\022\032\n\026FIELD_PRESENCE" + "_UNKNOWN\020\000\022\014\n\010EXPLICIT\020\001\022\014\n\010IMPLICIT\020\002\022\023" + "\n\017LEGACY_REQUIRED\020\003\"7\n\010EnumType\022\025\n\021ENUM_" + "TYPE_UNKNOWN\020\000\022\010\n\004OPEN\020\001\022\n\n\006CLOSED\020\002\"V\n\025" + "RepeatedFieldEncoding\022#\n\037REPEATED_FIELD_" + "ENCODING_UNKNOWN\020\000\022\n\n\006PACKED\020\001\022\014\n\010EXPAND" + "ED\020\002\"I\n\016Utf8Validation\022\033\n\027UTF8_VALIDATIO" + "N_UNKNOWN\020\000\022\n\n\006VERIFY\020\002\022\010\n\004NONE\020\003\"\004\010\001\020\001\"" + "S\n\017MessageEncoding\022\034\n\030MESSAGE_ENCODING_U" + "NKNOWN\020\000\022\023\n\017LENGTH_PREFIXED\020\001\022\r\n\tDELIMIT" + "ED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_FORMAT_UNKNOW" + "N\020\000\022\t\n\005ALLOW\020\001\022\026\n\022LEGACY_BEST_EFFORT\020\002\"W" + "\n\022EnforceNamingStyle\022 \n\034ENFORCE_NAMING_S" + "TYLE_UNKNOWN\020\000\022\r\n\tSTYLE2024\020\001\022\020\n\014STYLE_L" + "EGACY\020\002*\006\010\350\007\020\213N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007\020\350\007\"" + "\230\003\n\022FeatureSetDefaults\022N\n\010defaults\030\001 \003(\013" + "2<.google.protobuf.FeatureSetDefaults.Fe" + "atureSetEditionDefault\0221\n\017minimum_editio" + "n\030\004 \001(\0162\030.google.protobuf.Edition\0221\n\017max" + "imum_edition\030\005 \001(\0162\030.google.protobuf.Edi" + "tion\032\313\001\n\030FeatureSetEditionDefault\022)\n\007edi" + "tion\030\003 \001(\0162\030.google.protobuf.Edition\0229\n\024" + "overridable_features\030\004 \001(\0132\033.google.prot" + "obuf.FeatureSet\0223\n\016fixed_features\030\005 \001(\0132" + "\033.google.protobuf.FeatureSetJ\004\010\001\020\002J\004\010\002\020\003" + "R\010features\"\343\001\n\016SourceCodeInfo\022:\n\010locatio" + "n\030\001 \003(\0132(.google.protobuf.SourceCodeInfo" + ".Location\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001" + "\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003" + " \001(\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leadi" + "ng_detached_comments\030\006 \003(\t*\014\010\200\354\312\377\001\020\201\354\312\377\001" + "\"\234\002\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003" + "(\0132-.google.protobuf.GeneratedCodeInfo.A" + "nnotation\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002" + "\020\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013" + "\n\003end\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626.google.p" + "rotobuf.GeneratedCodeInfo.Annotation.Sem" + "antic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005" + "ALIAS\020\002*\247\002\n\007Edition\022\023\n\017EDITION_UNKNOWN\020\000" + "\022\023\n\016EDITION_LEGACY\020\204\007\022\023\n\016EDITION_PROTO2\020" + "\346\007\022\023\n\016EDITION_PROTO3\020\347\007\022\021\n\014EDITION_2023\020" + "\350\007\022\021\n\014EDITION_2024\020\351\007\022\027\n\023EDITION_1_TEST_" + "ONLY\020\001\022\027\n\023EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITI" + "ON_99997_TEST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_" + "TEST_ONLY\020\236\215\006\022\035\n\027EDITION_99999_TEST_ONLY" + "\020\237\215\006\022\023\n\013EDITION_MAX\020\377\377\377\377\007B~\n\023com.google." + "protobufB\020DescriptorProtosH\001Z-google.gol" + "ang.org/protobuf/types/descriptorpb\370\001\001\242\002" + "\003GPB\252\002\032Google.Protobuf.Reflection" }; static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once; PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = { false, false, - 10110, + 10353, descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto, "google/protobuf/descriptor.proto", &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once, @@ -2233,400 +2243,142 @@ static std::true_type dynamic_init_dummy_google_2fprotobuf_2fdescriptor_2eproto{ } // namespace google namespace google { namespace protobuf { -const ::google::protobuf::EnumDescriptor* ExtensionRangeOptions_VerificationState_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL ExtensionRangeOptions_VerificationState_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[0]; } PROTOBUF_CONSTINIT const uint32_t ExtensionRangeOptions_VerificationState_internal_data_[] = { 131072u, 0u, }; -bool ExtensionRangeOptions_VerificationState_IsValid(int value) { - return 0 <= value && value <= 1; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions::DECLARATION; -constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions::UNVERIFIED; -constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions::VerificationState_MIN; -constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions::VerificationState_MAX; -constexpr int ExtensionRangeOptions::VerificationState_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Type_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldDescriptorProto_Type_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[1]; } PROTOBUF_CONSTINIT const uint32_t FieldDescriptorProto_Type_internal_data_[] = { 1179649u, 0u, }; -bool FieldDescriptorProto_Type_IsValid(int value) { - return 1 <= value && value <= 18; -} -#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; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_UINT64; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_INT32; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FIXED64; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FIXED32; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_BOOL; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_STRING; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_GROUP; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_MESSAGE; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_BYTES; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_UINT32; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_ENUM; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SFIXED32; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SFIXED64; -constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SINT32; -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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FieldDescriptorProto_Label_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldDescriptorProto_Label_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[2]; } PROTOBUF_CONSTINIT const uint32_t FieldDescriptorProto_Label_internal_data_[] = { 196609u, 0u, }; -bool FieldDescriptorProto_Label_IsValid(int value) { - return 1 <= value && value <= 3; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_OPTIONAL; -constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REPEATED; -constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REQUIRED; -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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FileOptions_OptimizeMode_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FileOptions_OptimizeMode_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[3]; } PROTOBUF_CONSTINIT const uint32_t FileOptions_OptimizeMode_internal_data_[] = { 196609u, 0u, }; -bool FileOptions_OptimizeMode_IsValid(int value) { - return 1 <= value && value <= 3; -} -#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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FieldOptions_CType_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_CType_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[4]; } PROTOBUF_CONSTINIT const uint32_t FieldOptions_CType_internal_data_[] = { 196608u, 0u, }; -bool FieldOptions_CType_IsValid(int value) { - return 0 <= value && value <= 2; -} -#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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FieldOptions_JSType_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_JSType_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[5]; } PROTOBUF_CONSTINIT const uint32_t FieldOptions_JSType_internal_data_[] = { 196608u, 0u, }; -bool FieldOptions_JSType_IsValid(int value) { - return 0 <= value && value <= 2; -} -#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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FieldOptions_OptionRetention_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_OptionRetention_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[6]; } PROTOBUF_CONSTINIT const uint32_t FieldOptions_OptionRetention_internal_data_[] = { 196608u, 0u, }; -bool FieldOptions_OptionRetention_IsValid(int value) { - return 0 <= value && value <= 2; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FieldOptions_OptionRetention FieldOptions::RETENTION_UNKNOWN; -constexpr FieldOptions_OptionRetention FieldOptions::RETENTION_RUNTIME; -constexpr FieldOptions_OptionRetention FieldOptions::RETENTION_SOURCE; -constexpr FieldOptions_OptionRetention FieldOptions::OptionRetention_MIN; -constexpr FieldOptions_OptionRetention FieldOptions::OptionRetention_MAX; -constexpr int FieldOptions::OptionRetention_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FieldOptions_OptionTargetType_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_OptionTargetType_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[7]; } PROTOBUF_CONSTINIT const uint32_t FieldOptions_OptionTargetType_internal_data_[] = { 655360u, 0u, }; -bool FieldOptions_OptionTargetType_IsValid(int value) { - return 0 <= value && value <= 9; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_UNKNOWN; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_FILE; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_EXTENSION_RANGE; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_MESSAGE; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_FIELD; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_ONEOF; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_ENUM; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_ENUM_ENTRY; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_SERVICE; -constexpr FieldOptions_OptionTargetType FieldOptions::TARGET_TYPE_METHOD; -constexpr FieldOptions_OptionTargetType FieldOptions::OptionTargetType_MIN; -constexpr FieldOptions_OptionTargetType FieldOptions::OptionTargetType_MAX; -constexpr int FieldOptions::OptionTargetType_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* MethodOptions_IdempotencyLevel_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL MethodOptions_IdempotencyLevel_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[8]; } PROTOBUF_CONSTINIT const uint32_t MethodOptions_IdempotencyLevel_internal_data_[] = { 196608u, 0u, }; -bool MethodOptions_IdempotencyLevel_IsValid(int value) { - return 0 <= value && value <= 2; -} -#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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FeatureSet_FieldPresence_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_FieldPresence_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[9]; } PROTOBUF_CONSTINIT const uint32_t FeatureSet_FieldPresence_internal_data_[] = { 262144u, 0u, }; -bool FeatureSet_FieldPresence_IsValid(int value) { - return 0 <= value && value <= 3; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FeatureSet_FieldPresence FeatureSet::FIELD_PRESENCE_UNKNOWN; -constexpr FeatureSet_FieldPresence FeatureSet::EXPLICIT; -constexpr FeatureSet_FieldPresence FeatureSet::IMPLICIT; -constexpr FeatureSet_FieldPresence FeatureSet::LEGACY_REQUIRED; -constexpr FeatureSet_FieldPresence FeatureSet::FieldPresence_MIN; -constexpr FeatureSet_FieldPresence FeatureSet::FieldPresence_MAX; -constexpr int FeatureSet::FieldPresence_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FeatureSet_EnumType_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_EnumType_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[10]; } PROTOBUF_CONSTINIT const uint32_t FeatureSet_EnumType_internal_data_[] = { 196608u, 0u, }; -bool FeatureSet_EnumType_IsValid(int value) { - return 0 <= value && value <= 2; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FeatureSet_EnumType FeatureSet::ENUM_TYPE_UNKNOWN; -constexpr FeatureSet_EnumType FeatureSet::OPEN; -constexpr FeatureSet_EnumType FeatureSet::CLOSED; -constexpr FeatureSet_EnumType FeatureSet::EnumType_MIN; -constexpr FeatureSet_EnumType FeatureSet::EnumType_MAX; -constexpr int FeatureSet::EnumType_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FeatureSet_RepeatedFieldEncoding_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_RepeatedFieldEncoding_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[11]; } PROTOBUF_CONSTINIT const uint32_t FeatureSet_RepeatedFieldEncoding_internal_data_[] = { 196608u, 0u, }; -bool FeatureSet_RepeatedFieldEncoding_IsValid(int value) { - return 0 <= value && value <= 2; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FeatureSet_RepeatedFieldEncoding FeatureSet::REPEATED_FIELD_ENCODING_UNKNOWN; -constexpr FeatureSet_RepeatedFieldEncoding FeatureSet::PACKED; -constexpr FeatureSet_RepeatedFieldEncoding FeatureSet::EXPANDED; -constexpr FeatureSet_RepeatedFieldEncoding FeatureSet::RepeatedFieldEncoding_MIN; -constexpr FeatureSet_RepeatedFieldEncoding FeatureSet::RepeatedFieldEncoding_MAX; -constexpr int FeatureSet::RepeatedFieldEncoding_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FeatureSet_Utf8Validation_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_Utf8Validation_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[12]; } PROTOBUF_CONSTINIT const uint32_t FeatureSet_Utf8Validation_internal_data_[] = { 65536u, 32u, 6u, }; -bool FeatureSet_Utf8Validation_IsValid(int value) { - return 0 <= value && value <= 3 && ((13u >> value) & 1) != 0; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FeatureSet_Utf8Validation FeatureSet::UTF8_VALIDATION_UNKNOWN; -constexpr FeatureSet_Utf8Validation FeatureSet::VERIFY; -constexpr FeatureSet_Utf8Validation FeatureSet::NONE; -constexpr FeatureSet_Utf8Validation FeatureSet::Utf8Validation_MIN; -constexpr FeatureSet_Utf8Validation FeatureSet::Utf8Validation_MAX; -constexpr int FeatureSet::Utf8Validation_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FeatureSet_MessageEncoding_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_MessageEncoding_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[13]; } PROTOBUF_CONSTINIT const uint32_t FeatureSet_MessageEncoding_internal_data_[] = { 196608u, 0u, }; -bool FeatureSet_MessageEncoding_IsValid(int value) { - return 0 <= value && value <= 2; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FeatureSet_MessageEncoding FeatureSet::MESSAGE_ENCODING_UNKNOWN; -constexpr FeatureSet_MessageEncoding FeatureSet::LENGTH_PREFIXED; -constexpr FeatureSet_MessageEncoding FeatureSet::DELIMITED; -constexpr FeatureSet_MessageEncoding FeatureSet::MessageEncoding_MIN; -constexpr FeatureSet_MessageEncoding FeatureSet::MessageEncoding_MAX; -constexpr int FeatureSet::MessageEncoding_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* FeatureSet_JsonFormat_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_JsonFormat_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[14]; } PROTOBUF_CONSTINIT const uint32_t FeatureSet_JsonFormat_internal_data_[] = { 196608u, 0u, }; -bool FeatureSet_JsonFormat_IsValid(int value) { - return 0 <= value && value <= 2; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr FeatureSet_JsonFormat FeatureSet::JSON_FORMAT_UNKNOWN; -constexpr FeatureSet_JsonFormat FeatureSet::ALLOW; -constexpr FeatureSet_JsonFormat FeatureSet::LEGACY_BEST_EFFORT; -constexpr FeatureSet_JsonFormat FeatureSet::JsonFormat_MIN; -constexpr FeatureSet_JsonFormat FeatureSet::JsonFormat_MAX; -constexpr int FeatureSet::JsonFormat_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* GeneratedCodeInfo_Annotation_Semantic_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_EnforceNamingStyle_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[15]; } -PROTOBUF_CONSTINIT const uint32_t GeneratedCodeInfo_Annotation_Semantic_internal_data_[] = { +PROTOBUF_CONSTINIT const uint32_t FeatureSet_EnforceNamingStyle_internal_data_[] = { 196608u, 0u, }; -bool GeneratedCodeInfo_Annotation_Semantic_IsValid(int value) { - return 0 <= value && value <= 2; -} -#if (__cplusplus < 201703) && \ - (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) - -constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation::NONE; -constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation::SET; -constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation::ALIAS; -constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation::Semantic_MIN; -constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation::Semantic_MAX; -constexpr int GeneratedCodeInfo_Annotation::Semantic_ARRAYSIZE; - -#endif // (__cplusplus < 201703) && - // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* Edition_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation_Semantic_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[16]; } +PROTOBUF_CONSTINIT const uint32_t GeneratedCodeInfo_Annotation_Semantic_internal_data_[] = { + 196608u, 0u, }; +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Edition_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); + return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[17]; +} PROTOBUF_CONSTINIT const uint32_t Edition_internal_data_[] = { 196608u, 589824u, 99997u, 1000u, 99999u, 998u, 1001u, 99998u, 2147483647u, 900u, 999u, }; -bool Edition_IsValid(int value) { - return ::_pbi::ValidateEnum(value, Edition_internal_data_); -} // =================================================================== class FileDescriptorSet::_Internal { public: }; -FileDescriptorSet::FileDescriptorSet(::google::protobuf::Arena* arena) +FileDescriptorSet::FileDescriptorSet(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FileDescriptorSet_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FileDescriptorSet) } -inline PROTOBUF_NDEBUG_INLINE FileDescriptorSet::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FileDescriptorSet& from_msg) +PROTOBUF_NDEBUG_INLINE FileDescriptorSet::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FileDescriptorSet& from_msg) : _extensions_{visibility, arena}, file_{visibility, arena, from.file_}, _cached_size_{0} {} FileDescriptorSet::FileDescriptorSet( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FileDescriptorSet& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FileDescriptorSet_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -2639,14 +2391,14 @@ FileDescriptorSet::FileDescriptorSet( // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorSet) } -inline PROTOBUF_NDEBUG_INLINE FileDescriptorSet::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FileDescriptorSet::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, file_{visibility, arena}, _cached_size_{0} {} -inline void FileDescriptorSet::SharedCtor(::_pb::Arena* arena) { +inline void FileDescriptorSet::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } FileDescriptorSet::~FileDescriptorSet() { @@ -2660,8 +2412,9 @@ inline void FileDescriptorSet::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FileDescriptorSet::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FileDescriptorSet::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FileDescriptorSet(arena); } constexpr auto FileDescriptorSet::InternalNewImpl_() { @@ -2683,34 +2436,41 @@ constexpr auto FileDescriptorSet::InternalNewImpl_() { alignof(FileDescriptorSet)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FileDescriptorSet::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FileDescriptorSet_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FileDescriptorSet::IsInitializedImpl, - &FileDescriptorSet::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FileDescriptorSet>(), +constexpr auto FileDescriptorSet::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FileDescriptorSet_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FileDescriptorSet::IsInitializedImpl, + &FileDescriptorSet::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FileDescriptorSet>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FileDescriptorSet::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FileDescriptorSet>(), &FileDescriptorSet::ByteSizeLong, - &FileDescriptorSet::_InternalSerialize, + &FileDescriptorSet::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FileDescriptorSet>(), &FileDescriptorSet::ByteSizeLong, + &FileDescriptorSet::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FileDescriptorSet, _impl_._cached_size_), - false, - }, - &FileDescriptorSet::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FileDescriptorSet::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FileDescriptorSet, _impl_._cached_size_), + false, + }, + &FileDescriptorSet::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> FileDescriptorSet::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FileDescriptorSet_class_data_ = + FileDescriptorSet::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FileDescriptorSet::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FileDescriptorSet_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FileDescriptorSet_class_data_.tc_table); + return FileDescriptorSet_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> +FileDescriptorSet::_table_ = { { 0, // no _has_bits_ PROTOBUF_FIELD_OFFSET(FileDescriptorSet, _impl_._extensions_), @@ -2721,7 +2481,7 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> FileDescriptorSet::_table_ = { 1, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FileDescriptorSet_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -2737,12 +2497,13 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> FileDescriptorSet::_table_ = { // repeated .google.protobuf.FileDescriptorProto file = 1; {PROTOBUF_FIELD_OFFSET(FileDescriptorSet, _impl_.file_), 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorProto>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorProto>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void FileDescriptorSet::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2756,71 +2517,71 @@ PROTOBUF_NOINLINE void FileDescriptorSet::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FileDescriptorSet::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FileDescriptorSet& this_ = static_cast<const FileDescriptorSet&>(base); +::uint8_t* PROTOBUF_NONNULL FileDescriptorSet::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FileDescriptorSet& this_ = static_cast<const FileDescriptorSet&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FileDescriptorSet::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FileDescriptorSet& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FileDescriptorSet::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FileDescriptorSet& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorSet) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorSet) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated .google.protobuf.FileDescriptorProto file = 1; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_file_size()); - i < n; i++) { - const auto& repfield = this_._internal_file().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FileDescriptorProto file = 1; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_file_size()); + i < n; i++) { + const auto& repfield = this_._internal_file().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [536000000, 536000001) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 536000000, 536000001, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileDescriptorSet) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileDescriptorSet) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FileDescriptorSet::ByteSizeLong(const MessageLite& base) { - const FileDescriptorSet& this_ = static_cast<const FileDescriptorSet&>(base); +::size_t FileDescriptorSet::ByteSizeLong(const MessageLite& base) { + const FileDescriptorSet& this_ = static_cast<const FileDescriptorSet&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FileDescriptorSet::ByteSizeLong() const { - const FileDescriptorSet& this_ = *this; +::size_t FileDescriptorSet::ByteSizeLong() const { + const FileDescriptorSet& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorSet) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorSet) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.FileDescriptorProto file = 1; - { - total_size += 1UL * this_._internal_file_size(); - for (const auto& msg : this_._internal_file()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.FileDescriptorProto file = 1; + { + total_size += 1UL * this_._internal_file_size(); + for (const auto& msg : this_._internal_file()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FileDescriptorSet::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FileDescriptorSet*>(&to_msg); @@ -2832,7 +2593,7 @@ void FileDescriptorSet::MergeImpl(::google::protobuf::MessageLite& to_msg, const _this->_internal_mutable_file()->MergeFrom( from._internal_file()); - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -2846,8 +2607,7 @@ void FileDescriptorSet::CopyFrom(const FileDescriptorSet& from) { PROTOBUF_NOINLINE bool FileDescriptorSet::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const FileDescriptorSet&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_file())) @@ -2855,7 +2615,7 @@ PROTOBUF_NOINLINE bool FileDescriptorSet::IsInitializedImpl( return true; } -void FileDescriptorSet::InternalSwap(FileDescriptorSet* PROTOBUF_RESTRICT other) { +void FileDescriptorSet::InternalSwap(FileDescriptorSet* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -2875,18 +2635,19 @@ class FileDescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_._has_bits_); }; -FileDescriptorProto::FileDescriptorProto(::google::protobuf::Arena* arena) +FileDescriptorProto::FileDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FileDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FileDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FileDescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FileDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, dependency_{visibility, arena, from.dependency_}, @@ -2901,10 +2662,10 @@ inline PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( syntax_(arena, from.syntax_) {} FileDescriptorProto::FileDescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FileDescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FileDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -2914,19 +2675,19 @@ FileDescriptorProto::FileDescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000008u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FileOptions>( - arena, *from._impl_.options_) - : nullptr; - _impl_.source_code_info_ = (cached_has_bits & 0x00000010u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceCodeInfo>( - arena, *from._impl_.source_code_info_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000008u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; + _impl_.source_code_info_ = ((cached_has_bits & 0x00000010u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_code_info_) + : nullptr; _impl_.edition_ = from._impl_.edition_; // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, dependency_{visibility, arena}, message_type_{visibility, arena}, @@ -2939,7 +2700,7 @@ inline PROTOBUF_NDEBUG_INLINE FileDescriptorProto::Impl_::Impl_( package_(arena), syntax_(arena) {} -inline void FileDescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void FileDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, options_), @@ -2964,8 +2725,9 @@ inline void FileDescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FileDescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FileDescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FileDescriptorProto(arena); } constexpr auto FileDescriptorProto::InternalNewImpl_() { @@ -3008,34 +2770,41 @@ constexpr auto FileDescriptorProto::InternalNewImpl_() { alignof(FileDescriptorProto)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FileDescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FileDescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FileDescriptorProto::IsInitializedImpl, - &FileDescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FileDescriptorProto>(), +constexpr auto FileDescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FileDescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FileDescriptorProto::IsInitializedImpl, + &FileDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FileDescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FileDescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FileDescriptorProto>(), &FileDescriptorProto::ByteSizeLong, - &FileDescriptorProto::_InternalSerialize, + &FileDescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FileDescriptorProto>(), &FileDescriptorProto::ByteSizeLong, + &FileDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_._cached_size_), - false, - }, - &FileDescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FileDescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_._cached_size_), + false, + }, + &FileDescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<4, 13, 7, 79, 2> FileDescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FileDescriptorProto_class_data_ = + FileDescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FileDescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FileDescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FileDescriptorProto_class_data_.tc_table); + return FileDescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<4, 13, 7, 79, 2> +FileDescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -3046,7 +2815,7 @@ constexpr ::_pbi::TcParseTable<4, 13, 7, 79, 2> FileDescriptorProto::_table_ = { 13, // num_field_entries 7, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FileDescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -3137,15 +2906,17 @@ constexpr ::_pbi::TcParseTable<4, 13, 7, 79, 2> FileDescriptorProto::_table_ = { // optional .google.protobuf.Edition edition = 14; {PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.edition_), _Internal::kHasBitsOffset + 5, 6, (0 | ::_fl::kFcOptional | ::_fl::kEnum)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::ServiceDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FieldDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FileOptions>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::SourceCodeInfo>()}, - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::ServiceDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FieldDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FileOptions>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::SourceCodeInfo>()}, + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + }}, + {{ "\43\4\7\12\0\0\0\0\0\0\0\0\6\0\0\0" "google.protobuf.FileDescriptorProto" "name" @@ -3154,7 +2925,6 @@ constexpr ::_pbi::TcParseTable<4, 13, 7, 79, 2> FileDescriptorProto::_table_ = { "syntax" }}, }; - PROTOBUF_NOINLINE void FileDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -3170,21 +2940,21 @@ PROTOBUF_NOINLINE void FileDescriptorProto::Clear() { _impl_.public_dependency_.Clear(); _impl_.weak_dependency_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000001fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000001fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.package_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _impl_.syntax_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { ABSL_DCHECK(_impl_.source_code_info_ != nullptr); _impl_.source_code_info_->Clear(); } @@ -3195,247 +2965,247 @@ PROTOBUF_NOINLINE void FileDescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FileDescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FileDescriptorProto& this_ = static_cast<const FileDescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL FileDescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FileDescriptorProto& this_ = static_cast<const FileDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FileDescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FileDescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FileDescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FileDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileDescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileDescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional string package = 2; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_package(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileDescriptorProto.package"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + // optional string package = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_package(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileDescriptorProto.package"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // repeated string dependency = 3; - for (int i = 0, n = this_._internal_dependency_size(); i < n; ++i) { - const auto& s = this_._internal_dependency().Get(i); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileDescriptorProto.dependency"); - target = stream->WriteString(3, s, target); - } + // repeated string dependency = 3; + for (int i = 0, n = this_._internal_dependency_size(); i < n; ++i) { + const auto& s = this_._internal_dependency().Get(i); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileDescriptorProto.dependency"); + target = stream->WriteString(3, s, target); + } - // repeated .google.protobuf.DescriptorProto message_type = 4; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_message_type_size()); - i < n; i++) { - const auto& repfield = this_._internal_message_type().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.DescriptorProto message_type = 4; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_message_type_size()); + i < n; i++) { + const auto& repfield = this_._internal_message_type().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_enum_type_size()); - i < n; i++) { - const auto& repfield = this_._internal_enum_type().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_enum_type_size()); + i < n; i++) { + const auto& repfield = this_._internal_enum_type().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 5, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.ServiceDescriptorProto service = 6; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_service_size()); - i < n; i++) { - const auto& repfield = this_._internal_service().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.ServiceDescriptorProto service = 6; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_service_size()); + i < n; i++) { + const auto& repfield = this_._internal_service().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 6, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.FieldDescriptorProto extension = 7; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_extension_size()); - i < n; i++) { - const auto& repfield = this_._internal_extension().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 7, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FieldDescriptorProto extension = 7; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_extension_size()); + i < n; i++) { + const auto& repfield = this_._internal_extension().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 7, repfield, repfield.GetCachedSize(), + target, stream); + } - // optional .google.protobuf.FileOptions options = 8; - if (cached_has_bits & 0x00000008u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 8, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FileOptions options = 8; + if ((cached_has_bits & 0x00000008u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 8, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - // optional .google.protobuf.SourceCodeInfo source_code_info = 9; - if (cached_has_bits & 0x00000010u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 9, *this_._impl_.source_code_info_, this_._impl_.source_code_info_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.SourceCodeInfo source_code_info = 9; + if ((cached_has_bits & 0x00000010u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 9, *this_._impl_.source_code_info_, this_._impl_.source_code_info_->GetCachedSize(), target, + stream); + } - // repeated int32 public_dependency = 10; - for (int i = 0, n = this_._internal_public_dependency_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 10, this_._internal_public_dependency().Get(i), target); - } + // repeated int32 public_dependency = 10; + for (int i = 0, n = this_._internal_public_dependency_size(); i < n; ++i) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 10, this_._internal_public_dependency().Get(i), target); + } - // repeated int32 weak_dependency = 11; - for (int i = 0, n = this_._internal_weak_dependency_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 11, this_._internal_weak_dependency().Get(i), target); - } + // repeated int32 weak_dependency = 11; + for (int i = 0, n = this_._internal_weak_dependency_size(); i < n; ++i) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 11, this_._internal_weak_dependency().Get(i), target); + } - // optional string syntax = 12; - if (cached_has_bits & 0x00000004u) { - const std::string& _s = this_._internal_syntax(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileDescriptorProto.syntax"); - target = stream->WriteStringMaybeAliased(12, _s, target); - } + // optional string syntax = 12; + if ((cached_has_bits & 0x00000004u) != 0) { + const std::string& _s = this_._internal_syntax(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileDescriptorProto.syntax"); + target = stream->WriteStringMaybeAliased(12, _s, target); + } - // optional .google.protobuf.Edition edition = 14; - if (cached_has_bits & 0x00000020u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 14, this_._internal_edition(), target); - } + // optional .google.protobuf.Edition edition = 14; + if ((cached_has_bits & 0x00000020u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 14, this_._internal_edition(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileDescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileDescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FileDescriptorProto::ByteSizeLong(const MessageLite& base) { - const FileDescriptorProto& this_ = static_cast<const FileDescriptorProto&>(base); +::size_t FileDescriptorProto::ByteSizeLong(const MessageLite& base) { + const FileDescriptorProto& this_ = static_cast<const FileDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FileDescriptorProto::ByteSizeLong() const { - const FileDescriptorProto& this_ = *this; +::size_t FileDescriptorProto::ByteSizeLong() const { + const FileDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated string dependency = 3; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_dependency().size()); - for (int i = 0, n = this_._internal_dependency().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_dependency().Get(i)); - } - } - // repeated .google.protobuf.DescriptorProto message_type = 4; - { - total_size += 1UL * this_._internal_message_type_size(); - for (const auto& msg : this_._internal_message_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - { - total_size += 1UL * this_._internal_enum_type_size(); - for (const auto& msg : this_._internal_enum_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.ServiceDescriptorProto service = 6; - { - total_size += 1UL * this_._internal_service_size(); - for (const auto& msg : this_._internal_service()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.FieldDescriptorProto extension = 7; - { - total_size += 1UL * this_._internal_extension_size(); - for (const auto& msg : this_._internal_extension()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated int32 public_dependency = 10; - { - std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_public_dependency()); - std::size_t tag_size = std::size_t{1} * - ::_pbi::FromIntSize(this_._internal_public_dependency_size()); - total_size += tag_size + data_size; - } - // repeated int32 weak_dependency = 11; - { - std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_weak_dependency()); - std::size_t tag_size = std::size_t{1} * - ::_pbi::FromIntSize(this_._internal_weak_dependency_size()); - total_size += tag_size + data_size; - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional string package = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_package()); - } - // optional string syntax = 12; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_syntax()); - } - // optional .google.protobuf.FileOptions options = 8; - if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - // optional .google.protobuf.SourceCodeInfo source_code_info = 9; - if (cached_has_bits & 0x00000010u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_code_info_); - } - // optional .google.protobuf.Edition edition = 14; - if (cached_has_bits & 0x00000020u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated string dependency = 3; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_dependency().size()); + for (int i = 0, n = this_._internal_dependency().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_dependency().Get(i)); + } + } + // repeated .google.protobuf.DescriptorProto message_type = 4; + { + total_size += 1UL * this_._internal_message_type_size(); + for (const auto& msg : this_._internal_message_type()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; + { + total_size += 1UL * this_._internal_enum_type_size(); + for (const auto& msg : this_._internal_enum_type()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.ServiceDescriptorProto service = 6; + { + total_size += 1UL * this_._internal_service_size(); + for (const auto& msg : this_._internal_service()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.FieldDescriptorProto extension = 7; + { + total_size += 1UL * this_._internal_extension_size(); + for (const auto& msg : this_._internal_extension()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated int32 public_dependency = 10; + { + std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( + this_._internal_public_dependency()); + std::size_t tag_size = std::size_t{1} * + ::_pbi::FromIntSize(this_._internal_public_dependency_size()); + total_size += tag_size + data_size; + } + // repeated int32 weak_dependency = 11; + { + std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( + this_._internal_weak_dependency()); + std::size_t tag_size = std::size_t{1} * + ::_pbi::FromIntSize(this_._internal_weak_dependency_size()); + total_size += tag_size + data_size; + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000003fu) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional string package = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_package()); + } + // optional string syntax = 12; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_syntax()); + } + // optional .google.protobuf.FileOptions options = 8; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + // optional .google.protobuf.SourceCodeInfo source_code_info = 9; + if ((cached_has_bits & 0x00000010u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_code_info_); + } + // optional .google.protobuf.Edition edition = 14; + if ((cached_has_bits & 0x00000020u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FileDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FileDescriptorProto*>(&to_msg); @@ -3458,35 +3228,33 @@ void FileDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, con _this->_internal_mutable_public_dependency()->MergeFrom(from._internal_public_dependency()); _this->_internal_mutable_weak_dependency()->MergeFrom(from._internal_weak_dependency()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000003fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_package(from._internal_package()); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_internal_set_syntax(from._internal_syntax()); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FileOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { ABSL_DCHECK(from._impl_.source_code_info_ != nullptr); if (_this->_impl_.source_code_info_ == nullptr) { - _this->_impl_.source_code_info_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceCodeInfo>(arena, *from._impl_.source_code_info_); + _this->_impl_.source_code_info_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_code_info_); } else { _this->_impl_.source_code_info_->MergeFrom(*from._impl_.source_code_info_); } } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _this->_impl_.edition_ = from._impl_.edition_; } } @@ -3521,7 +3289,7 @@ PROTOBUF_NOINLINE bool FileDescriptorProto::IsInitializedImpl( return true; } -void FileDescriptorProto::InternalSwap(FileDescriptorProto* PROTOBUF_RESTRICT other) { +void FileDescriptorProto::InternalSwap(FileDescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -3558,26 +3326,27 @@ class DescriptorProto_ExtensionRange::_Internal { 8 * PROTOBUF_FIELD_OFFSET(DescriptorProto_ExtensionRange, _impl_._has_bits_); }; -DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena) +DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, DescriptorProto_ExtensionRange_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto.ExtensionRange) } -inline PROTOBUF_NDEBUG_INLINE DescriptorProto_ExtensionRange::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::DescriptorProto_ExtensionRange& from_msg) +PROTOBUF_NDEBUG_INLINE DescriptorProto_ExtensionRange::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::DescriptorProto_ExtensionRange& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0} {} DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DescriptorProto_ExtensionRange& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, DescriptorProto_ExtensionRange_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -3587,9 +3356,9 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::ExtensionRangeOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, start_), reinterpret_cast<const char *>(&from._impl_) + @@ -3600,12 +3369,12 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange( // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange) } -inline PROTOBUF_NDEBUG_INLINE DescriptorProto_ExtensionRange::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE DescriptorProto_ExtensionRange::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void DescriptorProto_ExtensionRange::SharedCtor(::_pb::Arena* arena) { +inline void DescriptorProto_ExtensionRange::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, options_), @@ -3626,42 +3395,50 @@ inline void DescriptorProto_ExtensionRange::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* DescriptorProto_ExtensionRange::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL DescriptorProto_ExtensionRange::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) DescriptorProto_ExtensionRange(arena); } constexpr auto DescriptorProto_ExtensionRange::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(DescriptorProto_ExtensionRange), alignof(DescriptorProto_ExtensionRange)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull DescriptorProto_ExtensionRange::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_DescriptorProto_ExtensionRange_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - DescriptorProto_ExtensionRange::IsInitializedImpl, - &DescriptorProto_ExtensionRange::MergeImpl, - ::google::protobuf::Message::GetNewImpl<DescriptorProto_ExtensionRange>(), +constexpr auto DescriptorProto_ExtensionRange::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_DescriptorProto_ExtensionRange_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + DescriptorProto_ExtensionRange::IsInitializedImpl, + &DescriptorProto_ExtensionRange::MergeImpl, + ::google::protobuf::Message::GetNewImpl<DescriptorProto_ExtensionRange>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &DescriptorProto_ExtensionRange::SharedDtor, - ::google::protobuf::Message::GetClearImpl<DescriptorProto_ExtensionRange>(), &DescriptorProto_ExtensionRange::ByteSizeLong, - &DescriptorProto_ExtensionRange::_InternalSerialize, + &DescriptorProto_ExtensionRange::SharedDtor, + ::google::protobuf::Message::GetClearImpl<DescriptorProto_ExtensionRange>(), &DescriptorProto_ExtensionRange::ByteSizeLong, + &DescriptorProto_ExtensionRange::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(DescriptorProto_ExtensionRange, _impl_._cached_size_), - false, - }, - &DescriptorProto_ExtensionRange::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* DescriptorProto_ExtensionRange::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(DescriptorProto_ExtensionRange, _impl_._cached_size_), + false, + }, + &DescriptorProto_ExtensionRange::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<2, 3, 1, 0, 2> DescriptorProto_ExtensionRange::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + DescriptorProto_ExtensionRange_class_data_ = + DescriptorProto_ExtensionRange::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL DescriptorProto_ExtensionRange::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&DescriptorProto_ExtensionRange_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(DescriptorProto_ExtensionRange_class_data_.tc_table); + return DescriptorProto_ExtensionRange_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<2, 3, 1, 0, 2> +DescriptorProto_ExtensionRange::_table_ = { { PROTOBUF_FIELD_OFFSET(DescriptorProto_ExtensionRange, _impl_._has_bits_), 0, // no _extensions_ @@ -3672,7 +3449,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 0, 2> DescriptorProto_ExtensionRange::_t 3, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + DescriptorProto_ExtensionRange_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -3701,12 +3478,13 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 0, 2> DescriptorProto_ExtensionRange::_t // optional .google.protobuf.ExtensionRangeOptions options = 3; {PROTOBUF_FIELD_OFFSET(DescriptorProto_ExtensionRange, _impl_.options_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::ExtensionRangeOptions>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::ExtensionRangeOptions>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void DescriptorProto_ExtensionRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -3715,11 +3493,11 @@ PROTOBUF_NOINLINE void DescriptorProto_ExtensionRange::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } - if (cached_has_bits & 0x00000006u) { + if ((cached_has_bits & 0x00000006u) != 0) { ::memset(&_impl_.start_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.end_) - reinterpret_cast<char*>(&_impl_.start_)) + sizeof(_impl_.end_)); @@ -3729,87 +3507,87 @@ PROTOBUF_NOINLINE void DescriptorProto_ExtensionRange::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* DescriptorProto_ExtensionRange::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const DescriptorProto_ExtensionRange& this_ = static_cast<const DescriptorProto_ExtensionRange&>(base); +::uint8_t* PROTOBUF_NONNULL DescriptorProto_ExtensionRange::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const DescriptorProto_ExtensionRange& this_ = static_cast<const DescriptorProto_ExtensionRange&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* DescriptorProto_ExtensionRange::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const DescriptorProto_ExtensionRange& this_ = *this; +::uint8_t* PROTOBUF_NONNULL DescriptorProto_ExtensionRange::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const DescriptorProto_ExtensionRange& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ExtensionRange) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ExtensionRange) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 start = 1; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this_._internal_start(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional int32 start = 1; + if ((cached_has_bits & 0x00000002u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( + stream, this_._internal_start(), target); + } - // optional int32 end = 2; - if (cached_has_bits & 0x00000004u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_end(), target); - } + // optional int32 end = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_end(), target); + } - // optional .google.protobuf.ExtensionRangeOptions options = 3; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.ExtensionRangeOptions options = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto.ExtensionRange) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto.ExtensionRange) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t DescriptorProto_ExtensionRange::ByteSizeLong(const MessageLite& base) { - const DescriptorProto_ExtensionRange& this_ = static_cast<const DescriptorProto_ExtensionRange&>(base); +::size_t DescriptorProto_ExtensionRange::ByteSizeLong(const MessageLite& base) { + const DescriptorProto_ExtensionRange& this_ = static_cast<const DescriptorProto_ExtensionRange&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t DescriptorProto_ExtensionRange::ByteSizeLong() const { - const DescriptorProto_ExtensionRange& this_ = *this; +::size_t DescriptorProto_ExtensionRange::ByteSizeLong() const { + const DescriptorProto_ExtensionRange& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ExtensionRange) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ExtensionRange) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - // optional .google.protobuf.ExtensionRangeOptions options = 3; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - // optional int32 start = 1; - if (cached_has_bits & 0x00000002u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_start()); - } - // optional int32 end = 2; - if (cached_has_bits & 0x00000004u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000007u) != 0) { + // optional .google.protobuf.ExtensionRangeOptions options = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + // optional int32 start = 1; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_start()); + } + // optional int32 end = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_end()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void DescriptorProto_ExtensionRange::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<DescriptorProto_ExtensionRange*>(&to_msg); @@ -3821,20 +3599,19 @@ void DescriptorProto_ExtensionRange::MergeImpl(::google::protobuf::MessageLite& (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::ExtensionRangeOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.start_ = from._impl_.start_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.end_ = from._impl_.end_; } } @@ -3858,7 +3635,7 @@ PROTOBUF_NOINLINE bool DescriptorProto_ExtensionRange::IsInitializedImpl( return true; } -void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange* PROTOBUF_RESTRICT other) { +void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); @@ -3883,9 +3660,9 @@ class DescriptorProto_ReservedRange::_Internal { 8 * PROTOBUF_FIELD_OFFSET(DescriptorProto_ReservedRange, _impl_._has_bits_); }; -DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(::google::protobuf::Arena* arena) +DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, DescriptorProto_ReservedRange_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -3893,16 +3670,22 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(::google::protobuf: // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto.ReservedRange) } DescriptorProto_ReservedRange::DescriptorProto_ReservedRange( - ::google::protobuf::Arena* arena, const DescriptorProto_ReservedRange& from) - : DescriptorProto_ReservedRange(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DescriptorProto_ReservedRange& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, DescriptorProto_ReservedRange_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE DescriptorProto_ReservedRange::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE DescriptorProto_ReservedRange::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void DescriptorProto_ReservedRange::SharedCtor(::_pb::Arena* arena) { +inline void DescriptorProto_ReservedRange::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, start_), @@ -3922,42 +3705,50 @@ inline void DescriptorProto_ReservedRange::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* DescriptorProto_ReservedRange::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL DescriptorProto_ReservedRange::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) DescriptorProto_ReservedRange(arena); } constexpr auto DescriptorProto_ReservedRange::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(DescriptorProto_ReservedRange), alignof(DescriptorProto_ReservedRange)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull DescriptorProto_ReservedRange::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_DescriptorProto_ReservedRange_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &DescriptorProto_ReservedRange::MergeImpl, - ::google::protobuf::Message::GetNewImpl<DescriptorProto_ReservedRange>(), +constexpr auto DescriptorProto_ReservedRange::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_DescriptorProto_ReservedRange_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &DescriptorProto_ReservedRange::MergeImpl, + ::google::protobuf::Message::GetNewImpl<DescriptorProto_ReservedRange>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &DescriptorProto_ReservedRange::SharedDtor, - ::google::protobuf::Message::GetClearImpl<DescriptorProto_ReservedRange>(), &DescriptorProto_ReservedRange::ByteSizeLong, - &DescriptorProto_ReservedRange::_InternalSerialize, + &DescriptorProto_ReservedRange::SharedDtor, + ::google::protobuf::Message::GetClearImpl<DescriptorProto_ReservedRange>(), &DescriptorProto_ReservedRange::ByteSizeLong, + &DescriptorProto_ReservedRange::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(DescriptorProto_ReservedRange, _impl_._cached_size_), - false, - }, - &DescriptorProto_ReservedRange::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* DescriptorProto_ReservedRange::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(DescriptorProto_ReservedRange, _impl_._cached_size_), + false, + }, + &DescriptorProto_ReservedRange::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> DescriptorProto_ReservedRange::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + DescriptorProto_ReservedRange_class_data_ = + DescriptorProto_ReservedRange::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL DescriptorProto_ReservedRange::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&DescriptorProto_ReservedRange_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(DescriptorProto_ReservedRange_class_data_.tc_table); + return DescriptorProto_ReservedRange_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> +DescriptorProto_ReservedRange::_table_ = { { PROTOBUF_FIELD_OFFSET(DescriptorProto_ReservedRange, _impl_._has_bits_), 0, // no _extensions_ @@ -3968,7 +3759,7 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> DescriptorProto_ReservedRange::_ta 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + DescriptorProto_ReservedRange_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -3995,7 +3786,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> DescriptorProto_ReservedRange::_ta {{ }}, }; - PROTOBUF_NOINLINE void DescriptorProto_ReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -4004,7 +3794,7 @@ PROTOBUF_NOINLINE void DescriptorProto_ReservedRange::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if ((cached_has_bits & 0x00000003u) != 0) { ::memset(&_impl_.start_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.end_) - reinterpret_cast<char*>(&_impl_.start_)) + sizeof(_impl_.end_)); @@ -4014,75 +3804,75 @@ PROTOBUF_NOINLINE void DescriptorProto_ReservedRange::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* DescriptorProto_ReservedRange::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const DescriptorProto_ReservedRange& this_ = static_cast<const DescriptorProto_ReservedRange&>(base); +::uint8_t* PROTOBUF_NONNULL DescriptorProto_ReservedRange::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const DescriptorProto_ReservedRange& this_ = static_cast<const DescriptorProto_ReservedRange&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* DescriptorProto_ReservedRange::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const DescriptorProto_ReservedRange& this_ = *this; +::uint8_t* PROTOBUF_NONNULL DescriptorProto_ReservedRange::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const DescriptorProto_ReservedRange& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ReservedRange) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ReservedRange) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 start = 1; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this_._internal_start(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional int32 start = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( + stream, this_._internal_start(), target); + } - // optional int32 end = 2; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_end(), target); - } + // optional int32 end = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_end(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto.ReservedRange) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto.ReservedRange) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t DescriptorProto_ReservedRange::ByteSizeLong(const MessageLite& base) { - const DescriptorProto_ReservedRange& this_ = static_cast<const DescriptorProto_ReservedRange&>(base); +::size_t DescriptorProto_ReservedRange::ByteSizeLong(const MessageLite& base) { + const DescriptorProto_ReservedRange& this_ = static_cast<const DescriptorProto_ReservedRange&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t DescriptorProto_ReservedRange::ByteSizeLong() const { - const DescriptorProto_ReservedRange& this_ = *this; +::size_t DescriptorProto_ReservedRange::ByteSizeLong() const { + const DescriptorProto_ReservedRange& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ReservedRange) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ReservedRange) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional int32 start = 1; - if (cached_has_bits & 0x00000001u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_start()); - } - // optional int32 end = 2; - if (cached_has_bits & 0x00000002u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional int32 start = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_start()); + } + // optional int32 end = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_end()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void DescriptorProto_ReservedRange::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<DescriptorProto_ReservedRange*>(&to_msg); @@ -4093,11 +3883,11 @@ void DescriptorProto_ReservedRange::MergeImpl(::google::protobuf::MessageLite& t (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_impl_.start_ = from._impl_.start_; } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.end_ = from._impl_.end_; } } @@ -4113,7 +3903,7 @@ void DescriptorProto_ReservedRange::CopyFrom(const DescriptorProto_ReservedRange } -void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange* PROTOBUF_RESTRICT other) { +void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); @@ -4138,18 +3928,19 @@ class DescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_._has_bits_); }; -DescriptorProto::DescriptorProto(::google::protobuf::Arena* arena) +DescriptorProto::DescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, DescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.DescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::DescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::DescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, field_{visibility, arena, from.field_}, @@ -4163,10 +3954,10 @@ inline PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( name_(arena, from.name_) {} DescriptorProto::DescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, DescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -4176,15 +3967,15 @@ DescriptorProto::DescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::MessageOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, field_{visibility, arena}, nested_type_{visibility, arena}, @@ -4196,7 +3987,7 @@ inline PROTOBUF_NDEBUG_INLINE DescriptorProto::Impl_::Impl_( reserved_name_{visibility, arena}, name_(arena) {} -inline void DescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void DescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.options_ = {}; } @@ -4213,8 +4004,9 @@ inline void DescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* DescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL DescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) DescriptorProto(arena); } constexpr auto DescriptorProto::InternalNewImpl_() { @@ -4261,34 +4053,41 @@ constexpr auto DescriptorProto::InternalNewImpl_() { alignof(DescriptorProto)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull DescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_DescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - DescriptorProto::IsInitializedImpl, - &DescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<DescriptorProto>(), +constexpr auto DescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_DescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + DescriptorProto::IsInitializedImpl, + &DescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<DescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &DescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<DescriptorProto>(), &DescriptorProto::ByteSizeLong, - &DescriptorProto::_InternalSerialize, + &DescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<DescriptorProto>(), &DescriptorProto::ByteSizeLong, + &DescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_._cached_size_), - false, - }, - &DescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* DescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_._cached_size_), + false, + }, + &DescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<4, 10, 8, 65, 2> DescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + DescriptorProto_class_data_ = + DescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL DescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&DescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(DescriptorProto_class_data_.tc_table); + return DescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<4, 10, 8, 65, 2> +DescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -4299,7 +4098,7 @@ constexpr ::_pbi::TcParseTable<4, 10, 8, 65, 2> DescriptorProto::_table_ = { 10, // num_field_entries 8, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + DescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -4375,23 +4174,24 @@ constexpr ::_pbi::TcParseTable<4, 10, 8, 65, 2> DescriptorProto::_table_ = { // repeated string reserved_name = 10; {PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.reserved_name_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kRawString | ::_fl::kRepSString)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FieldDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto_ExtensionRange>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FieldDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::MessageOptions>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::OneofDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto_ReservedRange>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FieldDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto_ExtensionRange>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FieldDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::MessageOptions>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::OneofDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto_ReservedRange>()}, + }}, + {{ "\37\4\0\0\0\0\0\0\0\0\15\0\0\0\0\0" "google.protobuf.DescriptorProto" "name" "reserved_name" }}, }; - PROTOBUF_NOINLINE void DescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -4408,11 +4208,11 @@ PROTOBUF_NOINLINE void DescriptorProto::Clear() { _impl_.reserved_range_.Clear(); _impl_.reserved_name_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } @@ -4422,221 +4222,221 @@ PROTOBUF_NOINLINE void DescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* DescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const DescriptorProto& this_ = static_cast<const DescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL DescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const DescriptorProto& this_ = static_cast<const DescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* DescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const DescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL DescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const DescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.DescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.DescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // repeated .google.protobuf.FieldDescriptorProto field = 2; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_field_size()); - i < n; i++) { - const auto& repfield = this_._internal_field().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FieldDescriptorProto field = 2; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_field_size()); + i < n; i++) { + const auto& repfield = this_._internal_field().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.DescriptorProto nested_type = 3; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_nested_type_size()); - i < n; i++) { - const auto& repfield = this_._internal_nested_type().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.DescriptorProto nested_type = 3; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_nested_type_size()); + i < n; i++) { + const auto& repfield = this_._internal_nested_type().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_enum_type_size()); - i < n; i++) { - const auto& repfield = this_._internal_enum_type().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_enum_type_size()); + i < n; i++) { + const auto& repfield = this_._internal_enum_type().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_extension_range_size()); - i < n; i++) { - const auto& repfield = this_._internal_extension_range().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_extension_range_size()); + i < n; i++) { + const auto& repfield = this_._internal_extension_range().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 5, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.FieldDescriptorProto extension = 6; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_extension_size()); - i < n; i++) { - const auto& repfield = this_._internal_extension().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FieldDescriptorProto extension = 6; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_extension_size()); + i < n; i++) { + const auto& repfield = this_._internal_extension().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 6, repfield, repfield.GetCachedSize(), + target, stream); + } - // optional .google.protobuf.MessageOptions options = 7; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 7, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.MessageOptions options = 7; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 7, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_oneof_decl_size()); - i < n; i++) { - const auto& repfield = this_._internal_oneof_decl().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 8, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_oneof_decl_size()); + i < n; i++) { + const auto& repfield = this_._internal_oneof_decl().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 8, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_reserved_range_size()); - i < n; i++) { - const auto& repfield = this_._internal_reserved_range().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 9, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_reserved_range_size()); + i < n; i++) { + const auto& repfield = this_._internal_reserved_range().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 9, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated string reserved_name = 10; - for (int i = 0, n = this_._internal_reserved_name_size(); i < n; ++i) { - const auto& s = this_._internal_reserved_name().Get(i); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.DescriptorProto.reserved_name"); - target = stream->WriteString(10, s, target); - } + // repeated string reserved_name = 10; + for (int i = 0, n = this_._internal_reserved_name_size(); i < n; ++i) { + const auto& s = this_._internal_reserved_name().Get(i); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.DescriptorProto.reserved_name"); + target = stream->WriteString(10, s, target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t DescriptorProto::ByteSizeLong(const MessageLite& base) { - const DescriptorProto& this_ = static_cast<const DescriptorProto&>(base); +::size_t DescriptorProto::ByteSizeLong(const MessageLite& base) { + const DescriptorProto& this_ = static_cast<const DescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t DescriptorProto::ByteSizeLong() const { - const DescriptorProto& this_ = *this; +::size_t DescriptorProto::ByteSizeLong() const { + const DescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.FieldDescriptorProto field = 2; - { - total_size += 1UL * this_._internal_field_size(); - for (const auto& msg : this_._internal_field()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.DescriptorProto nested_type = 3; - { - total_size += 1UL * this_._internal_nested_type_size(); - for (const auto& msg : this_._internal_nested_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - { - total_size += 1UL * this_._internal_enum_type_size(); - for (const auto& msg : this_._internal_enum_type()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - { - total_size += 1UL * this_._internal_extension_range_size(); - for (const auto& msg : this_._internal_extension_range()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.FieldDescriptorProto extension = 6; - { - total_size += 1UL * this_._internal_extension_size(); - for (const auto& msg : this_._internal_extension()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - { - total_size += 1UL * this_._internal_oneof_decl_size(); - for (const auto& msg : this_._internal_oneof_decl()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - { - total_size += 1UL * this_._internal_reserved_range_size(); - for (const auto& msg : this_._internal_reserved_range()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated string reserved_name = 10; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_reserved_name().size()); - for (int i = 0, n = this_._internal_reserved_name().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_reserved_name().Get(i)); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional .google.protobuf.MessageOptions options = 7; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.FieldDescriptorProto field = 2; + { + total_size += 1UL * this_._internal_field_size(); + for (const auto& msg : this_._internal_field()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.DescriptorProto nested_type = 3; + { + total_size += 1UL * this_._internal_nested_type_size(); + for (const auto& msg : this_._internal_nested_type()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; + { + total_size += 1UL * this_._internal_enum_type_size(); + for (const auto& msg : this_._internal_enum_type()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; + { + total_size += 1UL * this_._internal_extension_range_size(); + for (const auto& msg : this_._internal_extension_range()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.FieldDescriptorProto extension = 6; + { + total_size += 1UL * this_._internal_extension_size(); + for (const auto& msg : this_._internal_extension()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; + { + total_size += 1UL * this_._internal_oneof_decl_size(); + for (const auto& msg : this_._internal_oneof_decl()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; + { + total_size += 1UL * this_._internal_reserved_range_size(); + for (const auto& msg : this_._internal_reserved_range()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated string reserved_name = 10; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_reserved_name().size()); + for (int i = 0, n = this_._internal_reserved_name().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_reserved_name().Get(i)); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional .google.protobuf.MessageOptions options = 7; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void DescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<DescriptorProto*>(&to_msg); @@ -4663,15 +4463,14 @@ void DescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const : from._internal_reserved_range()); _this->_internal_mutable_reserved_name()->MergeFrom(from._internal_reserved_name()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::MessageOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } @@ -4709,7 +4508,7 @@ PROTOBUF_NOINLINE bool DescriptorProto::IsInitializedImpl( return true; } -void DescriptorProto::InternalSwap(DescriptorProto* PROTOBUF_RESTRICT other) { +void DescriptorProto::InternalSwap(DescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -4740,28 +4539,29 @@ class ExtensionRangeOptions_Declaration::_Internal { 8 * PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions_Declaration, _impl_._has_bits_); }; -ExtensionRangeOptions_Declaration::ExtensionRangeOptions_Declaration(::google::protobuf::Arena* arena) +ExtensionRangeOptions_Declaration::ExtensionRangeOptions_Declaration(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ExtensionRangeOptions_Declaration_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.ExtensionRangeOptions.Declaration) } -inline PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions_Declaration::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::ExtensionRangeOptions_Declaration& from_msg) +PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions_Declaration::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::ExtensionRangeOptions_Declaration& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, full_name_(arena, from.full_name_), type_(arena, from.type_) {} ExtensionRangeOptions_Declaration::ExtensionRangeOptions_Declaration( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ExtensionRangeOptions_Declaration& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ExtensionRangeOptions_Declaration_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -4780,14 +4580,14 @@ ExtensionRangeOptions_Declaration::ExtensionRangeOptions_Declaration( // @@protoc_insertion_point(copy_constructor:google.protobuf.ExtensionRangeOptions.Declaration) } -inline PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions_Declaration::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions_Declaration::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, full_name_(arena), type_(arena) {} -inline void ExtensionRangeOptions_Declaration::SharedCtor(::_pb::Arena* arena) { +inline void ExtensionRangeOptions_Declaration::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, number_), @@ -4809,42 +4609,50 @@ inline void ExtensionRangeOptions_Declaration::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* ExtensionRangeOptions_Declaration::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ExtensionRangeOptions_Declaration(arena); } constexpr auto ExtensionRangeOptions_Declaration::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(ExtensionRangeOptions_Declaration), alignof(ExtensionRangeOptions_Declaration)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull ExtensionRangeOptions_Declaration::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_ExtensionRangeOptions_Declaration_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &ExtensionRangeOptions_Declaration::MergeImpl, - ::google::protobuf::Message::GetNewImpl<ExtensionRangeOptions_Declaration>(), +constexpr auto ExtensionRangeOptions_Declaration::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_ExtensionRangeOptions_Declaration_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &ExtensionRangeOptions_Declaration::MergeImpl, + ::google::protobuf::Message::GetNewImpl<ExtensionRangeOptions_Declaration>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &ExtensionRangeOptions_Declaration::SharedDtor, - ::google::protobuf::Message::GetClearImpl<ExtensionRangeOptions_Declaration>(), &ExtensionRangeOptions_Declaration::ByteSizeLong, - &ExtensionRangeOptions_Declaration::_InternalSerialize, + &ExtensionRangeOptions_Declaration::SharedDtor, + ::google::protobuf::Message::GetClearImpl<ExtensionRangeOptions_Declaration>(), &ExtensionRangeOptions_Declaration::ByteSizeLong, + &ExtensionRangeOptions_Declaration::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions_Declaration, _impl_._cached_size_), - false, - }, - &ExtensionRangeOptions_Declaration::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* ExtensionRangeOptions_Declaration::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions_Declaration, _impl_._cached_size_), + false, + }, + &ExtensionRangeOptions_Declaration::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 5, 0, 71, 2> ExtensionRangeOptions_Declaration::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + ExtensionRangeOptions_Declaration_class_data_ = + ExtensionRangeOptions_Declaration::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&ExtensionRangeOptions_Declaration_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(ExtensionRangeOptions_Declaration_class_data_.tc_table); + return ExtensionRangeOptions_Declaration_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 5, 0, 71, 2> +ExtensionRangeOptions_Declaration::_table_ = { { PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions_Declaration, _impl_._has_bits_), 0, // no _extensions_ @@ -4855,7 +4663,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 71, 2> ExtensionRangeOptions_Declaration 5, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + ExtensionRangeOptions_Declaration_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -4907,7 +4715,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 71, 2> ExtensionRangeOptions_Declaration "type" }}, }; - PROTOBUF_NOINLINE void ExtensionRangeOptions_Declaration::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions.Declaration) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -4916,15 +4723,15 @@ PROTOBUF_NOINLINE void ExtensionRangeOptions_Declaration::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.full_name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.type_.ClearNonDefaultToEmpty(); } } - if (cached_has_bits & 0x0000001cu) { + if ((cached_has_bits & 0x0000001cu) != 0) { ::memset(&_impl_.number_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.repeated_) - reinterpret_cast<char*>(&_impl_.number_)) + sizeof(_impl_.repeated_)); @@ -4934,111 +4741,104 @@ PROTOBUF_NOINLINE void ExtensionRangeOptions_Declaration::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* ExtensionRangeOptions_Declaration::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const ExtensionRangeOptions_Declaration& this_ = static_cast<const ExtensionRangeOptions_Declaration&>(base); +::uint8_t* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const ExtensionRangeOptions_Declaration& this_ = static_cast<const ExtensionRangeOptions_Declaration&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* ExtensionRangeOptions_Declaration::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const ExtensionRangeOptions_Declaration& this_ = *this; +::uint8_t* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const ExtensionRangeOptions_Declaration& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ExtensionRangeOptions.Declaration) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ExtensionRangeOptions.Declaration) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 number = 1; - if (cached_has_bits & 0x00000004u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this_._internal_number(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional int32 number = 1; + if ((cached_has_bits & 0x00000004u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( + stream, this_._internal_number(), target); + } - // optional string full_name = 2; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_full_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.ExtensionRangeOptions.Declaration.full_name"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + // optional string full_name = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_full_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.ExtensionRangeOptions.Declaration.full_name"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // optional string type = 3; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_type(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.ExtensionRangeOptions.Declaration.type"); - target = stream->WriteStringMaybeAliased(3, _s, target); - } + // optional string type = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_type(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.ExtensionRangeOptions.Declaration.type"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } - // optional bool reserved = 5; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 5, this_._internal_reserved(), target); - } + // optional bool reserved = 5; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this_._internal_reserved(), target); + } - // optional bool repeated = 6; - if (cached_has_bits & 0x00000010u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 6, this_._internal_repeated(), target); - } + // optional bool repeated = 6; + if ((cached_has_bits & 0x00000010u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this_._internal_repeated(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ExtensionRangeOptions.Declaration) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ExtensionRangeOptions.Declaration) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t ExtensionRangeOptions_Declaration::ByteSizeLong(const MessageLite& base) { - const ExtensionRangeOptions_Declaration& this_ = static_cast<const ExtensionRangeOptions_Declaration&>(base); +::size_t ExtensionRangeOptions_Declaration::ByteSizeLong(const MessageLite& base) { + const ExtensionRangeOptions_Declaration& this_ = static_cast<const ExtensionRangeOptions_Declaration&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ExtensionRangeOptions_Declaration::ByteSizeLong() const { - const ExtensionRangeOptions_Declaration& this_ = *this; +::size_t ExtensionRangeOptions_Declaration::ByteSizeLong() const { + const ExtensionRangeOptions_Declaration& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ExtensionRangeOptions.Declaration) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ExtensionRangeOptions.Declaration) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000001fu) { - // optional string full_name = 2; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_full_name()); - } - // optional string type = 3; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type()); - } - // optional int32 number = 1; - if (cached_has_bits & 0x00000004u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); - } - // optional bool reserved = 5; - if (cached_has_bits & 0x00000008u) { - total_size += 2; - } - // optional bool repeated = 6; - if (cached_has_bits & 0x00000010u) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x00000018u & cached_has_bits) * 2; + if ((cached_has_bits & 0x00000007u) != 0) { + // optional string full_name = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_full_name()); + } + // optional string type = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_type()); + } + // optional int32 number = 1; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_number()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void ExtensionRangeOptions_Declaration::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<ExtensionRangeOptions_Declaration*>(&to_msg); @@ -5049,20 +4849,20 @@ void ExtensionRangeOptions_Declaration::MergeImpl(::google::protobuf::MessageLit (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000001fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000001fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_full_name(from._internal_full_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_type(from._internal_type()); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.number_ = from._impl_.number_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.reserved_ = from._impl_.reserved_; } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_impl_.repeated_ = from._impl_.repeated_; } } @@ -5078,7 +4878,7 @@ void ExtensionRangeOptions_Declaration::CopyFrom(const ExtensionRangeOptions_Dec } -void ExtensionRangeOptions_Declaration::InternalSwap(ExtensionRangeOptions_Declaration* PROTOBUF_RESTRICT other) { +void ExtensionRangeOptions_Declaration::InternalSwap(ExtensionRangeOptions_Declaration* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -5107,18 +4907,19 @@ class ExtensionRangeOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._has_bits_); }; -ExtensionRangeOptions::ExtensionRangeOptions(::google::protobuf::Arena* arena) +ExtensionRangeOptions::ExtensionRangeOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ExtensionRangeOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.ExtensionRangeOptions) } -inline PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::ExtensionRangeOptions& from_msg) +PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::ExtensionRangeOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, @@ -5126,10 +4927,10 @@ inline PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions::Impl_::Impl_( uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} ExtensionRangeOptions::ExtensionRangeOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ExtensionRangeOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ExtensionRangeOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -5140,23 +4941,23 @@ ExtensionRangeOptions::ExtensionRangeOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; _impl_.verification_ = from._impl_.verification_; // @@protoc_insertion_point(copy_constructor:google.protobuf.ExtensionRangeOptions) } -inline PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE ExtensionRangeOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, declaration_{visibility, arena}, uninterpreted_option_{visibility, arena}, verification_{static_cast< ::google::protobuf::ExtensionRangeOptions_VerificationState >(1)} {} -inline void ExtensionRangeOptions::SharedCtor(::_pb::Arena* arena) { +inline void ExtensionRangeOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.features_ = {}; } @@ -5172,8 +4973,9 @@ inline void ExtensionRangeOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* ExtensionRangeOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL ExtensionRangeOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ExtensionRangeOptions(arena); } constexpr auto ExtensionRangeOptions::InternalNewImpl_() { @@ -5199,34 +5001,41 @@ constexpr auto ExtensionRangeOptions::InternalNewImpl_() { alignof(ExtensionRangeOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull ExtensionRangeOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_ExtensionRangeOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - ExtensionRangeOptions::IsInitializedImpl, - &ExtensionRangeOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<ExtensionRangeOptions>(), +constexpr auto ExtensionRangeOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_ExtensionRangeOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + ExtensionRangeOptions::IsInitializedImpl, + &ExtensionRangeOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<ExtensionRangeOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &ExtensionRangeOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<ExtensionRangeOptions>(), &ExtensionRangeOptions::ByteSizeLong, - &ExtensionRangeOptions::_InternalSerialize, + &ExtensionRangeOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<ExtensionRangeOptions>(), &ExtensionRangeOptions::ByteSizeLong, + &ExtensionRangeOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._cached_size_), - false, - }, - &ExtensionRangeOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* ExtensionRangeOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._cached_size_), + false, + }, + &ExtensionRangeOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 4, 4, 0, 12> ExtensionRangeOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + ExtensionRangeOptions_class_data_ = + ExtensionRangeOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL ExtensionRangeOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&ExtensionRangeOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(ExtensionRangeOptions_class_data_.tc_table); + return ExtensionRangeOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 4, 4, 0, 12> +ExtensionRangeOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._extensions_), @@ -5237,7 +5046,7 @@ constexpr ::_pbi::TcParseTable<3, 4, 4, 0, 12> ExtensionRangeOptions::_table_ = 4, // num_field_entries 4, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + ExtensionRangeOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -5260,8 +5069,9 @@ constexpr ::_pbi::TcParseTable<3, 4, 4, 0, 12> ExtensionRangeOptions::_table_ = {16058, 63, 2, PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_.uninterpreted_option_)}}, }}, {{ 50, 0, 1, - 65534, 2,999, 0, 1, - 65534, 3, + 65534, 2, + 999, 0, 1, + 65534, 3, 65535, 65535 }}, {{ // repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE]; @@ -5276,15 +5086,16 @@ constexpr ::_pbi::TcParseTable<3, 4, 4, 0, 12> ExtensionRangeOptions::_table_ = // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_.uninterpreted_option_), -1, 2, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::ExtensionRangeOptions_Declaration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - {0, 2}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::ExtensionRangeOptions_Declaration>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + {0, 2}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void ExtensionRangeOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -5296,8 +5107,8 @@ PROTOBUF_NOINLINE void ExtensionRangeOptions::Clear() { _impl_.declaration_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } @@ -5308,117 +5119,117 @@ PROTOBUF_NOINLINE void ExtensionRangeOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* ExtensionRangeOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const ExtensionRangeOptions& this_ = static_cast<const ExtensionRangeOptions&>(base); +::uint8_t* PROTOBUF_NONNULL ExtensionRangeOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const ExtensionRangeOptions& this_ = static_cast<const ExtensionRangeOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* ExtensionRangeOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const ExtensionRangeOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL ExtensionRangeOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const ExtensionRangeOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ExtensionRangeOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ExtensionRangeOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE]; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_declaration_size()); - i < n; i++) { - const auto& repfield = this_._internal_declaration().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE]; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_declaration_size()); + i < n; i++) { + const auto& repfield = this_._internal_declaration().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE]; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 3, this_._internal_verification(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE]; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this_._internal_verification(), target); + } - // optional .google.protobuf.FeatureSet features = 50; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 50, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 50; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 50, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ExtensionRangeOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ExtensionRangeOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t ExtensionRangeOptions::ByteSizeLong(const MessageLite& base) { - const ExtensionRangeOptions& this_ = static_cast<const ExtensionRangeOptions&>(base); +::size_t ExtensionRangeOptions::ByteSizeLong(const MessageLite& base) { + const ExtensionRangeOptions& this_ = static_cast<const ExtensionRangeOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ExtensionRangeOptions::ByteSizeLong() const { - const ExtensionRangeOptions& this_ = *this; +::size_t ExtensionRangeOptions::ByteSizeLong() const { + const ExtensionRangeOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ExtensionRangeOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ExtensionRangeOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE]; - { - total_size += 1UL * this_._internal_declaration_size(); - for (const auto& msg : this_._internal_declaration()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional .google.protobuf.FeatureSet features = 50; - if (cached_has_bits & 0x00000001u) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE]; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_verification()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.ExtensionRangeOptions.Declaration declaration = 2 [retention = RETENTION_SOURCE]; + { + total_size += 1UL * this_._internal_declaration_size(); + for (const auto& msg : this_._internal_declaration()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional .google.protobuf.FeatureSet features = 50; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + // optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE]; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_verification()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void ExtensionRangeOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<ExtensionRangeOptions*>(&to_msg); @@ -5434,22 +5245,21 @@ void ExtensionRangeOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, c _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.verification_ = from._impl_.verification_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -5463,8 +5273,7 @@ void ExtensionRangeOptions::CopyFrom(const ExtensionRangeOptions& from) { PROTOBUF_NOINLINE bool ExtensionRangeOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const ExtensionRangeOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -5475,7 +5284,7 @@ PROTOBUF_NOINLINE bool ExtensionRangeOptions::IsInitializedImpl( return true; } -void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* PROTOBUF_RESTRICT other) { +void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -5503,18 +5312,19 @@ class FieldDescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FieldDescriptorProto, _impl_._has_bits_); }; -FieldDescriptorProto::FieldDescriptorProto(::google::protobuf::Arena* arena) +FieldDescriptorProto::FieldDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE FieldDescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FieldDescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE FieldDescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FieldDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_(arena, from.name_), @@ -5524,10 +5334,10 @@ inline PROTOBUF_NDEBUG_INLINE FieldDescriptorProto::Impl_::Impl_( json_name_(arena, from.json_name_) {} FieldDescriptorProto::FieldDescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldDescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -5537,9 +5347,9 @@ FieldDescriptorProto::FieldDescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000020u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000020u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, number_), reinterpret_cast<const char *>(&from._impl_) + @@ -5550,9 +5360,9 @@ FieldDescriptorProto::FieldDescriptorProto( // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE FieldDescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FieldDescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_(arena), extendee_(arena), @@ -5562,7 +5372,7 @@ inline PROTOBUF_NDEBUG_INLINE FieldDescriptorProto::Impl_::Impl_( label_{static_cast< ::google::protobuf::FieldDescriptorProto_Label >(1)}, type_{static_cast< ::google::protobuf::FieldDescriptorProto_Type >(1)} {} -inline void FieldDescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void FieldDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, options_), @@ -5588,42 +5398,50 @@ inline void FieldDescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FieldDescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FieldDescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FieldDescriptorProto(arena); } constexpr auto FieldDescriptorProto::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FieldDescriptorProto), alignof(FieldDescriptorProto)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FieldDescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FieldDescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FieldDescriptorProto::IsInitializedImpl, - &FieldDescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FieldDescriptorProto>(), +constexpr auto FieldDescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FieldDescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FieldDescriptorProto::IsInitializedImpl, + &FieldDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FieldDescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldDescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FieldDescriptorProto>(), &FieldDescriptorProto::ByteSizeLong, - &FieldDescriptorProto::_InternalSerialize, + &FieldDescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FieldDescriptorProto>(), &FieldDescriptorProto::ByteSizeLong, + &FieldDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldDescriptorProto, _impl_._cached_size_), - false, - }, - &FieldDescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FieldDescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FieldDescriptorProto, _impl_._cached_size_), + false, + }, + &FieldDescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<4, 11, 3, 96, 2> FieldDescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FieldDescriptorProto_class_data_ = + FieldDescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FieldDescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FieldDescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FieldDescriptorProto_class_data_.tc_table); + return FieldDescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<4, 11, 3, 96, 2> +FieldDescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(FieldDescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -5634,7 +5452,7 @@ constexpr ::_pbi::TcParseTable<4, 11, 3, 96, 2> FieldDescriptorProto::_table_ = 11, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FieldDescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -5713,11 +5531,13 @@ constexpr ::_pbi::TcParseTable<4, 11, 3, 96, 2> FieldDescriptorProto::_table_ = // optional bool proto3_optional = 17; {PROTOBUF_FIELD_OFFSET(FieldDescriptorProto, _impl_.proto3_optional_), _Internal::kHasBitsOffset + 8, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions>()}, - {1, 3}, - {1, 18}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions>()}, + {1, 3}, + {1, 18}, + }}, + {{ "\44\4\10\0\0\0\11\15\0\0\11\0\0\0\0\0" "google.protobuf.FieldDescriptorProto" "name" @@ -5727,7 +5547,6 @@ constexpr ::_pbi::TcParseTable<4, 11, 3, 96, 2> FieldDescriptorProto::_table_ = "json_name" }}, }; - PROTOBUF_NOINLINE void FieldDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -5736,33 +5555,33 @@ PROTOBUF_NOINLINE void FieldDescriptorProto::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000003fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.extendee_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _impl_.type_name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _impl_.default_value_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _impl_.json_name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } } - if (cached_has_bits & 0x000000c0u) { + if ((cached_has_bits & 0x000000c0u) != 0) { ::memset(&_impl_.number_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.oneof_index_) - reinterpret_cast<char*>(&_impl_.number_)) + sizeof(_impl_.oneof_index_)); } - if (cached_has_bits & 0x00000700u) { + if ((cached_has_bits & 0x00000700u) != 0) { _impl_.proto3_optional_ = false; _impl_.label_ = 1; _impl_.type_ = 1; @@ -5772,189 +5591,186 @@ PROTOBUF_NOINLINE void FieldDescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FieldDescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FieldDescriptorProto& this_ = static_cast<const FieldDescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL FieldDescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FieldDescriptorProto& this_ = static_cast<const FieldDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FieldDescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FieldDescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FieldDescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FieldDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldDescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldDescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FieldDescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldDescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional string extendee = 2; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_extendee(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FieldDescriptorProto.extendee"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + // optional string extendee = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_extendee(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldDescriptorProto.extendee"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // optional int32 number = 3; - if (cached_has_bits & 0x00000040u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this_._internal_number(), target); - } + // optional int32 number = 3; + if ((cached_has_bits & 0x00000040u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<3>( + stream, this_._internal_number(), target); + } - // optional .google.protobuf.FieldDescriptorProto.Label label = 4; - if (cached_has_bits & 0x00000200u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 4, this_._internal_label(), target); - } + // optional .google.protobuf.FieldDescriptorProto.Label label = 4; + if ((cached_has_bits & 0x00000200u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 4, this_._internal_label(), target); + } - // optional .google.protobuf.FieldDescriptorProto.Type type = 5; - if (cached_has_bits & 0x00000400u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 5, this_._internal_type(), target); - } + // optional .google.protobuf.FieldDescriptorProto.Type type = 5; + if ((cached_has_bits & 0x00000400u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 5, this_._internal_type(), target); + } - // optional string type_name = 6; - if (cached_has_bits & 0x00000004u) { - const std::string& _s = this_._internal_type_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FieldDescriptorProto.type_name"); - target = stream->WriteStringMaybeAliased(6, _s, target); - } + // optional string type_name = 6; + if ((cached_has_bits & 0x00000004u) != 0) { + const std::string& _s = this_._internal_type_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldDescriptorProto.type_name"); + target = stream->WriteStringMaybeAliased(6, _s, target); + } - // optional string default_value = 7; - if (cached_has_bits & 0x00000008u) { - const std::string& _s = this_._internal_default_value(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FieldDescriptorProto.default_value"); - target = stream->WriteStringMaybeAliased(7, _s, target); - } + // optional string default_value = 7; + if ((cached_has_bits & 0x00000008u) != 0) { + const std::string& _s = this_._internal_default_value(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldDescriptorProto.default_value"); + target = stream->WriteStringMaybeAliased(7, _s, target); + } - // optional .google.protobuf.FieldOptions options = 8; - if (cached_has_bits & 0x00000020u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 8, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FieldOptions options = 8; + if ((cached_has_bits & 0x00000020u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 8, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - // optional int32 oneof_index = 9; - if (cached_has_bits & 0x00000080u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<9>( - stream, this_._internal_oneof_index(), target); - } + // optional int32 oneof_index = 9; + if ((cached_has_bits & 0x00000080u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<9>( + stream, this_._internal_oneof_index(), target); + } - // optional string json_name = 10; - if (cached_has_bits & 0x00000010u) { - const std::string& _s = this_._internal_json_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FieldDescriptorProto.json_name"); - target = stream->WriteStringMaybeAliased(10, _s, target); - } + // optional string json_name = 10; + if ((cached_has_bits & 0x00000010u) != 0) { + const std::string& _s = this_._internal_json_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldDescriptorProto.json_name"); + target = stream->WriteStringMaybeAliased(10, _s, target); + } - // optional bool proto3_optional = 17; - if (cached_has_bits & 0x00000100u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 17, this_._internal_proto3_optional(), target); - } + // optional bool proto3_optional = 17; + if ((cached_has_bits & 0x00000100u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 17, this_._internal_proto3_optional(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldDescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldDescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FieldDescriptorProto::ByteSizeLong(const MessageLite& base) { - const FieldDescriptorProto& this_ = static_cast<const FieldDescriptorProto&>(base); +::size_t FieldDescriptorProto::ByteSizeLong(const MessageLite& base) { + const FieldDescriptorProto& this_ = static_cast<const FieldDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FieldDescriptorProto::ByteSizeLong() const { - const FieldDescriptorProto& this_ = *this; +::size_t FieldDescriptorProto::ByteSizeLong() const { + const FieldDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldDescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldDescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x000000ffu) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional string extendee = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_extendee()); - } - // optional string type_name = 6; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type_name()); - } - // optional string default_value = 7; - if (cached_has_bits & 0x00000008u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_default_value()); - } - // optional string json_name = 10; - if (cached_has_bits & 0x00000010u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_json_name()); - } - // optional .google.protobuf.FieldOptions options = 8; - if (cached_has_bits & 0x00000020u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - // optional int32 number = 3; - if (cached_has_bits & 0x00000040u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); - } - // optional int32 oneof_index = 9; - if (cached_has_bits & 0x00000080u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_oneof_index()); - } - } - if (cached_has_bits & 0x00000700u) { - // optional bool proto3_optional = 17; - if (cached_has_bits & 0x00000100u) { - total_size += 3; - } - // optional .google.protobuf.FieldDescriptorProto.Label label = 4; - if (cached_has_bits & 0x00000200u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_label()); - } - // optional .google.protobuf.FieldDescriptorProto.Type type = 5; - if (cached_has_bits & 0x00000400u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_type()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += static_cast<bool>(0x00000100u & cached_has_bits) * 3; + if ((cached_has_bits & 0x000000ffu) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional string extendee = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_extendee()); + } + // optional string type_name = 6; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_type_name()); + } + // optional string default_value = 7; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_default_value()); + } + // optional string json_name = 10; + if ((cached_has_bits & 0x00000010u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_json_name()); + } + // optional .google.protobuf.FieldOptions options = 8; + if ((cached_has_bits & 0x00000020u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + // optional int32 number = 3; + if ((cached_has_bits & 0x00000040u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_number()); + } + // optional int32 oneof_index = 9; + if ((cached_has_bits & 0x00000080u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_oneof_index()); + } + } + if ((cached_has_bits & 0x00000600u) != 0) { + // optional .google.protobuf.FieldDescriptorProto.Label label = 4; + if ((cached_has_bits & 0x00000200u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_label()); + } + // optional .google.protobuf.FieldDescriptorProto.Type type = 5; + if ((cached_has_bits & 0x00000400u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_type()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FieldDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FieldDescriptorProto*>(&to_msg); @@ -5966,46 +5782,45 @@ void FieldDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, co (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x000000ffu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x000000ffu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_extendee(from._internal_extendee()); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_internal_set_type_name(from._internal_type_name()); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_internal_set_default_value(from._internal_default_value()); } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_internal_set_json_name(from._internal_json_name()); } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } } - if (cached_has_bits & 0x00000040u) { + if ((cached_has_bits & 0x00000040u) != 0) { _this->_impl_.number_ = from._impl_.number_; } - if (cached_has_bits & 0x00000080u) { + if ((cached_has_bits & 0x00000080u) != 0) { _this->_impl_.oneof_index_ = from._impl_.oneof_index_; } } - if (cached_has_bits & 0x00000700u) { - if (cached_has_bits & 0x00000100u) { + if ((cached_has_bits & 0x00000700u) != 0) { + if ((cached_has_bits & 0x00000100u) != 0) { _this->_impl_.proto3_optional_ = from._impl_.proto3_optional_; } - if (cached_has_bits & 0x00000200u) { + if ((cached_has_bits & 0x00000200u) != 0) { _this->_impl_.label_ = from._impl_.label_; } - if (cached_has_bits & 0x00000400u) { + if ((cached_has_bits & 0x00000400u) != 0) { _this->_impl_.type_ = from._impl_.type_; } } @@ -6029,7 +5844,7 @@ PROTOBUF_NOINLINE bool FieldDescriptorProto::IsInitializedImpl( return true; } -void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* PROTOBUF_RESTRICT other) { +void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -6061,27 +5876,28 @@ class OneofDescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(OneofDescriptorProto, _impl_._has_bits_); }; -OneofDescriptorProto::OneofDescriptorProto(::google::protobuf::Arena* arena) +OneofDescriptorProto::OneofDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, OneofDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.OneofDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE OneofDescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::OneofDescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE OneofDescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::OneofDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_(arena, from.name_) {} OneofDescriptorProto::OneofDescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const OneofDescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, OneofDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -6091,19 +5907,19 @@ OneofDescriptorProto::OneofDescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::OneofOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE OneofDescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE OneofDescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_(arena) {} -inline void OneofDescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void OneofDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.options_ = {}; } @@ -6120,42 +5936,50 @@ inline void OneofDescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* OneofDescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL OneofDescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) OneofDescriptorProto(arena); } constexpr auto OneofDescriptorProto::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(OneofDescriptorProto), alignof(OneofDescriptorProto)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull OneofDescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_OneofDescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - OneofDescriptorProto::IsInitializedImpl, - &OneofDescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<OneofDescriptorProto>(), +constexpr auto OneofDescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_OneofDescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + OneofDescriptorProto::IsInitializedImpl, + &OneofDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<OneofDescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &OneofDescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<OneofDescriptorProto>(), &OneofDescriptorProto::ByteSizeLong, - &OneofDescriptorProto::_InternalSerialize, + &OneofDescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<OneofDescriptorProto>(), &OneofDescriptorProto::ByteSizeLong, + &OneofDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(OneofDescriptorProto, _impl_._cached_size_), - false, - }, - &OneofDescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* OneofDescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(OneofDescriptorProto, _impl_._cached_size_), + false, + }, + &OneofDescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<1, 2, 1, 49, 2> OneofDescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + OneofDescriptorProto_class_data_ = + OneofDescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL OneofDescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&OneofDescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(OneofDescriptorProto_class_data_.tc_table); + return OneofDescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<1, 2, 1, 49, 2> +OneofDescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(OneofDescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -6166,7 +5990,7 @@ constexpr ::_pbi::TcParseTable<1, 2, 1, 49, 2> OneofDescriptorProto::_table_ = { 2, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + OneofDescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -6188,15 +6012,16 @@ constexpr ::_pbi::TcParseTable<1, 2, 1, 49, 2> OneofDescriptorProto::_table_ = { // optional .google.protobuf.OneofOptions options = 2; {PROTOBUF_FIELD_OFFSET(OneofDescriptorProto, _impl_.options_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::OneofOptions>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::OneofOptions>()}, + }}, + {{ "\44\4\0\0\0\0\0\0" "google.protobuf.OneofDescriptorProto" "name" }}, }; - PROTOBUF_NOINLINE void OneofDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -6205,11 +6030,11 @@ PROTOBUF_NOINLINE void OneofDescriptorProto::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } @@ -6219,76 +6044,76 @@ PROTOBUF_NOINLINE void OneofDescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* OneofDescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const OneofDescriptorProto& this_ = static_cast<const OneofDescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL OneofDescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const OneofDescriptorProto& this_ = static_cast<const OneofDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* OneofDescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const OneofDescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL OneofDescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const OneofDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.OneofDescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.OneofDescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional .google.protobuf.OneofOptions options = 2; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.OneofOptions options = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.OneofDescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.OneofDescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t OneofDescriptorProto::ByteSizeLong(const MessageLite& base) { - const OneofDescriptorProto& this_ = static_cast<const OneofDescriptorProto&>(base); +::size_t OneofDescriptorProto::ByteSizeLong(const MessageLite& base) { + const OneofDescriptorProto& this_ = static_cast<const OneofDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t OneofDescriptorProto::ByteSizeLong() const { - const OneofDescriptorProto& this_ = *this; +::size_t OneofDescriptorProto::ByteSizeLong() const { + const OneofDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofDescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofDescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional .google.protobuf.OneofOptions options = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional .google.protobuf.OneofOptions options = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void OneofDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<OneofDescriptorProto*>(&to_msg); @@ -6300,15 +6125,14 @@ void OneofDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, co (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::OneofOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } @@ -6334,7 +6158,7 @@ PROTOBUF_NOINLINE bool OneofDescriptorProto::IsInitializedImpl( return true; } -void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* PROTOBUF_RESTRICT other) { +void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -6357,9 +6181,9 @@ class EnumDescriptorProto_EnumReservedRange::_Internal { 8 * PROTOBUF_FIELD_OFFSET(EnumDescriptorProto_EnumReservedRange, _impl_._has_bits_); }; -EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena) +EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumDescriptorProto_EnumReservedRange_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -6367,16 +6191,22 @@ EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(::g // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange) } EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange( - ::google::protobuf::Arena* arena, const EnumDescriptorProto_EnumReservedRange& from) - : EnumDescriptorProto_EnumReservedRange(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumDescriptorProto_EnumReservedRange& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, EnumDescriptorProto_EnumReservedRange_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE EnumDescriptorProto_EnumReservedRange::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE EnumDescriptorProto_EnumReservedRange::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void EnumDescriptorProto_EnumReservedRange::SharedCtor(::_pb::Arena* arena) { +inline void EnumDescriptorProto_EnumReservedRange::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, start_), @@ -6396,42 +6226,50 @@ inline void EnumDescriptorProto_EnumReservedRange::SharedDtor(MessageLite& self) this_._impl_.~Impl_(); } -inline void* EnumDescriptorProto_EnumReservedRange::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL EnumDescriptorProto_EnumReservedRange::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumDescriptorProto_EnumReservedRange(arena); } constexpr auto EnumDescriptorProto_EnumReservedRange::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(EnumDescriptorProto_EnumReservedRange), alignof(EnumDescriptorProto_EnumReservedRange)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull EnumDescriptorProto_EnumReservedRange::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_EnumDescriptorProto_EnumReservedRange_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &EnumDescriptorProto_EnumReservedRange::MergeImpl, - ::google::protobuf::Message::GetNewImpl<EnumDescriptorProto_EnumReservedRange>(), +constexpr auto EnumDescriptorProto_EnumReservedRange::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_EnumDescriptorProto_EnumReservedRange_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &EnumDescriptorProto_EnumReservedRange::MergeImpl, + ::google::protobuf::Message::GetNewImpl<EnumDescriptorProto_EnumReservedRange>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &EnumDescriptorProto_EnumReservedRange::SharedDtor, - ::google::protobuf::Message::GetClearImpl<EnumDescriptorProto_EnumReservedRange>(), &EnumDescriptorProto_EnumReservedRange::ByteSizeLong, - &EnumDescriptorProto_EnumReservedRange::_InternalSerialize, + &EnumDescriptorProto_EnumReservedRange::SharedDtor, + ::google::protobuf::Message::GetClearImpl<EnumDescriptorProto_EnumReservedRange>(), &EnumDescriptorProto_EnumReservedRange::ByteSizeLong, + &EnumDescriptorProto_EnumReservedRange::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(EnumDescriptorProto_EnumReservedRange, _impl_._cached_size_), - false, - }, - &EnumDescriptorProto_EnumReservedRange::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* EnumDescriptorProto_EnumReservedRange::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(EnumDescriptorProto_EnumReservedRange, _impl_._cached_size_), + false, + }, + &EnumDescriptorProto_EnumReservedRange::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> EnumDescriptorProto_EnumReservedRange::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + EnumDescriptorProto_EnumReservedRange_class_data_ = + EnumDescriptorProto_EnumReservedRange::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL EnumDescriptorProto_EnumReservedRange::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&EnumDescriptorProto_EnumReservedRange_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(EnumDescriptorProto_EnumReservedRange_class_data_.tc_table); + return EnumDescriptorProto_EnumReservedRange_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> +EnumDescriptorProto_EnumReservedRange::_table_ = { { PROTOBUF_FIELD_OFFSET(EnumDescriptorProto_EnumReservedRange, _impl_._has_bits_), 0, // no _extensions_ @@ -6442,7 +6280,7 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> EnumDescriptorProto_EnumReservedRa 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + EnumDescriptorProto_EnumReservedRange_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -6469,7 +6307,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 0, 2> EnumDescriptorProto_EnumReservedRa {{ }}, }; - PROTOBUF_NOINLINE void EnumDescriptorProto_EnumReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -6478,7 +6315,7 @@ PROTOBUF_NOINLINE void EnumDescriptorProto_EnumReservedRange::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if ((cached_has_bits & 0x00000003u) != 0) { ::memset(&_impl_.start_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.end_) - reinterpret_cast<char*>(&_impl_.start_)) + sizeof(_impl_.end_)); @@ -6488,75 +6325,75 @@ PROTOBUF_NOINLINE void EnumDescriptorProto_EnumReservedRange::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* EnumDescriptorProto_EnumReservedRange::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const EnumDescriptorProto_EnumReservedRange& this_ = static_cast<const EnumDescriptorProto_EnumReservedRange&>(base); +::uint8_t* PROTOBUF_NONNULL EnumDescriptorProto_EnumReservedRange::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const EnumDescriptorProto_EnumReservedRange& this_ = static_cast<const EnumDescriptorProto_EnumReservedRange&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* EnumDescriptorProto_EnumReservedRange::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const EnumDescriptorProto_EnumReservedRange& this_ = *this; +::uint8_t* PROTOBUF_NONNULL EnumDescriptorProto_EnumReservedRange::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const EnumDescriptorProto_EnumReservedRange& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 start = 1; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this_._internal_start(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional int32 start = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( + stream, this_._internal_start(), target); + } - // optional int32 end = 2; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_end(), target); - } + // optional int32 end = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_end(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumDescriptorProto.EnumReservedRange) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumDescriptorProto.EnumReservedRange) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong(const MessageLite& base) { - const EnumDescriptorProto_EnumReservedRange& this_ = static_cast<const EnumDescriptorProto_EnumReservedRange&>(base); +::size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong(const MessageLite& base) { + const EnumDescriptorProto_EnumReservedRange& this_ = static_cast<const EnumDescriptorProto_EnumReservedRange&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const { - const EnumDescriptorProto_EnumReservedRange& this_ = *this; +::size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const { + const EnumDescriptorProto_EnumReservedRange& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional int32 start = 1; - if (cached_has_bits & 0x00000001u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_start()); - } - // optional int32 end = 2; - if (cached_has_bits & 0x00000002u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional int32 start = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_start()); + } + // optional int32 end = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_end()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void EnumDescriptorProto_EnumReservedRange::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<EnumDescriptorProto_EnumReservedRange*>(&to_msg); @@ -6567,11 +6404,11 @@ void EnumDescriptorProto_EnumReservedRange::MergeImpl(::google::protobuf::Messag (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_impl_.start_ = from._impl_.start_; } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.end_ = from._impl_.end_; } } @@ -6587,7 +6424,7 @@ void EnumDescriptorProto_EnumReservedRange::CopyFrom(const EnumDescriptorProto_E } -void EnumDescriptorProto_EnumReservedRange::InternalSwap(EnumDescriptorProto_EnumReservedRange* PROTOBUF_RESTRICT other) { +void EnumDescriptorProto_EnumReservedRange::InternalSwap(EnumDescriptorProto_EnumReservedRange* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); @@ -6612,18 +6449,19 @@ class EnumDescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_._has_bits_); }; -EnumDescriptorProto::EnumDescriptorProto(::google::protobuf::Arena* arena) +EnumDescriptorProto::EnumDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE EnumDescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::EnumDescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE EnumDescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::EnumDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, value_{visibility, arena, from.value_}, @@ -6632,10 +6470,10 @@ inline PROTOBUF_NDEBUG_INLINE EnumDescriptorProto::Impl_::Impl_( name_(arena, from.name_) {} EnumDescriptorProto::EnumDescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumDescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -6645,22 +6483,22 @@ EnumDescriptorProto::EnumDescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE EnumDescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE EnumDescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, value_{visibility, arena}, reserved_range_{visibility, arena}, reserved_name_{visibility, arena}, name_(arena) {} -inline void EnumDescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void EnumDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.options_ = {}; } @@ -6677,8 +6515,9 @@ inline void EnumDescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* EnumDescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL EnumDescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumDescriptorProto(arena); } constexpr auto EnumDescriptorProto::InternalNewImpl_() { @@ -6705,34 +6544,41 @@ constexpr auto EnumDescriptorProto::InternalNewImpl_() { alignof(EnumDescriptorProto)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull EnumDescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_EnumDescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - EnumDescriptorProto::IsInitializedImpl, - &EnumDescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<EnumDescriptorProto>(), +constexpr auto EnumDescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_EnumDescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + EnumDescriptorProto::IsInitializedImpl, + &EnumDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<EnumDescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &EnumDescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<EnumDescriptorProto>(), &EnumDescriptorProto::ByteSizeLong, - &EnumDescriptorProto::_InternalSerialize, + &EnumDescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<EnumDescriptorProto>(), &EnumDescriptorProto::ByteSizeLong, + &EnumDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_._cached_size_), - false, - }, - &EnumDescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* EnumDescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_._cached_size_), + false, + }, + &EnumDescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 5, 3, 61, 2> EnumDescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + EnumDescriptorProto_class_data_ = + EnumDescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL EnumDescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&EnumDescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(EnumDescriptorProto_class_data_.tc_table); + return EnumDescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 5, 3, 61, 2> +EnumDescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -6743,7 +6589,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 3, 61, 2> EnumDescriptorProto::_table_ = { 5, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + EnumDescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -6786,18 +6632,19 @@ constexpr ::_pbi::TcParseTable<3, 5, 3, 61, 2> EnumDescriptorProto::_table_ = { // repeated string reserved_name = 5; {PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_.reserved_name_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kRawString | ::_fl::kRepSString)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::EnumValueDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::EnumOptions>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto_EnumReservedRange>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::EnumValueDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::EnumOptions>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto_EnumReservedRange>()}, + }}, + {{ "\43\4\0\0\0\15\0\0" "google.protobuf.EnumDescriptorProto" "name" "reserved_name" }}, }; - PROTOBUF_NOINLINE void EnumDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -6809,11 +6656,11 @@ PROTOBUF_NOINLINE void EnumDescriptorProto::Clear() { _impl_.reserved_range_.Clear(); _impl_.reserved_name_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } @@ -6823,131 +6670,131 @@ PROTOBUF_NOINLINE void EnumDescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* EnumDescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const EnumDescriptorProto& this_ = static_cast<const EnumDescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL EnumDescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const EnumDescriptorProto& this_ = static_cast<const EnumDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* EnumDescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const EnumDescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL EnumDescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const EnumDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.EnumDescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.EnumDescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // repeated .google.protobuf.EnumValueDescriptorProto value = 2; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_value_size()); - i < n; i++) { - const auto& repfield = this_._internal_value().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.EnumValueDescriptorProto value = 2; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_value_size()); + i < n; i++) { + const auto& repfield = this_._internal_value().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - // optional .google.protobuf.EnumOptions options = 3; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.EnumOptions options = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_reserved_range_size()); - i < n; i++) { - const auto& repfield = this_._internal_reserved_range().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_reserved_range_size()); + i < n; i++) { + const auto& repfield = this_._internal_reserved_range().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated string reserved_name = 5; - for (int i = 0, n = this_._internal_reserved_name_size(); i < n; ++i) { - const auto& s = this_._internal_reserved_name().Get(i); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.EnumDescriptorProto.reserved_name"); - target = stream->WriteString(5, s, target); - } + // repeated string reserved_name = 5; + for (int i = 0, n = this_._internal_reserved_name_size(); i < n; ++i) { + const auto& s = this_._internal_reserved_name().Get(i); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.EnumDescriptorProto.reserved_name"); + target = stream->WriteString(5, s, target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumDescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumDescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t EnumDescriptorProto::ByteSizeLong(const MessageLite& base) { - const EnumDescriptorProto& this_ = static_cast<const EnumDescriptorProto&>(base); +::size_t EnumDescriptorProto::ByteSizeLong(const MessageLite& base) { + const EnumDescriptorProto& this_ = static_cast<const EnumDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t EnumDescriptorProto::ByteSizeLong() const { - const EnumDescriptorProto& this_ = *this; +::size_t EnumDescriptorProto::ByteSizeLong() const { + const EnumDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.EnumValueDescriptorProto value = 2; - { - total_size += 1UL * this_._internal_value_size(); - for (const auto& msg : this_._internal_value()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; - { - total_size += 1UL * this_._internal_reserved_range_size(); - for (const auto& msg : this_._internal_reserved_range()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated string reserved_name = 5; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_reserved_name().size()); - for (int i = 0, n = this_._internal_reserved_name().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_reserved_name().Get(i)); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional .google.protobuf.EnumOptions options = 3; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.EnumValueDescriptorProto value = 2; + { + total_size += 1UL * this_._internal_value_size(); + for (const auto& msg : this_._internal_value()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; + { + total_size += 1UL * this_._internal_reserved_range_size(); + for (const auto& msg : this_._internal_reserved_range()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated string reserved_name = 5; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_reserved_name().size()); + for (int i = 0, n = this_._internal_reserved_name().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_reserved_name().Get(i)); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional .google.protobuf.EnumOptions options = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void EnumDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<EnumDescriptorProto*>(&to_msg); @@ -6964,15 +6811,14 @@ void EnumDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, con from._internal_reserved_range()); _this->_internal_mutable_reserved_name()->MergeFrom(from._internal_reserved_name()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } @@ -7000,7 +6846,7 @@ PROTOBUF_NOINLINE bool EnumDescriptorProto::IsInitializedImpl( return true; } -void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* PROTOBUF_RESTRICT other) { +void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -7026,27 +6872,28 @@ class EnumValueDescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(EnumValueDescriptorProto, _impl_._has_bits_); }; -EnumValueDescriptorProto::EnumValueDescriptorProto(::google::protobuf::Arena* arena) +EnumValueDescriptorProto::EnumValueDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumValueDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValueDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE EnumValueDescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::EnumValueDescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE EnumValueDescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::EnumValueDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_(arena, from.name_) {} EnumValueDescriptorProto::EnumValueDescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumValueDescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumValueDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -7056,20 +6903,20 @@ EnumValueDescriptorProto::EnumValueDescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumValueOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; _impl_.number_ = from._impl_.number_; // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE EnumValueDescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE EnumValueDescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_(arena) {} -inline void EnumValueDescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void EnumValueDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, options_), @@ -7091,42 +6938,50 @@ inline void EnumValueDescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* EnumValueDescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL EnumValueDescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumValueDescriptorProto(arena); } constexpr auto EnumValueDescriptorProto::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(EnumValueDescriptorProto), alignof(EnumValueDescriptorProto)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull EnumValueDescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_EnumValueDescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - EnumValueDescriptorProto::IsInitializedImpl, - &EnumValueDescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<EnumValueDescriptorProto>(), +constexpr auto EnumValueDescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_EnumValueDescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + EnumValueDescriptorProto::IsInitializedImpl, + &EnumValueDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<EnumValueDescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &EnumValueDescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<EnumValueDescriptorProto>(), &EnumValueDescriptorProto::ByteSizeLong, - &EnumValueDescriptorProto::_InternalSerialize, + &EnumValueDescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<EnumValueDescriptorProto>(), &EnumValueDescriptorProto::ByteSizeLong, + &EnumValueDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(EnumValueDescriptorProto, _impl_._cached_size_), - false, - }, - &EnumValueDescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* EnumValueDescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(EnumValueDescriptorProto, _impl_._cached_size_), + false, + }, + &EnumValueDescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<2, 3, 1, 53, 2> EnumValueDescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + EnumValueDescriptorProto_class_data_ = + EnumValueDescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL EnumValueDescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&EnumValueDescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(EnumValueDescriptorProto_class_data_.tc_table); + return EnumValueDescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<2, 3, 1, 53, 2> +EnumValueDescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(EnumValueDescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -7137,7 +6992,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 53, 2> EnumValueDescriptorProto::_table_ 3, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + EnumValueDescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -7166,15 +7021,16 @@ constexpr ::_pbi::TcParseTable<2, 3, 1, 53, 2> EnumValueDescriptorProto::_table_ // optional .google.protobuf.EnumValueOptions options = 3; {PROTOBUF_FIELD_OFFSET(EnumValueDescriptorProto, _impl_.options_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::EnumValueOptions>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::EnumValueOptions>()}, + }}, + {{ "\50\4\0\0\0\0\0\0" "google.protobuf.EnumValueDescriptorProto" "name" }}, }; - PROTOBUF_NOINLINE void EnumValueDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -7183,11 +7039,11 @@ PROTOBUF_NOINLINE void EnumValueDescriptorProto::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } @@ -7198,88 +7054,88 @@ PROTOBUF_NOINLINE void EnumValueDescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* EnumValueDescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const EnumValueDescriptorProto& this_ = static_cast<const EnumValueDescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL EnumValueDescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const EnumValueDescriptorProto& this_ = static_cast<const EnumValueDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* EnumValueDescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const EnumValueDescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL EnumValueDescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const EnumValueDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueDescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueDescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.EnumValueDescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.EnumValueDescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional int32 number = 2; - if (cached_has_bits & 0x00000004u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_number(), target); - } + // optional int32 number = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_number(), target); + } - // optional .google.protobuf.EnumValueOptions options = 3; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.EnumValueOptions options = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValueDescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValueDescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t EnumValueDescriptorProto::ByteSizeLong(const MessageLite& base) { - const EnumValueDescriptorProto& this_ = static_cast<const EnumValueDescriptorProto&>(base); +::size_t EnumValueDescriptorProto::ByteSizeLong(const MessageLite& base) { + const EnumValueDescriptorProto& this_ = static_cast<const EnumValueDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t EnumValueDescriptorProto::ByteSizeLong() const { - const EnumValueDescriptorProto& this_ = *this; +::size_t EnumValueDescriptorProto::ByteSizeLong() const { + const EnumValueDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueDescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueDescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional .google.protobuf.EnumValueOptions options = 3; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - // optional int32 number = 2; - if (cached_has_bits & 0x00000004u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000007u) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional .google.protobuf.EnumValueOptions options = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + // optional int32 number = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_number()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void EnumValueDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<EnumValueDescriptorProto*>(&to_msg); @@ -7291,20 +7147,19 @@ void EnumValueDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::EnumValueOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.number_ = from._impl_.number_; } } @@ -7328,7 +7183,7 @@ PROTOBUF_NOINLINE bool EnumValueDescriptorProto::IsInitializedImpl( return true; } -void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* PROTOBUF_RESTRICT other) { +void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -7356,28 +7211,29 @@ class ServiceDescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(ServiceDescriptorProto, _impl_._has_bits_); }; -ServiceDescriptorProto::ServiceDescriptorProto(::google::protobuf::Arena* arena) +ServiceDescriptorProto::ServiceDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ServiceDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.ServiceDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE ServiceDescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::ServiceDescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE ServiceDescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::ServiceDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, method_{visibility, arena, from.method_}, name_(arena, from.name_) {} ServiceDescriptorProto::ServiceDescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ServiceDescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ServiceDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -7387,20 +7243,20 @@ ServiceDescriptorProto::ServiceDescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::ServiceOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE ServiceDescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE ServiceDescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, method_{visibility, arena}, name_(arena) {} -inline void ServiceDescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void ServiceDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.options_ = {}; } @@ -7417,8 +7273,9 @@ inline void ServiceDescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* ServiceDescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL ServiceDescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ServiceDescriptorProto(arena); } constexpr auto ServiceDescriptorProto::InternalNewImpl_() { @@ -7437,34 +7294,41 @@ constexpr auto ServiceDescriptorProto::InternalNewImpl_() { alignof(ServiceDescriptorProto)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull ServiceDescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_ServiceDescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - ServiceDescriptorProto::IsInitializedImpl, - &ServiceDescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<ServiceDescriptorProto>(), +constexpr auto ServiceDescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_ServiceDescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + ServiceDescriptorProto::IsInitializedImpl, + &ServiceDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<ServiceDescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &ServiceDescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<ServiceDescriptorProto>(), &ServiceDescriptorProto::ByteSizeLong, - &ServiceDescriptorProto::_InternalSerialize, + &ServiceDescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<ServiceDescriptorProto>(), &ServiceDescriptorProto::ByteSizeLong, + &ServiceDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(ServiceDescriptorProto, _impl_._cached_size_), - false, - }, - &ServiceDescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* ServiceDescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(ServiceDescriptorProto, _impl_._cached_size_), + false, + }, + &ServiceDescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<2, 3, 2, 51, 2> ServiceDescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + ServiceDescriptorProto_class_data_ = + ServiceDescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL ServiceDescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&ServiceDescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(ServiceDescriptorProto_class_data_.tc_table); + return ServiceDescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<2, 3, 2, 51, 2> +ServiceDescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(ServiceDescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -7475,7 +7339,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 51, 2> ServiceDescriptorProto::_table_ = 3, // num_field_entries 2, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + ServiceDescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -7504,16 +7368,17 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 51, 2> ServiceDescriptorProto::_table_ = // optional .google.protobuf.ServiceOptions options = 3; {PROTOBUF_FIELD_OFFSET(ServiceDescriptorProto, _impl_.options_), _Internal::kHasBitsOffset + 1, 1, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::MethodDescriptorProto>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::ServiceOptions>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::MethodDescriptorProto>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::ServiceOptions>()}, + }}, + {{ "\46\4\0\0\0\0\0\0" "google.protobuf.ServiceDescriptorProto" "name" }}, }; - PROTOBUF_NOINLINE void ServiceDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -7523,11 +7388,11 @@ PROTOBUF_NOINLINE void ServiceDescriptorProto::Clear() { _impl_.method_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } @@ -7537,96 +7402,96 @@ PROTOBUF_NOINLINE void ServiceDescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* ServiceDescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const ServiceDescriptorProto& this_ = static_cast<const ServiceDescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL ServiceDescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const ServiceDescriptorProto& this_ = static_cast<const ServiceDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* ServiceDescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const ServiceDescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL ServiceDescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const ServiceDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceDescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceDescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.ServiceDescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.ServiceDescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // repeated .google.protobuf.MethodDescriptorProto method = 2; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_method_size()); - i < n; i++) { - const auto& repfield = this_._internal_method().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.MethodDescriptorProto method = 2; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_method_size()); + i < n; i++) { + const auto& repfield = this_._internal_method().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - // optional .google.protobuf.ServiceOptions options = 3; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.ServiceOptions options = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ServiceDescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ServiceDescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t ServiceDescriptorProto::ByteSizeLong(const MessageLite& base) { - const ServiceDescriptorProto& this_ = static_cast<const ServiceDescriptorProto&>(base); +::size_t ServiceDescriptorProto::ByteSizeLong(const MessageLite& base) { + const ServiceDescriptorProto& this_ = static_cast<const ServiceDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ServiceDescriptorProto::ByteSizeLong() const { - const ServiceDescriptorProto& this_ = *this; +::size_t ServiceDescriptorProto::ByteSizeLong() const { + const ServiceDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceDescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceDescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.MethodDescriptorProto method = 2; - { - total_size += 1UL * this_._internal_method_size(); - for (const auto& msg : this_._internal_method()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional .google.protobuf.ServiceOptions options = 3; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.MethodDescriptorProto method = 2; + { + total_size += 1UL * this_._internal_method_size(); + for (const auto& msg : this_._internal_method()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional .google.protobuf.ServiceOptions options = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void ServiceDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<ServiceDescriptorProto*>(&to_msg); @@ -7640,15 +7505,14 @@ void ServiceDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, _this->_internal_mutable_method()->MergeFrom( from._internal_method()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::ServiceOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } @@ -7676,7 +7540,7 @@ PROTOBUF_NOINLINE bool ServiceDescriptorProto::IsInitializedImpl( return true; } -void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* PROTOBUF_RESTRICT other) { +void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -7700,18 +7564,19 @@ class MethodDescriptorProto::_Internal { 8 * PROTOBUF_FIELD_OFFSET(MethodDescriptorProto, _impl_._has_bits_); }; -MethodDescriptorProto::MethodDescriptorProto(::google::protobuf::Arena* arena) +MethodDescriptorProto::MethodDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, MethodDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.MethodDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE MethodDescriptorProto::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::MethodDescriptorProto& from_msg) +PROTOBUF_NDEBUG_INLINE MethodDescriptorProto::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::MethodDescriptorProto& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_(arena, from.name_), @@ -7719,10 +7584,10 @@ inline PROTOBUF_NDEBUG_INLINE MethodDescriptorProto::Impl_::Impl_( output_type_(arena, from.output_type_) {} MethodDescriptorProto::MethodDescriptorProto( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MethodDescriptorProto& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, MethodDescriptorProto_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -7732,9 +7597,9 @@ MethodDescriptorProto::MethodDescriptorProto( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.options_ = (cached_has_bits & 0x00000008u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::MethodOptions>( - arena, *from._impl_.options_) - : nullptr; + _impl_.options_ = ((cached_has_bits & 0x00000008u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, client_streaming_), reinterpret_cast<const char *>(&from._impl_) + @@ -7745,15 +7610,15 @@ MethodDescriptorProto::MethodDescriptorProto( // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto) } -inline PROTOBUF_NDEBUG_INLINE MethodDescriptorProto::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE MethodDescriptorProto::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_(arena), input_type_(arena), output_type_(arena) {} -inline void MethodDescriptorProto::SharedCtor(::_pb::Arena* arena) { +inline void MethodDescriptorProto::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, options_), @@ -7777,42 +7642,50 @@ inline void MethodDescriptorProto::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* MethodDescriptorProto::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL MethodDescriptorProto::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) MethodDescriptorProto(arena); } constexpr auto MethodDescriptorProto::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(MethodDescriptorProto), alignof(MethodDescriptorProto)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull MethodDescriptorProto::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_MethodDescriptorProto_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - MethodDescriptorProto::IsInitializedImpl, - &MethodDescriptorProto::MergeImpl, - ::google::protobuf::Message::GetNewImpl<MethodDescriptorProto>(), +constexpr auto MethodDescriptorProto::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_MethodDescriptorProto_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + MethodDescriptorProto::IsInitializedImpl, + &MethodDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl<MethodDescriptorProto>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &MethodDescriptorProto::SharedDtor, - ::google::protobuf::Message::GetClearImpl<MethodDescriptorProto>(), &MethodDescriptorProto::ByteSizeLong, - &MethodDescriptorProto::_InternalSerialize, + &MethodDescriptorProto::SharedDtor, + ::google::protobuf::Message::GetClearImpl<MethodDescriptorProto>(), &MethodDescriptorProto::ByteSizeLong, + &MethodDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(MethodDescriptorProto, _impl_._cached_size_), - false, - }, - &MethodDescriptorProto::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* MethodDescriptorProto::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(MethodDescriptorProto, _impl_._cached_size_), + false, + }, + &MethodDescriptorProto::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 6, 1, 71, 2> MethodDescriptorProto::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + MethodDescriptorProto_class_data_ = + MethodDescriptorProto::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL MethodDescriptorProto::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&MethodDescriptorProto_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(MethodDescriptorProto_class_data_.tc_table); + return MethodDescriptorProto_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 6, 1, 71, 2> +MethodDescriptorProto::_table_ = { { PROTOBUF_FIELD_OFFSET(MethodDescriptorProto, _impl_._has_bits_), 0, // no _extensions_ @@ -7823,7 +7696,7 @@ constexpr ::_pbi::TcParseTable<3, 6, 1, 71, 2> MethodDescriptorProto::_table_ = 6, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + MethodDescriptorProto_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -7871,9 +7744,11 @@ constexpr ::_pbi::TcParseTable<3, 6, 1, 71, 2> MethodDescriptorProto::_table_ = // optional bool server_streaming = 6 [default = false]; {PROTOBUF_FIELD_OFFSET(MethodDescriptorProto, _impl_.server_streaming_), _Internal::kHasBitsOffset + 5, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::MethodOptions>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::MethodOptions>()}, + }}, + {{ "\45\4\12\13\0\0\0\0" "google.protobuf.MethodDescriptorProto" "name" @@ -7881,7 +7756,6 @@ constexpr ::_pbi::TcParseTable<3, 6, 1, 71, 2> MethodDescriptorProto::_table_ = "output_type" }}, }; - PROTOBUF_NOINLINE void MethodDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -7890,17 +7764,17 @@ PROTOBUF_NOINLINE void MethodDescriptorProto::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.input_type_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _impl_.output_type_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { ABSL_DCHECK(_impl_.options_ != nullptr); _impl_.options_->Clear(); } @@ -7913,124 +7787,117 @@ PROTOBUF_NOINLINE void MethodDescriptorProto::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* MethodDescriptorProto::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const MethodDescriptorProto& this_ = static_cast<const MethodDescriptorProto&>(base); +::uint8_t* PROTOBUF_NONNULL MethodDescriptorProto::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const MethodDescriptorProto& this_ = static_cast<const MethodDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* MethodDescriptorProto::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const MethodDescriptorProto& this_ = *this; +::uint8_t* PROTOBUF_NONNULL MethodDescriptorProto::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const MethodDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodDescriptorProto) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodDescriptorProto) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.MethodDescriptorProto.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.MethodDescriptorProto.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional string input_type = 2; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_input_type(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.MethodDescriptorProto.input_type"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + // optional string input_type = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_input_type(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.MethodDescriptorProto.input_type"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // optional string output_type = 3; - if (cached_has_bits & 0x00000004u) { - const std::string& _s = this_._internal_output_type(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.MethodDescriptorProto.output_type"); - target = stream->WriteStringMaybeAliased(3, _s, target); - } + // optional string output_type = 3; + if ((cached_has_bits & 0x00000004u) != 0) { + const std::string& _s = this_._internal_output_type(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.MethodDescriptorProto.output_type"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } - // optional .google.protobuf.MethodOptions options = 4; - if (cached_has_bits & 0x00000008u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.MethodOptions options = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, *this_._impl_.options_, this_._impl_.options_->GetCachedSize(), target, + stream); + } - // optional bool client_streaming = 5 [default = false]; - if (cached_has_bits & 0x00000010u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 5, this_._internal_client_streaming(), target); - } + // optional bool client_streaming = 5 [default = false]; + if ((cached_has_bits & 0x00000010u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this_._internal_client_streaming(), target); + } - // optional bool server_streaming = 6 [default = false]; - if (cached_has_bits & 0x00000020u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 6, this_._internal_server_streaming(), target); - } + // optional bool server_streaming = 6 [default = false]; + if ((cached_has_bits & 0x00000020u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this_._internal_server_streaming(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MethodDescriptorProto) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MethodDescriptorProto) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t MethodDescriptorProto::ByteSizeLong(const MessageLite& base) { - const MethodDescriptorProto& this_ = static_cast<const MethodDescriptorProto&>(base); +::size_t MethodDescriptorProto::ByteSizeLong(const MessageLite& base) { + const MethodDescriptorProto& this_ = static_cast<const MethodDescriptorProto&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t MethodDescriptorProto::ByteSizeLong() const { - const MethodDescriptorProto& this_ = *this; +::size_t MethodDescriptorProto::ByteSizeLong() const { + const MethodDescriptorProto& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodDescriptorProto) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodDescriptorProto) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - // optional string name = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // optional string input_type = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_input_type()); - } - // optional string output_type = 3; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_output_type()); - } - // optional .google.protobuf.MethodOptions options = 4; - if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); - } - // optional bool client_streaming = 5 [default = false]; - if (cached_has_bits & 0x00000010u) { - total_size += 2; - } - // optional bool server_streaming = 6 [default = false]; - if (cached_has_bits & 0x00000020u) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x00000030u & cached_has_bits) * 2; + if ((cached_has_bits & 0x0000000fu) != 0) { + // optional string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + // optional string input_type = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_input_type()); + } + // optional string output_type = 3; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_output_type()); + } + // optional .google.protobuf.MethodOptions options = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.options_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void MethodDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<MethodDescriptorProto*>(&to_msg); @@ -8042,29 +7909,28 @@ void MethodDescriptorProto::MergeImpl(::google::protobuf::MessageLite& to_msg, c (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000003fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name(from._internal_name()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_input_type(from._internal_input_type()); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_internal_set_output_type(from._internal_output_type()); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { ABSL_DCHECK(from._impl_.options_ != nullptr); if (_this->_impl_.options_ == nullptr) { - _this->_impl_.options_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::MethodOptions>(arena, *from._impl_.options_); + _this->_impl_.options_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.options_); } else { _this->_impl_.options_->MergeFrom(*from._impl_.options_); } } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_impl_.client_streaming_ = from._impl_.client_streaming_; } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _this->_impl_.server_streaming_ = from._impl_.server_streaming_; } } @@ -8088,7 +7954,7 @@ PROTOBUF_NOINLINE bool MethodDescriptorProto::IsInitializedImpl( return true; } -void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* PROTOBUF_RESTRICT other) { +void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -8118,18 +7984,19 @@ class FileOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._has_bits_); }; -FileOptions::FileOptions(::google::protobuf::Arena* arena) +FileOptions::FileOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FileOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FileOptions) } -inline PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FileOptions& from_msg) +PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FileOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, @@ -8146,10 +8013,10 @@ inline PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( ruby_package_(arena, from.ruby_package_) {} FileOptions::FileOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FileOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FileOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -8160,9 +8027,9 @@ FileOptions::FileOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000400u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000400u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, java_multiple_files_), reinterpret_cast<const char *>(&from._impl_) + @@ -8173,9 +8040,9 @@ FileOptions::FileOptions( // @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions) } -inline PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, uninterpreted_option_{visibility, arena}, @@ -8192,7 +8059,7 @@ inline PROTOBUF_NDEBUG_INLINE FileOptions::Impl_::Impl_( optimize_for_{static_cast< ::google::protobuf::FileOptions_OptimizeMode >(1)}, cc_enable_arenas_{true} {} -inline void FileOptions::SharedCtor(::_pb::Arena* arena) { +inline void FileOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, features_), @@ -8223,8 +8090,9 @@ inline void FileOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FileOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FileOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FileOptions(arena); } constexpr auto FileOptions::InternalNewImpl_() { @@ -8246,34 +8114,41 @@ constexpr auto FileOptions::InternalNewImpl_() { alignof(FileOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FileOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FileOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FileOptions::IsInitializedImpl, - &FileOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FileOptions>(), +constexpr auto FileOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FileOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FileOptions::IsInitializedImpl, + &FileOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FileOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FileOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FileOptions>(), &FileOptions::ByteSizeLong, - &FileOptions::_InternalSerialize, + &FileOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FileOptions>(), &FileOptions::ByteSizeLong, + &FileOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._cached_size_), - false, - }, - &FileOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FileOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._cached_size_), + false, + }, + &FileOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<5, 21, 3, 202, 12> FileOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FileOptions_class_data_ = + FileOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FileOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FileOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FileOptions_class_data_.tc_table); + return FileOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<5, 21, 3, 202, 12> +FileOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._extensions_), @@ -8284,7 +8159,7 @@ constexpr ::_pbi::TcParseTable<5, 21, 3, 202, 12> FileOptions::_table_ = { 21, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FileOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -8359,8 +8234,9 @@ constexpr ::_pbi::TcParseTable<5, 21, 3, 202, 12> FileOptions::_table_ = { {504, 19, 0, PROTOBUF_FIELD_OFFSET(FileOptions, _impl_.cc_enable_arenas_)}}, }}, {{ 36, 0, 1, - 48324, 12,999, 0, 1, - 65534, 20, + 48324, 12, + 999, 0, 1, + 65534, 20, 65535, 65535 }}, {{ // optional string java_package = 1; @@ -8426,11 +8302,13 @@ constexpr ::_pbi::TcParseTable<5, 21, 3, 202, 12> FileOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(FileOptions, _impl_.uninterpreted_option_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - {1, 3}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + {1, 3}, + }}, + {{ "\33\14\24\0\0\12\0\0\0\0\0\0\0\21\20\14\20\15\26\14\0\0\0\0" "google.protobuf.FileOptions" "java_package" @@ -8445,7 +8323,6 @@ constexpr ::_pbi::TcParseTable<5, 21, 3, 202, 12> FileOptions::_table_ = { "ruby_package" }}, }; - PROTOBUF_NOINLINE void FileOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -8456,50 +8333,50 @@ PROTOBUF_NOINLINE void FileOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x000000ffu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x000000ffu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.java_package_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.java_outer_classname_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _impl_.go_package_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _impl_.objc_class_prefix_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _impl_.csharp_namespace_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _impl_.swift_prefix_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000040u) { + if ((cached_has_bits & 0x00000040u) != 0) { _impl_.php_class_prefix_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000080u) { + if ((cached_has_bits & 0x00000080u) != 0) { _impl_.php_namespace_.ClearNonDefaultToEmpty(); } } - if (cached_has_bits & 0x00000700u) { - if (cached_has_bits & 0x00000100u) { + if ((cached_has_bits & 0x00000700u) != 0) { + if ((cached_has_bits & 0x00000100u) != 0) { _impl_.php_metadata_namespace_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000200u) { + if ((cached_has_bits & 0x00000200u) != 0) { _impl_.ruby_package_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000400u) { + if ((cached_has_bits & 0x00000400u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } } - if (cached_has_bits & 0x0000f800u) { + if ((cached_has_bits & 0x0000f800u) != 0) { ::memset(&_impl_.java_multiple_files_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.java_generic_services_) - reinterpret_cast<char*>(&_impl_.java_multiple_files_)) + sizeof(_impl_.java_generic_services_)); } - if (cached_has_bits & 0x000f0000u) { + if ((cached_has_bits & 0x000f0000u) != 0) { ::memset(&_impl_.py_generic_services_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.deprecated_) - reinterpret_cast<char*>(&_impl_.py_generic_services_)) + sizeof(_impl_.deprecated_)); @@ -8511,321 +8388,291 @@ PROTOBUF_NOINLINE void FileOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FileOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FileOptions& this_ = static_cast<const FileOptions&>(base); +::uint8_t* PROTOBUF_NONNULL FileOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FileOptions& this_ = static_cast<const FileOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FileOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FileOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FileOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FileOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string java_package = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_java_package(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.java_package"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string java_package = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_java_package(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.java_package"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // optional string java_outer_classname = 8; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_java_outer_classname(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.java_outer_classname"); - target = stream->WriteStringMaybeAliased(8, _s, target); - } + // optional string java_outer_classname = 8; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_java_outer_classname(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.java_outer_classname"); + target = stream->WriteStringMaybeAliased(8, _s, target); + } - // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - if (cached_has_bits & 0x00040000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 9, this_._internal_optimize_for(), target); - } + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + if ((cached_has_bits & 0x00040000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 9, this_._internal_optimize_for(), target); + } - // optional bool java_multiple_files = 10 [default = false]; - if (cached_has_bits & 0x00000800u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 10, this_._internal_java_multiple_files(), target); - } + // optional bool java_multiple_files = 10 [default = false]; + if ((cached_has_bits & 0x00000800u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 10, this_._internal_java_multiple_files(), target); + } - // optional string go_package = 11; - if (cached_has_bits & 0x00000004u) { - const std::string& _s = this_._internal_go_package(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.go_package"); - target = stream->WriteStringMaybeAliased(11, _s, target); - } + // optional string go_package = 11; + if ((cached_has_bits & 0x00000004u) != 0) { + const std::string& _s = this_._internal_go_package(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.go_package"); + target = stream->WriteStringMaybeAliased(11, _s, target); + } - // optional bool cc_generic_services = 16 [default = false]; - if (cached_has_bits & 0x00004000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 16, this_._internal_cc_generic_services(), target); - } + // optional bool cc_generic_services = 16 [default = false]; + if ((cached_has_bits & 0x00004000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 16, this_._internal_cc_generic_services(), target); + } - // optional bool java_generic_services = 17 [default = false]; - if (cached_has_bits & 0x00008000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 17, this_._internal_java_generic_services(), target); - } + // optional bool java_generic_services = 17 [default = false]; + if ((cached_has_bits & 0x00008000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 17, this_._internal_java_generic_services(), target); + } - // optional bool py_generic_services = 18 [default = false]; - if (cached_has_bits & 0x00010000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 18, this_._internal_py_generic_services(), target); - } + // optional bool py_generic_services = 18 [default = false]; + if ((cached_has_bits & 0x00010000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 18, this_._internal_py_generic_services(), target); + } - // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - if (cached_has_bits & 0x00001000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 20, this_._internal_java_generate_equals_and_hash(), target); - } + // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + if ((cached_has_bits & 0x00001000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 20, this_._internal_java_generate_equals_and_hash(), target); + } - // optional bool deprecated = 23 [default = false]; - if (cached_has_bits & 0x00020000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 23, this_._internal_deprecated(), target); - } + // optional bool deprecated = 23 [default = false]; + if ((cached_has_bits & 0x00020000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 23, this_._internal_deprecated(), target); + } - // optional bool java_string_check_utf8 = 27 [default = false]; - if (cached_has_bits & 0x00002000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 27, this_._internal_java_string_check_utf8(), target); - } + // optional bool java_string_check_utf8 = 27 [default = false]; + if ((cached_has_bits & 0x00002000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 27, this_._internal_java_string_check_utf8(), target); + } - // optional bool cc_enable_arenas = 31 [default = true]; - if (cached_has_bits & 0x00080000u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 31, this_._internal_cc_enable_arenas(), target); - } + // optional bool cc_enable_arenas = 31 [default = true]; + if ((cached_has_bits & 0x00080000u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 31, this_._internal_cc_enable_arenas(), target); + } - // optional string objc_class_prefix = 36; - if (cached_has_bits & 0x00000008u) { - const std::string& _s = this_._internal_objc_class_prefix(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.objc_class_prefix"); - target = stream->WriteStringMaybeAliased(36, _s, target); - } + // optional string objc_class_prefix = 36; + if ((cached_has_bits & 0x00000008u) != 0) { + const std::string& _s = this_._internal_objc_class_prefix(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.objc_class_prefix"); + target = stream->WriteStringMaybeAliased(36, _s, target); + } - // optional string csharp_namespace = 37; - if (cached_has_bits & 0x00000010u) { - const std::string& _s = this_._internal_csharp_namespace(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.csharp_namespace"); - target = stream->WriteStringMaybeAliased(37, _s, target); - } + // optional string csharp_namespace = 37; + if ((cached_has_bits & 0x00000010u) != 0) { + const std::string& _s = this_._internal_csharp_namespace(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.csharp_namespace"); + target = stream->WriteStringMaybeAliased(37, _s, target); + } - // optional string swift_prefix = 39; - if (cached_has_bits & 0x00000020u) { - const std::string& _s = this_._internal_swift_prefix(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.swift_prefix"); - target = stream->WriteStringMaybeAliased(39, _s, target); - } + // optional string swift_prefix = 39; + if ((cached_has_bits & 0x00000020u) != 0) { + const std::string& _s = this_._internal_swift_prefix(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.swift_prefix"); + target = stream->WriteStringMaybeAliased(39, _s, target); + } - // optional string php_class_prefix = 40; - if (cached_has_bits & 0x00000040u) { - const std::string& _s = this_._internal_php_class_prefix(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.php_class_prefix"); - target = stream->WriteStringMaybeAliased(40, _s, target); - } + // optional string php_class_prefix = 40; + if ((cached_has_bits & 0x00000040u) != 0) { + const std::string& _s = this_._internal_php_class_prefix(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.php_class_prefix"); + target = stream->WriteStringMaybeAliased(40, _s, target); + } - // optional string php_namespace = 41; - if (cached_has_bits & 0x00000080u) { - const std::string& _s = this_._internal_php_namespace(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.php_namespace"); - target = stream->WriteStringMaybeAliased(41, _s, target); - } + // optional string php_namespace = 41; + if ((cached_has_bits & 0x00000080u) != 0) { + const std::string& _s = this_._internal_php_namespace(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.php_namespace"); + target = stream->WriteStringMaybeAliased(41, _s, target); + } - // optional string php_metadata_namespace = 44; - if (cached_has_bits & 0x00000100u) { - const std::string& _s = this_._internal_php_metadata_namespace(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.php_metadata_namespace"); - target = stream->WriteStringMaybeAliased(44, _s, target); - } + // optional string php_metadata_namespace = 44; + if ((cached_has_bits & 0x00000100u) != 0) { + const std::string& _s = this_._internal_php_metadata_namespace(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.php_metadata_namespace"); + target = stream->WriteStringMaybeAliased(44, _s, target); + } - // optional string ruby_package = 45; - if (cached_has_bits & 0x00000200u) { - const std::string& _s = this_._internal_ruby_package(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FileOptions.ruby_package"); - target = stream->WriteStringMaybeAliased(45, _s, target); - } + // optional string ruby_package = 45; + if ((cached_has_bits & 0x00000200u) != 0) { + const std::string& _s = this_._internal_ruby_package(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.ruby_package"); + target = stream->WriteStringMaybeAliased(45, _s, target); + } - // optional .google.protobuf.FeatureSet features = 50; - if (cached_has_bits & 0x00000400u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 50, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 50; + if ((cached_has_bits & 0x00000400u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 50, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FileOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FileOptions::ByteSizeLong(const MessageLite& base) { - const FileOptions& this_ = static_cast<const FileOptions&>(base); +::size_t FileOptions::ByteSizeLong(const MessageLite& base) { + const FileOptions& this_ = static_cast<const FileOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FileOptions::ByteSizeLong() const { - const FileOptions& this_ = *this; +::size_t FileOptions::ByteSizeLong() const { + const FileOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x000000ffu) { - // optional string java_package = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_java_package()); - } - // optional string java_outer_classname = 8; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_java_outer_classname()); - } - // optional string go_package = 11; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_go_package()); - } - // optional string objc_class_prefix = 36; - if (cached_has_bits & 0x00000008u) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_objc_class_prefix()); - } - // optional string csharp_namespace = 37; - if (cached_has_bits & 0x00000010u) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_csharp_namespace()); - } - // optional string swift_prefix = 39; - if (cached_has_bits & 0x00000020u) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_swift_prefix()); - } - // optional string php_class_prefix = 40; - if (cached_has_bits & 0x00000040u) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_php_class_prefix()); - } - // optional string php_namespace = 41; - if (cached_has_bits & 0x00000080u) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_php_namespace()); - } - } - if (cached_has_bits & 0x0000ff00u) { - // optional string php_metadata_namespace = 44; - if (cached_has_bits & 0x00000100u) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_php_metadata_namespace()); - } - // optional string ruby_package = 45; - if (cached_has_bits & 0x00000200u) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_ruby_package()); - } - // optional .google.protobuf.FeatureSet features = 50; - if (cached_has_bits & 0x00000400u) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional bool java_multiple_files = 10 [default = false]; - if (cached_has_bits & 0x00000800u) { - total_size += 2; - } - // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; - if (cached_has_bits & 0x00001000u) { - total_size += 3; - } - // optional bool java_string_check_utf8 = 27 [default = false]; - if (cached_has_bits & 0x00002000u) { - total_size += 3; - } - // optional bool cc_generic_services = 16 [default = false]; - if (cached_has_bits & 0x00004000u) { - total_size += 3; - } - // optional bool java_generic_services = 17 [default = false]; - if (cached_has_bits & 0x00008000u) { - total_size += 3; - } - } - if (cached_has_bits & 0x000f0000u) { - // optional bool py_generic_services = 18 [default = false]; - if (cached_has_bits & 0x00010000u) { - total_size += 3; - } - // optional bool deprecated = 23 [default = false]; - if (cached_has_bits & 0x00020000u) { - total_size += 3; - } - // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; - if (cached_has_bits & 0x00040000u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_optimize_for()); - } - // optional bool cc_enable_arenas = 31 [default = true]; - if (cached_has_bits & 0x00080000u) { - total_size += 3; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x000bf000u & cached_has_bits) * 3; + total_size += static_cast<bool>(0x00000800u & cached_has_bits) * 2; + if ((cached_has_bits & 0x000000ffu) != 0) { + // optional string java_package = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_java_package()); + } + // optional string java_outer_classname = 8; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_java_outer_classname()); + } + // optional string go_package = 11; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_go_package()); + } + // optional string objc_class_prefix = 36; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_objc_class_prefix()); + } + // optional string csharp_namespace = 37; + if ((cached_has_bits & 0x00000010u) != 0) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_csharp_namespace()); + } + // optional string swift_prefix = 39; + if ((cached_has_bits & 0x00000020u) != 0) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_swift_prefix()); + } + // optional string php_class_prefix = 40; + if ((cached_has_bits & 0x00000040u) != 0) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_php_class_prefix()); + } + // optional string php_namespace = 41; + if ((cached_has_bits & 0x00000080u) != 0) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_php_namespace()); + } + } + if ((cached_has_bits & 0x00000700u) != 0) { + // optional string php_metadata_namespace = 44; + if ((cached_has_bits & 0x00000100u) != 0) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_php_metadata_namespace()); + } + // optional string ruby_package = 45; + if ((cached_has_bits & 0x00000200u) != 0) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_ruby_package()); + } + // optional .google.protobuf.FeatureSet features = 50; + if ((cached_has_bits & 0x00000400u) != 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + } + { + // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; + if ((cached_has_bits & 0x00040000u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_optimize_for()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FileOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FileOptions*>(&to_msg); @@ -8839,80 +8686,79 @@ void FileOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x000000ffu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x000000ffu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_java_package(from._internal_java_package()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_java_outer_classname(from._internal_java_outer_classname()); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_internal_set_go_package(from._internal_go_package()); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_internal_set_objc_class_prefix(from._internal_objc_class_prefix()); } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_internal_set_csharp_namespace(from._internal_csharp_namespace()); } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _this->_internal_set_swift_prefix(from._internal_swift_prefix()); } - if (cached_has_bits & 0x00000040u) { + if ((cached_has_bits & 0x00000040u) != 0) { _this->_internal_set_php_class_prefix(from._internal_php_class_prefix()); } - if (cached_has_bits & 0x00000080u) { + if ((cached_has_bits & 0x00000080u) != 0) { _this->_internal_set_php_namespace(from._internal_php_namespace()); } } - if (cached_has_bits & 0x0000ff00u) { - if (cached_has_bits & 0x00000100u) { + if ((cached_has_bits & 0x0000ff00u) != 0) { + if ((cached_has_bits & 0x00000100u) != 0) { _this->_internal_set_php_metadata_namespace(from._internal_php_metadata_namespace()); } - if (cached_has_bits & 0x00000200u) { + if ((cached_has_bits & 0x00000200u) != 0) { _this->_internal_set_ruby_package(from._internal_ruby_package()); } - if (cached_has_bits & 0x00000400u) { + if ((cached_has_bits & 0x00000400u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000800u) { + if ((cached_has_bits & 0x00000800u) != 0) { _this->_impl_.java_multiple_files_ = from._impl_.java_multiple_files_; } - if (cached_has_bits & 0x00001000u) { + if ((cached_has_bits & 0x00001000u) != 0) { _this->_impl_.java_generate_equals_and_hash_ = from._impl_.java_generate_equals_and_hash_; } - if (cached_has_bits & 0x00002000u) { + if ((cached_has_bits & 0x00002000u) != 0) { _this->_impl_.java_string_check_utf8_ = from._impl_.java_string_check_utf8_; } - if (cached_has_bits & 0x00004000u) { + if ((cached_has_bits & 0x00004000u) != 0) { _this->_impl_.cc_generic_services_ = from._impl_.cc_generic_services_; } - if (cached_has_bits & 0x00008000u) { + if ((cached_has_bits & 0x00008000u) != 0) { _this->_impl_.java_generic_services_ = from._impl_.java_generic_services_; } } - if (cached_has_bits & 0x000f0000u) { - if (cached_has_bits & 0x00010000u) { + if ((cached_has_bits & 0x000f0000u) != 0) { + if ((cached_has_bits & 0x00010000u) != 0) { _this->_impl_.py_generic_services_ = from._impl_.py_generic_services_; } - if (cached_has_bits & 0x00020000u) { + if ((cached_has_bits & 0x00020000u) != 0) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } - if (cached_has_bits & 0x00040000u) { + if ((cached_has_bits & 0x00040000u) != 0) { _this->_impl_.optimize_for_ = from._impl_.optimize_for_; } - if (cached_has_bits & 0x00080000u) { + if ((cached_has_bits & 0x00080000u) != 0) { _this->_impl_.cc_enable_arenas_ = from._impl_.cc_enable_arenas_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -8926,8 +8772,7 @@ void FileOptions::CopyFrom(const FileOptions& from) { PROTOBUF_NOINLINE bool FileOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const FileOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -8938,7 +8783,7 @@ PROTOBUF_NOINLINE bool FileOptions::IsInitializedImpl( return true; } -void FileOptions::InternalSwap(FileOptions* PROTOBUF_RESTRICT other) { +void FileOptions::InternalSwap(FileOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); auto* arena = GetArena(); @@ -8977,28 +8822,29 @@ class MessageOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._has_bits_); }; -MessageOptions::MessageOptions(::google::protobuf::Arena* arena) +MessageOptions::MessageOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, MessageOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.MessageOptions) } -inline PROTOBUF_NDEBUG_INLINE MessageOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::MessageOptions& from_msg) +PROTOBUF_NDEBUG_INLINE MessageOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::MessageOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} MessageOptions::MessageOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MessageOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, MessageOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -9009,9 +8855,9 @@ MessageOptions::MessageOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, message_set_wire_format_), reinterpret_cast<const char *>(&from._impl_) + @@ -9022,14 +8868,14 @@ MessageOptions::MessageOptions( // @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions) } -inline PROTOBUF_NDEBUG_INLINE MessageOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE MessageOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, uninterpreted_option_{visibility, arena} {} -inline void MessageOptions::SharedCtor(::_pb::Arena* arena) { +inline void MessageOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, features_), @@ -9050,8 +8896,9 @@ inline void MessageOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* MessageOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL MessageOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) MessageOptions(arena); } constexpr auto MessageOptions::InternalNewImpl_() { @@ -9073,34 +8920,41 @@ constexpr auto MessageOptions::InternalNewImpl_() { alignof(MessageOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull MessageOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_MessageOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - MessageOptions::IsInitializedImpl, - &MessageOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<MessageOptions>(), +constexpr auto MessageOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_MessageOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + MessageOptions::IsInitializedImpl, + &MessageOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<MessageOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &MessageOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<MessageOptions>(), &MessageOptions::ByteSizeLong, - &MessageOptions::_InternalSerialize, + &MessageOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<MessageOptions>(), &MessageOptions::ByteSizeLong, + &MessageOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._cached_size_), - false, - }, - &MessageOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* MessageOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._cached_size_), + false, + }, + &MessageOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 7, 2, 0, 7> MessageOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + MessageOptions_class_data_ = + MessageOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL MessageOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&MessageOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(MessageOptions_class_data_.tc_table); + return MessageOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 7, 2, 0, 7> +MessageOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._extensions_), @@ -9111,7 +8965,7 @@ constexpr ::_pbi::TcParseTable<3, 7, 2, 0, 7> MessageOptions::_table_ = { 7, // num_field_entries 2, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + MessageOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -9162,13 +9016,14 @@ constexpr ::_pbi::TcParseTable<3, 7, 2, 0, 7> MessageOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_.uninterpreted_option_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void MessageOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -9179,11 +9034,11 @@ PROTOBUF_NOINLINE void MessageOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } - if (cached_has_bits & 0x0000003eu) { + if ((cached_has_bits & 0x0000003eu) != 0) { ::memset(&_impl_.message_set_wire_format_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.deprecated_legacy_json_field_conflicts_) - reinterpret_cast<char*>(&_impl_.message_set_wire_format_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_)); @@ -9193,142 +9048,123 @@ PROTOBUF_NOINLINE void MessageOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* MessageOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const MessageOptions& this_ = static_cast<const MessageOptions&>(base); +::uint8_t* PROTOBUF_NONNULL MessageOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const MessageOptions& this_ = static_cast<const MessageOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* MessageOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const MessageOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL MessageOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const MessageOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MessageOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MessageOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool message_set_wire_format = 1 [default = false]; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_message_set_wire_format(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional bool message_set_wire_format = 1 [default = false]; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 1, this_._internal_message_set_wire_format(), target); + } - // optional bool no_standard_descriptor_accessor = 2 [default = false]; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this_._internal_no_standard_descriptor_accessor(), target); - } + // optional bool no_standard_descriptor_accessor = 2 [default = false]; + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 2, this_._internal_no_standard_descriptor_accessor(), target); + } - // optional bool deprecated = 3 [default = false]; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_deprecated(), target); - } + // optional bool deprecated = 3 [default = false]; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this_._internal_deprecated(), target); + } - // optional bool map_entry = 7; - if (cached_has_bits & 0x00000010u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 7, this_._internal_map_entry(), target); - } + // optional bool map_entry = 7; + if ((cached_has_bits & 0x00000010u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 7, this_._internal_map_entry(), target); + } - // optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - if (cached_has_bits & 0x00000020u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 11, this_._internal_deprecated_legacy_json_field_conflicts(), target); - } + // optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + if ((cached_has_bits & 0x00000020u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 11, this_._internal_deprecated_legacy_json_field_conflicts(), target); + } - // optional .google.protobuf.FeatureSet features = 12; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 12, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 12; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 12, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MessageOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MessageOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t MessageOptions::ByteSizeLong(const MessageLite& base) { - const MessageOptions& this_ = static_cast<const MessageOptions&>(base); +::size_t MessageOptions::ByteSizeLong(const MessageLite& base) { + const MessageOptions& this_ = static_cast<const MessageOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t MessageOptions::ByteSizeLong() const { - const MessageOptions& this_ = *this; +::size_t MessageOptions::ByteSizeLong() const { + const MessageOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MessageOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MessageOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - // optional .google.protobuf.FeatureSet features = 12; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional bool message_set_wire_format = 1 [default = false]; - if (cached_has_bits & 0x00000002u) { - total_size += 2; - } - // optional bool no_standard_descriptor_accessor = 2 [default = false]; - if (cached_has_bits & 0x00000004u) { - total_size += 2; - } - // optional bool deprecated = 3 [default = false]; - if (cached_has_bits & 0x00000008u) { - total_size += 2; - } - // optional bool map_entry = 7; - if (cached_has_bits & 0x00000010u) { - total_size += 2; - } - // optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; - if (cached_has_bits & 0x00000020u) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x0000003eu & cached_has_bits) * 2; + { + // optional .google.protobuf.FeatureSet features = 12; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void MessageOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<MessageOptions*>(&to_msg); @@ -9342,34 +9178,33 @@ void MessageOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const :: _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000003fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.message_set_wire_format_ = from._impl_.message_set_wire_format_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.no_standard_descriptor_accessor_ = from._impl_.no_standard_descriptor_accessor_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_impl_.map_entry_ = from._impl_.map_entry_; } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -9383,8 +9218,7 @@ void MessageOptions::CopyFrom(const MessageOptions& from) { PROTOBUF_NOINLINE bool MessageOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const MessageOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -9395,7 +9229,7 @@ PROTOBUF_NOINLINE bool MessageOptions::IsInitializedImpl( return true; } -void MessageOptions::InternalSwap(MessageOptions* PROTOBUF_RESTRICT other) { +void MessageOptions::InternalSwap(MessageOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -9422,27 +9256,28 @@ class FieldOptions_EditionDefault::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FieldOptions_EditionDefault, _impl_._has_bits_); }; -FieldOptions_EditionDefault::FieldOptions_EditionDefault(::google::protobuf::Arena* arena) +FieldOptions_EditionDefault::FieldOptions_EditionDefault(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldOptions_EditionDefault_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldOptions.EditionDefault) } -inline PROTOBUF_NDEBUG_INLINE FieldOptions_EditionDefault::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FieldOptions_EditionDefault& from_msg) +PROTOBUF_NDEBUG_INLINE FieldOptions_EditionDefault::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FieldOptions_EditionDefault& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, value_(arena, from.value_) {} FieldOptions_EditionDefault::FieldOptions_EditionDefault( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldOptions_EditionDefault& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldOptions_EditionDefault_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -9455,13 +9290,13 @@ FieldOptions_EditionDefault::FieldOptions_EditionDefault( // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions.EditionDefault) } -inline PROTOBUF_NDEBUG_INLINE FieldOptions_EditionDefault::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FieldOptions_EditionDefault::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, value_(arena) {} -inline void FieldOptions_EditionDefault::SharedCtor(::_pb::Arena* arena) { +inline void FieldOptions_EditionDefault::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.edition_ = {}; } @@ -9477,42 +9312,50 @@ inline void FieldOptions_EditionDefault::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FieldOptions_EditionDefault::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FieldOptions_EditionDefault::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FieldOptions_EditionDefault(arena); } constexpr auto FieldOptions_EditionDefault::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FieldOptions_EditionDefault), alignof(FieldOptions_EditionDefault)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FieldOptions_EditionDefault::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FieldOptions_EditionDefault_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &FieldOptions_EditionDefault::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FieldOptions_EditionDefault>(), +constexpr auto FieldOptions_EditionDefault::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FieldOptions_EditionDefault_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &FieldOptions_EditionDefault::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FieldOptions_EditionDefault>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldOptions_EditionDefault::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FieldOptions_EditionDefault>(), &FieldOptions_EditionDefault::ByteSizeLong, - &FieldOptions_EditionDefault::_InternalSerialize, + &FieldOptions_EditionDefault::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FieldOptions_EditionDefault>(), &FieldOptions_EditionDefault::ByteSizeLong, + &FieldOptions_EditionDefault::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldOptions_EditionDefault, _impl_._cached_size_), - false, - }, - &FieldOptions_EditionDefault::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FieldOptions_EditionDefault::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FieldOptions_EditionDefault, _impl_._cached_size_), + false, + }, + &FieldOptions_EditionDefault::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<1, 2, 1, 57, 2> FieldOptions_EditionDefault::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FieldOptions_EditionDefault_class_data_ = + FieldOptions_EditionDefault::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FieldOptions_EditionDefault::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FieldOptions_EditionDefault_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FieldOptions_EditionDefault_class_data_.tc_table); + return FieldOptions_EditionDefault_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<1, 2, 1, 57, 2> +FieldOptions_EditionDefault::_table_ = { { PROTOBUF_FIELD_OFFSET(FieldOptions_EditionDefault, _impl_._has_bits_), 0, // no _extensions_ @@ -9523,7 +9366,7 @@ constexpr ::_pbi::TcParseTable<1, 2, 1, 57, 2> FieldOptions_EditionDefault::_tab 2, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FieldOptions_EditionDefault_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -9545,15 +9388,16 @@ constexpr ::_pbi::TcParseTable<1, 2, 1, 57, 2> FieldOptions_EditionDefault::_tab // optional .google.protobuf.Edition edition = 3; {PROTOBUF_FIELD_OFFSET(FieldOptions_EditionDefault, _impl_.edition_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kEnum)}, - }}, {{ - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - }}, {{ + }}, + {{ + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + }}, + {{ "\53\5\0\0\0\0\0\0" "google.protobuf.FieldOptions.EditionDefault" "value" }}, }; - PROTOBUF_NOINLINE void FieldOptions_EditionDefault::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions.EditionDefault) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -9562,7 +9406,7 @@ PROTOBUF_NOINLINE void FieldOptions_EditionDefault::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.value_.ClearNonDefaultToEmpty(); } _impl_.edition_ = 0; @@ -9571,76 +9415,76 @@ PROTOBUF_NOINLINE void FieldOptions_EditionDefault::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FieldOptions_EditionDefault::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FieldOptions_EditionDefault& this_ = static_cast<const FieldOptions_EditionDefault&>(base); +::uint8_t* PROTOBUF_NONNULL FieldOptions_EditionDefault::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FieldOptions_EditionDefault& this_ = static_cast<const FieldOptions_EditionDefault&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FieldOptions_EditionDefault::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FieldOptions_EditionDefault& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FieldOptions_EditionDefault::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FieldOptions_EditionDefault& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions.EditionDefault) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions.EditionDefault) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string value = 2; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_value(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FieldOptions.EditionDefault.value"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string value = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_value(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldOptions.EditionDefault.value"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // optional .google.protobuf.Edition edition = 3; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 3, this_._internal_edition(), target); - } + // optional .google.protobuf.Edition edition = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this_._internal_edition(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldOptions.EditionDefault) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldOptions.EditionDefault) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FieldOptions_EditionDefault::ByteSizeLong(const MessageLite& base) { - const FieldOptions_EditionDefault& this_ = static_cast<const FieldOptions_EditionDefault&>(base); +::size_t FieldOptions_EditionDefault::ByteSizeLong(const MessageLite& base) { + const FieldOptions_EditionDefault& this_ = static_cast<const FieldOptions_EditionDefault&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FieldOptions_EditionDefault::ByteSizeLong() const { - const FieldOptions_EditionDefault& this_ = *this; +::size_t FieldOptions_EditionDefault::ByteSizeLong() const { + const FieldOptions_EditionDefault& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldOptions.EditionDefault) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldOptions.EditionDefault) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string value = 2; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_value()); - } - // optional .google.protobuf.Edition edition = 3; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional string value = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_value()); + } + // optional .google.protobuf.Edition edition = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FieldOptions_EditionDefault::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FieldOptions_EditionDefault*>(&to_msg); @@ -9651,11 +9495,11 @@ void FieldOptions_EditionDefault::MergeImpl(::google::protobuf::MessageLite& to_ (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_value(from._internal_value()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.edition_ = from._impl_.edition_; } } @@ -9671,7 +9515,7 @@ void FieldOptions_EditionDefault::CopyFrom(const FieldOptions_EditionDefault& fr } -void FieldOptions_EditionDefault::InternalSwap(FieldOptions_EditionDefault* PROTOBUF_RESTRICT other) { +void FieldOptions_EditionDefault::InternalSwap(FieldOptions_EditionDefault* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -9694,27 +9538,28 @@ class FieldOptions_FeatureSupport::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FieldOptions_FeatureSupport, _impl_._has_bits_); }; -FieldOptions_FeatureSupport::FieldOptions_FeatureSupport(::google::protobuf::Arena* arena) +FieldOptions_FeatureSupport::FieldOptions_FeatureSupport(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldOptions_FeatureSupport_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldOptions.FeatureSupport) } -inline PROTOBUF_NDEBUG_INLINE FieldOptions_FeatureSupport::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FieldOptions_FeatureSupport& from_msg) +PROTOBUF_NDEBUG_INLINE FieldOptions_FeatureSupport::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FieldOptions_FeatureSupport& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, deprecation_warning_(arena, from.deprecation_warning_) {} FieldOptions_FeatureSupport::FieldOptions_FeatureSupport( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldOptions_FeatureSupport& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldOptions_FeatureSupport_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -9733,13 +9578,13 @@ FieldOptions_FeatureSupport::FieldOptions_FeatureSupport( // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions.FeatureSupport) } -inline PROTOBUF_NDEBUG_INLINE FieldOptions_FeatureSupport::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FieldOptions_FeatureSupport::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, deprecation_warning_(arena) {} -inline void FieldOptions_FeatureSupport::SharedCtor(::_pb::Arena* arena) { +inline void FieldOptions_FeatureSupport::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, edition_introduced_), @@ -9760,42 +9605,50 @@ inline void FieldOptions_FeatureSupport::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FieldOptions_FeatureSupport::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FieldOptions_FeatureSupport::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FieldOptions_FeatureSupport(arena); } constexpr auto FieldOptions_FeatureSupport::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FieldOptions_FeatureSupport), alignof(FieldOptions_FeatureSupport)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FieldOptions_FeatureSupport::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FieldOptions_FeatureSupport_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &FieldOptions_FeatureSupport::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FieldOptions_FeatureSupport>(), +constexpr auto FieldOptions_FeatureSupport::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FieldOptions_FeatureSupport_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &FieldOptions_FeatureSupport::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FieldOptions_FeatureSupport>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldOptions_FeatureSupport::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FieldOptions_FeatureSupport>(), &FieldOptions_FeatureSupport::ByteSizeLong, - &FieldOptions_FeatureSupport::_InternalSerialize, + &FieldOptions_FeatureSupport::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FieldOptions_FeatureSupport>(), &FieldOptions_FeatureSupport::ByteSizeLong, + &FieldOptions_FeatureSupport::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldOptions_FeatureSupport, _impl_._cached_size_), - false, - }, - &FieldOptions_FeatureSupport::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FieldOptions_FeatureSupport::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FieldOptions_FeatureSupport, _impl_._cached_size_), + false, + }, + &FieldOptions_FeatureSupport::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<2, 4, 3, 71, 2> FieldOptions_FeatureSupport::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FieldOptions_FeatureSupport_class_data_ = + FieldOptions_FeatureSupport::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FieldOptions_FeatureSupport::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FieldOptions_FeatureSupport_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FieldOptions_FeatureSupport_class_data_.tc_table); + return FieldOptions_FeatureSupport_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<2, 4, 3, 71, 2> +FieldOptions_FeatureSupport::_table_ = { { PROTOBUF_FIELD_OFFSET(FieldOptions_FeatureSupport, _impl_._has_bits_), 0, // no _extensions_ @@ -9806,7 +9659,7 @@ constexpr ::_pbi::TcParseTable<2, 4, 3, 71, 2> FieldOptions_FeatureSupport::_tab 4, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FieldOptions_FeatureSupport_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -9840,17 +9693,18 @@ constexpr ::_pbi::TcParseTable<2, 4, 3, 71, 2> FieldOptions_FeatureSupport::_tab // optional .google.protobuf.Edition edition_removed = 4; {PROTOBUF_FIELD_OFFSET(FieldOptions_FeatureSupport, _impl_.edition_removed_), _Internal::kHasBitsOffset + 3, 2, (0 | ::_fl::kFcOptional | ::_fl::kEnum)}, - }}, {{ - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - }}, {{ + }}, + {{ + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + }}, + {{ "\53\0\0\23\0\0\0\0" "google.protobuf.FieldOptions.FeatureSupport" "deprecation_warning" }}, }; - PROTOBUF_NOINLINE void FieldOptions_FeatureSupport::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions.FeatureSupport) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -9859,10 +9713,10 @@ PROTOBUF_NOINLINE void FieldOptions_FeatureSupport::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.deprecation_warning_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x0000000eu) { + if ((cached_has_bits & 0x0000000eu) != 0) { ::memset(&_impl_.edition_introduced_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.edition_removed_) - reinterpret_cast<char*>(&_impl_.edition_introduced_)) + sizeof(_impl_.edition_removed_)); @@ -9872,100 +9726,100 @@ PROTOBUF_NOINLINE void FieldOptions_FeatureSupport::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FieldOptions_FeatureSupport::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FieldOptions_FeatureSupport& this_ = static_cast<const FieldOptions_FeatureSupport&>(base); +::uint8_t* PROTOBUF_NONNULL FieldOptions_FeatureSupport::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FieldOptions_FeatureSupport& this_ = static_cast<const FieldOptions_FeatureSupport&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FieldOptions_FeatureSupport::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FieldOptions_FeatureSupport& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FieldOptions_FeatureSupport::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FieldOptions_FeatureSupport& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions.FeatureSupport) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions.FeatureSupport) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.Edition edition_introduced = 1; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this_._internal_edition_introduced(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional .google.protobuf.Edition edition_introduced = 1; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this_._internal_edition_introduced(), target); + } - // optional .google.protobuf.Edition edition_deprecated = 2; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 2, this_._internal_edition_deprecated(), target); - } + // optional .google.protobuf.Edition edition_deprecated = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this_._internal_edition_deprecated(), target); + } - // optional string deprecation_warning = 3; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_deprecation_warning(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.FieldOptions.FeatureSupport.deprecation_warning"); - target = stream->WriteStringMaybeAliased(3, _s, target); - } + // optional string deprecation_warning = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_deprecation_warning(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldOptions.FeatureSupport.deprecation_warning"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } - // optional .google.protobuf.Edition edition_removed = 4; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 4, this_._internal_edition_removed(), target); - } + // optional .google.protobuf.Edition edition_removed = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 4, this_._internal_edition_removed(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldOptions.FeatureSupport) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldOptions.FeatureSupport) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FieldOptions_FeatureSupport::ByteSizeLong(const MessageLite& base) { - const FieldOptions_FeatureSupport& this_ = static_cast<const FieldOptions_FeatureSupport&>(base); +::size_t FieldOptions_FeatureSupport::ByteSizeLong(const MessageLite& base) { + const FieldOptions_FeatureSupport& this_ = static_cast<const FieldOptions_FeatureSupport&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FieldOptions_FeatureSupport::ByteSizeLong() const { - const FieldOptions_FeatureSupport& this_ = *this; +::size_t FieldOptions_FeatureSupport::ByteSizeLong() const { + const FieldOptions_FeatureSupport& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldOptions.FeatureSupport) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldOptions.FeatureSupport) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional string deprecation_warning = 3; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_deprecation_warning()); - } - // optional .google.protobuf.Edition edition_introduced = 1; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_introduced()); - } - // optional .google.protobuf.Edition edition_deprecated = 2; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_deprecated()); - } - // optional .google.protobuf.Edition edition_removed = 4; - if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_removed()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // optional string deprecation_warning = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_deprecation_warning()); + } + // optional .google.protobuf.Edition edition_introduced = 1; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_introduced()); + } + // optional .google.protobuf.Edition edition_deprecated = 2; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_deprecated()); + } + // optional .google.protobuf.Edition edition_removed = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_edition_removed()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FieldOptions_FeatureSupport::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FieldOptions_FeatureSupport*>(&to_msg); @@ -9976,17 +9830,17 @@ void FieldOptions_FeatureSupport::MergeImpl(::google::protobuf::MessageLite& to_ (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_deprecation_warning(from._internal_deprecation_warning()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.edition_introduced_ = from._impl_.edition_introduced_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.edition_deprecated_ = from._impl_.edition_deprecated_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.edition_removed_ = from._impl_.edition_removed_; } } @@ -10002,7 +9856,7 @@ void FieldOptions_FeatureSupport::CopyFrom(const FieldOptions_FeatureSupport& fr } -void FieldOptions_FeatureSupport::InternalSwap(FieldOptions_FeatureSupport* PROTOBUF_RESTRICT other) { +void FieldOptions_FeatureSupport::InternalSwap(FieldOptions_FeatureSupport* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -10030,18 +9884,19 @@ class FieldOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._has_bits_); }; -FieldOptions::FieldOptions(::google::protobuf::Arena* arena) +FieldOptions::FieldOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldOptions) } -inline PROTOBUF_NDEBUG_INLINE FieldOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FieldOptions& from_msg) +PROTOBUF_NDEBUG_INLINE FieldOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FieldOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, @@ -10050,10 +9905,10 @@ inline PROTOBUF_NDEBUG_INLINE FieldOptions::Impl_::Impl_( uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} FieldOptions::FieldOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -10064,12 +9919,12 @@ FieldOptions::FieldOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; - _impl_.feature_support_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions_FeatureSupport>( - arena, *from._impl_.feature_support_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; + _impl_.feature_support_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.feature_support_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, ctype_), reinterpret_cast<const char *>(&from._impl_) + @@ -10080,16 +9935,16 @@ FieldOptions::FieldOptions( // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions) } -inline PROTOBUF_NDEBUG_INLINE FieldOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FieldOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, targets_{visibility, arena}, edition_defaults_{visibility, arena}, uninterpreted_option_{visibility, arena} {} -inline void FieldOptions::SharedCtor(::_pb::Arena* arena) { +inline void FieldOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, features_), @@ -10111,8 +9966,9 @@ inline void FieldOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FieldOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FieldOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FieldOptions(arena); } constexpr auto FieldOptions::InternalNewImpl_() { @@ -10142,34 +9998,41 @@ constexpr auto FieldOptions::InternalNewImpl_() { alignof(FieldOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FieldOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FieldOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FieldOptions::IsInitializedImpl, - &FieldOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FieldOptions>(), +constexpr auto FieldOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FieldOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FieldOptions::IsInitializedImpl, + &FieldOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FieldOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FieldOptions>(), &FieldOptions::ByteSizeLong, - &FieldOptions::_InternalSerialize, + &FieldOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FieldOptions>(), &FieldOptions::ByteSizeLong, + &FieldOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._cached_size_), - false, - }, - &FieldOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FieldOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._cached_size_), + false, + }, + &FieldOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<4, 14, 8, 0, 7> FieldOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FieldOptions_class_data_ = + FieldOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FieldOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FieldOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FieldOptions_class_data_.tc_table); + return FieldOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<4, 14, 8, 0, 7> +FieldOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._extensions_), @@ -10180,7 +10043,7 @@ constexpr ::_pbi::TcParseTable<4, 14, 8, 0, 7> FieldOptions::_table_ = { 14, // num_field_entries 8, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FieldOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -10270,19 +10133,20 @@ constexpr ::_pbi::TcParseTable<4, 14, 8, 0, 7> FieldOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.uninterpreted_option_), -1, 3, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_EditionDefault>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_FeatureSupport>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - {0, 3}, - {0, 3}, - {0, 3}, - {0, 10}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_EditionDefault>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_FeatureSupport>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + {0, 3}, + {0, 3}, + {0, 3}, + {0, 10}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void FieldOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -10295,22 +10159,22 @@ PROTOBUF_NOINLINE void FieldOptions::Clear() { _impl_.edition_defaults_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.feature_support_ != nullptr); _impl_.feature_support_->Clear(); } } - if (cached_has_bits & 0x000000fcu) { + if ((cached_has_bits & 0x000000fcu) != 0) { ::memset(&_impl_.ctype_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.deprecated_) - reinterpret_cast<char*>(&_impl_.ctype_)) + sizeof(_impl_.deprecated_)); } - if (cached_has_bits & 0x00000700u) { + if ((cached_has_bits & 0x00000700u) != 0) { ::memset(&_impl_.weak_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.retention_) - reinterpret_cast<char*>(&_impl_.weak_)) + sizeof(_impl_.retention_)); @@ -10320,237 +10184,215 @@ PROTOBUF_NOINLINE void FieldOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FieldOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FieldOptions& this_ = static_cast<const FieldOptions&>(base); +::uint8_t* PROTOBUF_NONNULL FieldOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FieldOptions& this_ = static_cast<const FieldOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FieldOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FieldOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FieldOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FieldOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this_._internal_ctype(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this_._internal_ctype(), target); + } - // optional bool packed = 2; - if (cached_has_bits & 0x00000010u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this_._internal_packed(), target); - } + // optional bool packed = 2; + if ((cached_has_bits & 0x00000010u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 2, this_._internal_packed(), target); + } - // optional bool deprecated = 3 [default = false]; - if (cached_has_bits & 0x00000080u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_deprecated(), target); - } + // optional bool deprecated = 3 [default = false]; + if ((cached_has_bits & 0x00000080u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this_._internal_deprecated(), target); + } - // optional bool lazy = 5 [default = false]; - if (cached_has_bits & 0x00000020u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 5, this_._internal_lazy(), target); - } + // optional bool lazy = 5 [default = false]; + if ((cached_has_bits & 0x00000020u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this_._internal_lazy(), target); + } - // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 6, this_._internal_jstype(), target); - } + // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 6, this_._internal_jstype(), target); + } - // optional bool weak = 10 [default = false]; - if (cached_has_bits & 0x00000100u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 10, this_._internal_weak(), target); - } + // optional bool weak = 10 [default = false]; + if ((cached_has_bits & 0x00000100u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 10, this_._internal_weak(), target); + } - // optional bool unverified_lazy = 15 [default = false]; - if (cached_has_bits & 0x00000040u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 15, this_._internal_unverified_lazy(), target); - } + // optional bool unverified_lazy = 15 [default = false]; + if ((cached_has_bits & 0x00000040u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 15, this_._internal_unverified_lazy(), target); + } - // optional bool debug_redact = 16 [default = false]; - if (cached_has_bits & 0x00000200u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 16, this_._internal_debug_redact(), target); - } + // optional bool debug_redact = 16 [default = false]; + if ((cached_has_bits & 0x00000200u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 16, this_._internal_debug_redact(), target); + } - // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; - if (cached_has_bits & 0x00000400u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 17, this_._internal_retention(), target); - } + // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; + if ((cached_has_bits & 0x00000400u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 17, this_._internal_retention(), target); + } - // repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19; - for (int i = 0, n = this_._internal_targets_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 19, static_cast<::google::protobuf::FieldOptions_OptionTargetType>(this_._internal_targets().Get(i)), - target); - } + // repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19; + for (int i = 0, n = this_._internal_targets_size(); i < n; ++i) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 19, static_cast<::google::protobuf::FieldOptions_OptionTargetType>(this_._internal_targets().Get(i)), + target); + } - // repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_edition_defaults_size()); - i < n; i++) { - const auto& repfield = this_._internal_edition_defaults().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 20, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_edition_defaults_size()); + i < n; i++) { + const auto& repfield = this_._internal_edition_defaults().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 20, repfield, repfield.GetCachedSize(), + target, stream); + } - // optional .google.protobuf.FeatureSet features = 21; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 21, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 21; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 21, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 22, *this_._impl_.feature_support_, this_._impl_.feature_support_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 22, *this_._impl_.feature_support_, this_._impl_.feature_support_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FieldOptions::ByteSizeLong(const MessageLite& base) { - const FieldOptions& this_ = static_cast<const FieldOptions&>(base); +::size_t FieldOptions::ByteSizeLong(const MessageLite& base) { + const FieldOptions& this_ = static_cast<const FieldOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FieldOptions::ByteSizeLong() const { - const FieldOptions& this_ = *this; +::size_t FieldOptions::ByteSizeLong() const { + const FieldOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19; - { - std::size_t data_size = - ::_pbi::WireFormatLite::EnumSize(this_._internal_targets()); - std::size_t tag_size = std::size_t{2} * - ::_pbi::FromIntSize(this_._internal_targets_size()); - total_size += data_size + tag_size; - } - // repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20; - { - total_size += 2UL * this_._internal_edition_defaults_size(); - for (const auto& msg : this_._internal_edition_defaults()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x000000ffu) { - // optional .google.protobuf.FeatureSet features = 21; - if (cached_has_bits & 0x00000001u) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22; - if (cached_has_bits & 0x00000002u) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.feature_support_); - } - // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_ctype()); - } - // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; - if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_jstype()); - } - // optional bool packed = 2; - if (cached_has_bits & 0x00000010u) { - total_size += 2; - } - // optional bool lazy = 5 [default = false]; - if (cached_has_bits & 0x00000020u) { - total_size += 2; - } - // optional bool unverified_lazy = 15 [default = false]; - if (cached_has_bits & 0x00000040u) { - total_size += 2; - } - // optional bool deprecated = 3 [default = false]; - if (cached_has_bits & 0x00000080u) { - total_size += 2; - } - } - if (cached_has_bits & 0x00000700u) { - // optional bool weak = 10 [default = false]; - if (cached_has_bits & 0x00000100u) { - total_size += 2; - } - // optional bool debug_redact = 16 [default = false]; - if (cached_has_bits & 0x00000200u) { - total_size += 3; - } - // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; - if (cached_has_bits & 0x00000400u) { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_retention()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19; + { + std::size_t data_size = + ::_pbi::WireFormatLite::EnumSize(this_._internal_targets()); + std::size_t tag_size = std::size_t{2} * + ::_pbi::FromIntSize(this_._internal_targets_size()); + total_size += data_size + tag_size; + } + // repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20; + { + total_size += 2UL * this_._internal_edition_defaults_size(); + for (const auto& msg : this_._internal_edition_defaults()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += static_cast<bool>(0x00000200u & cached_has_bits) * 3; + total_size += ::absl::popcount(0x000001f0u & cached_has_bits) * 2; + if ((cached_has_bits & 0x0000000fu) != 0) { + // optional .google.protobuf.FeatureSet features = 21; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.feature_support_); + } + // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_ctype()); + } + // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_jstype()); + } + } + { + // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; + if ((cached_has_bits & 0x00000400u) != 0) { + total_size += 2 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_retention()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FieldOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FieldOptions*>(&to_msg); @@ -10567,57 +10409,55 @@ void FieldOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::go _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x000000ffu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x000000ffu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.feature_support_ != nullptr); if (_this->_impl_.feature_support_ == nullptr) { - _this->_impl_.feature_support_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions_FeatureSupport>(arena, *from._impl_.feature_support_); + _this->_impl_.feature_support_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.feature_support_); } else { _this->_impl_.feature_support_->MergeFrom(*from._impl_.feature_support_); } } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.ctype_ = from._impl_.ctype_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.jstype_ = from._impl_.jstype_; } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_impl_.packed_ = from._impl_.packed_; } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _this->_impl_.lazy_ = from._impl_.lazy_; } - if (cached_has_bits & 0x00000040u) { + if ((cached_has_bits & 0x00000040u) != 0) { _this->_impl_.unverified_lazy_ = from._impl_.unverified_lazy_; } - if (cached_has_bits & 0x00000080u) { + if ((cached_has_bits & 0x00000080u) != 0) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } } - if (cached_has_bits & 0x00000700u) { - if (cached_has_bits & 0x00000100u) { + if ((cached_has_bits & 0x00000700u) != 0) { + if ((cached_has_bits & 0x00000100u) != 0) { _this->_impl_.weak_ = from._impl_.weak_; } - if (cached_has_bits & 0x00000200u) { + if ((cached_has_bits & 0x00000200u) != 0) { _this->_impl_.debug_redact_ = from._impl_.debug_redact_; } - if (cached_has_bits & 0x00000400u) { + if ((cached_has_bits & 0x00000400u) != 0) { _this->_impl_.retention_ = from._impl_.retention_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -10631,8 +10471,7 @@ void FieldOptions::CopyFrom(const FieldOptions& from) { PROTOBUF_NOINLINE bool FieldOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const FieldOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -10643,7 +10482,7 @@ PROTOBUF_NOINLINE bool FieldOptions::IsInitializedImpl( return true; } -void FieldOptions::InternalSwap(FieldOptions* PROTOBUF_RESTRICT other) { +void FieldOptions::InternalSwap(FieldOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -10672,28 +10511,29 @@ class OneofOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._has_bits_); }; -OneofOptions::OneofOptions(::google::protobuf::Arena* arena) +OneofOptions::OneofOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, OneofOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.OneofOptions) } -inline PROTOBUF_NDEBUG_INLINE OneofOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::OneofOptions& from_msg) +PROTOBUF_NDEBUG_INLINE OneofOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::OneofOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} OneofOptions::OneofOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const OneofOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, OneofOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -10704,20 +10544,20 @@ OneofOptions::OneofOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofOptions) } -inline PROTOBUF_NDEBUG_INLINE OneofOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE OneofOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, uninterpreted_option_{visibility, arena} {} -inline void OneofOptions::SharedCtor(::_pb::Arena* arena) { +inline void OneofOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.features_ = {}; } @@ -10733,8 +10573,9 @@ inline void OneofOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* OneofOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL OneofOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) OneofOptions(arena); } constexpr auto OneofOptions::InternalNewImpl_() { @@ -10756,34 +10597,41 @@ constexpr auto OneofOptions::InternalNewImpl_() { alignof(OneofOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull OneofOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_OneofOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - OneofOptions::IsInitializedImpl, - &OneofOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<OneofOptions>(), +constexpr auto OneofOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_OneofOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + OneofOptions::IsInitializedImpl, + &OneofOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<OneofOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &OneofOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<OneofOptions>(), &OneofOptions::ByteSizeLong, - &OneofOptions::_InternalSerialize, + &OneofOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<OneofOptions>(), &OneofOptions::ByteSizeLong, + &OneofOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._cached_size_), - false, - }, - &OneofOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* OneofOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._cached_size_), + false, + }, + &OneofOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<2, 2, 2, 0, 7> OneofOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + OneofOptions_class_data_ = + OneofOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL OneofOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&OneofOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(OneofOptions_class_data_.tc_table); + return OneofOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<2, 2, 2, 0, 7> +OneofOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._extensions_), @@ -10794,7 +10642,7 @@ constexpr ::_pbi::TcParseTable<2, 2, 2, 0, 7> OneofOptions::_table_ = { 2, // num_field_entries 2, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + OneofOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -10820,13 +10668,14 @@ constexpr ::_pbi::TcParseTable<2, 2, 2, 0, 7> OneofOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_.uninterpreted_option_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void OneofOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -10837,7 +10686,7 @@ PROTOBUF_NOINLINE void OneofOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } @@ -10846,87 +10695,87 @@ PROTOBUF_NOINLINE void OneofOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* OneofOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const OneofOptions& this_ = static_cast<const OneofOptions&>(base); +::uint8_t* PROTOBUF_NONNULL OneofOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const OneofOptions& this_ = static_cast<const OneofOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* OneofOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const OneofOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL OneofOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const OneofOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.FeatureSet features = 1; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional .google.protobuf.FeatureSet features = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.OneofOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.OneofOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t OneofOptions::ByteSizeLong(const MessageLite& base) { - const OneofOptions& this_ = static_cast<const OneofOptions&>(base); +::size_t OneofOptions::ByteSizeLong(const MessageLite& base) { + const OneofOptions& this_ = static_cast<const OneofOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t OneofOptions::ByteSizeLong() const { - const OneofOptions& this_ = *this; +::size_t OneofOptions::ByteSizeLong() const { + const OneofOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - { - // optional .google.protobuf.FeatureSet features = 1; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + { + // optional .google.protobuf.FeatureSet features = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void OneofOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<OneofOptions*>(&to_msg); @@ -10940,17 +10789,16 @@ void OneofOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::go _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -10964,8 +10812,7 @@ void OneofOptions::CopyFrom(const OneofOptions& from) { PROTOBUF_NOINLINE bool OneofOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const OneofOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -10976,7 +10823,7 @@ PROTOBUF_NOINLINE bool OneofOptions::IsInitializedImpl( return true; } -void OneofOptions::InternalSwap(OneofOptions* PROTOBUF_RESTRICT other) { +void OneofOptions::InternalSwap(OneofOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -10998,28 +10845,29 @@ class EnumOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._has_bits_); }; -EnumOptions::EnumOptions(::google::protobuf::Arena* arena) +EnumOptions::EnumOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumOptions) } -inline PROTOBUF_NDEBUG_INLINE EnumOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::EnumOptions& from_msg) +PROTOBUF_NDEBUG_INLINE EnumOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::EnumOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} EnumOptions::EnumOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -11030,9 +10878,9 @@ EnumOptions::EnumOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, allow_alias_), reinterpret_cast<const char *>(&from._impl_) + @@ -11043,14 +10891,14 @@ EnumOptions::EnumOptions( // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions) } -inline PROTOBUF_NDEBUG_INLINE EnumOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE EnumOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, uninterpreted_option_{visibility, arena} {} -inline void EnumOptions::SharedCtor(::_pb::Arena* arena) { +inline void EnumOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, features_), @@ -11071,8 +10919,9 @@ inline void EnumOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* EnumOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL EnumOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumOptions(arena); } constexpr auto EnumOptions::InternalNewImpl_() { @@ -11094,34 +10943,41 @@ constexpr auto EnumOptions::InternalNewImpl_() { alignof(EnumOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull EnumOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_EnumOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - EnumOptions::IsInitializedImpl, - &EnumOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<EnumOptions>(), +constexpr auto EnumOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_EnumOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + EnumOptions::IsInitializedImpl, + &EnumOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<EnumOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &EnumOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<EnumOptions>(), &EnumOptions::ByteSizeLong, - &EnumOptions::_InternalSerialize, + &EnumOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<EnumOptions>(), &EnumOptions::ByteSizeLong, + &EnumOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._cached_size_), - false, - }, - &EnumOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* EnumOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._cached_size_), + false, + }, + &EnumOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 5, 2, 0, 7> EnumOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + EnumOptions_class_data_ = + EnumOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL EnumOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&EnumOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(EnumOptions_class_data_.tc_table); + return EnumOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 5, 2, 0, 7> +EnumOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._extensions_), @@ -11132,7 +10988,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 2, 0, 7> EnumOptions::_table_ = { 5, // num_field_entries 2, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + EnumOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -11175,13 +11031,14 @@ constexpr ::_pbi::TcParseTable<3, 5, 2, 0, 7> EnumOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_.uninterpreted_option_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void EnumOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -11192,7 +11049,7 @@ PROTOBUF_NOINLINE void EnumOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } @@ -11204,120 +11061,109 @@ PROTOBUF_NOINLINE void EnumOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* EnumOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const EnumOptions& this_ = static_cast<const EnumOptions&>(base); +::uint8_t* PROTOBUF_NONNULL EnumOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const EnumOptions& this_ = static_cast<const EnumOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* EnumOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const EnumOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL EnumOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const EnumOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool allow_alias = 2; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this_._internal_allow_alias(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional bool allow_alias = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 2, this_._internal_allow_alias(), target); + } - // optional bool deprecated = 3 [default = false]; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_deprecated(), target); - } + // optional bool deprecated = 3 [default = false]; + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this_._internal_deprecated(), target); + } - // optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 6, this_._internal_deprecated_legacy_json_field_conflicts(), target); - } + // optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this_._internal_deprecated_legacy_json_field_conflicts(), target); + } - // optional .google.protobuf.FeatureSet features = 7; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 7, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 7; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 7, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t EnumOptions::ByteSizeLong(const MessageLite& base) { - const EnumOptions& this_ = static_cast<const EnumOptions&>(base); +::size_t EnumOptions::ByteSizeLong(const MessageLite& base) { + const EnumOptions& this_ = static_cast<const EnumOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t EnumOptions::ByteSizeLong() const { - const EnumOptions& this_ = *this; +::size_t EnumOptions::ByteSizeLong() const { + const EnumOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional .google.protobuf.FeatureSet features = 7; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional bool allow_alias = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 2; - } - // optional bool deprecated = 3 [default = false]; - if (cached_has_bits & 0x00000004u) { - total_size += 2; - } - // optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; - if (cached_has_bits & 0x00000008u) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x0000000eu & cached_has_bits) * 2; + { + // optional .google.protobuf.FeatureSet features = 7; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void EnumOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<EnumOptions*>(&to_msg); @@ -11331,28 +11177,27 @@ void EnumOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.allow_alias_ = from._impl_.allow_alias_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -11366,8 +11211,7 @@ void EnumOptions::CopyFrom(const EnumOptions& from) { PROTOBUF_NOINLINE bool EnumOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const EnumOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -11378,7 +11222,7 @@ PROTOBUF_NOINLINE bool EnumOptions::IsInitializedImpl( return true; } -void EnumOptions::InternalSwap(EnumOptions* PROTOBUF_RESTRICT other) { +void EnumOptions::InternalSwap(EnumOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -11405,28 +11249,29 @@ class EnumValueOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._has_bits_); }; -EnumValueOptions::EnumValueOptions(::google::protobuf::Arena* arena) +EnumValueOptions::EnumValueOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumValueOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValueOptions) } -inline PROTOBUF_NDEBUG_INLINE EnumValueOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::EnumValueOptions& from_msg) +PROTOBUF_NDEBUG_INLINE EnumValueOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::EnumValueOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} EnumValueOptions::EnumValueOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumValueOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumValueOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -11437,12 +11282,12 @@ EnumValueOptions::EnumValueOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; - _impl_.feature_support_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions_FeatureSupport>( - arena, *from._impl_.feature_support_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; + _impl_.feature_support_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.feature_support_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, deprecated_), reinterpret_cast<const char *>(&from._impl_) + @@ -11453,14 +11298,14 @@ EnumValueOptions::EnumValueOptions( // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueOptions) } -inline PROTOBUF_NDEBUG_INLINE EnumValueOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE EnumValueOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, uninterpreted_option_{visibility, arena} {} -inline void EnumValueOptions::SharedCtor(::_pb::Arena* arena) { +inline void EnumValueOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, features_), @@ -11482,8 +11327,9 @@ inline void EnumValueOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* EnumValueOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL EnumValueOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumValueOptions(arena); } constexpr auto EnumValueOptions::InternalNewImpl_() { @@ -11505,34 +11351,41 @@ constexpr auto EnumValueOptions::InternalNewImpl_() { alignof(EnumValueOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull EnumValueOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_EnumValueOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - EnumValueOptions::IsInitializedImpl, - &EnumValueOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<EnumValueOptions>(), +constexpr auto EnumValueOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_EnumValueOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + EnumValueOptions::IsInitializedImpl, + &EnumValueOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<EnumValueOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &EnumValueOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<EnumValueOptions>(), &EnumValueOptions::ByteSizeLong, - &EnumValueOptions::_InternalSerialize, + &EnumValueOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<EnumValueOptions>(), &EnumValueOptions::ByteSizeLong, + &EnumValueOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._cached_size_), - false, - }, - &EnumValueOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* EnumValueOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._cached_size_), + false, + }, + &EnumValueOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 5, 3, 0, 7> EnumValueOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + EnumValueOptions_class_data_ = + EnumValueOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL EnumValueOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&EnumValueOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(EnumValueOptions_class_data_.tc_table); + return EnumValueOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 5, 3, 0, 7> +EnumValueOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._extensions_), @@ -11543,7 +11396,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 3, 0, 7> EnumValueOptions::_table_ = { 5, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + EnumValueOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -11588,14 +11441,15 @@ constexpr ::_pbi::TcParseTable<3, 5, 3, 0, 7> EnumValueOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_.uninterpreted_option_), -1, 2, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_FeatureSupport>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_FeatureSupport>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void EnumValueOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -11606,12 +11460,12 @@ PROTOBUF_NOINLINE void EnumValueOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.feature_support_ != nullptr); _impl_.feature_support_->Clear(); } @@ -11624,121 +11478,114 @@ PROTOBUF_NOINLINE void EnumValueOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* EnumValueOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const EnumValueOptions& this_ = static_cast<const EnumValueOptions&>(base); +::uint8_t* PROTOBUF_NONNULL EnumValueOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const EnumValueOptions& this_ = static_cast<const EnumValueOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* EnumValueOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const EnumValueOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL EnumValueOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const EnumValueOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool deprecated = 1 [default = false]; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_deprecated(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional bool deprecated = 1 [default = false]; + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 1, this_._internal_deprecated(), target); + } - // optional .google.protobuf.FeatureSet features = 2; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // optional bool debug_redact = 3 [default = false]; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_debug_redact(), target); - } + // optional bool debug_redact = 3 [default = false]; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this_._internal_debug_redact(), target); + } - // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.feature_support_, this_._impl_.feature_support_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, *this_._impl_.feature_support_, this_._impl_.feature_support_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValueOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValueOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t EnumValueOptions::ByteSizeLong(const MessageLite& base) { - const EnumValueOptions& this_ = static_cast<const EnumValueOptions&>(base); +::size_t EnumValueOptions::ByteSizeLong(const MessageLite& base) { + const EnumValueOptions& this_ = static_cast<const EnumValueOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t EnumValueOptions::ByteSizeLong() const { - const EnumValueOptions& this_ = *this; +::size_t EnumValueOptions::ByteSizeLong() const { + const EnumValueOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional .google.protobuf.FeatureSet features = 2; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.feature_support_); - } - // optional bool deprecated = 1 [default = false]; - if (cached_has_bits & 0x00000004u) { - total_size += 2; - } - // optional bool debug_redact = 3 [default = false]; - if (cached_has_bits & 0x00000008u) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += ::absl::popcount(0x0000000cu & cached_has_bits) * 2; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional .google.protobuf.FeatureSet features = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.feature_support_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void EnumValueOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<EnumValueOptions*>(&to_msg); @@ -11752,34 +11599,32 @@ void EnumValueOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.feature_support_ != nullptr); if (_this->_impl_.feature_support_ == nullptr) { - _this->_impl_.feature_support_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FieldOptions_FeatureSupport>(arena, *from._impl_.feature_support_); + _this->_impl_.feature_support_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.feature_support_); } else { _this->_impl_.feature_support_->MergeFrom(*from._impl_.feature_support_); } } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.debug_redact_ = from._impl_.debug_redact_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -11793,8 +11638,7 @@ void EnumValueOptions::CopyFrom(const EnumValueOptions& from) { PROTOBUF_NOINLINE bool EnumValueOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const EnumValueOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -11805,7 +11649,7 @@ PROTOBUF_NOINLINE bool EnumValueOptions::IsInitializedImpl( return true; } -void EnumValueOptions::InternalSwap(EnumValueOptions* PROTOBUF_RESTRICT other) { +void EnumValueOptions::InternalSwap(EnumValueOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -11832,28 +11676,29 @@ class ServiceOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._has_bits_); }; -ServiceOptions::ServiceOptions(::google::protobuf::Arena* arena) +ServiceOptions::ServiceOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ServiceOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.ServiceOptions) } -inline PROTOBUF_NDEBUG_INLINE ServiceOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::ServiceOptions& from_msg) +PROTOBUF_NDEBUG_INLINE ServiceOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::ServiceOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} ServiceOptions::ServiceOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ServiceOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ServiceOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -11864,21 +11709,21 @@ ServiceOptions::ServiceOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; _impl_.deprecated_ = from._impl_.deprecated_; // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceOptions) } -inline PROTOBUF_NDEBUG_INLINE ServiceOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE ServiceOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, uninterpreted_option_{visibility, arena} {} -inline void ServiceOptions::SharedCtor(::_pb::Arena* arena) { +inline void ServiceOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, features_), @@ -11899,8 +11744,9 @@ inline void ServiceOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* ServiceOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL ServiceOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ServiceOptions(arena); } constexpr auto ServiceOptions::InternalNewImpl_() { @@ -11922,34 +11768,41 @@ constexpr auto ServiceOptions::InternalNewImpl_() { alignof(ServiceOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull ServiceOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_ServiceOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - ServiceOptions::IsInitializedImpl, - &ServiceOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<ServiceOptions>(), +constexpr auto ServiceOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_ServiceOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + ServiceOptions::IsInitializedImpl, + &ServiceOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<ServiceOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &ServiceOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<ServiceOptions>(), &ServiceOptions::ByteSizeLong, - &ServiceOptions::_InternalSerialize, + &ServiceOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<ServiceOptions>(), &ServiceOptions::ByteSizeLong, + &ServiceOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._cached_size_), - false, - }, - &ServiceOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* ServiceOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._cached_size_), + false, + }, + &ServiceOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> ServiceOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + ServiceOptions_class_data_ = + ServiceOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL ServiceOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&ServiceOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(ServiceOptions_class_data_.tc_table); + return ServiceOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> +ServiceOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._extensions_), @@ -11960,7 +11813,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> ServiceOptions::_table_ = { 3, // num_field_entries 2, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + ServiceOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -11979,8 +11832,9 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> ServiceOptions::_table_ = { {16058, 63, 1, PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_.uninterpreted_option_)}}, }}, {{ 33, 0, 1, - 65532, 0,999, 0, 1, - 65534, 2, + 65532, 0, + 999, 0, 1, + 65534, 2, 65535, 65535 }}, {{ // optional bool deprecated = 33 [default = false]; @@ -11992,13 +11846,14 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> ServiceOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_.uninterpreted_option_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void ServiceOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12009,7 +11864,7 @@ PROTOBUF_NOINLINE void ServiceOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } @@ -12019,98 +11874,95 @@ PROTOBUF_NOINLINE void ServiceOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* ServiceOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const ServiceOptions& this_ = static_cast<const ServiceOptions&>(base); +::uint8_t* PROTOBUF_NONNULL ServiceOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const ServiceOptions& this_ = static_cast<const ServiceOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* ServiceOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const ServiceOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL ServiceOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const ServiceOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool deprecated = 33 [default = false]; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 33, this_._internal_deprecated(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional bool deprecated = 33 [default = false]; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 33, this_._internal_deprecated(), target); + } - // optional .google.protobuf.FeatureSet features = 34; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 34, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 34; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 34, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ServiceOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ServiceOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t ServiceOptions::ByteSizeLong(const MessageLite& base) { - const ServiceOptions& this_ = static_cast<const ServiceOptions&>(base); +::size_t ServiceOptions::ByteSizeLong(const MessageLite& base) { + const ServiceOptions& this_ = static_cast<const ServiceOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ServiceOptions::ByteSizeLong() const { - const ServiceOptions& this_ = *this; +::size_t ServiceOptions::ByteSizeLong() const { + const ServiceOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional .google.protobuf.FeatureSet features = 34; - if (cached_has_bits & 0x00000001u) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional bool deprecated = 33 [default = false]; - if (cached_has_bits & 0x00000002u) { - total_size += 3; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += static_cast<bool>(0x00000002u & cached_has_bits) * 3; + { + // optional .google.protobuf.FeatureSet features = 34; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void ServiceOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<ServiceOptions*>(&to_msg); @@ -12124,22 +11976,21 @@ void ServiceOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const :: _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -12153,8 +12004,7 @@ void ServiceOptions::CopyFrom(const ServiceOptions& from) { PROTOBUF_NOINLINE bool ServiceOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const ServiceOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -12165,7 +12015,7 @@ PROTOBUF_NOINLINE bool ServiceOptions::IsInitializedImpl( return true; } -void ServiceOptions::InternalSwap(ServiceOptions* PROTOBUF_RESTRICT other) { +void ServiceOptions::InternalSwap(ServiceOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -12192,28 +12042,29 @@ class MethodOptions::_Internal { 8 * PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._has_bits_); }; -MethodOptions::MethodOptions(::google::protobuf::Arena* arena) +MethodOptions::MethodOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, MethodOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.MethodOptions) } -inline PROTOBUF_NDEBUG_INLINE MethodOptions::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::MethodOptions& from_msg) +PROTOBUF_NDEBUG_INLINE MethodOptions::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::MethodOptions& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0}, uninterpreted_option_{visibility, arena, from.uninterpreted_option_} {} MethodOptions::MethodOptions( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MethodOptions& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, MethodOptions_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -12224,9 +12075,9 @@ MethodOptions::MethodOptions( new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; + _impl_.features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_) + : nullptr; ::memcpy(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, deprecated_), reinterpret_cast<const char *>(&from._impl_) + @@ -12237,14 +12088,14 @@ MethodOptions::MethodOptions( // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions) } -inline PROTOBUF_NDEBUG_INLINE MethodOptions::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE MethodOptions::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0}, uninterpreted_option_{visibility, arena} {} -inline void MethodOptions::SharedCtor(::_pb::Arena* arena) { +inline void MethodOptions::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, features_), @@ -12265,8 +12116,9 @@ inline void MethodOptions::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* MethodOptions::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL MethodOptions::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) MethodOptions(arena); } constexpr auto MethodOptions::InternalNewImpl_() { @@ -12288,34 +12140,41 @@ constexpr auto MethodOptions::InternalNewImpl_() { alignof(MethodOptions)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull MethodOptions::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_MethodOptions_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - MethodOptions::IsInitializedImpl, - &MethodOptions::MergeImpl, - ::google::protobuf::Message::GetNewImpl<MethodOptions>(), +constexpr auto MethodOptions::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_MethodOptions_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + MethodOptions::IsInitializedImpl, + &MethodOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl<MethodOptions>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &MethodOptions::SharedDtor, - ::google::protobuf::Message::GetClearImpl<MethodOptions>(), &MethodOptions::ByteSizeLong, - &MethodOptions::_InternalSerialize, + &MethodOptions::SharedDtor, + ::google::protobuf::Message::GetClearImpl<MethodOptions>(), &MethodOptions::ByteSizeLong, + &MethodOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._cached_size_), - false, - }, - &MethodOptions::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* MethodOptions::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._cached_size_), + false, + }, + &MethodOptions::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 4, 3, 0, 12> MethodOptions::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + MethodOptions_class_data_ = + MethodOptions::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL MethodOptions::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&MethodOptions_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(MethodOptions_class_data_.tc_table); + return MethodOptions_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 4, 3, 0, 12> +MethodOptions::_table_ = { { PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._extensions_), @@ -12326,7 +12185,7 @@ constexpr ::_pbi::TcParseTable<3, 4, 3, 0, 12> MethodOptions::_table_ = { 4, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + MethodOptions_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -12351,8 +12210,9 @@ constexpr ::_pbi::TcParseTable<3, 4, 3, 0, 12> MethodOptions::_table_ = { {16058, 63, 1, PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_.uninterpreted_option_)}}, }}, {{ 33, 0, 1, - 65528, 0,999, 0, 1, - 65534, 3, + 65528, 0, + 999, 0, 1, + 65534, 3, 65535, 65535 }}, {{ // optional bool deprecated = 33 [default = false]; @@ -12367,14 +12227,15 @@ constexpr ::_pbi::TcParseTable<3, 4, 3, 0, 12> MethodOptions::_table_ = { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; {PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_.uninterpreted_option_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, - {0, 3}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>()}, + {0, 3}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void MethodOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12385,11 +12246,11 @@ PROTOBUF_NOINLINE void MethodOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.features_ != nullptr); _impl_.features_->Clear(); } - if (cached_has_bits & 0x00000006u) { + if ((cached_has_bits & 0x00000006u) != 0) { ::memset(&_impl_.deprecated_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.idempotency_level_) - reinterpret_cast<char*>(&_impl_.deprecated_)) + sizeof(_impl_.idempotency_level_)); @@ -12399,110 +12260,107 @@ PROTOBUF_NOINLINE void MethodOptions::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* MethodOptions::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const MethodOptions& this_ = static_cast<const MethodOptions&>(base); +::uint8_t* PROTOBUF_NONNULL MethodOptions::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const MethodOptions& this_ = static_cast<const MethodOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* MethodOptions::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const MethodOptions& this_ = *this; +::uint8_t* PROTOBUF_NONNULL MethodOptions::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const MethodOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodOptions) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodOptions) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool deprecated = 33 [default = false]; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 33, this_._internal_deprecated(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional bool deprecated = 33 [default = false]; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 33, this_._internal_deprecated(), target); + } - // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 34, this_._internal_idempotency_level(), target); - } + // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 34, this_._internal_idempotency_level(), target); + } - // optional .google.protobuf.FeatureSet features = 35; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 35, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet features = 35; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 35, *this_._impl_.features_, this_._impl_.features_->GetCachedSize(), target, + stream); + } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_uninterpreted_option_size()); - i < n; i++) { - const auto& repfield = this_._internal_uninterpreted_option().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 999, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_uninterpreted_option_size()); + i < n; i++) { + const auto& repfield = this_._internal_uninterpreted_option().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 999, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [1000, 536870912) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 536870912, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MethodOptions) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.MethodOptions) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t MethodOptions::ByteSizeLong(const MessageLite& base) { - const MethodOptions& this_ = static_cast<const MethodOptions&>(base); +::size_t MethodOptions::ByteSizeLong(const MessageLite& base) { + const MethodOptions& this_ = static_cast<const MethodOptions&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t MethodOptions::ByteSizeLong() const { - const MethodOptions& this_ = *this; +::size_t MethodOptions::ByteSizeLong() const { + const MethodOptions& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodOptions) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodOptions) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - { - total_size += 2UL * this_._internal_uninterpreted_option_size(); - for (const auto& msg : this_._internal_uninterpreted_option()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - // optional .google.protobuf.FeatureSet features = 35; - if (cached_has_bits & 0x00000001u) { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); - } - // optional bool deprecated = 33 [default = false]; - if (cached_has_bits & 0x00000002u) { - total_size += 3; - } - // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; - if (cached_has_bits & 0x00000004u) { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_idempotency_level()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; + { + total_size += 2UL * this_._internal_uninterpreted_option_size(); + for (const auto& msg : this_._internal_uninterpreted_option()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += static_cast<bool>(0x00000002u & cached_has_bits) * 3; + if ((cached_has_bits & 0x00000005u) != 0) { + // optional .google.protobuf.FeatureSet features = 35; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.features_); + } + // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 2 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_idempotency_level()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void MethodOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<MethodOptions*>(&to_msg); @@ -12516,25 +12374,24 @@ void MethodOptions::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::g _this->_internal_mutable_uninterpreted_option()->MergeFrom( from._internal_uninterpreted_option()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.features_ != nullptr); if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); + _this->_impl_.features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.features_); } else { _this->_impl_.features_->MergeFrom(*from._impl_.features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.idempotency_level_ = from._impl_.idempotency_level_; } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -12548,8 +12405,7 @@ void MethodOptions::CopyFrom(const MethodOptions& from) { PROTOBUF_NOINLINE bool MethodOptions::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const MethodOptions&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } if (!::google::protobuf::internal::AllAreInitialized(this_._internal_uninterpreted_option())) @@ -12560,7 +12416,7 @@ PROTOBUF_NOINLINE bool MethodOptions::IsInitializedImpl( return true; } -void MethodOptions::InternalSwap(MethodOptions* PROTOBUF_RESTRICT other) { +void MethodOptions::InternalSwap(MethodOptions* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -12590,27 +12446,28 @@ class UninterpretedOption_NamePart::_Internal { } }; -UninterpretedOption_NamePart::UninterpretedOption_NamePart(::google::protobuf::Arena* arena) +UninterpretedOption_NamePart::UninterpretedOption_NamePart(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, UninterpretedOption_NamePart_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.UninterpretedOption.NamePart) } -inline PROTOBUF_NDEBUG_INLINE UninterpretedOption_NamePart::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::UninterpretedOption_NamePart& from_msg) +PROTOBUF_NDEBUG_INLINE UninterpretedOption_NamePart::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::UninterpretedOption_NamePart& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_part_(arena, from.name_part_) {} UninterpretedOption_NamePart::UninterpretedOption_NamePart( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UninterpretedOption_NamePart& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, UninterpretedOption_NamePart_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -12623,13 +12480,13 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart( // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart) } -inline PROTOBUF_NDEBUG_INLINE UninterpretedOption_NamePart::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE UninterpretedOption_NamePart::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_part_(arena) {} -inline void UninterpretedOption_NamePart::SharedCtor(::_pb::Arena* arena) { +inline void UninterpretedOption_NamePart::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.is_extension_ = {}; } @@ -12645,42 +12502,50 @@ inline void UninterpretedOption_NamePart::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* UninterpretedOption_NamePart::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL UninterpretedOption_NamePart::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) UninterpretedOption_NamePart(arena); } constexpr auto UninterpretedOption_NamePart::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(UninterpretedOption_NamePart), alignof(UninterpretedOption_NamePart)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull UninterpretedOption_NamePart::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_UninterpretedOption_NamePart_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - UninterpretedOption_NamePart::IsInitializedImpl, - &UninterpretedOption_NamePart::MergeImpl, - ::google::protobuf::Message::GetNewImpl<UninterpretedOption_NamePart>(), +constexpr auto UninterpretedOption_NamePart::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_UninterpretedOption_NamePart_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + UninterpretedOption_NamePart::IsInitializedImpl, + &UninterpretedOption_NamePart::MergeImpl, + ::google::protobuf::Message::GetNewImpl<UninterpretedOption_NamePart>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &UninterpretedOption_NamePart::SharedDtor, - ::google::protobuf::Message::GetClearImpl<UninterpretedOption_NamePart>(), &UninterpretedOption_NamePart::ByteSizeLong, - &UninterpretedOption_NamePart::_InternalSerialize, + &UninterpretedOption_NamePart::SharedDtor, + ::google::protobuf::Message::GetClearImpl<UninterpretedOption_NamePart>(), &UninterpretedOption_NamePart::ByteSizeLong, + &UninterpretedOption_NamePart::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(UninterpretedOption_NamePart, _impl_._cached_size_), - false, - }, - &UninterpretedOption_NamePart::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* UninterpretedOption_NamePart::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(UninterpretedOption_NamePart, _impl_._cached_size_), + false, + }, + &UninterpretedOption_NamePart::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<1, 2, 0, 62, 2> UninterpretedOption_NamePart::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + UninterpretedOption_NamePart_class_data_ = + UninterpretedOption_NamePart::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL UninterpretedOption_NamePart::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&UninterpretedOption_NamePart_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(UninterpretedOption_NamePart_class_data_.tc_table); + return UninterpretedOption_NamePart_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<1, 2, 0, 62, 2> +UninterpretedOption_NamePart::_table_ = { { PROTOBUF_FIELD_OFFSET(UninterpretedOption_NamePart, _impl_._has_bits_), 0, // no _extensions_ @@ -12691,7 +12556,7 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 62, 2> UninterpretedOption_NamePart::_ta 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + UninterpretedOption_NamePart_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -12721,7 +12586,6 @@ constexpr ::_pbi::TcParseTable<1, 2, 0, 62, 2> UninterpretedOption_NamePart::_ta "name_part" }}, }; - PROTOBUF_NOINLINE void UninterpretedOption_NamePart::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12730,7 +12594,7 @@ PROTOBUF_NOINLINE void UninterpretedOption_NamePart::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.name_part_.ClearNonDefaultToEmpty(); } _impl_.is_extension_ = false; @@ -12739,75 +12603,72 @@ PROTOBUF_NOINLINE void UninterpretedOption_NamePart::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* UninterpretedOption_NamePart::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const UninterpretedOption_NamePart& this_ = static_cast<const UninterpretedOption_NamePart&>(base); +::uint8_t* PROTOBUF_NONNULL UninterpretedOption_NamePart::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const UninterpretedOption_NamePart& this_ = static_cast<const UninterpretedOption_NamePart&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* UninterpretedOption_NamePart::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const UninterpretedOption_NamePart& this_ = *this; +::uint8_t* PROTOBUF_NONNULL UninterpretedOption_NamePart::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const UninterpretedOption_NamePart& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption.NamePart) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption.NamePart) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // required string name_part = 1; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_name_part(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.UninterpretedOption.NamePart.name_part"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // required string name_part = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_name_part(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.UninterpretedOption.NamePart.name_part"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } - // required bool is_extension = 2; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this_._internal_is_extension(), target); - } + // required bool is_extension = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 2, this_._internal_is_extension(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UninterpretedOption.NamePart) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UninterpretedOption.NamePart) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t UninterpretedOption_NamePart::ByteSizeLong(const MessageLite& base) { - const UninterpretedOption_NamePart& this_ = static_cast<const UninterpretedOption_NamePart&>(base); +::size_t UninterpretedOption_NamePart::ByteSizeLong(const MessageLite& base) { + const UninterpretedOption_NamePart& this_ = static_cast<const UninterpretedOption_NamePart&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t UninterpretedOption_NamePart::ByteSizeLong() const { - const UninterpretedOption_NamePart& this_ = *this; +::size_t UninterpretedOption_NamePart::ByteSizeLong() const { + const UninterpretedOption_NamePart& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption.NamePart) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption.NamePart) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // required string name_part = 1; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name_part()); - } - // required bool is_extension = 2; - if (cached_has_bits & 0x00000002u) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += static_cast<bool>(0x00000002u & cached_has_bits) * 2; + { + // required string name_part = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name_part()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void UninterpretedOption_NamePart::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<UninterpretedOption_NamePart*>(&to_msg); @@ -12818,11 +12679,11 @@ void UninterpretedOption_NamePart::MergeImpl(::google::protobuf::MessageLite& to (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_name_part(from._internal_name_part()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.is_extension_ = from._impl_.is_extension_; } } @@ -12846,14 +12707,14 @@ PROTOBUF_NOINLINE bool UninterpretedOption_NamePart::IsInitializedImpl( return true; } -void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* PROTOBUF_RESTRICT other) { +void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_part_, &other->_impl_.name_part_, arena); - swap(_impl_.is_extension_, other->_impl_.is_extension_); + swap(_impl_.is_extension_, other->_impl_.is_extension_); } ::google::protobuf::Metadata UninterpretedOption_NamePart::GetMetadata() const { @@ -12869,18 +12730,19 @@ class UninterpretedOption::_Internal { 8 * PROTOBUF_FIELD_OFFSET(UninterpretedOption, _impl_._has_bits_); }; -UninterpretedOption::UninterpretedOption(::google::protobuf::Arena* arena) +UninterpretedOption::UninterpretedOption(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, UninterpretedOption_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.UninterpretedOption) } -inline PROTOBUF_NDEBUG_INLINE UninterpretedOption::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::UninterpretedOption& from_msg) +PROTOBUF_NDEBUG_INLINE UninterpretedOption::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::UninterpretedOption& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_{visibility, arena, from.name_}, @@ -12889,10 +12751,10 @@ inline PROTOBUF_NDEBUG_INLINE UninterpretedOption::Impl_::Impl_( aggregate_value_(arena, from.aggregate_value_) {} UninterpretedOption::UninterpretedOption( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UninterpretedOption& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, UninterpretedOption_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -12911,16 +12773,16 @@ UninterpretedOption::UninterpretedOption( // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption) } -inline PROTOBUF_NDEBUG_INLINE UninterpretedOption::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE UninterpretedOption::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_{visibility, arena}, identifier_value_(arena), string_value_(arena), aggregate_value_(arena) {} -inline void UninterpretedOption::SharedCtor(::_pb::Arena* arena) { +inline void UninterpretedOption::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, positive_int_value_), @@ -12943,8 +12805,9 @@ inline void UninterpretedOption::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* UninterpretedOption::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL UninterpretedOption::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) UninterpretedOption(arena); } constexpr auto UninterpretedOption::InternalNewImpl_() { @@ -12963,34 +12826,41 @@ constexpr auto UninterpretedOption::InternalNewImpl_() { alignof(UninterpretedOption)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull UninterpretedOption::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_UninterpretedOption_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - UninterpretedOption::IsInitializedImpl, - &UninterpretedOption::MergeImpl, - ::google::protobuf::Message::GetNewImpl<UninterpretedOption>(), +constexpr auto UninterpretedOption::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_UninterpretedOption_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + UninterpretedOption::IsInitializedImpl, + &UninterpretedOption::MergeImpl, + ::google::protobuf::Message::GetNewImpl<UninterpretedOption>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &UninterpretedOption::SharedDtor, - ::google::protobuf::Message::GetClearImpl<UninterpretedOption>(), &UninterpretedOption::ByteSizeLong, - &UninterpretedOption::_InternalSerialize, + &UninterpretedOption::SharedDtor, + ::google::protobuf::Message::GetClearImpl<UninterpretedOption>(), &UninterpretedOption::ByteSizeLong, + &UninterpretedOption::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(UninterpretedOption, _impl_._cached_size_), - false, - }, - &UninterpretedOption::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* UninterpretedOption::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(UninterpretedOption, _impl_._cached_size_), + false, + }, + &UninterpretedOption::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 7, 1, 75, 2> UninterpretedOption::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + UninterpretedOption_class_data_ = + UninterpretedOption::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL UninterpretedOption::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&UninterpretedOption_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(UninterpretedOption_class_data_.tc_table); + return UninterpretedOption_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 7, 1, 75, 2> +UninterpretedOption::_table_ = { { PROTOBUF_FIELD_OFFSET(UninterpretedOption, _impl_._has_bits_), 0, // no _extensions_ @@ -13001,7 +12871,7 @@ constexpr ::_pbi::TcParseTable<3, 7, 1, 75, 2> UninterpretedOption::_table_ = { 7, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + UninterpretedOption_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -13054,16 +12924,17 @@ constexpr ::_pbi::TcParseTable<3, 7, 1, 75, 2> UninterpretedOption::_table_ = { // optional string aggregate_value = 8; {PROTOBUF_FIELD_OFFSET(UninterpretedOption, _impl_.aggregate_value_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kRawString | ::_fl::kRepAString)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption_NamePart>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption_NamePart>()}, + }}, + {{ "\43\0\20\0\0\0\0\17" "google.protobuf.UninterpretedOption" "identifier_value" "aggregate_value" }}, }; - PROTOBUF_NOINLINE void UninterpretedOption::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13073,18 +12944,18 @@ PROTOBUF_NOINLINE void UninterpretedOption::Clear() { _impl_.name_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.identifier_value_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.string_value_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _impl_.aggregate_value_.ClearNonDefaultToEmpty(); } } - if (cached_has_bits & 0x00000038u) { + if ((cached_has_bits & 0x00000038u) != 0) { ::memset(&_impl_.positive_int_value_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.double_value_) - reinterpret_cast<char*>(&_impl_.positive_int_value_)) + sizeof(_impl_.double_value_)); @@ -13094,143 +12965,140 @@ PROTOBUF_NOINLINE void UninterpretedOption::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* UninterpretedOption::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const UninterpretedOption& this_ = static_cast<const UninterpretedOption&>(base); +::uint8_t* PROTOBUF_NONNULL UninterpretedOption::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const UninterpretedOption& this_ = static_cast<const UninterpretedOption&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* UninterpretedOption::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const UninterpretedOption& this_ = *this; +::uint8_t* PROTOBUF_NONNULL UninterpretedOption::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const UninterpretedOption& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_name_size()); - i < n; i++) { - const auto& repfield = this_._internal_name().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_name_size()); + i < n; i++) { + const auto& repfield = this_._internal_name().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string identifier_value = 3; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_identifier_value(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.UninterpretedOption.identifier_value"); - target = stream->WriteStringMaybeAliased(3, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string identifier_value = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_identifier_value(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.UninterpretedOption.identifier_value"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } - // optional uint64 positive_int_value = 4; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 4, this_._internal_positive_int_value(), target); - } + // optional uint64 positive_int_value = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray( + 4, this_._internal_positive_int_value(), target); + } - // optional int64 negative_int_value = 5; - if (cached_has_bits & 0x00000010u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64ToArrayWithField<5>( - stream, this_._internal_negative_int_value(), target); - } + // optional int64 negative_int_value = 5; + if ((cached_has_bits & 0x00000010u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<5>( + stream, this_._internal_negative_int_value(), target); + } - // optional double double_value = 6; - if (cached_has_bits & 0x00000020u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 6, this_._internal_double_value(), target); - } + // optional double double_value = 6; + if ((cached_has_bits & 0x00000020u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteDoubleToArray( + 6, this_._internal_double_value(), target); + } - // optional bytes string_value = 7; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_string_value(); - target = stream->WriteBytesMaybeAliased(7, _s, target); - } + // optional bytes string_value = 7; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_string_value(); + target = stream->WriteBytesMaybeAliased(7, _s, target); + } - // optional string aggregate_value = 8; - if (cached_has_bits & 0x00000004u) { - const std::string& _s = this_._internal_aggregate_value(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.UninterpretedOption.aggregate_value"); - target = stream->WriteStringMaybeAliased(8, _s, target); - } + // optional string aggregate_value = 8; + if ((cached_has_bits & 0x00000004u) != 0) { + const std::string& _s = this_._internal_aggregate_value(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.UninterpretedOption.aggregate_value"); + target = stream->WriteStringMaybeAliased(8, _s, target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UninterpretedOption) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UninterpretedOption) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t UninterpretedOption::ByteSizeLong(const MessageLite& base) { - const UninterpretedOption& this_ = static_cast<const UninterpretedOption&>(base); +::size_t UninterpretedOption::ByteSizeLong(const MessageLite& base) { + const UninterpretedOption& this_ = static_cast<const UninterpretedOption&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t UninterpretedOption::ByteSizeLong() const { - const UninterpretedOption& this_ = *this; +::size_t UninterpretedOption::ByteSizeLong() const { + const UninterpretedOption& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - { - total_size += 1UL * this_._internal_name_size(); - for (const auto& msg : this_._internal_name()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - // optional string identifier_value = 3; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_identifier_value()); - } - // optional bytes string_value = 7; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_string_value()); - } - // optional string aggregate_value = 8; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_aggregate_value()); - } - // optional uint64 positive_int_value = 4; - if (cached_has_bits & 0x00000008u) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_positive_int_value()); - } - // optional int64 negative_int_value = 5; - if (cached_has_bits & 0x00000010u) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_negative_int_value()); - } - // optional double double_value = 6; - if (cached_has_bits & 0x00000020u) { - total_size += 9; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; + { + total_size += 1UL * this_._internal_name_size(); + for (const auto& msg : this_._internal_name()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + total_size += static_cast<bool>(0x00000020u & cached_has_bits) * 9; + if ((cached_has_bits & 0x0000001fu) != 0) { + // optional string identifier_value = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_identifier_value()); + } + // optional bytes string_value = 7; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this_._internal_string_value()); + } + // optional string aggregate_value = 8; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_aggregate_value()); + } + // optional uint64 positive_int_value = 4; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( + this_._internal_positive_int_value()); + } + // optional int64 negative_int_value = 5; + if ((cached_has_bits & 0x00000010u) != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( + this_._internal_negative_int_value()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void UninterpretedOption::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<UninterpretedOption*>(&to_msg); @@ -13243,23 +13111,23 @@ void UninterpretedOption::MergeImpl(::google::protobuf::MessageLite& to_msg, con _this->_internal_mutable_name()->MergeFrom( from._internal_name()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000003fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_identifier_value(from._internal_identifier_value()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_string_value(from._internal_string_value()); } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_internal_set_aggregate_value(from._internal_aggregate_value()); } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.positive_int_value_ = from._impl_.positive_int_value_; } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_impl_.negative_int_value_ = from._impl_.negative_int_value_; } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _this->_impl_.double_value_ = from._impl_.double_value_; } } @@ -13282,7 +13150,7 @@ PROTOBUF_NOINLINE bool UninterpretedOption::IsInitializedImpl( return true; } -void UninterpretedOption::InternalSwap(UninterpretedOption* PROTOBUF_RESTRICT other) { +void UninterpretedOption::InternalSwap(UninterpretedOption* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -13313,27 +13181,28 @@ class FeatureSet::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._has_bits_); }; -FeatureSet::FeatureSet(::google::protobuf::Arena* arena) +FeatureSet::FeatureSet(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FeatureSet_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FeatureSet) } -inline PROTOBUF_NDEBUG_INLINE FeatureSet::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FeatureSet& from_msg) +PROTOBUF_NDEBUG_INLINE FeatureSet::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FeatureSet& from_msg) : _extensions_{visibility, arena}, _has_bits_{from._has_bits_}, _cached_size_{0} {} FeatureSet::FeatureSet( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FeatureSet& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FeatureSet_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -13347,26 +13216,26 @@ FeatureSet::FeatureSet( offsetof(Impl_, field_presence_), reinterpret_cast<const char *>(&from._impl_) + offsetof(Impl_, field_presence_), - offsetof(Impl_, json_format_) - + offsetof(Impl_, enforce_naming_style_) - offsetof(Impl_, field_presence_) + - sizeof(Impl_::json_format_)); + sizeof(Impl_::enforce_naming_style_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FeatureSet) } -inline PROTOBUF_NDEBUG_INLINE FeatureSet::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FeatureSet::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, _cached_size_{0} {} -inline void FeatureSet::SharedCtor(::_pb::Arena* arena) { +inline void FeatureSet::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, field_presence_), 0, - offsetof(Impl_, json_format_) - + offsetof(Impl_, enforce_naming_style_) - offsetof(Impl_, field_presence_) + - sizeof(Impl_::json_format_)); + sizeof(Impl_::enforce_naming_style_)); } FeatureSet::~FeatureSet() { // @@protoc_insertion_point(destructor:google.protobuf.FeatureSet) @@ -13379,8 +13248,9 @@ inline void FeatureSet::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FeatureSet::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FeatureSet::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FeatureSet(arena); } constexpr auto FeatureSet::InternalNewImpl_() { @@ -13398,45 +13268,52 @@ constexpr auto FeatureSet::InternalNewImpl_() { alignof(FeatureSet)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FeatureSet::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FeatureSet_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FeatureSet::IsInitializedImpl, - &FeatureSet::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FeatureSet>(), +constexpr auto FeatureSet::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FeatureSet_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FeatureSet::IsInitializedImpl, + &FeatureSet::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FeatureSet>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FeatureSet::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FeatureSet>(), &FeatureSet::ByteSizeLong, - &FeatureSet::_InternalSerialize, + &FeatureSet::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FeatureSet>(), &FeatureSet::ByteSizeLong, + &FeatureSet::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._cached_size_), - false, - }, - &FeatureSet::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FeatureSet::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._cached_size_), + false, + }, + &FeatureSet::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> FeatureSet::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FeatureSet_class_data_ = + FeatureSet::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FeatureSet::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FeatureSet_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FeatureSet_class_data_.tc_table); + return FeatureSet_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 7, 7, 0, 2> +FeatureSet::_table_ = { { PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._extensions_), - 6, 56, // max_field_number, fast_idx_mask + 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967232, // skipmap + 4294967168, // skipmap offsetof(decltype(_table_), field_entries), - 6, // num_field_entries - 6, // num_aux_entries + 7, // num_field_entries + 7, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FeatureSet_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -13462,7 +13339,9 @@ constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> FeatureSet::_table_ = { // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, {48, 5, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_)}}, - {::_pbi::TcParser::MiniParse, {}}, + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + {::_pbi::TcParser::FastEr0S1, + {56, 6, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enforce_naming_style_)}}, }}, {{ 65535, 65535 }}, {{ @@ -13484,17 +13363,22 @@ constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> FeatureSet::_table_ = { // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_), _Internal::kHasBitsOffset + 5, 5, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, - }}, {{ - {0, 4}, - {0, 3}, - {0, 3}, - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::FeatureSet_Utf8Validation_internal_data_}, - {0, 3}, - {0, 3}, - }}, {{ + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enforce_naming_style_), _Internal::kHasBitsOffset + 6, 6, + (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, + }}, + {{ + {0, 4}, + {0, 3}, + {0, 3}, + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::FeatureSet_Utf8Validation_internal_data_}, + {0, 3}, + {0, 3}, + {0, 3}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void FeatureSet::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FeatureSet) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13504,137 +13388,149 @@ PROTOBUF_NOINLINE void FeatureSet::Clear() { _impl_._extensions_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if ((cached_has_bits & 0x0000007fu) != 0) { ::memset(&_impl_.field_presence_, 0, static_cast<::size_t>( - reinterpret_cast<char*>(&_impl_.json_format_) - - reinterpret_cast<char*>(&_impl_.field_presence_)) + sizeof(_impl_.json_format_)); + reinterpret_cast<char*>(&_impl_.enforce_naming_style_) - + reinterpret_cast<char*>(&_impl_.field_presence_)) + sizeof(_impl_.enforce_naming_style_)); } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FeatureSet::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FeatureSet& this_ = static_cast<const FeatureSet&>(base); +::uint8_t* PROTOBUF_NONNULL FeatureSet::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FeatureSet& this_ = static_cast<const FeatureSet&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FeatureSet::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FeatureSet& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FeatureSet::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FeatureSet& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FeatureSet) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FeatureSet) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000001u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this_._internal_field_presence(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000001u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this_._internal_field_presence(), target); + } - // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 2, this_._internal_enum_type(), target); - } + // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this_._internal_enum_type(), target); + } - // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 3, this_._internal_repeated_field_encoding(), target); - } + // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this_._internal_repeated_field_encoding(), target); + } - // optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 4, this_._internal_utf8_validation(), target); - } + // optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 4, this_._internal_utf8_validation(), target); + } - // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000010u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 5, this_._internal_message_encoding(), target); - } + // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000010u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 5, this_._internal_message_encoding(), target); + } - // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000020u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 6, this_._internal_json_format(), target); - } + // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000020u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 6, this_._internal_json_format(), target); + } - // Extension range [1000, 10001) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 1000, 10001, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FeatureSet) - return target; - } + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + if ((cached_has_bits & 0x00000040u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 7, this_._internal_enforce_naming_style(), target); + } + + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FeatureSet) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FeatureSet::ByteSizeLong(const MessageLite& base) { - const FeatureSet& this_ = static_cast<const FeatureSet&>(base); +::size_t FeatureSet::ByteSizeLong(const MessageLite& base) { + const FeatureSet& this_ = static_cast<const FeatureSet&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FeatureSet::ByteSizeLong() const { - const FeatureSet& this_ = *this; +::size_t FeatureSet::ByteSizeLong() const { + const FeatureSet& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FeatureSet) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FeatureSet) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_field_presence()); - } - // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_enum_type()); - } - // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_repeated_field_encoding()); - } - // optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_utf8_validation()); - } - // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000010u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_message_encoding()); - } - // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000020u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_json_format()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000007fu) != 0) { + // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_field_presence()); + } + // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_enum_type()); + } + // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_repeated_field_encoding()); + } + // optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_utf8_validation()); + } + // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000010u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_message_encoding()); + } + // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { + if ((cached_has_bits & 0x00000020u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_json_format()); + } + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + if ((cached_has_bits & 0x00000040u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_enforce_naming_style()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FeatureSet::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FeatureSet*>(&to_msg); @@ -13645,28 +13541,31 @@ void FeatureSet::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000007fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_impl_.field_presence_ = from._impl_.field_presence_; } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.enum_type_ = from._impl_.enum_type_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.repeated_field_encoding_ = from._impl_.repeated_field_encoding_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.utf8_validation_ = from._impl_.utf8_validation_; } - if (cached_has_bits & 0x00000010u) { + if ((cached_has_bits & 0x00000010u) != 0) { _this->_impl_.message_encoding_ = from._impl_.message_encoding_; } - if (cached_has_bits & 0x00000020u) { + if ((cached_has_bits & 0x00000020u) != 0) { _this->_impl_.json_format_ = from._impl_.json_format_; } + if ((cached_has_bits & 0x00000040u) != 0) { + _this->_impl_.enforce_naming_style_ = from._impl_.enforce_naming_style_; + } } _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -13680,21 +13579,20 @@ void FeatureSet::CopyFrom(const FeatureSet& from) { PROTOBUF_NOINLINE bool FeatureSet::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const FeatureSet&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } return true; } -void FeatureSet::InternalSwap(FeatureSet* PROTOBUF_RESTRICT other) { +void FeatureSet::InternalSwap(FeatureSet* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_) - + sizeof(FeatureSet::_impl_.json_format_) + PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enforce_naming_style_) + + sizeof(FeatureSet::_impl_.enforce_naming_style_) - PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.field_presence_)>( reinterpret_cast<char*>(&_impl_.field_presence_), reinterpret_cast<char*>(&other->_impl_.field_presence_)); @@ -13713,26 +13611,27 @@ class FeatureSetDefaults_FeatureSetEditionDefault::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_._has_bits_); }; -FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* arena) +FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FeatureSetDefaults_FeatureSetEditionDefault_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) } -inline PROTOBUF_NDEBUG_INLINE FeatureSetDefaults_FeatureSetEditionDefault::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault& from_msg) +PROTOBUF_NDEBUG_INLINE FeatureSetDefaults_FeatureSetEditionDefault::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0} {} FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaults_FeatureSetEditionDefault( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FeatureSetDefaults_FeatureSetEditionDefault& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FeatureSetDefaults_FeatureSetEditionDefault_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -13742,22 +13641,22 @@ FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaults_FeatureSetEditio from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.overridable_features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.overridable_features_) - : nullptr; - _impl_.fixed_features_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.fixed_features_) - : nullptr; + _impl_.overridable_features_ = ((cached_has_bits & 0x00000001u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.overridable_features_) + : nullptr; + _impl_.fixed_features_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.fixed_features_) + : nullptr; _impl_.edition_ = from._impl_.edition_; // @@protoc_insertion_point(copy_constructor:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) } -inline PROTOBUF_NDEBUG_INLINE FeatureSetDefaults_FeatureSetEditionDefault::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FeatureSetDefaults_FeatureSetEditionDefault::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void FeatureSetDefaults_FeatureSetEditionDefault::SharedCtor(::_pb::Arena* arena) { +inline void FeatureSetDefaults_FeatureSetEditionDefault::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, overridable_features_), @@ -13779,42 +13678,50 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::SharedDtor(MessageLite& this_._impl_.~Impl_(); } -inline void* FeatureSetDefaults_FeatureSetEditionDefault::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FeatureSetDefaults_FeatureSetEditionDefault(arena); } constexpr auto FeatureSetDefaults_FeatureSetEditionDefault::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(FeatureSetDefaults_FeatureSetEditionDefault), alignof(FeatureSetDefaults_FeatureSetEditionDefault)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FeatureSetDefaults_FeatureSetEditionDefault::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FeatureSetDefaults_FeatureSetEditionDefault_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FeatureSetDefaults_FeatureSetEditionDefault::IsInitializedImpl, - &FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FeatureSetDefaults_FeatureSetEditionDefault>(), +constexpr auto FeatureSetDefaults_FeatureSetEditionDefault::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FeatureSetDefaults_FeatureSetEditionDefault_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FeatureSetDefaults_FeatureSetEditionDefault::IsInitializedImpl, + &FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FeatureSetDefaults_FeatureSetEditionDefault>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FeatureSetDefaults_FeatureSetEditionDefault::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FeatureSetDefaults_FeatureSetEditionDefault>(), &FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong, - &FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize, + &FeatureSetDefaults_FeatureSetEditionDefault::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FeatureSetDefaults_FeatureSetEditionDefault>(), &FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong, + &FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_._cached_size_), - false, - }, - &FeatureSetDefaults_FeatureSetEditionDefault::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FeatureSetDefaults_FeatureSetEditionDefault::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_._cached_size_), + false, + }, + &FeatureSetDefaults_FeatureSetEditionDefault::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<2, 3, 3, 0, 2> FeatureSetDefaults_FeatureSetEditionDefault::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FeatureSetDefaults_FeatureSetEditionDefault_class_data_ = + FeatureSetDefaults_FeatureSetEditionDefault::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FeatureSetDefaults_FeatureSetEditionDefault_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FeatureSetDefaults_FeatureSetEditionDefault_class_data_.tc_table); + return FeatureSetDefaults_FeatureSetEditionDefault_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<2, 3, 3, 0, 2> +FeatureSetDefaults_FeatureSetEditionDefault::_table_ = { { PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_._has_bits_), 0, // no _extensions_ @@ -13825,7 +13732,7 @@ constexpr ::_pbi::TcParseTable<2, 3, 3, 0, 2> FeatureSetDefaults_FeatureSetEditi 3, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FeatureSetDefaults_FeatureSetEditionDefault_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -13854,14 +13761,15 @@ constexpr ::_pbi::TcParseTable<2, 3, 3, 0, 2> FeatureSetDefaults_FeatureSetEditi // optional .google.protobuf.FeatureSet fixed_features = 5; {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.fixed_features_), _Internal::kHasBitsOffset + 1, 1, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void FeatureSetDefaults_FeatureSetEditionDefault::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13870,12 +13778,12 @@ PROTOBUF_NOINLINE void FeatureSetDefaults_FeatureSetEditionDefault::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(_impl_.overridable_features_ != nullptr); _impl_.overridable_features_->Clear(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(_impl_.fixed_features_ != nullptr); _impl_.fixed_features_->Clear(); } @@ -13886,87 +13794,87 @@ PROTOBUF_NOINLINE void FeatureSetDefaults_FeatureSetEditionDefault::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FeatureSetDefaults_FeatureSetEditionDefault& this_ = static_cast<const FeatureSetDefaults_FeatureSetEditionDefault&>(base); +::uint8_t* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FeatureSetDefaults_FeatureSetEditionDefault& this_ = static_cast<const FeatureSetDefaults_FeatureSetEditionDefault&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FeatureSetDefaults_FeatureSetEditionDefault& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FeatureSetDefaults_FeatureSetEditionDefault& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.Edition edition = 3; - if (cached_has_bits & 0x00000004u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 3, this_._internal_edition(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional .google.protobuf.Edition edition = 3; + if ((cached_has_bits & 0x00000004u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this_._internal_edition(), target); + } - // optional .google.protobuf.FeatureSet overridable_features = 4; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.overridable_features_, this_._impl_.overridable_features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet overridable_features = 4; + if ((cached_has_bits & 0x00000001u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, *this_._impl_.overridable_features_, this_._impl_.overridable_features_->GetCachedSize(), target, + stream); + } - // optional .google.protobuf.FeatureSet fixed_features = 5; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.fixed_features_, this_._impl_.fixed_features_->GetCachedSize(), target, - stream); - } + // optional .google.protobuf.FeatureSet fixed_features = 5; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 5, *this_._impl_.fixed_features_, this_._impl_.fixed_features_->GetCachedSize(), target, + stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong(const MessageLite& base) { - const FeatureSetDefaults_FeatureSetEditionDefault& this_ = static_cast<const FeatureSetDefaults_FeatureSetEditionDefault&>(base); +::size_t FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong(const MessageLite& base) { + const FeatureSetDefaults_FeatureSetEditionDefault& this_ = static_cast<const FeatureSetDefaults_FeatureSetEditionDefault&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong() const { - const FeatureSetDefaults_FeatureSetEditionDefault& this_ = *this; +::size_t FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong() const { + const FeatureSetDefaults_FeatureSetEditionDefault& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - // optional .google.protobuf.FeatureSet overridable_features = 4; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.overridable_features_); - } - // optional .google.protobuf.FeatureSet fixed_features = 5; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.fixed_features_); - } - // optional .google.protobuf.Edition edition = 3; - if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000007u) != 0) { + // optional .google.protobuf.FeatureSet overridable_features = 4; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.overridable_features_); + } + // optional .google.protobuf.FeatureSet fixed_features = 5; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.fixed_features_); + } + // optional .google.protobuf.Edition edition = 3; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_edition()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FeatureSetDefaults_FeatureSetEditionDefault*>(&to_msg); @@ -13978,26 +13886,24 @@ void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf:: (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { ABSL_DCHECK(from._impl_.overridable_features_ != nullptr); if (_this->_impl_.overridable_features_ == nullptr) { - _this->_impl_.overridable_features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.overridable_features_); + _this->_impl_.overridable_features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.overridable_features_); } else { _this->_impl_.overridable_features_->MergeFrom(*from._impl_.overridable_features_); } } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { ABSL_DCHECK(from._impl_.fixed_features_ != nullptr); if (_this->_impl_.fixed_features_ == nullptr) { - _this->_impl_.fixed_features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.fixed_features_); + _this->_impl_.fixed_features_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.fixed_features_); } else { _this->_impl_.fixed_features_->MergeFrom(*from._impl_.fixed_features_); } } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.edition_ = from._impl_.edition_; } } @@ -14024,7 +13930,7 @@ PROTOBUF_NOINLINE bool FeatureSetDefaults_FeatureSetEditionDefault::IsInitialize return true; } -void FeatureSetDefaults_FeatureSetEditionDefault::InternalSwap(FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_RESTRICT other) { +void FeatureSetDefaults_FeatureSetEditionDefault::InternalSwap(FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); @@ -14049,27 +13955,28 @@ class FeatureSetDefaults::_Internal { 8 * PROTOBUF_FIELD_OFFSET(FeatureSetDefaults, _impl_._has_bits_); }; -FeatureSetDefaults::FeatureSetDefaults(::google::protobuf::Arena* arena) +FeatureSetDefaults::FeatureSetDefaults(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FeatureSetDefaults_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FeatureSetDefaults) } -inline PROTOBUF_NDEBUG_INLINE FeatureSetDefaults::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FeatureSetDefaults& from_msg) +PROTOBUF_NDEBUG_INLINE FeatureSetDefaults::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FeatureSetDefaults& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, defaults_{visibility, arena, from.defaults_} {} FeatureSetDefaults::FeatureSetDefaults( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FeatureSetDefaults& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FeatureSetDefaults_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -14088,13 +13995,13 @@ FeatureSetDefaults::FeatureSetDefaults( // @@protoc_insertion_point(copy_constructor:google.protobuf.FeatureSetDefaults) } -inline PROTOBUF_NDEBUG_INLINE FeatureSetDefaults::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FeatureSetDefaults::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, defaults_{visibility, arena} {} -inline void FeatureSetDefaults::SharedCtor(::_pb::Arena* arena) { +inline void FeatureSetDefaults::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, minimum_edition_), @@ -14114,8 +14021,9 @@ inline void FeatureSetDefaults::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FeatureSetDefaults::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FeatureSetDefaults::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FeatureSetDefaults(arena); } constexpr auto FeatureSetDefaults::InternalNewImpl_() { @@ -14134,34 +14042,41 @@ constexpr auto FeatureSetDefaults::InternalNewImpl_() { alignof(FeatureSetDefaults)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FeatureSetDefaults::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FeatureSetDefaults_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FeatureSetDefaults::IsInitializedImpl, - &FeatureSetDefaults::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FeatureSetDefaults>(), +constexpr auto FeatureSetDefaults::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FeatureSetDefaults_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + FeatureSetDefaults::IsInitializedImpl, + &FeatureSetDefaults::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FeatureSetDefaults>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FeatureSetDefaults::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FeatureSetDefaults>(), &FeatureSetDefaults::ByteSizeLong, - &FeatureSetDefaults::_InternalSerialize, + &FeatureSetDefaults::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FeatureSetDefaults>(), &FeatureSetDefaults::ByteSizeLong, + &FeatureSetDefaults::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FeatureSetDefaults, _impl_._cached_size_), - false, - }, - &FeatureSetDefaults::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FeatureSetDefaults::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FeatureSetDefaults, _impl_._cached_size_), + false, + }, + &FeatureSetDefaults::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<1, 3, 3, 0, 2> FeatureSetDefaults::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FeatureSetDefaults_class_data_ = + FeatureSetDefaults::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FeatureSetDefaults::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FeatureSetDefaults_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FeatureSetDefaults_class_data_.tc_table); + return FeatureSetDefaults_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<1, 3, 3, 0, 2> +FeatureSetDefaults::_table_ = { { PROTOBUF_FIELD_OFFSET(FeatureSetDefaults, _impl_._has_bits_), 0, // no _extensions_ @@ -14172,7 +14087,7 @@ constexpr ::_pbi::TcParseTable<1, 3, 3, 0, 2> FeatureSetDefaults::_table_ = { 3, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + FeatureSetDefaults_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -14197,14 +14112,15 @@ constexpr ::_pbi::TcParseTable<1, 3, 3, 0, 2> FeatureSetDefaults::_table_ = { // optional .google.protobuf.Edition maximum_edition = 5; {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults, _impl_.maximum_edition_), _Internal::kHasBitsOffset + 1, 2, (0 | ::_fl::kFcOptional | ::_fl::kEnum)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>()}, - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>()}, + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void FeatureSetDefaults::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FeatureSetDefaults) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -14214,7 +14130,7 @@ PROTOBUF_NOINLINE void FeatureSetDefaults::Clear() { _impl_.defaults_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if ((cached_has_bits & 0x00000003u) != 0) { ::memset(&_impl_.minimum_edition_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.maximum_edition_) - reinterpret_cast<char*>(&_impl_.minimum_edition_)) + sizeof(_impl_.maximum_edition_)); @@ -14224,95 +14140,95 @@ PROTOBUF_NOINLINE void FeatureSetDefaults::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FeatureSetDefaults::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FeatureSetDefaults& this_ = static_cast<const FeatureSetDefaults&>(base); +::uint8_t* PROTOBUF_NONNULL FeatureSetDefaults::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FeatureSetDefaults& this_ = static_cast<const FeatureSetDefaults&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FeatureSetDefaults::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FeatureSetDefaults& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FeatureSetDefaults::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FeatureSetDefaults& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FeatureSetDefaults) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FeatureSetDefaults) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_defaults_size()); - i < n; i++) { - const auto& repfield = this_._internal_defaults().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_defaults_size()); + i < n; i++) { + const auto& repfield = this_._internal_defaults().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, repfield, repfield.GetCachedSize(), + target, stream); + } - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.Edition minimum_edition = 4; - if (cached_has_bits & 0x00000001u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 4, this_._internal_minimum_edition(), target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional .google.protobuf.Edition minimum_edition = 4; + if ((cached_has_bits & 0x00000001u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 4, this_._internal_minimum_edition(), target); + } - // optional .google.protobuf.Edition maximum_edition = 5; - if (cached_has_bits & 0x00000002u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 5, this_._internal_maximum_edition(), target); - } + // optional .google.protobuf.Edition maximum_edition = 5; + if ((cached_has_bits & 0x00000002u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 5, this_._internal_maximum_edition(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FeatureSetDefaults) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FeatureSetDefaults) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FeatureSetDefaults::ByteSizeLong(const MessageLite& base) { - const FeatureSetDefaults& this_ = static_cast<const FeatureSetDefaults&>(base); +::size_t FeatureSetDefaults::ByteSizeLong(const MessageLite& base) { + const FeatureSetDefaults& this_ = static_cast<const FeatureSetDefaults&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FeatureSetDefaults::ByteSizeLong() const { - const FeatureSetDefaults& this_ = *this; +::size_t FeatureSetDefaults::ByteSizeLong() const { + const FeatureSetDefaults& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FeatureSetDefaults) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FeatureSetDefaults) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1; - { - total_size += 1UL * this_._internal_defaults_size(); - for (const auto& msg : this_._internal_defaults()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional .google.protobuf.Edition minimum_edition = 4; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_minimum_edition()); - } - // optional .google.protobuf.Edition maximum_edition = 5; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_maximum_edition()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault defaults = 1; + { + total_size += 1UL * this_._internal_defaults_size(); + for (const auto& msg : this_._internal_defaults()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional .google.protobuf.Edition minimum_edition = 4; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_minimum_edition()); + } + // optional .google.protobuf.Edition maximum_edition = 5; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_maximum_edition()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FeatureSetDefaults::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FeatureSetDefaults*>(&to_msg); @@ -14325,11 +14241,11 @@ void FeatureSetDefaults::MergeImpl(::google::protobuf::MessageLite& to_msg, cons _this->_internal_mutable_defaults()->MergeFrom( from._internal_defaults()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_impl_.minimum_edition_ = from._impl_.minimum_edition_; } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.maximum_edition_ = from._impl_.maximum_edition_; } } @@ -14352,7 +14268,7 @@ PROTOBUF_NOINLINE bool FeatureSetDefaults::IsInitializedImpl( return true; } -void FeatureSetDefaults::InternalSwap(FeatureSetDefaults* PROTOBUF_RESTRICT other) { +void FeatureSetDefaults::InternalSwap(FeatureSetDefaults* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); @@ -14378,18 +14294,19 @@ class SourceCodeInfo_Location::_Internal { 8 * PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_._has_bits_); }; -SourceCodeInfo_Location::SourceCodeInfo_Location(::google::protobuf::Arena* arena) +SourceCodeInfo_Location::SourceCodeInfo_Location(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, SourceCodeInfo_Location_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.SourceCodeInfo.Location) } -inline PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::SourceCodeInfo_Location& from_msg) +PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::SourceCodeInfo_Location& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, path_{visibility, arena, from.path_}, @@ -14401,10 +14318,10 @@ inline PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( trailing_comments_(arena, from.trailing_comments_) {} SourceCodeInfo_Location::SourceCodeInfo_Location( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SourceCodeInfo_Location& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, SourceCodeInfo_Location_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -14416,9 +14333,9 @@ SourceCodeInfo_Location::SourceCodeInfo_Location( // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location) } -inline PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, path_{visibility, arena}, _path_cached_byte_size_{0}, @@ -14428,7 +14345,7 @@ inline PROTOBUF_NDEBUG_INLINE SourceCodeInfo_Location::Impl_::Impl_( leading_comments_(arena), trailing_comments_(arena) {} -inline void SourceCodeInfo_Location::SharedCtor(::_pb::Arena* arena) { +inline void SourceCodeInfo_Location::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } SourceCodeInfo_Location::~SourceCodeInfo_Location() { @@ -14444,8 +14361,9 @@ inline void SourceCodeInfo_Location::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* SourceCodeInfo_Location::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL SourceCodeInfo_Location::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) SourceCodeInfo_Location(arena); } constexpr auto SourceCodeInfo_Location::InternalNewImpl_() { @@ -14472,34 +14390,41 @@ constexpr auto SourceCodeInfo_Location::InternalNewImpl_() { alignof(SourceCodeInfo_Location)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull SourceCodeInfo_Location::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_SourceCodeInfo_Location_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &SourceCodeInfo_Location::MergeImpl, - ::google::protobuf::Message::GetNewImpl<SourceCodeInfo_Location>(), +constexpr auto SourceCodeInfo_Location::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_SourceCodeInfo_Location_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &SourceCodeInfo_Location::MergeImpl, + ::google::protobuf::Message::GetNewImpl<SourceCodeInfo_Location>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &SourceCodeInfo_Location::SharedDtor, - ::google::protobuf::Message::GetClearImpl<SourceCodeInfo_Location>(), &SourceCodeInfo_Location::ByteSizeLong, - &SourceCodeInfo_Location::_InternalSerialize, + &SourceCodeInfo_Location::SharedDtor, + ::google::protobuf::Message::GetClearImpl<SourceCodeInfo_Location>(), &SourceCodeInfo_Location::ByteSizeLong, + &SourceCodeInfo_Location::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_._cached_size_), - false, - }, - &SourceCodeInfo_Location::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* SourceCodeInfo_Location::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_._cached_size_), + false, + }, + &SourceCodeInfo_Location::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 5, 0, 106, 2> SourceCodeInfo_Location::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + SourceCodeInfo_Location_class_data_ = + SourceCodeInfo_Location::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL SourceCodeInfo_Location::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&SourceCodeInfo_Location_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(SourceCodeInfo_Location_class_data_.tc_table); + return SourceCodeInfo_Location_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 5, 0, 106, 2> +SourceCodeInfo_Location::_table_ = { { PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_._has_bits_), 0, // no _extensions_ @@ -14510,7 +14435,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 106, 2> SourceCodeInfo_Location::_table_ 5, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + SourceCodeInfo_Location_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -14563,7 +14488,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 106, 2> SourceCodeInfo_Location::_table_ "leading_detached_comments" }}, }; - PROTOBUF_NOINLINE void SourceCodeInfo_Location::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -14575,11 +14499,11 @@ PROTOBUF_NOINLINE void SourceCodeInfo_Location::Clear() { _impl_.span_.Clear(); _impl_.leading_detached_comments_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.leading_comments_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _impl_.trailing_comments_.ClearNonDefaultToEmpty(); } } @@ -14588,128 +14512,128 @@ PROTOBUF_NOINLINE void SourceCodeInfo_Location::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* SourceCodeInfo_Location::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const SourceCodeInfo_Location& this_ = static_cast<const SourceCodeInfo_Location&>(base); +::uint8_t* PROTOBUF_NONNULL SourceCodeInfo_Location::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const SourceCodeInfo_Location& this_ = static_cast<const SourceCodeInfo_Location&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* SourceCodeInfo_Location::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const SourceCodeInfo_Location& this_ = *this; +::uint8_t* PROTOBUF_NONNULL SourceCodeInfo_Location::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const SourceCodeInfo_Location& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo.Location) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo.Location) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated int32 path = 1 [packed = true]; - { - int byte_size = this_._impl_._path_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 1, this_._internal_path(), byte_size, target); - } - } + // repeated int32 path = 1 [packed = true]; + { + int byte_size = this_._impl_._path_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 1, this_._internal_path(), byte_size, target); + } + } - // repeated int32 span = 2 [packed = true]; - { - int byte_size = this_._impl_._span_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 2, this_._internal_span(), byte_size, target); - } - } + // repeated int32 span = 2 [packed = true]; + { + int byte_size = this_._impl_._span_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 2, this_._internal_span(), byte_size, target); + } + } - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string leading_comments = 3; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_leading_comments(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.SourceCodeInfo.Location.leading_comments"); - target = stream->WriteStringMaybeAliased(3, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string leading_comments = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_leading_comments(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.SourceCodeInfo.Location.leading_comments"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } - // optional string trailing_comments = 4; - if (cached_has_bits & 0x00000002u) { - const std::string& _s = this_._internal_trailing_comments(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.SourceCodeInfo.Location.trailing_comments"); - target = stream->WriteStringMaybeAliased(4, _s, target); - } + // optional string trailing_comments = 4; + if ((cached_has_bits & 0x00000002u) != 0) { + const std::string& _s = this_._internal_trailing_comments(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.SourceCodeInfo.Location.trailing_comments"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } - // repeated string leading_detached_comments = 6; - for (int i = 0, n = this_._internal_leading_detached_comments_size(); i < n; ++i) { - const auto& s = this_._internal_leading_detached_comments().Get(i); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); - target = stream->WriteString(6, s, target); - } + // repeated string leading_detached_comments = 6; + for (int i = 0, n = this_._internal_leading_detached_comments_size(); i < n; ++i) { + const auto& s = this_._internal_leading_detached_comments().Get(i); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"); + target = stream->WriteString(6, s, target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceCodeInfo.Location) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceCodeInfo.Location) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t SourceCodeInfo_Location::ByteSizeLong(const MessageLite& base) { - const SourceCodeInfo_Location& this_ = static_cast<const SourceCodeInfo_Location&>(base); +::size_t SourceCodeInfo_Location::ByteSizeLong(const MessageLite& base) { + const SourceCodeInfo_Location& this_ = static_cast<const SourceCodeInfo_Location&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t SourceCodeInfo_Location::ByteSizeLong() const { - const SourceCodeInfo_Location& this_ = *this; +::size_t SourceCodeInfo_Location::ByteSizeLong() const { + const SourceCodeInfo_Location& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo.Location) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo.Location) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated int32 path = 1 [packed = true]; - { - total_size += - ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( - this_._internal_path(), 1, - this_._impl_._path_cached_byte_size_); - } - // repeated int32 span = 2 [packed = true]; - { - total_size += - ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( - this_._internal_span(), 1, - this_._impl_._span_cached_byte_size_); - } - // repeated string leading_detached_comments = 6; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_leading_detached_comments().size()); - for (int i = 0, n = this_._internal_leading_detached_comments().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_leading_detached_comments().Get(i)); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - // optional string leading_comments = 3; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_leading_comments()); - } - // optional string trailing_comments = 4; - if (cached_has_bits & 0x00000002u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_trailing_comments()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated int32 path = 1 [packed = true]; + { + total_size += + ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( + this_._internal_path(), 1, + this_._impl_._path_cached_byte_size_); + } + // repeated int32 span = 2 [packed = true]; + { + total_size += + ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( + this_._internal_span(), 1, + this_._impl_._span_cached_byte_size_); + } + // repeated string leading_detached_comments = 6; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_leading_detached_comments().size()); + for (int i = 0, n = this_._internal_leading_detached_comments().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_leading_detached_comments().Get(i)); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // optional string leading_comments = 3; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_leading_comments()); + } + // optional string trailing_comments = 4; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_trailing_comments()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void SourceCodeInfo_Location::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<SourceCodeInfo_Location*>(&to_msg); @@ -14723,11 +14647,11 @@ void SourceCodeInfo_Location::MergeImpl(::google::protobuf::MessageLite& to_msg, _this->_internal_mutable_span()->MergeFrom(from._internal_span()); _this->_internal_mutable_leading_detached_comments()->MergeFrom(from._internal_leading_detached_comments()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_leading_comments(from._internal_leading_comments()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_internal_set_trailing_comments(from._internal_trailing_comments()); } } @@ -14743,7 +14667,7 @@ void SourceCodeInfo_Location::CopyFrom(const SourceCodeInfo_Location& from) { } -void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* PROTOBUF_RESTRICT other) { +void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -14765,27 +14689,28 @@ class SourceCodeInfo::_Internal { public: }; -SourceCodeInfo::SourceCodeInfo(::google::protobuf::Arena* arena) +SourceCodeInfo::SourceCodeInfo(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, SourceCodeInfo_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.SourceCodeInfo) } -inline PROTOBUF_NDEBUG_INLINE SourceCodeInfo::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::SourceCodeInfo& from_msg) +PROTOBUF_NDEBUG_INLINE SourceCodeInfo::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::SourceCodeInfo& from_msg) : _extensions_{visibility, arena}, location_{visibility, arena, from.location_}, _cached_size_{0} {} SourceCodeInfo::SourceCodeInfo( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SourceCodeInfo& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, SourceCodeInfo_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -14798,14 +14723,14 @@ SourceCodeInfo::SourceCodeInfo( // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo) } -inline PROTOBUF_NDEBUG_INLINE SourceCodeInfo::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE SourceCodeInfo::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _extensions_{visibility, arena}, location_{visibility, arena}, _cached_size_{0} {} -inline void SourceCodeInfo::SharedCtor(::_pb::Arena* arena) { +inline void SourceCodeInfo::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } SourceCodeInfo::~SourceCodeInfo() { @@ -14819,8 +14744,9 @@ inline void SourceCodeInfo::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* SourceCodeInfo::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL SourceCodeInfo::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) SourceCodeInfo(arena); } constexpr auto SourceCodeInfo::InternalNewImpl_() { @@ -14842,34 +14768,41 @@ constexpr auto SourceCodeInfo::InternalNewImpl_() { alignof(SourceCodeInfo)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull SourceCodeInfo::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_SourceCodeInfo_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - SourceCodeInfo::IsInitializedImpl, - &SourceCodeInfo::MergeImpl, - ::google::protobuf::Message::GetNewImpl<SourceCodeInfo>(), +constexpr auto SourceCodeInfo::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_SourceCodeInfo_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + SourceCodeInfo::IsInitializedImpl, + &SourceCodeInfo::MergeImpl, + ::google::protobuf::Message::GetNewImpl<SourceCodeInfo>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &SourceCodeInfo::SharedDtor, - ::google::protobuf::Message::GetClearImpl<SourceCodeInfo>(), &SourceCodeInfo::ByteSizeLong, - &SourceCodeInfo::_InternalSerialize, + &SourceCodeInfo::SharedDtor, + ::google::protobuf::Message::GetClearImpl<SourceCodeInfo>(), &SourceCodeInfo::ByteSizeLong, + &SourceCodeInfo::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(SourceCodeInfo, _impl_._cached_size_), - false, - }, - &SourceCodeInfo::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* SourceCodeInfo::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(SourceCodeInfo, _impl_._cached_size_), + false, + }, + &SourceCodeInfo::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> SourceCodeInfo::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + SourceCodeInfo_class_data_ = + SourceCodeInfo::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL SourceCodeInfo::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&SourceCodeInfo_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(SourceCodeInfo_class_data_.tc_table); + return SourceCodeInfo_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> +SourceCodeInfo::_table_ = { { 0, // no _has_bits_ PROTOBUF_FIELD_OFFSET(SourceCodeInfo, _impl_._extensions_), @@ -14880,7 +14813,7 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> SourceCodeInfo::_table_ = { 1, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + SourceCodeInfo_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -14896,12 +14829,13 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> SourceCodeInfo::_table_ = { // repeated .google.protobuf.SourceCodeInfo.Location location = 1; {PROTOBUF_FIELD_OFFSET(SourceCodeInfo, _impl_.location_), 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::SourceCodeInfo_Location>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::SourceCodeInfo_Location>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void SourceCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -14915,71 +14849,71 @@ PROTOBUF_NOINLINE void SourceCodeInfo::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* SourceCodeInfo::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const SourceCodeInfo& this_ = static_cast<const SourceCodeInfo&>(base); +::uint8_t* PROTOBUF_NONNULL SourceCodeInfo::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const SourceCodeInfo& this_ = static_cast<const SourceCodeInfo&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* SourceCodeInfo::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const SourceCodeInfo& this_ = *this; +::uint8_t* PROTOBUF_NONNULL SourceCodeInfo::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const SourceCodeInfo& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated .google.protobuf.SourceCodeInfo.Location location = 1; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_location_size()); - i < n; i++) { - const auto& repfield = this_._internal_location().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.SourceCodeInfo.Location location = 1; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_location_size()); + i < n; i++) { + const auto& repfield = this_._internal_location().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, repfield, repfield.GetCachedSize(), + target, stream); + } - // Extension range [536000000, 536000001) - target = this_._impl_._extensions_._InternalSerialize( - internal_default_instance(), 536000000, 536000001, target, stream); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceCodeInfo) - return target; - } + // All extensions. + target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), + target, stream); + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceCodeInfo) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t SourceCodeInfo::ByteSizeLong(const MessageLite& base) { - const SourceCodeInfo& this_ = static_cast<const SourceCodeInfo&>(base); +::size_t SourceCodeInfo::ByteSizeLong(const MessageLite& base) { + const SourceCodeInfo& this_ = static_cast<const SourceCodeInfo&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t SourceCodeInfo::ByteSizeLong() const { - const SourceCodeInfo& this_ = *this; +::size_t SourceCodeInfo::ByteSizeLong() const { + const SourceCodeInfo& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo) + ::size_t total_size = 0; + total_size += this_._impl_._extensions_.ByteSize(); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.SourceCodeInfo.Location location = 1; - { - total_size += 1UL * this_._internal_location_size(); - for (const auto& msg : this_._internal_location()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.SourceCodeInfo.Location location = 1; + { + total_size += 1UL * this_._internal_location_size(); + for (const auto& msg : this_._internal_location()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void SourceCodeInfo::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<SourceCodeInfo*>(&to_msg); @@ -14991,7 +14925,7 @@ void SourceCodeInfo::MergeImpl(::google::protobuf::MessageLite& to_msg, const :: _this->_internal_mutable_location()->MergeFrom( from._internal_location()); - _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -15005,14 +14939,13 @@ void SourceCodeInfo::CopyFrom(const SourceCodeInfo& from) { PROTOBUF_NOINLINE bool SourceCodeInfo::IsInitializedImpl( const MessageLite& msg) { auto& this_ = static_cast<const SourceCodeInfo&>(msg); - if (!this_._impl_._extensions_.IsInitialized( - internal_default_instance())) { + if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { return false; } return true; } -void SourceCodeInfo::InternalSwap(SourceCodeInfo* PROTOBUF_RESTRICT other) { +void SourceCodeInfo::InternalSwap(SourceCodeInfo* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); @@ -15032,18 +14965,19 @@ class GeneratedCodeInfo_Annotation::_Internal { 8 * PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _impl_._has_bits_); }; -GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena) +GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, GeneratedCodeInfo_Annotation_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.GeneratedCodeInfo.Annotation) } -inline PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo_Annotation::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::GeneratedCodeInfo_Annotation& from_msg) +PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo_Annotation::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::GeneratedCodeInfo_Annotation& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, path_{visibility, arena, from.path_}, @@ -15051,10 +14985,10 @@ inline PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo_Annotation::Impl_::Impl_( source_file_(arena, from.source_file_) {} GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const GeneratedCodeInfo_Annotation& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, GeneratedCodeInfo_Annotation_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -15073,15 +15007,15 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation( // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation) } -inline PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo_Annotation::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo_Annotation::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, path_{visibility, arena}, _path_cached_byte_size_{0}, source_file_(arena) {} -inline void GeneratedCodeInfo_Annotation::SharedCtor(::_pb::Arena* arena) { +inline void GeneratedCodeInfo_Annotation::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, begin_), @@ -15102,8 +15036,9 @@ inline void GeneratedCodeInfo_Annotation::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* GeneratedCodeInfo_Annotation::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) GeneratedCodeInfo_Annotation(arena); } constexpr auto GeneratedCodeInfo_Annotation::InternalNewImpl_() { @@ -15122,34 +15057,41 @@ constexpr auto GeneratedCodeInfo_Annotation::InternalNewImpl_() { alignof(GeneratedCodeInfo_Annotation)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull GeneratedCodeInfo_Annotation::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_GeneratedCodeInfo_Annotation_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &GeneratedCodeInfo_Annotation::MergeImpl, - ::google::protobuf::Message::GetNewImpl<GeneratedCodeInfo_Annotation>(), +constexpr auto GeneratedCodeInfo_Annotation::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_GeneratedCodeInfo_Annotation_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &GeneratedCodeInfo_Annotation::MergeImpl, + ::google::protobuf::Message::GetNewImpl<GeneratedCodeInfo_Annotation>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &GeneratedCodeInfo_Annotation::SharedDtor, - ::google::protobuf::Message::GetClearImpl<GeneratedCodeInfo_Annotation>(), &GeneratedCodeInfo_Annotation::ByteSizeLong, - &GeneratedCodeInfo_Annotation::_InternalSerialize, + &GeneratedCodeInfo_Annotation::SharedDtor, + ::google::protobuf::Message::GetClearImpl<GeneratedCodeInfo_Annotation>(), &GeneratedCodeInfo_Annotation::ByteSizeLong, + &GeneratedCodeInfo_Annotation::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _impl_._cached_size_), - false, - }, - &GeneratedCodeInfo_Annotation::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* GeneratedCodeInfo_Annotation::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _impl_._cached_size_), + false, + }, + &GeneratedCodeInfo_Annotation::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<3, 5, 1, 64, 2> GeneratedCodeInfo_Annotation::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + GeneratedCodeInfo_Annotation_class_data_ = + GeneratedCodeInfo_Annotation::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&GeneratedCodeInfo_Annotation_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(GeneratedCodeInfo_Annotation_class_data_.tc_table); + return GeneratedCodeInfo_Annotation_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<3, 5, 1, 64, 2> +GeneratedCodeInfo_Annotation::_table_ = { { PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _impl_._has_bits_), 0, // no _extensions_ @@ -15160,7 +15102,7 @@ constexpr ::_pbi::TcParseTable<3, 5, 1, 64, 2> GeneratedCodeInfo_Annotation::_ta 5, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + GeneratedCodeInfo_Annotation_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -15203,15 +15145,16 @@ constexpr ::_pbi::TcParseTable<3, 5, 1, 64, 2> GeneratedCodeInfo_Annotation::_ta // optional .google.protobuf.GeneratedCodeInfo.Annotation.Semantic semantic = 5; {PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _impl_.semantic_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, - }}, {{ - {0, 3}, - }}, {{ + }}, + {{ + {0, 3}, + }}, + {{ "\54\0\13\0\0\0\0\0" "google.protobuf.GeneratedCodeInfo.Annotation" "source_file" }}, }; - PROTOBUF_NOINLINE void GeneratedCodeInfo_Annotation::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -15221,10 +15164,10 @@ PROTOBUF_NOINLINE void GeneratedCodeInfo_Annotation::Clear() { _impl_.path_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x00000001u) != 0) { _impl_.source_file_.ClearNonDefaultToEmpty(); } - if (cached_has_bits & 0x0000000eu) { + if ((cached_has_bits & 0x0000000eu) != 0) { ::memset(&_impl_.begin_, 0, static_cast<::size_t>( reinterpret_cast<char*>(&_impl_.semantic_) - reinterpret_cast<char*>(&_impl_.begin_)) + sizeof(_impl_.semantic_)); @@ -15234,118 +15177,118 @@ PROTOBUF_NOINLINE void GeneratedCodeInfo_Annotation::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* GeneratedCodeInfo_Annotation::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const GeneratedCodeInfo_Annotation& this_ = static_cast<const GeneratedCodeInfo_Annotation&>(base); +::uint8_t* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const GeneratedCodeInfo_Annotation& this_ = static_cast<const GeneratedCodeInfo_Annotation&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* GeneratedCodeInfo_Annotation::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const GeneratedCodeInfo_Annotation& this_ = *this; +::uint8_t* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const GeneratedCodeInfo_Annotation& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo.Annotation) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo.Annotation) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated int32 path = 1 [packed = true]; - { - int byte_size = this_._impl_._path_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 1, this_._internal_path(), byte_size, target); - } - } + // repeated int32 path = 1 [packed = true]; + { + int byte_size = this_._impl_._path_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 1, this_._internal_path(), byte_size, target); + } + } - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string source_file = 2; - if (cached_has_bits & 0x00000001u) { - const std::string& _s = this_._internal_source_file(); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, - "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // optional string source_file = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + const std::string& _s = this_._internal_source_file(); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(_s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } - // optional int32 begin = 3; - if (cached_has_bits & 0x00000002u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this_._internal_begin(), target); - } + // optional int32 begin = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<3>( + stream, this_._internal_begin(), target); + } - // optional int32 end = 4; - if (cached_has_bits & 0x00000004u) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<4>( - stream, this_._internal_end(), target); - } + // optional int32 end = 4; + if ((cached_has_bits & 0x00000004u) != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<4>( + stream, this_._internal_end(), target); + } - // optional .google.protobuf.GeneratedCodeInfo.Annotation.Semantic semantic = 5; - if (cached_has_bits & 0x00000008u) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 5, this_._internal_semantic(), target); - } + // optional .google.protobuf.GeneratedCodeInfo.Annotation.Semantic semantic = 5; + if ((cached_has_bits & 0x00000008u) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 5, this_._internal_semantic(), target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo.Annotation) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo.Annotation) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t GeneratedCodeInfo_Annotation::ByteSizeLong(const MessageLite& base) { - const GeneratedCodeInfo_Annotation& this_ = static_cast<const GeneratedCodeInfo_Annotation&>(base); +::size_t GeneratedCodeInfo_Annotation::ByteSizeLong(const MessageLite& base) { + const GeneratedCodeInfo_Annotation& this_ = static_cast<const GeneratedCodeInfo_Annotation&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { - const GeneratedCodeInfo_Annotation& this_ = *this; +::size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { + const GeneratedCodeInfo_Annotation& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo.Annotation) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo.Annotation) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated int32 path = 1 [packed = true]; - { - total_size += - ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( - this_._internal_path(), 1, - this_._impl_._path_cached_byte_size_); - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional string source_file = 2; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_source_file()); - } - // optional int32 begin = 3; - if (cached_has_bits & 0x00000002u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_begin()); - } - // optional int32 end = 4; - if (cached_has_bits & 0x00000004u) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_end()); - } - // optional .google.protobuf.GeneratedCodeInfo.Annotation.Semantic semantic = 5; - if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_semantic()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated int32 path = 1 [packed = true]; + { + total_size += + ::_pbi::WireFormatLite::Int32SizeWithPackedTagSize( + this_._internal_path(), 1, + this_._impl_._path_cached_byte_size_); + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // optional string source_file = 2; + if ((cached_has_bits & 0x00000001u) != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_source_file()); + } + // optional int32 begin = 3; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_begin()); + } + // optional int32 end = 4; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_end()); + } + // optional .google.protobuf.GeneratedCodeInfo.Annotation.Semantic semantic = 5; + if ((cached_has_bits & 0x00000008u) != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_semantic()); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void GeneratedCodeInfo_Annotation::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<GeneratedCodeInfo_Annotation*>(&to_msg); @@ -15357,17 +15300,17 @@ void GeneratedCodeInfo_Annotation::MergeImpl(::google::protobuf::MessageLite& to _this->_internal_mutable_path()->MergeFrom(from._internal_path()); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - if (cached_has_bits & 0x00000001u) { + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { _this->_internal_set_source_file(from._internal_source_file()); } - if (cached_has_bits & 0x00000002u) { + if ((cached_has_bits & 0x00000002u) != 0) { _this->_impl_.begin_ = from._impl_.begin_; } - if (cached_has_bits & 0x00000004u) { + if ((cached_has_bits & 0x00000004u) != 0) { _this->_impl_.end_ = from._impl_.end_; } - if (cached_has_bits & 0x00000008u) { + if ((cached_has_bits & 0x00000008u) != 0) { _this->_impl_.semantic_ = from._impl_.semantic_; } } @@ -15383,7 +15326,7 @@ void GeneratedCodeInfo_Annotation::CopyFrom(const GeneratedCodeInfo_Annotation& } -void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* PROTOBUF_RESTRICT other) { +void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -15408,26 +15351,27 @@ class GeneratedCodeInfo::_Internal { public: }; -GeneratedCodeInfo::GeneratedCodeInfo(::google::protobuf::Arena* arena) +GeneratedCodeInfo::GeneratedCodeInfo(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, GeneratedCodeInfo_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.GeneratedCodeInfo) } -inline PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::GeneratedCodeInfo& from_msg) +PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::GeneratedCodeInfo& from_msg) : annotation_{visibility, arena, from.annotation_}, _cached_size_{0} {} GeneratedCodeInfo::GeneratedCodeInfo( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const GeneratedCodeInfo& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, GeneratedCodeInfo_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -15439,13 +15383,13 @@ GeneratedCodeInfo::GeneratedCodeInfo( // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo) } -inline PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE GeneratedCodeInfo::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : annotation_{visibility, arena}, _cached_size_{0} {} -inline void GeneratedCodeInfo::SharedCtor(::_pb::Arena* arena) { +inline void GeneratedCodeInfo::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } GeneratedCodeInfo::~GeneratedCodeInfo() { @@ -15459,8 +15403,9 @@ inline void GeneratedCodeInfo::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* GeneratedCodeInfo::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL GeneratedCodeInfo::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) GeneratedCodeInfo(arena); } constexpr auto GeneratedCodeInfo::InternalNewImpl_() { @@ -15479,34 +15424,41 @@ constexpr auto GeneratedCodeInfo::InternalNewImpl_() { alignof(GeneratedCodeInfo)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull GeneratedCodeInfo::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_GeneratedCodeInfo_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &GeneratedCodeInfo::MergeImpl, - ::google::protobuf::Message::GetNewImpl<GeneratedCodeInfo>(), +constexpr auto GeneratedCodeInfo::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_GeneratedCodeInfo_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &GeneratedCodeInfo::MergeImpl, + ::google::protobuf::Message::GetNewImpl<GeneratedCodeInfo>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &GeneratedCodeInfo::SharedDtor, - ::google::protobuf::Message::GetClearImpl<GeneratedCodeInfo>(), &GeneratedCodeInfo::ByteSizeLong, - &GeneratedCodeInfo::_InternalSerialize, + &GeneratedCodeInfo::SharedDtor, + ::google::protobuf::Message::GetClearImpl<GeneratedCodeInfo>(), &GeneratedCodeInfo::ByteSizeLong, + &GeneratedCodeInfo::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo, _impl_._cached_size_), - false, - }, - &GeneratedCodeInfo::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* GeneratedCodeInfo::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo, _impl_._cached_size_), + false, + }, + &GeneratedCodeInfo::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, + nullptr, // tracker + }; } -constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> GeneratedCodeInfo::_table_ = { + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + GeneratedCodeInfo_class_data_ = + GeneratedCodeInfo::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GeneratedCodeInfo::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&GeneratedCodeInfo_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(GeneratedCodeInfo_class_data_.tc_table); + return GeneratedCodeInfo_class_data_.base(); +} +constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> +GeneratedCodeInfo::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -15517,7 +15469,7 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> GeneratedCodeInfo::_table_ = { 1, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + GeneratedCodeInfo_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -15533,12 +15485,13 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> GeneratedCodeInfo::_table_ = { // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; {PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo, _impl_.annotation_), 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::GeneratedCodeInfo_Annotation>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::GeneratedCodeInfo_Annotation>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void GeneratedCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -15551,67 +15504,67 @@ PROTOBUF_NOINLINE void GeneratedCodeInfo::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* GeneratedCodeInfo::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const GeneratedCodeInfo& this_ = static_cast<const GeneratedCodeInfo&>(base); +::uint8_t* PROTOBUF_NONNULL GeneratedCodeInfo::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const GeneratedCodeInfo& this_ = static_cast<const GeneratedCodeInfo&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* GeneratedCodeInfo::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const GeneratedCodeInfo& this_ = *this; +::uint8_t* PROTOBUF_NONNULL GeneratedCodeInfo::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const GeneratedCodeInfo& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_annotation_size()); - i < n; i++) { - const auto& repfield = this_._internal_annotation().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_annotation_size()); + i < n; i++) { + const auto& repfield = this_._internal_annotation().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, repfield, repfield.GetCachedSize(), + target, stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t GeneratedCodeInfo::ByteSizeLong(const MessageLite& base) { - const GeneratedCodeInfo& this_ = static_cast<const GeneratedCodeInfo&>(base); +::size_t GeneratedCodeInfo::ByteSizeLong(const MessageLite& base) { + const GeneratedCodeInfo& this_ = static_cast<const GeneratedCodeInfo&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t GeneratedCodeInfo::ByteSizeLong() const { - const GeneratedCodeInfo& this_ = *this; +::size_t GeneratedCodeInfo::ByteSizeLong() const { + const GeneratedCodeInfo& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - { - total_size += 1UL * this_._internal_annotation_size(); - for (const auto& msg : this_._internal_annotation()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + { + total_size += 1UL * this_._internal_annotation_size(); + for (const auto& msg : this_._internal_annotation()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void GeneratedCodeInfo::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<GeneratedCodeInfo*>(&to_msg); @@ -15634,7 +15587,7 @@ void GeneratedCodeInfo::CopyFrom(const GeneratedCodeInfo& from) { } -void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* PROTOBUF_RESTRICT other) { +void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); _impl_.annotation_.InternalSwap(&other->_impl_.annotation_); diff --git a/third_party/protobuf/src/google/protobuf/descriptor.pb.h b/third_party/protobuf/src/google/protobuf/descriptor.pb.h index 8bea63a479a87..0b2a75d592d6f 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.pb.h +++ b/third_party/protobuf/src/google/protobuf/descriptor.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/descriptor.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fdescriptor_2eproto_2epb_2eh #define google_2fprotobuf_2fdescriptor_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -50,109 +50,233 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fdescriptor_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fdescriptor_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto; +} // extern "C" namespace google { namespace protobuf { +enum Edition : int; +PROTOBUF_EXPORT extern const uint32_t Edition_internal_data_[]; +enum ExtensionRangeOptions_VerificationState : int; +PROTOBUF_EXPORT extern const uint32_t ExtensionRangeOptions_VerificationState_internal_data_[]; +enum FeatureSet_EnforceNamingStyle : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_EnforceNamingStyle_internal_data_[]; +enum FeatureSet_EnumType : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_EnumType_internal_data_[]; +enum FeatureSet_FieldPresence : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_FieldPresence_internal_data_[]; +enum FeatureSet_JsonFormat : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_JsonFormat_internal_data_[]; +enum FeatureSet_MessageEncoding : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_MessageEncoding_internal_data_[]; +enum FeatureSet_RepeatedFieldEncoding : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_RepeatedFieldEncoding_internal_data_[]; +enum FeatureSet_Utf8Validation : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_Utf8Validation_internal_data_[]; +enum FieldDescriptorProto_Label : int; +PROTOBUF_EXPORT extern const uint32_t FieldDescriptorProto_Label_internal_data_[]; +enum FieldDescriptorProto_Type : int; +PROTOBUF_EXPORT extern const uint32_t FieldDescriptorProto_Type_internal_data_[]; +enum FieldOptions_CType : int; +PROTOBUF_EXPORT extern const uint32_t FieldOptions_CType_internal_data_[]; +enum FieldOptions_JSType : int; +PROTOBUF_EXPORT extern const uint32_t FieldOptions_JSType_internal_data_[]; +enum FieldOptions_OptionRetention : int; +PROTOBUF_EXPORT extern const uint32_t FieldOptions_OptionRetention_internal_data_[]; +enum FieldOptions_OptionTargetType : int; +PROTOBUF_EXPORT extern const uint32_t FieldOptions_OptionTargetType_internal_data_[]; +enum FileOptions_OptimizeMode : int; +PROTOBUF_EXPORT extern const uint32_t FileOptions_OptimizeMode_internal_data_[]; +enum GeneratedCodeInfo_Annotation_Semantic : int; +PROTOBUF_EXPORT extern const uint32_t GeneratedCodeInfo_Annotation_Semantic_internal_data_[]; +enum MethodOptions_IdempotencyLevel : int; +PROTOBUF_EXPORT extern const uint32_t MethodOptions_IdempotencyLevel_internal_data_[]; class DescriptorProto; struct DescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern DescriptorProtoDefaultTypeInternal _DescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DescriptorProto_class_data_; class DescriptorProto_ExtensionRange; struct DescriptorProto_ExtensionRangeDefaultTypeInternal; PROTOBUF_EXPORT extern DescriptorProto_ExtensionRangeDefaultTypeInternal _DescriptorProto_ExtensionRange_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DescriptorProto_ExtensionRange_class_data_; class DescriptorProto_ReservedRange; struct DescriptorProto_ReservedRangeDefaultTypeInternal; PROTOBUF_EXPORT extern DescriptorProto_ReservedRangeDefaultTypeInternal _DescriptorProto_ReservedRange_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DescriptorProto_ReservedRange_class_data_; class EnumDescriptorProto; struct EnumDescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumDescriptorProto_class_data_; class EnumDescriptorProto_EnumReservedRange; struct EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal; PROTOBUF_EXPORT extern EnumDescriptorProto_EnumReservedRangeDefaultTypeInternal _EnumDescriptorProto_EnumReservedRange_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumDescriptorProto_EnumReservedRange_class_data_; class EnumOptions; struct EnumOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern EnumOptionsDefaultTypeInternal _EnumOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumOptions_class_data_; class EnumValueDescriptorProto; struct EnumValueDescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern EnumValueDescriptorProtoDefaultTypeInternal _EnumValueDescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumValueDescriptorProto_class_data_; class EnumValueOptions; struct EnumValueOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern EnumValueOptionsDefaultTypeInternal _EnumValueOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumValueOptions_class_data_; class ExtensionRangeOptions; struct ExtensionRangeOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern ExtensionRangeOptionsDefaultTypeInternal _ExtensionRangeOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ExtensionRangeOptions_class_data_; class ExtensionRangeOptions_Declaration; struct ExtensionRangeOptions_DeclarationDefaultTypeInternal; PROTOBUF_EXPORT extern ExtensionRangeOptions_DeclarationDefaultTypeInternal _ExtensionRangeOptions_Declaration_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ExtensionRangeOptions_Declaration_class_data_; class FeatureSet; struct FeatureSetDefaultTypeInternal; PROTOBUF_EXPORT extern FeatureSetDefaultTypeInternal _FeatureSet_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FeatureSet_class_data_; class FeatureSetDefaults; struct FeatureSetDefaultsDefaultTypeInternal; PROTOBUF_EXPORT extern FeatureSetDefaultsDefaultTypeInternal _FeatureSetDefaults_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FeatureSetDefaults_class_data_; class FeatureSetDefaults_FeatureSetEditionDefault; struct FeatureSetDefaults_FeatureSetEditionDefaultDefaultTypeInternal; PROTOBUF_EXPORT extern FeatureSetDefaults_FeatureSetEditionDefaultDefaultTypeInternal _FeatureSetDefaults_FeatureSetEditionDefault_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FeatureSetDefaults_FeatureSetEditionDefault_class_data_; class FieldDescriptorProto; struct FieldDescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern FieldDescriptorProtoDefaultTypeInternal _FieldDescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldDescriptorProto_class_data_; class FieldOptions; struct FieldOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern FieldOptionsDefaultTypeInternal _FieldOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldOptions_class_data_; class FieldOptions_EditionDefault; struct FieldOptions_EditionDefaultDefaultTypeInternal; PROTOBUF_EXPORT extern FieldOptions_EditionDefaultDefaultTypeInternal _FieldOptions_EditionDefault_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldOptions_EditionDefault_class_data_; class FieldOptions_FeatureSupport; struct FieldOptions_FeatureSupportDefaultTypeInternal; PROTOBUF_EXPORT extern FieldOptions_FeatureSupportDefaultTypeInternal _FieldOptions_FeatureSupport_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldOptions_FeatureSupport_class_data_; class FileDescriptorProto; struct FileDescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern FileDescriptorProtoDefaultTypeInternal _FileDescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FileDescriptorProto_class_data_; class FileDescriptorSet; struct FileDescriptorSetDefaultTypeInternal; PROTOBUF_EXPORT extern FileDescriptorSetDefaultTypeInternal _FileDescriptorSet_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FileDescriptorSet_class_data_; class FileOptions; struct FileOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern FileOptionsDefaultTypeInternal _FileOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FileOptions_class_data_; class GeneratedCodeInfo; struct GeneratedCodeInfoDefaultTypeInternal; PROTOBUF_EXPORT extern GeneratedCodeInfoDefaultTypeInternal _GeneratedCodeInfo_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull GeneratedCodeInfo_class_data_; class GeneratedCodeInfo_Annotation; struct GeneratedCodeInfo_AnnotationDefaultTypeInternal; PROTOBUF_EXPORT extern GeneratedCodeInfo_AnnotationDefaultTypeInternal _GeneratedCodeInfo_Annotation_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull GeneratedCodeInfo_Annotation_class_data_; class MessageOptions; struct MessageOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern MessageOptionsDefaultTypeInternal _MessageOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull MessageOptions_class_data_; class MethodDescriptorProto; struct MethodDescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern MethodDescriptorProtoDefaultTypeInternal _MethodDescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull MethodDescriptorProto_class_data_; class MethodOptions; struct MethodOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern MethodOptionsDefaultTypeInternal _MethodOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull MethodOptions_class_data_; class OneofDescriptorProto; struct OneofDescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern OneofDescriptorProtoDefaultTypeInternal _OneofDescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull OneofDescriptorProto_class_data_; class OneofOptions; struct OneofOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern OneofOptionsDefaultTypeInternal _OneofOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull OneofOptions_class_data_; class ServiceDescriptorProto; struct ServiceDescriptorProtoDefaultTypeInternal; PROTOBUF_EXPORT extern ServiceDescriptorProtoDefaultTypeInternal _ServiceDescriptorProto_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ServiceDescriptorProto_class_data_; class ServiceOptions; struct ServiceOptionsDefaultTypeInternal; PROTOBUF_EXPORT extern ServiceOptionsDefaultTypeInternal _ServiceOptions_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ServiceOptions_class_data_; class SourceCodeInfo; struct SourceCodeInfoDefaultTypeInternal; PROTOBUF_EXPORT extern SourceCodeInfoDefaultTypeInternal _SourceCodeInfo_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull SourceCodeInfo_class_data_; class SourceCodeInfo_Location; struct SourceCodeInfo_LocationDefaultTypeInternal; PROTOBUF_EXPORT extern SourceCodeInfo_LocationDefaultTypeInternal _SourceCodeInfo_Location_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull SourceCodeInfo_Location_class_data_; class UninterpretedOption; struct UninterpretedOptionDefaultTypeInternal; PROTOBUF_EXPORT extern UninterpretedOptionDefaultTypeInternal _UninterpretedOption_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UninterpretedOption_class_data_; class UninterpretedOption_NamePart; struct UninterpretedOption_NamePartDefaultTypeInternal; PROTOBUF_EXPORT extern UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UninterpretedOption_NamePart_class_data_; +template <> +internal::EnumTraitsT<::google::protobuf::Edition_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::Edition>; +template <> +internal::EnumTraitsT<::google::protobuf::ExtensionRangeOptions_VerificationState_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::ExtensionRangeOptions_VerificationState>; +template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_EnforceNamingStyle_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_EnforceNamingStyle>; +template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_EnumType_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_EnumType>; +template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_FieldPresence_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_FieldPresence>; +template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_JsonFormat_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_JsonFormat>; +template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_MessageEncoding_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_MessageEncoding>; +template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_RepeatedFieldEncoding_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_RepeatedFieldEncoding>; +template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_Utf8Validation_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_Utf8Validation>; +template <> +internal::EnumTraitsT<::google::protobuf::FieldDescriptorProto_Label_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FieldDescriptorProto_Label>; +template <> +internal::EnumTraitsT<::google::protobuf::FieldDescriptorProto_Type_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FieldDescriptorProto_Type>; +template <> +internal::EnumTraitsT<::google::protobuf::FieldOptions_CType_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FieldOptions_CType>; +template <> +internal::EnumTraitsT<::google::protobuf::FieldOptions_JSType_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FieldOptions_JSType>; +template <> +internal::EnumTraitsT<::google::protobuf::FieldOptions_OptionRetention_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FieldOptions_OptionRetention>; +template <> +internal::EnumTraitsT<::google::protobuf::FieldOptions_OptionTargetType_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FieldOptions_OptionTargetType>; +template <> +internal::EnumTraitsT<::google::protobuf::FileOptions_OptimizeMode_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FileOptions_OptimizeMode>; +template <> +internal::EnumTraitsT<::google::protobuf::GeneratedCodeInfo_Annotation_Semantic_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::GeneratedCodeInfo_Annotation_Semantic>; +template <> +internal::EnumTraitsT<::google::protobuf::MethodOptions_IdempotencyLevel_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::MethodOptions_IdempotencyLevel>; namespace internal { #if !defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) PROTOBUF_EXPORT void InitializeFileDescriptorDefaultInstancesSlow(); @@ -168,13 +292,16 @@ enum ExtensionRangeOptions_VerificationState : int { ExtensionRangeOptions_VerificationState_UNVERIFIED = 1, }; -PROTOBUF_EXPORT bool ExtensionRangeOptions_VerificationState_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t ExtensionRangeOptions_VerificationState_internal_data_[]; -constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions_VerificationState_VerificationState_MIN = static_cast<ExtensionRangeOptions_VerificationState>(0); -constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions_VerificationState_VerificationState_MAX = static_cast<ExtensionRangeOptions_VerificationState>(1); -constexpr int ExtensionRangeOptions_VerificationState_VerificationState_ARRAYSIZE = 1 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -ExtensionRangeOptions_VerificationState_descriptor(); +inline constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions_VerificationState_VerificationState_MIN = + static_cast<ExtensionRangeOptions_VerificationState>(0); +inline constexpr ExtensionRangeOptions_VerificationState ExtensionRangeOptions_VerificationState_VerificationState_MAX = + static_cast<ExtensionRangeOptions_VerificationState>(1); +inline bool ExtensionRangeOptions_VerificationState_IsValid(int value) { + return 0 <= value && value <= 1; +} +inline constexpr int ExtensionRangeOptions_VerificationState_VerificationState_ARRAYSIZE = 1 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL ExtensionRangeOptions_VerificationState_descriptor(); template <typename T> const std::string& ExtensionRangeOptions_VerificationState_Name(T value) { static_assert(std::is_same<T, ExtensionRangeOptions_VerificationState>::value || @@ -184,13 +311,13 @@ const std::string& ExtensionRangeOptions_VerificationState_Name(T value) { } template <> inline const std::string& ExtensionRangeOptions_VerificationState_Name(ExtensionRangeOptions_VerificationState value) { - return ::google::protobuf::internal::NameOfDenseEnum<ExtensionRangeOptions_VerificationState_descriptor, - 0, 1>( + return ::google::protobuf::internal::NameOfDenseEnum<ExtensionRangeOptions_VerificationState_descriptor, 0, 1>( static_cast<int>(value)); } -inline bool ExtensionRangeOptions_VerificationState_Parse(absl::string_view name, ExtensionRangeOptions_VerificationState* value) { - return ::google::protobuf::internal::ParseNamedEnum<ExtensionRangeOptions_VerificationState>( - ExtensionRangeOptions_VerificationState_descriptor(), name, value); +inline bool ExtensionRangeOptions_VerificationState_Parse( + absl::string_view name, ExtensionRangeOptions_VerificationState* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<ExtensionRangeOptions_VerificationState>(ExtensionRangeOptions_VerificationState_descriptor(), name, + value); } enum FieldDescriptorProto_Type : int { FieldDescriptorProto_Type_TYPE_DOUBLE = 1, @@ -213,13 +340,16 @@ enum FieldDescriptorProto_Type : int { FieldDescriptorProto_Type_TYPE_SINT64 = 18, }; -PROTOBUF_EXPORT bool FieldDescriptorProto_Type_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FieldDescriptorProto_Type_internal_data_[]; -constexpr FieldDescriptorProto_Type FieldDescriptorProto_Type_Type_MIN = static_cast<FieldDescriptorProto_Type>(1); -constexpr FieldDescriptorProto_Type FieldDescriptorProto_Type_Type_MAX = static_cast<FieldDescriptorProto_Type>(18); -constexpr int FieldDescriptorProto_Type_Type_ARRAYSIZE = 18 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FieldDescriptorProto_Type_descriptor(); +inline constexpr FieldDescriptorProto_Type FieldDescriptorProto_Type_Type_MIN = + static_cast<FieldDescriptorProto_Type>(1); +inline constexpr FieldDescriptorProto_Type FieldDescriptorProto_Type_Type_MAX = + static_cast<FieldDescriptorProto_Type>(18); +inline bool FieldDescriptorProto_Type_IsValid(int value) { + return 1 <= value && value <= 18; +} +inline constexpr int FieldDescriptorProto_Type_Type_ARRAYSIZE = 18 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldDescriptorProto_Type_descriptor(); template <typename T> const std::string& FieldDescriptorProto_Type_Name(T value) { static_assert(std::is_same<T, FieldDescriptorProto_Type>::value || @@ -229,13 +359,13 @@ const std::string& FieldDescriptorProto_Type_Name(T value) { } template <> inline const std::string& FieldDescriptorProto_Type_Name(FieldDescriptorProto_Type value) { - return ::google::protobuf::internal::NameOfDenseEnum<FieldDescriptorProto_Type_descriptor, - 1, 18>( + return ::google::protobuf::internal::NameOfDenseEnum<FieldDescriptorProto_Type_descriptor, 1, 18>( static_cast<int>(value)); } -inline bool FieldDescriptorProto_Type_Parse(absl::string_view name, FieldDescriptorProto_Type* value) { - return ::google::protobuf::internal::ParseNamedEnum<FieldDescriptorProto_Type>( - FieldDescriptorProto_Type_descriptor(), name, value); +inline bool FieldDescriptorProto_Type_Parse( + absl::string_view name, FieldDescriptorProto_Type* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FieldDescriptorProto_Type>(FieldDescriptorProto_Type_descriptor(), name, + value); } enum FieldDescriptorProto_Label : int { FieldDescriptorProto_Label_LABEL_OPTIONAL = 1, @@ -243,13 +373,16 @@ enum FieldDescriptorProto_Label : int { FieldDescriptorProto_Label_LABEL_REQUIRED = 2, }; -PROTOBUF_EXPORT bool FieldDescriptorProto_Label_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FieldDescriptorProto_Label_internal_data_[]; -constexpr FieldDescriptorProto_Label FieldDescriptorProto_Label_Label_MIN = static_cast<FieldDescriptorProto_Label>(1); -constexpr FieldDescriptorProto_Label FieldDescriptorProto_Label_Label_MAX = static_cast<FieldDescriptorProto_Label>(3); -constexpr int FieldDescriptorProto_Label_Label_ARRAYSIZE = 3 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FieldDescriptorProto_Label_descriptor(); +inline constexpr FieldDescriptorProto_Label FieldDescriptorProto_Label_Label_MIN = + static_cast<FieldDescriptorProto_Label>(1); +inline constexpr FieldDescriptorProto_Label FieldDescriptorProto_Label_Label_MAX = + static_cast<FieldDescriptorProto_Label>(3); +inline bool FieldDescriptorProto_Label_IsValid(int value) { + return 1 <= value && value <= 3; +} +inline constexpr int FieldDescriptorProto_Label_Label_ARRAYSIZE = 3 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldDescriptorProto_Label_descriptor(); template <typename T> const std::string& FieldDescriptorProto_Label_Name(T value) { static_assert(std::is_same<T, FieldDescriptorProto_Label>::value || @@ -259,13 +392,13 @@ const std::string& FieldDescriptorProto_Label_Name(T value) { } template <> inline const std::string& FieldDescriptorProto_Label_Name(FieldDescriptorProto_Label value) { - return ::google::protobuf::internal::NameOfDenseEnum<FieldDescriptorProto_Label_descriptor, - 1, 3>( + return ::google::protobuf::internal::NameOfDenseEnum<FieldDescriptorProto_Label_descriptor, 1, 3>( static_cast<int>(value)); } -inline bool FieldDescriptorProto_Label_Parse(absl::string_view name, FieldDescriptorProto_Label* value) { - return ::google::protobuf::internal::ParseNamedEnum<FieldDescriptorProto_Label>( - FieldDescriptorProto_Label_descriptor(), name, value); +inline bool FieldDescriptorProto_Label_Parse( + absl::string_view name, FieldDescriptorProto_Label* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FieldDescriptorProto_Label>(FieldDescriptorProto_Label_descriptor(), name, + value); } enum FileOptions_OptimizeMode : int { FileOptions_OptimizeMode_SPEED = 1, @@ -273,13 +406,16 @@ enum FileOptions_OptimizeMode : int { FileOptions_OptimizeMode_LITE_RUNTIME = 3, }; -PROTOBUF_EXPORT bool FileOptions_OptimizeMode_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FileOptions_OptimizeMode_internal_data_[]; -constexpr FileOptions_OptimizeMode FileOptions_OptimizeMode_OptimizeMode_MIN = static_cast<FileOptions_OptimizeMode>(1); -constexpr FileOptions_OptimizeMode FileOptions_OptimizeMode_OptimizeMode_MAX = static_cast<FileOptions_OptimizeMode>(3); -constexpr int FileOptions_OptimizeMode_OptimizeMode_ARRAYSIZE = 3 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FileOptions_OptimizeMode_descriptor(); +inline constexpr FileOptions_OptimizeMode FileOptions_OptimizeMode_OptimizeMode_MIN = + static_cast<FileOptions_OptimizeMode>(1); +inline constexpr FileOptions_OptimizeMode FileOptions_OptimizeMode_OptimizeMode_MAX = + static_cast<FileOptions_OptimizeMode>(3); +inline bool FileOptions_OptimizeMode_IsValid(int value) { + return 1 <= value && value <= 3; +} +inline constexpr int FileOptions_OptimizeMode_OptimizeMode_ARRAYSIZE = 3 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FileOptions_OptimizeMode_descriptor(); template <typename T> const std::string& FileOptions_OptimizeMode_Name(T value) { static_assert(std::is_same<T, FileOptions_OptimizeMode>::value || @@ -289,13 +425,13 @@ const std::string& FileOptions_OptimizeMode_Name(T value) { } template <> inline const std::string& FileOptions_OptimizeMode_Name(FileOptions_OptimizeMode value) { - return ::google::protobuf::internal::NameOfDenseEnum<FileOptions_OptimizeMode_descriptor, - 1, 3>( + return ::google::protobuf::internal::NameOfDenseEnum<FileOptions_OptimizeMode_descriptor, 1, 3>( static_cast<int>(value)); } -inline bool FileOptions_OptimizeMode_Parse(absl::string_view name, FileOptions_OptimizeMode* value) { - return ::google::protobuf::internal::ParseNamedEnum<FileOptions_OptimizeMode>( - FileOptions_OptimizeMode_descriptor(), name, value); +inline bool FileOptions_OptimizeMode_Parse( + absl::string_view name, FileOptions_OptimizeMode* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FileOptions_OptimizeMode>(FileOptions_OptimizeMode_descriptor(), name, + value); } enum FieldOptions_CType : int { FieldOptions_CType_STRING = 0, @@ -303,13 +439,16 @@ enum FieldOptions_CType : int { FieldOptions_CType_STRING_PIECE = 2, }; -PROTOBUF_EXPORT bool FieldOptions_CType_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FieldOptions_CType_internal_data_[]; -constexpr FieldOptions_CType FieldOptions_CType_CType_MIN = static_cast<FieldOptions_CType>(0); -constexpr FieldOptions_CType FieldOptions_CType_CType_MAX = static_cast<FieldOptions_CType>(2); -constexpr int FieldOptions_CType_CType_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FieldOptions_CType_descriptor(); +inline constexpr FieldOptions_CType FieldOptions_CType_CType_MIN = + static_cast<FieldOptions_CType>(0); +inline constexpr FieldOptions_CType FieldOptions_CType_CType_MAX = + static_cast<FieldOptions_CType>(2); +inline bool FieldOptions_CType_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FieldOptions_CType_CType_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_CType_descriptor(); template <typename T> const std::string& FieldOptions_CType_Name(T value) { static_assert(std::is_same<T, FieldOptions_CType>::value || @@ -319,13 +458,13 @@ const std::string& FieldOptions_CType_Name(T value) { } template <> inline const std::string& FieldOptions_CType_Name(FieldOptions_CType value) { - return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_CType_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_CType_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool FieldOptions_CType_Parse(absl::string_view name, FieldOptions_CType* value) { - return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_CType>( - FieldOptions_CType_descriptor(), name, value); +inline bool FieldOptions_CType_Parse( + absl::string_view name, FieldOptions_CType* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_CType>(FieldOptions_CType_descriptor(), name, + value); } enum FieldOptions_JSType : int { FieldOptions_JSType_JS_NORMAL = 0, @@ -333,13 +472,16 @@ enum FieldOptions_JSType : int { FieldOptions_JSType_JS_NUMBER = 2, }; -PROTOBUF_EXPORT bool FieldOptions_JSType_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FieldOptions_JSType_internal_data_[]; -constexpr FieldOptions_JSType FieldOptions_JSType_JSType_MIN = static_cast<FieldOptions_JSType>(0); -constexpr FieldOptions_JSType FieldOptions_JSType_JSType_MAX = static_cast<FieldOptions_JSType>(2); -constexpr int FieldOptions_JSType_JSType_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FieldOptions_JSType_descriptor(); +inline constexpr FieldOptions_JSType FieldOptions_JSType_JSType_MIN = + static_cast<FieldOptions_JSType>(0); +inline constexpr FieldOptions_JSType FieldOptions_JSType_JSType_MAX = + static_cast<FieldOptions_JSType>(2); +inline bool FieldOptions_JSType_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FieldOptions_JSType_JSType_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_JSType_descriptor(); template <typename T> const std::string& FieldOptions_JSType_Name(T value) { static_assert(std::is_same<T, FieldOptions_JSType>::value || @@ -349,13 +491,13 @@ const std::string& FieldOptions_JSType_Name(T value) { } template <> inline const std::string& FieldOptions_JSType_Name(FieldOptions_JSType value) { - return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_JSType_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_JSType_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool FieldOptions_JSType_Parse(absl::string_view name, FieldOptions_JSType* value) { - return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_JSType>( - FieldOptions_JSType_descriptor(), name, value); +inline bool FieldOptions_JSType_Parse( + absl::string_view name, FieldOptions_JSType* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_JSType>(FieldOptions_JSType_descriptor(), name, + value); } enum FieldOptions_OptionRetention : int { FieldOptions_OptionRetention_RETENTION_UNKNOWN = 0, @@ -363,13 +505,16 @@ enum FieldOptions_OptionRetention : int { FieldOptions_OptionRetention_RETENTION_SOURCE = 2, }; -PROTOBUF_EXPORT bool FieldOptions_OptionRetention_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FieldOptions_OptionRetention_internal_data_[]; -constexpr FieldOptions_OptionRetention FieldOptions_OptionRetention_OptionRetention_MIN = static_cast<FieldOptions_OptionRetention>(0); -constexpr FieldOptions_OptionRetention FieldOptions_OptionRetention_OptionRetention_MAX = static_cast<FieldOptions_OptionRetention>(2); -constexpr int FieldOptions_OptionRetention_OptionRetention_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FieldOptions_OptionRetention_descriptor(); +inline constexpr FieldOptions_OptionRetention FieldOptions_OptionRetention_OptionRetention_MIN = + static_cast<FieldOptions_OptionRetention>(0); +inline constexpr FieldOptions_OptionRetention FieldOptions_OptionRetention_OptionRetention_MAX = + static_cast<FieldOptions_OptionRetention>(2); +inline bool FieldOptions_OptionRetention_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FieldOptions_OptionRetention_OptionRetention_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_OptionRetention_descriptor(); template <typename T> const std::string& FieldOptions_OptionRetention_Name(T value) { static_assert(std::is_same<T, FieldOptions_OptionRetention>::value || @@ -379,13 +524,13 @@ const std::string& FieldOptions_OptionRetention_Name(T value) { } template <> inline const std::string& FieldOptions_OptionRetention_Name(FieldOptions_OptionRetention value) { - return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_OptionRetention_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_OptionRetention_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool FieldOptions_OptionRetention_Parse(absl::string_view name, FieldOptions_OptionRetention* value) { - return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_OptionRetention>( - FieldOptions_OptionRetention_descriptor(), name, value); +inline bool FieldOptions_OptionRetention_Parse( + absl::string_view name, FieldOptions_OptionRetention* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_OptionRetention>(FieldOptions_OptionRetention_descriptor(), name, + value); } enum FieldOptions_OptionTargetType : int { FieldOptions_OptionTargetType_TARGET_TYPE_UNKNOWN = 0, @@ -400,13 +545,16 @@ enum FieldOptions_OptionTargetType : int { FieldOptions_OptionTargetType_TARGET_TYPE_METHOD = 9, }; -PROTOBUF_EXPORT bool FieldOptions_OptionTargetType_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FieldOptions_OptionTargetType_internal_data_[]; -constexpr FieldOptions_OptionTargetType FieldOptions_OptionTargetType_OptionTargetType_MIN = static_cast<FieldOptions_OptionTargetType>(0); -constexpr FieldOptions_OptionTargetType FieldOptions_OptionTargetType_OptionTargetType_MAX = static_cast<FieldOptions_OptionTargetType>(9); -constexpr int FieldOptions_OptionTargetType_OptionTargetType_ARRAYSIZE = 9 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FieldOptions_OptionTargetType_descriptor(); +inline constexpr FieldOptions_OptionTargetType FieldOptions_OptionTargetType_OptionTargetType_MIN = + static_cast<FieldOptions_OptionTargetType>(0); +inline constexpr FieldOptions_OptionTargetType FieldOptions_OptionTargetType_OptionTargetType_MAX = + static_cast<FieldOptions_OptionTargetType>(9); +inline bool FieldOptions_OptionTargetType_IsValid(int value) { + return 0 <= value && value <= 9; +} +inline constexpr int FieldOptions_OptionTargetType_OptionTargetType_ARRAYSIZE = 9 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldOptions_OptionTargetType_descriptor(); template <typename T> const std::string& FieldOptions_OptionTargetType_Name(T value) { static_assert(std::is_same<T, FieldOptions_OptionTargetType>::value || @@ -416,13 +564,13 @@ const std::string& FieldOptions_OptionTargetType_Name(T value) { } template <> inline const std::string& FieldOptions_OptionTargetType_Name(FieldOptions_OptionTargetType value) { - return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_OptionTargetType_descriptor, - 0, 9>( + return ::google::protobuf::internal::NameOfDenseEnum<FieldOptions_OptionTargetType_descriptor, 0, 9>( static_cast<int>(value)); } -inline bool FieldOptions_OptionTargetType_Parse(absl::string_view name, FieldOptions_OptionTargetType* value) { - return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_OptionTargetType>( - FieldOptions_OptionTargetType_descriptor(), name, value); +inline bool FieldOptions_OptionTargetType_Parse( + absl::string_view name, FieldOptions_OptionTargetType* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FieldOptions_OptionTargetType>(FieldOptions_OptionTargetType_descriptor(), name, + value); } enum MethodOptions_IdempotencyLevel : int { MethodOptions_IdempotencyLevel_IDEMPOTENCY_UNKNOWN = 0, @@ -430,13 +578,16 @@ enum MethodOptions_IdempotencyLevel : int { MethodOptions_IdempotencyLevel_IDEMPOTENT = 2, }; -PROTOBUF_EXPORT bool MethodOptions_IdempotencyLevel_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t MethodOptions_IdempotencyLevel_internal_data_[]; -constexpr MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel_IdempotencyLevel_MIN = static_cast<MethodOptions_IdempotencyLevel>(0); -constexpr MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel_IdempotencyLevel_MAX = static_cast<MethodOptions_IdempotencyLevel>(2); -constexpr int MethodOptions_IdempotencyLevel_IdempotencyLevel_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -MethodOptions_IdempotencyLevel_descriptor(); +inline constexpr MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel_IdempotencyLevel_MIN = + static_cast<MethodOptions_IdempotencyLevel>(0); +inline constexpr MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel_IdempotencyLevel_MAX = + static_cast<MethodOptions_IdempotencyLevel>(2); +inline bool MethodOptions_IdempotencyLevel_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int MethodOptions_IdempotencyLevel_IdempotencyLevel_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL MethodOptions_IdempotencyLevel_descriptor(); template <typename T> const std::string& MethodOptions_IdempotencyLevel_Name(T value) { static_assert(std::is_same<T, MethodOptions_IdempotencyLevel>::value || @@ -446,13 +597,13 @@ const std::string& MethodOptions_IdempotencyLevel_Name(T value) { } template <> inline const std::string& MethodOptions_IdempotencyLevel_Name(MethodOptions_IdempotencyLevel value) { - return ::google::protobuf::internal::NameOfDenseEnum<MethodOptions_IdempotencyLevel_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<MethodOptions_IdempotencyLevel_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool MethodOptions_IdempotencyLevel_Parse(absl::string_view name, MethodOptions_IdempotencyLevel* value) { - return ::google::protobuf::internal::ParseNamedEnum<MethodOptions_IdempotencyLevel>( - MethodOptions_IdempotencyLevel_descriptor(), name, value); +inline bool MethodOptions_IdempotencyLevel_Parse( + absl::string_view name, MethodOptions_IdempotencyLevel* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<MethodOptions_IdempotencyLevel>(MethodOptions_IdempotencyLevel_descriptor(), name, + value); } enum FeatureSet_FieldPresence : int { FeatureSet_FieldPresence_FIELD_PRESENCE_UNKNOWN = 0, @@ -461,13 +612,16 @@ enum FeatureSet_FieldPresence : int { FeatureSet_FieldPresence_LEGACY_REQUIRED = 3, }; -PROTOBUF_EXPORT bool FeatureSet_FieldPresence_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FeatureSet_FieldPresence_internal_data_[]; -constexpr FeatureSet_FieldPresence FeatureSet_FieldPresence_FieldPresence_MIN = static_cast<FeatureSet_FieldPresence>(0); -constexpr FeatureSet_FieldPresence FeatureSet_FieldPresence_FieldPresence_MAX = static_cast<FeatureSet_FieldPresence>(3); -constexpr int FeatureSet_FieldPresence_FieldPresence_ARRAYSIZE = 3 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FeatureSet_FieldPresence_descriptor(); +inline constexpr FeatureSet_FieldPresence FeatureSet_FieldPresence_FieldPresence_MIN = + static_cast<FeatureSet_FieldPresence>(0); +inline constexpr FeatureSet_FieldPresence FeatureSet_FieldPresence_FieldPresence_MAX = + static_cast<FeatureSet_FieldPresence>(3); +inline bool FeatureSet_FieldPresence_IsValid(int value) { + return 0 <= value && value <= 3; +} +inline constexpr int FeatureSet_FieldPresence_FieldPresence_ARRAYSIZE = 3 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_FieldPresence_descriptor(); template <typename T> const std::string& FeatureSet_FieldPresence_Name(T value) { static_assert(std::is_same<T, FeatureSet_FieldPresence>::value || @@ -477,13 +631,13 @@ const std::string& FeatureSet_FieldPresence_Name(T value) { } template <> inline const std::string& FeatureSet_FieldPresence_Name(FeatureSet_FieldPresence value) { - return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_FieldPresence_descriptor, - 0, 3>( + return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_FieldPresence_descriptor, 0, 3>( static_cast<int>(value)); } -inline bool FeatureSet_FieldPresence_Parse(absl::string_view name, FeatureSet_FieldPresence* value) { - return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_FieldPresence>( - FeatureSet_FieldPresence_descriptor(), name, value); +inline bool FeatureSet_FieldPresence_Parse( + absl::string_view name, FeatureSet_FieldPresence* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_FieldPresence>(FeatureSet_FieldPresence_descriptor(), name, + value); } enum FeatureSet_EnumType : int { FeatureSet_EnumType_ENUM_TYPE_UNKNOWN = 0, @@ -491,13 +645,16 @@ enum FeatureSet_EnumType : int { FeatureSet_EnumType_CLOSED = 2, }; -PROTOBUF_EXPORT bool FeatureSet_EnumType_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FeatureSet_EnumType_internal_data_[]; -constexpr FeatureSet_EnumType FeatureSet_EnumType_EnumType_MIN = static_cast<FeatureSet_EnumType>(0); -constexpr FeatureSet_EnumType FeatureSet_EnumType_EnumType_MAX = static_cast<FeatureSet_EnumType>(2); -constexpr int FeatureSet_EnumType_EnumType_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FeatureSet_EnumType_descriptor(); +inline constexpr FeatureSet_EnumType FeatureSet_EnumType_EnumType_MIN = + static_cast<FeatureSet_EnumType>(0); +inline constexpr FeatureSet_EnumType FeatureSet_EnumType_EnumType_MAX = + static_cast<FeatureSet_EnumType>(2); +inline bool FeatureSet_EnumType_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FeatureSet_EnumType_EnumType_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_EnumType_descriptor(); template <typename T> const std::string& FeatureSet_EnumType_Name(T value) { static_assert(std::is_same<T, FeatureSet_EnumType>::value || @@ -507,13 +664,13 @@ const std::string& FeatureSet_EnumType_Name(T value) { } template <> inline const std::string& FeatureSet_EnumType_Name(FeatureSet_EnumType value) { - return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_EnumType_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_EnumType_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool FeatureSet_EnumType_Parse(absl::string_view name, FeatureSet_EnumType* value) { - return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_EnumType>( - FeatureSet_EnumType_descriptor(), name, value); +inline bool FeatureSet_EnumType_Parse( + absl::string_view name, FeatureSet_EnumType* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_EnumType>(FeatureSet_EnumType_descriptor(), name, + value); } enum FeatureSet_RepeatedFieldEncoding : int { FeatureSet_RepeatedFieldEncoding_REPEATED_FIELD_ENCODING_UNKNOWN = 0, @@ -521,13 +678,16 @@ enum FeatureSet_RepeatedFieldEncoding : int { FeatureSet_RepeatedFieldEncoding_EXPANDED = 2, }; -PROTOBUF_EXPORT bool FeatureSet_RepeatedFieldEncoding_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FeatureSet_RepeatedFieldEncoding_internal_data_[]; -constexpr FeatureSet_RepeatedFieldEncoding FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_MIN = static_cast<FeatureSet_RepeatedFieldEncoding>(0); -constexpr FeatureSet_RepeatedFieldEncoding FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_MAX = static_cast<FeatureSet_RepeatedFieldEncoding>(2); -constexpr int FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FeatureSet_RepeatedFieldEncoding_descriptor(); +inline constexpr FeatureSet_RepeatedFieldEncoding FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_MIN = + static_cast<FeatureSet_RepeatedFieldEncoding>(0); +inline constexpr FeatureSet_RepeatedFieldEncoding FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_MAX = + static_cast<FeatureSet_RepeatedFieldEncoding>(2); +inline bool FeatureSet_RepeatedFieldEncoding_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_RepeatedFieldEncoding_descriptor(); template <typename T> const std::string& FeatureSet_RepeatedFieldEncoding_Name(T value) { static_assert(std::is_same<T, FeatureSet_RepeatedFieldEncoding>::value || @@ -537,13 +697,13 @@ const std::string& FeatureSet_RepeatedFieldEncoding_Name(T value) { } template <> inline const std::string& FeatureSet_RepeatedFieldEncoding_Name(FeatureSet_RepeatedFieldEncoding value) { - return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_RepeatedFieldEncoding_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_RepeatedFieldEncoding_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool FeatureSet_RepeatedFieldEncoding_Parse(absl::string_view name, FeatureSet_RepeatedFieldEncoding* value) { - return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_RepeatedFieldEncoding>( - FeatureSet_RepeatedFieldEncoding_descriptor(), name, value); +inline bool FeatureSet_RepeatedFieldEncoding_Parse( + absl::string_view name, FeatureSet_RepeatedFieldEncoding* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_RepeatedFieldEncoding>(FeatureSet_RepeatedFieldEncoding_descriptor(), name, + value); } enum FeatureSet_Utf8Validation : int { FeatureSet_Utf8Validation_UTF8_VALIDATION_UNKNOWN = 0, @@ -551,13 +711,16 @@ enum FeatureSet_Utf8Validation : int { FeatureSet_Utf8Validation_NONE = 3, }; -PROTOBUF_EXPORT bool FeatureSet_Utf8Validation_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FeatureSet_Utf8Validation_internal_data_[]; -constexpr FeatureSet_Utf8Validation FeatureSet_Utf8Validation_Utf8Validation_MIN = static_cast<FeatureSet_Utf8Validation>(0); -constexpr FeatureSet_Utf8Validation FeatureSet_Utf8Validation_Utf8Validation_MAX = static_cast<FeatureSet_Utf8Validation>(3); -constexpr int FeatureSet_Utf8Validation_Utf8Validation_ARRAYSIZE = 3 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FeatureSet_Utf8Validation_descriptor(); +inline constexpr FeatureSet_Utf8Validation FeatureSet_Utf8Validation_Utf8Validation_MIN = + static_cast<FeatureSet_Utf8Validation>(0); +inline constexpr FeatureSet_Utf8Validation FeatureSet_Utf8Validation_Utf8Validation_MAX = + static_cast<FeatureSet_Utf8Validation>(3); +inline bool FeatureSet_Utf8Validation_IsValid(int value) { + return 0 <= value && value <= 3 && ((13u >> value) & 1) != 0; +} +inline constexpr int FeatureSet_Utf8Validation_Utf8Validation_ARRAYSIZE = 3 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_Utf8Validation_descriptor(); template <typename T> const std::string& FeatureSet_Utf8Validation_Name(T value) { static_assert(std::is_same<T, FeatureSet_Utf8Validation>::value || @@ -567,13 +730,13 @@ const std::string& FeatureSet_Utf8Validation_Name(T value) { } template <> inline const std::string& FeatureSet_Utf8Validation_Name(FeatureSet_Utf8Validation value) { - return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_Utf8Validation_descriptor, - 0, 3>( + return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_Utf8Validation_descriptor, 0, 3>( static_cast<int>(value)); } -inline bool FeatureSet_Utf8Validation_Parse(absl::string_view name, FeatureSet_Utf8Validation* value) { - return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_Utf8Validation>( - FeatureSet_Utf8Validation_descriptor(), name, value); +inline bool FeatureSet_Utf8Validation_Parse( + absl::string_view name, FeatureSet_Utf8Validation* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_Utf8Validation>(FeatureSet_Utf8Validation_descriptor(), name, + value); } enum FeatureSet_MessageEncoding : int { FeatureSet_MessageEncoding_MESSAGE_ENCODING_UNKNOWN = 0, @@ -581,13 +744,16 @@ enum FeatureSet_MessageEncoding : int { FeatureSet_MessageEncoding_DELIMITED = 2, }; -PROTOBUF_EXPORT bool FeatureSet_MessageEncoding_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FeatureSet_MessageEncoding_internal_data_[]; -constexpr FeatureSet_MessageEncoding FeatureSet_MessageEncoding_MessageEncoding_MIN = static_cast<FeatureSet_MessageEncoding>(0); -constexpr FeatureSet_MessageEncoding FeatureSet_MessageEncoding_MessageEncoding_MAX = static_cast<FeatureSet_MessageEncoding>(2); -constexpr int FeatureSet_MessageEncoding_MessageEncoding_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FeatureSet_MessageEncoding_descriptor(); +inline constexpr FeatureSet_MessageEncoding FeatureSet_MessageEncoding_MessageEncoding_MIN = + static_cast<FeatureSet_MessageEncoding>(0); +inline constexpr FeatureSet_MessageEncoding FeatureSet_MessageEncoding_MessageEncoding_MAX = + static_cast<FeatureSet_MessageEncoding>(2); +inline bool FeatureSet_MessageEncoding_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FeatureSet_MessageEncoding_MessageEncoding_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_MessageEncoding_descriptor(); template <typename T> const std::string& FeatureSet_MessageEncoding_Name(T value) { static_assert(std::is_same<T, FeatureSet_MessageEncoding>::value || @@ -597,13 +763,13 @@ const std::string& FeatureSet_MessageEncoding_Name(T value) { } template <> inline const std::string& FeatureSet_MessageEncoding_Name(FeatureSet_MessageEncoding value) { - return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_MessageEncoding_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_MessageEncoding_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool FeatureSet_MessageEncoding_Parse(absl::string_view name, FeatureSet_MessageEncoding* value) { - return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_MessageEncoding>( - FeatureSet_MessageEncoding_descriptor(), name, value); +inline bool FeatureSet_MessageEncoding_Parse( + absl::string_view name, FeatureSet_MessageEncoding* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_MessageEncoding>(FeatureSet_MessageEncoding_descriptor(), name, + value); } enum FeatureSet_JsonFormat : int { FeatureSet_JsonFormat_JSON_FORMAT_UNKNOWN = 0, @@ -611,13 +777,16 @@ enum FeatureSet_JsonFormat : int { FeatureSet_JsonFormat_LEGACY_BEST_EFFORT = 2, }; -PROTOBUF_EXPORT bool FeatureSet_JsonFormat_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t FeatureSet_JsonFormat_internal_data_[]; -constexpr FeatureSet_JsonFormat FeatureSet_JsonFormat_JsonFormat_MIN = static_cast<FeatureSet_JsonFormat>(0); -constexpr FeatureSet_JsonFormat FeatureSet_JsonFormat_JsonFormat_MAX = static_cast<FeatureSet_JsonFormat>(2); -constexpr int FeatureSet_JsonFormat_JsonFormat_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -FeatureSet_JsonFormat_descriptor(); +inline constexpr FeatureSet_JsonFormat FeatureSet_JsonFormat_JsonFormat_MIN = + static_cast<FeatureSet_JsonFormat>(0); +inline constexpr FeatureSet_JsonFormat FeatureSet_JsonFormat_JsonFormat_MAX = + static_cast<FeatureSet_JsonFormat>(2); +inline bool FeatureSet_JsonFormat_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FeatureSet_JsonFormat_JsonFormat_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_JsonFormat_descriptor(); template <typename T> const std::string& FeatureSet_JsonFormat_Name(T value) { static_assert(std::is_same<T, FeatureSet_JsonFormat>::value || @@ -627,13 +796,46 @@ const std::string& FeatureSet_JsonFormat_Name(T value) { } template <> inline const std::string& FeatureSet_JsonFormat_Name(FeatureSet_JsonFormat value) { - return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_JsonFormat_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_JsonFormat_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool FeatureSet_JsonFormat_Parse(absl::string_view name, FeatureSet_JsonFormat* value) { - return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_JsonFormat>( - FeatureSet_JsonFormat_descriptor(), name, value); +inline bool FeatureSet_JsonFormat_Parse( + absl::string_view name, FeatureSet_JsonFormat* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_JsonFormat>(FeatureSet_JsonFormat_descriptor(), name, + value); +} +enum FeatureSet_EnforceNamingStyle : int { + FeatureSet_EnforceNamingStyle_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + FeatureSet_EnforceNamingStyle_STYLE2024 = 1, + FeatureSet_EnforceNamingStyle_STYLE_LEGACY = 2, +}; + +PROTOBUF_EXPORT extern const uint32_t FeatureSet_EnforceNamingStyle_internal_data_[]; +inline constexpr FeatureSet_EnforceNamingStyle FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MIN = + static_cast<FeatureSet_EnforceNamingStyle>(0); +inline constexpr FeatureSet_EnforceNamingStyle FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MAX = + static_cast<FeatureSet_EnforceNamingStyle>(2); +inline bool FeatureSet_EnforceNamingStyle_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FeatureSet_EnforceNamingStyle_EnforceNamingStyle_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_EnforceNamingStyle_descriptor(); +template <typename T> +const std::string& FeatureSet_EnforceNamingStyle_Name(T value) { + static_assert(std::is_same<T, FeatureSet_EnforceNamingStyle>::value || + std::is_integral<T>::value, + "Incorrect type passed to EnforceNamingStyle_Name()."); + return FeatureSet_EnforceNamingStyle_Name(static_cast<FeatureSet_EnforceNamingStyle>(value)); +} +template <> +inline const std::string& FeatureSet_EnforceNamingStyle_Name(FeatureSet_EnforceNamingStyle value) { + return ::google::protobuf::internal::NameOfDenseEnum<FeatureSet_EnforceNamingStyle_descriptor, 0, 2>( + static_cast<int>(value)); +} +inline bool FeatureSet_EnforceNamingStyle_Parse( + absl::string_view name, FeatureSet_EnforceNamingStyle* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<FeatureSet_EnforceNamingStyle>(FeatureSet_EnforceNamingStyle_descriptor(), name, + value); } enum GeneratedCodeInfo_Annotation_Semantic : int { GeneratedCodeInfo_Annotation_Semantic_NONE = 0, @@ -641,13 +843,16 @@ enum GeneratedCodeInfo_Annotation_Semantic : int { GeneratedCodeInfo_Annotation_Semantic_ALIAS = 2, }; -PROTOBUF_EXPORT bool GeneratedCodeInfo_Annotation_Semantic_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t GeneratedCodeInfo_Annotation_Semantic_internal_data_[]; -constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation_Semantic_Semantic_MIN = static_cast<GeneratedCodeInfo_Annotation_Semantic>(0); -constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation_Semantic_Semantic_MAX = static_cast<GeneratedCodeInfo_Annotation_Semantic>(2); -constexpr int GeneratedCodeInfo_Annotation_Semantic_Semantic_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -GeneratedCodeInfo_Annotation_Semantic_descriptor(); +inline constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation_Semantic_Semantic_MIN = + static_cast<GeneratedCodeInfo_Annotation_Semantic>(0); +inline constexpr GeneratedCodeInfo_Annotation_Semantic GeneratedCodeInfo_Annotation_Semantic_Semantic_MAX = + static_cast<GeneratedCodeInfo_Annotation_Semantic>(2); +inline bool GeneratedCodeInfo_Annotation_Semantic_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int GeneratedCodeInfo_Annotation_Semantic_Semantic_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation_Semantic_descriptor(); template <typename T> const std::string& GeneratedCodeInfo_Annotation_Semantic_Name(T value) { static_assert(std::is_same<T, GeneratedCodeInfo_Annotation_Semantic>::value || @@ -657,13 +862,13 @@ const std::string& GeneratedCodeInfo_Annotation_Semantic_Name(T value) { } template <> inline const std::string& GeneratedCodeInfo_Annotation_Semantic_Name(GeneratedCodeInfo_Annotation_Semantic value) { - return ::google::protobuf::internal::NameOfDenseEnum<GeneratedCodeInfo_Annotation_Semantic_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<GeneratedCodeInfo_Annotation_Semantic_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool GeneratedCodeInfo_Annotation_Semantic_Parse(absl::string_view name, GeneratedCodeInfo_Annotation_Semantic* value) { - return ::google::protobuf::internal::ParseNamedEnum<GeneratedCodeInfo_Annotation_Semantic>( - GeneratedCodeInfo_Annotation_Semantic_descriptor(), name, value); +inline bool GeneratedCodeInfo_Annotation_Semantic_Parse( + absl::string_view name, GeneratedCodeInfo_Annotation_Semantic* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<GeneratedCodeInfo_Annotation_Semantic>(GeneratedCodeInfo_Annotation_Semantic_descriptor(), name, + value); } enum Edition : int { EDITION_UNKNOWN = 0, @@ -680,12 +885,15 @@ enum Edition : int { EDITION_MAX = 2147483647, }; -PROTOBUF_EXPORT bool Edition_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t Edition_internal_data_[]; -constexpr Edition Edition_MIN = static_cast<Edition>(0); -constexpr Edition Edition_MAX = static_cast<Edition>(2147483647); -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -Edition_descriptor(); +inline constexpr Edition Edition_MIN = + static_cast<Edition>(0); +inline constexpr Edition Edition_MAX = + static_cast<Edition>(2147483647); +inline bool Edition_IsValid(int value) { + return ::google::protobuf::internal::ValidateEnum(value, Edition_internal_data_); +} +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Edition_descriptor(); template <typename T> const std::string& Edition_Name(T value) { static_assert(std::is_same<T, Edition>::value || @@ -693,9 +901,10 @@ const std::string& Edition_Name(T value) { "Incorrect type passed to Edition_Name()."); return ::google::protobuf::internal::NameOfEnum(Edition_descriptor(), value); } -inline bool Edition_Parse(absl::string_view name, Edition* value) { - return ::google::protobuf::internal::ParseNamedEnum<Edition>( - Edition_descriptor(), name, value); +inline bool Edition_Parse( + absl::string_view name, Edition* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<Edition>(Edition_descriptor(), name, + value); } // =================================================================== @@ -710,15 +919,14 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot ~UninterpretedOption_NamePart() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(UninterpretedOption_NamePart* msg, std::destroying_delete_t) { + void operator delete(UninterpretedOption_NamePart* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(UninterpretedOption_NamePart)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR UninterpretedOption_NamePart( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR UninterpretedOption_NamePart(::google::protobuf::internal::ConstantInitialized); inline UninterpretedOption_NamePart(const UninterpretedOption_NamePart& from) : UninterpretedOption_NamePart(nullptr, from) {} inline UninterpretedOption_NamePart(UninterpretedOption_NamePart&& from) noexcept @@ -741,30 +949,27 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const UninterpretedOption_NamePart& default_instance() { - return *internal_default_instance(); - } - static inline const UninterpretedOption_NamePart* internal_default_instance() { - return reinterpret_cast<const UninterpretedOption_NamePart*>( + return *reinterpret_cast<const UninterpretedOption_NamePart*>( &_UninterpretedOption_NamePart_default_instance_); } static constexpr int kIndexInFileMessages = 24; friend void swap(UninterpretedOption_NamePart& a, UninterpretedOption_NamePart& b) { a.Swap(&b); } - inline void Swap(UninterpretedOption_NamePart* other) { + inline void Swap(UninterpretedOption_NamePart* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -772,7 +977,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(UninterpretedOption_NamePart* other) { + void UnsafeArenaSwap(UninterpretedOption_NamePart* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -780,7 +985,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot // implements Message ---------------------------------------------- - UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena = nullptr) const { + UninterpretedOption_NamePart* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<UninterpretedOption_NamePart>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -789,9 +994,8 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot void MergeFrom(const UninterpretedOption_NamePart& from) { UninterpretedOption_NamePart::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -806,49 +1010,51 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(UninterpretedOption_NamePart* other); + void InternalSwap(UninterpretedOption_NamePart* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.UninterpretedOption.NamePart"; } protected: - explicit UninterpretedOption_NamePart(::google::protobuf::Arena* arena); - UninterpretedOption_NamePart(::google::protobuf::Arena* arena, const UninterpretedOption_NamePart& from); - UninterpretedOption_NamePart(::google::protobuf::Arena* arena, UninterpretedOption_NamePart&& from) noexcept + explicit UninterpretedOption_NamePart(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + UninterpretedOption_NamePart(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UninterpretedOption_NamePart& from); + UninterpretedOption_NamePart( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, UninterpretedOption_NamePart&& from) noexcept : UninterpretedOption_NamePart(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -863,15 +1069,14 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot const std::string& name_part() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name_part(Arg_&& arg, Args_... args); - std::string* mutable_name_part(); - PROTOBUF_NODISCARD std::string* release_name_part(); - void set_allocated_name_part(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name_part(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name_part(); + void set_allocated_name_part(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name_part() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name_part( - const std::string& value); - std::string* _internal_mutable_name_part(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name_part(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name_part(); public: // required bool is_extension = 2; @@ -889,9 +1094,9 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, - 62, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 0, 62, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -901,13 +1106,14 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const UninterpretedOption_NamePart& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const UninterpretedOption_NamePart& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_part_; @@ -917,6 +1123,8 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UninterpretedOption_NamePart_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf::Message @@ -926,15 +1134,14 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: ~SourceCodeInfo_Location() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(SourceCodeInfo_Location* msg, std::destroying_delete_t) { + void operator delete(SourceCodeInfo_Location* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(SourceCodeInfo_Location)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR SourceCodeInfo_Location( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR SourceCodeInfo_Location(::google::protobuf::internal::ConstantInitialized); inline SourceCodeInfo_Location(const SourceCodeInfo_Location& from) : SourceCodeInfo_Location(nullptr, from) {} inline SourceCodeInfo_Location(SourceCodeInfo_Location&& from) noexcept @@ -957,30 +1164,27 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const SourceCodeInfo_Location& default_instance() { - return *internal_default_instance(); - } - static inline const SourceCodeInfo_Location* internal_default_instance() { - return reinterpret_cast<const SourceCodeInfo_Location*>( + return *reinterpret_cast<const SourceCodeInfo_Location*>( &_SourceCodeInfo_Location_default_instance_); } static constexpr int kIndexInFileMessages = 29; friend void swap(SourceCodeInfo_Location& a, SourceCodeInfo_Location& b) { a.Swap(&b); } - inline void Swap(SourceCodeInfo_Location* other) { + inline void Swap(SourceCodeInfo_Location* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -988,7 +1192,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(SourceCodeInfo_Location* other) { + void UnsafeArenaSwap(SourceCodeInfo_Location* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -996,7 +1200,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: // implements Message ---------------------------------------------- - SourceCodeInfo_Location* New(::google::protobuf::Arena* arena = nullptr) const { + SourceCodeInfo_Location* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<SourceCodeInfo_Location>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1005,9 +1209,8 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: void MergeFrom(const SourceCodeInfo_Location& from) { SourceCodeInfo_Location::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1017,49 +1220,51 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(SourceCodeInfo_Location* other); + void InternalSwap(SourceCodeInfo_Location* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.SourceCodeInfo.Location"; } protected: - explicit SourceCodeInfo_Location(::google::protobuf::Arena* arena); - SourceCodeInfo_Location(::google::protobuf::Arena* arena, const SourceCodeInfo_Location& from); - SourceCodeInfo_Location(::google::protobuf::Arena* arena, SourceCodeInfo_Location&& from) noexcept + explicit SourceCodeInfo_Location(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + SourceCodeInfo_Location(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SourceCodeInfo_Location& from); + SourceCodeInfo_Location( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, SourceCodeInfo_Location&& from) noexcept : SourceCodeInfo_Location(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1082,11 +1287,11 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: void set_path(int index, ::int32_t value); void add_path(::int32_t value); const ::google::protobuf::RepeatedField<::int32_t>& path() const; - ::google::protobuf::RepeatedField<::int32_t>* mutable_path(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_path(); private: const ::google::protobuf::RepeatedField<::int32_t>& _internal_path() const; - ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_path(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_path(); public: // repeated int32 span = 2 [packed = true]; @@ -1100,11 +1305,11 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: void set_span(int index, ::int32_t value); void add_span(::int32_t value); const ::google::protobuf::RepeatedField<::int32_t>& span() const; - ::google::protobuf::RepeatedField<::int32_t>* mutable_span(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_span(); private: const ::google::protobuf::RepeatedField<::int32_t>& _internal_span() const; - ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_span(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_span(); public: // repeated string leading_detached_comments = 6; @@ -1115,18 +1320,18 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: public: void clear_leading_detached_comments() ; const std::string& leading_detached_comments(int index) const; - std::string* mutable_leading_detached_comments(int index); + std::string* PROTOBUF_NONNULL mutable_leading_detached_comments(int index); template <typename Arg_ = const std::string&, typename... Args_> void set_leading_detached_comments(int index, Arg_&& value, Args_... args); - std::string* add_leading_detached_comments(); + std::string* PROTOBUF_NONNULL add_leading_detached_comments(); template <typename Arg_ = const std::string&, typename... Args_> void add_leading_detached_comments(Arg_&& value, Args_... args); const ::google::protobuf::RepeatedPtrField<std::string>& leading_detached_comments() const; - ::google::protobuf::RepeatedPtrField<std::string>* mutable_leading_detached_comments(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL mutable_leading_detached_comments(); private: const ::google::protobuf::RepeatedPtrField<std::string>& _internal_leading_detached_comments() const; - ::google::protobuf::RepeatedPtrField<std::string>* _internal_mutable_leading_detached_comments(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL _internal_mutable_leading_detached_comments(); public: // optional string leading_comments = 3; @@ -1135,15 +1340,14 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: const std::string& leading_comments() const; template <typename Arg_ = const std::string&, typename... Args_> void set_leading_comments(Arg_&& arg, Args_... args); - std::string* mutable_leading_comments(); - PROTOBUF_NODISCARD std::string* release_leading_comments(); - void set_allocated_leading_comments(std::string* value); + std::string* PROTOBUF_NONNULL mutable_leading_comments(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_leading_comments(); + void set_allocated_leading_comments(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_leading_comments() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_leading_comments( - const std::string& value); - std::string* _internal_mutable_leading_comments(); + PROTOBUF_ALWAYS_INLINE void _internal_set_leading_comments(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_leading_comments(); public: // optional string trailing_comments = 4; @@ -1152,24 +1356,23 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: const std::string& trailing_comments() const; template <typename Arg_ = const std::string&, typename... Args_> void set_trailing_comments(Arg_&& arg, Args_... args); - std::string* mutable_trailing_comments(); - PROTOBUF_NODISCARD std::string* release_trailing_comments(); - void set_allocated_trailing_comments(std::string* value); + std::string* PROTOBUF_NONNULL mutable_trailing_comments(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_trailing_comments(); + void set_allocated_trailing_comments(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_trailing_comments() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_trailing_comments( - const std::string& value); - std::string* _internal_mutable_trailing_comments(); + PROTOBUF_ALWAYS_INLINE void _internal_set_trailing_comments(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_trailing_comments(); public: // @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo.Location) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 0, - 106, 2> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 0, 106, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1179,13 +1382,14 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const SourceCodeInfo_Location& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const SourceCodeInfo_Location& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedField<::int32_t> path_; @@ -1200,6 +1404,8 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull SourceCodeInfo_Location_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::protobuf::Message @@ -1209,15 +1415,14 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot ~GeneratedCodeInfo_Annotation() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(GeneratedCodeInfo_Annotation* msg, std::destroying_delete_t) { + void operator delete(GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(GeneratedCodeInfo_Annotation)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR GeneratedCodeInfo_Annotation( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR GeneratedCodeInfo_Annotation(::google::protobuf::internal::ConstantInitialized); inline GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from) : GeneratedCodeInfo_Annotation(nullptr, from) {} inline GeneratedCodeInfo_Annotation(GeneratedCodeInfo_Annotation&& from) noexcept @@ -1240,30 +1445,27 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const GeneratedCodeInfo_Annotation& default_instance() { - return *internal_default_instance(); - } - static inline const GeneratedCodeInfo_Annotation* internal_default_instance() { - return reinterpret_cast<const GeneratedCodeInfo_Annotation*>( + return *reinterpret_cast<const GeneratedCodeInfo_Annotation*>( &_GeneratedCodeInfo_Annotation_default_instance_); } static constexpr int kIndexInFileMessages = 31; friend void swap(GeneratedCodeInfo_Annotation& a, GeneratedCodeInfo_Annotation& b) { a.Swap(&b); } - inline void Swap(GeneratedCodeInfo_Annotation* other) { + inline void Swap(GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1271,7 +1473,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(GeneratedCodeInfo_Annotation* other) { + void UnsafeArenaSwap(GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1279,7 +1481,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot // implements Message ---------------------------------------------- - GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena = nullptr) const { + GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<GeneratedCodeInfo_Annotation>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1288,9 +1490,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot void MergeFrom(const GeneratedCodeInfo_Annotation& from) { GeneratedCodeInfo_Annotation::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1300,49 +1501,51 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(GeneratedCodeInfo_Annotation* other); + void InternalSwap(GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.GeneratedCodeInfo.Annotation"; } protected: - explicit GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena); - GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena, const GeneratedCodeInfo_Annotation& from); - GeneratedCodeInfo_Annotation(::google::protobuf::Arena* arena, GeneratedCodeInfo_Annotation&& from) noexcept + explicit GeneratedCodeInfo_Annotation(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + GeneratedCodeInfo_Annotation(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const GeneratedCodeInfo_Annotation& from); + GeneratedCodeInfo_Annotation( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, GeneratedCodeInfo_Annotation&& from) noexcept : GeneratedCodeInfo_Annotation(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using Semantic = GeneratedCodeInfo_Annotation_Semantic; @@ -1355,14 +1558,15 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot static constexpr Semantic Semantic_MIN = GeneratedCodeInfo_Annotation_Semantic_Semantic_MIN; static constexpr Semantic Semantic_MAX = GeneratedCodeInfo_Annotation_Semantic_Semantic_MAX; static constexpr int Semantic_ARRAYSIZE = GeneratedCodeInfo_Annotation_Semantic_Semantic_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Semantic_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Semantic_descriptor() { return GeneratedCodeInfo_Annotation_Semantic_descriptor(); } template <typename T> static inline const std::string& Semantic_Name(T value) { return GeneratedCodeInfo_Annotation_Semantic_Name(value); } - static inline bool Semantic_Parse(absl::string_view name, Semantic* value) { + static inline bool Semantic_Parse( + absl::string_view name, Semantic* PROTOBUF_NONNULL value) { return GeneratedCodeInfo_Annotation_Semantic_Parse(name, value); } @@ -1385,11 +1589,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot void set_path(int index, ::int32_t value); void add_path(::int32_t value); const ::google::protobuf::RepeatedField<::int32_t>& path() const; - ::google::protobuf::RepeatedField<::int32_t>* mutable_path(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_path(); private: const ::google::protobuf::RepeatedField<::int32_t>& _internal_path() const; - ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_path(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_path(); public: // optional string source_file = 2; @@ -1398,15 +1602,14 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot const std::string& source_file() const; template <typename Arg_ = const std::string&, typename... Args_> void set_source_file(Arg_&& arg, Args_... args); - std::string* mutable_source_file(); - PROTOBUF_NODISCARD std::string* release_source_file(); - void set_allocated_source_file(std::string* value); + std::string* PROTOBUF_NONNULL mutable_source_file(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_source_file(); + void set_allocated_source_file(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_source_file() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_source_file( - const std::string& value); - std::string* _internal_mutable_source_file(); + PROTOBUF_ALWAYS_INLINE void _internal_set_source_file(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_source_file(); public: // optional int32 begin = 3; @@ -1446,9 +1649,9 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 1, - 64, 2> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 1, 64, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1458,13 +1661,14 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const GeneratedCodeInfo_Annotation& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const GeneratedCodeInfo_Annotation& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedField<::int32_t> path_; @@ -1478,6 +1682,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull GeneratedCodeInfo_Annotation_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::protobuf::Message @@ -1487,15 +1693,14 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto ~FieldOptions_FeatureSupport() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldOptions_FeatureSupport* msg, std::destroying_delete_t) { + void operator delete(FieldOptions_FeatureSupport* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldOptions_FeatureSupport)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FieldOptions_FeatureSupport( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FieldOptions_FeatureSupport(::google::protobuf::internal::ConstantInitialized); inline FieldOptions_FeatureSupport(const FieldOptions_FeatureSupport& from) : FieldOptions_FeatureSupport(nullptr, from) {} inline FieldOptions_FeatureSupport(FieldOptions_FeatureSupport&& from) noexcept @@ -1518,30 +1723,27 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FieldOptions_FeatureSupport& default_instance() { - return *internal_default_instance(); - } - static inline const FieldOptions_FeatureSupport* internal_default_instance() { - return reinterpret_cast<const FieldOptions_FeatureSupport*>( + return *reinterpret_cast<const FieldOptions_FeatureSupport*>( &_FieldOptions_FeatureSupport_default_instance_); } static constexpr int kIndexInFileMessages = 17; friend void swap(FieldOptions_FeatureSupport& a, FieldOptions_FeatureSupport& b) { a.Swap(&b); } - inline void Swap(FieldOptions_FeatureSupport* other) { + inline void Swap(FieldOptions_FeatureSupport* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1549,7 +1751,7 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FieldOptions_FeatureSupport* other) { + void UnsafeArenaSwap(FieldOptions_FeatureSupport* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1557,7 +1759,7 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto // implements Message ---------------------------------------------- - FieldOptions_FeatureSupport* New(::google::protobuf::Arena* arena = nullptr) const { + FieldOptions_FeatureSupport* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FieldOptions_FeatureSupport>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1566,9 +1768,8 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto void MergeFrom(const FieldOptions_FeatureSupport& from) { FieldOptions_FeatureSupport::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1578,49 +1779,51 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FieldOptions_FeatureSupport* other); + void InternalSwap(FieldOptions_FeatureSupport* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FieldOptions.FeatureSupport"; } protected: - explicit FieldOptions_FeatureSupport(::google::protobuf::Arena* arena); - FieldOptions_FeatureSupport(::google::protobuf::Arena* arena, const FieldOptions_FeatureSupport& from); - FieldOptions_FeatureSupport(::google::protobuf::Arena* arena, FieldOptions_FeatureSupport&& from) noexcept + explicit FieldOptions_FeatureSupport(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FieldOptions_FeatureSupport(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldOptions_FeatureSupport& from); + FieldOptions_FeatureSupport( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldOptions_FeatureSupport&& from) noexcept : FieldOptions_FeatureSupport(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1637,15 +1840,14 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto const std::string& deprecation_warning() const; template <typename Arg_ = const std::string&, typename... Args_> void set_deprecation_warning(Arg_&& arg, Args_... args); - std::string* mutable_deprecation_warning(); - PROTOBUF_NODISCARD std::string* release_deprecation_warning(); - void set_allocated_deprecation_warning(std::string* value); + std::string* PROTOBUF_NONNULL mutable_deprecation_warning(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_deprecation_warning(); + void set_allocated_deprecation_warning(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_deprecation_warning() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_deprecation_warning( - const std::string& value); - std::string* _internal_mutable_deprecation_warning(); + PROTOBUF_ALWAYS_INLINE void _internal_set_deprecation_warning(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_deprecation_warning(); public: // optional .google.protobuf.Edition edition_introduced = 1; @@ -1685,9 +1887,9 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 4, 3, - 71, 2> + static const ::google::protobuf::internal::TcParseTable<2, 4, + 3, 71, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1697,13 +1899,14 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FieldOptions_FeatureSupport& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FieldOptions_FeatureSupport& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr deprecation_warning_; @@ -1715,6 +1918,8 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldOptions_FeatureSupport_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::protobuf::Message @@ -1724,15 +1929,14 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto ~FieldOptions_EditionDefault() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldOptions_EditionDefault* msg, std::destroying_delete_t) { + void operator delete(FieldOptions_EditionDefault* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldOptions_EditionDefault)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FieldOptions_EditionDefault( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FieldOptions_EditionDefault(::google::protobuf::internal::ConstantInitialized); inline FieldOptions_EditionDefault(const FieldOptions_EditionDefault& from) : FieldOptions_EditionDefault(nullptr, from) {} inline FieldOptions_EditionDefault(FieldOptions_EditionDefault&& from) noexcept @@ -1755,30 +1959,27 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FieldOptions_EditionDefault& default_instance() { - return *internal_default_instance(); - } - static inline const FieldOptions_EditionDefault* internal_default_instance() { - return reinterpret_cast<const FieldOptions_EditionDefault*>( + return *reinterpret_cast<const FieldOptions_EditionDefault*>( &_FieldOptions_EditionDefault_default_instance_); } static constexpr int kIndexInFileMessages = 16; friend void swap(FieldOptions_EditionDefault& a, FieldOptions_EditionDefault& b) { a.Swap(&b); } - inline void Swap(FieldOptions_EditionDefault* other) { + inline void Swap(FieldOptions_EditionDefault* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1786,7 +1987,7 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FieldOptions_EditionDefault* other) { + void UnsafeArenaSwap(FieldOptions_EditionDefault* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1794,7 +1995,7 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto // implements Message ---------------------------------------------- - FieldOptions_EditionDefault* New(::google::protobuf::Arena* arena = nullptr) const { + FieldOptions_EditionDefault* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FieldOptions_EditionDefault>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1803,9 +2004,8 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto void MergeFrom(const FieldOptions_EditionDefault& from) { FieldOptions_EditionDefault::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1815,49 +2015,51 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FieldOptions_EditionDefault* other); + void InternalSwap(FieldOptions_EditionDefault* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FieldOptions.EditionDefault"; } protected: - explicit FieldOptions_EditionDefault(::google::protobuf::Arena* arena); - FieldOptions_EditionDefault(::google::protobuf::Arena* arena, const FieldOptions_EditionDefault& from); - FieldOptions_EditionDefault(::google::protobuf::Arena* arena, FieldOptions_EditionDefault&& from) noexcept + explicit FieldOptions_EditionDefault(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FieldOptions_EditionDefault(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldOptions_EditionDefault& from); + FieldOptions_EditionDefault( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldOptions_EditionDefault&& from) noexcept : FieldOptions_EditionDefault(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1872,15 +2074,14 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto const std::string& value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_value(Arg_&& arg, Args_... args); - std::string* mutable_value(); - PROTOBUF_NODISCARD std::string* release_value(); - void set_allocated_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_value(); + void set_allocated_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_value( - const std::string& value); - std::string* _internal_mutable_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_value(); public: // optional .google.protobuf.Edition edition = 3; @@ -1898,9 +2099,9 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 1, - 57, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 1, 57, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1910,13 +2111,14 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FieldOptions_EditionDefault& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FieldOptions_EditionDefault& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr value_; @@ -1926,6 +2128,8 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldOptions_EditionDefault_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message @@ -1935,15 +2139,14 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message ~FeatureSet() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FeatureSet* msg, std::destroying_delete_t) { + void operator delete(FeatureSet* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FeatureSet)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FeatureSet( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FeatureSet(::google::protobuf::internal::ConstantInitialized); inline FeatureSet(const FeatureSet& from) : FeatureSet(nullptr, from) {} inline FeatureSet(FeatureSet&& from) noexcept @@ -1966,30 +2169,27 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FeatureSet& default_instance() { - return *internal_default_instance(); - } - static inline const FeatureSet* internal_default_instance() { - return reinterpret_cast<const FeatureSet*>( + return *reinterpret_cast<const FeatureSet*>( &_FeatureSet_default_instance_); } static constexpr int kIndexInFileMessages = 26; friend void swap(FeatureSet& a, FeatureSet& b) { a.Swap(&b); } - inline void Swap(FeatureSet* other) { + inline void Swap(FeatureSet* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1997,7 +2197,7 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FeatureSet* other) { + void UnsafeArenaSwap(FeatureSet* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -2005,7 +2205,7 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FeatureSet* New(::google::protobuf::Arena* arena = nullptr) const { + FeatureSet* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FeatureSet>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -2014,9 +2214,8 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message void MergeFrom(const FeatureSet& from) { FeatureSet::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -2031,49 +2230,51 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FeatureSet* other); + void InternalSwap(FeatureSet* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FeatureSet"; } protected: - explicit FeatureSet(::google::protobuf::Arena* arena); - FeatureSet(::google::protobuf::Arena* arena, const FeatureSet& from); - FeatureSet(::google::protobuf::Arena* arena, FeatureSet&& from) noexcept + explicit FeatureSet(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FeatureSet(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FeatureSet& from); + FeatureSet( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FeatureSet&& from) noexcept : FeatureSet(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using FieldPresence = FeatureSet_FieldPresence; @@ -2087,14 +2288,15 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message static constexpr FieldPresence FieldPresence_MIN = FeatureSet_FieldPresence_FieldPresence_MIN; static constexpr FieldPresence FieldPresence_MAX = FeatureSet_FieldPresence_FieldPresence_MAX; static constexpr int FieldPresence_ARRAYSIZE = FeatureSet_FieldPresence_FieldPresence_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* FieldPresence_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FieldPresence_descriptor() { return FeatureSet_FieldPresence_descriptor(); } template <typename T> static inline const std::string& FieldPresence_Name(T value) { return FeatureSet_FieldPresence_Name(value); } - static inline bool FieldPresence_Parse(absl::string_view name, FieldPresence* value) { + static inline bool FieldPresence_Parse( + absl::string_view name, FieldPresence* PROTOBUF_NONNULL value) { return FeatureSet_FieldPresence_Parse(name, value); } using EnumType = FeatureSet_EnumType; @@ -2107,14 +2309,15 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message static constexpr EnumType EnumType_MIN = FeatureSet_EnumType_EnumType_MIN; static constexpr EnumType EnumType_MAX = FeatureSet_EnumType_EnumType_MAX; static constexpr int EnumType_ARRAYSIZE = FeatureSet_EnumType_EnumType_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* EnumType_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL EnumType_descriptor() { return FeatureSet_EnumType_descriptor(); } template <typename T> static inline const std::string& EnumType_Name(T value) { return FeatureSet_EnumType_Name(value); } - static inline bool EnumType_Parse(absl::string_view name, EnumType* value) { + static inline bool EnumType_Parse( + absl::string_view name, EnumType* PROTOBUF_NONNULL value) { return FeatureSet_EnumType_Parse(name, value); } using RepeatedFieldEncoding = FeatureSet_RepeatedFieldEncoding; @@ -2127,14 +2330,15 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message static constexpr RepeatedFieldEncoding RepeatedFieldEncoding_MIN = FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_MIN; static constexpr RepeatedFieldEncoding RepeatedFieldEncoding_MAX = FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_MAX; static constexpr int RepeatedFieldEncoding_ARRAYSIZE = FeatureSet_RepeatedFieldEncoding_RepeatedFieldEncoding_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* RepeatedFieldEncoding_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL RepeatedFieldEncoding_descriptor() { return FeatureSet_RepeatedFieldEncoding_descriptor(); } template <typename T> static inline const std::string& RepeatedFieldEncoding_Name(T value) { return FeatureSet_RepeatedFieldEncoding_Name(value); } - static inline bool RepeatedFieldEncoding_Parse(absl::string_view name, RepeatedFieldEncoding* value) { + static inline bool RepeatedFieldEncoding_Parse( + absl::string_view name, RepeatedFieldEncoding* PROTOBUF_NONNULL value) { return FeatureSet_RepeatedFieldEncoding_Parse(name, value); } using Utf8Validation = FeatureSet_Utf8Validation; @@ -2147,14 +2351,15 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message static constexpr Utf8Validation Utf8Validation_MIN = FeatureSet_Utf8Validation_Utf8Validation_MIN; static constexpr Utf8Validation Utf8Validation_MAX = FeatureSet_Utf8Validation_Utf8Validation_MAX; static constexpr int Utf8Validation_ARRAYSIZE = FeatureSet_Utf8Validation_Utf8Validation_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Utf8Validation_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Utf8Validation_descriptor() { return FeatureSet_Utf8Validation_descriptor(); } template <typename T> static inline const std::string& Utf8Validation_Name(T value) { return FeatureSet_Utf8Validation_Name(value); } - static inline bool Utf8Validation_Parse(absl::string_view name, Utf8Validation* value) { + static inline bool Utf8Validation_Parse( + absl::string_view name, Utf8Validation* PROTOBUF_NONNULL value) { return FeatureSet_Utf8Validation_Parse(name, value); } using MessageEncoding = FeatureSet_MessageEncoding; @@ -2167,14 +2372,15 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message static constexpr MessageEncoding MessageEncoding_MIN = FeatureSet_MessageEncoding_MessageEncoding_MIN; static constexpr MessageEncoding MessageEncoding_MAX = FeatureSet_MessageEncoding_MessageEncoding_MAX; static constexpr int MessageEncoding_ARRAYSIZE = FeatureSet_MessageEncoding_MessageEncoding_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* MessageEncoding_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL MessageEncoding_descriptor() { return FeatureSet_MessageEncoding_descriptor(); } template <typename T> static inline const std::string& MessageEncoding_Name(T value) { return FeatureSet_MessageEncoding_Name(value); } - static inline bool MessageEncoding_Parse(absl::string_view name, MessageEncoding* value) { + static inline bool MessageEncoding_Parse( + absl::string_view name, MessageEncoding* PROTOBUF_NONNULL value) { return FeatureSet_MessageEncoding_Parse(name, value); } using JsonFormat = FeatureSet_JsonFormat; @@ -2187,16 +2393,38 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message static constexpr JsonFormat JsonFormat_MIN = FeatureSet_JsonFormat_JsonFormat_MIN; static constexpr JsonFormat JsonFormat_MAX = FeatureSet_JsonFormat_JsonFormat_MAX; static constexpr int JsonFormat_ARRAYSIZE = FeatureSet_JsonFormat_JsonFormat_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* JsonFormat_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL JsonFormat_descriptor() { return FeatureSet_JsonFormat_descriptor(); } template <typename T> static inline const std::string& JsonFormat_Name(T value) { return FeatureSet_JsonFormat_Name(value); } - static inline bool JsonFormat_Parse(absl::string_view name, JsonFormat* value) { + static inline bool JsonFormat_Parse( + absl::string_view name, JsonFormat* PROTOBUF_NONNULL value) { return FeatureSet_JsonFormat_Parse(name, value); } + using EnforceNamingStyle = FeatureSet_EnforceNamingStyle; + static constexpr EnforceNamingStyle ENFORCE_NAMING_STYLE_UNKNOWN = FeatureSet_EnforceNamingStyle_ENFORCE_NAMING_STYLE_UNKNOWN; + static constexpr EnforceNamingStyle STYLE2024 = FeatureSet_EnforceNamingStyle_STYLE2024; + static constexpr EnforceNamingStyle STYLE_LEGACY = FeatureSet_EnforceNamingStyle_STYLE_LEGACY; + static inline bool EnforceNamingStyle_IsValid(int value) { + return FeatureSet_EnforceNamingStyle_IsValid(value); + } + static constexpr EnforceNamingStyle EnforceNamingStyle_MIN = FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MIN; + static constexpr EnforceNamingStyle EnforceNamingStyle_MAX = FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MAX; + static constexpr int EnforceNamingStyle_ARRAYSIZE = FeatureSet_EnforceNamingStyle_EnforceNamingStyle_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL EnforceNamingStyle_descriptor() { + return FeatureSet_EnforceNamingStyle_descriptor(); + } + template <typename T> + static inline const std::string& EnforceNamingStyle_Name(T value) { + return FeatureSet_EnforceNamingStyle_Name(value); + } + static inline bool EnforceNamingStyle_Parse( + absl::string_view name, EnforceNamingStyle* PROTOBUF_NONNULL value) { + return FeatureSet_EnforceNamingStyle_Parse(name, value); + } // accessors ------------------------------------------------------- enum : int { @@ -2206,6 +2434,7 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message kUtf8ValidationFieldNumber = 4, kMessageEncodingFieldNumber = 5, kJsonFormatFieldNumber = 6, + kEnforceNamingStyleFieldNumber = 7, }; // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { bool has_field_presence() const; @@ -2272,6 +2501,17 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message ::google::protobuf::FeatureSet_JsonFormat _internal_json_format() const; void _internal_set_json_format(::google::protobuf::FeatureSet_JsonFormat value); + public: + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + bool has_enforce_naming_style() const; + void clear_enforce_naming_style() ; + ::google::protobuf::FeatureSet_EnforceNamingStyle enforce_naming_style() const; + void set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value); + + private: + ::google::protobuf::FeatureSet_EnforceNamingStyle _internal_enforce_naming_style() const; + void _internal_set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value); + public: template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed, @@ -2356,11 +2596,9 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<FeatureSet, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + FeatureSet, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -2444,7 +2682,7 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<FeatureSet, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -2456,9 +2694,9 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 6, 6, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<3, 7, + 7, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -2468,13 +2706,14 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FeatureSet& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FeatureSet& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; @@ -2484,11 +2723,14 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message int utf8_validation_; int message_encoding_; int json_format_; + int enforce_naming_style_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FeatureSet_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google::protobuf::Message @@ -2498,15 +2740,14 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: ~ExtensionRangeOptions_Declaration() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(ExtensionRangeOptions_Declaration* msg, std::destroying_delete_t) { + void operator delete(ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(ExtensionRangeOptions_Declaration)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR ExtensionRangeOptions_Declaration( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR ExtensionRangeOptions_Declaration(::google::protobuf::internal::ConstantInitialized); inline ExtensionRangeOptions_Declaration(const ExtensionRangeOptions_Declaration& from) : ExtensionRangeOptions_Declaration(nullptr, from) {} inline ExtensionRangeOptions_Declaration(ExtensionRangeOptions_Declaration&& from) noexcept @@ -2529,30 +2770,27 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const ExtensionRangeOptions_Declaration& default_instance() { - return *internal_default_instance(); - } - static inline const ExtensionRangeOptions_Declaration* internal_default_instance() { - return reinterpret_cast<const ExtensionRangeOptions_Declaration*>( + return *reinterpret_cast<const ExtensionRangeOptions_Declaration*>( &_ExtensionRangeOptions_Declaration_default_instance_); } static constexpr int kIndexInFileMessages = 5; friend void swap(ExtensionRangeOptions_Declaration& a, ExtensionRangeOptions_Declaration& b) { a.Swap(&b); } - inline void Swap(ExtensionRangeOptions_Declaration* other) { + inline void Swap(ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -2560,7 +2798,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(ExtensionRangeOptions_Declaration* other) { + void UnsafeArenaSwap(ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -2568,7 +2806,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: // implements Message ---------------------------------------------- - ExtensionRangeOptions_Declaration* New(::google::protobuf::Arena* arena = nullptr) const { + ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<ExtensionRangeOptions_Declaration>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -2577,9 +2815,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: void MergeFrom(const ExtensionRangeOptions_Declaration& from) { ExtensionRangeOptions_Declaration::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -2589,49 +2826,51 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(ExtensionRangeOptions_Declaration* other); + void InternalSwap(ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.ExtensionRangeOptions.Declaration"; } protected: - explicit ExtensionRangeOptions_Declaration(::google::protobuf::Arena* arena); - ExtensionRangeOptions_Declaration(::google::protobuf::Arena* arena, const ExtensionRangeOptions_Declaration& from); - ExtensionRangeOptions_Declaration(::google::protobuf::Arena* arena, ExtensionRangeOptions_Declaration&& from) noexcept + explicit ExtensionRangeOptions_Declaration(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + ExtensionRangeOptions_Declaration(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ExtensionRangeOptions_Declaration& from); + ExtensionRangeOptions_Declaration( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, ExtensionRangeOptions_Declaration&& from) noexcept : ExtensionRangeOptions_Declaration(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -2649,15 +2888,14 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: const std::string& full_name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_full_name(Arg_&& arg, Args_... args); - std::string* mutable_full_name(); - PROTOBUF_NODISCARD std::string* release_full_name(); - void set_allocated_full_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_full_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_full_name(); + void set_allocated_full_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_full_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_full_name( - const std::string& value); - std::string* _internal_mutable_full_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_full_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_full_name(); public: // optional string type = 3; @@ -2666,15 +2904,14 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: const std::string& type() const; template <typename Arg_ = const std::string&, typename... Args_> void set_type(Arg_&& arg, Args_... args); - std::string* mutable_type(); - PROTOBUF_NODISCARD std::string* release_type(); - void set_allocated_type(std::string* value); + std::string* PROTOBUF_NONNULL mutable_type(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_type(); + void set_allocated_type(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_type() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_type( - const std::string& value); - std::string* _internal_mutable_type(); + PROTOBUF_ALWAYS_INLINE void _internal_set_type(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_type(); public: // optional int32 number = 1; @@ -2714,9 +2951,9 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 0, - 71, 2> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 0, 71, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -2726,13 +2963,14 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const ExtensionRangeOptions_Declaration& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ExtensionRangeOptions_Declaration& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr full_name_; @@ -2745,6 +2983,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ExtensionRangeOptions_Declaration_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::google::protobuf::Message @@ -2754,15 +2994,14 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo ~EnumDescriptorProto_EnumReservedRange() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(EnumDescriptorProto_EnumReservedRange* msg, std::destroying_delete_t) { + void operator delete(EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(EnumDescriptorProto_EnumReservedRange)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR EnumDescriptorProto_EnumReservedRange( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR EnumDescriptorProto_EnumReservedRange(::google::protobuf::internal::ConstantInitialized); inline EnumDescriptorProto_EnumReservedRange(const EnumDescriptorProto_EnumReservedRange& from) : EnumDescriptorProto_EnumReservedRange(nullptr, from) {} inline EnumDescriptorProto_EnumReservedRange(EnumDescriptorProto_EnumReservedRange&& from) noexcept @@ -2785,30 +3024,27 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const EnumDescriptorProto_EnumReservedRange& default_instance() { - return *internal_default_instance(); - } - static inline const EnumDescriptorProto_EnumReservedRange* internal_default_instance() { - return reinterpret_cast<const EnumDescriptorProto_EnumReservedRange*>( + return *reinterpret_cast<const EnumDescriptorProto_EnumReservedRange*>( &_EnumDescriptorProto_EnumReservedRange_default_instance_); } static constexpr int kIndexInFileMessages = 9; friend void swap(EnumDescriptorProto_EnumReservedRange& a, EnumDescriptorProto_EnumReservedRange& b) { a.Swap(&b); } - inline void Swap(EnumDescriptorProto_EnumReservedRange* other) { + inline void Swap(EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -2816,7 +3052,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(EnumDescriptorProto_EnumReservedRange* other) { + void UnsafeArenaSwap(EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -2824,7 +3060,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo // implements Message ---------------------------------------------- - EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena = nullptr) const { + EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<EnumDescriptorProto_EnumReservedRange>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -2833,9 +3069,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo void MergeFrom(const EnumDescriptorProto_EnumReservedRange& from) { EnumDescriptorProto_EnumReservedRange::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -2845,49 +3080,51 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(EnumDescriptorProto_EnumReservedRange* other); + void InternalSwap(EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.EnumDescriptorProto.EnumReservedRange"; } protected: - explicit EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena); - EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena, const EnumDescriptorProto_EnumReservedRange& from); - EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* arena, EnumDescriptorProto_EnumReservedRange&& from) noexcept + explicit EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + EnumDescriptorProto_EnumReservedRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumDescriptorProto_EnumReservedRange& from); + EnumDescriptorProto_EnumReservedRange( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EnumDescriptorProto_EnumReservedRange&& from) noexcept : EnumDescriptorProto_EnumReservedRange(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -2922,9 +3159,9 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -2934,13 +3171,14 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const EnumDescriptorProto_EnumReservedRange& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const EnumDescriptorProto_EnumReservedRange& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::int32_t start_; @@ -2950,6 +3188,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumDescriptorProto_EnumReservedRange_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::protobuf::Message @@ -2959,15 +3199,14 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro ~DescriptorProto_ReservedRange() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(DescriptorProto_ReservedRange* msg, std::destroying_delete_t) { + void operator delete(DescriptorProto_ReservedRange* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(DescriptorProto_ReservedRange)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR DescriptorProto_ReservedRange( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR DescriptorProto_ReservedRange(::google::protobuf::internal::ConstantInitialized); inline DescriptorProto_ReservedRange(const DescriptorProto_ReservedRange& from) : DescriptorProto_ReservedRange(nullptr, from) {} inline DescriptorProto_ReservedRange(DescriptorProto_ReservedRange&& from) noexcept @@ -2990,30 +3229,27 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const DescriptorProto_ReservedRange& default_instance() { - return *internal_default_instance(); - } - static inline const DescriptorProto_ReservedRange* internal_default_instance() { - return reinterpret_cast<const DescriptorProto_ReservedRange*>( + return *reinterpret_cast<const DescriptorProto_ReservedRange*>( &_DescriptorProto_ReservedRange_default_instance_); } static constexpr int kIndexInFileMessages = 3; friend void swap(DescriptorProto_ReservedRange& a, DescriptorProto_ReservedRange& b) { a.Swap(&b); } - inline void Swap(DescriptorProto_ReservedRange* other) { + inline void Swap(DescriptorProto_ReservedRange* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -3021,7 +3257,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(DescriptorProto_ReservedRange* other) { + void UnsafeArenaSwap(DescriptorProto_ReservedRange* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -3029,7 +3265,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro // implements Message ---------------------------------------------- - DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena = nullptr) const { + DescriptorProto_ReservedRange* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<DescriptorProto_ReservedRange>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3038,9 +3274,8 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro void MergeFrom(const DescriptorProto_ReservedRange& from) { DescriptorProto_ReservedRange::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -3050,49 +3285,51 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(DescriptorProto_ReservedRange* other); + void InternalSwap(DescriptorProto_ReservedRange* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.DescriptorProto.ReservedRange"; } protected: - explicit DescriptorProto_ReservedRange(::google::protobuf::Arena* arena); - DescriptorProto_ReservedRange(::google::protobuf::Arena* arena, const DescriptorProto_ReservedRange& from); - DescriptorProto_ReservedRange(::google::protobuf::Arena* arena, DescriptorProto_ReservedRange&& from) noexcept + explicit DescriptorProto_ReservedRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + DescriptorProto_ReservedRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DescriptorProto_ReservedRange& from); + DescriptorProto_ReservedRange( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, DescriptorProto_ReservedRange&& from) noexcept : DescriptorProto_ReservedRange(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -3127,9 +3364,9 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -3139,13 +3376,14 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const DescriptorProto_ReservedRange& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const DescriptorProto_ReservedRange& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::int32_t start_; @@ -3155,6 +3393,8 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DescriptorProto_ReservedRange_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Message @@ -3164,15 +3404,14 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes ~UninterpretedOption() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(UninterpretedOption* msg, std::destroying_delete_t) { + void operator delete(UninterpretedOption* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(UninterpretedOption)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR UninterpretedOption( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR UninterpretedOption(::google::protobuf::internal::ConstantInitialized); inline UninterpretedOption(const UninterpretedOption& from) : UninterpretedOption(nullptr, from) {} inline UninterpretedOption(UninterpretedOption&& from) noexcept @@ -3195,30 +3434,27 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const UninterpretedOption& default_instance() { - return *internal_default_instance(); - } - static inline const UninterpretedOption* internal_default_instance() { - return reinterpret_cast<const UninterpretedOption*>( + return *reinterpret_cast<const UninterpretedOption*>( &_UninterpretedOption_default_instance_); } static constexpr int kIndexInFileMessages = 25; friend void swap(UninterpretedOption& a, UninterpretedOption& b) { a.Swap(&b); } - inline void Swap(UninterpretedOption* other) { + inline void Swap(UninterpretedOption* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -3226,7 +3462,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(UninterpretedOption* other) { + void UnsafeArenaSwap(UninterpretedOption* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -3234,7 +3470,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - UninterpretedOption* New(::google::protobuf::Arena* arena = nullptr) const { + UninterpretedOption* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<UninterpretedOption>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3243,9 +3479,8 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes void MergeFrom(const UninterpretedOption& from) { UninterpretedOption::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -3260,49 +3495,51 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(UninterpretedOption* other); + void InternalSwap(UninterpretedOption* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.UninterpretedOption"; } protected: - explicit UninterpretedOption(::google::protobuf::Arena* arena); - UninterpretedOption(::google::protobuf::Arena* arena, const UninterpretedOption& from); - UninterpretedOption(::google::protobuf::Arena* arena, UninterpretedOption&& from) noexcept + explicit UninterpretedOption(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + UninterpretedOption(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UninterpretedOption& from); + UninterpretedOption( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, UninterpretedOption&& from) noexcept : UninterpretedOption(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using NamePart = UninterpretedOption_NamePart; @@ -3324,15 +3561,15 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes public: void clear_name() ; - ::google::protobuf::UninterpretedOption_NamePart* mutable_name(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* mutable_name(); + ::google::protobuf::UninterpretedOption_NamePart* PROTOBUF_NONNULL mutable_name(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* PROTOBUF_NONNULL mutable_name(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>& _internal_name() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* _internal_mutable_name(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* PROTOBUF_NONNULL _internal_mutable_name(); public: const ::google::protobuf::UninterpretedOption_NamePart& name(int index) const; - ::google::protobuf::UninterpretedOption_NamePart* add_name(); + ::google::protobuf::UninterpretedOption_NamePart* PROTOBUF_NONNULL add_name(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>& name() const; // optional string identifier_value = 3; bool has_identifier_value() const; @@ -3340,15 +3577,14 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes const std::string& identifier_value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_identifier_value(Arg_&& arg, Args_... args); - std::string* mutable_identifier_value(); - PROTOBUF_NODISCARD std::string* release_identifier_value(); - void set_allocated_identifier_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_identifier_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_identifier_value(); + void set_allocated_identifier_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_identifier_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_identifier_value( - const std::string& value); - std::string* _internal_mutable_identifier_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_identifier_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_identifier_value(); public: // optional bytes string_value = 7; @@ -3357,15 +3593,14 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes const std::string& string_value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_string_value(Arg_&& arg, Args_... args); - std::string* mutable_string_value(); - PROTOBUF_NODISCARD std::string* release_string_value(); - void set_allocated_string_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_string_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_string_value(); + void set_allocated_string_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_string_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_string_value( - const std::string& value); - std::string* _internal_mutable_string_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_string_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_string_value(); public: // optional string aggregate_value = 8; @@ -3374,15 +3609,14 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes const std::string& aggregate_value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_aggregate_value(Arg_&& arg, Args_... args); - std::string* mutable_aggregate_value(); - PROTOBUF_NODISCARD std::string* release_aggregate_value(); - void set_allocated_aggregate_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_aggregate_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_aggregate_value(); + void set_allocated_aggregate_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_aggregate_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_aggregate_value( - const std::string& value); - std::string* _internal_mutable_aggregate_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_aggregate_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_aggregate_value(); public: // optional uint64 positive_int_value = 4; @@ -3422,9 +3656,9 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 7, 1, - 75, 2> + static const ::google::protobuf::internal::TcParseTable<3, 7, + 1, 75, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -3434,13 +3668,14 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const UninterpretedOption& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const UninterpretedOption& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart > name_; @@ -3455,6 +3690,8 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UninterpretedOption_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message @@ -3464,15 +3701,14 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message ~SourceCodeInfo() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(SourceCodeInfo* msg, std::destroying_delete_t) { + void operator delete(SourceCodeInfo* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(SourceCodeInfo)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR SourceCodeInfo( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR SourceCodeInfo(::google::protobuf::internal::ConstantInitialized); inline SourceCodeInfo(const SourceCodeInfo& from) : SourceCodeInfo(nullptr, from) {} inline SourceCodeInfo(SourceCodeInfo&& from) noexcept @@ -3495,30 +3731,27 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const SourceCodeInfo& default_instance() { - return *internal_default_instance(); - } - static inline const SourceCodeInfo* internal_default_instance() { - return reinterpret_cast<const SourceCodeInfo*>( + return *reinterpret_cast<const SourceCodeInfo*>( &_SourceCodeInfo_default_instance_); } static constexpr int kIndexInFileMessages = 30; friend void swap(SourceCodeInfo& a, SourceCodeInfo& b) { a.Swap(&b); } - inline void Swap(SourceCodeInfo* other) { + inline void Swap(SourceCodeInfo* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -3526,7 +3759,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(SourceCodeInfo* other) { + void UnsafeArenaSwap(SourceCodeInfo* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -3534,7 +3767,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - SourceCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const { + SourceCodeInfo* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<SourceCodeInfo>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3543,9 +3776,8 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message void MergeFrom(const SourceCodeInfo& from) { SourceCodeInfo::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -3560,49 +3792,51 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(SourceCodeInfo* other); + void InternalSwap(SourceCodeInfo* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.SourceCodeInfo"; } protected: - explicit SourceCodeInfo(::google::protobuf::Arena* arena); - SourceCodeInfo(::google::protobuf::Arena* arena, const SourceCodeInfo& from); - SourceCodeInfo(::google::protobuf::Arena* arena, SourceCodeInfo&& from) noexcept + explicit SourceCodeInfo(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + SourceCodeInfo(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SourceCodeInfo& from); + SourceCodeInfo( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, SourceCodeInfo&& from) noexcept : SourceCodeInfo(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using Location = SourceCodeInfo_Location; @@ -3618,15 +3852,15 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message public: void clear_location() ; - ::google::protobuf::SourceCodeInfo_Location* mutable_location(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* mutable_location(); + ::google::protobuf::SourceCodeInfo_Location* PROTOBUF_NONNULL mutable_location(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* PROTOBUF_NONNULL mutable_location(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>& _internal_location() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* _internal_mutable_location(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* PROTOBUF_NONNULL _internal_mutable_location(); public: const ::google::protobuf::SourceCodeInfo_Location& location(int index) const; - ::google::protobuf::SourceCodeInfo_Location* add_location(); + ::google::protobuf::SourceCodeInfo_Location* PROTOBUF_NONNULL add_location(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>& location() const; template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed, @@ -3711,11 +3945,9 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<SourceCodeInfo, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + SourceCodeInfo, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -3799,7 +4031,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<SourceCodeInfo, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -3811,9 +4043,9 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 1, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 1, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -3823,13 +4055,14 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const SourceCodeInfo& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const SourceCodeInfo& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location > location_; ::google::protobuf::internal::CachedSize _cached_size_; @@ -3838,6 +4071,8 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull SourceCodeInfo_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Message @@ -3847,15 +4082,14 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa ~GeneratedCodeInfo() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(GeneratedCodeInfo* msg, std::destroying_delete_t) { + void operator delete(GeneratedCodeInfo* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(GeneratedCodeInfo)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR GeneratedCodeInfo( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR GeneratedCodeInfo(::google::protobuf::internal::ConstantInitialized); inline GeneratedCodeInfo(const GeneratedCodeInfo& from) : GeneratedCodeInfo(nullptr, from) {} inline GeneratedCodeInfo(GeneratedCodeInfo&& from) noexcept @@ -3878,30 +4112,27 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const GeneratedCodeInfo& default_instance() { - return *internal_default_instance(); - } - static inline const GeneratedCodeInfo* internal_default_instance() { - return reinterpret_cast<const GeneratedCodeInfo*>( + return *reinterpret_cast<const GeneratedCodeInfo*>( &_GeneratedCodeInfo_default_instance_); } static constexpr int kIndexInFileMessages = 32; friend void swap(GeneratedCodeInfo& a, GeneratedCodeInfo& b) { a.Swap(&b); } - inline void Swap(GeneratedCodeInfo* other) { + inline void Swap(GeneratedCodeInfo* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -3909,7 +4140,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(GeneratedCodeInfo* other) { + void UnsafeArenaSwap(GeneratedCodeInfo* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -3917,7 +4148,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa // implements Message ---------------------------------------------- - GeneratedCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const { + GeneratedCodeInfo* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<GeneratedCodeInfo>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3926,9 +4157,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa void MergeFrom(const GeneratedCodeInfo& from) { GeneratedCodeInfo::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -3938,49 +4168,51 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(GeneratedCodeInfo* other); + void InternalSwap(GeneratedCodeInfo* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.GeneratedCodeInfo"; } protected: - explicit GeneratedCodeInfo(::google::protobuf::Arena* arena); - GeneratedCodeInfo(::google::protobuf::Arena* arena, const GeneratedCodeInfo& from); - GeneratedCodeInfo(::google::protobuf::Arena* arena, GeneratedCodeInfo&& from) noexcept + explicit GeneratedCodeInfo(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + GeneratedCodeInfo(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const GeneratedCodeInfo& from); + GeneratedCodeInfo( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, GeneratedCodeInfo&& from) noexcept : GeneratedCodeInfo(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using Annotation = GeneratedCodeInfo_Annotation; @@ -3996,23 +4228,23 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa public: void clear_annotation() ; - ::google::protobuf::GeneratedCodeInfo_Annotation* mutable_annotation(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* mutable_annotation(); + ::google::protobuf::GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL mutable_annotation(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* PROTOBUF_NONNULL mutable_annotation(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>& _internal_annotation() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* _internal_mutable_annotation(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* PROTOBUF_NONNULL _internal_mutable_annotation(); public: const ::google::protobuf::GeneratedCodeInfo_Annotation& annotation(int index) const; - ::google::protobuf::GeneratedCodeInfo_Annotation* add_annotation(); + ::google::protobuf::GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL add_annotation(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>& annotation() const; // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 1, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 1, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -4022,13 +4254,14 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const GeneratedCodeInfo& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const GeneratedCodeInfo& from_msg); ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation > annotation_; ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER @@ -4036,6 +4269,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull GeneratedCodeInfo_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public ::google::protobuf::Message @@ -4045,15 +4280,14 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public ~FeatureSetDefaults_FeatureSetEditionDefault() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FeatureSetDefaults_FeatureSetEditionDefault* msg, std::destroying_delete_t) { + void operator delete(FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FeatureSetDefaults_FeatureSetEditionDefault)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FeatureSetDefaults_FeatureSetEditionDefault( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::internal::ConstantInitialized); inline FeatureSetDefaults_FeatureSetEditionDefault(const FeatureSetDefaults_FeatureSetEditionDefault& from) : FeatureSetDefaults_FeatureSetEditionDefault(nullptr, from) {} inline FeatureSetDefaults_FeatureSetEditionDefault(FeatureSetDefaults_FeatureSetEditionDefault&& from) noexcept @@ -4076,30 +4310,27 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FeatureSetDefaults_FeatureSetEditionDefault& default_instance() { - return *internal_default_instance(); - } - static inline const FeatureSetDefaults_FeatureSetEditionDefault* internal_default_instance() { - return reinterpret_cast<const FeatureSetDefaults_FeatureSetEditionDefault*>( + return *reinterpret_cast<const FeatureSetDefaults_FeatureSetEditionDefault*>( &_FeatureSetDefaults_FeatureSetEditionDefault_default_instance_); } static constexpr int kIndexInFileMessages = 27; friend void swap(FeatureSetDefaults_FeatureSetEditionDefault& a, FeatureSetDefaults_FeatureSetEditionDefault& b) { a.Swap(&b); } - inline void Swap(FeatureSetDefaults_FeatureSetEditionDefault* other) { + inline void Swap(FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -4107,7 +4338,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FeatureSetDefaults_FeatureSetEditionDefault* other) { + void UnsafeArenaSwap(FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -4115,7 +4346,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public // implements Message ---------------------------------------------- - FeatureSetDefaults_FeatureSetEditionDefault* New(::google::protobuf::Arena* arena = nullptr) const { + FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FeatureSetDefaults_FeatureSetEditionDefault>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -4124,9 +4355,8 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public void MergeFrom(const FeatureSetDefaults_FeatureSetEditionDefault& from) { FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -4141,49 +4371,51 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FeatureSetDefaults_FeatureSetEditionDefault* other); + void InternalSwap(FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; } protected: - explicit FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* arena); - FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* arena, const FeatureSetDefaults_FeatureSetEditionDefault& from); - FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* arena, FeatureSetDefaults_FeatureSetEditionDefault&& from) noexcept + explicit FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FeatureSetDefaults_FeatureSetEditionDefault(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FeatureSetDefaults_FeatureSetEditionDefault& from); + FeatureSetDefaults_FeatureSetEditionDefault( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FeatureSetDefaults_FeatureSetEditionDefault&& from) noexcept : FeatureSetDefaults_FeatureSetEditionDefault(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -4197,30 +4429,30 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public bool has_overridable_features() const; void clear_overridable_features() ; const ::google::protobuf::FeatureSet& overridable_features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_overridable_features(); - ::google::protobuf::FeatureSet* mutable_overridable_features(); - void set_allocated_overridable_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_overridable_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_overridable_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_overridable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_overridable_features(); + void set_allocated_overridable_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_overridable_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_overridable_features(); private: const ::google::protobuf::FeatureSet& _internal_overridable_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_overridable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_overridable_features(); public: // optional .google.protobuf.FeatureSet fixed_features = 5; bool has_fixed_features() const; void clear_fixed_features() ; const ::google::protobuf::FeatureSet& fixed_features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_fixed_features(); - ::google::protobuf::FeatureSet* mutable_fixed_features(); - void set_allocated_fixed_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_fixed_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_fixed_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_fixed_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_fixed_features(); + void set_allocated_fixed_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_fixed_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_fixed_features(); private: const ::google::protobuf::FeatureSet& _internal_fixed_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_fixed_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_fixed_features(); public: // optional .google.protobuf.Edition edition = 3; @@ -4238,9 +4470,9 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 3, 3, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 3, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -4250,23 +4482,26 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FeatureSetDefaults_FeatureSetEditionDefault& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FeatureSetDefaults_FeatureSetEditionDefault& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::FeatureSet* overridable_features_; - ::google::protobuf::FeatureSet* fixed_features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE overridable_features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE fixed_features_; int edition_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FeatureSetDefaults_FeatureSetEditionDefault_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message @@ -4276,15 +4511,14 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message ~ServiceOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(ServiceOptions* msg, std::destroying_delete_t) { + void operator delete(ServiceOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(ServiceOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR ServiceOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR ServiceOptions(::google::protobuf::internal::ConstantInitialized); inline ServiceOptions(const ServiceOptions& from) : ServiceOptions(nullptr, from) {} inline ServiceOptions(ServiceOptions&& from) noexcept @@ -4307,30 +4541,27 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const ServiceOptions& default_instance() { - return *internal_default_instance(); - } - static inline const ServiceOptions* internal_default_instance() { - return reinterpret_cast<const ServiceOptions*>( + return *reinterpret_cast<const ServiceOptions*>( &_ServiceOptions_default_instance_); } static constexpr int kIndexInFileMessages = 22; friend void swap(ServiceOptions& a, ServiceOptions& b) { a.Swap(&b); } - inline void Swap(ServiceOptions* other) { + inline void Swap(ServiceOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -4338,7 +4569,7 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(ServiceOptions* other) { + void UnsafeArenaSwap(ServiceOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -4346,7 +4577,7 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - ServiceOptions* New(::google::protobuf::Arena* arena = nullptr) const { + ServiceOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<ServiceOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -4355,9 +4586,8 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message void MergeFrom(const ServiceOptions& from) { ServiceOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -4372,49 +4602,51 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(ServiceOptions* other); + void InternalSwap(ServiceOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.ServiceOptions"; } protected: - explicit ServiceOptions(::google::protobuf::Arena* arena); - ServiceOptions(::google::protobuf::Arena* arena, const ServiceOptions& from); - ServiceOptions(::google::protobuf::Arena* arena, ServiceOptions&& from) noexcept + explicit ServiceOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + ServiceOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ServiceOptions& from); + ServiceOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, ServiceOptions&& from) noexcept : ServiceOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -4431,29 +4663,29 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 34; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional bool deprecated = 33 [default = false]; @@ -4550,11 +4782,9 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<ServiceOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -4638,7 +4868,7 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -4650,9 +4880,9 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 3, 2, - 0, 12> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 2, 0, + 12> _table_; friend class ::google::protobuf::MessageLite; @@ -4662,24 +4892,27 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const ServiceOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ServiceOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; bool deprecated_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ServiceOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message @@ -4689,15 +4922,14 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message ~OneofOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(OneofOptions* msg, std::destroying_delete_t) { + void operator delete(OneofOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(OneofOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR OneofOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR OneofOptions(::google::protobuf::internal::ConstantInitialized); inline OneofOptions(const OneofOptions& from) : OneofOptions(nullptr, from) {} inline OneofOptions(OneofOptions&& from) noexcept @@ -4720,30 +4952,27 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const OneofOptions& default_instance() { - return *internal_default_instance(); - } - static inline const OneofOptions* internal_default_instance() { - return reinterpret_cast<const OneofOptions*>( + return *reinterpret_cast<const OneofOptions*>( &_OneofOptions_default_instance_); } static constexpr int kIndexInFileMessages = 19; friend void swap(OneofOptions& a, OneofOptions& b) { a.Swap(&b); } - inline void Swap(OneofOptions* other) { + inline void Swap(OneofOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -4751,7 +4980,7 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(OneofOptions* other) { + void UnsafeArenaSwap(OneofOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -4759,7 +4988,7 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - OneofOptions* New(::google::protobuf::Arena* arena = nullptr) const { + OneofOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<OneofOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -4768,9 +4997,8 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message void MergeFrom(const OneofOptions& from) { OneofOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -4785,49 +5013,51 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(OneofOptions* other); + void InternalSwap(OneofOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.OneofOptions"; } protected: - explicit OneofOptions(::google::protobuf::Arena* arena); - OneofOptions(::google::protobuf::Arena* arena, const OneofOptions& from); - OneofOptions(::google::protobuf::Arena* arena, OneofOptions&& from) noexcept + explicit OneofOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + OneofOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const OneofOptions& from); + OneofOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, OneofOptions&& from) noexcept : OneofOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -4843,29 +5073,29 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 1; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -4951,11 +5181,9 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<OneofOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -5039,7 +5267,7 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -5051,9 +5279,9 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 2, 2, - 0, 7> + static const ::google::protobuf::internal::TcParseTable<2, 2, + 2, 0, + 7> _table_; friend class ::google::protobuf::MessageLite; @@ -5063,23 +5291,26 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const OneofOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const OneofOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull OneofOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message @@ -5089,15 +5320,14 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message ~MethodOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(MethodOptions* msg, std::destroying_delete_t) { + void operator delete(MethodOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(MethodOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR MethodOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR MethodOptions(::google::protobuf::internal::ConstantInitialized); inline MethodOptions(const MethodOptions& from) : MethodOptions(nullptr, from) {} inline MethodOptions(MethodOptions&& from) noexcept @@ -5120,30 +5350,27 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const MethodOptions& default_instance() { - return *internal_default_instance(); - } - static inline const MethodOptions* internal_default_instance() { - return reinterpret_cast<const MethodOptions*>( + return *reinterpret_cast<const MethodOptions*>( &_MethodOptions_default_instance_); } static constexpr int kIndexInFileMessages = 23; friend void swap(MethodOptions& a, MethodOptions& b) { a.Swap(&b); } - inline void Swap(MethodOptions* other) { + inline void Swap(MethodOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -5151,7 +5378,7 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(MethodOptions* other) { + void UnsafeArenaSwap(MethodOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -5159,7 +5386,7 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - MethodOptions* New(::google::protobuf::Arena* arena = nullptr) const { + MethodOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<MethodOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -5168,9 +5395,8 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message void MergeFrom(const MethodOptions& from) { MethodOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -5185,49 +5411,51 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(MethodOptions* other); + void InternalSwap(MethodOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.MethodOptions"; } protected: - explicit MethodOptions(::google::protobuf::Arena* arena); - MethodOptions(::google::protobuf::Arena* arena, const MethodOptions& from); - MethodOptions(::google::protobuf::Arena* arena, MethodOptions&& from) noexcept + explicit MethodOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + MethodOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MethodOptions& from); + MethodOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, MethodOptions&& from) noexcept : MethodOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using IdempotencyLevel = MethodOptions_IdempotencyLevel; @@ -5240,14 +5468,15 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message static constexpr IdempotencyLevel IdempotencyLevel_MIN = MethodOptions_IdempotencyLevel_IdempotencyLevel_MIN; static constexpr IdempotencyLevel IdempotencyLevel_MAX = MethodOptions_IdempotencyLevel_IdempotencyLevel_MAX; static constexpr int IdempotencyLevel_ARRAYSIZE = MethodOptions_IdempotencyLevel_IdempotencyLevel_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* IdempotencyLevel_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL IdempotencyLevel_descriptor() { return MethodOptions_IdempotencyLevel_descriptor(); } template <typename T> static inline const std::string& IdempotencyLevel_Name(T value) { return MethodOptions_IdempotencyLevel_Name(value); } - static inline bool IdempotencyLevel_Parse(absl::string_view name, IdempotencyLevel* value) { + static inline bool IdempotencyLevel_Parse( + absl::string_view name, IdempotencyLevel* PROTOBUF_NONNULL value) { return MethodOptions_IdempotencyLevel_Parse(name, value); } @@ -5265,29 +5494,29 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 35; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional bool deprecated = 33 [default = false]; @@ -5395,11 +5624,9 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<MethodOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -5483,7 +5710,7 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -5495,9 +5722,9 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 4, 3, - 0, 12> + static const ::google::protobuf::internal::TcParseTable<3, 4, + 3, 0, + 12> _table_; friend class ::google::protobuf::MessageLite; @@ -5507,18 +5734,19 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const MethodOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const MethodOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; bool deprecated_; int idempotency_level_; PROTOBUF_TSAN_DECLARE_MEMBER @@ -5526,6 +5754,8 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull MethodOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message @@ -5535,15 +5765,14 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message ~MessageOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(MessageOptions* msg, std::destroying_delete_t) { + void operator delete(MessageOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(MessageOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR MessageOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR MessageOptions(::google::protobuf::internal::ConstantInitialized); inline MessageOptions(const MessageOptions& from) : MessageOptions(nullptr, from) {} inline MessageOptions(MessageOptions&& from) noexcept @@ -5566,30 +5795,27 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const MessageOptions& default_instance() { - return *internal_default_instance(); - } - static inline const MessageOptions* internal_default_instance() { - return reinterpret_cast<const MessageOptions*>( + return *reinterpret_cast<const MessageOptions*>( &_MessageOptions_default_instance_); } static constexpr int kIndexInFileMessages = 15; friend void swap(MessageOptions& a, MessageOptions& b) { a.Swap(&b); } - inline void Swap(MessageOptions* other) { + inline void Swap(MessageOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -5597,7 +5823,7 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(MessageOptions* other) { + void UnsafeArenaSwap(MessageOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -5605,7 +5831,7 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - MessageOptions* New(::google::protobuf::Arena* arena = nullptr) const { + MessageOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<MessageOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -5614,9 +5840,8 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message void MergeFrom(const MessageOptions& from) { MessageOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -5631,49 +5856,51 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(MessageOptions* other); + void InternalSwap(MessageOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.MessageOptions"; } protected: - explicit MessageOptions(::google::protobuf::Arena* arena); - MessageOptions(::google::protobuf::Arena* arena, const MessageOptions& from); - MessageOptions(::google::protobuf::Arena* arena, MessageOptions&& from) noexcept + explicit MessageOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + MessageOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MessageOptions& from); + MessageOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, MessageOptions&& from) noexcept : MessageOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -5694,29 +5921,29 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 12; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional bool message_set_wire_format = 1 [default = false]; @@ -5857,11 +6084,9 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<MessageOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -5945,7 +6170,7 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -5957,9 +6182,9 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 7, 2, - 0, 7> + static const ::google::protobuf::internal::TcParseTable<3, 7, + 2, 0, + 7> _table_; friend class ::google::protobuf::MessageLite; @@ -5969,18 +6194,19 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const MessageOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const MessageOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; bool message_set_wire_format_; bool no_standard_descriptor_accessor_; bool deprecated_; @@ -5991,6 +6217,8 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull MessageOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message @@ -6000,15 +6228,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message ~FileOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FileOptions* msg, std::destroying_delete_t) { + void operator delete(FileOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FileOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FileOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FileOptions(::google::protobuf::internal::ConstantInitialized); inline FileOptions(const FileOptions& from) : FileOptions(nullptr, from) {} inline FileOptions(FileOptions&& from) noexcept @@ -6031,30 +6258,27 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FileOptions& default_instance() { - return *internal_default_instance(); - } - static inline const FileOptions* internal_default_instance() { - return reinterpret_cast<const FileOptions*>( + return *reinterpret_cast<const FileOptions*>( &_FileOptions_default_instance_); } static constexpr int kIndexInFileMessages = 14; friend void swap(FileOptions& a, FileOptions& b) { a.Swap(&b); } - inline void Swap(FileOptions* other) { + inline void Swap(FileOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -6062,7 +6286,7 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FileOptions* other) { + void UnsafeArenaSwap(FileOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -6070,7 +6294,7 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FileOptions* New(::google::protobuf::Arena* arena = nullptr) const { + FileOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FileOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -6079,9 +6303,8 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message void MergeFrom(const FileOptions& from) { FileOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -6096,49 +6319,51 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FileOptions* other); + void InternalSwap(FileOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FileOptions"; } protected: - explicit FileOptions(::google::protobuf::Arena* arena); - FileOptions(::google::protobuf::Arena* arena, const FileOptions& from); - FileOptions(::google::protobuf::Arena* arena, FileOptions&& from) noexcept + explicit FileOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FileOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FileOptions& from); + FileOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FileOptions&& from) noexcept : FileOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using OptimizeMode = FileOptions_OptimizeMode; @@ -6151,14 +6376,15 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message static constexpr OptimizeMode OptimizeMode_MIN = FileOptions_OptimizeMode_OptimizeMode_MIN; static constexpr OptimizeMode OptimizeMode_MAX = FileOptions_OptimizeMode_OptimizeMode_MAX; static constexpr int OptimizeMode_ARRAYSIZE = FileOptions_OptimizeMode_OptimizeMode_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* OptimizeMode_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL OptimizeMode_descriptor() { return FileOptions_OptimizeMode_descriptor(); } template <typename T> static inline const std::string& OptimizeMode_Name(T value) { return FileOptions_OptimizeMode_Name(value); } - static inline bool OptimizeMode_Parse(absl::string_view name, OptimizeMode* value) { + static inline bool OptimizeMode_Parse( + absl::string_view name, OptimizeMode* PROTOBUF_NONNULL value) { return FileOptions_OptimizeMode_Parse(name, value); } @@ -6193,15 +6419,15 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional string java_package = 1; bool has_java_package() const; @@ -6209,15 +6435,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& java_package() const; template <typename Arg_ = const std::string&, typename... Args_> void set_java_package(Arg_&& arg, Args_... args); - std::string* mutable_java_package(); - PROTOBUF_NODISCARD std::string* release_java_package(); - void set_allocated_java_package(std::string* value); + std::string* PROTOBUF_NONNULL mutable_java_package(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_java_package(); + void set_allocated_java_package(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_java_package() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_java_package( - const std::string& value); - std::string* _internal_mutable_java_package(); + PROTOBUF_ALWAYS_INLINE void _internal_set_java_package(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_java_package(); public: // optional string java_outer_classname = 8; @@ -6226,15 +6451,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& java_outer_classname() const; template <typename Arg_ = const std::string&, typename... Args_> void set_java_outer_classname(Arg_&& arg, Args_... args); - std::string* mutable_java_outer_classname(); - PROTOBUF_NODISCARD std::string* release_java_outer_classname(); - void set_allocated_java_outer_classname(std::string* value); + std::string* PROTOBUF_NONNULL mutable_java_outer_classname(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_java_outer_classname(); + void set_allocated_java_outer_classname(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_java_outer_classname() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_java_outer_classname( - const std::string& value); - std::string* _internal_mutable_java_outer_classname(); + PROTOBUF_ALWAYS_INLINE void _internal_set_java_outer_classname(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_java_outer_classname(); public: // optional string go_package = 11; @@ -6243,15 +6467,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& go_package() const; template <typename Arg_ = const std::string&, typename... Args_> void set_go_package(Arg_&& arg, Args_... args); - std::string* mutable_go_package(); - PROTOBUF_NODISCARD std::string* release_go_package(); - void set_allocated_go_package(std::string* value); + std::string* PROTOBUF_NONNULL mutable_go_package(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_go_package(); + void set_allocated_go_package(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_go_package() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_go_package( - const std::string& value); - std::string* _internal_mutable_go_package(); + PROTOBUF_ALWAYS_INLINE void _internal_set_go_package(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_go_package(); public: // optional string objc_class_prefix = 36; @@ -6260,15 +6483,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& objc_class_prefix() const; template <typename Arg_ = const std::string&, typename... Args_> void set_objc_class_prefix(Arg_&& arg, Args_... args); - std::string* mutable_objc_class_prefix(); - PROTOBUF_NODISCARD std::string* release_objc_class_prefix(); - void set_allocated_objc_class_prefix(std::string* value); + std::string* PROTOBUF_NONNULL mutable_objc_class_prefix(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_objc_class_prefix(); + void set_allocated_objc_class_prefix(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_objc_class_prefix() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_objc_class_prefix( - const std::string& value); - std::string* _internal_mutable_objc_class_prefix(); + PROTOBUF_ALWAYS_INLINE void _internal_set_objc_class_prefix(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_objc_class_prefix(); public: // optional string csharp_namespace = 37; @@ -6277,15 +6499,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& csharp_namespace() const; template <typename Arg_ = const std::string&, typename... Args_> void set_csharp_namespace(Arg_&& arg, Args_... args); - std::string* mutable_csharp_namespace(); - PROTOBUF_NODISCARD std::string* release_csharp_namespace(); - void set_allocated_csharp_namespace(std::string* value); + std::string* PROTOBUF_NONNULL mutable_csharp_namespace(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_csharp_namespace(); + void set_allocated_csharp_namespace(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_csharp_namespace() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_csharp_namespace( - const std::string& value); - std::string* _internal_mutable_csharp_namespace(); + PROTOBUF_ALWAYS_INLINE void _internal_set_csharp_namespace(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_csharp_namespace(); public: // optional string swift_prefix = 39; @@ -6294,15 +6515,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& swift_prefix() const; template <typename Arg_ = const std::string&, typename... Args_> void set_swift_prefix(Arg_&& arg, Args_... args); - std::string* mutable_swift_prefix(); - PROTOBUF_NODISCARD std::string* release_swift_prefix(); - void set_allocated_swift_prefix(std::string* value); + std::string* PROTOBUF_NONNULL mutable_swift_prefix(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_swift_prefix(); + void set_allocated_swift_prefix(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_swift_prefix() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_swift_prefix( - const std::string& value); - std::string* _internal_mutable_swift_prefix(); + PROTOBUF_ALWAYS_INLINE void _internal_set_swift_prefix(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_swift_prefix(); public: // optional string php_class_prefix = 40; @@ -6311,15 +6531,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& php_class_prefix() const; template <typename Arg_ = const std::string&, typename... Args_> void set_php_class_prefix(Arg_&& arg, Args_... args); - std::string* mutable_php_class_prefix(); - PROTOBUF_NODISCARD std::string* release_php_class_prefix(); - void set_allocated_php_class_prefix(std::string* value); + std::string* PROTOBUF_NONNULL mutable_php_class_prefix(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_php_class_prefix(); + void set_allocated_php_class_prefix(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_php_class_prefix() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_php_class_prefix( - const std::string& value); - std::string* _internal_mutable_php_class_prefix(); + PROTOBUF_ALWAYS_INLINE void _internal_set_php_class_prefix(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_php_class_prefix(); public: // optional string php_namespace = 41; @@ -6328,15 +6547,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& php_namespace() const; template <typename Arg_ = const std::string&, typename... Args_> void set_php_namespace(Arg_&& arg, Args_... args); - std::string* mutable_php_namespace(); - PROTOBUF_NODISCARD std::string* release_php_namespace(); - void set_allocated_php_namespace(std::string* value); + std::string* PROTOBUF_NONNULL mutable_php_namespace(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_php_namespace(); + void set_allocated_php_namespace(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_php_namespace() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_php_namespace( - const std::string& value); - std::string* _internal_mutable_php_namespace(); + PROTOBUF_ALWAYS_INLINE void _internal_set_php_namespace(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_php_namespace(); public: // optional string php_metadata_namespace = 44; @@ -6345,15 +6563,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& php_metadata_namespace() const; template <typename Arg_ = const std::string&, typename... Args_> void set_php_metadata_namespace(Arg_&& arg, Args_... args); - std::string* mutable_php_metadata_namespace(); - PROTOBUF_NODISCARD std::string* release_php_metadata_namespace(); - void set_allocated_php_metadata_namespace(std::string* value); + std::string* PROTOBUF_NONNULL mutable_php_metadata_namespace(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_php_metadata_namespace(); + void set_allocated_php_metadata_namespace(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_php_metadata_namespace() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_php_metadata_namespace( - const std::string& value); - std::string* _internal_mutable_php_metadata_namespace(); + PROTOBUF_ALWAYS_INLINE void _internal_set_php_metadata_namespace(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_php_metadata_namespace(); public: // optional string ruby_package = 45; @@ -6362,30 +6579,29 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message const std::string& ruby_package() const; template <typename Arg_ = const std::string&, typename... Args_> void set_ruby_package(Arg_&& arg, Args_... args); - std::string* mutable_ruby_package(); - PROTOBUF_NODISCARD std::string* release_ruby_package(); - void set_allocated_ruby_package(std::string* value); + std::string* PROTOBUF_NONNULL mutable_ruby_package(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_ruby_package(); + void set_allocated_ruby_package(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_ruby_package() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_ruby_package( - const std::string& value); - std::string* _internal_mutable_ruby_package(); + PROTOBUF_ALWAYS_INLINE void _internal_set_ruby_package(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_ruby_package(); public: // optional .google.protobuf.FeatureSet features = 50; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional bool java_multiple_files = 10 [default = false]; @@ -6570,11 +6786,9 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<FileOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -6658,7 +6872,7 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -6670,9 +6884,9 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 5, 21, 3, - 202, 12> + static const ::google::protobuf::internal::TcParseTable<5, 21, + 3, 202, + 12> _table_; friend class ::google::protobuf::MessageLite; @@ -6682,13 +6896,14 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FileOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FileOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; @@ -6703,7 +6918,7 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message ::google::protobuf::internal::ArenaStringPtr php_namespace_; ::google::protobuf::internal::ArenaStringPtr php_metadata_namespace_; ::google::protobuf::internal::ArenaStringPtr ruby_package_; - ::google::protobuf::FeatureSet* features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; bool java_multiple_files_; bool java_generate_equals_and_hash_; bool java_string_check_utf8_; @@ -6718,6 +6933,8 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FileOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message @@ -6727,15 +6944,14 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message ~FieldOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldOptions* msg, std::destroying_delete_t) { + void operator delete(FieldOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FieldOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FieldOptions(::google::protobuf::internal::ConstantInitialized); inline FieldOptions(const FieldOptions& from) : FieldOptions(nullptr, from) {} inline FieldOptions(FieldOptions&& from) noexcept @@ -6758,30 +6974,27 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FieldOptions& default_instance() { - return *internal_default_instance(); - } - static inline const FieldOptions* internal_default_instance() { - return reinterpret_cast<const FieldOptions*>( + return *reinterpret_cast<const FieldOptions*>( &_FieldOptions_default_instance_); } static constexpr int kIndexInFileMessages = 18; friend void swap(FieldOptions& a, FieldOptions& b) { a.Swap(&b); } - inline void Swap(FieldOptions* other) { + inline void Swap(FieldOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -6789,7 +7002,7 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FieldOptions* other) { + void UnsafeArenaSwap(FieldOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -6797,7 +7010,7 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FieldOptions* New(::google::protobuf::Arena* arena = nullptr) const { + FieldOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FieldOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -6806,9 +7019,8 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message void MergeFrom(const FieldOptions& from) { FieldOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -6823,49 +7035,51 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FieldOptions* other); + void InternalSwap(FieldOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FieldOptions"; } protected: - explicit FieldOptions(::google::protobuf::Arena* arena); - FieldOptions(::google::protobuf::Arena* arena, const FieldOptions& from); - FieldOptions(::google::protobuf::Arena* arena, FieldOptions&& from) noexcept + explicit FieldOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FieldOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldOptions& from); + FieldOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldOptions&& from) noexcept : FieldOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using EditionDefault = FieldOptions_EditionDefault; @@ -6880,14 +7094,15 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message static constexpr CType CType_MIN = FieldOptions_CType_CType_MIN; static constexpr CType CType_MAX = FieldOptions_CType_CType_MAX; static constexpr int CType_ARRAYSIZE = FieldOptions_CType_CType_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* CType_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL CType_descriptor() { return FieldOptions_CType_descriptor(); } template <typename T> static inline const std::string& CType_Name(T value) { return FieldOptions_CType_Name(value); } - static inline bool CType_Parse(absl::string_view name, CType* value) { + static inline bool CType_Parse( + absl::string_view name, CType* PROTOBUF_NONNULL value) { return FieldOptions_CType_Parse(name, value); } using JSType = FieldOptions_JSType; @@ -6900,14 +7115,15 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message static constexpr JSType JSType_MIN = FieldOptions_JSType_JSType_MIN; static constexpr JSType JSType_MAX = FieldOptions_JSType_JSType_MAX; static constexpr int JSType_ARRAYSIZE = FieldOptions_JSType_JSType_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* JSType_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL JSType_descriptor() { return FieldOptions_JSType_descriptor(); } template <typename T> static inline const std::string& JSType_Name(T value) { return FieldOptions_JSType_Name(value); } - static inline bool JSType_Parse(absl::string_view name, JSType* value) { + static inline bool JSType_Parse( + absl::string_view name, JSType* PROTOBUF_NONNULL value) { return FieldOptions_JSType_Parse(name, value); } using OptionRetention = FieldOptions_OptionRetention; @@ -6920,14 +7136,15 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message static constexpr OptionRetention OptionRetention_MIN = FieldOptions_OptionRetention_OptionRetention_MIN; static constexpr OptionRetention OptionRetention_MAX = FieldOptions_OptionRetention_OptionRetention_MAX; static constexpr int OptionRetention_ARRAYSIZE = FieldOptions_OptionRetention_OptionRetention_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* OptionRetention_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL OptionRetention_descriptor() { return FieldOptions_OptionRetention_descriptor(); } template <typename T> static inline const std::string& OptionRetention_Name(T value) { return FieldOptions_OptionRetention_Name(value); } - static inline bool OptionRetention_Parse(absl::string_view name, OptionRetention* value) { + static inline bool OptionRetention_Parse( + absl::string_view name, OptionRetention* PROTOBUF_NONNULL value) { return FieldOptions_OptionRetention_Parse(name, value); } using OptionTargetType = FieldOptions_OptionTargetType; @@ -6947,14 +7164,15 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message static constexpr OptionTargetType OptionTargetType_MIN = FieldOptions_OptionTargetType_OptionTargetType_MIN; static constexpr OptionTargetType OptionTargetType_MAX = FieldOptions_OptionTargetType_OptionTargetType_MAX; static constexpr int OptionTargetType_ARRAYSIZE = FieldOptions_OptionTargetType_OptionTargetType_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* OptionTargetType_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL OptionTargetType_descriptor() { return FieldOptions_OptionTargetType_descriptor(); } template <typename T> static inline const std::string& OptionTargetType_Name(T value) { return FieldOptions_OptionTargetType_Name(value); } - static inline bool OptionTargetType_Parse(absl::string_view name, OptionTargetType* value) { + static inline bool OptionTargetType_Parse( + absl::string_view name, OptionTargetType* PROTOBUF_NONNULL value) { return FieldOptions_OptionTargetType_Parse(name, value); } @@ -6987,11 +7205,11 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message void set_targets(int index, ::google::protobuf::FieldOptions_OptionTargetType value); void add_targets(::google::protobuf::FieldOptions_OptionTargetType value); const ::google::protobuf::RepeatedField<int>& targets() const; - ::google::protobuf::RepeatedField<int>* mutable_targets(); + ::google::protobuf::RepeatedField<int>* PROTOBUF_NONNULL mutable_targets(); private: const ::google::protobuf::RepeatedField<int>& _internal_targets() const; - ::google::protobuf::RepeatedField<int>* _internal_mutable_targets(); + ::google::protobuf::RepeatedField<int>* PROTOBUF_NONNULL _internal_mutable_targets(); public: // repeated .google.protobuf.FieldOptions.EditionDefault edition_defaults = 20; @@ -7001,15 +7219,15 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message public: void clear_edition_defaults() ; - ::google::protobuf::FieldOptions_EditionDefault* mutable_edition_defaults(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* mutable_edition_defaults(); + ::google::protobuf::FieldOptions_EditionDefault* PROTOBUF_NONNULL mutable_edition_defaults(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* PROTOBUF_NONNULL mutable_edition_defaults(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>& _internal_edition_defaults() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* _internal_mutable_edition_defaults(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* PROTOBUF_NONNULL _internal_mutable_edition_defaults(); public: const ::google::protobuf::FieldOptions_EditionDefault& edition_defaults(int index) const; - ::google::protobuf::FieldOptions_EditionDefault* add_edition_defaults(); + ::google::protobuf::FieldOptions_EditionDefault* PROTOBUF_NONNULL add_edition_defaults(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>& edition_defaults() const; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; @@ -7018,44 +7236,44 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 21; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 22; bool has_feature_support() const; void clear_feature_support() ; const ::google::protobuf::FieldOptions_FeatureSupport& feature_support() const; - PROTOBUF_NODISCARD ::google::protobuf::FieldOptions_FeatureSupport* release_feature_support(); - ::google::protobuf::FieldOptions_FeatureSupport* mutable_feature_support(); - void set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value); - void unsafe_arena_set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value); - ::google::protobuf::FieldOptions_FeatureSupport* unsafe_arena_release_feature_support(); + [[nodiscard]] ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE release_feature_support(); + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL mutable_feature_support(); + void set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value); + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE unsafe_arena_release_feature_support(); private: const ::google::protobuf::FieldOptions_FeatureSupport& _internal_feature_support() const; - ::google::protobuf::FieldOptions_FeatureSupport* _internal_mutable_feature_support(); + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL _internal_mutable_feature_support(); public: // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; @@ -7240,11 +7458,9 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<FieldOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -7328,7 +7544,7 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -7340,9 +7556,9 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 4, 14, 8, - 0, 7> + static const ::google::protobuf::internal::TcParseTable<4, 14, + 8, 0, + 7> _table_; friend class ::google::protobuf::MessageLite; @@ -7352,21 +7568,22 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FieldOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FieldOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedField<int> targets_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldOptions_EditionDefault > edition_defaults_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; - ::google::protobuf::FieldOptions_FeatureSupport* feature_support_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE feature_support_; int ctype_; int jstype_; bool packed_; @@ -7381,6 +7598,8 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Message @@ -7390,15 +7609,14 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess ~FeatureSetDefaults() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FeatureSetDefaults* msg, std::destroying_delete_t) { + void operator delete(FeatureSetDefaults* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FeatureSetDefaults)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FeatureSetDefaults( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FeatureSetDefaults(::google::protobuf::internal::ConstantInitialized); inline FeatureSetDefaults(const FeatureSetDefaults& from) : FeatureSetDefaults(nullptr, from) {} inline FeatureSetDefaults(FeatureSetDefaults&& from) noexcept @@ -7421,30 +7639,27 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FeatureSetDefaults& default_instance() { - return *internal_default_instance(); - } - static inline const FeatureSetDefaults* internal_default_instance() { - return reinterpret_cast<const FeatureSetDefaults*>( + return *reinterpret_cast<const FeatureSetDefaults*>( &_FeatureSetDefaults_default_instance_); } static constexpr int kIndexInFileMessages = 28; friend void swap(FeatureSetDefaults& a, FeatureSetDefaults& b) { a.Swap(&b); } - inline void Swap(FeatureSetDefaults* other) { + inline void Swap(FeatureSetDefaults* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -7452,7 +7667,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FeatureSetDefaults* other) { + void UnsafeArenaSwap(FeatureSetDefaults* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -7460,7 +7675,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess // implements Message ---------------------------------------------- - FeatureSetDefaults* New(::google::protobuf::Arena* arena = nullptr) const { + FeatureSetDefaults* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FeatureSetDefaults>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -7469,9 +7684,8 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess void MergeFrom(const FeatureSetDefaults& from) { FeatureSetDefaults::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -7486,49 +7700,51 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FeatureSetDefaults* other); + void InternalSwap(FeatureSetDefaults* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FeatureSetDefaults"; } protected: - explicit FeatureSetDefaults(::google::protobuf::Arena* arena); - FeatureSetDefaults(::google::protobuf::Arena* arena, const FeatureSetDefaults& from); - FeatureSetDefaults(::google::protobuf::Arena* arena, FeatureSetDefaults&& from) noexcept + explicit FeatureSetDefaults(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FeatureSetDefaults(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FeatureSetDefaults& from); + FeatureSetDefaults( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FeatureSetDefaults&& from) noexcept : FeatureSetDefaults(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using FeatureSetEditionDefault = FeatureSetDefaults_FeatureSetEditionDefault; @@ -7546,15 +7762,15 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess public: void clear_defaults() ; - ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* mutable_defaults(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* mutable_defaults(); + ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL mutable_defaults(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* PROTOBUF_NONNULL mutable_defaults(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>& _internal_defaults() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* _internal_mutable_defaults(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* PROTOBUF_NONNULL _internal_mutable_defaults(); public: const ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault& defaults(int index) const; - ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* add_defaults(); + ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL add_defaults(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>& defaults() const; // optional .google.protobuf.Edition minimum_edition = 4; bool has_minimum_edition() const; @@ -7582,9 +7798,9 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 3, 3, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<1, 3, + 3, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -7594,13 +7810,14 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FeatureSetDefaults& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FeatureSetDefaults& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault > defaults_; @@ -7611,6 +7828,8 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FeatureSetDefaults_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::Message @@ -7620,15 +7839,14 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M ~ExtensionRangeOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(ExtensionRangeOptions* msg, std::destroying_delete_t) { + void operator delete(ExtensionRangeOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(ExtensionRangeOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR ExtensionRangeOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR ExtensionRangeOptions(::google::protobuf::internal::ConstantInitialized); inline ExtensionRangeOptions(const ExtensionRangeOptions& from) : ExtensionRangeOptions(nullptr, from) {} inline ExtensionRangeOptions(ExtensionRangeOptions&& from) noexcept @@ -7651,30 +7869,27 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const ExtensionRangeOptions& default_instance() { - return *internal_default_instance(); - } - static inline const ExtensionRangeOptions* internal_default_instance() { - return reinterpret_cast<const ExtensionRangeOptions*>( + return *reinterpret_cast<const ExtensionRangeOptions*>( &_ExtensionRangeOptions_default_instance_); } static constexpr int kIndexInFileMessages = 6; friend void swap(ExtensionRangeOptions& a, ExtensionRangeOptions& b) { a.Swap(&b); } - inline void Swap(ExtensionRangeOptions* other) { + inline void Swap(ExtensionRangeOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -7682,7 +7897,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(ExtensionRangeOptions* other) { + void UnsafeArenaSwap(ExtensionRangeOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -7690,7 +7905,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M // implements Message ---------------------------------------------- - ExtensionRangeOptions* New(::google::protobuf::Arena* arena = nullptr) const { + ExtensionRangeOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<ExtensionRangeOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -7699,9 +7914,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M void MergeFrom(const ExtensionRangeOptions& from) { ExtensionRangeOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -7716,49 +7930,51 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(ExtensionRangeOptions* other); + void InternalSwap(ExtensionRangeOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.ExtensionRangeOptions"; } protected: - explicit ExtensionRangeOptions(::google::protobuf::Arena* arena); - ExtensionRangeOptions(::google::protobuf::Arena* arena, const ExtensionRangeOptions& from); - ExtensionRangeOptions(::google::protobuf::Arena* arena, ExtensionRangeOptions&& from) noexcept + explicit ExtensionRangeOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + ExtensionRangeOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ExtensionRangeOptions& from); + ExtensionRangeOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, ExtensionRangeOptions&& from) noexcept : ExtensionRangeOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using Declaration = ExtensionRangeOptions_Declaration; @@ -7771,14 +7987,15 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M static constexpr VerificationState VerificationState_MIN = ExtensionRangeOptions_VerificationState_VerificationState_MIN; static constexpr VerificationState VerificationState_MAX = ExtensionRangeOptions_VerificationState_VerificationState_MAX; static constexpr int VerificationState_ARRAYSIZE = ExtensionRangeOptions_VerificationState_VerificationState_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* VerificationState_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL VerificationState_descriptor() { return ExtensionRangeOptions_VerificationState_descriptor(); } template <typename T> static inline const std::string& VerificationState_Name(T value) { return ExtensionRangeOptions_VerificationState_Name(value); } - static inline bool VerificationState_Parse(absl::string_view name, VerificationState* value) { + static inline bool VerificationState_Parse( + absl::string_view name, VerificationState* PROTOBUF_NONNULL value) { return ExtensionRangeOptions_VerificationState_Parse(name, value); } @@ -7796,15 +8013,15 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M public: void clear_declaration() ; - ::google::protobuf::ExtensionRangeOptions_Declaration* mutable_declaration(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* mutable_declaration(); + ::google::protobuf::ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL mutable_declaration(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* PROTOBUF_NONNULL mutable_declaration(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>& _internal_declaration() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* _internal_mutable_declaration(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* PROTOBUF_NONNULL _internal_mutable_declaration(); public: const ::google::protobuf::ExtensionRangeOptions_Declaration& declaration(int index) const; - ::google::protobuf::ExtensionRangeOptions_Declaration* add_declaration(); + ::google::protobuf::ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL add_declaration(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>& declaration() const; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; @@ -7813,29 +8030,29 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 50; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED, retention = RETENTION_SOURCE]; @@ -7932,11 +8149,9 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<ExtensionRangeOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -8020,7 +8235,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -8032,9 +8247,9 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 4, 4, - 0, 12> + static const ::google::protobuf::internal::TcParseTable<3, 4, + 4, 0, + 12> _table_; friend class ::google::protobuf::MessageLite; @@ -8044,25 +8259,28 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const ExtensionRangeOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ExtensionRangeOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::ExtensionRangeOptions_Declaration > declaration_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; int verification_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ExtensionRangeOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Message @@ -8072,15 +8290,14 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag ~EnumValueOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(EnumValueOptions* msg, std::destroying_delete_t) { + void operator delete(EnumValueOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(EnumValueOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR EnumValueOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR EnumValueOptions(::google::protobuf::internal::ConstantInitialized); inline EnumValueOptions(const EnumValueOptions& from) : EnumValueOptions(nullptr, from) {} inline EnumValueOptions(EnumValueOptions&& from) noexcept @@ -8103,30 +8320,27 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const EnumValueOptions& default_instance() { - return *internal_default_instance(); - } - static inline const EnumValueOptions* internal_default_instance() { - return reinterpret_cast<const EnumValueOptions*>( + return *reinterpret_cast<const EnumValueOptions*>( &_EnumValueOptions_default_instance_); } static constexpr int kIndexInFileMessages = 21; friend void swap(EnumValueOptions& a, EnumValueOptions& b) { a.Swap(&b); } - inline void Swap(EnumValueOptions* other) { + inline void Swap(EnumValueOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -8134,7 +8348,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(EnumValueOptions* other) { + void UnsafeArenaSwap(EnumValueOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -8142,7 +8356,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag // implements Message ---------------------------------------------- - EnumValueOptions* New(::google::protobuf::Arena* arena = nullptr) const { + EnumValueOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<EnumValueOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -8151,9 +8365,8 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag void MergeFrom(const EnumValueOptions& from) { EnumValueOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -8168,49 +8381,51 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(EnumValueOptions* other); + void InternalSwap(EnumValueOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.EnumValueOptions"; } protected: - explicit EnumValueOptions(::google::protobuf::Arena* arena); - EnumValueOptions(::google::protobuf::Arena* arena, const EnumValueOptions& from); - EnumValueOptions(::google::protobuf::Arena* arena, EnumValueOptions&& from) noexcept + explicit EnumValueOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + EnumValueOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumValueOptions& from); + EnumValueOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EnumValueOptions&& from) noexcept : EnumValueOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -8229,44 +8444,44 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 2; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional .google.protobuf.FieldOptions.FeatureSupport feature_support = 4; bool has_feature_support() const; void clear_feature_support() ; const ::google::protobuf::FieldOptions_FeatureSupport& feature_support() const; - PROTOBUF_NODISCARD ::google::protobuf::FieldOptions_FeatureSupport* release_feature_support(); - ::google::protobuf::FieldOptions_FeatureSupport* mutable_feature_support(); - void set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value); - void unsafe_arena_set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value); - ::google::protobuf::FieldOptions_FeatureSupport* unsafe_arena_release_feature_support(); + [[nodiscard]] ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE release_feature_support(); + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL mutable_feature_support(); + void set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value); + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE unsafe_arena_release_feature_support(); private: const ::google::protobuf::FieldOptions_FeatureSupport& _internal_feature_support() const; - ::google::protobuf::FieldOptions_FeatureSupport* _internal_mutable_feature_support(); + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL _internal_mutable_feature_support(); public: // optional bool deprecated = 1 [default = false]; @@ -8374,11 +8589,9 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<EnumValueOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -8462,7 +8675,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -8474,9 +8687,9 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 3, - 0, 7> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 3, 0, + 7> _table_; friend class ::google::protobuf::MessageLite; @@ -8486,19 +8699,20 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const EnumValueOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const EnumValueOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; - ::google::protobuf::FieldOptions_FeatureSupport* feature_support_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE feature_support_; bool deprecated_; bool debug_redact_; PROTOBUF_TSAN_DECLARE_MEMBER @@ -8506,6 +8720,8 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumValueOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message @@ -8515,15 +8731,14 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message ~EnumOptions() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(EnumOptions* msg, std::destroying_delete_t) { + void operator delete(EnumOptions* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(EnumOptions)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR EnumOptions( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR EnumOptions(::google::protobuf::internal::ConstantInitialized); inline EnumOptions(const EnumOptions& from) : EnumOptions(nullptr, from) {} inline EnumOptions(EnumOptions&& from) noexcept @@ -8546,30 +8761,27 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const EnumOptions& default_instance() { - return *internal_default_instance(); - } - static inline const EnumOptions* internal_default_instance() { - return reinterpret_cast<const EnumOptions*>( + return *reinterpret_cast<const EnumOptions*>( &_EnumOptions_default_instance_); } static constexpr int kIndexInFileMessages = 20; friend void swap(EnumOptions& a, EnumOptions& b) { a.Swap(&b); } - inline void Swap(EnumOptions* other) { + inline void Swap(EnumOptions* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -8577,7 +8789,7 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(EnumOptions* other) { + void UnsafeArenaSwap(EnumOptions* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -8585,7 +8797,7 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - EnumOptions* New(::google::protobuf::Arena* arena = nullptr) const { + EnumOptions* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<EnumOptions>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -8594,9 +8806,8 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message void MergeFrom(const EnumOptions& from) { EnumOptions::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -8611,49 +8822,51 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(EnumOptions* other); + void InternalSwap(EnumOptions* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.EnumOptions"; } protected: - explicit EnumOptions(::google::protobuf::Arena* arena); - EnumOptions(::google::protobuf::Arena* arena, const EnumOptions& from); - EnumOptions(::google::protobuf::Arena* arena, EnumOptions&& from) noexcept + explicit EnumOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + EnumOptions(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumOptions& from); + EnumOptions( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EnumOptions&& from) noexcept : EnumOptions(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -8672,29 +8885,29 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message public: void clear_uninterpreted_option() ; - ::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* mutable_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL mutable_uninterpreted_option(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL mutable_uninterpreted_option(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& _internal_uninterpreted_option() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* _internal_mutable_uninterpreted_option(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL _internal_mutable_uninterpreted_option(); public: const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const; - ::google::protobuf::UninterpretedOption* add_uninterpreted_option(); + ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL add_uninterpreted_option(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>& uninterpreted_option() const; // optional .google.protobuf.FeatureSet features = 7; bool has_features() const; void clear_features() ; const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); + [[nodiscard]] ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE release_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL mutable_features(); + void set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value); + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE unsafe_arena_release_features(); private: const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); + ::google::protobuf::FeatureSet* PROTOBUF_NONNULL _internal_mutable_features(); public: // optional bool allow_alias = 2; @@ -8813,11 +9026,9 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<EnumOptions, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -8901,7 +9112,7 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -8913,9 +9124,9 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 2, - 0, 7> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 2, 0, + 7> _table_; friend class ::google::protobuf::MessageLite; @@ -8925,18 +9136,19 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const EnumOptions& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const EnumOptions& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; - ::google::protobuf::FeatureSet* features_; + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE features_; bool allow_alias_; bool deprecated_; bool deprecated_legacy_json_field_conflicts_; @@ -8945,6 +9157,8 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumOptions_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Message @@ -8954,15 +9168,14 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me ~OneofDescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(OneofDescriptorProto* msg, std::destroying_delete_t) { + void operator delete(OneofDescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(OneofDescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR OneofDescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR OneofDescriptorProto(::google::protobuf::internal::ConstantInitialized); inline OneofDescriptorProto(const OneofDescriptorProto& from) : OneofDescriptorProto(nullptr, from) {} inline OneofDescriptorProto(OneofDescriptorProto&& from) noexcept @@ -8985,30 +9198,27 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const OneofDescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const OneofDescriptorProto* internal_default_instance() { - return reinterpret_cast<const OneofDescriptorProto*>( + return *reinterpret_cast<const OneofDescriptorProto*>( &_OneofDescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 8; friend void swap(OneofDescriptorProto& a, OneofDescriptorProto& b) { a.Swap(&b); } - inline void Swap(OneofDescriptorProto* other) { + inline void Swap(OneofDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -9016,7 +9226,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(OneofDescriptorProto* other) { + void UnsafeArenaSwap(OneofDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -9024,7 +9234,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me // implements Message ---------------------------------------------- - OneofDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + OneofDescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<OneofDescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9033,9 +9243,8 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me void MergeFrom(const OneofDescriptorProto& from) { OneofDescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -9050,49 +9259,51 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(OneofDescriptorProto* other); + void InternalSwap(OneofDescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.OneofDescriptorProto"; } protected: - explicit OneofDescriptorProto(::google::protobuf::Arena* arena); - OneofDescriptorProto(::google::protobuf::Arena* arena, const OneofDescriptorProto& from); - OneofDescriptorProto(::google::protobuf::Arena* arena, OneofDescriptorProto&& from) noexcept + explicit OneofDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + OneofDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const OneofDescriptorProto& from); + OneofDescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, OneofDescriptorProto&& from) noexcept : OneofDescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -9107,39 +9318,38 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional .google.protobuf.OneofOptions options = 2; bool has_options() const; void clear_options() ; const ::google::protobuf::OneofOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::OneofOptions* release_options(); - ::google::protobuf::OneofOptions* mutable_options(); - void set_allocated_options(::google::protobuf::OneofOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::OneofOptions* value); - ::google::protobuf::OneofOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::OneofOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::OneofOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::OneofOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::OneofOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::OneofOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::OneofOptions& _internal_options() const; - ::google::protobuf::OneofOptions* _internal_mutable_options(); + ::google::protobuf::OneofOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // @@protoc_insertion_point(class_scope:google.protobuf.OneofDescriptorProto) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 1, - 49, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 1, 49, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -9149,22 +9359,25 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const OneofDescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const OneofDescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::OneofOptions* options_; + ::google::protobuf::OneofOptions* PROTOBUF_NULLABLE options_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull OneofDescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::Message @@ -9174,15 +9387,14 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M ~MethodDescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(MethodDescriptorProto* msg, std::destroying_delete_t) { + void operator delete(MethodDescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(MethodDescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR MethodDescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR MethodDescriptorProto(::google::protobuf::internal::ConstantInitialized); inline MethodDescriptorProto(const MethodDescriptorProto& from) : MethodDescriptorProto(nullptr, from) {} inline MethodDescriptorProto(MethodDescriptorProto&& from) noexcept @@ -9205,30 +9417,27 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const MethodDescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const MethodDescriptorProto* internal_default_instance() { - return reinterpret_cast<const MethodDescriptorProto*>( + return *reinterpret_cast<const MethodDescriptorProto*>( &_MethodDescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 13; friend void swap(MethodDescriptorProto& a, MethodDescriptorProto& b) { a.Swap(&b); } - inline void Swap(MethodDescriptorProto* other) { + inline void Swap(MethodDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -9236,7 +9445,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(MethodDescriptorProto* other) { + void UnsafeArenaSwap(MethodDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -9244,7 +9453,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M // implements Message ---------------------------------------------- - MethodDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + MethodDescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<MethodDescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9253,9 +9462,8 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M void MergeFrom(const MethodDescriptorProto& from) { MethodDescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -9270,49 +9478,51 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(MethodDescriptorProto* other); + void InternalSwap(MethodDescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.MethodDescriptorProto"; } protected: - explicit MethodDescriptorProto(::google::protobuf::Arena* arena); - MethodDescriptorProto(::google::protobuf::Arena* arena, const MethodDescriptorProto& from); - MethodDescriptorProto(::google::protobuf::Arena* arena, MethodDescriptorProto&& from) noexcept + explicit MethodDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + MethodDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MethodDescriptorProto& from); + MethodDescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, MethodDescriptorProto&& from) noexcept : MethodDescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -9331,15 +9541,14 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional string input_type = 2; @@ -9348,15 +9557,14 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M const std::string& input_type() const; template <typename Arg_ = const std::string&, typename... Args_> void set_input_type(Arg_&& arg, Args_... args); - std::string* mutable_input_type(); - PROTOBUF_NODISCARD std::string* release_input_type(); - void set_allocated_input_type(std::string* value); + std::string* PROTOBUF_NONNULL mutable_input_type(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_input_type(); + void set_allocated_input_type(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_input_type() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_input_type( - const std::string& value); - std::string* _internal_mutable_input_type(); + PROTOBUF_ALWAYS_INLINE void _internal_set_input_type(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_input_type(); public: // optional string output_type = 3; @@ -9365,30 +9573,29 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M const std::string& output_type() const; template <typename Arg_ = const std::string&, typename... Args_> void set_output_type(Arg_&& arg, Args_... args); - std::string* mutable_output_type(); - PROTOBUF_NODISCARD std::string* release_output_type(); - void set_allocated_output_type(std::string* value); + std::string* PROTOBUF_NONNULL mutable_output_type(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_output_type(); + void set_allocated_output_type(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_output_type() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_output_type( - const std::string& value); - std::string* _internal_mutable_output_type(); + PROTOBUF_ALWAYS_INLINE void _internal_set_output_type(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_output_type(); public: // optional .google.protobuf.MethodOptions options = 4; bool has_options() const; void clear_options() ; const ::google::protobuf::MethodOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::MethodOptions* release_options(); - ::google::protobuf::MethodOptions* mutable_options(); - void set_allocated_options(::google::protobuf::MethodOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::MethodOptions* value); - ::google::protobuf::MethodOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::MethodOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::MethodOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::MethodOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::MethodOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::MethodOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::MethodOptions& _internal_options() const; - ::google::protobuf::MethodOptions* _internal_mutable_options(); + ::google::protobuf::MethodOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // optional bool client_streaming = 5 [default = false]; @@ -9417,9 +9624,9 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 6, 1, - 71, 2> + static const ::google::protobuf::internal::TcParseTable<3, 6, + 1, 71, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -9429,19 +9636,20 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const MethodDescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const MethodDescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr input_type_; ::google::protobuf::internal::ArenaStringPtr output_type_; - ::google::protobuf::MethodOptions* options_; + ::google::protobuf::MethodOptions* PROTOBUF_NULLABLE options_; bool client_streaming_; bool server_streaming_; PROTOBUF_TSAN_DECLARE_MEMBER @@ -9449,6 +9657,8 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull MethodDescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Message @@ -9458,15 +9668,14 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me ~FieldDescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldDescriptorProto* msg, std::destroying_delete_t) { + void operator delete(FieldDescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldDescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FieldDescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FieldDescriptorProto(::google::protobuf::internal::ConstantInitialized); inline FieldDescriptorProto(const FieldDescriptorProto& from) : FieldDescriptorProto(nullptr, from) {} inline FieldDescriptorProto(FieldDescriptorProto&& from) noexcept @@ -9489,30 +9698,27 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FieldDescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const FieldDescriptorProto* internal_default_instance() { - return reinterpret_cast<const FieldDescriptorProto*>( + return *reinterpret_cast<const FieldDescriptorProto*>( &_FieldDescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 7; friend void swap(FieldDescriptorProto& a, FieldDescriptorProto& b) { a.Swap(&b); } - inline void Swap(FieldDescriptorProto* other) { + inline void Swap(FieldDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -9520,7 +9726,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FieldDescriptorProto* other) { + void UnsafeArenaSwap(FieldDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -9528,7 +9734,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me // implements Message ---------------------------------------------- - FieldDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + FieldDescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FieldDescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9537,9 +9743,8 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me void MergeFrom(const FieldDescriptorProto& from) { FieldDescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -9554,49 +9759,51 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FieldDescriptorProto* other); + void InternalSwap(FieldDescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FieldDescriptorProto"; } protected: - explicit FieldDescriptorProto(::google::protobuf::Arena* arena); - FieldDescriptorProto(::google::protobuf::Arena* arena, const FieldDescriptorProto& from); - FieldDescriptorProto(::google::protobuf::Arena* arena, FieldDescriptorProto&& from) noexcept + explicit FieldDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FieldDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldDescriptorProto& from); + FieldDescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldDescriptorProto&& from) noexcept : FieldDescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using Type = FieldDescriptorProto_Type; @@ -9624,14 +9831,15 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me static constexpr Type Type_MIN = FieldDescriptorProto_Type_Type_MIN; static constexpr Type Type_MAX = FieldDescriptorProto_Type_Type_MAX; static constexpr int Type_ARRAYSIZE = FieldDescriptorProto_Type_Type_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Type_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Type_descriptor() { return FieldDescriptorProto_Type_descriptor(); } template <typename T> static inline const std::string& Type_Name(T value) { return FieldDescriptorProto_Type_Name(value); } - static inline bool Type_Parse(absl::string_view name, Type* value) { + static inline bool Type_Parse( + absl::string_view name, Type* PROTOBUF_NONNULL value) { return FieldDescriptorProto_Type_Parse(name, value); } using Label = FieldDescriptorProto_Label; @@ -9644,14 +9852,15 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me static constexpr Label Label_MIN = FieldDescriptorProto_Label_Label_MIN; static constexpr Label Label_MAX = FieldDescriptorProto_Label_Label_MAX; static constexpr int Label_ARRAYSIZE = FieldDescriptorProto_Label_Label_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Label_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Label_descriptor() { return FieldDescriptorProto_Label_descriptor(); } template <typename T> static inline const std::string& Label_Name(T value) { return FieldDescriptorProto_Label_Name(value); } - static inline bool Label_Parse(absl::string_view name, Label* value) { + static inline bool Label_Parse( + absl::string_view name, Label* PROTOBUF_NONNULL value) { return FieldDescriptorProto_Label_Parse(name, value); } @@ -9675,15 +9884,14 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional string extendee = 2; @@ -9692,15 +9900,14 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me const std::string& extendee() const; template <typename Arg_ = const std::string&, typename... Args_> void set_extendee(Arg_&& arg, Args_... args); - std::string* mutable_extendee(); - PROTOBUF_NODISCARD std::string* release_extendee(); - void set_allocated_extendee(std::string* value); + std::string* PROTOBUF_NONNULL mutable_extendee(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_extendee(); + void set_allocated_extendee(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_extendee() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_extendee( - const std::string& value); - std::string* _internal_mutable_extendee(); + PROTOBUF_ALWAYS_INLINE void _internal_set_extendee(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_extendee(); public: // optional string type_name = 6; @@ -9709,15 +9916,14 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me const std::string& type_name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_type_name(Arg_&& arg, Args_... args); - std::string* mutable_type_name(); - PROTOBUF_NODISCARD std::string* release_type_name(); - void set_allocated_type_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_type_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_type_name(); + void set_allocated_type_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_type_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_name( - const std::string& value); - std::string* _internal_mutable_type_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_type_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_type_name(); public: // optional string default_value = 7; @@ -9726,15 +9932,14 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me const std::string& default_value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_default_value(Arg_&& arg, Args_... args); - std::string* mutable_default_value(); - PROTOBUF_NODISCARD std::string* release_default_value(); - void set_allocated_default_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_default_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_default_value(); + void set_allocated_default_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_default_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_default_value( - const std::string& value); - std::string* _internal_mutable_default_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_default_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_default_value(); public: // optional string json_name = 10; @@ -9743,30 +9948,29 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me const std::string& json_name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_json_name(Arg_&& arg, Args_... args); - std::string* mutable_json_name(); - PROTOBUF_NODISCARD std::string* release_json_name(); - void set_allocated_json_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_json_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_json_name(); + void set_allocated_json_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_json_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_json_name( - const std::string& value); - std::string* _internal_mutable_json_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_json_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_json_name(); public: // optional .google.protobuf.FieldOptions options = 8; bool has_options() const; void clear_options() ; const ::google::protobuf::FieldOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::FieldOptions* release_options(); - ::google::protobuf::FieldOptions* mutable_options(); - void set_allocated_options(::google::protobuf::FieldOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::FieldOptions* value); - ::google::protobuf::FieldOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::FieldOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::FieldOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::FieldOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::FieldOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::FieldOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::FieldOptions& _internal_options() const; - ::google::protobuf::FieldOptions* _internal_mutable_options(); + ::google::protobuf::FieldOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // optional int32 number = 3; @@ -9828,9 +10032,9 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 4, 11, 3, - 96, 2> + static const ::google::protobuf::internal::TcParseTable<4, 11, + 3, 96, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -9840,13 +10044,14 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FieldDescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FieldDescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; @@ -9854,7 +10059,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me ::google::protobuf::internal::ArenaStringPtr type_name_; ::google::protobuf::internal::ArenaStringPtr default_value_; ::google::protobuf::internal::ArenaStringPtr json_name_; - ::google::protobuf::FieldOptions* options_; + ::google::protobuf::FieldOptions* PROTOBUF_NULLABLE options_; ::int32_t number_; ::int32_t oneof_index_; bool proto3_optional_; @@ -9865,6 +10070,8 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldDescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf::Message @@ -9874,15 +10081,14 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf ~EnumValueDescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(EnumValueDescriptorProto* msg, std::destroying_delete_t) { + void operator delete(EnumValueDescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(EnumValueDescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR EnumValueDescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR EnumValueDescriptorProto(::google::protobuf::internal::ConstantInitialized); inline EnumValueDescriptorProto(const EnumValueDescriptorProto& from) : EnumValueDescriptorProto(nullptr, from) {} inline EnumValueDescriptorProto(EnumValueDescriptorProto&& from) noexcept @@ -9905,30 +10111,27 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const EnumValueDescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const EnumValueDescriptorProto* internal_default_instance() { - return reinterpret_cast<const EnumValueDescriptorProto*>( + return *reinterpret_cast<const EnumValueDescriptorProto*>( &_EnumValueDescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 11; friend void swap(EnumValueDescriptorProto& a, EnumValueDescriptorProto& b) { a.Swap(&b); } - inline void Swap(EnumValueDescriptorProto* other) { + inline void Swap(EnumValueDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -9936,7 +10139,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(EnumValueDescriptorProto* other) { + void UnsafeArenaSwap(EnumValueDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -9944,7 +10147,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf // implements Message ---------------------------------------------- - EnumValueDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + EnumValueDescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<EnumValueDescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9953,9 +10156,8 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf void MergeFrom(const EnumValueDescriptorProto& from) { EnumValueDescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -9970,49 +10172,51 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(EnumValueDescriptorProto* other); + void InternalSwap(EnumValueDescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.EnumValueDescriptorProto"; } protected: - explicit EnumValueDescriptorProto(::google::protobuf::Arena* arena); - EnumValueDescriptorProto(::google::protobuf::Arena* arena, const EnumValueDescriptorProto& from); - EnumValueDescriptorProto(::google::protobuf::Arena* arena, EnumValueDescriptorProto&& from) noexcept + explicit EnumValueDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + EnumValueDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumValueDescriptorProto& from); + EnumValueDescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EnumValueDescriptorProto&& from) noexcept : EnumValueDescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -10028,30 +10232,29 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional .google.protobuf.EnumValueOptions options = 3; bool has_options() const; void clear_options() ; const ::google::protobuf::EnumValueOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::EnumValueOptions* release_options(); - ::google::protobuf::EnumValueOptions* mutable_options(); - void set_allocated_options(::google::protobuf::EnumValueOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::EnumValueOptions* value); - ::google::protobuf::EnumValueOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::EnumValueOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::EnumValueOptions& _internal_options() const; - ::google::protobuf::EnumValueOptions* _internal_mutable_options(); + ::google::protobuf::EnumValueOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // optional int32 number = 2; @@ -10069,9 +10272,9 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 3, 1, - 53, 2> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 1, 53, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -10081,23 +10284,26 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const EnumValueDescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const EnumValueDescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::EnumValueOptions* options_; + ::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE options_; ::int32_t number_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumValueDescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::protobuf::Message @@ -10107,15 +10313,14 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr ~DescriptorProto_ExtensionRange() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(DescriptorProto_ExtensionRange* msg, std::destroying_delete_t) { + void operator delete(DescriptorProto_ExtensionRange* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(DescriptorProto_ExtensionRange)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR DescriptorProto_ExtensionRange( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR DescriptorProto_ExtensionRange(::google::protobuf::internal::ConstantInitialized); inline DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from) : DescriptorProto_ExtensionRange(nullptr, from) {} inline DescriptorProto_ExtensionRange(DescriptorProto_ExtensionRange&& from) noexcept @@ -10138,30 +10343,27 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const DescriptorProto_ExtensionRange& default_instance() { - return *internal_default_instance(); - } - static inline const DescriptorProto_ExtensionRange* internal_default_instance() { - return reinterpret_cast<const DescriptorProto_ExtensionRange*>( + return *reinterpret_cast<const DescriptorProto_ExtensionRange*>( &_DescriptorProto_ExtensionRange_default_instance_); } static constexpr int kIndexInFileMessages = 2; friend void swap(DescriptorProto_ExtensionRange& a, DescriptorProto_ExtensionRange& b) { a.Swap(&b); } - inline void Swap(DescriptorProto_ExtensionRange* other) { + inline void Swap(DescriptorProto_ExtensionRange* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -10169,7 +10371,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(DescriptorProto_ExtensionRange* other) { + void UnsafeArenaSwap(DescriptorProto_ExtensionRange* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -10177,7 +10379,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr // implements Message ---------------------------------------------- - DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena = nullptr) const { + DescriptorProto_ExtensionRange* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<DescriptorProto_ExtensionRange>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -10186,9 +10388,8 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr void MergeFrom(const DescriptorProto_ExtensionRange& from) { DescriptorProto_ExtensionRange::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -10203,49 +10404,51 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(DescriptorProto_ExtensionRange* other); + void InternalSwap(DescriptorProto_ExtensionRange* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.DescriptorProto.ExtensionRange"; } protected: - explicit DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena); - DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena, const DescriptorProto_ExtensionRange& from); - DescriptorProto_ExtensionRange(::google::protobuf::Arena* arena, DescriptorProto_ExtensionRange&& from) noexcept + explicit DescriptorProto_ExtensionRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + DescriptorProto_ExtensionRange(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DescriptorProto_ExtensionRange& from); + DescriptorProto_ExtensionRange( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, DescriptorProto_ExtensionRange&& from) noexcept : DescriptorProto_ExtensionRange(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -10259,15 +10462,15 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr bool has_options() const; void clear_options() ; const ::google::protobuf::ExtensionRangeOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::ExtensionRangeOptions* release_options(); - ::google::protobuf::ExtensionRangeOptions* mutable_options(); - void set_allocated_options(::google::protobuf::ExtensionRangeOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::ExtensionRangeOptions* value); - ::google::protobuf::ExtensionRangeOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::ExtensionRangeOptions& _internal_options() const; - ::google::protobuf::ExtensionRangeOptions* _internal_mutable_options(); + ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // optional int32 start = 1; @@ -10296,9 +10499,9 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 3, 1, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 1, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -10308,16 +10511,17 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const DescriptorProto_ExtensionRange& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const DescriptorProto_ExtensionRange& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::ExtensionRangeOptions* options_; + ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE options_; ::int32_t start_; ::int32_t end_; PROTOBUF_TSAN_DECLARE_MEMBER @@ -10325,6 +10529,8 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DescriptorProto_ExtensionRange_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf::Message @@ -10334,15 +10540,14 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: ~ServiceDescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(ServiceDescriptorProto* msg, std::destroying_delete_t) { + void operator delete(ServiceDescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(ServiceDescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR ServiceDescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR ServiceDescriptorProto(::google::protobuf::internal::ConstantInitialized); inline ServiceDescriptorProto(const ServiceDescriptorProto& from) : ServiceDescriptorProto(nullptr, from) {} inline ServiceDescriptorProto(ServiceDescriptorProto&& from) noexcept @@ -10365,30 +10570,27 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const ServiceDescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const ServiceDescriptorProto* internal_default_instance() { - return reinterpret_cast<const ServiceDescriptorProto*>( + return *reinterpret_cast<const ServiceDescriptorProto*>( &_ServiceDescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 12; friend void swap(ServiceDescriptorProto& a, ServiceDescriptorProto& b) { a.Swap(&b); } - inline void Swap(ServiceDescriptorProto* other) { + inline void Swap(ServiceDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -10396,7 +10598,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(ServiceDescriptorProto* other) { + void UnsafeArenaSwap(ServiceDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -10404,7 +10606,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: // implements Message ---------------------------------------------- - ServiceDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + ServiceDescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<ServiceDescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -10413,9 +10615,8 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: void MergeFrom(const ServiceDescriptorProto& from) { ServiceDescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -10430,49 +10631,51 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(ServiceDescriptorProto* other); + void InternalSwap(ServiceDescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.ServiceDescriptorProto"; } protected: - explicit ServiceDescriptorProto(::google::protobuf::Arena* arena); - ServiceDescriptorProto(::google::protobuf::Arena* arena, const ServiceDescriptorProto& from); - ServiceDescriptorProto(::google::protobuf::Arena* arena, ServiceDescriptorProto&& from) noexcept + explicit ServiceDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + ServiceDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ServiceDescriptorProto& from); + ServiceDescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, ServiceDescriptorProto&& from) noexcept : ServiceDescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -10489,15 +10692,15 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: public: void clear_method() ; - ::google::protobuf::MethodDescriptorProto* mutable_method(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* mutable_method(); + ::google::protobuf::MethodDescriptorProto* PROTOBUF_NONNULL mutable_method(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* PROTOBUF_NONNULL mutable_method(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>& _internal_method() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* _internal_mutable_method(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_method(); public: const ::google::protobuf::MethodDescriptorProto& method(int index) const; - ::google::protobuf::MethodDescriptorProto* add_method(); + ::google::protobuf::MethodDescriptorProto* PROTOBUF_NONNULL add_method(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>& method() const; // optional string name = 1; bool has_name() const; @@ -10505,39 +10708,38 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional .google.protobuf.ServiceOptions options = 3; bool has_options() const; void clear_options() ; const ::google::protobuf::ServiceOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::ServiceOptions* release_options(); - ::google::protobuf::ServiceOptions* mutable_options(); - void set_allocated_options(::google::protobuf::ServiceOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::ServiceOptions* value); - ::google::protobuf::ServiceOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::ServiceOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::ServiceOptions& _internal_options() const; - ::google::protobuf::ServiceOptions* _internal_mutable_options(); + ::google::protobuf::ServiceOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // @@protoc_insertion_point(class_scope:google.protobuf.ServiceDescriptorProto) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 3, 2, - 51, 2> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 2, 51, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -10547,23 +10749,26 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const ServiceDescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ServiceDescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto > method_; ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::ServiceOptions* options_; + ::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE options_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ServiceDescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Message @@ -10573,15 +10778,14 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes ~EnumDescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(EnumDescriptorProto* msg, std::destroying_delete_t) { + void operator delete(EnumDescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(EnumDescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR EnumDescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR EnumDescriptorProto(::google::protobuf::internal::ConstantInitialized); inline EnumDescriptorProto(const EnumDescriptorProto& from) : EnumDescriptorProto(nullptr, from) {} inline EnumDescriptorProto(EnumDescriptorProto&& from) noexcept @@ -10604,30 +10808,27 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const EnumDescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const EnumDescriptorProto* internal_default_instance() { - return reinterpret_cast<const EnumDescriptorProto*>( + return *reinterpret_cast<const EnumDescriptorProto*>( &_EnumDescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 10; friend void swap(EnumDescriptorProto& a, EnumDescriptorProto& b) { a.Swap(&b); } - inline void Swap(EnumDescriptorProto* other) { + inline void Swap(EnumDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -10635,7 +10836,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(EnumDescriptorProto* other) { + void UnsafeArenaSwap(EnumDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -10643,7 +10844,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - EnumDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + EnumDescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<EnumDescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -10652,9 +10853,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes void MergeFrom(const EnumDescriptorProto& from) { EnumDescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -10669,49 +10869,51 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(EnumDescriptorProto* other); + void InternalSwap(EnumDescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.EnumDescriptorProto"; } protected: - explicit EnumDescriptorProto(::google::protobuf::Arena* arena); - EnumDescriptorProto(::google::protobuf::Arena* arena, const EnumDescriptorProto& from); - EnumDescriptorProto(::google::protobuf::Arena* arena, EnumDescriptorProto&& from) noexcept + explicit EnumDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + EnumDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumDescriptorProto& from); + EnumDescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EnumDescriptorProto&& from) noexcept : EnumDescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using EnumReservedRange = EnumDescriptorProto_EnumReservedRange; @@ -10731,15 +10933,15 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes public: void clear_value() ; - ::google::protobuf::EnumValueDescriptorProto* mutable_value(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* mutable_value(); + ::google::protobuf::EnumValueDescriptorProto* PROTOBUF_NONNULL mutable_value(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* PROTOBUF_NONNULL mutable_value(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>& _internal_value() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* _internal_mutable_value(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_value(); public: const ::google::protobuf::EnumValueDescriptorProto& value(int index) const; - ::google::protobuf::EnumValueDescriptorProto* add_value(); + ::google::protobuf::EnumValueDescriptorProto* PROTOBUF_NONNULL add_value(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>& value() const; // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; int reserved_range_size() const; @@ -10748,15 +10950,15 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes public: void clear_reserved_range() ; - ::google::protobuf::EnumDescriptorProto_EnumReservedRange* mutable_reserved_range(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* mutable_reserved_range(); + ::google::protobuf::EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL mutable_reserved_range(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* PROTOBUF_NONNULL mutable_reserved_range(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>& _internal_reserved_range() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* _internal_mutable_reserved_range(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* PROTOBUF_NONNULL _internal_mutable_reserved_range(); public: const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& reserved_range(int index) const; - ::google::protobuf::EnumDescriptorProto_EnumReservedRange* add_reserved_range(); + ::google::protobuf::EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL add_reserved_range(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>& reserved_range() const; // repeated string reserved_name = 5; int reserved_name_size() const; @@ -10766,18 +10968,18 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes public: void clear_reserved_name() ; const std::string& reserved_name(int index) const; - std::string* mutable_reserved_name(int index); + std::string* PROTOBUF_NONNULL mutable_reserved_name(int index); template <typename Arg_ = const std::string&, typename... Args_> void set_reserved_name(int index, Arg_&& value, Args_... args); - std::string* add_reserved_name(); + std::string* PROTOBUF_NONNULL add_reserved_name(); template <typename Arg_ = const std::string&, typename... Args_> void add_reserved_name(Arg_&& value, Args_... args); const ::google::protobuf::RepeatedPtrField<std::string>& reserved_name() const; - ::google::protobuf::RepeatedPtrField<std::string>* mutable_reserved_name(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL mutable_reserved_name(); private: const ::google::protobuf::RepeatedPtrField<std::string>& _internal_reserved_name() const; - ::google::protobuf::RepeatedPtrField<std::string>* _internal_mutable_reserved_name(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL _internal_mutable_reserved_name(); public: // optional string name = 1; @@ -10786,39 +10988,38 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional .google.protobuf.EnumOptions options = 3; bool has_options() const; void clear_options() ; const ::google::protobuf::EnumOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::EnumOptions* release_options(); - ::google::protobuf::EnumOptions* mutable_options(); - void set_allocated_options(::google::protobuf::EnumOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::EnumOptions* value); - ::google::protobuf::EnumOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::EnumOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::EnumOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::EnumOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::EnumOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::EnumOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::EnumOptions& _internal_options() const; - ::google::protobuf::EnumOptions* _internal_mutable_options(); + ::google::protobuf::EnumOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 5, 3, - 61, 2> + static const ::google::protobuf::internal::TcParseTable<3, 5, + 3, 61, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -10828,25 +11029,28 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const EnumDescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const EnumDescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto > value_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange > reserved_range_; ::google::protobuf::RepeatedPtrField<std::string> reserved_name_; ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::EnumOptions* options_; + ::google::protobuf::EnumOptions* PROTOBUF_NULLABLE options_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumDescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message @@ -10856,15 +11060,14 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message ~DescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(DescriptorProto* msg, std::destroying_delete_t) { + void operator delete(DescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(DescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR DescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR DescriptorProto(::google::protobuf::internal::ConstantInitialized); inline DescriptorProto(const DescriptorProto& from) : DescriptorProto(nullptr, from) {} inline DescriptorProto(DescriptorProto&& from) noexcept @@ -10887,30 +11090,27 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const DescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const DescriptorProto* internal_default_instance() { - return reinterpret_cast<const DescriptorProto*>( + return *reinterpret_cast<const DescriptorProto*>( &_DescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 4; friend void swap(DescriptorProto& a, DescriptorProto& b) { a.Swap(&b); } - inline void Swap(DescriptorProto* other) { + inline void Swap(DescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -10918,7 +11118,7 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(DescriptorProto* other) { + void UnsafeArenaSwap(DescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -10926,7 +11126,7 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - DescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + DescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<DescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -10935,9 +11135,8 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message void MergeFrom(const DescriptorProto& from) { DescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -10952,49 +11151,51 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(DescriptorProto* other); + void InternalSwap(DescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.DescriptorProto"; } protected: - explicit DescriptorProto(::google::protobuf::Arena* arena); - DescriptorProto(::google::protobuf::Arena* arena, const DescriptorProto& from); - DescriptorProto(::google::protobuf::Arena* arena, DescriptorProto&& from) noexcept + explicit DescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + DescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DescriptorProto& from); + DescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, DescriptorProto&& from) noexcept : DescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using ExtensionRange = DescriptorProto_ExtensionRange; @@ -11020,15 +11221,15 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_field() ; - ::google::protobuf::FieldDescriptorProto* mutable_field(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* mutable_field(); + ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL mutable_field(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL mutable_field(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>& _internal_field() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* _internal_mutable_field(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_field(); public: const ::google::protobuf::FieldDescriptorProto& field(int index) const; - ::google::protobuf::FieldDescriptorProto* add_field(); + ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL add_field(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>& field() const; // repeated .google.protobuf.DescriptorProto nested_type = 3; int nested_type_size() const; @@ -11037,15 +11238,15 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_nested_type() ; - ::google::protobuf::DescriptorProto* mutable_nested_type(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* mutable_nested_type(); + ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL mutable_nested_type(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL mutable_nested_type(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>& _internal_nested_type() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* _internal_mutable_nested_type(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL _internal_mutable_nested_type(); public: const ::google::protobuf::DescriptorProto& nested_type(int index) const; - ::google::protobuf::DescriptorProto* add_nested_type(); + ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL add_nested_type(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>& nested_type() const; // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; int enum_type_size() const; @@ -11054,15 +11255,15 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_enum_type() ; - ::google::protobuf::EnumDescriptorProto* mutable_enum_type(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* mutable_enum_type(); + ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL mutable_enum_type(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL mutable_enum_type(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>& _internal_enum_type() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* _internal_mutable_enum_type(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_enum_type(); public: const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const; - ::google::protobuf::EnumDescriptorProto* add_enum_type(); + ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL add_enum_type(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>& enum_type() const; // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; int extension_range_size() const; @@ -11071,15 +11272,15 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_extension_range() ; - ::google::protobuf::DescriptorProto_ExtensionRange* mutable_extension_range(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* mutable_extension_range(); + ::google::protobuf::DescriptorProto_ExtensionRange* PROTOBUF_NONNULL mutable_extension_range(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* PROTOBUF_NONNULL mutable_extension_range(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>& _internal_extension_range() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* _internal_mutable_extension_range(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* PROTOBUF_NONNULL _internal_mutable_extension_range(); public: const ::google::protobuf::DescriptorProto_ExtensionRange& extension_range(int index) const; - ::google::protobuf::DescriptorProto_ExtensionRange* add_extension_range(); + ::google::protobuf::DescriptorProto_ExtensionRange* PROTOBUF_NONNULL add_extension_range(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>& extension_range() const; // repeated .google.protobuf.FieldDescriptorProto extension = 6; int extension_size() const; @@ -11088,15 +11289,15 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_extension() ; - ::google::protobuf::FieldDescriptorProto* mutable_extension(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* mutable_extension(); + ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL mutable_extension(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL mutable_extension(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>& _internal_extension() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* _internal_mutable_extension(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_extension(); public: const ::google::protobuf::FieldDescriptorProto& extension(int index) const; - ::google::protobuf::FieldDescriptorProto* add_extension(); + ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL add_extension(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>& extension() const; // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; int oneof_decl_size() const; @@ -11105,15 +11306,15 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_oneof_decl() ; - ::google::protobuf::OneofDescriptorProto* mutable_oneof_decl(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* mutable_oneof_decl(); + ::google::protobuf::OneofDescriptorProto* PROTOBUF_NONNULL mutable_oneof_decl(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* PROTOBUF_NONNULL mutable_oneof_decl(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>& _internal_oneof_decl() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* _internal_mutable_oneof_decl(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_oneof_decl(); public: const ::google::protobuf::OneofDescriptorProto& oneof_decl(int index) const; - ::google::protobuf::OneofDescriptorProto* add_oneof_decl(); + ::google::protobuf::OneofDescriptorProto* PROTOBUF_NONNULL add_oneof_decl(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>& oneof_decl() const; // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; int reserved_range_size() const; @@ -11122,15 +11323,15 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_reserved_range() ; - ::google::protobuf::DescriptorProto_ReservedRange* mutable_reserved_range(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* mutable_reserved_range(); + ::google::protobuf::DescriptorProto_ReservedRange* PROTOBUF_NONNULL mutable_reserved_range(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* PROTOBUF_NONNULL mutable_reserved_range(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>& _internal_reserved_range() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* _internal_mutable_reserved_range(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* PROTOBUF_NONNULL _internal_mutable_reserved_range(); public: const ::google::protobuf::DescriptorProto_ReservedRange& reserved_range(int index) const; - ::google::protobuf::DescriptorProto_ReservedRange* add_reserved_range(); + ::google::protobuf::DescriptorProto_ReservedRange* PROTOBUF_NONNULL add_reserved_range(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>& reserved_range() const; // repeated string reserved_name = 10; int reserved_name_size() const; @@ -11140,18 +11341,18 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message public: void clear_reserved_name() ; const std::string& reserved_name(int index) const; - std::string* mutable_reserved_name(int index); + std::string* PROTOBUF_NONNULL mutable_reserved_name(int index); template <typename Arg_ = const std::string&, typename... Args_> void set_reserved_name(int index, Arg_&& value, Args_... args); - std::string* add_reserved_name(); + std::string* PROTOBUF_NONNULL add_reserved_name(); template <typename Arg_ = const std::string&, typename... Args_> void add_reserved_name(Arg_&& value, Args_... args); const ::google::protobuf::RepeatedPtrField<std::string>& reserved_name() const; - ::google::protobuf::RepeatedPtrField<std::string>* mutable_reserved_name(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL mutable_reserved_name(); private: const ::google::protobuf::RepeatedPtrField<std::string>& _internal_reserved_name() const; - ::google::protobuf::RepeatedPtrField<std::string>* _internal_mutable_reserved_name(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL _internal_mutable_reserved_name(); public: // optional string name = 1; @@ -11160,39 +11361,38 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional .google.protobuf.MessageOptions options = 7; bool has_options() const; void clear_options() ; const ::google::protobuf::MessageOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::MessageOptions* release_options(); - ::google::protobuf::MessageOptions* mutable_options(); - void set_allocated_options(::google::protobuf::MessageOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::MessageOptions* value); - ::google::protobuf::MessageOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::MessageOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::MessageOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::MessageOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::MessageOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::MessageOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::MessageOptions& _internal_options() const; - ::google::protobuf::MessageOptions* _internal_mutable_options(); + ::google::protobuf::MessageOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 4, 10, 8, - 65, 2> + static const ::google::protobuf::internal::TcParseTable<4, 10, + 8, 65, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -11202,13 +11402,14 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const DescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const DescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > field_; @@ -11220,12 +11421,14 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange > reserved_range_; ::google::protobuf::RepeatedPtrField<std::string> reserved_name_; ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::MessageOptions* options_; + ::google::protobuf::MessageOptions* PROTOBUF_NULLABLE options_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Message @@ -11235,15 +11438,14 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes ~FileDescriptorProto() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FileDescriptorProto* msg, std::destroying_delete_t) { + void operator delete(FileDescriptorProto* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FileDescriptorProto)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FileDescriptorProto( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FileDescriptorProto(::google::protobuf::internal::ConstantInitialized); inline FileDescriptorProto(const FileDescriptorProto& from) : FileDescriptorProto(nullptr, from) {} inline FileDescriptorProto(FileDescriptorProto&& from) noexcept @@ -11266,30 +11468,27 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FileDescriptorProto& default_instance() { - return *internal_default_instance(); - } - static inline const FileDescriptorProto* internal_default_instance() { - return reinterpret_cast<const FileDescriptorProto*>( + return *reinterpret_cast<const FileDescriptorProto*>( &_FileDescriptorProto_default_instance_); } static constexpr int kIndexInFileMessages = 1; friend void swap(FileDescriptorProto& a, FileDescriptorProto& b) { a.Swap(&b); } - inline void Swap(FileDescriptorProto* other) { + inline void Swap(FileDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -11297,7 +11496,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FileDescriptorProto* other) { + void UnsafeArenaSwap(FileDescriptorProto* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -11305,7 +11504,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - FileDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { + FileDescriptorProto* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FileDescriptorProto>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -11314,9 +11513,8 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes void MergeFrom(const FileDescriptorProto& from) { FileDescriptorProto::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -11331,49 +11529,51 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FileDescriptorProto* other); + void InternalSwap(FileDescriptorProto* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FileDescriptorProto"; } protected: - explicit FileDescriptorProto(::google::protobuf::Arena* arena); - FileDescriptorProto(::google::protobuf::Arena* arena, const FileDescriptorProto& from); - FileDescriptorProto(::google::protobuf::Arena* arena, FileDescriptorProto&& from) noexcept + explicit FileDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FileDescriptorProto(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FileDescriptorProto& from); + FileDescriptorProto( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FileDescriptorProto&& from) noexcept : FileDescriptorProto(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -11401,18 +11601,18 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes public: void clear_dependency() ; const std::string& dependency(int index) const; - std::string* mutable_dependency(int index); + std::string* PROTOBUF_NONNULL mutable_dependency(int index); template <typename Arg_ = const std::string&, typename... Args_> void set_dependency(int index, Arg_&& value, Args_... args); - std::string* add_dependency(); + std::string* PROTOBUF_NONNULL add_dependency(); template <typename Arg_ = const std::string&, typename... Args_> void add_dependency(Arg_&& value, Args_... args); const ::google::protobuf::RepeatedPtrField<std::string>& dependency() const; - ::google::protobuf::RepeatedPtrField<std::string>* mutable_dependency(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL mutable_dependency(); private: const ::google::protobuf::RepeatedPtrField<std::string>& _internal_dependency() const; - ::google::protobuf::RepeatedPtrField<std::string>* _internal_mutable_dependency(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL _internal_mutable_dependency(); public: // repeated .google.protobuf.DescriptorProto message_type = 4; @@ -11422,15 +11622,15 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes public: void clear_message_type() ; - ::google::protobuf::DescriptorProto* mutable_message_type(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* mutable_message_type(); + ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL mutable_message_type(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL mutable_message_type(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>& _internal_message_type() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* _internal_mutable_message_type(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL _internal_mutable_message_type(); public: const ::google::protobuf::DescriptorProto& message_type(int index) const; - ::google::protobuf::DescriptorProto* add_message_type(); + ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL add_message_type(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>& message_type() const; // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; int enum_type_size() const; @@ -11439,15 +11639,15 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes public: void clear_enum_type() ; - ::google::protobuf::EnumDescriptorProto* mutable_enum_type(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* mutable_enum_type(); + ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL mutable_enum_type(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL mutable_enum_type(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>& _internal_enum_type() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* _internal_mutable_enum_type(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_enum_type(); public: const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const; - ::google::protobuf::EnumDescriptorProto* add_enum_type(); + ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL add_enum_type(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>& enum_type() const; // repeated .google.protobuf.ServiceDescriptorProto service = 6; int service_size() const; @@ -11456,15 +11656,15 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes public: void clear_service() ; - ::google::protobuf::ServiceDescriptorProto* mutable_service(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* mutable_service(); + ::google::protobuf::ServiceDescriptorProto* PROTOBUF_NONNULL mutable_service(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* PROTOBUF_NONNULL mutable_service(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>& _internal_service() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* _internal_mutable_service(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_service(); public: const ::google::protobuf::ServiceDescriptorProto& service(int index) const; - ::google::protobuf::ServiceDescriptorProto* add_service(); + ::google::protobuf::ServiceDescriptorProto* PROTOBUF_NONNULL add_service(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>& service() const; // repeated .google.protobuf.FieldDescriptorProto extension = 7; int extension_size() const; @@ -11473,15 +11673,15 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes public: void clear_extension() ; - ::google::protobuf::FieldDescriptorProto* mutable_extension(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* mutable_extension(); + ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL mutable_extension(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL mutable_extension(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>& _internal_extension() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* _internal_mutable_extension(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_extension(); public: const ::google::protobuf::FieldDescriptorProto& extension(int index) const; - ::google::protobuf::FieldDescriptorProto* add_extension(); + ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL add_extension(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>& extension() const; // repeated int32 public_dependency = 10; int public_dependency_size() const; @@ -11494,11 +11694,11 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes void set_public_dependency(int index, ::int32_t value); void add_public_dependency(::int32_t value); const ::google::protobuf::RepeatedField<::int32_t>& public_dependency() const; - ::google::protobuf::RepeatedField<::int32_t>* mutable_public_dependency(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_public_dependency(); private: const ::google::protobuf::RepeatedField<::int32_t>& _internal_public_dependency() const; - ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_public_dependency(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_public_dependency(); public: // repeated int32 weak_dependency = 11; @@ -11512,11 +11712,11 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes void set_weak_dependency(int index, ::int32_t value); void add_weak_dependency(::int32_t value); const ::google::protobuf::RepeatedField<::int32_t>& weak_dependency() const; - ::google::protobuf::RepeatedField<::int32_t>* mutable_weak_dependency(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_weak_dependency(); private: const ::google::protobuf::RepeatedField<::int32_t>& _internal_weak_dependency() const; - ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_weak_dependency(); + ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_weak_dependency(); public: // optional string name = 1; @@ -11525,15 +11725,14 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // optional string package = 2; @@ -11542,15 +11741,14 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes const std::string& package() const; template <typename Arg_ = const std::string&, typename... Args_> void set_package(Arg_&& arg, Args_... args); - std::string* mutable_package(); - PROTOBUF_NODISCARD std::string* release_package(); - void set_allocated_package(std::string* value); + std::string* PROTOBUF_NONNULL mutable_package(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_package(); + void set_allocated_package(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_package() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_package( - const std::string& value); - std::string* _internal_mutable_package(); + PROTOBUF_ALWAYS_INLINE void _internal_set_package(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_package(); public: // optional string syntax = 12; @@ -11559,45 +11757,44 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes const std::string& syntax() const; template <typename Arg_ = const std::string&, typename... Args_> void set_syntax(Arg_&& arg, Args_... args); - std::string* mutable_syntax(); - PROTOBUF_NODISCARD std::string* release_syntax(); - void set_allocated_syntax(std::string* value); + std::string* PROTOBUF_NONNULL mutable_syntax(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_syntax(); + void set_allocated_syntax(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_syntax() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_syntax( - const std::string& value); - std::string* _internal_mutable_syntax(); + PROTOBUF_ALWAYS_INLINE void _internal_set_syntax(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_syntax(); public: // optional .google.protobuf.FileOptions options = 8; bool has_options() const; void clear_options() ; const ::google::protobuf::FileOptions& options() const; - PROTOBUF_NODISCARD ::google::protobuf::FileOptions* release_options(); - ::google::protobuf::FileOptions* mutable_options(); - void set_allocated_options(::google::protobuf::FileOptions* value); - void unsafe_arena_set_allocated_options(::google::protobuf::FileOptions* value); - ::google::protobuf::FileOptions* unsafe_arena_release_options(); + [[nodiscard]] ::google::protobuf::FileOptions* PROTOBUF_NULLABLE release_options(); + ::google::protobuf::FileOptions* PROTOBUF_NONNULL mutable_options(); + void set_allocated_options(::google::protobuf::FileOptions* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_options(::google::protobuf::FileOptions* PROTOBUF_NULLABLE value); + ::google::protobuf::FileOptions* PROTOBUF_NULLABLE unsafe_arena_release_options(); private: const ::google::protobuf::FileOptions& _internal_options() const; - ::google::protobuf::FileOptions* _internal_mutable_options(); + ::google::protobuf::FileOptions* PROTOBUF_NONNULL _internal_mutable_options(); public: // optional .google.protobuf.SourceCodeInfo source_code_info = 9; bool has_source_code_info() const; void clear_source_code_info() ; const ::google::protobuf::SourceCodeInfo& source_code_info() const; - PROTOBUF_NODISCARD ::google::protobuf::SourceCodeInfo* release_source_code_info(); - ::google::protobuf::SourceCodeInfo* mutable_source_code_info(); - void set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* value); - void unsafe_arena_set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* value); - ::google::protobuf::SourceCodeInfo* unsafe_arena_release_source_code_info(); + [[nodiscard]] ::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE release_source_code_info(); + ::google::protobuf::SourceCodeInfo* PROTOBUF_NONNULL mutable_source_code_info(); + void set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE value); + ::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE unsafe_arena_release_source_code_info(); private: const ::google::protobuf::SourceCodeInfo& _internal_source_code_info() const; - ::google::protobuf::SourceCodeInfo* _internal_mutable_source_code_info(); + ::google::protobuf::SourceCodeInfo* PROTOBUF_NONNULL _internal_mutable_source_code_info(); public: // optional .google.protobuf.Edition edition = 14; @@ -11615,9 +11812,9 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 4, 13, 7, - 79, 2> + static const ::google::protobuf::internal::TcParseTable<4, 13, + 7, 79, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -11627,13 +11824,14 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FileDescriptorProto& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FileDescriptorProto& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField<std::string> dependency_; @@ -11646,14 +11844,16 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr package_; ::google::protobuf::internal::ArenaStringPtr syntax_; - ::google::protobuf::FileOptions* options_; - ::google::protobuf::SourceCodeInfo* source_code_info_; + ::google::protobuf::FileOptions* PROTOBUF_NULLABLE options_; + ::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE source_code_info_; int edition_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FileDescriptorProto_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Message @@ -11663,15 +11863,14 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa ~FileDescriptorSet() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FileDescriptorSet* msg, std::destroying_delete_t) { + void operator delete(FileDescriptorSet* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FileDescriptorSet)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FileDescriptorSet( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FileDescriptorSet(::google::protobuf::internal::ConstantInitialized); inline FileDescriptorSet(const FileDescriptorSet& from) : FileDescriptorSet(nullptr, from) {} inline FileDescriptorSet(FileDescriptorSet&& from) noexcept @@ -11694,30 +11893,27 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FileDescriptorSet& default_instance() { - return *internal_default_instance(); - } - static inline const FileDescriptorSet* internal_default_instance() { - return reinterpret_cast<const FileDescriptorSet*>( + return *reinterpret_cast<const FileDescriptorSet*>( &_FileDescriptorSet_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(FileDescriptorSet& a, FileDescriptorSet& b) { a.Swap(&b); } - inline void Swap(FileDescriptorSet* other) { + inline void Swap(FileDescriptorSet* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -11725,7 +11921,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FileDescriptorSet* other) { + void UnsafeArenaSwap(FileDescriptorSet* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -11733,7 +11929,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa // implements Message ---------------------------------------------- - FileDescriptorSet* New(::google::protobuf::Arena* arena = nullptr) const { + FileDescriptorSet* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FileDescriptorSet>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -11742,9 +11938,8 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa void MergeFrom(const FileDescriptorSet& from) { FileDescriptorSet::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -11759,49 +11954,51 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FileDescriptorSet* other); + void InternalSwap(FileDescriptorSet* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FileDescriptorSet"; } protected: - explicit FileDescriptorSet(::google::protobuf::Arena* arena); - FileDescriptorSet(::google::protobuf::Arena* arena, const FileDescriptorSet& from); - FileDescriptorSet(::google::protobuf::Arena* arena, FileDescriptorSet&& from) noexcept + explicit FileDescriptorSet(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FileDescriptorSet(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FileDescriptorSet& from); + FileDescriptorSet( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FileDescriptorSet&& from) noexcept : FileDescriptorSet(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -11816,15 +12013,15 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa public: void clear_file() ; - ::google::protobuf::FileDescriptorProto* mutable_file(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* mutable_file(); + ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL mutable_file(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL mutable_file(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& _internal_file() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* _internal_mutable_file(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL _internal_mutable_file(); public: const ::google::protobuf::FileDescriptorProto& file(int index) const; - ::google::protobuf::FileDescriptorProto* add_file(); + ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL add_file(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>& file() const; template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed, @@ -11909,11 +12106,9 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - PROTOBUF_NODISCARD inline - typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier<FileDescriptorSet, _proto_TypeTraits, - _field_type, _is_packed>& id) { + [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< + FileDescriptorSet, _proto_TypeTraits, _field_type, _is_packed>& id) { return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); } template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, @@ -11997,7 +12192,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa template <typename _proto_TypeTraits, ::google::protobuf::internal::FieldType _field_type, bool _is_packed> - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL MutableRepeatedExtension( const ::google::protobuf::internal::ExtensionIdentifier<FileDescriptorSet, _proto_TypeTraits, _field_type, _is_packed>& id) @@ -12009,9 +12204,9 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 1, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 1, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -12021,13 +12216,14 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FileDescriptorSet& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FileDescriptorSet& from_msg); ::google::protobuf::internal::ExtensionSet _extensions_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > file_; ::google::protobuf::internal::CachedSize _cached_size_; @@ -12037,6 +12233,8 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FileDescriptorSet_class_data_; + // =================================================================== @@ -12064,12 +12262,12 @@ inline void FileDescriptorSet::clear_file() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.file_.Clear(); } -inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) +inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL FileDescriptorSet::mutable_file(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorSet.file) return _internal_mutable_file()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* FileDescriptorSet::mutable_file() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL FileDescriptorSet::mutable_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12080,7 +12278,8 @@ inline const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(in // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file) return _internal_file().Get(index); } -inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FileDescriptorProto* PROTOBUF_NONNULL FileDescriptorSet::add_file() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FileDescriptorProto* _add = _internal_mutable_file()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file) @@ -12096,7 +12295,7 @@ FileDescriptorSet::_internal_file() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.file_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FileDescriptorProto>* PROTOBUF_NONNULL FileDescriptorSet::_internal_mutable_file() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.file_; @@ -12122,14 +12321,14 @@ inline const std::string& FileDescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileDescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileDescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name) } -inline std::string* FileDescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name) return _s; @@ -12143,12 +12342,12 @@ inline void FileDescriptorProto::_internal_set_name(const std::string& value) { _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* FileDescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* FileDescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE FileDescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -12161,7 +12360,7 @@ inline std::string* FileDescriptorProto::release_name() { } return released; } -inline void FileDescriptorProto::set_allocated_name(std::string* value) { +inline void FileDescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -12191,14 +12390,14 @@ inline const std::string& FileDescriptorProto::package() const return _internal_package(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileDescriptorProto::set_package(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileDescriptorProto::set_package(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.package_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package) } -inline std::string* FileDescriptorProto::mutable_package() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::mutable_package() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_package(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package) return _s; @@ -12212,12 +12411,12 @@ inline void FileDescriptorProto::_internal_set_package(const std::string& value) _impl_._has_bits_[0] |= 0x00000002u; _impl_.package_.Set(value, GetArena()); } -inline std::string* FileDescriptorProto::_internal_mutable_package() { +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_package() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.package_.Mutable( GetArena()); } -inline std::string* FileDescriptorProto::release_package() { +inline std::string* PROTOBUF_NULLABLE FileDescriptorProto::release_package() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -12230,7 +12429,7 @@ inline std::string* FileDescriptorProto::release_package() { } return released; } -inline void FileDescriptorProto::set_allocated_package(std::string* value) { +inline void FileDescriptorProto::set_allocated_package(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -12255,7 +12454,8 @@ inline void FileDescriptorProto::clear_dependency() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.dependency_.Clear(); } -inline std::string* FileDescriptorProto::add_dependency() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::add_dependency() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); std::string* _s = _internal_mutable_dependency()->Add(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency) @@ -12266,16 +12466,15 @@ inline const std::string& FileDescriptorProto::dependency(int index) const // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency) return _internal_dependency().Get(index); } -inline std::string* FileDescriptorProto::mutable_dependency(int index) +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::mutable_dependency(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.dependency) return _internal_mutable_dependency()->Mutable(index); } template <typename Arg_, typename... Args_> inline void FileDescriptorProto::set_dependency(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString( - *_internal_mutable_dependency()->Mutable(index), - std::forward<Arg_>(value), args... ); + ::google::protobuf::internal::AssignToString(*_internal_mutable_dependency()->Mutable(index), std::forward<Arg_>(value), + args... ); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency) } template <typename Arg_, typename... Args_> @@ -12286,12 +12485,12 @@ inline void FileDescriptorProto::add_dependency(Arg_&& value, Args_... args) { args... ); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency) } -inline const ::google::protobuf::RepeatedPtrField<std::string>& -FileDescriptorProto::dependency() const ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline const ::google::protobuf::RepeatedPtrField<std::string>& FileDescriptorProto::dependency() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.dependency) return _internal_dependency(); } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL FileDescriptorProto::mutable_dependency() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.dependency) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12302,7 +12501,7 @@ FileDescriptorProto::_internal_dependency() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.dependency_; } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_dependency() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.dependency_; @@ -12337,7 +12536,7 @@ inline const ::google::protobuf::RepeatedField<::int32_t>& FileDescriptorProto:: // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency) return _internal_public_dependency(); } -inline ::google::protobuf::RepeatedField<::int32_t>* FileDescriptorProto::mutable_public_dependency() +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL FileDescriptorProto::mutable_public_dependency() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12348,7 +12547,8 @@ FileDescriptorProto::_internal_public_dependency() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.public_dependency_; } -inline ::google::protobuf::RepeatedField<::int32_t>* FileDescriptorProto::_internal_mutable_public_dependency() { +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL +FileDescriptorProto::_internal_mutable_public_dependency() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.public_dependency_; } @@ -12382,7 +12582,7 @@ inline const ::google::protobuf::RepeatedField<::int32_t>& FileDescriptorProto:: // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency) return _internal_weak_dependency(); } -inline ::google::protobuf::RepeatedField<::int32_t>* FileDescriptorProto::mutable_weak_dependency() +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL FileDescriptorProto::mutable_weak_dependency() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12393,7 +12593,8 @@ FileDescriptorProto::_internal_weak_dependency() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.weak_dependency_; } -inline ::google::protobuf::RepeatedField<::int32_t>* FileDescriptorProto::_internal_mutable_weak_dependency() { +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL +FileDescriptorProto::_internal_mutable_weak_dependency() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.weak_dependency_; } @@ -12409,12 +12610,12 @@ inline void FileDescriptorProto::clear_message_type() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.message_type_.Clear(); } -inline ::google::protobuf::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) +inline ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::mutable_message_type(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.message_type) return _internal_mutable_message_type()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* FileDescriptorProto::mutable_message_type() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::mutable_message_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12425,7 +12626,8 @@ inline const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_t // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type) return _internal_message_type().Get(index); } -inline ::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_message_type() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::DescriptorProto* _add = _internal_mutable_message_type()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type) @@ -12441,7 +12643,7 @@ FileDescriptorProto::_internal_message_type() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.message_type_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_message_type() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.message_type_; @@ -12458,12 +12660,12 @@ inline void FileDescriptorProto::clear_enum_type() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.enum_type_.Clear(); } -inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) +inline ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::mutable_enum_type(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.enum_type) return _internal_mutable_enum_type()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* FileDescriptorProto::mutable_enum_type() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::mutable_enum_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12474,7 +12676,8 @@ inline const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type) return _internal_enum_type().Get(index); } -inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_enum_type() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::EnumDescriptorProto* _add = _internal_mutable_enum_type()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type) @@ -12490,7 +12693,7 @@ FileDescriptorProto::_internal_enum_type() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.enum_type_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_enum_type() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.enum_type_; @@ -12507,12 +12710,12 @@ inline void FileDescriptorProto::clear_service() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.service_.Clear(); } -inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) +inline ::google::protobuf::ServiceDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::mutable_service(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.service) return _internal_mutable_service()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* FileDescriptorProto::mutable_service() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::mutable_service() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12523,7 +12726,8 @@ inline const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::se // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service) return _internal_service().Get(index); } -inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::ServiceDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_service() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::ServiceDescriptorProto* _add = _internal_mutable_service()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service) @@ -12539,7 +12743,7 @@ FileDescriptorProto::_internal_service() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.service_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ServiceDescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_service() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.service_; @@ -12556,12 +12760,12 @@ inline void FileDescriptorProto::clear_extension() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.extension_.Clear(); } -inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) +inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::mutable_extension(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.extension) return _internal_mutable_extension()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* FileDescriptorProto::mutable_extension() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::mutable_extension() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -12572,7 +12776,8 @@ inline const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::exte // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension) return _internal_extension().Get(index); } -inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL FileDescriptorProto::add_extension() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_extension()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension) @@ -12588,7 +12793,7 @@ FileDescriptorProto::_internal_extension() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.extension_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_extension() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.extension_; @@ -12614,7 +12819,8 @@ inline const ::google::protobuf::FileOptions& FileDescriptorProto::options() con // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options) return _internal_options(); } -inline void FileDescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::FileOptions* value) { +inline void FileDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::FileOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -12627,7 +12833,7 @@ inline void FileDescriptorProto::unsafe_arena_set_allocated_options(::google::pr } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.options) } -inline ::google::protobuf::FileOptions* FileDescriptorProto::release_options() { +inline ::google::protobuf::FileOptions* PROTOBUF_NULLABLE FileDescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000008u; @@ -12646,7 +12852,7 @@ inline ::google::protobuf::FileOptions* FileDescriptorProto::release_options() { } return released; } -inline ::google::protobuf::FileOptions* FileDescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::FileOptions* PROTOBUF_NULLABLE FileDescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options) @@ -12655,7 +12861,7 @@ inline ::google::protobuf::FileOptions* FileDescriptorProto::unsafe_arena_releas _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::FileOptions* FileDescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::FileOptions* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FileOptions>(GetArena()); @@ -12663,21 +12869,22 @@ inline ::google::protobuf::FileOptions* FileDescriptorProto::_internal_mutable_o } return _impl_.options_; } -inline ::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FileOptions* PROTOBUF_NONNULL FileDescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000008u; ::google::protobuf::FileOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) return _msg; } -inline void FileDescriptorProto::set_allocated_options(::google::protobuf::FileOptions* value) { +inline void FileDescriptorProto::set_allocated_options(::google::protobuf::FileOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -12710,7 +12917,8 @@ inline const ::google::protobuf::SourceCodeInfo& FileDescriptorProto::source_cod // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info) return _internal_source_code_info(); } -inline void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* value) { +inline void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info( + ::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.source_code_info_); @@ -12723,7 +12931,7 @@ inline void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info(::g } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.source_code_info) } -inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { +inline ::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE FileDescriptorProto::release_source_code_info() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000010u; @@ -12742,7 +12950,7 @@ inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::release_source_c } return released; } -inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::unsafe_arena_release_source_code_info() { +inline ::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE FileDescriptorProto::unsafe_arena_release_source_code_info() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info) @@ -12751,7 +12959,7 @@ inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::unsafe_arena_rel _impl_.source_code_info_ = nullptr; return temp; } -inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::_internal_mutable_source_code_info() { +inline ::google::protobuf::SourceCodeInfo* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_source_code_info() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_code_info_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::SourceCodeInfo>(GetArena()); @@ -12759,21 +12967,22 @@ inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::_internal_mutabl } return _impl_.source_code_info_; } -inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::SourceCodeInfo* PROTOBUF_NONNULL FileDescriptorProto::mutable_source_code_info() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000010u; ::google::protobuf::SourceCodeInfo* _msg = _internal_mutable_source_code_info(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) return _msg; } -inline void FileDescriptorProto::set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* value) { +inline void FileDescriptorProto::set_allocated_source_code_info(::google::protobuf::SourceCodeInfo* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.source_code_info_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.source_code_info_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -12802,14 +13011,14 @@ inline const std::string& FileDescriptorProto::syntax() const return _internal_syntax(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileDescriptorProto::set_syntax(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileDescriptorProto::set_syntax(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; _impl_.syntax_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax) } -inline std::string* FileDescriptorProto::mutable_syntax() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::mutable_syntax() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_syntax(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax) return _s; @@ -12823,12 +13032,12 @@ inline void FileDescriptorProto::_internal_set_syntax(const std::string& value) _impl_._has_bits_[0] |= 0x00000004u; _impl_.syntax_.Set(value, GetArena()); } -inline std::string* FileDescriptorProto::_internal_mutable_syntax() { +inline std::string* PROTOBUF_NONNULL FileDescriptorProto::_internal_mutable_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; return _impl_.syntax_.Mutable( GetArena()); } -inline std::string* FileDescriptorProto::release_syntax() { +inline std::string* PROTOBUF_NULLABLE FileDescriptorProto::release_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax) if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { @@ -12841,7 +13050,7 @@ inline std::string* FileDescriptorProto::release_syntax() { } return released; } -inline void FileDescriptorProto::set_allocated_syntax(std::string* value) { +inline void FileDescriptorProto::set_allocated_syntax(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000004u; @@ -12880,8 +13089,10 @@ inline ::google::protobuf::Edition FileDescriptorProto::_internal_edition() cons } inline void FileDescriptorProto::_internal_set_edition(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.edition_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.edition_ = value; } // ------------------------------------------------------------------- @@ -12964,7 +13175,8 @@ inline const ::google::protobuf::ExtensionRangeOptions& DescriptorProto_Extensio // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.options) return _internal_options(); } -inline void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options(::google::protobuf::ExtensionRangeOptions* value) { +inline void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options( + ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -12977,7 +13189,7 @@ inline void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options(: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options) } -inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() { +inline ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE DescriptorProto_ExtensionRange::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -12996,7 +13208,7 @@ inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange } return released; } -inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::unsafe_arena_release_options() { +inline ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE DescriptorProto_ExtensionRange::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options) @@ -13005,7 +13217,7 @@ inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::_internal_mutable_options() { +inline ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NONNULL DescriptorProto_ExtensionRange::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::ExtensionRangeOptions>(GetArena()); @@ -13013,21 +13225,22 @@ inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange } return _impl_.options_; } -inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::ExtensionRangeOptions* PROTOBUF_NONNULL DescriptorProto_ExtensionRange::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::ExtensionRangeOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options) return _msg; } -inline void DescriptorProto_ExtensionRange::set_allocated_options(::google::protobuf::ExtensionRangeOptions* value) { +inline void DescriptorProto_ExtensionRange::set_allocated_options(::google::protobuf::ExtensionRangeOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -13120,14 +13333,14 @@ inline const std::string& DescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void DescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void DescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name) } -inline std::string* DescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL DescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name) return _s; @@ -13141,12 +13354,12 @@ inline void DescriptorProto::_internal_set_name(const std::string& value) { _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* DescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* DescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE DescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -13159,7 +13372,7 @@ inline std::string* DescriptorProto::release_name() { } return released; } -inline void DescriptorProto::set_allocated_name(std::string* value) { +inline void DescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -13184,12 +13397,12 @@ inline void DescriptorProto::clear_field() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.field_.Clear(); } -inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_field(int index) +inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL DescriptorProto::mutable_field(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.field) return _internal_mutable_field()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* DescriptorProto::mutable_field() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::mutable_field() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13200,7 +13413,8 @@ inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(in // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field) return _internal_field().Get(index); } -inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_field() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_field()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field) @@ -13216,7 +13430,7 @@ DescriptorProto::_internal_field() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.field_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_field() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.field_; @@ -13233,12 +13447,12 @@ inline void DescriptorProto::clear_extension() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.extension_.Clear(); } -inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) +inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL DescriptorProto::mutable_extension(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension) return _internal_mutable_extension()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* DescriptorProto::mutable_extension() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::mutable_extension() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13249,7 +13463,8 @@ inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extensio // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension) return _internal_extension().Get(index); } -inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FieldDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_extension() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FieldDescriptorProto* _add = _internal_mutable_extension()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension) @@ -13265,7 +13480,7 @@ DescriptorProto::_internal_extension() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.extension_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_extension() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.extension_; @@ -13282,12 +13497,12 @@ inline void DescriptorProto::clear_nested_type() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.nested_type_.Clear(); } -inline ::google::protobuf::DescriptorProto* DescriptorProto::mutable_nested_type(int index) +inline ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL DescriptorProto::mutable_nested_type(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.nested_type) return _internal_mutable_nested_type()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* DescriptorProto::mutable_nested_type() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL DescriptorProto::mutable_nested_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13298,7 +13513,8 @@ inline const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(i // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type) return _internal_nested_type().Get(index); } -inline ::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::DescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_nested_type() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::DescriptorProto* _add = _internal_mutable_nested_type()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type) @@ -13314,7 +13530,7 @@ DescriptorProto::_internal_nested_type() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.nested_type_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_nested_type() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.nested_type_; @@ -13331,12 +13547,12 @@ inline void DescriptorProto::clear_enum_type() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.enum_type_.Clear(); } -inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) +inline ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL DescriptorProto::mutable_enum_type(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.enum_type) return _internal_mutable_enum_type()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* DescriptorProto::mutable_enum_type() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::mutable_enum_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13347,7 +13563,8 @@ inline const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type) return _internal_enum_type().Get(index); } -inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::EnumDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_enum_type() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::EnumDescriptorProto* _add = _internal_mutable_enum_type()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type) @@ -13363,7 +13580,7 @@ DescriptorProto::_internal_enum_type() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.enum_type_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_enum_type() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.enum_type_; @@ -13380,12 +13597,12 @@ inline void DescriptorProto::clear_extension_range() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.extension_range_.Clear(); } -inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) +inline ::google::protobuf::DescriptorProto_ExtensionRange* PROTOBUF_NONNULL DescriptorProto::mutable_extension_range(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension_range) return _internal_mutable_extension_range()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* DescriptorProto::mutable_extension_range() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* PROTOBUF_NONNULL DescriptorProto::mutable_extension_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension_range) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13396,7 +13613,8 @@ inline const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range) return _internal_extension_range().Get(index); } -inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::DescriptorProto_ExtensionRange* PROTOBUF_NONNULL DescriptorProto::add_extension_range() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::DescriptorProto_ExtensionRange* _add = _internal_mutable_extension_range()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range) @@ -13412,7 +13630,7 @@ DescriptorProto::_internal_extension_range() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.extension_range_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ExtensionRange>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_extension_range() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.extension_range_; @@ -13429,12 +13647,12 @@ inline void DescriptorProto::clear_oneof_decl() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.oneof_decl_.Clear(); } -inline ::google::protobuf::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) +inline ::google::protobuf::OneofDescriptorProto* PROTOBUF_NONNULL DescriptorProto::mutable_oneof_decl(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.oneof_decl) return _internal_mutable_oneof_decl()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* DescriptorProto::mutable_oneof_decl() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::mutable_oneof_decl() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13445,7 +13663,8 @@ inline const ::google::protobuf::OneofDescriptorProto& DescriptorProto::oneof_de // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl) return _internal_oneof_decl().Get(index); } -inline ::google::protobuf::OneofDescriptorProto* DescriptorProto::add_oneof_decl() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::OneofDescriptorProto* PROTOBUF_NONNULL DescriptorProto::add_oneof_decl() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::OneofDescriptorProto* _add = _internal_mutable_oneof_decl()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl) @@ -13461,7 +13680,7 @@ DescriptorProto::_internal_oneof_decl() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.oneof_decl_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::OneofDescriptorProto>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_oneof_decl() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.oneof_decl_; @@ -13487,7 +13706,8 @@ inline const ::google::protobuf::MessageOptions& DescriptorProto::options() cons // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options) return _internal_options(); } -inline void DescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::MessageOptions* value) { +inline void DescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::MessageOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -13500,7 +13720,7 @@ inline void DescriptorProto::unsafe_arena_set_allocated_options(::google::protob } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.options) } -inline ::google::protobuf::MessageOptions* DescriptorProto::release_options() { +inline ::google::protobuf::MessageOptions* PROTOBUF_NULLABLE DescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -13519,7 +13739,7 @@ inline ::google::protobuf::MessageOptions* DescriptorProto::release_options() { } return released; } -inline ::google::protobuf::MessageOptions* DescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::MessageOptions* PROTOBUF_NULLABLE DescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options) @@ -13528,7 +13748,7 @@ inline ::google::protobuf::MessageOptions* DescriptorProto::unsafe_arena_release _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::MessageOptions* DescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::MessageOptions* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::MessageOptions>(GetArena()); @@ -13536,21 +13756,22 @@ inline ::google::protobuf::MessageOptions* DescriptorProto::_internal_mutable_op } return _impl_.options_; } -inline ::google::protobuf::MessageOptions* DescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::MessageOptions* PROTOBUF_NONNULL DescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::MessageOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) return _msg; } -inline void DescriptorProto::set_allocated_options(::google::protobuf::MessageOptions* value) { +inline void DescriptorProto::set_allocated_options(::google::protobuf::MessageOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -13574,12 +13795,12 @@ inline void DescriptorProto::clear_reserved_range() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.reserved_range_.Clear(); } -inline ::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::mutable_reserved_range(int index) +inline ::google::protobuf::DescriptorProto_ReservedRange* PROTOBUF_NONNULL DescriptorProto::mutable_reserved_range(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_range) return _internal_mutable_reserved_range()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* DescriptorProto::mutable_reserved_range() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* PROTOBUF_NONNULL DescriptorProto::mutable_reserved_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_range) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13590,7 +13811,8 @@ inline const ::google::protobuf::DescriptorProto_ReservedRange& DescriptorProto: // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_range) return _internal_reserved_range().Get(index); } -inline ::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::DescriptorProto_ReservedRange* PROTOBUF_NONNULL DescriptorProto::add_reserved_range() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::DescriptorProto_ReservedRange* _add = _internal_mutable_reserved_range()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range) @@ -13606,7 +13828,7 @@ DescriptorProto::_internal_reserved_range() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.reserved_range_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::DescriptorProto_ReservedRange>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_reserved_range() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.reserved_range_; @@ -13623,7 +13845,8 @@ inline void DescriptorProto::clear_reserved_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.reserved_name_.Clear(); } -inline std::string* DescriptorProto::add_reserved_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL DescriptorProto::add_reserved_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); std::string* _s = _internal_mutable_reserved_name()->Add(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name) @@ -13634,16 +13857,15 @@ inline const std::string& DescriptorProto::reserved_name(int index) const // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_name) return _internal_reserved_name().Get(index); } -inline std::string* DescriptorProto::mutable_reserved_name(int index) +inline std::string* PROTOBUF_NONNULL DescriptorProto::mutable_reserved_name(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_name) return _internal_mutable_reserved_name()->Mutable(index); } template <typename Arg_, typename... Args_> inline void DescriptorProto::set_reserved_name(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString( - *_internal_mutable_reserved_name()->Mutable(index), - std::forward<Arg_>(value), args... ); + ::google::protobuf::internal::AssignToString(*_internal_mutable_reserved_name()->Mutable(index), std::forward<Arg_>(value), + args... ); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name) } template <typename Arg_, typename... Args_> @@ -13654,12 +13876,12 @@ inline void DescriptorProto::add_reserved_name(Arg_&& value, Args_... args) { args... ); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name) } -inline const ::google::protobuf::RepeatedPtrField<std::string>& -DescriptorProto::reserved_name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline const ::google::protobuf::RepeatedPtrField<std::string>& DescriptorProto::reserved_name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_name) return _internal_reserved_name(); } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL DescriptorProto::mutable_reserved_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_name) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13670,7 +13892,7 @@ DescriptorProto::_internal_reserved_name() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.reserved_name_; } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL DescriptorProto::_internal_mutable_reserved_name() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.reserved_name_; @@ -13724,14 +13946,14 @@ inline const std::string& ExtensionRangeOptions_Declaration::full_name() const return _internal_full_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void ExtensionRangeOptions_Declaration::set_full_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void ExtensionRangeOptions_Declaration::set_full_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.full_name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.ExtensionRangeOptions.Declaration.full_name) } -inline std::string* ExtensionRangeOptions_Declaration::mutable_full_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::mutable_full_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_full_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.Declaration.full_name) return _s; @@ -13745,12 +13967,12 @@ inline void ExtensionRangeOptions_Declaration::_internal_set_full_name(const std _impl_._has_bits_[0] |= 0x00000001u; _impl_.full_name_.Set(value, GetArena()); } -inline std::string* ExtensionRangeOptions_Declaration::_internal_mutable_full_name() { +inline std::string* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::_internal_mutable_full_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.full_name_.Mutable( GetArena()); } -inline std::string* ExtensionRangeOptions_Declaration::release_full_name() { +inline std::string* PROTOBUF_NULLABLE ExtensionRangeOptions_Declaration::release_full_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.ExtensionRangeOptions.Declaration.full_name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -13763,7 +13985,7 @@ inline std::string* ExtensionRangeOptions_Declaration::release_full_name() { } return released; } -inline void ExtensionRangeOptions_Declaration::set_allocated_full_name(std::string* value) { +inline void ExtensionRangeOptions_Declaration::set_allocated_full_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -13793,14 +14015,14 @@ inline const std::string& ExtensionRangeOptions_Declaration::type() const return _internal_type(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void ExtensionRangeOptions_Declaration::set_type(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void ExtensionRangeOptions_Declaration::set_type(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.type_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.ExtensionRangeOptions.Declaration.type) } -inline std::string* ExtensionRangeOptions_Declaration::mutable_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::mutable_type() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_type(); // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.Declaration.type) return _s; @@ -13814,12 +14036,12 @@ inline void ExtensionRangeOptions_Declaration::_internal_set_type(const std::str _impl_._has_bits_[0] |= 0x00000002u; _impl_.type_.Set(value, GetArena()); } -inline std::string* ExtensionRangeOptions_Declaration::_internal_mutable_type() { +inline std::string* PROTOBUF_NONNULL ExtensionRangeOptions_Declaration::_internal_mutable_type() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.type_.Mutable( GetArena()); } -inline std::string* ExtensionRangeOptions_Declaration::release_type() { +inline std::string* PROTOBUF_NULLABLE ExtensionRangeOptions_Declaration::release_type() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.ExtensionRangeOptions.Declaration.type) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -13832,7 +14054,7 @@ inline std::string* ExtensionRangeOptions_Declaration::release_type() { } return released; } -inline void ExtensionRangeOptions_Declaration::set_allocated_type(std::string* value) { +inline void ExtensionRangeOptions_Declaration::set_allocated_type(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -13917,12 +14139,12 @@ inline void ExtensionRangeOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* ExtensionRangeOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL ExtensionRangeOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* ExtensionRangeOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL ExtensionRangeOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13933,7 +14155,8 @@ inline const ::google::protobuf::UninterpretedOption& ExtensionRangeOptions::uni // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL ExtensionRangeOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option) @@ -13949,7 +14172,7 @@ ExtensionRangeOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL ExtensionRangeOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -13966,12 +14189,12 @@ inline void ExtensionRangeOptions::clear_declaration() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.declaration_.Clear(); } -inline ::google::protobuf::ExtensionRangeOptions_Declaration* ExtensionRangeOptions::mutable_declaration(int index) +inline ::google::protobuf::ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL ExtensionRangeOptions::mutable_declaration(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.declaration) return _internal_mutable_declaration()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* ExtensionRangeOptions::mutable_declaration() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* PROTOBUF_NONNULL ExtensionRangeOptions::mutable_declaration() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ExtensionRangeOptions.declaration) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -13982,7 +14205,8 @@ inline const ::google::protobuf::ExtensionRangeOptions_Declaration& ExtensionRan // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.declaration) return _internal_declaration().Get(index); } -inline ::google::protobuf::ExtensionRangeOptions_Declaration* ExtensionRangeOptions::add_declaration() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::ExtensionRangeOptions_Declaration* PROTOBUF_NONNULL ExtensionRangeOptions::add_declaration() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::ExtensionRangeOptions_Declaration* _add = _internal_mutable_declaration()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.declaration) @@ -13998,7 +14222,7 @@ ExtensionRangeOptions::_internal_declaration() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.declaration_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::ExtensionRangeOptions_Declaration>* PROTOBUF_NONNULL ExtensionRangeOptions::_internal_mutable_declaration() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.declaration_; @@ -14024,7 +14248,8 @@ inline const ::google::protobuf::FeatureSet& ExtensionRangeOptions::features() c // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.features) return _internal_features(); } -inline void ExtensionRangeOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void ExtensionRangeOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -14037,7 +14262,7 @@ inline void ExtensionRangeOptions::unsafe_arena_set_allocated_features(::google: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ExtensionRangeOptions.features) } -inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE ExtensionRangeOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -14056,7 +14281,7 @@ inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::release_features() } return released; } -inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE ExtensionRangeOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.ExtensionRangeOptions.features) @@ -14065,7 +14290,7 @@ inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::unsafe_arena_relea _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL ExtensionRangeOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -14073,21 +14298,22 @@ inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::_internal_mutable_ } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* ExtensionRangeOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL ExtensionRangeOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.features) return _msg; } -inline void ExtensionRangeOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void ExtensionRangeOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -14125,8 +14351,10 @@ inline ::google::protobuf::ExtensionRangeOptions_VerificationState ExtensionRang } inline void ExtensionRangeOptions::_internal_set_verification(::google::protobuf::ExtensionRangeOptions_VerificationState value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::ExtensionRangeOptions_VerificationState_IsValid(value)); - _impl_.verification_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::ExtensionRangeOptions_VerificationState_internal_data_)); + _impl_.verification_ = value; } // ------------------------------------------------------------------- @@ -14149,14 +14377,14 @@ inline const std::string& FieldDescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name) } -inline std::string* FieldDescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name) return _s; @@ -14170,12 +14398,12 @@ inline void FieldDescriptorProto::_internal_set_name(const std::string& value) { _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* FieldDescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* FieldDescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE FieldDescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -14188,7 +14416,7 @@ inline std::string* FieldDescriptorProto::release_name() { } return released; } -inline void FieldDescriptorProto::set_allocated_name(std::string* value) { +inline void FieldDescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -14255,8 +14483,10 @@ inline ::google::protobuf::FieldDescriptorProto_Label FieldDescriptorProto::_int } inline void FieldDescriptorProto::_internal_set_label(::google::protobuf::FieldDescriptorProto_Label value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FieldDescriptorProto_Label_IsValid(value)); - _impl_.label_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FieldDescriptorProto_Label_internal_data_)); + _impl_.label_ = value; } // optional .google.protobuf.FieldDescriptorProto.Type type = 5; @@ -14284,8 +14514,10 @@ inline ::google::protobuf::FieldDescriptorProto_Type FieldDescriptorProto::_inte } inline void FieldDescriptorProto::_internal_set_type(::google::protobuf::FieldDescriptorProto_Type value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FieldDescriptorProto_Type_IsValid(value)); - _impl_.type_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FieldDescriptorProto_Type_internal_data_)); + _impl_.type_ = value; } // optional string type_name = 6; @@ -14304,14 +14536,14 @@ inline const std::string& FieldDescriptorProto::type_name() const return _internal_type_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_type_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_type_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; _impl_.type_name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name) } -inline std::string* FieldDescriptorProto::mutable_type_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::mutable_type_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_type_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name) return _s; @@ -14325,12 +14557,12 @@ inline void FieldDescriptorProto::_internal_set_type_name(const std::string& val _impl_._has_bits_[0] |= 0x00000004u; _impl_.type_name_.Set(value, GetArena()); } -inline std::string* FieldDescriptorProto::_internal_mutable_type_name() { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::_internal_mutable_type_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; return _impl_.type_name_.Mutable( GetArena()); } -inline std::string* FieldDescriptorProto::release_type_name() { +inline std::string* PROTOBUF_NULLABLE FieldDescriptorProto::release_type_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name) if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { @@ -14343,7 +14575,7 @@ inline std::string* FieldDescriptorProto::release_type_name() { } return released; } -inline void FieldDescriptorProto::set_allocated_type_name(std::string* value) { +inline void FieldDescriptorProto::set_allocated_type_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000004u; @@ -14373,14 +14605,14 @@ inline const std::string& FieldDescriptorProto::extendee() const return _internal_extendee(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_extendee(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_extendee(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.extendee_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee) } -inline std::string* FieldDescriptorProto::mutable_extendee() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::mutable_extendee() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_extendee(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee) return _s; @@ -14394,12 +14626,12 @@ inline void FieldDescriptorProto::_internal_set_extendee(const std::string& valu _impl_._has_bits_[0] |= 0x00000002u; _impl_.extendee_.Set(value, GetArena()); } -inline std::string* FieldDescriptorProto::_internal_mutable_extendee() { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::_internal_mutable_extendee() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.extendee_.Mutable( GetArena()); } -inline std::string* FieldDescriptorProto::release_extendee() { +inline std::string* PROTOBUF_NULLABLE FieldDescriptorProto::release_extendee() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -14412,7 +14644,7 @@ inline std::string* FieldDescriptorProto::release_extendee() { } return released; } -inline void FieldDescriptorProto::set_allocated_extendee(std::string* value) { +inline void FieldDescriptorProto::set_allocated_extendee(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -14442,14 +14674,14 @@ inline const std::string& FieldDescriptorProto::default_value() const return _internal_default_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_default_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_default_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000008u; _impl_.default_value_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value) } -inline std::string* FieldDescriptorProto::mutable_default_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::mutable_default_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_default_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value) return _s; @@ -14463,12 +14695,12 @@ inline void FieldDescriptorProto::_internal_set_default_value(const std::string& _impl_._has_bits_[0] |= 0x00000008u; _impl_.default_value_.Set(value, GetArena()); } -inline std::string* FieldDescriptorProto::_internal_mutable_default_value() { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::_internal_mutable_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000008u; return _impl_.default_value_.Mutable( GetArena()); } -inline std::string* FieldDescriptorProto::release_default_value() { +inline std::string* PROTOBUF_NULLABLE FieldDescriptorProto::release_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value) if ((_impl_._has_bits_[0] & 0x00000008u) == 0) { @@ -14481,7 +14713,7 @@ inline std::string* FieldDescriptorProto::release_default_value() { } return released; } -inline void FieldDescriptorProto::set_allocated_default_value(std::string* value) { +inline void FieldDescriptorProto::set_allocated_default_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000008u; @@ -14539,14 +14771,14 @@ inline const std::string& FieldDescriptorProto::json_name() const return _internal_json_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_json_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FieldDescriptorProto::set_json_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000010u; _impl_.json_name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name) } -inline std::string* FieldDescriptorProto::mutable_json_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::mutable_json_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_json_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name) return _s; @@ -14560,12 +14792,12 @@ inline void FieldDescriptorProto::_internal_set_json_name(const std::string& val _impl_._has_bits_[0] |= 0x00000010u; _impl_.json_name_.Set(value, GetArena()); } -inline std::string* FieldDescriptorProto::_internal_mutable_json_name() { +inline std::string* PROTOBUF_NONNULL FieldDescriptorProto::_internal_mutable_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000010u; return _impl_.json_name_.Mutable( GetArena()); } -inline std::string* FieldDescriptorProto::release_json_name() { +inline std::string* PROTOBUF_NULLABLE FieldDescriptorProto::release_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name) if ((_impl_._has_bits_[0] & 0x00000010u) == 0) { @@ -14578,7 +14810,7 @@ inline std::string* FieldDescriptorProto::release_json_name() { } return released; } -inline void FieldDescriptorProto::set_allocated_json_name(std::string* value) { +inline void FieldDescriptorProto::set_allocated_json_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000010u; @@ -14612,7 +14844,8 @@ inline const ::google::protobuf::FieldOptions& FieldDescriptorProto::options() c // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options) return _internal_options(); } -inline void FieldDescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::FieldOptions* value) { +inline void FieldDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::FieldOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -14625,7 +14858,7 @@ inline void FieldDescriptorProto::unsafe_arena_set_allocated_options(::google::p } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.options) } -inline ::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() { +inline ::google::protobuf::FieldOptions* PROTOBUF_NULLABLE FieldDescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000020u; @@ -14644,7 +14877,7 @@ inline ::google::protobuf::FieldOptions* FieldDescriptorProto::release_options() } return released; } -inline ::google::protobuf::FieldOptions* FieldDescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::FieldOptions* PROTOBUF_NULLABLE FieldDescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options) @@ -14653,7 +14886,7 @@ inline ::google::protobuf::FieldOptions* FieldDescriptorProto::unsafe_arena_rele _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::FieldOptions* FieldDescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::FieldOptions* PROTOBUF_NONNULL FieldDescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FieldOptions>(GetArena()); @@ -14661,21 +14894,22 @@ inline ::google::protobuf::FieldOptions* FieldDescriptorProto::_internal_mutable } return _impl_.options_; } -inline ::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FieldOptions* PROTOBUF_NONNULL FieldDescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000020u; ::google::protobuf::FieldOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) return _msg; } -inline void FieldDescriptorProto::set_allocated_options(::google::protobuf::FieldOptions* value) { +inline void FieldDescriptorProto::set_allocated_options(::google::protobuf::FieldOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -14736,14 +14970,14 @@ inline const std::string& OneofDescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void OneofDescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void OneofDescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name) } -inline std::string* OneofDescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL OneofDescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name) return _s; @@ -14757,12 +14991,12 @@ inline void OneofDescriptorProto::_internal_set_name(const std::string& value) { _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* OneofDescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL OneofDescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* OneofDescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE OneofDescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -14775,7 +15009,7 @@ inline std::string* OneofDescriptorProto::release_name() { } return released; } -inline void OneofDescriptorProto::set_allocated_name(std::string* value) { +inline void OneofDescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -14809,7 +15043,8 @@ inline const ::google::protobuf::OneofOptions& OneofDescriptorProto::options() c // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options) return _internal_options(); } -inline void OneofDescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::OneofOptions* value) { +inline void OneofDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::OneofOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -14822,7 +15057,7 @@ inline void OneofDescriptorProto::unsafe_arena_set_allocated_options(::google::p } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofDescriptorProto.options) } -inline ::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() { +inline ::google::protobuf::OneofOptions* PROTOBUF_NULLABLE OneofDescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -14841,7 +15076,7 @@ inline ::google::protobuf::OneofOptions* OneofDescriptorProto::release_options() } return released; } -inline ::google::protobuf::OneofOptions* OneofDescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::OneofOptions* PROTOBUF_NULLABLE OneofDescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options) @@ -14850,7 +15085,7 @@ inline ::google::protobuf::OneofOptions* OneofDescriptorProto::unsafe_arena_rele _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::OneofOptions* OneofDescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::OneofOptions* PROTOBUF_NONNULL OneofDescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::OneofOptions>(GetArena()); @@ -14858,21 +15093,22 @@ inline ::google::protobuf::OneofOptions* OneofDescriptorProto::_internal_mutable } return _impl_.options_; } -inline ::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::OneofOptions* PROTOBUF_NONNULL OneofDescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::OneofOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options) return _msg; } -inline void OneofDescriptorProto::set_allocated_options(::google::protobuf::OneofOptions* value) { +inline void OneofDescriptorProto::set_allocated_options(::google::protobuf::OneofOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -14965,14 +15201,14 @@ inline const std::string& EnumDescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void EnumDescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void EnumDescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name) } -inline std::string* EnumDescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL EnumDescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name) return _s; @@ -14986,12 +15222,12 @@ inline void EnumDescriptorProto::_internal_set_name(const std::string& value) { _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* EnumDescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL EnumDescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* EnumDescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE EnumDescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -15004,7 +15240,7 @@ inline std::string* EnumDescriptorProto::release_name() { } return released; } -inline void EnumDescriptorProto::set_allocated_name(std::string* value) { +inline void EnumDescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -15029,12 +15265,12 @@ inline void EnumDescriptorProto::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_.Clear(); } -inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) +inline ::google::protobuf::EnumValueDescriptorProto* PROTOBUF_NONNULL EnumDescriptorProto::mutable_value(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.value) return _internal_mutable_value()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* EnumDescriptorProto::mutable_value() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* PROTOBUF_NONNULL EnumDescriptorProto::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -15045,7 +15281,8 @@ inline const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto:: // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value) return _internal_value().Get(index); } -inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::EnumValueDescriptorProto* PROTOBUF_NONNULL EnumDescriptorProto::add_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::EnumValueDescriptorProto* _add = _internal_mutable_value()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value) @@ -15061,7 +15298,7 @@ EnumDescriptorProto::_internal_value() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.value_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValueDescriptorProto>* PROTOBUF_NONNULL EnumDescriptorProto::_internal_mutable_value() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.value_; @@ -15087,7 +15324,8 @@ inline const ::google::protobuf::EnumOptions& EnumDescriptorProto::options() con // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options) return _internal_options(); } -inline void EnumDescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::EnumOptions* value) { +inline void EnumDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::EnumOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -15100,7 +15338,7 @@ inline void EnumDescriptorProto::unsafe_arena_set_allocated_options(::google::pr } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumDescriptorProto.options) } -inline ::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() { +inline ::google::protobuf::EnumOptions* PROTOBUF_NULLABLE EnumDescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -15119,7 +15357,7 @@ inline ::google::protobuf::EnumOptions* EnumDescriptorProto::release_options() { } return released; } -inline ::google::protobuf::EnumOptions* EnumDescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::EnumOptions* PROTOBUF_NULLABLE EnumDescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options) @@ -15128,7 +15366,7 @@ inline ::google::protobuf::EnumOptions* EnumDescriptorProto::unsafe_arena_releas _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::EnumOptions* EnumDescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::EnumOptions* PROTOBUF_NONNULL EnumDescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::EnumOptions>(GetArena()); @@ -15136,21 +15374,22 @@ inline ::google::protobuf::EnumOptions* EnumDescriptorProto::_internal_mutable_o } return _impl_.options_; } -inline ::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::EnumOptions* PROTOBUF_NONNULL EnumDescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::EnumOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) return _msg; } -inline void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumOptions* value) { +inline void EnumDescriptorProto::set_allocated_options(::google::protobuf::EnumOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -15174,12 +15413,12 @@ inline void EnumDescriptorProto::clear_reserved_range() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.reserved_range_.Clear(); } -inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::mutable_reserved_range(int index) +inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL EnumDescriptorProto::mutable_reserved_range(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_range) return _internal_mutable_reserved_range()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* EnumDescriptorProto::mutable_reserved_range() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* PROTOBUF_NONNULL EnumDescriptorProto::mutable_reserved_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_range) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -15190,7 +15429,8 @@ inline const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& EnumDesc // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_range) return _internal_reserved_range().Get(index); } -inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::add_reserved_range() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* PROTOBUF_NONNULL EnumDescriptorProto::add_reserved_range() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::EnumDescriptorProto_EnumReservedRange* _add = _internal_mutable_reserved_range()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_range) @@ -15206,7 +15446,7 @@ EnumDescriptorProto::_internal_reserved_range() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.reserved_range_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumDescriptorProto_EnumReservedRange>* PROTOBUF_NONNULL EnumDescriptorProto::_internal_mutable_reserved_range() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.reserved_range_; @@ -15223,7 +15463,8 @@ inline void EnumDescriptorProto::clear_reserved_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.reserved_name_.Clear(); } -inline std::string* EnumDescriptorProto::add_reserved_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL EnumDescriptorProto::add_reserved_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); std::string* _s = _internal_mutable_reserved_name()->Add(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.EnumDescriptorProto.reserved_name) @@ -15234,16 +15475,15 @@ inline const std::string& EnumDescriptorProto::reserved_name(int index) const // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_name) return _internal_reserved_name().Get(index); } -inline std::string* EnumDescriptorProto::mutable_reserved_name(int index) +inline std::string* PROTOBUF_NONNULL EnumDescriptorProto::mutable_reserved_name(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_name) return _internal_mutable_reserved_name()->Mutable(index); } template <typename Arg_, typename... Args_> inline void EnumDescriptorProto::set_reserved_name(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString( - *_internal_mutable_reserved_name()->Mutable(index), - std::forward<Arg_>(value), args... ); + ::google::protobuf::internal::AssignToString(*_internal_mutable_reserved_name()->Mutable(index), std::forward<Arg_>(value), + args... ); // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.reserved_name) } template <typename Arg_, typename... Args_> @@ -15254,12 +15494,12 @@ inline void EnumDescriptorProto::add_reserved_name(Arg_&& value, Args_... args) args... ); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_name) } -inline const ::google::protobuf::RepeatedPtrField<std::string>& -EnumDescriptorProto::reserved_name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline const ::google::protobuf::RepeatedPtrField<std::string>& EnumDescriptorProto::reserved_name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.reserved_name) return _internal_reserved_name(); } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL EnumDescriptorProto::mutable_reserved_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_name) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -15270,7 +15510,7 @@ EnumDescriptorProto::_internal_reserved_name() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.reserved_name_; } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL EnumDescriptorProto::_internal_mutable_reserved_name() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.reserved_name_; @@ -15296,14 +15536,14 @@ inline const std::string& EnumValueDescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void EnumValueDescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void EnumValueDescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name) } -inline std::string* EnumValueDescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL EnumValueDescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name) return _s; @@ -15317,12 +15557,12 @@ inline void EnumValueDescriptorProto::_internal_set_name(const std::string& valu _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* EnumValueDescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL EnumValueDescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* EnumValueDescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE EnumValueDescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -15335,7 +15575,7 @@ inline std::string* EnumValueDescriptorProto::release_name() { } return released; } -inline void EnumValueDescriptorProto::set_allocated_name(std::string* value) { +inline void EnumValueDescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -15397,7 +15637,8 @@ inline const ::google::protobuf::EnumValueOptions& EnumValueDescriptorProto::opt // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options) return _internal_options(); } -inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::EnumValueOptions* value) { +inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -15410,7 +15651,7 @@ inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_options(::googl } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueDescriptorProto.options) } -inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_options() { +inline ::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE EnumValueDescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -15429,7 +15670,7 @@ inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::release_o } return released; } -inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE EnumValueDescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options) @@ -15438,7 +15679,7 @@ inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::unsafe_ar _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::EnumValueOptions* PROTOBUF_NONNULL EnumValueDescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::EnumValueOptions>(GetArena()); @@ -15446,21 +15687,22 @@ inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::_internal } return _impl_.options_; } -inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::EnumValueOptions* PROTOBUF_NONNULL EnumValueDescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::EnumValueOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) return _msg; } -inline void EnumValueDescriptorProto::set_allocated_options(::google::protobuf::EnumValueOptions* value) { +inline void EnumValueDescriptorProto::set_allocated_options(::google::protobuf::EnumValueOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -15493,14 +15735,14 @@ inline const std::string& ServiceDescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void ServiceDescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void ServiceDescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name) } -inline std::string* ServiceDescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL ServiceDescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name) return _s; @@ -15514,12 +15756,12 @@ inline void ServiceDescriptorProto::_internal_set_name(const std::string& value) _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* ServiceDescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL ServiceDescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* ServiceDescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE ServiceDescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -15532,7 +15774,7 @@ inline std::string* ServiceDescriptorProto::release_name() { } return released; } -inline void ServiceDescriptorProto::set_allocated_name(std::string* value) { +inline void ServiceDescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -15557,12 +15799,12 @@ inline void ServiceDescriptorProto::clear_method() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.method_.Clear(); } -inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) +inline ::google::protobuf::MethodDescriptorProto* PROTOBUF_NONNULL ServiceDescriptorProto::mutable_method(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.method) return _internal_mutable_method()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* ServiceDescriptorProto::mutable_method() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* PROTOBUF_NONNULL ServiceDescriptorProto::mutable_method() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -15573,7 +15815,8 @@ inline const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto:: // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method) return _internal_method().Get(index); } -inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::MethodDescriptorProto* PROTOBUF_NONNULL ServiceDescriptorProto::add_method() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::MethodDescriptorProto* _add = _internal_mutable_method()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method) @@ -15589,7 +15832,7 @@ ServiceDescriptorProto::_internal_method() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.method_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::MethodDescriptorProto>* PROTOBUF_NONNULL ServiceDescriptorProto::_internal_mutable_method() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.method_; @@ -15615,7 +15858,8 @@ inline const ::google::protobuf::ServiceOptions& ServiceDescriptorProto::options // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options) return _internal_options(); } -inline void ServiceDescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::ServiceOptions* value) { +inline void ServiceDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -15628,7 +15872,7 @@ inline void ServiceDescriptorProto::unsafe_arena_set_allocated_options(::google: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceDescriptorProto.options) } -inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_options() { +inline ::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE ServiceDescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -15647,7 +15891,7 @@ inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::release_optio } return released; } -inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE ServiceDescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options) @@ -15656,7 +15900,7 @@ inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::unsafe_arena_ _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::ServiceOptions* PROTOBUF_NONNULL ServiceDescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::ServiceOptions>(GetArena()); @@ -15664,21 +15908,22 @@ inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::_internal_mut } return _impl_.options_; } -inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::ServiceOptions* PROTOBUF_NONNULL ServiceDescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::ServiceOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) return _msg; } -inline void ServiceDescriptorProto::set_allocated_options(::google::protobuf::ServiceOptions* value) { +inline void ServiceDescriptorProto::set_allocated_options(::google::protobuf::ServiceOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -15711,14 +15956,14 @@ inline const std::string& MethodDescriptorProto::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void MethodDescriptorProto::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void MethodDescriptorProto::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name) } -inline std::string* MethodDescriptorProto::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL MethodDescriptorProto::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name) return _s; @@ -15732,12 +15977,12 @@ inline void MethodDescriptorProto::_internal_set_name(const std::string& value) _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* MethodDescriptorProto::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL MethodDescriptorProto::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* MethodDescriptorProto::release_name() { +inline std::string* PROTOBUF_NULLABLE MethodDescriptorProto::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -15750,7 +15995,7 @@ inline std::string* MethodDescriptorProto::release_name() { } return released; } -inline void MethodDescriptorProto::set_allocated_name(std::string* value) { +inline void MethodDescriptorProto::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -15780,14 +16025,14 @@ inline const std::string& MethodDescriptorProto::input_type() const return _internal_input_type(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void MethodDescriptorProto::set_input_type(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void MethodDescriptorProto::set_input_type(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.input_type_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type) } -inline std::string* MethodDescriptorProto::mutable_input_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL MethodDescriptorProto::mutable_input_type() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_input_type(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type) return _s; @@ -15801,12 +16046,12 @@ inline void MethodDescriptorProto::_internal_set_input_type(const std::string& v _impl_._has_bits_[0] |= 0x00000002u; _impl_.input_type_.Set(value, GetArena()); } -inline std::string* MethodDescriptorProto::_internal_mutable_input_type() { +inline std::string* PROTOBUF_NONNULL MethodDescriptorProto::_internal_mutable_input_type() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.input_type_.Mutable( GetArena()); } -inline std::string* MethodDescriptorProto::release_input_type() { +inline std::string* PROTOBUF_NULLABLE MethodDescriptorProto::release_input_type() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -15819,7 +16064,7 @@ inline std::string* MethodDescriptorProto::release_input_type() { } return released; } -inline void MethodDescriptorProto::set_allocated_input_type(std::string* value) { +inline void MethodDescriptorProto::set_allocated_input_type(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -15849,14 +16094,14 @@ inline const std::string& MethodDescriptorProto::output_type() const return _internal_output_type(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void MethodDescriptorProto::set_output_type(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void MethodDescriptorProto::set_output_type(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; _impl_.output_type_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type) } -inline std::string* MethodDescriptorProto::mutable_output_type() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL MethodDescriptorProto::mutable_output_type() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_output_type(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type) return _s; @@ -15870,12 +16115,12 @@ inline void MethodDescriptorProto::_internal_set_output_type(const std::string& _impl_._has_bits_[0] |= 0x00000004u; _impl_.output_type_.Set(value, GetArena()); } -inline std::string* MethodDescriptorProto::_internal_mutable_output_type() { +inline std::string* PROTOBUF_NONNULL MethodDescriptorProto::_internal_mutable_output_type() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; return _impl_.output_type_.Mutable( GetArena()); } -inline std::string* MethodDescriptorProto::release_output_type() { +inline std::string* PROTOBUF_NULLABLE MethodDescriptorProto::release_output_type() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type) if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { @@ -15888,7 +16133,7 @@ inline std::string* MethodDescriptorProto::release_output_type() { } return released; } -inline void MethodDescriptorProto::set_allocated_output_type(std::string* value) { +inline void MethodDescriptorProto::set_allocated_output_type(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000004u; @@ -15922,7 +16167,8 @@ inline const ::google::protobuf::MethodOptions& MethodDescriptorProto::options() // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options) return _internal_options(); } -inline void MethodDescriptorProto::unsafe_arena_set_allocated_options(::google::protobuf::MethodOptions* value) { +inline void MethodDescriptorProto::unsafe_arena_set_allocated_options( + ::google::protobuf::MethodOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); @@ -15935,7 +16181,7 @@ inline void MethodDescriptorProto::unsafe_arena_set_allocated_options(::google:: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.options) } -inline ::google::protobuf::MethodOptions* MethodDescriptorProto::release_options() { +inline ::google::protobuf::MethodOptions* PROTOBUF_NULLABLE MethodDescriptorProto::release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000008u; @@ -15954,7 +16200,7 @@ inline ::google::protobuf::MethodOptions* MethodDescriptorProto::release_options } return released; } -inline ::google::protobuf::MethodOptions* MethodDescriptorProto::unsafe_arena_release_options() { +inline ::google::protobuf::MethodOptions* PROTOBUF_NULLABLE MethodDescriptorProto::unsafe_arena_release_options() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options) @@ -15963,7 +16209,7 @@ inline ::google::protobuf::MethodOptions* MethodDescriptorProto::unsafe_arena_re _impl_.options_ = nullptr; return temp; } -inline ::google::protobuf::MethodOptions* MethodDescriptorProto::_internal_mutable_options() { +inline ::google::protobuf::MethodOptions* PROTOBUF_NONNULL MethodDescriptorProto::_internal_mutable_options() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.options_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::MethodOptions>(GetArena()); @@ -15971,21 +16217,22 @@ inline ::google::protobuf::MethodOptions* MethodDescriptorProto::_internal_mutab } return _impl_.options_; } -inline ::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::MethodOptions* PROTOBUF_NONNULL MethodDescriptorProto::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000008u; ::google::protobuf::MethodOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) return _msg; } -inline void MethodDescriptorProto::set_allocated_options(::google::protobuf::MethodOptions* value) { +inline void MethodDescriptorProto::set_allocated_options(::google::protobuf::MethodOptions* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.options_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.options_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -16074,14 +16321,14 @@ inline const std::string& FileOptions::java_package() const return _internal_java_package(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_java_package(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_java_package(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.java_package_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package) } -inline std::string* FileOptions::mutable_java_package() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_java_package() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_java_package(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package) return _s; @@ -16095,12 +16342,12 @@ inline void FileOptions::_internal_set_java_package(const std::string& value) { _impl_._has_bits_[0] |= 0x00000001u; _impl_.java_package_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_java_package() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_java_package() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.java_package_.Mutable( GetArena()); } -inline std::string* FileOptions::release_java_package() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_java_package() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -16113,7 +16360,7 @@ inline std::string* FileOptions::release_java_package() { } return released; } -inline void FileOptions::set_allocated_java_package(std::string* value) { +inline void FileOptions::set_allocated_java_package(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -16143,14 +16390,14 @@ inline const std::string& FileOptions::java_outer_classname() const return _internal_java_outer_classname(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_java_outer_classname(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_java_outer_classname(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.java_outer_classname_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname) } -inline std::string* FileOptions::mutable_java_outer_classname() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_java_outer_classname() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_java_outer_classname(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname) return _s; @@ -16164,12 +16411,12 @@ inline void FileOptions::_internal_set_java_outer_classname(const std::string& v _impl_._has_bits_[0] |= 0x00000002u; _impl_.java_outer_classname_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_java_outer_classname() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_java_outer_classname() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.java_outer_classname_.Mutable( GetArena()); } -inline std::string* FileOptions::release_java_outer_classname() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_java_outer_classname() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -16182,7 +16429,7 @@ inline std::string* FileOptions::release_java_outer_classname() { } return released; } -inline void FileOptions::set_allocated_java_outer_classname(std::string* value) { +inline void FileOptions::set_allocated_java_outer_classname(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -16305,8 +16552,10 @@ inline ::google::protobuf::FileOptions_OptimizeMode FileOptions::_internal_optim } inline void FileOptions::_internal_set_optimize_for(::google::protobuf::FileOptions_OptimizeMode value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FileOptions_OptimizeMode_IsValid(value)); - _impl_.optimize_for_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FileOptions_OptimizeMode_internal_data_)); + _impl_.optimize_for_ = value; } // optional string go_package = 11; @@ -16325,14 +16574,14 @@ inline const std::string& FileOptions::go_package() const return _internal_go_package(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_go_package(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_go_package(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; _impl_.go_package_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package) } -inline std::string* FileOptions::mutable_go_package() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_go_package() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_go_package(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package) return _s; @@ -16346,12 +16595,12 @@ inline void FileOptions::_internal_set_go_package(const std::string& value) { _impl_._has_bits_[0] |= 0x00000004u; _impl_.go_package_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_go_package() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_go_package() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; return _impl_.go_package_.Mutable( GetArena()); } -inline std::string* FileOptions::release_go_package() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_go_package() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package) if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { @@ -16364,7 +16613,7 @@ inline std::string* FileOptions::release_go_package() { } return released; } -inline void FileOptions::set_allocated_go_package(std::string* value) { +inline void FileOptions::set_allocated_go_package(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000004u; @@ -16534,14 +16783,14 @@ inline const std::string& FileOptions::objc_class_prefix() const return _internal_objc_class_prefix(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_objc_class_prefix(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_objc_class_prefix(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000008u; _impl_.objc_class_prefix_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix) } -inline std::string* FileOptions::mutable_objc_class_prefix() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_objc_class_prefix() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_objc_class_prefix(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix) return _s; @@ -16555,12 +16804,12 @@ inline void FileOptions::_internal_set_objc_class_prefix(const std::string& valu _impl_._has_bits_[0] |= 0x00000008u; _impl_.objc_class_prefix_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_objc_class_prefix() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_objc_class_prefix() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000008u; return _impl_.objc_class_prefix_.Mutable( GetArena()); } -inline std::string* FileOptions::release_objc_class_prefix() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_objc_class_prefix() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix) if ((_impl_._has_bits_[0] & 0x00000008u) == 0) { @@ -16573,7 +16822,7 @@ inline std::string* FileOptions::release_objc_class_prefix() { } return released; } -inline void FileOptions::set_allocated_objc_class_prefix(std::string* value) { +inline void FileOptions::set_allocated_objc_class_prefix(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000008u; @@ -16603,14 +16852,14 @@ inline const std::string& FileOptions::csharp_namespace() const return _internal_csharp_namespace(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_csharp_namespace(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_csharp_namespace(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000010u; _impl_.csharp_namespace_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace) } -inline std::string* FileOptions::mutable_csharp_namespace() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_csharp_namespace() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_csharp_namespace(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace) return _s; @@ -16624,12 +16873,12 @@ inline void FileOptions::_internal_set_csharp_namespace(const std::string& value _impl_._has_bits_[0] |= 0x00000010u; _impl_.csharp_namespace_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_csharp_namespace() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_csharp_namespace() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000010u; return _impl_.csharp_namespace_.Mutable( GetArena()); } -inline std::string* FileOptions::release_csharp_namespace() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_csharp_namespace() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace) if ((_impl_._has_bits_[0] & 0x00000010u) == 0) { @@ -16642,7 +16891,7 @@ inline std::string* FileOptions::release_csharp_namespace() { } return released; } -inline void FileOptions::set_allocated_csharp_namespace(std::string* value) { +inline void FileOptions::set_allocated_csharp_namespace(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000010u; @@ -16672,14 +16921,14 @@ inline const std::string& FileOptions::swift_prefix() const return _internal_swift_prefix(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_swift_prefix(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_swift_prefix(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000020u; _impl_.swift_prefix_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix) } -inline std::string* FileOptions::mutable_swift_prefix() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_swift_prefix() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_swift_prefix(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix) return _s; @@ -16693,12 +16942,12 @@ inline void FileOptions::_internal_set_swift_prefix(const std::string& value) { _impl_._has_bits_[0] |= 0x00000020u; _impl_.swift_prefix_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_swift_prefix() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_swift_prefix() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000020u; return _impl_.swift_prefix_.Mutable( GetArena()); } -inline std::string* FileOptions::release_swift_prefix() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_swift_prefix() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix) if ((_impl_._has_bits_[0] & 0x00000020u) == 0) { @@ -16711,7 +16960,7 @@ inline std::string* FileOptions::release_swift_prefix() { } return released; } -inline void FileOptions::set_allocated_swift_prefix(std::string* value) { +inline void FileOptions::set_allocated_swift_prefix(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000020u; @@ -16741,14 +16990,14 @@ inline const std::string& FileOptions::php_class_prefix() const return _internal_php_class_prefix(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_php_class_prefix(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_php_class_prefix(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000040u; _impl_.php_class_prefix_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix) } -inline std::string* FileOptions::mutable_php_class_prefix() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_php_class_prefix() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_php_class_prefix(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix) return _s; @@ -16762,12 +17011,12 @@ inline void FileOptions::_internal_set_php_class_prefix(const std::string& value _impl_._has_bits_[0] |= 0x00000040u; _impl_.php_class_prefix_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_php_class_prefix() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_php_class_prefix() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000040u; return _impl_.php_class_prefix_.Mutable( GetArena()); } -inline std::string* FileOptions::release_php_class_prefix() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_php_class_prefix() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix) if ((_impl_._has_bits_[0] & 0x00000040u) == 0) { @@ -16780,7 +17029,7 @@ inline std::string* FileOptions::release_php_class_prefix() { } return released; } -inline void FileOptions::set_allocated_php_class_prefix(std::string* value) { +inline void FileOptions::set_allocated_php_class_prefix(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000040u; @@ -16810,14 +17059,14 @@ inline const std::string& FileOptions::php_namespace() const return _internal_php_namespace(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_php_namespace(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_php_namespace(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000080u; _impl_.php_namespace_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace) } -inline std::string* FileOptions::mutable_php_namespace() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_php_namespace() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_php_namespace(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace) return _s; @@ -16831,12 +17080,12 @@ inline void FileOptions::_internal_set_php_namespace(const std::string& value) { _impl_._has_bits_[0] |= 0x00000080u; _impl_.php_namespace_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_php_namespace() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_php_namespace() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000080u; return _impl_.php_namespace_.Mutable( GetArena()); } -inline std::string* FileOptions::release_php_namespace() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_php_namespace() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace) if ((_impl_._has_bits_[0] & 0x00000080u) == 0) { @@ -16849,7 +17098,7 @@ inline std::string* FileOptions::release_php_namespace() { } return released; } -inline void FileOptions::set_allocated_php_namespace(std::string* value) { +inline void FileOptions::set_allocated_php_namespace(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000080u; @@ -16879,14 +17128,14 @@ inline const std::string& FileOptions::php_metadata_namespace() const return _internal_php_metadata_namespace(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_php_metadata_namespace(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_php_metadata_namespace(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000100u; _impl_.php_metadata_namespace_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_metadata_namespace) } -inline std::string* FileOptions::mutable_php_metadata_namespace() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_php_metadata_namespace() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_php_metadata_namespace(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_metadata_namespace) return _s; @@ -16900,12 +17149,12 @@ inline void FileOptions::_internal_set_php_metadata_namespace(const std::string& _impl_._has_bits_[0] |= 0x00000100u; _impl_.php_metadata_namespace_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_php_metadata_namespace() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_php_metadata_namespace() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000100u; return _impl_.php_metadata_namespace_.Mutable( GetArena()); } -inline std::string* FileOptions::release_php_metadata_namespace() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_php_metadata_namespace() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_metadata_namespace) if ((_impl_._has_bits_[0] & 0x00000100u) == 0) { @@ -16918,7 +17167,7 @@ inline std::string* FileOptions::release_php_metadata_namespace() { } return released; } -inline void FileOptions::set_allocated_php_metadata_namespace(std::string* value) { +inline void FileOptions::set_allocated_php_metadata_namespace(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000100u; @@ -16948,14 +17197,14 @@ inline const std::string& FileOptions::ruby_package() const return _internal_ruby_package(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FileOptions::set_ruby_package(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FileOptions::set_ruby_package(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000200u; _impl_.ruby_package_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.ruby_package) } -inline std::string* FileOptions::mutable_ruby_package() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FileOptions::mutable_ruby_package() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_ruby_package(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.ruby_package) return _s; @@ -16969,12 +17218,12 @@ inline void FileOptions::_internal_set_ruby_package(const std::string& value) { _impl_._has_bits_[0] |= 0x00000200u; _impl_.ruby_package_.Set(value, GetArena()); } -inline std::string* FileOptions::_internal_mutable_ruby_package() { +inline std::string* PROTOBUF_NONNULL FileOptions::_internal_mutable_ruby_package() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000200u; return _impl_.ruby_package_.Mutable( GetArena()); } -inline std::string* FileOptions::release_ruby_package() { +inline std::string* PROTOBUF_NULLABLE FileOptions::release_ruby_package() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.ruby_package) if ((_impl_._has_bits_[0] & 0x00000200u) == 0) { @@ -16987,7 +17236,7 @@ inline std::string* FileOptions::release_ruby_package() { } return released; } -inline void FileOptions::set_allocated_ruby_package(std::string* value) { +inline void FileOptions::set_allocated_ruby_package(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000200u; @@ -17021,7 +17270,8 @@ inline const ::google::protobuf::FeatureSet& FileOptions::features() const ABSL_ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.features) return _internal_features(); } -inline void FileOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void FileOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -17034,7 +17284,7 @@ inline void FileOptions::unsafe_arena_set_allocated_features(::google::protobuf: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.features) } -inline ::google::protobuf::FeatureSet* FileOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FileOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000400u; @@ -17053,7 +17303,7 @@ inline ::google::protobuf::FeatureSet* FileOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* FileOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FileOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.features) @@ -17062,7 +17312,7 @@ inline ::google::protobuf::FeatureSet* FileOptions::unsafe_arena_release_feature _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* FileOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FileOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -17070,21 +17320,22 @@ inline ::google::protobuf::FeatureSet* FileOptions::_internal_mutable_features() } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* FileOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FileOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000400u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.features) return _msg; } -inline void FileOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void FileOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -17108,12 +17359,12 @@ inline void FileOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL FileOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* FileOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL FileOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -17124,7 +17375,8 @@ inline const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL FileOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option) @@ -17140,7 +17392,7 @@ FileOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL FileOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -17310,7 +17562,8 @@ inline const ::google::protobuf::FeatureSet& MessageOptions::features() const AB // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.features) return _internal_features(); } -inline void MessageOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void MessageOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -17323,7 +17576,7 @@ inline void MessageOptions::unsafe_arena_set_allocated_features(::google::protob } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MessageOptions.features) } -inline ::google::protobuf::FeatureSet* MessageOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE MessageOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -17342,7 +17595,7 @@ inline ::google::protobuf::FeatureSet* MessageOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* MessageOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE MessageOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.MessageOptions.features) @@ -17351,7 +17604,7 @@ inline ::google::protobuf::FeatureSet* MessageOptions::unsafe_arena_release_feat _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* MessageOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL MessageOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -17359,21 +17612,22 @@ inline ::google::protobuf::FeatureSet* MessageOptions::_internal_mutable_feature } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* MessageOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL MessageOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.features) return _msg; } -inline void MessageOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void MessageOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -17397,12 +17651,12 @@ inline void MessageOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL MessageOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* MessageOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL MessageOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -17413,7 +17667,8 @@ inline const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpre // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL MessageOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option) @@ -17429,7 +17684,7 @@ MessageOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL MessageOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -17464,8 +17719,10 @@ inline ::google::protobuf::Edition FieldOptions_EditionDefault::_internal_editio } inline void FieldOptions_EditionDefault::_internal_set_edition(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.edition_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.edition_ = value; } // optional string value = 2; @@ -17484,14 +17741,14 @@ inline const std::string& FieldOptions_EditionDefault::value() const return _internal_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FieldOptions_EditionDefault::set_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FieldOptions_EditionDefault::set_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.EditionDefault.value) } -inline std::string* FieldOptions_EditionDefault::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldOptions_EditionDefault::mutable_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.EditionDefault.value) return _s; @@ -17505,12 +17762,12 @@ inline void FieldOptions_EditionDefault::_internal_set_value(const std::string& _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(value, GetArena()); } -inline std::string* FieldOptions_EditionDefault::_internal_mutable_value() { +inline std::string* PROTOBUF_NONNULL FieldOptions_EditionDefault::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.value_.Mutable( GetArena()); } -inline std::string* FieldOptions_EditionDefault::release_value() { +inline std::string* PROTOBUF_NULLABLE FieldOptions_EditionDefault::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldOptions.EditionDefault.value) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -17523,7 +17780,7 @@ inline std::string* FieldOptions_EditionDefault::release_value() { } return released; } -inline void FieldOptions_EditionDefault::set_allocated_value(std::string* value) { +inline void FieldOptions_EditionDefault::set_allocated_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -17566,8 +17823,10 @@ inline ::google::protobuf::Edition FieldOptions_FeatureSupport::_internal_editio } inline void FieldOptions_FeatureSupport::_internal_set_edition_introduced(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.edition_introduced_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.edition_introduced_ = value; } // optional .google.protobuf.Edition edition_deprecated = 2; @@ -17595,8 +17854,10 @@ inline ::google::protobuf::Edition FieldOptions_FeatureSupport::_internal_editio } inline void FieldOptions_FeatureSupport::_internal_set_edition_deprecated(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.edition_deprecated_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.edition_deprecated_ = value; } // optional string deprecation_warning = 3; @@ -17615,14 +17876,14 @@ inline const std::string& FieldOptions_FeatureSupport::deprecation_warning() con return _internal_deprecation_warning(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void FieldOptions_FeatureSupport::set_deprecation_warning(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void FieldOptions_FeatureSupport::set_deprecation_warning(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.deprecation_warning_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.FeatureSupport.deprecation_warning) } -inline std::string* FieldOptions_FeatureSupport::mutable_deprecation_warning() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldOptions_FeatureSupport::mutable_deprecation_warning() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_deprecation_warning(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.FeatureSupport.deprecation_warning) return _s; @@ -17636,12 +17897,12 @@ inline void FieldOptions_FeatureSupport::_internal_set_deprecation_warning(const _impl_._has_bits_[0] |= 0x00000001u; _impl_.deprecation_warning_.Set(value, GetArena()); } -inline std::string* FieldOptions_FeatureSupport::_internal_mutable_deprecation_warning() { +inline std::string* PROTOBUF_NONNULL FieldOptions_FeatureSupport::_internal_mutable_deprecation_warning() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.deprecation_warning_.Mutable( GetArena()); } -inline std::string* FieldOptions_FeatureSupport::release_deprecation_warning() { +inline std::string* PROTOBUF_NULLABLE FieldOptions_FeatureSupport::release_deprecation_warning() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldOptions.FeatureSupport.deprecation_warning) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -17654,7 +17915,7 @@ inline std::string* FieldOptions_FeatureSupport::release_deprecation_warning() { } return released; } -inline void FieldOptions_FeatureSupport::set_allocated_deprecation_warning(std::string* value) { +inline void FieldOptions_FeatureSupport::set_allocated_deprecation_warning(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -17693,8 +17954,10 @@ inline ::google::protobuf::Edition FieldOptions_FeatureSupport::_internal_editio } inline void FieldOptions_FeatureSupport::_internal_set_edition_removed(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.edition_removed_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.edition_removed_ = value; } // ------------------------------------------------------------------- @@ -17726,8 +17989,10 @@ inline ::google::protobuf::FieldOptions_CType FieldOptions::_internal_ctype() co } inline void FieldOptions::_internal_set_ctype(::google::protobuf::FieldOptions_CType value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FieldOptions_CType_IsValid(value)); - _impl_.ctype_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FieldOptions_CType_internal_data_)); + _impl_.ctype_ = value; } // optional bool packed = 2; @@ -17783,8 +18048,10 @@ inline ::google::protobuf::FieldOptions_JSType FieldOptions::_internal_jstype() } inline void FieldOptions::_internal_set_jstype(::google::protobuf::FieldOptions_JSType value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FieldOptions_JSType_IsValid(value)); - _impl_.jstype_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FieldOptions_JSType_internal_data_)); + _impl_.jstype_ = value; } // optional bool lazy = 5 [default = false]; @@ -17952,8 +18219,10 @@ inline ::google::protobuf::FieldOptions_OptionRetention FieldOptions::_internal_ } inline void FieldOptions::_internal_set_retention(::google::protobuf::FieldOptions_OptionRetention value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FieldOptions_OptionRetention_IsValid(value)); - _impl_.retention_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FieldOptions_OptionRetention_internal_data_)); + _impl_.retention_ = value; } // repeated .google.protobuf.FieldOptions.OptionTargetType targets = 19; @@ -17972,13 +18241,17 @@ inline ::google::protobuf::FieldOptions_OptionTargetType FieldOptions::targets(i return static_cast<::google::protobuf::FieldOptions_OptionTargetType>(_internal_targets().Get(index)); } inline void FieldOptions::set_targets(int index, ::google::protobuf::FieldOptions_OptionTargetType value) { - assert(::google::protobuf::FieldOptions_OptionTargetType_IsValid(value)); - _internal_mutable_targets()->Set(index, value); + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FieldOptions_OptionTargetType_internal_data_)); + _internal_mutable_targets()->Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.targets) } inline void FieldOptions::add_targets(::google::protobuf::FieldOptions_OptionTargetType value) { - assert(::google::protobuf::FieldOptions_OptionTargetType_IsValid(value)); - ::google::protobuf::internal::TSanWrite(&_impl_); + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FieldOptions_OptionTargetType_internal_data_)); + ::google::protobuf::internal::TSanWrite(&_impl_); _internal_mutable_targets()->Add(value); // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.targets) } @@ -17987,7 +18260,7 @@ inline const ::google::protobuf::RepeatedField<int>& FieldOptions::targets() con // @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.targets) return _internal_targets(); } -inline ::google::protobuf::RepeatedField<int>* FieldOptions::mutable_targets() +inline ::google::protobuf::RepeatedField<int>* PROTOBUF_NONNULL FieldOptions::mutable_targets() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.targets) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -17998,7 +18271,8 @@ inline const ::google::protobuf::RepeatedField<int>& FieldOptions::_internal_tar ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.targets_; } -inline ::google::protobuf::RepeatedField<int>* FieldOptions::_internal_mutable_targets() { +inline ::google::protobuf::RepeatedField<int>* PROTOBUF_NONNULL +FieldOptions::_internal_mutable_targets() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.targets_; } @@ -18014,12 +18288,12 @@ inline void FieldOptions::clear_edition_defaults() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.edition_defaults_.Clear(); } -inline ::google::protobuf::FieldOptions_EditionDefault* FieldOptions::mutable_edition_defaults(int index) +inline ::google::protobuf::FieldOptions_EditionDefault* PROTOBUF_NONNULL FieldOptions::mutable_edition_defaults(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.edition_defaults) return _internal_mutable_edition_defaults()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* FieldOptions::mutable_edition_defaults() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* PROTOBUF_NONNULL FieldOptions::mutable_edition_defaults() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.edition_defaults) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -18030,7 +18304,8 @@ inline const ::google::protobuf::FieldOptions_EditionDefault& FieldOptions::edit // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.edition_defaults) return _internal_edition_defaults().Get(index); } -inline ::google::protobuf::FieldOptions_EditionDefault* FieldOptions::add_edition_defaults() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FieldOptions_EditionDefault* PROTOBUF_NONNULL FieldOptions::add_edition_defaults() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FieldOptions_EditionDefault* _add = _internal_mutable_edition_defaults()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.edition_defaults) @@ -18046,7 +18321,7 @@ FieldOptions::_internal_edition_defaults() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.edition_defaults_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldOptions_EditionDefault>* PROTOBUF_NONNULL FieldOptions::_internal_mutable_edition_defaults() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.edition_defaults_; @@ -18072,7 +18347,8 @@ inline const ::google::protobuf::FeatureSet& FieldOptions::features() const ABSL // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.features) return _internal_features(); } -inline void FieldOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void FieldOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -18085,7 +18361,7 @@ inline void FieldOptions::unsafe_arena_set_allocated_features(::google::protobuf } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldOptions.features) } -inline ::google::protobuf::FeatureSet* FieldOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FieldOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -18104,7 +18380,7 @@ inline ::google::protobuf::FeatureSet* FieldOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* FieldOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FieldOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldOptions.features) @@ -18113,7 +18389,7 @@ inline ::google::protobuf::FeatureSet* FieldOptions::unsafe_arena_release_featur _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* FieldOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FieldOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -18121,21 +18397,22 @@ inline ::google::protobuf::FeatureSet* FieldOptions::_internal_mutable_features( } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* FieldOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FieldOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.features) return _msg; } -inline void FieldOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void FieldOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -18168,7 +18445,8 @@ inline const ::google::protobuf::FieldOptions_FeatureSupport& FieldOptions::feat // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.feature_support) return _internal_feature_support(); } -inline void FieldOptions::unsafe_arena_set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value) { +inline void FieldOptions::unsafe_arena_set_allocated_feature_support( + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.feature_support_); @@ -18181,7 +18459,7 @@ inline void FieldOptions::unsafe_arena_set_allocated_feature_support(::google::p } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldOptions.feature_support) } -inline ::google::protobuf::FieldOptions_FeatureSupport* FieldOptions::release_feature_support() { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE FieldOptions::release_feature_support() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -18200,7 +18478,7 @@ inline ::google::protobuf::FieldOptions_FeatureSupport* FieldOptions::release_fe } return released; } -inline ::google::protobuf::FieldOptions_FeatureSupport* FieldOptions::unsafe_arena_release_feature_support() { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE FieldOptions::unsafe_arena_release_feature_support() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FieldOptions.feature_support) @@ -18209,7 +18487,7 @@ inline ::google::protobuf::FieldOptions_FeatureSupport* FieldOptions::unsafe_are _impl_.feature_support_ = nullptr; return temp; } -inline ::google::protobuf::FieldOptions_FeatureSupport* FieldOptions::_internal_mutable_feature_support() { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL FieldOptions::_internal_mutable_feature_support() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.feature_support_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FieldOptions_FeatureSupport>(GetArena()); @@ -18217,21 +18495,22 @@ inline ::google::protobuf::FieldOptions_FeatureSupport* FieldOptions::_internal_ } return _impl_.feature_support_; } -inline ::google::protobuf::FieldOptions_FeatureSupport* FieldOptions::mutable_feature_support() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL FieldOptions::mutable_feature_support() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::FieldOptions_FeatureSupport* _msg = _internal_mutable_feature_support(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.feature_support) return _msg; } -inline void FieldOptions::set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value) { +inline void FieldOptions::set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.feature_support_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.feature_support_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -18255,12 +18534,12 @@ inline void FieldOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL FieldOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* FieldOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL FieldOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -18271,7 +18550,8 @@ inline const ::google::protobuf::UninterpretedOption& FieldOptions::uninterprete // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL FieldOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option) @@ -18287,7 +18567,7 @@ FieldOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL FieldOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -18317,7 +18597,8 @@ inline const ::google::protobuf::FeatureSet& OneofOptions::features() const ABSL // @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.features) return _internal_features(); } -inline void OneofOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void OneofOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -18330,7 +18611,7 @@ inline void OneofOptions::unsafe_arena_set_allocated_features(::google::protobuf } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofOptions.features) } -inline ::google::protobuf::FeatureSet* OneofOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE OneofOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -18349,7 +18630,7 @@ inline ::google::protobuf::FeatureSet* OneofOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* OneofOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE OneofOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.OneofOptions.features) @@ -18358,7 +18639,7 @@ inline ::google::protobuf::FeatureSet* OneofOptions::unsafe_arena_release_featur _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* OneofOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL OneofOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -18366,21 +18647,22 @@ inline ::google::protobuf::FeatureSet* OneofOptions::_internal_mutable_features( } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* OneofOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL OneofOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.OneofOptions.features) return _msg; } -inline void OneofOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void OneofOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -18404,12 +18686,12 @@ inline void OneofOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* OneofOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL OneofOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.OneofOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* OneofOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL OneofOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.OneofOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -18420,7 +18702,8 @@ inline const ::google::protobuf::UninterpretedOption& OneofOptions::uninterprete // @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* OneofOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL OneofOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option) @@ -18436,7 +18719,7 @@ OneofOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL OneofOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -18550,7 +18833,8 @@ inline const ::google::protobuf::FeatureSet& EnumOptions::features() const ABSL_ // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.features) return _internal_features(); } -inline void EnumOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void EnumOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -18563,7 +18847,7 @@ inline void EnumOptions::unsafe_arena_set_allocated_features(::google::protobuf: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumOptions.features) } -inline ::google::protobuf::FeatureSet* EnumOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE EnumOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -18582,7 +18866,7 @@ inline ::google::protobuf::FeatureSet* EnumOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* EnumOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE EnumOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumOptions.features) @@ -18591,7 +18875,7 @@ inline ::google::protobuf::FeatureSet* EnumOptions::unsafe_arena_release_feature _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* EnumOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL EnumOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -18599,21 +18883,22 @@ inline ::google::protobuf::FeatureSet* EnumOptions::_internal_mutable_features() } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* EnumOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL EnumOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.features) return _msg; } -inline void EnumOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void EnumOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -18637,12 +18922,12 @@ inline void EnumOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL EnumOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* EnumOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL EnumOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -18653,7 +18938,8 @@ inline const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL EnumOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option) @@ -18669,7 +18955,7 @@ EnumOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL EnumOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -18727,7 +19013,8 @@ inline const ::google::protobuf::FeatureSet& EnumValueOptions::features() const // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.features) return _internal_features(); } -inline void EnumValueOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void EnumValueOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -18740,7 +19027,7 @@ inline void EnumValueOptions::unsafe_arena_set_allocated_features(::google::prot } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueOptions.features) } -inline ::google::protobuf::FeatureSet* EnumValueOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE EnumValueOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -18759,7 +19046,7 @@ inline ::google::protobuf::FeatureSet* EnumValueOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* EnumValueOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE EnumValueOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumValueOptions.features) @@ -18768,7 +19055,7 @@ inline ::google::protobuf::FeatureSet* EnumValueOptions::unsafe_arena_release_fe _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* EnumValueOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL EnumValueOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -18776,21 +19063,22 @@ inline ::google::protobuf::FeatureSet* EnumValueOptions::_internal_mutable_featu } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* EnumValueOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL EnumValueOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.features) return _msg; } -inline void EnumValueOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void EnumValueOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -18851,7 +19139,8 @@ inline const ::google::protobuf::FieldOptions_FeatureSupport& EnumValueOptions:: // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.feature_support) return _internal_feature_support(); } -inline void EnumValueOptions::unsafe_arena_set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value) { +inline void EnumValueOptions::unsafe_arena_set_allocated_feature_support( + ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.feature_support_); @@ -18864,7 +19153,7 @@ inline void EnumValueOptions::unsafe_arena_set_allocated_feature_support(::googl } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueOptions.feature_support) } -inline ::google::protobuf::FieldOptions_FeatureSupport* EnumValueOptions::release_feature_support() { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE EnumValueOptions::release_feature_support() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -18883,7 +19172,7 @@ inline ::google::protobuf::FieldOptions_FeatureSupport* EnumValueOptions::releas } return released; } -inline ::google::protobuf::FieldOptions_FeatureSupport* EnumValueOptions::unsafe_arena_release_feature_support() { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE EnumValueOptions::unsafe_arena_release_feature_support() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumValueOptions.feature_support) @@ -18892,7 +19181,7 @@ inline ::google::protobuf::FieldOptions_FeatureSupport* EnumValueOptions::unsafe _impl_.feature_support_ = nullptr; return temp; } -inline ::google::protobuf::FieldOptions_FeatureSupport* EnumValueOptions::_internal_mutable_feature_support() { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL EnumValueOptions::_internal_mutable_feature_support() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.feature_support_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FieldOptions_FeatureSupport>(GetArena()); @@ -18900,21 +19189,22 @@ inline ::google::protobuf::FieldOptions_FeatureSupport* EnumValueOptions::_inter } return _impl_.feature_support_; } -inline ::google::protobuf::FieldOptions_FeatureSupport* EnumValueOptions::mutable_feature_support() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NONNULL EnumValueOptions::mutable_feature_support() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::FieldOptions_FeatureSupport* _msg = _internal_mutable_feature_support(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.feature_support) return _msg; } -inline void EnumValueOptions::set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* value) { +inline void EnumValueOptions::set_allocated_feature_support(::google::protobuf::FieldOptions_FeatureSupport* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.feature_support_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.feature_support_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -18938,12 +19228,12 @@ inline void EnumValueOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL EnumValueOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* EnumValueOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL EnumValueOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -18954,7 +19244,8 @@ inline const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterp // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL EnumValueOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option) @@ -18970,7 +19261,7 @@ EnumValueOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL EnumValueOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -19000,7 +19291,8 @@ inline const ::google::protobuf::FeatureSet& ServiceOptions::features() const AB // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.features) return _internal_features(); } -inline void ServiceOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void ServiceOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -19013,7 +19305,7 @@ inline void ServiceOptions::unsafe_arena_set_allocated_features(::google::protob } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceOptions.features) } -inline ::google::protobuf::FeatureSet* ServiceOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE ServiceOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -19032,7 +19324,7 @@ inline ::google::protobuf::FeatureSet* ServiceOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* ServiceOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE ServiceOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.ServiceOptions.features) @@ -19041,7 +19333,7 @@ inline ::google::protobuf::FeatureSet* ServiceOptions::unsafe_arena_release_feat _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* ServiceOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL ServiceOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -19049,21 +19341,22 @@ inline ::google::protobuf::FeatureSet* ServiceOptions::_internal_mutable_feature } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* ServiceOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL ServiceOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.features) return _msg; } -inline void ServiceOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void ServiceOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -19115,12 +19408,12 @@ inline void ServiceOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL ServiceOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* ServiceOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL ServiceOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -19131,7 +19424,8 @@ inline const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpre // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL ServiceOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option) @@ -19147,7 +19441,7 @@ ServiceOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL ServiceOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -19210,8 +19504,10 @@ inline ::google::protobuf::MethodOptions_IdempotencyLevel MethodOptions::_intern } inline void MethodOptions::_internal_set_idempotency_level(::google::protobuf::MethodOptions_IdempotencyLevel value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::MethodOptions_IdempotencyLevel_IsValid(value)); - _impl_.idempotency_level_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::MethodOptions_IdempotencyLevel_internal_data_)); + _impl_.idempotency_level_ = value; } // optional .google.protobuf.FeatureSet features = 35; @@ -19234,7 +19530,8 @@ inline const ::google::protobuf::FeatureSet& MethodOptions::features() const ABS // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.features) return _internal_features(); } -inline void MethodOptions::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void MethodOptions::unsafe_arena_set_allocated_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); @@ -19247,7 +19544,7 @@ inline void MethodOptions::unsafe_arena_set_allocated_features(::google::protobu } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodOptions.features) } -inline ::google::protobuf::FeatureSet* MethodOptions::release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE MethodOptions::release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -19266,7 +19563,7 @@ inline ::google::protobuf::FeatureSet* MethodOptions::release_features() { } return released; } -inline ::google::protobuf::FeatureSet* MethodOptions::unsafe_arena_release_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE MethodOptions::unsafe_arena_release_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.MethodOptions.features) @@ -19275,7 +19572,7 @@ inline ::google::protobuf::FeatureSet* MethodOptions::unsafe_arena_release_featu _impl_.features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* MethodOptions::_internal_mutable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL MethodOptions::_internal_mutable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -19283,21 +19580,22 @@ inline ::google::protobuf::FeatureSet* MethodOptions::_internal_mutable_features } return _impl_.features_; } -inline ::google::protobuf::FeatureSet* MethodOptions::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL MethodOptions::mutable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.features) return _msg; } -inline void MethodOptions::set_allocated_features(::google::protobuf::FeatureSet* value) { +inline void MethodOptions::set_allocated_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -19321,12 +19619,12 @@ inline void MethodOptions::clear_uninterpreted_option() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.uninterpreted_option_.Clear(); } -inline ::google::protobuf::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL MethodOptions::mutable_uninterpreted_option(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.uninterpreted_option) return _internal_mutable_uninterpreted_option()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* MethodOptions::mutable_uninterpreted_option() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL MethodOptions::mutable_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -19337,7 +19635,8 @@ inline const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpret // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option) return _internal_uninterpreted_option().Get(index); } -inline ::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption* PROTOBUF_NONNULL MethodOptions::add_uninterpreted_option() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption* _add = _internal_mutable_uninterpreted_option()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option) @@ -19353,7 +19652,7 @@ MethodOptions::_internal_uninterpreted_option() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.uninterpreted_option_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption>* PROTOBUF_NONNULL MethodOptions::_internal_mutable_uninterpreted_option() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.uninterpreted_option_; @@ -19379,14 +19678,14 @@ inline const std::string& UninterpretedOption_NamePart::name_part() const return _internal_name_part(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void UninterpretedOption_NamePart::set_name_part(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void UninterpretedOption_NamePart::set_name_part(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_part_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part) } -inline std::string* UninterpretedOption_NamePart::mutable_name_part() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL UninterpretedOption_NamePart::mutable_name_part() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name_part(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part) return _s; @@ -19400,12 +19699,12 @@ inline void UninterpretedOption_NamePart::_internal_set_name_part(const std::str _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_part_.Set(value, GetArena()); } -inline std::string* UninterpretedOption_NamePart::_internal_mutable_name_part() { +inline std::string* PROTOBUF_NONNULL UninterpretedOption_NamePart::_internal_mutable_name_part() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_part_.Mutable( GetArena()); } -inline std::string* UninterpretedOption_NamePart::release_name_part() { +inline std::string* PROTOBUF_NULLABLE UninterpretedOption_NamePart::release_name_part() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -19418,7 +19717,7 @@ inline std::string* UninterpretedOption_NamePart::release_name_part() { } return released; } -inline void UninterpretedOption_NamePart::set_allocated_name_part(std::string* value) { +inline void UninterpretedOption_NamePart::set_allocated_name_part(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -19475,12 +19774,12 @@ inline void UninterpretedOption::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.Clear(); } -inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) +inline ::google::protobuf::UninterpretedOption_NamePart* PROTOBUF_NONNULL UninterpretedOption::mutable_name(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.name) return _internal_mutable_name()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* UninterpretedOption::mutable_name() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* PROTOBUF_NONNULL UninterpretedOption::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -19491,7 +19790,8 @@ inline const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOpti // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name) return _internal_name().Get(index); } -inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::UninterpretedOption_NamePart* PROTOBUF_NONNULL UninterpretedOption::add_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::UninterpretedOption_NamePart* _add = _internal_mutable_name()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name) @@ -19507,7 +19807,7 @@ UninterpretedOption::_internal_name() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.name_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::UninterpretedOption_NamePart>* PROTOBUF_NONNULL UninterpretedOption::_internal_mutable_name() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.name_; @@ -19529,14 +19829,14 @@ inline const std::string& UninterpretedOption::identifier_value() const return _internal_identifier_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void UninterpretedOption::set_identifier_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void UninterpretedOption::set_identifier_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.identifier_value_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value) } -inline std::string* UninterpretedOption::mutable_identifier_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL UninterpretedOption::mutable_identifier_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_identifier_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value) return _s; @@ -19550,12 +19850,12 @@ inline void UninterpretedOption::_internal_set_identifier_value(const std::strin _impl_._has_bits_[0] |= 0x00000001u; _impl_.identifier_value_.Set(value, GetArena()); } -inline std::string* UninterpretedOption::_internal_mutable_identifier_value() { +inline std::string* PROTOBUF_NONNULL UninterpretedOption::_internal_mutable_identifier_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.identifier_value_.Mutable( GetArena()); } -inline std::string* UninterpretedOption::release_identifier_value() { +inline std::string* PROTOBUF_NULLABLE UninterpretedOption::release_identifier_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -19568,7 +19868,7 @@ inline std::string* UninterpretedOption::release_identifier_value() { } return released; } -inline void UninterpretedOption::set_allocated_identifier_value(std::string* value) { +inline void UninterpretedOption::set_allocated_identifier_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -19682,14 +19982,14 @@ inline const std::string& UninterpretedOption::string_value() const return _internal_string_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void UninterpretedOption::set_string_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void UninterpretedOption::set_string_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.string_value_.SetBytes(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value) } -inline std::string* UninterpretedOption::mutable_string_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL UninterpretedOption::mutable_string_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_string_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value) return _s; @@ -19703,12 +20003,12 @@ inline void UninterpretedOption::_internal_set_string_value(const std::string& v _impl_._has_bits_[0] |= 0x00000002u; _impl_.string_value_.Set(value, GetArena()); } -inline std::string* UninterpretedOption::_internal_mutable_string_value() { +inline std::string* PROTOBUF_NONNULL UninterpretedOption::_internal_mutable_string_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.string_value_.Mutable( GetArena()); } -inline std::string* UninterpretedOption::release_string_value() { +inline std::string* PROTOBUF_NULLABLE UninterpretedOption::release_string_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -19721,7 +20021,7 @@ inline std::string* UninterpretedOption::release_string_value() { } return released; } -inline void UninterpretedOption::set_allocated_string_value(std::string* value) { +inline void UninterpretedOption::set_allocated_string_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -19751,14 +20051,14 @@ inline const std::string& UninterpretedOption::aggregate_value() const return _internal_aggregate_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void UninterpretedOption::set_aggregate_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void UninterpretedOption::set_aggregate_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; _impl_.aggregate_value_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value) } -inline std::string* UninterpretedOption::mutable_aggregate_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL UninterpretedOption::mutable_aggregate_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_aggregate_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value) return _s; @@ -19772,12 +20072,12 @@ inline void UninterpretedOption::_internal_set_aggregate_value(const std::string _impl_._has_bits_[0] |= 0x00000004u; _impl_.aggregate_value_.Set(value, GetArena()); } -inline std::string* UninterpretedOption::_internal_mutable_aggregate_value() { +inline std::string* PROTOBUF_NONNULL UninterpretedOption::_internal_mutable_aggregate_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000004u; return _impl_.aggregate_value_.Mutable( GetArena()); } -inline std::string* UninterpretedOption::release_aggregate_value() { +inline std::string* PROTOBUF_NULLABLE UninterpretedOption::release_aggregate_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value) if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { @@ -19790,7 +20090,7 @@ inline std::string* UninterpretedOption::release_aggregate_value() { } return released; } -inline void UninterpretedOption::set_allocated_aggregate_value(std::string* value) { +inline void UninterpretedOption::set_allocated_aggregate_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000004u; @@ -19833,8 +20133,10 @@ inline ::google::protobuf::FeatureSet_FieldPresence FeatureSet::_internal_field_ } inline void FeatureSet::_internal_set_field_presence(::google::protobuf::FeatureSet_FieldPresence value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FeatureSet_FieldPresence_IsValid(value)); - _impl_.field_presence_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_FieldPresence_internal_data_)); + _impl_.field_presence_ = value; } // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { @@ -19862,8 +20164,10 @@ inline ::google::protobuf::FeatureSet_EnumType FeatureSet::_internal_enum_type() } inline void FeatureSet::_internal_set_enum_type(::google::protobuf::FeatureSet_EnumType value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FeatureSet_EnumType_IsValid(value)); - _impl_.enum_type_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_EnumType_internal_data_)); + _impl_.enum_type_ = value; } // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { @@ -19891,8 +20195,10 @@ inline ::google::protobuf::FeatureSet_RepeatedFieldEncoding FeatureSet::_interna } inline void FeatureSet::_internal_set_repeated_field_encoding(::google::protobuf::FeatureSet_RepeatedFieldEncoding value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FeatureSet_RepeatedFieldEncoding_IsValid(value)); - _impl_.repeated_field_encoding_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_RepeatedFieldEncoding_internal_data_)); + _impl_.repeated_field_encoding_ = value; } // optional .google.protobuf.FeatureSet.Utf8Validation utf8_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { @@ -19920,8 +20226,10 @@ inline ::google::protobuf::FeatureSet_Utf8Validation FeatureSet::_internal_utf8_ } inline void FeatureSet::_internal_set_utf8_validation(::google::protobuf::FeatureSet_Utf8Validation value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FeatureSet_Utf8Validation_IsValid(value)); - _impl_.utf8_validation_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_Utf8Validation_internal_data_)); + _impl_.utf8_validation_ = value; } // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { @@ -19949,8 +20257,10 @@ inline ::google::protobuf::FeatureSet_MessageEncoding FeatureSet::_internal_mess } inline void FeatureSet::_internal_set_message_encoding(::google::protobuf::FeatureSet_MessageEncoding value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FeatureSet_MessageEncoding_IsValid(value)); - _impl_.message_encoding_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_MessageEncoding_internal_data_)); + _impl_.message_encoding_ = value; } // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { @@ -19978,8 +20288,41 @@ inline ::google::protobuf::FeatureSet_JsonFormat FeatureSet::_internal_json_form } inline void FeatureSet::_internal_set_json_format(::google::protobuf::FeatureSet_JsonFormat value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::FeatureSet_JsonFormat_IsValid(value)); - _impl_.json_format_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_JsonFormat_internal_data_)); + _impl_.json_format_ = value; +} + +// optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { +inline bool FeatureSet::has_enforce_naming_style() const { + bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline void FeatureSet::clear_enforce_naming_style() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.enforce_naming_style_ = 0; + _impl_._has_bits_[0] &= ~0x00000040u; +} +inline ::google::protobuf::FeatureSet_EnforceNamingStyle FeatureSet::enforce_naming_style() const { + // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.enforce_naming_style) + return _internal_enforce_naming_style(); +} +inline void FeatureSet::set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value) { + _internal_set_enforce_naming_style(value); + _impl_._has_bits_[0] |= 0x00000040u; + // @@protoc_insertion_point(field_set:google.protobuf.FeatureSet.enforce_naming_style) +} +inline ::google::protobuf::FeatureSet_EnforceNamingStyle FeatureSet::_internal_enforce_naming_style() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::google::protobuf::FeatureSet_EnforceNamingStyle>(_impl_.enforce_naming_style_); +} +inline void FeatureSet::_internal_set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_EnforceNamingStyle_internal_data_)); + _impl_.enforce_naming_style_ = value; } // ------------------------------------------------------------------- @@ -20011,8 +20354,10 @@ inline ::google::protobuf::Edition FeatureSetDefaults_FeatureSetEditionDefault:: } inline void FeatureSetDefaults_FeatureSetEditionDefault::_internal_set_edition(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.edition_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.edition_ = value; } // optional .google.protobuf.FeatureSet overridable_features = 4; @@ -20035,7 +20380,8 @@ inline const ::google::protobuf::FeatureSet& FeatureSetDefaults_FeatureSetEditio // @@protoc_insertion_point(field_get:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features) return _internal_overridable_features(); } -inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_allocated_overridable_features(::google::protobuf::FeatureSet* value) { +inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_allocated_overridable_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.overridable_features_); @@ -20048,7 +20394,7 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_alloca } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features) } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::release_overridable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FeatureSetDefaults_FeatureSetEditionDefault::release_overridable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000001u; @@ -20067,7 +20413,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau } return released; } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_release_overridable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_release_overridable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features) @@ -20076,7 +20422,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau _impl_.overridable_features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::_internal_mutable_overridable_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::_internal_mutable_overridable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.overridable_features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -20084,21 +20430,22 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau } return _impl_.overridable_features_; } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::mutable_overridable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::mutable_overridable_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_overridable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features) return _msg; } -inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_overridable_features(::google::protobuf::FeatureSet* value) { +inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_overridable_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.overridable_features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.overridable_features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -20131,7 +20478,8 @@ inline const ::google::protobuf::FeatureSet& FeatureSetDefaults_FeatureSetEditio // @@protoc_insertion_point(field_get:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) return _internal_fixed_features(); } -inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_allocated_fixed_features(::google::protobuf::FeatureSet* value) { +inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_allocated_fixed_features( + ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.fixed_features_); @@ -20144,7 +20492,7 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_alloca } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::release_fixed_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FeatureSetDefaults_FeatureSetEditionDefault::release_fixed_features() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] &= ~0x00000002u; @@ -20163,7 +20511,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau } return released; } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_release_fixed_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NULLABLE FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_release_fixed_features() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) @@ -20172,7 +20520,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau _impl_.fixed_features_ = nullptr; return temp; } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::_internal_mutable_fixed_features() { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::_internal_mutable_fixed_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.fixed_features_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); @@ -20180,21 +20528,22 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau } return _impl_.fixed_features_; } -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::mutable_fixed_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSet* PROTOBUF_NONNULL FeatureSetDefaults_FeatureSetEditionDefault::mutable_fixed_features() + ABSL_ATTRIBUTE_LIFETIME_BOUND { _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_fixed_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) return _msg; } -inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_fixed_features(::google::protobuf::FeatureSet* value) { +inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_fixed_features(::google::protobuf::FeatureSet* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { - delete (_impl_.fixed_features_); + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.fixed_features_); } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = value->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } @@ -20222,12 +20571,12 @@ inline void FeatureSetDefaults::clear_defaults() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.defaults_.Clear(); } -inline ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* FeatureSetDefaults::mutable_defaults(int index) +inline ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL FeatureSetDefaults::mutable_defaults(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FeatureSetDefaults.defaults) return _internal_mutable_defaults()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* FeatureSetDefaults::mutable_defaults() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* PROTOBUF_NONNULL FeatureSetDefaults::mutable_defaults() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FeatureSetDefaults.defaults) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -20238,7 +20587,8 @@ inline const ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault& Fe // @@protoc_insertion_point(field_get:google.protobuf.FeatureSetDefaults.defaults) return _internal_defaults().Get(index); } -inline ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* FeatureSetDefaults::add_defaults() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* PROTOBUF_NONNULL FeatureSetDefaults::add_defaults() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault* _add = _internal_mutable_defaults()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.FeatureSetDefaults.defaults) @@ -20254,7 +20604,7 @@ FeatureSetDefaults::_internal_defaults() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.defaults_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>* PROTOBUF_NONNULL FeatureSetDefaults::_internal_mutable_defaults() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.defaults_; @@ -20285,8 +20635,10 @@ inline ::google::protobuf::Edition FeatureSetDefaults::_internal_minimum_edition } inline void FeatureSetDefaults::_internal_set_minimum_edition(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.minimum_edition_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.minimum_edition_ = value; } // optional .google.protobuf.Edition maximum_edition = 5; @@ -20314,8 +20666,10 @@ inline ::google::protobuf::Edition FeatureSetDefaults::_internal_maximum_edition } inline void FeatureSetDefaults::_internal_set_maximum_edition(::google::protobuf::Edition value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::Edition_IsValid(value)); - _impl_.maximum_edition_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::Edition_internal_data_)); + _impl_.maximum_edition_ = value; } // ------------------------------------------------------------------- @@ -20351,7 +20705,7 @@ inline const ::google::protobuf::RepeatedField<::int32_t>& SourceCodeInfo_Locati // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path) return _internal_path(); } -inline ::google::protobuf::RepeatedField<::int32_t>* SourceCodeInfo_Location::mutable_path() +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SourceCodeInfo_Location::mutable_path() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -20362,7 +20716,8 @@ SourceCodeInfo_Location::_internal_path() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.path_; } -inline ::google::protobuf::RepeatedField<::int32_t>* SourceCodeInfo_Location::_internal_mutable_path() { +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL +SourceCodeInfo_Location::_internal_mutable_path() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.path_; } @@ -20396,7 +20751,7 @@ inline const ::google::protobuf::RepeatedField<::int32_t>& SourceCodeInfo_Locati // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span) return _internal_span(); } -inline ::google::protobuf::RepeatedField<::int32_t>* SourceCodeInfo_Location::mutable_span() +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SourceCodeInfo_Location::mutable_span() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -20407,7 +20762,8 @@ SourceCodeInfo_Location::_internal_span() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.span_; } -inline ::google::protobuf::RepeatedField<::int32_t>* SourceCodeInfo_Location::_internal_mutable_span() { +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL +SourceCodeInfo_Location::_internal_mutable_span() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.span_; } @@ -20428,14 +20784,14 @@ inline const std::string& SourceCodeInfo_Location::leading_comments() const return _internal_leading_comments(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void SourceCodeInfo_Location::set_leading_comments(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void SourceCodeInfo_Location::set_leading_comments(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.leading_comments_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments) } -inline std::string* SourceCodeInfo_Location::mutable_leading_comments() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL SourceCodeInfo_Location::mutable_leading_comments() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_leading_comments(); // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments) return _s; @@ -20449,12 +20805,12 @@ inline void SourceCodeInfo_Location::_internal_set_leading_comments(const std::s _impl_._has_bits_[0] |= 0x00000001u; _impl_.leading_comments_.Set(value, GetArena()); } -inline std::string* SourceCodeInfo_Location::_internal_mutable_leading_comments() { +inline std::string* PROTOBUF_NONNULL SourceCodeInfo_Location::_internal_mutable_leading_comments() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.leading_comments_.Mutable( GetArena()); } -inline std::string* SourceCodeInfo_Location::release_leading_comments() { +inline std::string* PROTOBUF_NULLABLE SourceCodeInfo_Location::release_leading_comments() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -20467,7 +20823,7 @@ inline std::string* SourceCodeInfo_Location::release_leading_comments() { } return released; } -inline void SourceCodeInfo_Location::set_allocated_leading_comments(std::string* value) { +inline void SourceCodeInfo_Location::set_allocated_leading_comments(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -20497,14 +20853,14 @@ inline const std::string& SourceCodeInfo_Location::trailing_comments() const return _internal_trailing_comments(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void SourceCodeInfo_Location::set_trailing_comments(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void SourceCodeInfo_Location::set_trailing_comments(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; _impl_.trailing_comments_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments) } -inline std::string* SourceCodeInfo_Location::mutable_trailing_comments() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL SourceCodeInfo_Location::mutable_trailing_comments() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_trailing_comments(); // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments) return _s; @@ -20518,12 +20874,12 @@ inline void SourceCodeInfo_Location::_internal_set_trailing_comments(const std:: _impl_._has_bits_[0] |= 0x00000002u; _impl_.trailing_comments_.Set(value, GetArena()); } -inline std::string* SourceCodeInfo_Location::_internal_mutable_trailing_comments() { +inline std::string* PROTOBUF_NONNULL SourceCodeInfo_Location::_internal_mutable_trailing_comments() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000002u; return _impl_.trailing_comments_.Mutable( GetArena()); } -inline std::string* SourceCodeInfo_Location::release_trailing_comments() { +inline std::string* PROTOBUF_NULLABLE SourceCodeInfo_Location::release_trailing_comments() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments) if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { @@ -20536,7 +20892,7 @@ inline std::string* SourceCodeInfo_Location::release_trailing_comments() { } return released; } -inline void SourceCodeInfo_Location::set_allocated_trailing_comments(std::string* value) { +inline void SourceCodeInfo_Location::set_allocated_trailing_comments(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000002u; @@ -20561,7 +20917,8 @@ inline void SourceCodeInfo_Location::clear_leading_detached_comments() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.leading_detached_comments_.Clear(); } -inline std::string* SourceCodeInfo_Location::add_leading_detached_comments() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL SourceCodeInfo_Location::add_leading_detached_comments() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); std::string* _s = _internal_mutable_leading_detached_comments()->Add(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) @@ -20572,16 +20929,15 @@ inline const std::string& SourceCodeInfo_Location::leading_detached_comments(int // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) return _internal_leading_detached_comments().Get(index); } -inline std::string* SourceCodeInfo_Location::mutable_leading_detached_comments(int index) +inline std::string* PROTOBUF_NONNULL SourceCodeInfo_Location::mutable_leading_detached_comments(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) return _internal_mutable_leading_detached_comments()->Mutable(index); } template <typename Arg_, typename... Args_> inline void SourceCodeInfo_Location::set_leading_detached_comments(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString( - *_internal_mutable_leading_detached_comments()->Mutable(index), - std::forward<Arg_>(value), args... ); + ::google::protobuf::internal::AssignToString(*_internal_mutable_leading_detached_comments()->Mutable(index), std::forward<Arg_>(value), + args... ); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) } template <typename Arg_, typename... Args_> @@ -20592,12 +20948,12 @@ inline void SourceCodeInfo_Location::add_leading_detached_comments(Arg_&& value, args... ); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) } -inline const ::google::protobuf::RepeatedPtrField<std::string>& -SourceCodeInfo_Location::leading_detached_comments() const ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline const ::google::protobuf::RepeatedPtrField<std::string>& SourceCodeInfo_Location::leading_detached_comments() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) return _internal_leading_detached_comments(); } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL SourceCodeInfo_Location::mutable_leading_detached_comments() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -20608,7 +20964,7 @@ SourceCodeInfo_Location::_internal_leading_detached_comments() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.leading_detached_comments_; } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL SourceCodeInfo_Location::_internal_mutable_leading_detached_comments() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.leading_detached_comments_; @@ -20629,12 +20985,12 @@ inline void SourceCodeInfo::clear_location() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.location_.Clear(); } -inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) +inline ::google::protobuf::SourceCodeInfo_Location* PROTOBUF_NONNULL SourceCodeInfo::mutable_location(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.location) return _internal_mutable_location()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* SourceCodeInfo::mutable_location() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* PROTOBUF_NONNULL SourceCodeInfo::mutable_location() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -20645,7 +21001,8 @@ inline const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::locati // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location) return _internal_location().Get(index); } -inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::SourceCodeInfo_Location* PROTOBUF_NONNULL SourceCodeInfo::add_location() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::SourceCodeInfo_Location* _add = _internal_mutable_location()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location) @@ -20661,7 +21018,7 @@ SourceCodeInfo::_internal_location() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.location_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::SourceCodeInfo_Location>* PROTOBUF_NONNULL SourceCodeInfo::_internal_mutable_location() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.location_; @@ -20700,7 +21057,7 @@ inline const ::google::protobuf::RepeatedField<::int32_t>& GeneratedCodeInfo_Ann // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) return _internal_path(); } -inline ::google::protobuf::RepeatedField<::int32_t>* GeneratedCodeInfo_Annotation::mutable_path() +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation::mutable_path() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -20711,7 +21068,8 @@ GeneratedCodeInfo_Annotation::_internal_path() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.path_; } -inline ::google::protobuf::RepeatedField<::int32_t>* GeneratedCodeInfo_Annotation::_internal_mutable_path() { +inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL +GeneratedCodeInfo_Annotation::_internal_mutable_path() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.path_; } @@ -20732,14 +21090,14 @@ inline const std::string& GeneratedCodeInfo_Annotation::source_file() const return _internal_source_file(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void GeneratedCodeInfo_Annotation::set_source_file(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void GeneratedCodeInfo_Annotation::set_source_file(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; _impl_.source_file_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file) } -inline std::string* GeneratedCodeInfo_Annotation::mutable_source_file() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation::mutable_source_file() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_source_file(); // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file) return _s; @@ -20753,12 +21111,12 @@ inline void GeneratedCodeInfo_Annotation::_internal_set_source_file(const std::s _impl_._has_bits_[0] |= 0x00000001u; _impl_.source_file_.Set(value, GetArena()); } -inline std::string* GeneratedCodeInfo_Annotation::_internal_mutable_source_file() { +inline std::string* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation::_internal_mutable_source_file() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_._has_bits_[0] |= 0x00000001u; return _impl_.source_file_.Mutable( GetArena()); } -inline std::string* GeneratedCodeInfo_Annotation::release_source_file() { +inline std::string* PROTOBUF_NULLABLE GeneratedCodeInfo_Annotation::release_source_file() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file) if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { @@ -20771,7 +21129,7 @@ inline std::string* GeneratedCodeInfo_Annotation::release_source_file() { } return released; } -inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(std::string* value) { +inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (value != nullptr) { _impl_._has_bits_[0] |= 0x00000001u; @@ -20866,8 +21224,10 @@ inline ::google::protobuf::GeneratedCodeInfo_Annotation_Semantic GeneratedCodeIn } inline void GeneratedCodeInfo_Annotation::_internal_set_semantic(::google::protobuf::GeneratedCodeInfo_Annotation_Semantic value) { ::google::protobuf::internal::TSanWrite(&_impl_); - assert(::google::protobuf::GeneratedCodeInfo_Annotation_Semantic_IsValid(value)); - _impl_.semantic_ = value; + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::GeneratedCodeInfo_Annotation_Semantic_internal_data_)); + _impl_.semantic_ = value; } // ------------------------------------------------------------------- @@ -20885,12 +21245,12 @@ inline void GeneratedCodeInfo::clear_annotation() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.annotation_.Clear(); } -inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) +inline ::google::protobuf::GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL GeneratedCodeInfo::mutable_annotation(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation) return _internal_mutable_annotation()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* GeneratedCodeInfo::mutable_annotation() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* PROTOBUF_NONNULL GeneratedCodeInfo::mutable_annotation() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -20901,7 +21261,8 @@ inline const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) return _internal_annotation().Get(index); } -inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::GeneratedCodeInfo_Annotation* PROTOBUF_NONNULL GeneratedCodeInfo::add_annotation() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::GeneratedCodeInfo_Annotation* _add = _internal_mutable_annotation()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) @@ -20917,7 +21278,7 @@ GeneratedCodeInfo::_internal_annotation() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.annotation_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::GeneratedCodeInfo_Annotation>* PROTOBUF_NONNULL GeneratedCodeInfo::_internal_mutable_annotation() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.annotation_; @@ -20938,103 +21299,109 @@ namespace protobuf { template <> struct is_proto_enum<::google::protobuf::ExtensionRangeOptions_VerificationState> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::ExtensionRangeOptions_VerificationState>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::ExtensionRangeOptions_VerificationState>() { return ::google::protobuf::ExtensionRangeOptions_VerificationState_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FieldDescriptorProto_Type> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FieldDescriptorProto_Type>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FieldDescriptorProto_Type>() { return ::google::protobuf::FieldDescriptorProto_Type_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FieldDescriptorProto_Label> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FieldDescriptorProto_Label>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FieldDescriptorProto_Label>() { return ::google::protobuf::FieldDescriptorProto_Label_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FileOptions_OptimizeMode> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FileOptions_OptimizeMode>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FileOptions_OptimizeMode>() { return ::google::protobuf::FileOptions_OptimizeMode_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FieldOptions_CType> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FieldOptions_CType>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FieldOptions_CType>() { return ::google::protobuf::FieldOptions_CType_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FieldOptions_JSType> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FieldOptions_JSType>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FieldOptions_JSType>() { return ::google::protobuf::FieldOptions_JSType_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FieldOptions_OptionRetention> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FieldOptions_OptionRetention>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FieldOptions_OptionRetention>() { return ::google::protobuf::FieldOptions_OptionRetention_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FieldOptions_OptionTargetType> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FieldOptions_OptionTargetType>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FieldOptions_OptionTargetType>() { return ::google::protobuf::FieldOptions_OptionTargetType_descriptor(); } template <> struct is_proto_enum<::google::protobuf::MethodOptions_IdempotencyLevel> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::MethodOptions_IdempotencyLevel>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::MethodOptions_IdempotencyLevel>() { return ::google::protobuf::MethodOptions_IdempotencyLevel_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FeatureSet_FieldPresence> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FeatureSet_FieldPresence>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_FieldPresence>() { return ::google::protobuf::FeatureSet_FieldPresence_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FeatureSet_EnumType> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FeatureSet_EnumType>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_EnumType>() { return ::google::protobuf::FeatureSet_EnumType_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FeatureSet_RepeatedFieldEncoding> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FeatureSet_RepeatedFieldEncoding>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_RepeatedFieldEncoding>() { return ::google::protobuf::FeatureSet_RepeatedFieldEncoding_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FeatureSet_Utf8Validation> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FeatureSet_Utf8Validation>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_Utf8Validation>() { return ::google::protobuf::FeatureSet_Utf8Validation_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FeatureSet_MessageEncoding> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FeatureSet_MessageEncoding>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_MessageEncoding>() { return ::google::protobuf::FeatureSet_MessageEncoding_descriptor(); } template <> struct is_proto_enum<::google::protobuf::FeatureSet_JsonFormat> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::FeatureSet_JsonFormat>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_JsonFormat>() { return ::google::protobuf::FeatureSet_JsonFormat_descriptor(); } template <> +struct is_proto_enum<::google::protobuf::FeatureSet_EnforceNamingStyle> : std::true_type {}; +template <> +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_EnforceNamingStyle>() { + return ::google::protobuf::FeatureSet_EnforceNamingStyle_descriptor(); +} +template <> struct is_proto_enum<::google::protobuf::GeneratedCodeInfo_Annotation_Semantic> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::GeneratedCodeInfo_Annotation_Semantic>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::GeneratedCodeInfo_Annotation_Semantic>() { return ::google::protobuf::GeneratedCodeInfo_Annotation_Semantic_descriptor(); } template <> struct is_proto_enum<::google::protobuf::Edition> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::Edition>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::Edition>() { return ::google::protobuf::Edition_descriptor(); } diff --git a/third_party/protobuf/src/google/protobuf/descriptor.proto b/third_party/protobuf/src/google/protobuf/descriptor.proto index 6011f72c41503..f63ff196e3519 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor.proto +++ b/third_party/protobuf/src/google/protobuf/descriptor.proto @@ -131,9 +131,15 @@ message FileDescriptorProto { // The supported values are "proto2", "proto3", and "editions". // // If `edition` is present, this value must be "editions". + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional string syntax = 12; // The edition of the proto file. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional Edition edition = 14; } @@ -546,6 +552,9 @@ message FileOptions { optional string ruby_package = 45; // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 50; // The parser stores options it doesn't recognize here. @@ -632,6 +641,9 @@ message MessageOptions { optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 12; // The parser stores options it doesn't recognize here. See above. @@ -772,6 +784,9 @@ message FieldOptions { repeated EditionDefault edition_defaults = 20; // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 21; // Information about the support window of a feature. @@ -808,6 +823,9 @@ message FieldOptions { message OneofOptions { // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 1; // The parser stores options it doesn't recognize here. See above. @@ -840,6 +858,9 @@ message EnumOptions { optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 7; // The parser stores options it doesn't recognize here. See above. @@ -857,6 +878,9 @@ message EnumValueOptions { optional bool deprecated = 1 [default = false]; // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 2; // Indicate that fields annotated with this enum value should not be printed @@ -877,6 +901,9 @@ message EnumValueOptions { message ServiceOptions { // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 34; // Note: Field numbers 1 through 32 are reserved for Google's internal RPC @@ -922,6 +949,9 @@ message MethodOptions { [default = IDEMPOTENCY_UNKNOWN]; // Any features defined in the specific edition. + // WARNING: This field should only be used by protobuf plugins or special + // cases like the proto compiler. Other uses are discouraged and + // developers should rely on the protoreflect APIs for their client language. optional FeatureSet features = 35; // The parser stores options it doesn't recognize here. See above. @@ -1068,6 +1098,29 @@ message FeatureSet { edition_defaults = { edition: EDITION_PROTO3, value: "ALLOW" } ]; + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0; + STYLE2024 = 1; + STYLE_LEGACY = 2; + } + optional EnforceNamingStyle enforce_naming_style = 7 [ + retention = RETENTION_SOURCE, + targets = TARGET_TYPE_FILE, + targets = TARGET_TYPE_EXTENSION_RANGE, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_ONEOF, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_ENUM_ENTRY, + targets = TARGET_TYPE_SERVICE, + targets = TARGET_TYPE_METHOD, + feature_support = { + edition_introduced: EDITION_2024, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "STYLE_LEGACY" }, + edition_defaults = { edition: EDITION_2024, value: "STYLE2024" } + ]; + reserved 999; extensions 1000 to 9994 [ @@ -1082,6 +1135,11 @@ message FeatureSet { type: ".pb.JavaFeatures" }, declaration = { number: 1002, full_name: ".pb.go", type: ".pb.GoFeatures" }, + declaration = { + number: 1003, + full_name: ".pb.python", + type: ".pb.PythonFeatures" + }, declaration = { number: 9990, full_name: ".pb.proto1", diff --git a/third_party/protobuf/src/google/protobuf/descriptor_database.cc b/third_party/protobuf/src/google/protobuf/descriptor_database.cc index 10ebeff62dd34..733c9210c68fd 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor_database.cc +++ b/third_party/protobuf/src/google/protobuf/descriptor_database.cc @@ -12,6 +12,7 @@ #include "google/protobuf/descriptor_database.h" #include <algorithm> +#include <cstdint> #include <string> #include <utility> #include <vector> @@ -22,6 +23,7 @@ #include "absl/strings/str_replace.h" #include "absl/strings/string_view.h" #include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/parse_context.h" namespace google { diff --git a/third_party/protobuf/src/google/protobuf/descriptor_unittest.cc b/third_party/protobuf/src/google/protobuf/descriptor_unittest.cc index c9a109c6691e7..dd17bbeabcbc6 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/descriptor_unittest.cc @@ -20,10 +20,14 @@ #include <cstdlib> #include <deque> #include <functional> +#include <iostream> #include <limits> #include <memory> +#include <ostream> #include <string> +#include <thread> // NOLINT #include <tuple> +#include <type_traits> #include <utility> #include <vector> @@ -42,6 +46,7 @@ #include "absl/log/scoped_mock_log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/match.h" #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -77,7 +82,10 @@ // Must be included last. #include "google/protobuf/port_def.inc" +using ::google::protobuf::internal::cpp::GetFieldHasbitMode; using ::google::protobuf::internal::cpp::GetUtf8CheckMode; +using ::google::protobuf::internal::cpp::HasbitMode; +using ::google::protobuf::internal::cpp::HasHasbit; using ::google::protobuf::internal::cpp::HasPreservingUnknownEnumSemantics; using ::google::protobuf::internal::cpp::Utf8CheckMode; using ::testing::AnyOf; @@ -596,10 +604,10 @@ class SimpleErrorCollector : public io::ErrorCollector { TEST_F(FileDescriptorTest, DebugStringRoundTrip) { absl::flat_hash_set<absl::string_view> visited; std::vector<std::pair<absl::string_view, std::string>> debug_strings; - ExtractDebugString(protobuf_unittest::TestAllTypes::descriptor()->file(), + ExtractDebugString(proto2_unittest::TestAllTypes::descriptor()->file(), &visited, &debug_strings); ExtractDebugString( - protobuf_unittest::TestMessageWithCustomOptions::descriptor()->file(), + proto2_unittest::TestMessageWithCustomOptions::descriptor()->file(), &visited, &debug_strings); ExtractDebugString(proto3_arena_unittest::TestAllTypes::descriptor()->file(), &visited, &debug_strings); @@ -629,7 +637,7 @@ TEST_F(FileDescriptorTest, DebugStringRoundTrip) { TEST_F(FileDescriptorTest, AbslStringifyWorks) { std::string s = absl::StrFormat( "%v", - *protobuf_unittest::TestMessageWithCustomOptions::descriptor()->file()); + *proto2_unittest::TestMessageWithCustomOptions::descriptor()->file()); EXPECT_THAT(s, HasSubstr("TestMessageWithCustomOptions")); } @@ -979,15 +987,15 @@ TEST_F(DescriptorTest, PrintableNameIsFullNameForNonExtensionFields) { } TEST_F(DescriptorTest, PrintableNameIsFullNameForNonMessageSetExtension) { - EXPECT_EQ("protobuf_unittest.Aggregate.nested", - protobuf_unittest::Aggregate::descriptor() + EXPECT_EQ("proto2_unittest.Aggregate.nested", + proto2_unittest::Aggregate::descriptor() ->FindExtensionByName("nested") ->PrintableNameForExtension()); } TEST_F(DescriptorTest, PrintableNameIsExtendingTypeForMessageSetExtension) { - EXPECT_EQ("protobuf_unittest.AggregateMessageSetElement", - protobuf_unittest::AggregateMessageSetElement::descriptor() + EXPECT_EQ("proto2_unittest.AggregateMessageSetElement", + proto2_unittest::AggregateMessageSetElement::descriptor() ->FindExtensionByName("message_set_extension") ->PrintableNameForExtension()); } @@ -1023,7 +1031,7 @@ TEST_F(DescriptorTest, FieldJsonName) { EXPECT_EQ("fieldname7", proto.field(6).json_name()); // Test generated descriptor. - const Descriptor* generated = protobuf_unittest::TestJsonName::descriptor(); + const Descriptor* generated = proto2_unittest::TestJsonName::descriptor(); ASSERT_EQ(7, generated->field_count()); EXPECT_EQ("fieldName1", generated->field(0)->json_name()); EXPECT_EQ("fieldName2", generated->field(1)->json_name()); @@ -2630,7 +2638,7 @@ class MiscTest : public testing::Test { } } - const char* GetTypeNameForFieldType(FieldDescriptor::Type type) { + absl::string_view GetTypeNameForFieldType(FieldDescriptor::Type type) { const FieldDescriptor* field = GetFieldDescriptorOfType(type); return field != nullptr ? field->type_name() : ""; } @@ -2641,7 +2649,7 @@ class MiscTest : public testing::Test { : static_cast<FieldDescriptor::CppType>(0); } - const char* GetCppTypeNameForFieldType(FieldDescriptor::Type type) { + absl::string_view GetCppTypeNameForFieldType(FieldDescriptor::Type type) { const FieldDescriptor* field = GetFieldDescriptorOfType(type); return field != nullptr ? field->cpp_type_name() : ""; } @@ -2666,24 +2674,40 @@ TEST_F(MiscTest, TypeNames) { typedef FieldDescriptor FD; // avoid ugly line wrapping - EXPECT_STREQ("double", GetTypeNameForFieldType(FD::TYPE_DOUBLE)); - EXPECT_STREQ("float", GetTypeNameForFieldType(FD::TYPE_FLOAT)); - EXPECT_STREQ("int64", GetTypeNameForFieldType(FD::TYPE_INT64)); - EXPECT_STREQ("uint64", GetTypeNameForFieldType(FD::TYPE_UINT64)); - EXPECT_STREQ("int32", GetTypeNameForFieldType(FD::TYPE_INT32)); - EXPECT_STREQ("fixed64", GetTypeNameForFieldType(FD::TYPE_FIXED64)); - EXPECT_STREQ("fixed32", GetTypeNameForFieldType(FD::TYPE_FIXED32)); - EXPECT_STREQ("bool", GetTypeNameForFieldType(FD::TYPE_BOOL)); - EXPECT_STREQ("string", GetTypeNameForFieldType(FD::TYPE_STRING)); - EXPECT_STREQ("group", GetTypeNameForFieldType(FD::TYPE_GROUP)); - EXPECT_STREQ("message", GetTypeNameForFieldType(FD::TYPE_MESSAGE)); - EXPECT_STREQ("bytes", GetTypeNameForFieldType(FD::TYPE_BYTES)); - EXPECT_STREQ("uint32", GetTypeNameForFieldType(FD::TYPE_UINT32)); - EXPECT_STREQ("enum", GetTypeNameForFieldType(FD::TYPE_ENUM)); - EXPECT_STREQ("sfixed32", GetTypeNameForFieldType(FD::TYPE_SFIXED32)); - EXPECT_STREQ("sfixed64", GetTypeNameForFieldType(FD::TYPE_SFIXED64)); - EXPECT_STREQ("sint32", GetTypeNameForFieldType(FD::TYPE_SINT32)); - EXPECT_STREQ("sint64", GetTypeNameForFieldType(FD::TYPE_SINT64)); + EXPECT_EQ(absl::string_view("double"), + GetTypeNameForFieldType(FD::TYPE_DOUBLE)); + EXPECT_EQ(absl::string_view("float"), + GetTypeNameForFieldType(FD::TYPE_FLOAT)); + EXPECT_EQ(absl::string_view("int64"), + GetTypeNameForFieldType(FD::TYPE_INT64)); + EXPECT_EQ(absl::string_view("uint64"), + GetTypeNameForFieldType(FD::TYPE_UINT64)); + EXPECT_EQ(absl::string_view("int32"), + GetTypeNameForFieldType(FD::TYPE_INT32)); + EXPECT_EQ(absl::string_view("fixed64"), + GetTypeNameForFieldType(FD::TYPE_FIXED64)); + EXPECT_EQ(absl::string_view("fixed32"), + GetTypeNameForFieldType(FD::TYPE_FIXED32)); + EXPECT_EQ(absl::string_view("bool"), GetTypeNameForFieldType(FD::TYPE_BOOL)); + EXPECT_EQ(absl::string_view("string"), + GetTypeNameForFieldType(FD::TYPE_STRING)); + EXPECT_EQ(absl::string_view("group"), + GetTypeNameForFieldType(FD::TYPE_GROUP)); + EXPECT_EQ(absl::string_view("message"), + GetTypeNameForFieldType(FD::TYPE_MESSAGE)); + EXPECT_EQ(absl::string_view("bytes"), + GetTypeNameForFieldType(FD::TYPE_BYTES)); + EXPECT_EQ(absl::string_view("uint32"), + GetTypeNameForFieldType(FD::TYPE_UINT32)); + EXPECT_EQ(absl::string_view("enum"), GetTypeNameForFieldType(FD::TYPE_ENUM)); + EXPECT_EQ(absl::string_view("sfixed32"), + GetTypeNameForFieldType(FD::TYPE_SFIXED32)); + EXPECT_EQ(absl::string_view("sfixed64"), + GetTypeNameForFieldType(FD::TYPE_SFIXED64)); + EXPECT_EQ(absl::string_view("sint32"), + GetTypeNameForFieldType(FD::TYPE_SINT32)); + EXPECT_EQ(absl::string_view("sint64"), + GetTypeNameForFieldType(FD::TYPE_SINT64)); } TEST_F(MiscTest, StaticTypeNames) { @@ -2691,24 +2715,24 @@ TEST_F(MiscTest, StaticTypeNames) { typedef FieldDescriptor FD; // avoid ugly line wrapping - EXPECT_STREQ("double", FD::TypeName(FD::TYPE_DOUBLE)); - EXPECT_STREQ("float", FD::TypeName(FD::TYPE_FLOAT)); - EXPECT_STREQ("int64", FD::TypeName(FD::TYPE_INT64)); - EXPECT_STREQ("uint64", FD::TypeName(FD::TYPE_UINT64)); - EXPECT_STREQ("int32", FD::TypeName(FD::TYPE_INT32)); - EXPECT_STREQ("fixed64", FD::TypeName(FD::TYPE_FIXED64)); - EXPECT_STREQ("fixed32", FD::TypeName(FD::TYPE_FIXED32)); - EXPECT_STREQ("bool", FD::TypeName(FD::TYPE_BOOL)); - EXPECT_STREQ("string", FD::TypeName(FD::TYPE_STRING)); - EXPECT_STREQ("group", FD::TypeName(FD::TYPE_GROUP)); - EXPECT_STREQ("message", FD::TypeName(FD::TYPE_MESSAGE)); - EXPECT_STREQ("bytes", FD::TypeName(FD::TYPE_BYTES)); - EXPECT_STREQ("uint32", FD::TypeName(FD::TYPE_UINT32)); - EXPECT_STREQ("enum", FD::TypeName(FD::TYPE_ENUM)); - EXPECT_STREQ("sfixed32", FD::TypeName(FD::TYPE_SFIXED32)); - EXPECT_STREQ("sfixed64", FD::TypeName(FD::TYPE_SFIXED64)); - EXPECT_STREQ("sint32", FD::TypeName(FD::TYPE_SINT32)); - EXPECT_STREQ("sint64", FD::TypeName(FD::TYPE_SINT64)); + EXPECT_EQ(absl::string_view("double"), FD::TypeName(FD::TYPE_DOUBLE)); + EXPECT_EQ(absl::string_view("float"), FD::TypeName(FD::TYPE_FLOAT)); + EXPECT_EQ(absl::string_view("int64"), FD::TypeName(FD::TYPE_INT64)); + EXPECT_EQ(absl::string_view("uint64"), FD::TypeName(FD::TYPE_UINT64)); + EXPECT_EQ(absl::string_view("int32"), FD::TypeName(FD::TYPE_INT32)); + EXPECT_EQ(absl::string_view("fixed64"), FD::TypeName(FD::TYPE_FIXED64)); + EXPECT_EQ(absl::string_view("fixed32"), FD::TypeName(FD::TYPE_FIXED32)); + EXPECT_EQ(absl::string_view("bool"), FD::TypeName(FD::TYPE_BOOL)); + EXPECT_EQ(absl::string_view("string"), FD::TypeName(FD::TYPE_STRING)); + EXPECT_EQ(absl::string_view("group"), FD::TypeName(FD::TYPE_GROUP)); + EXPECT_EQ(absl::string_view("message"), FD::TypeName(FD::TYPE_MESSAGE)); + EXPECT_EQ(absl::string_view("bytes"), FD::TypeName(FD::TYPE_BYTES)); + EXPECT_EQ(absl::string_view("uint32"), FD::TypeName(FD::TYPE_UINT32)); + EXPECT_EQ(absl::string_view("enum"), FD::TypeName(FD::TYPE_ENUM)); + EXPECT_EQ(absl::string_view("sfixed32"), FD::TypeName(FD::TYPE_SFIXED32)); + EXPECT_EQ(absl::string_view("sfixed64"), FD::TypeName(FD::TYPE_SFIXED64)); + EXPECT_EQ(absl::string_view("sint32"), FD::TypeName(FD::TYPE_SINT32)); + EXPECT_EQ(absl::string_view("sint64"), FD::TypeName(FD::TYPE_SINT64)); } TEST_F(MiscTest, CppTypes) { @@ -2741,24 +2765,42 @@ TEST_F(MiscTest, CppTypeNames) { typedef FieldDescriptor FD; // avoid ugly line wrapping - EXPECT_STREQ("double", GetCppTypeNameForFieldType(FD::TYPE_DOUBLE)); - EXPECT_STREQ("float", GetCppTypeNameForFieldType(FD::TYPE_FLOAT)); - EXPECT_STREQ("int64", GetCppTypeNameForFieldType(FD::TYPE_INT64)); - EXPECT_STREQ("uint64", GetCppTypeNameForFieldType(FD::TYPE_UINT64)); - EXPECT_STREQ("int32", GetCppTypeNameForFieldType(FD::TYPE_INT32)); - EXPECT_STREQ("uint64", GetCppTypeNameForFieldType(FD::TYPE_FIXED64)); - EXPECT_STREQ("uint32", GetCppTypeNameForFieldType(FD::TYPE_FIXED32)); - EXPECT_STREQ("bool", GetCppTypeNameForFieldType(FD::TYPE_BOOL)); - EXPECT_STREQ("string", GetCppTypeNameForFieldType(FD::TYPE_STRING)); - EXPECT_STREQ("message", GetCppTypeNameForFieldType(FD::TYPE_GROUP)); - EXPECT_STREQ("message", GetCppTypeNameForFieldType(FD::TYPE_MESSAGE)); - EXPECT_STREQ("string", GetCppTypeNameForFieldType(FD::TYPE_BYTES)); - EXPECT_STREQ("uint32", GetCppTypeNameForFieldType(FD::TYPE_UINT32)); - EXPECT_STREQ("enum", GetCppTypeNameForFieldType(FD::TYPE_ENUM)); - EXPECT_STREQ("int32", GetCppTypeNameForFieldType(FD::TYPE_SFIXED32)); - EXPECT_STREQ("int64", GetCppTypeNameForFieldType(FD::TYPE_SFIXED64)); - EXPECT_STREQ("int32", GetCppTypeNameForFieldType(FD::TYPE_SINT32)); - EXPECT_STREQ("int64", GetCppTypeNameForFieldType(FD::TYPE_SINT64)); + EXPECT_EQ(absl::string_view("double"), + GetCppTypeNameForFieldType(FD::TYPE_DOUBLE)); + EXPECT_EQ(absl::string_view("float"), + GetCppTypeNameForFieldType(FD::TYPE_FLOAT)); + EXPECT_EQ(absl::string_view("int64"), + GetCppTypeNameForFieldType(FD::TYPE_INT64)); + EXPECT_EQ(absl::string_view("uint64"), + GetCppTypeNameForFieldType(FD::TYPE_UINT64)); + EXPECT_EQ(absl::string_view("int32"), + GetCppTypeNameForFieldType(FD::TYPE_INT32)); + EXPECT_EQ(absl::string_view("uint64"), + GetCppTypeNameForFieldType(FD::TYPE_FIXED64)); + EXPECT_EQ(absl::string_view("uint32"), + GetCppTypeNameForFieldType(FD::TYPE_FIXED32)); + EXPECT_EQ(absl::string_view("bool"), + GetCppTypeNameForFieldType(FD::TYPE_BOOL)); + EXPECT_EQ(absl::string_view("string"), + GetCppTypeNameForFieldType(FD::TYPE_STRING)); + EXPECT_EQ(absl::string_view("message"), + GetCppTypeNameForFieldType(FD::TYPE_GROUP)); + EXPECT_EQ(absl::string_view("message"), + GetCppTypeNameForFieldType(FD::TYPE_MESSAGE)); + EXPECT_EQ(absl::string_view("string"), + GetCppTypeNameForFieldType(FD::TYPE_BYTES)); + EXPECT_EQ(absl::string_view("uint32"), + GetCppTypeNameForFieldType(FD::TYPE_UINT32)); + EXPECT_EQ(absl::string_view("enum"), + GetCppTypeNameForFieldType(FD::TYPE_ENUM)); + EXPECT_EQ(absl::string_view("int32"), + GetCppTypeNameForFieldType(FD::TYPE_SFIXED32)); + EXPECT_EQ(absl::string_view("int64"), + GetCppTypeNameForFieldType(FD::TYPE_SFIXED64)); + EXPECT_EQ(absl::string_view("int32"), + GetCppTypeNameForFieldType(FD::TYPE_SINT32)); + EXPECT_EQ(absl::string_view("int64"), + GetCppTypeNameForFieldType(FD::TYPE_SINT64)); } TEST_F(MiscTest, StaticCppTypeNames) { @@ -2766,16 +2808,16 @@ TEST_F(MiscTest, StaticCppTypeNames) { typedef FieldDescriptor FD; // avoid ugly line wrapping - EXPECT_STREQ("int32", FD::CppTypeName(FD::CPPTYPE_INT32)); - EXPECT_STREQ("int64", FD::CppTypeName(FD::CPPTYPE_INT64)); - EXPECT_STREQ("uint32", FD::CppTypeName(FD::CPPTYPE_UINT32)); - EXPECT_STREQ("uint64", FD::CppTypeName(FD::CPPTYPE_UINT64)); - EXPECT_STREQ("double", FD::CppTypeName(FD::CPPTYPE_DOUBLE)); - EXPECT_STREQ("float", FD::CppTypeName(FD::CPPTYPE_FLOAT)); - EXPECT_STREQ("bool", FD::CppTypeName(FD::CPPTYPE_BOOL)); - EXPECT_STREQ("enum", FD::CppTypeName(FD::CPPTYPE_ENUM)); - EXPECT_STREQ("string", FD::CppTypeName(FD::CPPTYPE_STRING)); - EXPECT_STREQ("message", FD::CppTypeName(FD::CPPTYPE_MESSAGE)); + EXPECT_EQ(absl::string_view("int32"), FD::CppTypeName(FD::CPPTYPE_INT32)); + EXPECT_EQ(absl::string_view("int64"), FD::CppTypeName(FD::CPPTYPE_INT64)); + EXPECT_EQ(absl::string_view("uint32"), FD::CppTypeName(FD::CPPTYPE_UINT32)); + EXPECT_EQ(absl::string_view("uint64"), FD::CppTypeName(FD::CPPTYPE_UINT64)); + EXPECT_EQ(absl::string_view("double"), FD::CppTypeName(FD::CPPTYPE_DOUBLE)); + EXPECT_EQ(absl::string_view("float"), FD::CppTypeName(FD::CPPTYPE_FLOAT)); + EXPECT_EQ(absl::string_view("bool"), FD::CppTypeName(FD::CPPTYPE_BOOL)); + EXPECT_EQ(absl::string_view("enum"), FD::CppTypeName(FD::CPPTYPE_ENUM)); + EXPECT_EQ(absl::string_view("string"), FD::CppTypeName(FD::CPPTYPE_STRING)); + EXPECT_EQ(absl::string_view("message"), FD::CppTypeName(FD::CPPTYPE_MESSAGE)); } TEST_F(MiscTest, MessageType) { @@ -2990,10 +3032,340 @@ TEST_F(MiscTest, FieldOptions) { // "bar" had options set. EXPECT_NE(&FieldOptions::default_instance(), options); - EXPECT_TRUE(bar->options().has_ctype()); - EXPECT_EQ(FieldOptions::CORD, bar->options().ctype()); + EXPECT_EQ(bar->cpp_string_type(), FieldDescriptor::CppStringType::kCord); } +// =================================================================== + +struct HasHasbitTestParam { + struct ExpectedOutput { + HasbitMode expected_hasbitmode; + bool expected_has_presence; + bool expected_has_hasbit; + }; + + std::string input_foo_proto; + ExpectedOutput expected_output; + bool is_extension = false; +}; + +class HasHasbitTest : public testing::TestWithParam<HasHasbitTestParam> { + protected: + void SetUp() override { + ASSERT_TRUE( + TextFormat::ParseFromString(GetParam().input_foo_proto, &foo_proto_)); + foo_ = pool_.BuildFile(foo_proto_); + } + + const FieldDescriptor* GetField() { + if (GetParam().is_extension) { + return foo_->message_type(0)->extension(0); + } else { + return foo_->message_type(0)->field(0); + } + } + + DescriptorPool pool_; + FileDescriptorProto foo_proto_; + const FileDescriptor* foo_; +}; + +TEST_P(HasHasbitTest, TestHasHasbitExplicitPresence) { + EXPECT_EQ(GetField()->has_presence(), + GetParam().expected_output.expected_has_presence); + EXPECT_EQ(GetFieldHasbitMode(GetField()), + GetParam().expected_output.expected_hasbitmode); + EXPECT_EQ(HasHasbit(GetField()), + GetParam().expected_output.expected_has_hasbit); +} + +// NOTE: with C++20 we can use designated initializers to ensure +// that struct members match commented names, but as we are still working with +// C++17 in the foreseeable future, we won't be able to refactor this for a +// while... +// https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md +INSTANTIATE_TEST_SUITE_P( + HasHasbitLegacySyntaxTests, HasHasbitTest, + testing::Values( + // Test case: proto2 singular fields + HasHasbitTestParam{R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'proto2' + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_INT64 + label: LABEL_OPTIONAL + } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kTrueHasbit, + /*expected_has_presence=*/true, + /*expected_has_hasbit=*/true, + }}, + // Test case: proto2 repeated fields + HasHasbitTestParam{R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'proto2' + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_STRING + label: LABEL_REPEATED + } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kNoHasbit, + /*expected_has_presence=*/false, + /*expected_has_hasbit=*/false, + }}, + // Test case: proto3 singular fields + HasHasbitTestParam{R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'proto3' + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_INT64 + label: LABEL_OPTIONAL + } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kHintHasbit, + /*expected_has_presence=*/false, + /*expected_has_hasbit=*/true, + }}, + // Test case: proto3 optional fields + HasHasbitTestParam{ + R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'proto3' + message_type { + name: 'Foo' + field { + name: 'int_field' + number: 1 + type: TYPE_INT32 + label: LABEL_OPTIONAL + oneof_index: 0 + proto3_optional: true + } + oneof_decl { name: '_int_field' } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kTrueHasbit, + /*expected_has_presence=*/true, + /*expected_has_hasbit=*/true, + }}, + // Test case: proto3 repeated fields + HasHasbitTestParam{R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'proto3' + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_STRING + label: LABEL_REPEATED + } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kNoHasbit, + /*expected_has_presence=*/false, + /*expected_has_hasbit=*/false, + }}, + // Test case: proto2 extension fields. + // Note that extension fields don't have hasbits. + HasHasbitTestParam{ + R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'proto2' + message_type { + name: "FooMessage" + extension { + name: "foo" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_INT32 + extendee: "FooMessage2" + } + } + message_type { + name: "FooMessage2" + extension_range { start: 1 end: 2 } + } + )pb", + /*expected_output=*/ + { + /*expected_hasbitmode=*/HasbitMode::kNoHasbit, + /*expected_has_presence=*/true, + /*expected_has_hasbit=*/false, + }, + /*is_extension=*/true})); + +// NOTE: with C++20 we can use designated initializers to ensure +// that struct members match commented names, but as we are still working with +// C++17 in the foreseeable future, we won't be able to refactor this for a +// while... +// https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md +INSTANTIATE_TEST_SUITE_P( + HasHasbitEditionsTests, HasHasbitTest, + testing::Values( + // Test case: explicit-presence, singular fields + HasHasbitTestParam{ + R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'editions' + edition: EDITION_2023 + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_INT64 + options { features { field_presence: EXPLICIT } } + } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kTrueHasbit, + /*expected_has_presence=*/true, + /*expected_has_hasbit=*/true, + }}, + // Test case: implicit-presence, singular fields + HasHasbitTestParam{ + R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'editions' + edition: EDITION_2023 + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_INT64 + options { features { field_presence: IMPLICIT } } + } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kHintHasbit, + /*expected_has_presence=*/false, + /*expected_has_hasbit=*/true, + }}, + // Test case: oneof fields. + // Note that oneof fields can't specify field presence. + HasHasbitTestParam{ + R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'editions' + edition: EDITION_2023 + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_STRING + oneof_index: 0 + } + oneof_decl { name: "onebar" } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kNoHasbit, + /*expected_has_presence=*/true, + /*expected_has_hasbit=*/false, + }}, + // Test case: message fields. + // Note that message fields cannot specify implicit presence. + HasHasbitTestParam{ + R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'editions' + edition: EDITION_2023 + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_MESSAGE + type_name: "Bar" + } + } + message_type { + name: 'Bar' + field { name: 'int_field' number: 1 type: TYPE_INT32 } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kTrueHasbit, + /*expected_has_presence=*/true, + /*expected_has_hasbit=*/true, + }}, + // Test case: repeated fields. + // Note that repeated fields can't specify presence. + HasHasbitTestParam{R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'editions' + edition: EDITION_2023 + message_type { + name: 'FooMessage' + field { + name: 'f' + number: 1 + type: TYPE_STRING + label: LABEL_REPEATED + } + } + )pb", + /*expected_output=*/{ + /*expected_hasbitmode=*/HasbitMode::kNoHasbit, + /*expected_has_presence=*/false, + /*expected_has_hasbit=*/false, + }}, + // Test case: extension fields. + // Note that extension fields don't have hasbits. + HasHasbitTestParam{ + R"pb(name: 'foo.proto' + package: 'foo' + syntax: 'editions' + edition: EDITION_2023 + message_type { + name: "FooMessage" + extension { + name: "foo" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_INT32 + extendee: "FooMessage2" + } + } + message_type { + name: "FooMessage2" + extension_range { start: 1 end: 2 } + } + )pb", + /*expected_output=*/ + { + /*expected_hasbitmode=*/HasbitMode::kNoHasbit, + /*expected_has_presence=*/true, + /*expected_has_hasbit=*/false, + }, + /*is_extension=*/true})); + + // =================================================================== enum DescriptorPoolMode { NO_DATABASE, FALLBACK_DATABASE }; @@ -3332,7 +3704,7 @@ INSTANTIATE_TEST_SUITE_P(DatabaseSource, AllowUnknownDependenciesTest, TEST(CustomOptions, OptionLocations) { const Descriptor* message = - protobuf_unittest::TestMessageWithCustomOptions::descriptor(); + proto2_unittest::TestMessageWithCustomOptions::descriptor(); const FileDescriptor* file = message->file(); const FieldDescriptor* field = message->FindFieldByName("field1"); const OneofDescriptor* oneof = message->FindOneofByName("AnOneof"); @@ -3344,27 +3716,27 @@ TEST(CustomOptions, OptionLocations) { const MethodDescriptor* method = service->FindMethodByName("Foo"); EXPECT_EQ(int64_t{9876543210}, - file->options().GetExtension(protobuf_unittest::file_opt1)); + file->options().GetExtension(proto2_unittest::file_opt1)); EXPECT_EQ(-56, - message->options().GetExtension(protobuf_unittest::message_opt1)); + message->options().GetExtension(proto2_unittest::message_opt1)); EXPECT_EQ(int64_t{8765432109}, - field->options().GetExtension(protobuf_unittest::field_opt1)); + field->options().GetExtension(proto2_unittest::field_opt1)); EXPECT_EQ(42, // Check that we get the default for an option we don't set. - field->options().GetExtension(protobuf_unittest::field_opt2)); - EXPECT_EQ(-99, oneof->options().GetExtension(protobuf_unittest::oneof_opt1)); + field->options().GetExtension(proto2_unittest::field_opt2)); + EXPECT_EQ(-99, oneof->options().GetExtension(proto2_unittest::oneof_opt1)); EXPECT_EQ(int64_t{12345}, - map_field->options().GetExtension(protobuf_unittest::field_opt1)); - EXPECT_EQ(-789, enm->options().GetExtension(protobuf_unittest::enum_opt1)); + map_field->options().GetExtension(proto2_unittest::field_opt1)); + EXPECT_EQ(-789, enm->options().GetExtension(proto2_unittest::enum_opt1)); EXPECT_EQ(123, enm->value(1)->options().GetExtension( - protobuf_unittest::enum_value_opt1)); + proto2_unittest::enum_value_opt1)); EXPECT_EQ(int64_t{-9876543210}, - service->options().GetExtension(protobuf_unittest::service_opt1)); - EXPECT_EQ(protobuf_unittest::METHODOPT1_VAL2, - method->options().GetExtension(protobuf_unittest::method_opt1)); + service->options().GetExtension(proto2_unittest::service_opt1)); + EXPECT_EQ(proto2_unittest::METHODOPT1_VAL2, + method->options().GetExtension(proto2_unittest::method_opt1)); // See that the regular options went through unscathed. EXPECT_TRUE(message->options().has_message_set_wire_format()); - EXPECT_EQ(FieldOptions::CORD, field->options().ctype()); + EXPECT_EQ(field->cpp_string_type(), FieldDescriptor::CppStringType::kString); } TEST(CustomOptions, OptionTypes) { @@ -3378,110 +3750,110 @@ TEST(CustomOptions, OptionTypes) { constexpr uint64_t kuint64max = std::numeric_limits<uint64_t>::max(); options = - &protobuf_unittest::CustomOptionMinIntegerValues::descriptor()->options(); - EXPECT_EQ(false, options->GetExtension(protobuf_unittest::bool_opt)); - EXPECT_EQ(kint32min, options->GetExtension(protobuf_unittest::int32_opt)); - EXPECT_EQ(kint64min, options->GetExtension(protobuf_unittest::int64_opt)); - EXPECT_EQ(0, options->GetExtension(protobuf_unittest::uint32_opt)); - EXPECT_EQ(0, options->GetExtension(protobuf_unittest::uint64_opt)); - EXPECT_EQ(kint32min, options->GetExtension(protobuf_unittest::sint32_opt)); - EXPECT_EQ(kint64min, options->GetExtension(protobuf_unittest::sint64_opt)); - EXPECT_EQ(0, options->GetExtension(protobuf_unittest::fixed32_opt)); - EXPECT_EQ(0, options->GetExtension(protobuf_unittest::fixed64_opt)); - EXPECT_EQ(kint32min, options->GetExtension(protobuf_unittest::sfixed32_opt)); - EXPECT_EQ(kint64min, options->GetExtension(protobuf_unittest::sfixed64_opt)); + &proto2_unittest::CustomOptionMinIntegerValues::descriptor()->options(); + EXPECT_EQ(false, options->GetExtension(proto2_unittest::bool_opt)); + EXPECT_EQ(kint32min, options->GetExtension(proto2_unittest::int32_opt)); + EXPECT_EQ(kint64min, options->GetExtension(proto2_unittest::int64_opt)); + EXPECT_EQ(0, options->GetExtension(proto2_unittest::uint32_opt)); + EXPECT_EQ(0, options->GetExtension(proto2_unittest::uint64_opt)); + EXPECT_EQ(kint32min, options->GetExtension(proto2_unittest::sint32_opt)); + EXPECT_EQ(kint64min, options->GetExtension(proto2_unittest::sint64_opt)); + EXPECT_EQ(0, options->GetExtension(proto2_unittest::fixed32_opt)); + EXPECT_EQ(0, options->GetExtension(proto2_unittest::fixed64_opt)); + EXPECT_EQ(kint32min, options->GetExtension(proto2_unittest::sfixed32_opt)); + EXPECT_EQ(kint64min, options->GetExtension(proto2_unittest::sfixed64_opt)); options = - &protobuf_unittest::CustomOptionMaxIntegerValues::descriptor()->options(); - EXPECT_EQ(true, options->GetExtension(protobuf_unittest::bool_opt)); - EXPECT_EQ(kint32max, options->GetExtension(protobuf_unittest::int32_opt)); - EXPECT_EQ(kint64max, options->GetExtension(protobuf_unittest::int64_opt)); - EXPECT_EQ(kuint32max, options->GetExtension(protobuf_unittest::uint32_opt)); - EXPECT_EQ(kuint64max, options->GetExtension(protobuf_unittest::uint64_opt)); - EXPECT_EQ(kint32max, options->GetExtension(protobuf_unittest::sint32_opt)); - EXPECT_EQ(kint64max, options->GetExtension(protobuf_unittest::sint64_opt)); - EXPECT_EQ(kuint32max, options->GetExtension(protobuf_unittest::fixed32_opt)); - EXPECT_EQ(kuint64max, options->GetExtension(protobuf_unittest::fixed64_opt)); - EXPECT_EQ(kint32max, options->GetExtension(protobuf_unittest::sfixed32_opt)); - EXPECT_EQ(kint64max, options->GetExtension(protobuf_unittest::sfixed64_opt)); + &proto2_unittest::CustomOptionMaxIntegerValues::descriptor()->options(); + EXPECT_EQ(true, options->GetExtension(proto2_unittest::bool_opt)); + EXPECT_EQ(kint32max, options->GetExtension(proto2_unittest::int32_opt)); + EXPECT_EQ(kint64max, options->GetExtension(proto2_unittest::int64_opt)); + EXPECT_EQ(kuint32max, options->GetExtension(proto2_unittest::uint32_opt)); + EXPECT_EQ(kuint64max, options->GetExtension(proto2_unittest::uint64_opt)); + EXPECT_EQ(kint32max, options->GetExtension(proto2_unittest::sint32_opt)); + EXPECT_EQ(kint64max, options->GetExtension(proto2_unittest::sint64_opt)); + EXPECT_EQ(kuint32max, options->GetExtension(proto2_unittest::fixed32_opt)); + EXPECT_EQ(kuint64max, options->GetExtension(proto2_unittest::fixed64_opt)); + EXPECT_EQ(kint32max, options->GetExtension(proto2_unittest::sfixed32_opt)); + EXPECT_EQ(kint64max, options->GetExtension(proto2_unittest::sfixed64_opt)); - options = &protobuf_unittest::CustomOptionOtherValues::descriptor()->options(); - EXPECT_EQ(-100, options->GetExtension(protobuf_unittest::int32_opt)); + options = &proto2_unittest::CustomOptionOtherValues::descriptor()->options(); + EXPECT_EQ(-100, options->GetExtension(proto2_unittest::int32_opt)); EXPECT_FLOAT_EQ(12.3456789, - options->GetExtension(protobuf_unittest::float_opt)); + options->GetExtension(proto2_unittest::float_opt)); EXPECT_DOUBLE_EQ(1.234567890123456789, - options->GetExtension(protobuf_unittest::double_opt)); + options->GetExtension(proto2_unittest::double_opt)); EXPECT_EQ("Hello, \"World\"", - options->GetExtension(protobuf_unittest::string_opt)); + options->GetExtension(proto2_unittest::string_opt)); EXPECT_EQ(std::string("Hello\0World", 11), - options->GetExtension(protobuf_unittest::bytes_opt)); + options->GetExtension(proto2_unittest::bytes_opt)); - EXPECT_EQ(protobuf_unittest::DummyMessageContainingEnum::TEST_OPTION_ENUM_TYPE2, - options->GetExtension(protobuf_unittest::enum_opt)); + EXPECT_EQ(proto2_unittest::DummyMessageContainingEnum::TEST_OPTION_ENUM_TYPE2, + options->GetExtension(proto2_unittest::enum_opt)); options = - &protobuf_unittest::SettingRealsFromPositiveInts::descriptor()->options(); - EXPECT_FLOAT_EQ(12, options->GetExtension(protobuf_unittest::float_opt)); - EXPECT_DOUBLE_EQ(154, options->GetExtension(protobuf_unittest::double_opt)); + &proto2_unittest::SettingRealsFromPositiveInts::descriptor()->options(); + EXPECT_FLOAT_EQ(12, options->GetExtension(proto2_unittest::float_opt)); + EXPECT_DOUBLE_EQ(154, options->GetExtension(proto2_unittest::double_opt)); options = - &protobuf_unittest::SettingRealsFromNegativeInts::descriptor()->options(); - EXPECT_FLOAT_EQ(-12, options->GetExtension(protobuf_unittest::float_opt)); - EXPECT_DOUBLE_EQ(-154, options->GetExtension(protobuf_unittest::double_opt)); + &proto2_unittest::SettingRealsFromNegativeInts::descriptor()->options(); + EXPECT_FLOAT_EQ(-12, options->GetExtension(proto2_unittest::float_opt)); + EXPECT_DOUBLE_EQ(-154, options->GetExtension(proto2_unittest::double_opt)); } TEST(CustomOptions, ComplexExtensionOptions) { const MessageOptions* options = - &protobuf_unittest::VariousComplexOptions::descriptor()->options(); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt1).foo(), 42); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt1) - .GetExtension(protobuf_unittest::mooo), + &proto2_unittest::VariousComplexOptions::descriptor()->options(); + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt1).foo(), 42); + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt1) + .GetExtension(proto2_unittest::mooo), 324); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt1) - .GetExtension(protobuf_unittest::corge) + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt1) + .GetExtension(proto2_unittest::corge) .moo(), 876); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2).baz(), 987); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2) - .GetExtension(protobuf_unittest::grault), + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2).baz(), 987); + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2) + .GetExtension(proto2_unittest::grault), 654); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2).bar().foo(), + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2).bar().foo(), 743); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2) + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2) .bar() - .GetExtension(protobuf_unittest::mooo), + .GetExtension(proto2_unittest::mooo), 1999); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2) + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2) .bar() - .GetExtension(protobuf_unittest::corge) + .GetExtension(proto2_unittest::corge) .moo(), 2008); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2) - .GetExtension(protobuf_unittest::garply) + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2) + .GetExtension(proto2_unittest::garply) .foo(), 741); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2) - .GetExtension(protobuf_unittest::garply) - .GetExtension(protobuf_unittest::mooo), + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2) + .GetExtension(proto2_unittest::garply) + .GetExtension(proto2_unittest::mooo), 1998); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2) - .GetExtension(protobuf_unittest::garply) - .GetExtension(protobuf_unittest::corge) + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2) + .GetExtension(proto2_unittest::garply) + .GetExtension(proto2_unittest::corge) .moo(), 2121); EXPECT_EQ(options - ->GetExtension(protobuf_unittest::ComplexOptionType2:: + ->GetExtension(proto2_unittest::ComplexOptionType2:: ComplexOptionType4::complex_opt4) .waldo(), 1971); - EXPECT_EQ(options->GetExtension(protobuf_unittest::complex_opt2).fred().waldo(), + EXPECT_EQ(options->GetExtension(proto2_unittest::complex_opt2).fred().waldo(), 321); - EXPECT_EQ(9, options->GetExtension(protobuf_unittest::complex_opt3).moo()); - EXPECT_EQ(22, options->GetExtension(protobuf_unittest::complex_opt3) + EXPECT_EQ(9, options->GetExtension(proto2_unittest::complex_opt3).moo()); + EXPECT_EQ(22, options->GetExtension(proto2_unittest::complex_opt3) .complexoptiontype5() .plugh()); - EXPECT_EQ(24, options->GetExtension(protobuf_unittest::complexopt6).xyzzy()); + EXPECT_EQ(24, options->GetExtension(proto2_unittest::complexopt6).xyzzy()); } TEST(CustomOptions, OptionsFromOtherFile) { @@ -3500,13 +3872,13 @@ TEST(CustomOptions, OptionsFromOtherFile) { ASSERT_TRUE(pool.BuildFile(any_proto) != nullptr); } FileDescriptorProto file_proto; - protobuf_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( + proto2_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( &file_proto); ASSERT_TRUE(pool.BuildFile(file_proto) != nullptr); ASSERT_TRUE(TextFormat::ParseFromString( "name: \"custom_options_import.proto\" " - "package: \"protobuf_unittest\" " + "package: \"proto2_unittest\" " "dependency: \"google/protobuf/unittest_custom_options.proto\" " "options { " " uninterpreted_option { " @@ -3539,7 +3911,7 @@ TEST(CustomOptions, OptionsFromOtherFile) { const FileDescriptor* file = pool.BuildFile(file_proto); ASSERT_TRUE(file != nullptr); - EXPECT_EQ(1234, file->options().GetExtension(protobuf_unittest::file_opt1)); + EXPECT_EQ(1234, file->options().GetExtension(proto2_unittest::file_opt1)); EXPECT_TRUE(file->options().has_java_package()); EXPECT_EQ("foo", file->options().java_package()); EXPECT_TRUE(file->options().has_optimize_for()); @@ -3565,14 +3937,14 @@ TEST(CustomOptions, MessageOptionThreeFieldsSet) { ASSERT_TRUE(pool.BuildFile(any_proto) != nullptr); } FileDescriptorProto file_proto; - protobuf_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( + proto2_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( &file_proto); ASSERT_TRUE(pool.BuildFile(file_proto) != nullptr); // The following represents the definition: // // import "google/protobuf/unittest_custom_options.proto" - // package protobuf_unittest; + // package proto2_unittest; // message Foo { // option (complex_opt1).foo = 1234; // option (complex_opt1).foo2 = 1234; @@ -3580,7 +3952,7 @@ TEST(CustomOptions, MessageOptionThreeFieldsSet) { // } ASSERT_TRUE(TextFormat::ParseFromString( "name: \"custom_options_import.proto\" " - "package: \"protobuf_unittest\" " + "package: \"proto2_unittest\" " "dependency: \"google/protobuf/unittest_custom_options.proto\" " "message_type { " " name: \"Foo\" " @@ -3627,7 +3999,7 @@ TEST(CustomOptions, MessageOptionThreeFieldsSet) { ASSERT_EQ(1, file->message_type_count()); const MessageOptions& options = file->message_type(0)->options(); - EXPECT_EQ(1234, options.GetExtension(protobuf_unittest::complex_opt1).foo()); + EXPECT_EQ(1234, options.GetExtension(proto2_unittest::complex_opt1).foo()); } TEST(CustomOptions, MessageOptionRepeatedLeafFieldSet) { @@ -3649,14 +4021,14 @@ TEST(CustomOptions, MessageOptionRepeatedLeafFieldSet) { ASSERT_TRUE(pool.BuildFile(any_proto) != nullptr); } FileDescriptorProto file_proto; - protobuf_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( + proto2_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( &file_proto); ASSERT_TRUE(pool.BuildFile(file_proto) != nullptr); // The following represents the definition: // // import "google/protobuf/unittest_custom_options.proto" - // package protobuf_unittest; + // package proto2_unittest; // message Foo { // option (complex_opt1).foo4 = 12; // option (complex_opt1).foo4 = 34; @@ -3664,7 +4036,7 @@ TEST(CustomOptions, MessageOptionRepeatedLeafFieldSet) { // } ASSERT_TRUE(TextFormat::ParseFromString( "name: \"custom_options_import.proto\" " - "package: \"protobuf_unittest\" " + "package: \"proto2_unittest\" " "dependency: \"google/protobuf/unittest_custom_options.proto\" " "message_type { " " name: \"Foo\" " @@ -3711,10 +4083,10 @@ TEST(CustomOptions, MessageOptionRepeatedLeafFieldSet) { ASSERT_EQ(1, file->message_type_count()); const MessageOptions& options = file->message_type(0)->options(); - EXPECT_EQ(3, options.GetExtension(protobuf_unittest::complex_opt1).foo4_size()); - EXPECT_EQ(12, options.GetExtension(protobuf_unittest::complex_opt1).foo4(0)); - EXPECT_EQ(34, options.GetExtension(protobuf_unittest::complex_opt1).foo4(1)); - EXPECT_EQ(56, options.GetExtension(protobuf_unittest::complex_opt1).foo4(2)); + EXPECT_EQ(3, options.GetExtension(proto2_unittest::complex_opt1).foo4_size()); + EXPECT_EQ(12, options.GetExtension(proto2_unittest::complex_opt1).foo4(0)); + EXPECT_EQ(34, options.GetExtension(proto2_unittest::complex_opt1).foo4(1)); + EXPECT_EQ(56, options.GetExtension(proto2_unittest::complex_opt1).foo4(2)); } TEST(CustomOptions, MessageOptionRepeatedMsgFieldSet) { @@ -3736,14 +4108,14 @@ TEST(CustomOptions, MessageOptionRepeatedMsgFieldSet) { ASSERT_TRUE(pool.BuildFile(any_proto) != nullptr); } FileDescriptorProto file_proto; - protobuf_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( + proto2_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( &file_proto); ASSERT_TRUE(pool.BuildFile(file_proto) != nullptr); // The following represents the definition: // // import "google/protobuf/unittest_custom_options.proto" - // package protobuf_unittest; + // package proto2_unittest; // message Foo { // option (complex_opt2).barney = {waldo: 1}; // option (complex_opt2).barney = {waldo: 10}; @@ -3751,7 +4123,7 @@ TEST(CustomOptions, MessageOptionRepeatedMsgFieldSet) { // } ASSERT_TRUE(TextFormat::ParseFromString( "name: \"custom_options_import.proto\" " - "package: \"protobuf_unittest\" " + "package: \"proto2_unittest\" " "dependency: \"google/protobuf/unittest_custom_options.proto\" " "message_type { " " name: \"Foo\" " @@ -3799,21 +4171,21 @@ TEST(CustomOptions, MessageOptionRepeatedMsgFieldSet) { const MessageOptions& options = file->message_type(0)->options(); EXPECT_EQ(3, - options.GetExtension(protobuf_unittest::complex_opt2).barney_size()); + options.GetExtension(proto2_unittest::complex_opt2).barney_size()); EXPECT_EQ( - 1, options.GetExtension(protobuf_unittest::complex_opt2).barney(0).waldo()); + 1, options.GetExtension(proto2_unittest::complex_opt2).barney(0).waldo()); EXPECT_EQ( 10, - options.GetExtension(protobuf_unittest::complex_opt2).barney(1).waldo()); + options.GetExtension(proto2_unittest::complex_opt2).barney(1).waldo()); EXPECT_EQ( 100, - options.GetExtension(protobuf_unittest::complex_opt2).barney(2).waldo()); + options.GetExtension(proto2_unittest::complex_opt2).barney(2).waldo()); } // Check that aggregate options were parsed and saved correctly in // the appropriate descriptors. TEST(CustomOptions, AggregateOptions) { - const Descriptor* msg = protobuf_unittest::AggregateMessage::descriptor(); + const Descriptor* msg = proto2_unittest::AggregateMessage::descriptor(); const FileDescriptor* file = msg->file(); const FieldDescriptor* field = msg->FindFieldByName("fieldname"); const EnumDescriptor* enumd = file->FindEnumTypeByName("AggregateEnum"); @@ -3823,36 +4195,36 @@ TEST(CustomOptions, AggregateOptions) { const MethodDescriptor* method = service->FindMethodByName("Method"); // Tests for the different types of data embedded in fileopt - const protobuf_unittest::Aggregate& file_options = - file->options().GetExtension(protobuf_unittest::fileopt); + const proto2_unittest::Aggregate& file_options = + file->options().GetExtension(proto2_unittest::fileopt); EXPECT_EQ(100, file_options.i()); EXPECT_EQ("FileAnnotation", file_options.s()); EXPECT_EQ("NestedFileAnnotation", file_options.sub().s()); EXPECT_EQ("FileExtensionAnnotation", - file_options.file().GetExtension(protobuf_unittest::fileopt).s()); + file_options.file().GetExtension(proto2_unittest::fileopt).s()); EXPECT_EQ("EmbeddedMessageSetElement", file_options.mset() - .GetExtension(protobuf_unittest::AggregateMessageSetElement :: + .GetExtension(proto2_unittest::AggregateMessageSetElement :: message_set_extension) .s()); - protobuf_unittest::AggregateMessageSetElement any_payload; + proto2_unittest::AggregateMessageSetElement any_payload; ASSERT_TRUE(file_options.any().UnpackTo(&any_payload)); EXPECT_EQ("EmbeddedMessageSetElement", any_payload.s()); // Simple tests for all the other types of annotations EXPECT_EQ("MessageAnnotation", - msg->options().GetExtension(protobuf_unittest::msgopt).s()); + msg->options().GetExtension(proto2_unittest::msgopt).s()); EXPECT_EQ("FieldAnnotation", - field->options().GetExtension(protobuf_unittest::fieldopt).s()); + field->options().GetExtension(proto2_unittest::fieldopt).s()); EXPECT_EQ("EnumAnnotation", - enumd->options().GetExtension(protobuf_unittest::enumopt).s()); + enumd->options().GetExtension(proto2_unittest::enumopt).s()); EXPECT_EQ("EnumValueAnnotation", - enumv->options().GetExtension(protobuf_unittest::enumvalopt).s()); + enumv->options().GetExtension(proto2_unittest::enumvalopt).s()); EXPECT_EQ("ServiceAnnotation", - service->options().GetExtension(protobuf_unittest::serviceopt).s()); + service->options().GetExtension(proto2_unittest::serviceopt).s()); EXPECT_EQ("MethodAnnotation", - method->options().GetExtension(protobuf_unittest::methodopt).s()); + method->options().GetExtension(proto2_unittest::methodopt).s()); } TEST(CustomOptions, UnusedImportError) { @@ -3869,14 +4241,14 @@ TEST(CustomOptions, UnusedImportError) { ASSERT_TRUE(pool.BuildFile(any_proto) != nullptr); } FileDescriptorProto file_proto; - protobuf_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( + proto2_unittest::TestMessageWithCustomOptions::descriptor()->file()->CopyTo( &file_proto); ASSERT_TRUE(pool.BuildFile(file_proto) != nullptr); pool.AddDirectInputFile("custom_options_import.proto", true); ASSERT_TRUE(TextFormat::ParseFromString( "name: \"custom_options_import.proto\" " - "package: \"protobuf_unittest\" " + "package: \"proto2_unittest\" " "dependency: \"google/protobuf/unittest_custom_options.proto\" ", &file_proto)); @@ -3903,26 +4275,26 @@ TEST(CustomOptions, OptionsWithIncompatibleDescriptors) { // messages defined in google/protobuf/unittest_custom_options.proto. file_proto.Clear(); file_proto.set_name("unittest_custom_options.proto"); - file_proto.set_package("protobuf_unittest"); + file_proto.set_package("proto2_unittest"); file_proto.add_dependency("google/protobuf/descriptor.proto"); // Add the "required_enum_opt" extension. FieldDescriptorProto* extension = file_proto.add_extension(); - protobuf_unittest::OldOptionType::descriptor() + proto2_unittest::OldOptionType::descriptor() ->file() ->FindExtensionByName("required_enum_opt") ->CopyTo(extension); // Add a test message that uses the "required_enum_opt" option. DescriptorProto* test_message_type = file_proto.add_message_type(); - protobuf_unittest::TestMessageWithRequiredEnumOption::descriptor()->CopyTo( + proto2_unittest::TestMessageWithRequiredEnumOption::descriptor()->CopyTo( test_message_type); // Instruct the extension to use NewOptionType instead of // OldOptionType, and add the descriptor of NewOptionType. - extension->set_type_name(".protobuf_unittest.NewOptionType"); + extension->set_type_name(".proto2_unittest.NewOptionType"); DescriptorProto* new_option_type = file_proto.add_message_type(); - protobuf_unittest::NewOptionType::descriptor()->CopyTo(new_option_type); + proto2_unittest::NewOptionType::descriptor()->CopyTo(new_option_type); // Replace the value of the "required_enum_opt" option used in the // test message with an enum value that only exists in NewOptionType. @@ -3950,28 +4322,28 @@ TEST(CustomOptions, DebugString) { // Add "foo.proto": // import "google/protobuf/descriptor.proto"; - // package "protobuf_unittest"; - // option (protobuf_unittest.cc_option1) = 1; - // option (protobuf_unittest.cc_option2) = 2; + // package "proto2_unittest"; + // option (proto2_unittest.cc_option1) = 1; + // option (proto2_unittest.cc_option2) = 2; // extend google.protobuf.FieldOptions { // optional int32 cc_option1 = 7736974; // optional int32 cc_option2 = 7736975; // } ASSERT_TRUE(TextFormat::ParseFromString( "name: \"foo.proto\" " - "package: \"protobuf_unittest\" " + "package: \"proto2_unittest\" " "dependency: \"google/protobuf/descriptor.proto\" " "options { " " uninterpreted_option { " " name { " - " name_part: \"protobuf_unittest.cc_option1\" " + " name_part: \"proto2_unittest.cc_option1\" " " is_extension: true " " } " " positive_int_value: 1 " " } " " uninterpreted_option { " " name { " - " name_part: \"protobuf_unittest.cc_option2\" " + " name_part: \"proto2_unittest.cc_option2\" " " is_extension: true " " } " " positive_int_value: 2 " @@ -4006,10 +4378,10 @@ TEST(CustomOptions, DebugString) { "syntax = \"proto2\";\n" "\n" "import \"google/protobuf/descriptor.proto\";\n" - "package protobuf_unittest;\n" + "package proto2_unittest;\n" "\n" - "option (.protobuf_unittest.cc_option1) = 1;\n" - "option (.protobuf_unittest.cc_option2) = 2;\n" + "option (.proto2_unittest.cc_option1) = 1;\n" + "option (.proto2_unittest.cc_option2) = 2;\n" "\n" "extend .google.protobuf.FileOptions {\n" " optional int32 cc_option1 = 7736974;\n" @@ -4027,7 +4399,7 @@ class ValidationErrorTest : public testing::Test { void SetUp() override { // Enable extension declaration enforcement since most test cases want to // exercise the full validation. - pool_.EnforceExtensionDeclarations(true); + pool_.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); } // Parse file_text as a FileDescriptorProto in text format and add it // to the DescriptorPool. Expect no errors. @@ -6409,20 +6781,20 @@ TEST_F(ValidationErrorTest, UnusedImportWarning) { TEST_F(ValidationErrorTest, SamePackageUnusedImportError) { BuildFile(R"pb( name: "unused_dependency.proto" - package: "protobuf_unittest.subpackage" + package: "proto2_unittest.subpackage" message_type { name: "Foo" } )pb"); BuildFile(R"pb( name: "used_dependency.proto" - package: "protobuf_unittest.subpackage" + package: "proto2_unittest.subpackage" message_type { name: "Bar" } )pb"); pool_.AddDirectInputFile("import.proto", true); BuildFileWithErrors(R"pb( name: "import.proto" - package: "protobuf_unittest" + package: "proto2_unittest" dependency: "unused_dependency.proto" dependency: "used_dependency.proto" message_type { @@ -7574,6 +7946,7 @@ TEST_F(FeaturesTest, Proto2Features) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: true string_type: STRING @@ -7586,6 +7959,7 @@ TEST_F(FeaturesTest, Proto2Features) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: true string_type: STRING @@ -7598,6 +7972,7 @@ TEST_F(FeaturesTest, Proto2Features) { utf8_validation: NONE message_encoding: DELIMITED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: true string_type: STRING @@ -7675,6 +8050,7 @@ TEST_F(FeaturesTest, Proto3Features) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -7687,6 +8063,7 @@ TEST_F(FeaturesTest, Proto3Features) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -7867,6 +8244,7 @@ TEST_F(FeaturesTest, Edition2023Defaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -7950,6 +8328,7 @@ TEST_F(FeaturesTest, Edition2024Defaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE2024 [pb.cpp] { legacy_closed_enum: false string_type: VIEW @@ -7983,6 +8362,7 @@ TEST_F(FeaturesBaseTest, DefaultEdition2023Defaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8011,6 +8391,7 @@ TEST_F(FeaturesTest, ClearsOptions) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8379,6 +8760,7 @@ TEST_F(FeaturesTest, NoOptions) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8412,6 +8794,7 @@ TEST_F(FeaturesTest, FileFeatures) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8493,6 +8876,7 @@ TEST_F(FeaturesTest, MessageFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8604,6 +8988,7 @@ TEST_F(FeaturesTest, FieldFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9078,6 +9463,7 @@ TEST_F(FeaturesTest, EnumFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9193,6 +9579,7 @@ TEST_F(FeaturesTest, EnumValueFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9292,6 +9679,7 @@ TEST_F(FeaturesTest, OneofFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9400,6 +9788,7 @@ TEST_F(FeaturesTest, ExtensionRangeFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9493,6 +9882,7 @@ TEST_F(FeaturesTest, ServiceFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9563,6 +9953,7 @@ TEST_F(FeaturesTest, MethodFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9844,6 +10235,19 @@ TEST_F(FeaturesTest, FieldCppStringType) { } } } $0 + extension_range { start: 100 end: 200 } + } + extension { + name: "cord_ext" + number: 100 + label: LABEL_OPTIONAL + type: TYPE_STRING + options { + features { + [pb.cpp] { string_type: CORD } + } + } + extendee: "Foo" } )pb", "" @@ -9854,12 +10258,15 @@ TEST_F(FeaturesTest, FieldCppStringType) { const FieldDescriptor* str = message->field(1); const FieldDescriptor* cord = message->field(2); const FieldDescriptor* cord_bytes = message->field(3); + const FieldDescriptor* cord_ext = file->extension(0); EXPECT_EQ(view->cpp_string_type(), FieldDescriptor::CppStringType::kView); EXPECT_EQ(str->cpp_string_type(), FieldDescriptor::CppStringType::kString); EXPECT_EQ(cord_bytes->cpp_string_type(), FieldDescriptor::CppStringType::kCord); EXPECT_EQ(cord->cpp_string_type(), FieldDescriptor::CppStringType::kString); + EXPECT_EQ(cord_ext->cpp_string_type(), + FieldDescriptor::CppStringType::kString); } @@ -9972,7 +10379,7 @@ TEST_F(FeaturesTest, NoCtypeFromEdition2024) { } } )pb", - "foo.proto: Foo.bar: NAME: ctype option is not allowed under edition " + "foo.proto: Foo.bar: TYPE: ctype option is not allowed under edition " "2024 and beyond. Use the feature string_type = VIEW|CORD|STRING|... " "instead.\n"); } @@ -10644,6 +11051,7 @@ TEST_F(FeaturesTest, UninterpretedOptions) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -11364,6 +11772,7 @@ TEST_F(DescriptorPoolFeaturesTest, OverrideDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } minimum_edition: EDITION_PROTO2 @@ -11386,9 +11795,135 @@ TEST_F(DescriptorPoolFeaturesTest, OverrideDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY )pb")); } +TEST_F(DescriptorPoolFeaturesTest, OverrideFieldDefaults) { + FeatureSetDefaults defaults = ParseTextOrDie(R"pb( + defaults { + edition: EDITION_PROTO2 + overridable_features { + field_presence: EXPLICIT + enum_type: CLOSED + repeated_field_encoding: EXPANDED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE_LEGACY + } + } + minimum_edition: EDITION_PROTO2 + maximum_edition: EDITION_2023 + )pb"); + EXPECT_OK(pool_.SetFeatureSetDefaults(std::move(defaults))); + + FileDescriptorProto file_proto = ParseTextOrDie(R"pb( + name: "foo.proto" + syntax: "editions" + edition: EDITION_PROTO3 + message_type { + name: "Foo" + field { name: "bar" number: 1 label: LABEL_OPTIONAL type: TYPE_INT64 } + } + )pb"); + + BuildDescriptorMessagesInTestPool(); + const FileDescriptor* file = ABSL_DIE_IF_NULL(pool_.BuildFile(file_proto)); + const FieldDescriptor* field = file->message_type(0)->field(0); + EXPECT_THAT(GetFeatures(field), EqualsProto(R"pb( + field_presence: EXPLICIT + enum_type: CLOSED + repeated_field_encoding: EXPANDED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE_LEGACY + )pb")); +} + +TEST_F(DescriptorPoolFeaturesTest, ResolvesFeaturesForCppDefault) { + EXPECT_FALSE(pool_.ResolvesFeaturesFor(pb::test)); + EXPECT_FALSE(pool_.ResolvesFeaturesFor(pb::TestMessage::test_message)); + EXPECT_TRUE(pool_.ResolvesFeaturesFor(pb::cpp)); // The default. +} + +TEST_F(DescriptorPoolFeaturesTest, ResolvesFeaturesFor) { + auto test_default_spec = FeatureResolver::CompileDefaults( + FeatureSet::descriptor(), {GetExtensionReflection(pb::test)}, + EDITION_PROTO2, EDITION_99999_TEST_ONLY); + ASSERT_OK(test_default_spec); + ASSERT_OK(pool_.SetFeatureSetDefaults(std::move(test_default_spec).value())); + + EXPECT_TRUE(pool_.ResolvesFeaturesFor(pb::test)); + EXPECT_FALSE(pool_.ResolvesFeaturesFor(pb::TestMessage::test_message)); + EXPECT_FALSE(pool_.ResolvesFeaturesFor(pb::cpp)); +} + +class DescriptorPoolMemoizationTest : public ::testing::Test { + protected: + template <typename Func> + const auto& MemoizeProjection(const DescriptorPool* pool, + const FieldDescriptor* field, Func func) { + return pool->MemoizeProjection(field, func); + }; +}; + +TEST_F(DescriptorPoolMemoizationTest, MemoizeProjectionBasic) { + static int counter = 0; + auto name_lambda = [](const FieldDescriptor* field) { + counter++; + return field->full_name(); + }; + proto2_unittest::TestAllTypes message; + const Descriptor* descriptor = message.GetDescriptor(); + + const auto& name = DescriptorPoolMemoizationTest::MemoizeProjection( + descriptor->file()->pool(), descriptor->field(0), name_lambda); + const auto& dupe_name = DescriptorPoolMemoizationTest::MemoizeProjection( + descriptor->file()->pool(), descriptor->field(0), name_lambda); + + ASSERT_EQ(counter, 1); + ASSERT_EQ(name, "proto2_unittest.TestAllTypes.optional_int32"); + ASSERT_EQ(dupe_name, "proto2_unittest.TestAllTypes.optional_int32"); + + // Check that they are references aliasing the same object. + EXPECT_TRUE( + (std::is_same_v<decltype(name), const decltype(descriptor->name()) &>)); + EXPECT_EQ(&name, &dupe_name); + + auto other_name = DescriptorPoolMemoizationTest::MemoizeProjection( + descriptor->file()->pool(), descriptor->field(1), name_lambda); + + ASSERT_EQ(counter, 2); + ASSERT_NE(other_name, "proto2_unittest.TestAllTypes.optional_int32"); +} + +TEST_F(DescriptorPoolMemoizationTest, MemoizeProjectionMultithreaded) { + auto name_lambda = [](const FieldDescriptor* field) { + return field->full_name(); + }; + proto2_unittest::TestAllTypes message; + const Descriptor* descriptor = message.GetDescriptor(); + std::vector<std::thread> threads; + for (int i = 0; i < descriptor->field_count(); ++i) { + threads.emplace_back([this, name_lambda, descriptor, i]() { + auto name = DescriptorPoolMemoizationTest::MemoizeProjection( + descriptor->file()->pool(), descriptor->field(i), name_lambda); + auto first_name = DescriptorPoolMemoizationTest::MemoizeProjection( + descriptor->file()->pool(), descriptor->field(0), name_lambda); + ASSERT_THAT(name, HasSubstr("proto2_unittest.TestAllTypes")); + if (i != 0) { + ASSERT_NE(name, "proto2_unittest.TestAllTypes.optional_int32"); + } + ASSERT_EQ(first_name, "proto2_unittest.TestAllTypes.optional_int32"); + }); + } + for (auto& thread : threads) { + thread.join(); + } +} + @@ -11446,7 +11981,7 @@ TEST_F(ValidationErrorTest, ExtensionDeclarationsMismatchFullNameAllowed) { // Make sure that extension declaration names and types are not validated // outside of protoc. This is important for allowing extensions to be renamed // safely. - pool_.EnforceExtensionDeclarations(false); + pool_.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kNoEnforcement); BuildFile( R"pb( name: "foo.proto" @@ -11632,7 +12167,7 @@ TEST_P(ExtensionDeclarationsTest, DotPrefixTypeCompile) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); EXPECT_NE(pool.BuildFile(*file_proto), nullptr); } @@ -11665,7 +12200,7 @@ TEST_P(ExtensionDeclarationsTest, EnumTypeCompile) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); EXPECT_NE(pool.BuildFile(*file_proto), nullptr); } @@ -11702,7 +12237,7 @@ TEST_P(ExtensionDeclarationsTest, MismatchEnumType) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -11738,7 +12273,7 @@ TEST_P(ExtensionDeclarationsTest, DotPrefixFullNameCompile) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); EXPECT_NE(pool.BuildFile(*file_proto), nullptr); } @@ -11767,7 +12302,7 @@ TEST_P(ExtensionDeclarationsTest, MismatchDotPrefixTypeExpectingMessage) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -11797,7 +12332,7 @@ TEST_P(ExtensionDeclarationsTest, MismatchDotPrefixTypeExpectingNonMessage) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -11832,7 +12367,7 @@ TEST_P(ExtensionDeclarationsTest, MismatchMessageType) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -11862,7 +12397,7 @@ TEST_P(ExtensionDeclarationsTest, NonMessageTypeCompile) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); EXPECT_NE(pool.BuildFile(*file_proto), nullptr); } @@ -11891,7 +12426,7 @@ TEST_P(ExtensionDeclarationsTest, MismatchNonMessageType) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -11926,7 +12461,7 @@ TEST_P(ExtensionDeclarationsTest, MismatchCardinalityExpectingRepeated) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -11966,7 +12501,7 @@ TEST_P(ExtensionDeclarationsTest, MismatchCardinalityExpectingOptional) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -11998,7 +12533,7 @@ TEST_P(ExtensionDeclarationsTest, TypeDoesNotLookLikeIdentifier) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); MockErrorCollector error_collector; EXPECT_EQ(pool.BuildFileCollectingErrors(*file_proto, &error_collector), nullptr); @@ -12044,7 +12579,7 @@ TEST_P(ExtensionDeclarationsTest, MultipleDeclarationsInARangeCompile) { ASSERT_OK(file_proto); DescriptorPool pool; - pool.EnforceExtensionDeclarations(true); + pool.EnforceExtensionDeclarations(ExtDeclEnforcementLevel::kAllExtensions); EXPECT_NE(pool.BuildFile(*file_proto), nullptr); } @@ -12385,7 +12920,7 @@ TEST_F(DatabaseBackedPoolTest, UnittestProto) { // thoroughly test all paths through DescriptorBuilder to insure that there // are no deadlocking problems when pool_->mutex_ is non-null. const FileDescriptor* original_file = - protobuf_unittest::TestAllTypes::descriptor()->file(); + proto2_unittest::TestAllTypes::descriptor()->file(); DescriptorPoolDatabase database(*DescriptorPool::generated_pool()); DescriptorPool pool(&database); @@ -13438,7 +13973,7 @@ class LazilyBuildDependenciesTest : public testing::Test { ParseProtoAndAddToDb(absl::StrFormat( R"pb( name: '%s.proto' - package: "protobuf_unittest" + package: "proto2_unittest" message_type { name: '%s' field { name: 'a' number: 1 label: LABEL_OPTIONAL type: TYPE_INT32 } @@ -13451,7 +13986,7 @@ class LazilyBuildDependenciesTest : public testing::Test { absl::string_view enum_value_name) { ParseProtoAndAddToDb(absl::StrCat("name: '", file_name, ".proto' " - "package: 'protobuf_unittest' " + "package: 'proto2_unittest' " "enum_type { " " name:'", enum_name, @@ -13470,7 +14005,7 @@ class LazilyBuildDependenciesTest : public testing::Test { TEST_F(LazilyBuildDependenciesTest, Message) { ParseProtoAndAddToDb(R"pb( name: 'foo.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' dependency: 'bar.proto' message_type { name: 'Foo' @@ -13479,7 +14014,7 @@ TEST_F(LazilyBuildDependenciesTest, Message) { number: 1 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: '.protobuf_unittest.Bar' + type_name: '.proto2_unittest.Bar' } })pb"); AddSimpleMessageProtoFileToDb("bar", "Bar"); @@ -13516,7 +14051,7 @@ TEST_F(LazilyBuildDependenciesTest, Enum) { ParseProtoAndAddToDb( R"pb( name: 'foo.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' dependency: 'enum1.proto' dependency: 'enum2.proto' message_type { @@ -13526,14 +14061,14 @@ TEST_F(LazilyBuildDependenciesTest, Enum) { number: 1 label: LABEL_OPTIONAL type: TYPE_ENUM - type_name: '.protobuf_unittest.Enum1' + type_name: '.proto2_unittest.Enum1' } field { name: 'enum2' number: 1 label: LABEL_OPTIONAL type: TYPE_ENUM - type_name: '.protobuf_unittest.Enum2' + type_name: '.proto2_unittest.Enum2' } })pb"); AddSimpleEnumProtoFileToDb("enum1", "Enum1", "ENUM1"); @@ -13564,7 +14099,7 @@ TEST_F(LazilyBuildDependenciesTest, Type) { ParseProtoAndAddToDb( R"pb( name: 'foo.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' dependency: 'message1.proto' dependency: 'message2.proto' dependency: 'enum1.proto' @@ -13576,28 +14111,28 @@ TEST_F(LazilyBuildDependenciesTest, Type) { number: 1 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: '.protobuf_unittest.Message1' + type_name: '.proto2_unittest.Message1' } field { name: 'message2' number: 1 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: '.protobuf_unittest.Message2' + type_name: '.proto2_unittest.Message2' } field { name: 'enum1' number: 1 label: LABEL_OPTIONAL type: TYPE_ENUM - type_name: '.protobuf_unittest.Enum1' + type_name: '.proto2_unittest.Enum1' } field { name: 'enum2' number: 1 label: LABEL_OPTIONAL type: TYPE_ENUM - type_name: '.protobuf_unittest.Enum2' + type_name: '.proto2_unittest.Enum2' } })pb"); AddSimpleMessageProtoFileToDb("message1", "Message1"); @@ -13646,22 +14181,22 @@ TEST_F(LazilyBuildDependenciesTest, Extension) { ParseProtoAndAddToDb( R"pb( name: 'foo.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' dependency: 'bar.proto' dependency: 'baz.proto' extension { - extendee: '.protobuf_unittest.Bar' + extendee: '.proto2_unittest.Bar' name: 'bar' number: 11 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: '.protobuf_unittest.Baz' + type_name: '.proto2_unittest.Baz' } )pb"); ParseProtoAndAddToDb( R"pb( name: 'bar.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' message_type { name: 'Bar' extension_range { start: 10 end: 20 } @@ -13687,7 +14222,7 @@ TEST_F(LazilyBuildDependenciesTest, Extension) { TEST_F(LazilyBuildDependenciesTest, Service) { ParseProtoAndAddToDb(R"pb( name: 'foo.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' dependency: 'message1.proto' dependency: 'message2.proto' dependency: 'message3.proto' @@ -13696,8 +14231,8 @@ TEST_F(LazilyBuildDependenciesTest, Service) { name: 'LazyService' method { name: 'A' - input_type: '.protobuf_unittest.Message1' - output_type: '.protobuf_unittest.Message2' + input_type: '.proto2_unittest.Message1' + output_type: '.proto2_unittest.Message2' } })pb"); AddSimpleMessageProtoFileToDb("message1", "Message1"); @@ -13743,7 +14278,7 @@ TEST_F(LazilyBuildDependenciesTest, GeneratedFile) { // lazily_build_dependencies_ is set on the generated pool, and also that // the generated function "descriptor()" doesn't somehow subvert the laziness // by manually loading the dependencies or something. - EXPECT_TRUE(protobuf_unittest::lazy_imports::ImportedMessage::descriptor() != + EXPECT_TRUE(proto2_unittest::lazy_imports::ImportedMessage::descriptor() != nullptr); EXPECT_TRUE(DescriptorPool::generated_pool()->InternalIsFileLoaded( "google/protobuf/unittest_lazy_dependencies.proto")); @@ -13756,35 +14291,35 @@ TEST_F(LazilyBuildDependenciesTest, GeneratedFile) { // and that a non-default value of a custom option doesn't load the file // where that enum is defined. const MessageOptions& options = - protobuf_unittest::lazy_imports::MessageCustomOption::descriptor() + proto2_unittest::lazy_imports::MessageCustomOption::descriptor() ->options(); - protobuf_unittest::lazy_imports::LazyEnum custom_option_value = - options.GetExtension(protobuf_unittest::lazy_imports::lazy_enum_option); + proto2_unittest::lazy_imports::LazyEnum custom_option_value = + options.GetExtension(proto2_unittest::lazy_imports::lazy_enum_option); EXPECT_FALSE(DescriptorPool::generated_pool()->InternalIsFileLoaded( "google/protobuf/unittest_lazy_dependencies_custom_option.proto")); EXPECT_FALSE(DescriptorPool::generated_pool()->InternalIsFileLoaded( "google/protobuf/unittest_lazy_dependencies_enum.proto")); - EXPECT_EQ(custom_option_value, protobuf_unittest::lazy_imports::LAZY_ENUM_1); + EXPECT_EQ(custom_option_value, proto2_unittest::lazy_imports::LAZY_ENUM_1); const MessageOptions& options2 = - protobuf_unittest::lazy_imports::MessageCustomOption2::descriptor() + proto2_unittest::lazy_imports::MessageCustomOption2::descriptor() ->options(); custom_option_value = - options2.GetExtension(protobuf_unittest::lazy_imports::lazy_enum_option); + options2.GetExtension(proto2_unittest::lazy_imports::lazy_enum_option); EXPECT_FALSE(DescriptorPool::generated_pool()->InternalIsFileLoaded( "google/protobuf/unittest_lazy_dependencies_custom_option.proto")); EXPECT_FALSE(DescriptorPool::generated_pool()->InternalIsFileLoaded( "google/protobuf/unittest_lazy_dependencies_enum.proto")); - EXPECT_EQ(custom_option_value, protobuf_unittest::lazy_imports::LAZY_ENUM_0); + EXPECT_EQ(custom_option_value, proto2_unittest::lazy_imports::LAZY_ENUM_0); } TEST_F(LazilyBuildDependenciesTest, Dependency) { ParseProtoAndAddToDb( R"pb( name: 'foo.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' dependency: 'bar.proto' message_type { name: 'Foo' @@ -13793,14 +14328,14 @@ TEST_F(LazilyBuildDependenciesTest, Dependency) { number: 1 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: '.protobuf_unittest.Bar' + type_name: '.proto2_unittest.Bar' } } )pb"); ParseProtoAndAddToDb( R"pb( name: 'bar.proto' - package: 'protobuf_unittest' + package: 'proto2_unittest' dependency: 'baz.proto' message_type { name: 'Bar' @@ -13809,7 +14344,7 @@ TEST_F(LazilyBuildDependenciesTest, Dependency) { number: 1 label: LABEL_OPTIONAL type: TYPE_MESSAGE - type_name: '.protobuf_unittest.Baz' + type_name: '.proto2_unittest.Baz' } } )pb"); @@ -13832,6 +14367,28 @@ TEST_F(LazilyBuildDependenciesTest, Dependency) { // =================================================================== +// This is effectively a static_assert ensuring that the generated +// descriptor_table variable is marked extern "C". The compiler will give us an +// error if the generated declaration does not match this one. We need this +// variable to be extern "C" so that we can refer to it from Rust. +// +// If this causes a linker error, it is likely because the name mangling +// changed. That can be fixed by updating to the new name from the generated +// code for unittest.proto. + +#define DESCRIPTOR_TABLE_NAME \ + descriptor_table_google_2fprotobuf_2funittest_2eproto + +extern "C" { +extern const ::google::protobuf::internal::DescriptorTable DESCRIPTOR_TABLE_NAME; +} + +TEST(DescriptorTableExternLinkageTest, DescriptorTableExternLinkageTest) { + // The goal of this assertion is just to verify that the descriptor_table + // variable declaration above still refers to a real thing. + EXPECT_TRUE(absl::EndsWith(DESCRIPTOR_TABLE_NAME.filename, "unittest.proto")); +} + } // namespace descriptor_unittest } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/descriptor_visitor_test.cc b/third_party/protobuf/src/google/protobuf/descriptor_visitor_test.cc index aacf19e652019..21246f269c237 100644 --- a/third_party/protobuf/src/google/protobuf/descriptor_visitor_test.cc +++ b/third_party/protobuf/src/google/protobuf/descriptor_visitor_test.cc @@ -28,19 +28,19 @@ constexpr absl::string_view kUnittestProtoFile = TEST(VisitDescriptorsTest, SingleTypeNoProto) { const FileDescriptor& file = - *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); + *proto2_unittest::TestAllTypes::GetDescriptor()->file(); std::vector<absl::string_view> descriptors; VisitDescriptors(file, [&](const Descriptor& descriptor) { descriptors.push_back(descriptor.full_name()); }); EXPECT_THAT(descriptors, - IsSupersetOf({"protobuf_unittest.TestAllTypes", - "protobuf_unittest.TestAllTypes.NestedMessage"})); + IsSupersetOf({"proto2_unittest.TestAllTypes", + "proto2_unittest.TestAllTypes.NestedMessage"})); } TEST(VisitDescriptorsTest, SingleTypeWithProto) { const FileDescriptor& file = - *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); + *proto2_unittest::TestAllTypes::GetDescriptor()->file(); FileDescriptorProto proto; file.CopyTo(&proto); std::vector<absl::string_view> descriptors; @@ -51,13 +51,13 @@ TEST(VisitDescriptorsTest, SingleTypeWithProto) { EXPECT_EQ(descriptor.name(), proto.name()); }); EXPECT_THAT(descriptors, - IsSupersetOf({"protobuf_unittest.TestAllTypes", - "protobuf_unittest.TestAllTypes.NestedMessage"})); + IsSupersetOf({"proto2_unittest.TestAllTypes", + "proto2_unittest.TestAllTypes.NestedMessage"})); } TEST(VisitDescriptorsTest, SingleTypeMutableProto) { const FileDescriptor& file = - *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); + *proto2_unittest::TestAllTypes::GetDescriptor()->file(); FileDescriptorProto proto; file.CopyTo(&proto); std::vector<absl::string_view> descriptors; @@ -68,14 +68,14 @@ TEST(VisitDescriptorsTest, SingleTypeMutableProto) { proto.set_name("<redacted>"); }); EXPECT_THAT(descriptors, - IsSupersetOf({"protobuf_unittest.TestAllTypes", - "protobuf_unittest.TestAllTypes.NestedMessage"})); + IsSupersetOf({"proto2_unittest.TestAllTypes", + "proto2_unittest.TestAllTypes.NestedMessage"})); EXPECT_EQ(proto.message_type(0).name(), "<redacted>"); } TEST(VisitDescriptorsTest, AllTypesDeduce) { const FileDescriptor& file = - *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); + *proto2_unittest::TestAllTypes::GetDescriptor()->file(); std::vector<absl::string_view> descriptors; VisitDescriptors(file, [&](const auto& descriptor) { descriptors.push_back(descriptor.name()); @@ -89,7 +89,7 @@ TEST(VisitDescriptorsTest, AllTypesDeduce) { TEST(VisitDescriptorsTest, AllTypesDeduceSelective) { const FileDescriptor& file = - *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); + *proto2_unittest::TestAllTypes::GetDescriptor()->file(); std::vector<absl::string_view> descriptors; VisitDescriptors( file, @@ -103,12 +103,12 @@ TEST(VisitDescriptorsTest, AllTypesDeduceSelective) { EXPECT_THAT(descriptors, Not(Contains(kUnittestProtoFile))); EXPECT_THAT(descriptors, IsSupersetOf( - {"protobuf_unittest.TestAllTypes", - "protobuf_unittest.TestSparseEnum", "protobuf_unittest.SPARSE_C", - "protobuf_unittest.TestAllTypes.optional_int32", - "protobuf_unittest.TestAllTypes.oneof_nested_message", - "protobuf_unittest.TestAllTypes.oneof_field", - "protobuf_unittest.optional_nested_message_extension"})); + {"proto2_unittest.TestAllTypes", + "proto2_unittest.TestSparseEnum", "proto2_unittest.SPARSE_C", + "proto2_unittest.TestAllTypes.optional_int32", + "proto2_unittest.TestAllTypes.oneof_nested_message", + "proto2_unittest.TestAllTypes.oneof_field", + "proto2_unittest.optional_nested_message_extension"})); } void TestHandle(const Descriptor& message, const DescriptorProto& proto, @@ -123,7 +123,7 @@ void TestHandle(const EnumDescriptor& enm, const EnumDescriptorProto& proto, } TEST(VisitDescriptorsTest, AllTypesDeduceDelegate) { const FileDescriptor& file = - *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); + *proto2_unittest::TestAllTypes::GetDescriptor()->file(); FileDescriptorProto proto; file.CopyTo(&proto); std::vector<absl::string_view> descriptors; @@ -134,8 +134,8 @@ TEST(VisitDescriptorsTest, AllTypesDeduceDelegate) { TestHandle(descriptor, proto, &descriptors); }); - EXPECT_THAT(descriptors, IsSupersetOf({"protobuf_unittest.TestAllTypes", - "protobuf_unittest.TestSparseEnum"})); + EXPECT_THAT(descriptors, IsSupersetOf({"proto2_unittest.TestAllTypes", + "proto2_unittest.TestSparseEnum"})); } } // namespace diff --git a/third_party/protobuf/src/google/protobuf/duration.pb.cc b/third_party/protobuf/src/google/protobuf/duration.pb.cc index 53d1587586d78..405b5622786d5 100644 --- a/third_party/protobuf/src/google/protobuf/duration.pb.cc +++ b/third_party/protobuf/src/google/protobuf/duration.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/duration.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/duration.pb.h" @@ -29,14 +29,14 @@ namespace protobuf { inline constexpr Duration::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : seconds_{::int64_t{0}}, - nanos_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + seconds_{::int64_t{0}}, + nanos_{0} {} template <typename> PROTOBUF_CONSTEXPR Duration::Duration(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Duration_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -54,14 +54,14 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DurationDefaultTypeInternal _Duration_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -71,13 +71,15 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _impl_.seconds_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Duration, _impl_.nanos_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::Duration)}, + {0, 10, -1, sizeof(::google::protobuf::Duration)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_Duration_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -112,11 +114,15 @@ namespace protobuf { class Duration::_Internal { public: + using HasBits = + decltype(std::declval<Duration>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Duration, _impl_._has_bits_); }; -Duration::Duration(::google::protobuf::Arena* arena) +Duration::Duration(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Duration_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -124,16 +130,22 @@ Duration::Duration(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.Duration) } Duration::Duration( - ::google::protobuf::Arena* arena, const Duration& from) - : Duration(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Duration& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, Duration_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE Duration::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Duration::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void Duration::SharedCtor(::_pb::Arena* arena) { +inline void Duration::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, seconds_), @@ -153,45 +165,53 @@ inline void Duration::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Duration::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Duration::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Duration(arena); } constexpr auto Duration::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(Duration), alignof(Duration)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Duration::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Duration_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Duration::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Duration>(), +constexpr auto Duration::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Duration_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Duration::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Duration>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Duration::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Duration>(), &Duration::ByteSizeLong, - &Duration::_InternalSerialize, + &Duration::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Duration>(), &Duration::ByteSizeLong, + &Duration::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Duration, _impl_._cached_size_), - false, - }, - &Duration::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fduration_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Duration::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Duration, _impl_._cached_size_), + false, + }, + &Duration::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fduration_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Duration_class_data_ = + Duration::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Duration::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Duration_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Duration_class_data_.tc_table); + return Duration_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Duration::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 0, 2> +Duration::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Duration, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -200,7 +220,7 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Duration::_table_ = { 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Duration_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -208,26 +228,25 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Duration::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int32 nanos = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Duration, _impl_.nanos_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Duration, _impl_.nanos_), 1>(), + {16, 1, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_)}}, // int64 seconds = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Duration, _impl_.seconds_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Duration, _impl_.seconds_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_)}}, }}, {{ 65535, 65535 }}, {{ // int64 seconds = 1; - {PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt64)}, + {PROTOBUF_FIELD_OFFSET(Duration, _impl_.seconds_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, // int32 nanos = 2; - {PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void Duration::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -235,80 +254,93 @@ PROTOBUF_NOINLINE void Duration::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( - reinterpret_cast<char*>(&_impl_.nanos_) - - reinterpret_cast<char*>(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( + reinterpret_cast<char*>(&_impl_.nanos_) - + reinterpret_cast<char*>(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Duration::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Duration& this_ = static_cast<const Duration&>(base); +::uint8_t* PROTOBUF_NONNULL Duration::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Duration& this_ = static_cast<const Duration&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Duration::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Duration& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Duration::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Duration& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64ToArrayWithField<1>( - stream, this_._internal_seconds(), target); - } + // int64 seconds = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_seconds() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<1>( + stream, this_._internal_seconds(), target); + } + } - // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_nanos(), target); - } + // int32 nanos = 2; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (this_._internal_nanos() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_nanos(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Duration) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Duration) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Duration::ByteSizeLong(const MessageLite& base) { - const Duration& this_ = static_cast<const Duration&>(base); +::size_t Duration::ByteSizeLong(const MessageLite& base) { + const Duration& this_ = static_cast<const Duration&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Duration::ByteSizeLong() const { - const Duration& this_ = *this; +::size_t Duration::ByteSizeLong() const { + const Duration& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_seconds()); - } - // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_nanos()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // int64 seconds = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (this_._internal_seconds() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( + this_._internal_seconds()); + } + } + // int32 nanos = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + if (this_._internal_nanos() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_nanos()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Duration::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Duration*>(&to_msg); @@ -318,12 +350,20 @@ void Duration::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_seconds() != 0) { - _this->_impl_.seconds_ = from._impl_.seconds_; - } - if (from._internal_nanos() != 0) { - _this->_impl_.nanos_ = from._impl_.nanos_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (from._internal_seconds() != 0) { + _this->_impl_.seconds_ = from._impl_.seconds_; + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (from._internal_nanos() != 0) { + _this->_impl_.nanos_ = from._impl_.nanos_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -335,9 +375,10 @@ void Duration::CopyFrom(const Duration& from) { } -void Duration::InternalSwap(Duration* PROTOBUF_RESTRICT other) { +void Duration::InternalSwap(Duration* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::google::protobuf::internal::memswap< PROTOBUF_FIELD_OFFSET(Duration, _impl_.nanos_) + sizeof(Duration::_impl_.nanos_) @@ -358,7 +399,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fduration_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/duration.pb.h b/third_party/protobuf/src/google/protobuf/duration.pb.h index b92a7b9afbe25..9b1d27bfc315f 100644 --- a/third_party/protobuf/src/google/protobuf/duration.pb.h +++ b/third_party/protobuf/src/google/protobuf/duration.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/duration.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fduration_2eproto_2epb_2eh #define google_2fprotobuf_2fduration_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -49,13 +49,15 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fduration_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fduration_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto; +} // extern "C" namespace google { namespace protobuf { class Duration; struct DurationDefaultTypeInternal; PROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Duration_class_data_; } // namespace protobuf } // namespace google @@ -74,15 +76,14 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message ~Duration() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Duration* msg, std::destroying_delete_t) { + void operator delete(Duration* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Duration)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Duration( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Duration(::google::protobuf::internal::ConstantInitialized); inline Duration(const Duration& from) : Duration(nullptr, from) {} inline Duration(Duration&& from) noexcept @@ -105,30 +106,27 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Duration& default_instance() { - return *internal_default_instance(); - } - static inline const Duration* internal_default_instance() { - return reinterpret_cast<const Duration*>( + return *reinterpret_cast<const Duration*>( &_Duration_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(Duration& a, Duration& b) { a.Swap(&b); } - inline void Swap(Duration* other) { + inline void Swap(Duration* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -136,7 +134,7 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Duration* other) { + void UnsafeArenaSwap(Duration* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -144,7 +142,7 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Duration* New(::google::protobuf::Arena* arena = nullptr) const { + Duration* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Duration>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -153,9 +151,8 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message void MergeFrom(const Duration& from) { Duration::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -165,49 +162,51 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Duration* other); + void InternalSwap(Duration* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Duration"; } protected: - explicit Duration(::google::protobuf::Arena* arena); - Duration(::google::protobuf::Arena* arena, const Duration& from); - Duration(::google::protobuf::Arena* arena, Duration&& from) noexcept + explicit Duration(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Duration(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Duration& from); + Duration( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Duration&& from) noexcept : Duration(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -240,9 +239,9 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -252,22 +251,26 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Duration& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Duration& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::int64_t seconds_; ::int32_t nanos_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fduration_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Duration_class_data_; + // =================================================================== @@ -288,6 +291,7 @@ class PROTOBUF_EXPORT Duration final : public ::google::protobuf::Message inline void Duration::clear_seconds() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.seconds_ = ::int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int64_t Duration::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) @@ -295,6 +299,7 @@ inline ::int64_t Duration::seconds() const { } inline void Duration::set_seconds(::int64_t value) { _internal_set_seconds(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) } inline ::int64_t Duration::_internal_seconds() const { @@ -310,6 +315,7 @@ inline void Duration::_internal_set_seconds(::int64_t value) { inline void Duration::clear_nanos() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.nanos_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; } inline ::int32_t Duration::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) @@ -317,6 +323,7 @@ inline ::int32_t Duration::nanos() const { } inline void Duration::set_nanos(::int32_t value) { _internal_set_nanos(value); + _impl_._has_bits_[0] |= 0x00000002u; // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) } inline ::int32_t Duration::_internal_nanos() const { diff --git a/third_party/protobuf/src/google/protobuf/dynamic_message.cc b/third_party/protobuf/src/google/protobuf/dynamic_message.cc index 0fd0d1a40ddcb..6457640c890ce 100644 --- a/third_party/protobuf/src/google/protobuf/dynamic_message.cc +++ b/third_party/protobuf/src/google/protobuf/dynamic_message.cc @@ -48,16 +48,25 @@ #include <memory> #include <new> #include <string> +#include <type_traits> +#include "absl/base/attributes.h" +#include "absl/hash/hash.h" #include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" +#include "absl/types/variant.h" +#include "absl/utility/utility.h" #include "google/protobuf/arenastring.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/extension_set.h" #include "google/protobuf/generated_message_reflection.h" #include "google/protobuf/generated_message_util.h" +#include "google/protobuf/map.h" #include "google/protobuf/map_field.h" +#include "google/protobuf/map_field_inl.h" // IWYU pragma: keep #include "google/protobuf/message_lite.h" +#include "google/protobuf/port.h" #include "google/protobuf/repeated_field.h" #include "google/protobuf/unknown_field_set.h" #include "google/protobuf/wire_format.h" @@ -68,10 +77,7 @@ namespace google { namespace protobuf { - -using internal::DynamicMapField; using internal::ExtensionSet; -using internal::MapField; using internal::ArenaStringPtr; @@ -79,10 +85,95 @@ using internal::ArenaStringPtr; // =================================================================== // Some helper tables and functions... +namespace internal { + +class DynamicMapField final : public MapFieldBase { + public: + // We pass the prototype for the entry and the mapped type (if message) to + // allow the caller to use the appropriate lookup function. During prototype + // building we need to use a different one. + DynamicMapField(const Message* default_entry, + const Message* mapped_default_entry_if_message, Arena* arena); + DynamicMapField(const DynamicMapField&) = delete; + DynamicMapField& operator=(const DynamicMapField&) = delete; + ~DynamicMapField(); + + private: + friend class MapFieldBase; + + // Must be first for GetMapRaw to work. + UntypedMapBase map_; +}; + +static UntypedMapBase::TypeKind CppTypeToTypeKind( + FieldDescriptor::CppType type) { + using TK = UntypedMapBase::TypeKind; + switch (type) { + case FieldDescriptor::CPPTYPE_BOOL: + return TK::kBool; + case FieldDescriptor::CPPTYPE_INT32: + return TK::kU32; + case FieldDescriptor::CPPTYPE_UINT32: + return TK::kU32; + case FieldDescriptor::CPPTYPE_ENUM: + return TK::kU32; + case FieldDescriptor::CPPTYPE_INT64: + return TK::kU64; + case FieldDescriptor::CPPTYPE_UINT64: + return TK::kU64; + case FieldDescriptor::CPPTYPE_FLOAT: + return TK::kFloat; + case FieldDescriptor::CPPTYPE_DOUBLE: + return TK::kDouble; + case FieldDescriptor::CPPTYPE_STRING: + return TK::kString; + case FieldDescriptor::CPPTYPE_MESSAGE: + return TK::kMessage; + default: + Unreachable(); + } +} + +static auto DefaultEntryToTypeInfo( + const Message* default_entry, + const Message* mapped_default_entry_if_message) { + auto* desc = default_entry->GetDescriptor(); + return UntypedMapBase::GetTypeInfoDynamic( + CppTypeToTypeKind(desc->map_key()->cpp_type()), + CppTypeToTypeKind(desc->map_value()->cpp_type()), + mapped_default_entry_if_message); +} + +DynamicMapField::DynamicMapField(const Message* default_entry, + const Message* mapped_default_entry_if_message, + Arena* arena) + : MapFieldBase(default_entry, arena), + map_(arena, DefaultEntryToTypeInfo(default_entry, + mapped_default_entry_if_message)) { + // This invariant is required by `GetMapRaw` to easily access the map + // member without paying for dynamic dispatch. + static_assert(MapFieldBaseForParse::MapOffset() == + PROTOBUF_FIELD_OFFSET(DynamicMapField, map_)); +} + +DynamicMapField::~DynamicMapField() { + ABSL_DCHECK_EQ(arena(), nullptr); + map_.ClearTable(false); +} + +} // namespace internal + +using internal::DynamicMapField; + namespace { bool IsMapFieldInApi(const FieldDescriptor* field) { return field->is_map(); } +bool IsMapEntryField(const FieldDescriptor* field) { + return (field->containing_type() != nullptr && + field->containing_type()->options().map_entry()); +} + inline bool InRealOneof(const FieldDescriptor* field) { return field->real_containing_oneof() != nullptr; @@ -445,30 +536,22 @@ void DynamicMessage::SharedCtor(bool lock_factory) { new (field_ptr) Message*(nullptr); } else { if (IsMapFieldInApi(field)) { + const auto* sub = + field->message_type()->map_value()->message_type(); // We need to lock in most cases to avoid data racing. Only not lock // when the constructor is called inside GetPrototype(), in which // case we have already locked the factory. - if (lock_factory) { - if (arena != nullptr) { - new (field_ptr) DynamicMapField( - type_info_->factory->GetPrototype(field->message_type()), - arena); - } else { - new (field_ptr) DynamicMapField( - type_info_->factory->GetPrototype(field->message_type())); - } - } else { - if (arena != nullptr) { - new (field_ptr) - DynamicMapField(type_info_->factory->GetPrototypeNoLock( - field->message_type()), - arena); - } else { - new (field_ptr) - DynamicMapField(type_info_->factory->GetPrototypeNoLock( - field->message_type())); - } - } + new (field_ptr) DynamicMapField( + lock_factory + ? type_info_->factory->GetPrototype(field->message_type()) + : type_info_->factory->GetPrototypeNoLock( + field->message_type()), + sub != nullptr + ? lock_factory + ? type_info_->factory->GetPrototype(sub) + : type_info_->factory->GetPrototypeNoLock(sub) + : nullptr, + arena); } else { new (field_ptr) RepeatedPtrField<Message>(arena); } @@ -706,7 +789,43 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( type_info->has_bits_offset = -1; int max_hasbit = 0; for (int i = 0; i < type->field_count(); i++) { - if (internal::cpp::HasHasbit(type->field(i))) { + const FieldDescriptor* field = type->field(i); + + // If a field has hasbits, it could be either an explicit-presence or + // implicit-presence field. Explicit presence fields will have "true + // hasbits" where hasbit is set iff field is present. Implicit presence + // fields will have "hint hasbits" where + // - if hasbit is unset, field is not present. + // - if hasbit is set, field is present if it is also nonempty. + if (internal::cpp::HasHasbit(field)) { + // TODO: b/112602698 - during Python textproto serialization, MapEntry + // messages may be generated from DynamicMessage on the fly. C++ + // implementations of MapEntry messages always have hasbits, but + // has_presence return values might be different depending on how field + // presence is set. For MapEntrys, has_presence returns true for + // explicit-presence (proto2) messages and returns false for + // implicit-presence (proto3) messages. + // + // In the case of implicit presence, there is a potential inconsistency in + // code behavior between C++ and Python: + // - If C++ implementation is linked, hasbits are always generated for + // MapEntry messages, and MapEntry messages will behave like explicit + // presence. + // - If C++ implementation is not linked, Python defaults to the + // DynamicMessage implementation for MapEntrys which traditionally does + // not assume the presence of hasbits, so the default Python behavior + // for MapEntry messages (by default C++ implementations are not linked) + // will fall back to the DynamicMessage implementation and behave like + // implicit presence. + // This is an inconsistency and this if-condition preserves it. + // + // Longer term, we want to get rid of this additional if-check of + // IsMapEntryField. It might take one or more breaking changes and more + // consensus gathering & clarification though. + if (!field->has_presence() && IsMapEntryField(field)) { + continue; + } + if (type_info->has_bits_offset == -1) { // At least one field in the message requires a hasbit, so allocate // hasbits. diff --git a/third_party/protobuf/src/google/protobuf/dynamic_message_unittest.cc b/third_party/protobuf/src/google/protobuf/dynamic_message_unittest.cc index 135610307ee97..e12277a9b2f03 100644 --- a/third_party/protobuf/src/google/protobuf/dynamic_message_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/dynamic_message_unittest.cc @@ -91,28 +91,28 @@ class DynamicMessageTest : public ::testing::TestWithParam<bool> { void SetUp() override { AddUnittestDescriptors(pool_); - descriptor_ = pool_.FindMessageTypeByName("protobuf_unittest.TestAllTypes"); + descriptor_ = pool_.FindMessageTypeByName("proto2_unittest.TestAllTypes"); ASSERT_TRUE(descriptor_ != nullptr); prototype_ = factory_.GetPrototype(descriptor_); extensions_descriptor_ = - pool_.FindMessageTypeByName("protobuf_unittest.TestAllExtensions"); + pool_.FindMessageTypeByName("proto2_unittest.TestAllExtensions"); ASSERT_TRUE(extensions_descriptor_ != nullptr); extensions_prototype_ = factory_.GetPrototype(extensions_descriptor_); packed_extensions_descriptor_ = - pool_.FindMessageTypeByName("protobuf_unittest.TestPackedExtensions"); + pool_.FindMessageTypeByName("proto2_unittest.TestPackedExtensions"); ASSERT_TRUE(packed_extensions_descriptor_ != nullptr); packed_extensions_prototype_ = factory_.GetPrototype(packed_extensions_descriptor_); packed_descriptor_ = - pool_.FindMessageTypeByName("protobuf_unittest.TestPackedTypes"); + pool_.FindMessageTypeByName("proto2_unittest.TestPackedTypes"); ASSERT_TRUE(packed_descriptor_ != nullptr); packed_prototype_ = factory_.GetPrototype(packed_descriptor_); oneof_descriptor_ = - pool_.FindMessageTypeByName("protobuf_unittest.TestOneof2"); + pool_.FindMessageTypeByName("proto2_unittest.TestOneof2"); ASSERT_TRUE(oneof_descriptor_ != nullptr); oneof_prototype_ = factory_.GetPrototype(oneof_descriptor_); @@ -224,7 +224,7 @@ TEST_P(DynamicMessageTest, Oneof) { const Descriptor* nested_descriptor; const Message* nested_prototype; nested_descriptor = - pool_.FindMessageTypeByName("protobuf_unittest.TestOneof2.NestedMessage"); + pool_.FindMessageTypeByName("proto2_unittest.TestOneof2.NestedMessage"); nested_prototype = factory_.GetPrototype(nested_descriptor); EXPECT_EQ(nested_prototype, &reflection->GetMessage( @@ -232,7 +232,7 @@ TEST_P(DynamicMessageTest, Oneof) { const Descriptor* foogroup_descriptor; const Message* foogroup_prototype; foogroup_descriptor = - pool_.FindMessageTypeByName("protobuf_unittest.TestOneof2.FooGroup"); + pool_.FindMessageTypeByName("proto2_unittest.TestOneof2.FooGroup"); foogroup_prototype = factory_.GetPrototype(foogroup_descriptor); EXPECT_EQ(foogroup_prototype, &reflection->GetMessage(*message, diff --git a/third_party/protobuf/src/google/protobuf/edition_message_unittest.cc b/third_party/protobuf/src/google/protobuf/edition_message_unittest.cc index 1feeb5dc6dc26..293d68524ec9d 100644 --- a/third_party/protobuf/src/google/protobuf/edition_message_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/edition_message_unittest.cc @@ -34,7 +34,7 @@ #define MESSAGE_FACTORY_TEST_NAME EditionMessageFactoryTest #define UNITTEST_PACKAGE_NAME "edition_unittest" #define UNITTEST ::edition_unittest -#define UNITTEST_IMPORT ::protobuf_unittest_import +#define UNITTEST_IMPORT ::proto2_unittest_import // Must include after the above macros. // clang-format off diff --git a/third_party/protobuf/src/google/protobuf/edition_unittest.proto b/third_party/protobuf/src/google/protobuf/edition_unittest.proto index c0d0ebbbf768f..fe540a408db54 100644 --- a/third_party/protobuf/src/google/protobuf/edition_unittest.proto +++ b/third_party/protobuf/src/google/protobuf/edition_unittest.proto @@ -83,18 +83,18 @@ message TestAllTypes { NestedMessage optional_nested_message = 18; ForeignMessage optional_foreign_message = 19; - protobuf_unittest_import.ImportMessage optional_import_message = 20; + proto2_unittest_import.ImportMessage optional_import_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnum optional_foreign_enum = 22; - protobuf_unittest_import.ImportEnum optional_import_enum = 23; + proto2_unittest_import.ImportEnum optional_import_enum = 23; string optional_string_piece = 24 [ctype=STRING_PIECE]; string optional_cord = 25 [ctype=CORD]; bytes optional_bytes_cord = 86 [ctype=CORD]; // Defined in unittest_import_public.proto - protobuf_unittest_import.PublicImportMessage + proto2_unittest_import.PublicImportMessage optional_public_import_message = 26; NestedMessage optional_lazy_message = 27 [lazy=true]; @@ -125,11 +125,11 @@ message TestAllTypes { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + repeated proto2_unittest_import.ImportMessage repeated_import_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnum repeated_foreign_enum = 52; - repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + repeated proto2_unittest_import.ImportEnum repeated_import_enum = 53; repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; repeated string repeated_cord = 55 [ctype=CORD]; @@ -155,7 +155,7 @@ message TestAllTypes { NestedEnum default_nested_enum = 81 [default = BAR ]; ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; - protobuf_unittest_import.ImportEnum + proto2_unittest_import.ImportEnum default_import_enum = 83 [default = IMPORT_BAR]; string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; @@ -255,12 +255,12 @@ extend TestAllExtensions { TestAllTypes.NestedMessage optional_nested_message_extension = 18; ForeignMessage optional_foreign_message_extension = 19; - protobuf_unittest_import.ImportMessage + proto2_unittest_import.ImportMessage optional_import_message_extension = 20; TestAllTypes.NestedEnum optional_nested_enum_extension = 21; ForeignEnum optional_foreign_enum_extension = 22; - protobuf_unittest_import.ImportEnum + proto2_unittest_import.ImportEnum optional_import_enum_extension = 23; string optional_string_piece_extension = 24 [ctype=STRING_PIECE]; @@ -269,7 +269,7 @@ extend TestAllExtensions { string optional_cord_extension = 25; bytes optional_bytes_cord_extension = 86; - protobuf_unittest_import.PublicImportMessage + proto2_unittest_import.PublicImportMessage optional_public_import_message_extension = 26; TestAllTypes.NestedMessage @@ -299,12 +299,12 @@ extend TestAllExtensions { repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; repeated ForeignMessage repeated_foreign_message_extension = 49; - repeated protobuf_unittest_import.ImportMessage + repeated proto2_unittest_import.ImportMessage repeated_import_message_extension = 50; repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; repeated ForeignEnum repeated_foreign_enum_extension = 52; - repeated protobuf_unittest_import.ImportEnum + repeated proto2_unittest_import.ImportEnum repeated_import_enum_extension = 53; repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE]; @@ -336,7 +336,7 @@ extend TestAllExtensions { default_nested_enum_extension = 81 [default = BAR]; ForeignEnum default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; - protobuf_unittest_import.ImportEnum + proto2_unittest_import.ImportEnum default_import_enum_extension = 83 [default = IMPORT_BAR]; string default_string_piece_extension = 84 @@ -649,7 +649,7 @@ message TestIsInitialized { // Test that groups have disjoint field numbers from their siblings and // parents. This is NOT possible in proto1; only google.protobuf. When attempting // to compile with proto1, this will emit an error; so we only include it -// in protobuf_unittest_proto. +// in proto2_unittest_proto. message TestDupFieldNumber { // NO_PROTO1 int32 a = 1; // NO_PROTO1 message Foo { int32 a = 1; } // NO_PROTO1 @@ -1177,6 +1177,14 @@ message TestMessageSize { int64 m6 = 6; } +// Tests eager verification of a lazy message field. +message TestEagerlyVerifiedLazyMessage { + message LazyMessage { + bytes bytes_field = 1; + } + LazyMessage lazy_message = 1 [lazy = true]; +} + // Test that RPC services work. message FooRequest {} message FooResponse {} diff --git a/third_party/protobuf/src/google/protobuf/empty.pb.cc b/third_party/protobuf/src/google/protobuf/empty.pb.cc index f3b626bdb0a7a..9cd4656876418 100644 --- a/third_party/protobuf/src/google/protobuf/empty.pb.cc +++ b/third_party/protobuf/src/google/protobuf/empty.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/empty.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/empty.pb.h" @@ -26,10 +26,10 @@ namespace _pbi = ::google::protobuf::internal; namespace _fl = ::google::protobuf::internal::field_layout; namespace google { namespace protobuf { - template <typename> +template <typename> PROTOBUF_CONSTEXPR Empty::Empty(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::internal::ZeroFieldsBase(_class_data_.base()){} + : ::google::protobuf::internal::ZeroFieldsBase(Empty_class_data_.base()){} #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::internal::ZeroFieldsBase() { } @@ -46,9 +46,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EmptyDefaultTypeInternal _Empty_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -67,7 +67,7 @@ static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::google::protobuf::Empty)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_Empty_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2fempty_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -103,19 +103,19 @@ class Empty::_Internal { public: }; -Empty::Empty(::google::protobuf::Arena* arena) +Empty::Empty(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::internal::ZeroFieldsBase(arena, _class_data_.base()) { + : ::google::protobuf::internal::ZeroFieldsBase(arena, Empty_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::internal::ZeroFieldsBase(arena) { #endif // PROTOBUF_CUSTOM_VTABLE // @@protoc_insertion_point(arena_constructor:google.protobuf.Empty) } Empty::Empty( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Empty& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::internal::ZeroFieldsBase(arena, _class_data_.base()) { + : ::google::protobuf::internal::ZeroFieldsBase(arena, Empty_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::internal::ZeroFieldsBase(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -127,43 +127,51 @@ Empty::Empty( // @@protoc_insertion_point(copy_constructor:google.protobuf.Empty) } -inline void* Empty::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Empty::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Empty(arena); } constexpr auto Empty::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(Empty), alignof(Empty)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Empty::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Empty_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Empty::MergeImpl, - ::google::protobuf::internal::ZeroFieldsBase::GetNewImpl<Empty>(), +constexpr auto Empty::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Empty_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Empty::MergeImpl, + ::google::protobuf::internal::ZeroFieldsBase::GetNewImpl<Empty>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Empty::SharedDtor, - ::google::protobuf::internal::ZeroFieldsBase::GetClearImpl<Empty>(), &Empty::ByteSizeLong, - &Empty::_InternalSerialize, + &Empty::SharedDtor, + ::google::protobuf::internal::ZeroFieldsBase::GetClearImpl<Empty>(), &Empty::ByteSizeLong, + &Empty::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Empty, _impl_._cached_size_), - false, - }, - &Empty::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fempty_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Empty::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Empty, _impl_._cached_size_), + false, + }, + &Empty::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fempty_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Empty_class_data_ = + Empty::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Empty::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Empty_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Empty_class_data_.tc_table); + return Empty_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 0, 0, 0, 2> Empty::_table_ = { +const ::_pbi::TcParseTable<0, 0, 0, 0, 2> +Empty::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -174,7 +182,7 @@ const ::_pbi::TcParseTable<0, 0, 0, 0, 2> Empty::_table_ = { 0, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Empty_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -184,8 +192,7 @@ const ::_pbi::TcParseTable<0, 0, 0, 0, 2> Empty::_table_ = { {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 - }}, - // no field_entries, or aux_entries + }}, // no field_entries, or aux_entries {{ }}, }; @@ -196,7 +203,6 @@ const ::_pbi::TcParseTable<0, 0, 0, 0, 2> Empty::_table_ = { - ::google::protobuf::Metadata Empty::GetMetadata() const { return ::google::protobuf::internal::ZeroFieldsBase::GetMetadataImpl(GetClassData()->full()); } @@ -209,7 +215,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fempty_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/empty.pb.h b/third_party/protobuf/src/google/protobuf/empty.pb.h index 1973a7bcbaa79..b267284b423dc 100644 --- a/third_party/protobuf/src/google/protobuf/empty.pb.h +++ b/third_party/protobuf/src/google/protobuf/empty.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/empty.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fempty_2eproto_2epb_2eh #define google_2fprotobuf_2fempty_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -50,13 +50,15 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fempty_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fempty_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto; +} // extern "C" namespace google { namespace protobuf { class Empty; struct EmptyDefaultTypeInternal; PROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Empty_class_data_; } // namespace protobuf } // namespace google @@ -74,15 +76,14 @@ class PROTOBUF_EXPORT Empty final : public ::google::protobuf::internal::ZeroFie inline Empty() : Empty(nullptr) {} #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Empty* msg, std::destroying_delete_t) { + void operator delete(Empty* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Empty)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Empty( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Empty(::google::protobuf::internal::ConstantInitialized); inline Empty(const Empty& from) : Empty(nullptr, from) {} inline Empty(Empty&& from) noexcept @@ -105,30 +106,27 @@ class PROTOBUF_EXPORT Empty final : public ::google::protobuf::internal::ZeroFie ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Empty& default_instance() { - return *internal_default_instance(); - } - static inline const Empty* internal_default_instance() { - return reinterpret_cast<const Empty*>( + return *reinterpret_cast<const Empty*>( &_Empty_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(Empty& a, Empty& b) { a.Swap(&b); } - inline void Swap(Empty* other) { + inline void Swap(Empty* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -136,7 +134,7 @@ class PROTOBUF_EXPORT Empty final : public ::google::protobuf::internal::ZeroFie ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Empty* other) { + void UnsafeArenaSwap(Empty* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -144,7 +142,7 @@ class PROTOBUF_EXPORT Empty final : public ::google::protobuf::internal::ZeroFie // implements Message ---------------------------------------------- - Empty* New(::google::protobuf::Arena* arena = nullptr) const { + Empty* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::internal::ZeroFieldsBase::DefaultConstruct<Empty>(arena); } using ::google::protobuf::internal::ZeroFieldsBase::CopyFrom; @@ -162,24 +160,26 @@ class PROTOBUF_EXPORT Empty final : public ::google::protobuf::internal::ZeroFie } private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Empty"; } protected: - explicit Empty(::google::protobuf::Arena* arena); - Empty(::google::protobuf::Arena* arena, const Empty& from); - Empty(::google::protobuf::Arena* arena, Empty&& from) noexcept + explicit Empty(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Empty(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Empty& from); + Empty( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Empty&& from) noexcept : Empty(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -188,9 +188,9 @@ class PROTOBUF_EXPORT Empty final : public ::google::protobuf::internal::ZeroFie private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 0, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 0, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -200,18 +200,21 @@ class PROTOBUF_EXPORT Empty final : public ::google::protobuf::internal::ZeroFie using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Empty& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Empty& from_msg); PROTOBUF_TSAN_DECLARE_MEMBER }; friend struct ::TableStruct_google_2fprotobuf_2fempty_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Empty_class_data_; + // =================================================================== diff --git a/third_party/protobuf/src/google/protobuf/explicitly_constructed.h b/third_party/protobuf/src/google/protobuf/explicitly_constructed.h index e9e27c6aeca45..3527c4e42e4f1 100644 --- a/third_party/protobuf/src/google/protobuf/explicitly_constructed.h +++ b/third_party/protobuf/src/google/protobuf/explicitly_constructed.h @@ -58,11 +58,6 @@ class ExplicitlyConstructed { } union_; }; -// ArenaStringPtr compatible explicitly constructed string type. -// This empty string type is aligned with a minimum alignment of 8 bytes -// which is the minimum requirement of ArenaStringPtr -using ExplicitlyConstructedArenaString = ExplicitlyConstructed<std::string, 8>; - } // namespace internal } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/extension_set.cc b/third_party/protobuf/src/google/protobuf/extension_set.cc index 94229c6491476..8956e10523887 100644 --- a/third_party/protobuf/src/google/protobuf/extension_set.cc +++ b/third_party/protobuf/src/google/protobuf/extension_set.cc @@ -13,6 +13,7 @@ #include <algorithm> #include <atomic> +#include <cassert> #include <cstddef> #include <cstdint> #include <string> @@ -20,10 +21,13 @@ #include <type_traits> #include <utility> +#include "absl/base/attributes.h" +#include "absl/base/optimization.h" #include "absl/container/flat_hash_set.h" #include "absl/hash/hash.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" +#include "absl/numeric/bits.h" #include "google/protobuf/arena.h" #include "google/protobuf/extension_set_inl.h" #include "google/protobuf/io/coded_stream.h" @@ -135,28 +139,14 @@ void ExtensionSet::RegisterExtension(const MessageLite* extendee, int number, Register(info); } -static bool CallNoArgValidityFunc(const void* arg, int number) { - // Note: Must use C-style cast here rather than reinterpret_cast because - // the C++ standard at one point did not allow casts between function and - // data pointers and some compilers enforce this for C++-style casts. No - // compiler enforces it for C-style casts since lots of C-style code has - // relied on these kinds of casts for a long time, despite being - // technically undefined. See: - // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195 - // Also note: Some compilers do not allow function pointers to be "const". - // Which makes sense, I suppose, because it's meaningless. - return ((EnumValidityFunc*)arg)(number); -} - void ExtensionSet::RegisterEnumExtension(const MessageLite* extendee, int number, FieldType type, bool is_repeated, bool is_packed, - EnumValidityFunc* is_valid) { + const uint32_t* validation_data) { ABSL_CHECK_EQ(type, WireFormatLite::TYPE_ENUM); ExtensionInfo info(extendee, number, type, is_repeated, is_packed); - info.enum_validity_check.func = CallNoArgValidityFunc; - // See comment in CallNoArgValidityFunc() about why we use a c-style cast. - info.enum_validity_check.arg = (void*)is_valid; + info.enum_validity_check.func = nullptr; + info.enum_validity_check.arg = validation_data; Register(info); } @@ -189,7 +179,7 @@ ExtensionSet::~ExtensionSet() { if (arena_ == nullptr) { ForEach([](int /* number */, Extension& ext) { ext.Free(); }, PrefetchNta{}); - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { delete map_.large; } else { DeleteFlatMap(map_.flat, flat_capacity_); @@ -197,6 +187,19 @@ ExtensionSet::~ExtensionSet() { } } +ExtensionSet::KeyValue* ExtensionSet::AllocateFlatMap( + Arena* arena, uint16_t powerof2_flat_capacity) { + // It is important to allocate power-of-2 bytes in order to reuse + // allocated blocks in arena for ExtensionSet and RepeatedFields. + // ReturnArrayMemory is also more efficient with power-of-2 bytes, and + // sizeof(KeyValue) is a power-of-2 on 64-bit platforms. + static_assert(absl::has_single_bit(sizeof(KeyValue)) || sizeof(void*) != 8, + "sizeof(KeyValue) must be a power of 2"); + ABSL_DCHECK(absl::has_single_bit(powerof2_flat_capacity)); + return Arena::CreateArray<ExtensionSet::KeyValue>(arena, + powerof2_flat_capacity); +} + void ExtensionSet::DeleteFlatMap(const ExtensionSet::KeyValue* flat, uint16_t flat_capacity) { // Arena::CreateArray already requires a trivially destructible type, but @@ -398,6 +401,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, extension->is_pointer = true; extension->type = field_type; extension->is_packed = packed; + ABSL_DCHECK(!extension->is_cleared); switch (WireFormatLite::FieldTypeToCppType( static_cast<WireFormatLite::FieldType>(field_type))) { @@ -969,27 +973,13 @@ namespace { // already allocated and will not be going away. template <typename ItX, typename ItY> size_t SizeOfUnion(ItX it_dest, ItX end_dest, ItY it_source, ItY end_source) { - size_t result = 0; - while (it_dest != end_dest && it_source != end_source) { - if (it_dest->first < it_source->first) { - ++result; - ++it_dest; - } else if (it_dest->first == it_source->first) { - ++result; - ++it_dest; - ++it_source; - } else { - if (!it_source->second.is_cleared) { - ++result; - } - ++it_source; - } - } - result += std::distance(it_dest, end_dest); + size_t result = std::distance(it_dest, end_dest); for (; it_source != end_source; ++it_source) { - if (!it_source->second.is_cleared) { - ++result; + while (it_dest != end_dest && it_dest->first < it_source->first) { + ++it_dest; } + result += (it_dest == end_dest || it_dest->first > it_source->first) && + !it_source->second.is_cleared; } return result; } @@ -998,8 +988,45 @@ size_t SizeOfUnion(ItX it_dest, ItX end_dest, ItY it_source, ItY end_source) { void ExtensionSet::MergeFrom(const MessageLite* extendee, const ExtensionSet& other) { Prefetch5LinesFrom1Line(&other); - if (PROTOBUF_PREDICT_TRUE(!is_large())) { - if (PROTOBUF_PREDICT_TRUE(!other.is_large())) { + if (ABSL_PREDICT_TRUE(IsCompletelyEmpty() && !other.is_large())) { + InternalMergeFromSmallToEmpty(extendee, other); + return; + } + InternalMergeFromSlow(extendee, other); +} + +void ExtensionSet::InternalMergeFromSmallToEmpty(const MessageLite* extendee, + const ExtensionSet& other) { + ABSL_DCHECK(!other.is_large()); + // Compiler is complaining on potential side effects for `!other.is_large()`. + ABSL_ASSUME(static_cast<int16_t>(flat_size_) >= 0); + ABSL_DCHECK(IsCompletelyEmpty()); + + size_t count = other.NumExtensions(); + if (count == 0) { + return; + } + + InternalReserveSmallCapacityFromEmpty(count); + flat_size_ = static_cast<uint16_t>(count); + auto dst_it = map_.flat; + other.ForEach( + [extendee, this, &dst_it, &other](int number, const Extension& ext) { + if (ext.is_cleared) { + return; + } + dst_it->first = number; + this->InternalExtensionMergeFromIntoUninitializedExtension( + dst_it->second, extendee, number, ext, other.arena_); + ++dst_it; + }, + Prefetch{}); +} + +void ExtensionSet::InternalMergeFromSlow(const MessageLite* extendee, + const ExtensionSet& other) { + if (ABSL_PREDICT_TRUE(!is_large())) { + if (ABSL_PREDICT_TRUE(!other.is_large())) { GrowCapacity(SizeOfUnion(flat_begin(), flat_end(), other.flat_begin(), other.flat_end())); } else { @@ -1015,35 +1042,22 @@ void ExtensionSet::MergeFrom(const MessageLite* extendee, Prefetch{}); } -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 = - MaybeNewExtension(number, other_extension.descriptor, &extension); - if (is_new) { - // Extension did not already exist in set. - extension->type = other_extension.type; - extension->is_packed = other_extension.is_packed; - extension->is_repeated = true; - extension->is_pointer = true; - } else { - ABSL_DCHECK_EQ(extension->type, other_extension.type); - ABSL_DCHECK_EQ(extension->is_packed, other_extension.is_packed); - ABSL_DCHECK(extension->is_repeated); - } +void ExtensionSet::InternalExtensionMergeFromIntoUninitializedExtension( + Extension& dst_extension, const MessageLite* extendee, int number, + const Extension& other_extension, Arena* other_arena) { + // Copy and initialize all the fields. + // We fix up incorrect pointers later. + // Primitive values are copied here. + dst_extension = other_extension; + if (other_extension.is_repeated) { switch (cpp_type(other_extension.type)) { -#define HANDLE_TYPE(UPPERCASE, LOWERCASE, REPEATED_TYPE) \ - case WireFormatLite::CPPTYPE_##UPPERCASE: \ - if (is_new) { \ - extension->ptr.repeated_##LOWERCASE##_value = \ - Arena::Create<REPEATED_TYPE>(arena_); \ - } \ - extension->ptr.repeated_##LOWERCASE##_value->MergeFrom( \ - *other_extension.ptr.repeated_##LOWERCASE##_value); \ +#define HANDLE_TYPE(UPPERCASE, LOWERCASE, REPEATED_TYPE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + dst_extension.ptr.repeated_##LOWERCASE##_value = \ + Arena::Create<REPEATED_TYPE>(arena_); \ + dst_extension.ptr.repeated_##LOWERCASE##_value->MergeFrom( \ + *other_extension.ptr.repeated_##LOWERCASE##_value); \ break; HANDLE_TYPE(INT32, int32_t, RepeatedField<int32_t>); @@ -1058,83 +1072,127 @@ void ExtensionSet::InternalExtensionMergeFrom(const MessageLite* extendee, HANDLE_TYPE(MESSAGE, message, RepeatedPtrField<MessageLite>); #undef HANDLE_TYPE } - } else { - if (!other_extension.is_cleared) { - switch (cpp_type(other_extension.type)) { -#define HANDLE_TYPE(UPPERCASE, LOWERCASE, CAMELCASE) \ - case WireFormatLite::CPPTYPE_##UPPERCASE: \ - Set##CAMELCASE(number, other_extension.type, \ - other_extension.LOWERCASE##_value, \ - other_extension.descriptor); \ + return; + } + + // Non-repeated extension + switch (cpp_type(other_extension.type)) { + case WireFormatLite::CPPTYPE_INT32: + case WireFormatLite::CPPTYPE_INT64: + case WireFormatLite::CPPTYPE_UINT32: + case WireFormatLite::CPPTYPE_UINT64: + case WireFormatLite::CPPTYPE_FLOAT: + case WireFormatLite::CPPTYPE_DOUBLE: + case WireFormatLite::CPPTYPE_BOOL: + case WireFormatLite::CPPTYPE_ENUM: + break; // Do nothing. + case WireFormatLite::CPPTYPE_STRING: + dst_extension.ptr.string_value = + Arena::Create<std::string>(arena_, *other_extension.ptr.string_value); + break; + case WireFormatLite::CPPTYPE_MESSAGE: { + if (other_extension.is_lazy) { + dst_extension.ptr.lazymessage_value = + other_extension.ptr.lazymessage_value->Clone( + arena_, *other_extension.ptr.lazymessage_value, other_arena); + } else { + dst_extension.ptr.message_value = + other_extension.ptr.message_value->New(arena_); + dst_extension.ptr.message_value->CheckTypeAndMergeFrom( + *other_extension.ptr.message_value); + } + break; + } + } +} + +void ExtensionSet::InternalExtensionMergeFrom(const MessageLite* extendee, + int number, + const Extension& other_extension, + Arena* other_arena) { + Extension* dst_extension; + bool is_new = + MaybeNewExtension(number, other_extension.descriptor, &dst_extension); + if (is_new) { + InternalExtensionMergeFromIntoUninitializedExtension( + *dst_extension, extendee, number, other_extension, other_arena); + return; + } + if (other_extension.is_repeated) { + ABSL_DCHECK_EQ(dst_extension->type, other_extension.type); + ABSL_DCHECK_EQ(dst_extension->is_packed, other_extension.is_packed); + ABSL_DCHECK(dst_extension->is_repeated); + + switch (cpp_type(other_extension.type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + dst_extension->ptr.repeated_##LOWERCASE##_value->MergeFrom( \ + *other_extension.ptr.repeated_##LOWERCASE##_value); \ break; - HANDLE_TYPE(INT32, int32_t, Int32); - HANDLE_TYPE(INT64, int64_t, Int64); - HANDLE_TYPE(UINT32, uint32_t, UInt32); - HANDLE_TYPE(UINT64, uint64_t, UInt64); - HANDLE_TYPE(FLOAT, float, Float); - HANDLE_TYPE(DOUBLE, double, Double); - HANDLE_TYPE(BOOL, bool, Bool); - HANDLE_TYPE(ENUM, enum, Enum); + HANDLE_TYPE(INT32, int32_t); + HANDLE_TYPE(INT64, int64_t); + HANDLE_TYPE(UINT32, uint32_t); + HANDLE_TYPE(UINT64, uint64_t); + HANDLE_TYPE(FLOAT, float); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE(BOOL, bool); + HANDLE_TYPE(ENUM, enum); + HANDLE_TYPE(STRING, string); + HANDLE_TYPE(MESSAGE, message); #undef HANDLE_TYPE - case WireFormatLite::CPPTYPE_STRING: - SetString(number, other_extension.type, - *other_extension.ptr.string_value, - other_extension.descriptor); - break; - case WireFormatLite::CPPTYPE_MESSAGE: { - Arena* const arena = arena_; - Extension* extension; - bool is_new = - MaybeNewExtension(number, other_extension.descriptor, &extension); - if (is_new) { - extension->type = other_extension.type; - extension->is_packed = other_extension.is_packed; - extension->is_repeated = false; - extension->is_pointer = true; - if (other_extension.is_lazy) { - extension->is_lazy = true; - extension->ptr.lazymessage_value = - other_extension.ptr.lazymessage_value->New(arena); - extension->ptr.lazymessage_value->MergeFrom( - GetPrototypeForLazyMessage(extendee, number), - *other_extension.ptr.lazymessage_value, arena, other_arena); - } else { - extension->is_lazy = false; - extension->ptr.message_value = - other_extension.ptr.message_value->New(arena); - extension->ptr.message_value->CheckTypeAndMergeFrom( - *other_extension.ptr.message_value); - } - } else { - ABSL_DCHECK_EQ(extension->type, other_extension.type); - ABSL_DCHECK_EQ(extension->is_packed, other_extension.is_packed); - ABSL_DCHECK(!extension->is_repeated); - if (other_extension.is_lazy) { - if (extension->is_lazy) { - extension->ptr.lazymessage_value->MergeFrom( - GetPrototypeForLazyMessage(extendee, number), - *other_extension.ptr.lazymessage_value, arena, other_arena); - } else { - extension->ptr.message_value->CheckTypeAndMergeFrom( - other_extension.ptr.lazymessage_value->GetMessage( - *extension->ptr.message_value, other_arena)); - } - } else { - if (extension->is_lazy) { - extension->ptr.lazymessage_value - ->MutableMessage(*other_extension.ptr.message_value, arena) - ->CheckTypeAndMergeFrom(*other_extension.ptr.message_value); - } else { - extension->ptr.message_value->CheckTypeAndMergeFrom( - *other_extension.ptr.message_value); - } - } - } - extension->is_cleared = false; - break; + } + return; + } + + if (other_extension.is_cleared) { + return; + } + dst_extension->is_cleared = false; + switch (cpp_type(other_extension.type)) { +#define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ + case WireFormatLite::CPPTYPE_##UPPERCASE: \ + dst_extension->LOWERCASE##_value = other_extension.LOWERCASE##_value; \ + break; + + HANDLE_TYPE(INT32, int32_t); + HANDLE_TYPE(INT64, int64_t); + HANDLE_TYPE(UINT32, uint32_t); + HANDLE_TYPE(UINT64, uint64_t); + HANDLE_TYPE(FLOAT, float); + HANDLE_TYPE(DOUBLE, double); + HANDLE_TYPE(BOOL, bool); + HANDLE_TYPE(ENUM, enum); +#undef HANDLE_TYPE + case WireFormatLite::CPPTYPE_STRING: + dst_extension->ptr.string_value->assign( + *other_extension.ptr.string_value); + break; + case WireFormatLite::CPPTYPE_MESSAGE: { + ABSL_DCHECK_EQ(dst_extension->type, other_extension.type); + ABSL_DCHECK_EQ(dst_extension->is_packed, other_extension.is_packed); + ABSL_DCHECK(!dst_extension->is_repeated); + if (other_extension.is_lazy) { + if (dst_extension->is_lazy) { + dst_extension->ptr.lazymessage_value->MergeFrom( + GetPrototypeForLazyMessage(extendee, number), + *other_extension.ptr.lazymessage_value, arena_, other_arena); + } else { + dst_extension->ptr.message_value->CheckTypeAndMergeFrom( + other_extension.ptr.lazymessage_value->GetMessage( + *dst_extension->ptr.message_value, other_arena)); + } + } else { + if (dst_extension->is_lazy) { + dst_extension->ptr.lazymessage_value + ->MutableMessage(*other_extension.ptr.message_value, arena_) + ->CheckTypeAndMergeFrom(*other_extension.ptr.message_value); + } else { + dst_extension->ptr.message_value->CheckTypeAndMergeFrom( + *other_extension.ptr.message_value); } } + break; } } } @@ -1229,7 +1287,7 @@ bool ExtensionSet::IsInitialized(const MessageLite* extendee) const { // Extensions are never required. However, we need to check that all // embedded messages are initialized. Arena* const arena = arena_; - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { for (const auto& kv : *map_.large) { if (!kv.second.IsInitialized(this, extendee, kv.first, arena)) { return false; @@ -1279,14 +1337,9 @@ bool ExtensionSet::FieldTypeIsPointer(FieldType type) { uint8_t* ExtensionSet::_InternalSerializeImpl( const MessageLite* extendee, int start_field_number, int end_field_number, uint8_t* target, io::EpsCopyOutputStream* stream) const { - if (PROTOBUF_PREDICT_FALSE(is_large())) { - const auto& end = map_.large->end(); - for (auto it = map_.large->lower_bound(start_field_number); - it != end && it->first < end_field_number; ++it) { - target = it->second.InternalSerializeFieldWithCachedSizesToArray( - extendee, this, it->first, target, stream); - } - return target; + if (ABSL_PREDICT_FALSE(is_large())) { + return _InternalSerializeImplLarge(extendee, start_field_number, + end_field_number, target, stream); } const KeyValue* end = flat_end(); const KeyValue* it = flat_begin(); @@ -1298,6 +1351,31 @@ uint8_t* ExtensionSet::_InternalSerializeImpl( return target; } +uint8_t* ExtensionSet::_InternalSerializeAllImpl( + const MessageLite* extendee, uint8_t* target, + io::EpsCopyOutputStream* stream) const { + ForEach( + [&target, extendee, stream, this](int number, const Extension& ext) { + target = ext.InternalSerializeFieldWithCachedSizesToArray( + extendee, this, number, target, stream); + }, + Prefetch{}); + return target; +} + +uint8_t* ExtensionSet::_InternalSerializeImplLarge( + const MessageLite* extendee, int start_field_number, int end_field_number, + uint8_t* target, io::EpsCopyOutputStream* stream) const { + assert(is_large()); + const auto& end = map_.large->end(); + for (auto it = map_.large->lower_bound(start_field_number); + it != end && it->first < end_field_number; ++it) { + target = it->second.InternalSerializeFieldWithCachedSizesToArray( + extendee, this, it->first, target, stream); + } + return target; +} + uint8_t* ExtensionSet::InternalSerializeMessageSetWithCachedSizesToArray( const MessageLite* extendee, uint8_t* target, io::EpsCopyOutputStream* stream) const { @@ -1620,7 +1698,7 @@ void ExtensionSet::LazyMessageExtension::UnusedKeyMethod() {} const ExtensionSet::Extension* ExtensionSet::FindOrNull(int key) const { if (flat_size_ == 0) { return nullptr; - } else if (PROTOBUF_PREDICT_TRUE(!is_large())) { + } else if (ABSL_PREDICT_TRUE(!is_large())) { for (auto it = flat_begin(), end = flat_end(); it != end && it->first <= key; ++it) { if (it->first == key) return &it->second; @@ -1652,33 +1730,48 @@ ExtensionSet::Extension* ExtensionSet::FindOrNullInLargeMap(int key) { const_this->FindOrNullInLargeMap(key)); } -std::pair<ExtensionSet::Extension*, bool> ExtensionSet::Insert(int key) { - if (PROTOBUF_PREDICT_FALSE(is_large())) { - auto maybe = map_.large->insert({key, Extension()}); - return {&maybe.first->second, maybe.second}; - } - KeyValue* end = flat_end(); - KeyValue* it = flat_begin(); - for (; it != end && it->first <= key; ++it) { - if (it->first == key) return {&it->second, false}; - } - if (flat_size_ < flat_capacity_) { - std::copy_backward(it, end, end + 1); - ++flat_size_; - it->first = key; - it->second = Extension(); - return {&it->second, true}; - } - GrowCapacity(flat_size_ + 1); - return Insert(key); +ABSL_ATTRIBUTE_NOINLINE +std::pair<ExtensionSet::Extension*, bool> +ExtensionSet::InternalInsertIntoLargeMap(int key) { + ABSL_DCHECK(is_large()); + auto maybe = map_.large->insert({key, Extension()}); + return {&maybe.first->second, maybe.second}; } -namespace { -constexpr bool IsPowerOfTwo(size_t n) { return (n & (n - 1)) == 0; } -} // namespace +std::pair<ExtensionSet::Extension*, bool> ExtensionSet::Insert(int key) { + if (ABSL_PREDICT_FALSE(is_large())) { + return InternalInsertIntoLargeMap(key); + } + uint16_t i = flat_size_; + KeyValue* flat = map_.flat; + // Iterating from the back to benefit the case where the keys are inserted in + // increasing order. + for (; i > 0; --i) { + int map_key = flat[i - 1].first; + if (map_key == key) { + return {&flat[i - 1].second, false}; + } + if (map_key < key) { + break; + } + } + if (flat_size_ == flat_capacity_) { + GrowCapacity(flat_size_ + 1); + if (ABSL_PREDICT_FALSE(is_large())) { + return InternalInsertIntoLargeMap(key); + } + flat = map_.flat; // Reload flat pointer after GrowCapacity. + } + + std::copy_backward(flat + i, flat + flat_size_, flat + flat_size_ + 1); + ++flat_size_; + flat[i].first = key; + flat[i].second = Extension(); + return {&flat[i].second, true}; +} void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) { - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { return; // LargeMap does not have a "reserve" method. } if (flat_capacity_ >= minimum_new_capacity) { @@ -1703,16 +1796,10 @@ void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) { flat_size_ = static_cast<uint16_t>(-1); ABSL_DCHECK(is_large()); } else { - new_map.flat = Arena::CreateArray<KeyValue>(arena, new_flat_capacity); + new_map.flat = AllocateFlatMap(arena, new_flat_capacity); std::copy(begin, end, new_map.flat); } - // ReturnArrayMemory is more efficient with power-of-2 bytes, and - // sizeof(KeyValue) is a power-of-2 on 64-bit platforms. flat_capacity_ is - // always a power-of-2. - ABSL_DCHECK(IsPowerOfTwo(sizeof(KeyValue)) || sizeof(void*) != 8) - << sizeof(KeyValue) << " " << sizeof(void*); - ABSL_DCHECK(IsPowerOfTwo(flat_capacity_)); if (flat_capacity_ > 0) { if (arena == nullptr) { DeleteFlatMap(begin, flat_capacity_); @@ -1724,6 +1811,16 @@ void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) { map_ = new_map; } +void ExtensionSet::InternalReserveSmallCapacityFromEmpty( + size_t minimum_new_capacity) { + ABSL_DCHECK(flat_capacity_ == 0); + ABSL_DCHECK(minimum_new_capacity <= kMaximumFlatCapacity); + ABSL_DCHECK(minimum_new_capacity > 0); + const size_t new_flat_capacity = absl::bit_ceil(minimum_new_capacity); + flat_capacity_ = new_flat_capacity; + map_.flat = AllocateFlatMap(arena_, new_flat_capacity); +} + #if (__cplusplus < 201703) && \ (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) // static @@ -1732,7 +1829,7 @@ constexpr uint16_t ExtensionSet::kMaximumFlatCapacity; // && _MSC_VER < 1912)) void ExtensionSet::Erase(int key) { - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { map_.large->erase(key); return; } diff --git a/third_party/protobuf/src/google/protobuf/extension_set.h b/third_party/protobuf/src/google/protobuf/extension_set.h index 526522e84fdb6..d08a1de28fb4e 100644 --- a/third_party/protobuf/src/google/protobuf/extension_set.h +++ b/third_party/protobuf/src/google/protobuf/extension_set.h @@ -24,6 +24,7 @@ #include <string> #include <type_traits> #include <utility> +#include <variant> #include <vector> #include "google/protobuf/stubs/common.h" @@ -32,6 +33,7 @@ #include "absl/base/prefetch.h" #include "absl/container/btree_map.h" #include "absl/log/absl_check.h" +#include "google/protobuf/generated_enum_util.h" #include "google/protobuf/internal_visibility.h" #include "google/protobuf/port.h" #include "google/protobuf/io/coded_stream.h" @@ -82,17 +84,16 @@ namespace internal { class InternalMetadata; +namespace v2 { +class TableDriven; +} // namespace v2 + // Used to store values of type WireFormatLite::FieldType without having to // #include wire_format_lite.h. Also, ensures that we use only one byte to // store these values, which is important to keep the layout of // ExtensionSet::Extension small. typedef uint8_t FieldType; -// A function which, given an integer value, returns true if the number -// matches one of the defined values for the corresponding enum type. This -// is used with RegisterEnumExtension, below. -typedef bool EnumValidityFunc(int number); - // Version of the above which takes an argument. This is needed to deal with // extensions that are not compiled in. typedef bool EnumValidityFuncWithArg(const void* arg, int number); @@ -136,8 +137,15 @@ struct ExtensionInfo { LazyAnnotation is_lazy = LazyAnnotation::kUndefined; struct EnumValidityCheck { + // TODO: Fully remove the function pointer approach. EnumValidityFuncWithArg* func; const void* arg; + + bool IsValid(int value) const { + return func != nullptr ? func(arg, value) + : internal::ValidateEnum( + value, static_cast<const uint32_t*>(arg)); + } }; struct MessageInfo { @@ -225,7 +233,8 @@ class PROTOBUF_EXPORT ExtensionSet { bool is_packed); static void RegisterEnumExtension(const MessageLite* extendee, int number, FieldType type, bool is_repeated, - bool is_packed, EnumValidityFunc* is_valid); + bool is_packed, + const uint32_t* validation_data); static void RegisterMessageExtension(const MessageLite* extendee, int number, FieldType type, bool is_repeated, bool is_packed, @@ -334,13 +343,13 @@ class PROTOBUF_EXPORT ExtensionSet { void UnsafeArenaSetAllocatedMessage(int number, FieldType type, const FieldDescriptor* descriptor, MessageLite* message); - PROTOBUF_NODISCARD MessageLite* ReleaseMessage(int number, - const MessageLite& prototype); + [[nodiscard]] MessageLite* ReleaseMessage(int number, + const MessageLite& prototype); MessageLite* UnsafeArenaReleaseMessage(int number, const MessageLite& prototype); - PROTOBUF_NODISCARD MessageLite* ReleaseMessage( - const FieldDescriptor* descriptor, MessageFactory* factory); + [[nodiscard]] MessageLite* ReleaseMessage(const FieldDescriptor* descriptor, + MessageFactory* factory); MessageLite* UnsafeArenaReleaseMessage(const FieldDescriptor* descriptor, MessageFactory* factory); #undef desc @@ -409,7 +418,7 @@ class PROTOBUF_EXPORT ExtensionSet { #undef desc void RemoveLast(int number); - PROTOBUF_NODISCARD MessageLite* ReleaseLast(int number); + [[nodiscard]] MessageLite* ReleaseLast(int number); MessageLite* UnsafeArenaReleaseLast(int number); void SwapElements(int number, int index1, int index2); @@ -479,7 +488,6 @@ class PROTOBUF_EXPORT ExtensionSet { // serialized extensions. // // Returns a pointer past the last written byte. - uint8_t* _InternalSerialize(const MessageLite* extendee, int start_field_number, int end_field_number, uint8_t* target, @@ -492,6 +500,16 @@ class PROTOBUF_EXPORT ExtensionSet { end_field_number, target, stream); } + // Same as _InternalSerialize, but do not verify the range of field numbers. + uint8_t* _InternalSerializeAll(const MessageLite* extendee, uint8_t* target, + io::EpsCopyOutputStream* stream) const { + if (flat_size_ == 0) { + assert(!is_large()); + return target; + } + return _InternalSerializeAllImpl(extendee, target, stream); + } + // Like above but serializes in MessageSet format. void SerializeMessageSetWithCachedSizes(const MessageLite* extendee, io::CodedOutputStream* output) const { @@ -544,16 +562,17 @@ class PROTOBUF_EXPORT ExtensionSet { template <typename Type> friend class RepeatedPrimitiveTypeTraits; - template <typename Type, bool IsValid(int)> + template <typename Type> friend class EnumTypeTraits; - template <typename Type, bool IsValid(int)> + template <typename Type> friend class RepeatedEnumTypeTraits; friend class google::protobuf::Reflection; friend class google::protobuf::internal::ReflectionVisit; friend struct google::protobuf::internal::DynamicExtensionInfoHelper; friend class google::protobuf::internal::WireFormat; + friend class google::protobuf::internal::v2::TableDriven; friend void internal::InitializeLazyExtensionSet(); @@ -586,6 +605,17 @@ class PROTOBUF_EXPORT ExtensionSet { int start_field_number, int end_field_number, uint8_t* target, io::EpsCopyOutputStream* stream) const; + // Implementation of _InternalSerializeAll for non-empty map_. + uint8_t* _InternalSerializeAllImpl(const MessageLite* extendee, + uint8_t* target, + io::EpsCopyOutputStream* stream) const; + // Implementation of _InternalSerialize for large map_. + // Extracted as a separate method to avoid inlining and to reuse in + // _InternalSerializeAllImpl. + uint8_t* _InternalSerializeImplLarge(const MessageLite* extendee, + int start_field_number, + int end_field_number, uint8_t* target, + io::EpsCopyOutputStream* stream) const; // Interface of a lazily parsed singular message extension. class PROTOBUF_EXPORT LazyMessageExtension { public: @@ -594,7 +624,9 @@ class PROTOBUF_EXPORT ExtensionSet { LazyMessageExtension& operator=(const LazyMessageExtension&) = delete; virtual ~LazyMessageExtension() = default; - virtual LazyMessageExtension* New(Arena* arena) const = 0; + virtual LazyMessageExtension* Clone(Arena* arena, + const LazyMessageExtension& other, + Arena* other_arena) const = 0; virtual const MessageLite& GetMessage(const MessageLite& prototype, Arena* arena) const = 0; virtual const MessageLite& GetMessageIgnoreUnparsed( @@ -604,7 +636,7 @@ class PROTOBUF_EXPORT ExtensionSet { virtual void SetAllocatedMessage(MessageLite* message, Arena* arena) = 0; virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message, Arena* arena) = 0; - PROTOBUF_NODISCARD virtual MessageLite* ReleaseMessage( + [[nodiscard]] virtual MessageLite* ReleaseMessage( const MessageLite& prototype, Arena* arena) = 0; virtual MessageLite* UnsafeArenaReleaseMessage(const MessageLite& prototype, Arena* arena) = 0; @@ -621,6 +653,9 @@ class PROTOBUF_EXPORT ExtensionSet { virtual size_t ByteSizeLong() const = 0; virtual size_t SpaceUsedLong() const = 0; + virtual std::variant<size_t, const MessageLite*> UnparsedSizeOrMessage() + const = 0; + virtual void MergeFrom(const MessageLite* prototype, const LazyMessageExtension& other, Arena* arena, Arena* other_arena) = 0; @@ -634,6 +669,7 @@ class PROTOBUF_EXPORT ExtensionSet { const MessageLite* prototype, int number, uint8_t* target, io::EpsCopyOutputStream* stream) const = 0; + private: virtual void UnusedKeyMethod(); // Dummy key method to avoid weak vtable. }; @@ -729,9 +765,10 @@ class PROTOBUF_EXPORT ExtensionSet { // For singular types, indicates if the extension is "cleared". This // happens when an extension is set and then later cleared by the caller. // We want to keep the Extension object around for reuse, so instead of - // removing it from the map, we just set is_cleared = true. This has no - // meaning for repeated types; for those, the size of the RepeatedField - // simply becomes zero when cleared. + // removing it from the map, we just set is_cleared = true. + // + // This is always set to false for repeated types. + // The size of the RepeatedField simply becomes zero when cleared. bool is_cleared : 1; // For singular message types, indicates whether lazy parsing is enabled @@ -783,18 +820,29 @@ class PROTOBUF_EXPORT ExtensionSet { // finds the already-existing Extension for that key (returns false). // The Extension* will point to the new-or-found Extension. std::pair<Extension*, bool> Insert(int key); + // Same as insert for the large map. + std::pair<Extension*, bool> InternalInsertIntoLargeMap(int key); // Grows the flat_capacity_. // If flat_capacity_ > kMaximumFlatCapacity, converts to LargeMap. void GrowCapacity(size_t minimum_new_capacity); + static constexpr uint16_t kMaximumFlatCapacity = 256; + + // Reserves capacity for the flat_capacity_ when the ExtensionSet is + // IsCompletelyEmpty. + // minimum_new_capacity must be <= kMaximumFlatCapacity. + void InternalReserveSmallCapacityFromEmpty(size_t minimum_new_capacity); + bool is_large() const { return static_cast<int16_t>(flat_size_) < 0; } // Removes a key from the ExtensionSet. void Erase(int key); + // Returns the number of elements in the ExtensionSet, including cleared + // extensions. size_t Size() const { - return PROTOBUF_PREDICT_FALSE(is_large()) ? map_.large->size() : flat_size_; + return ABSL_PREDICT_FALSE(is_large()) ? map_.large->size() : flat_size_; } // For use as `PrefetchFunctor`s in `ForEach`. @@ -837,7 +885,7 @@ class PROTOBUF_EXPORT ExtensionSet { // prefetches ahead. template <typename KeyValueFunctor, typename PrefetchFunctor> void ForEach(KeyValueFunctor func, PrefetchFunctor prefetch_func) { - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { ForEachPrefetchImpl(map_.large->begin(), map_.large->end(), std::move(func), std::move(prefetch_func)); return; @@ -848,7 +896,7 @@ class PROTOBUF_EXPORT ExtensionSet { // As above, but const. template <typename KeyValueFunctor, typename PrefetchFunctor> void ForEach(KeyValueFunctor func, PrefetchFunctor prefetch_func) const { - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { ForEachPrefetchImpl(map_.large->begin(), map_.large->end(), std::move(func), std::move(prefetch_func)); return; @@ -868,7 +916,7 @@ class PROTOBUF_EXPORT ExtensionSet { // Applies a functor to the <int, Extension&> pairs in sorted order. template <typename KeyValueFunctor> void ForEachNoPrefetch(KeyValueFunctor func) { - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { ForEachNoPrefetch(map_.large->begin(), map_.large->end(), std::move(func)); return; @@ -879,7 +927,7 @@ class PROTOBUF_EXPORT ExtensionSet { // As above, but const. template <typename KeyValueFunctor> void ForEachNoPrefetch(KeyValueFunctor func) const { - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (ABSL_PREDICT_FALSE(is_large())) { ForEachNoPrefetch(map_.large->begin(), map_.large->end(), std::move(func)); return; @@ -887,10 +935,30 @@ class PROTOBUF_EXPORT ExtensionSet { ForEachNoPrefetch(flat_begin(), flat_end(), std::move(func)); } - // Merges existing Extension from other_extension + // Returns true if nothing is allocated in the ExtensionSet. + bool IsCompletelyEmpty() const { + return flat_size_ == 0 && flat_capacity_ == 0; + } + + // Implementation of MergeFrom into the empty ExtensionSet from a small + // `other`. + // This is used in all types of copy. + // PRECONDITIONs: + // 1. `this.IsCompletelyEmpty()`. + // 2. `other` is small (!other.is_large()). + void InternalMergeFromSmallToEmpty(const MessageLite* extendee, + const ExtensionSet& other); + // Implementation of MergeFrom for general case. + void InternalMergeFromSlow(const MessageLite* extendee, + const ExtensionSet& other); + // Merges new or existing Extension from other_extension. void InternalExtensionMergeFrom(const MessageLite* extendee, int number, const Extension& other_extension, Arena* other_arena); + // Merges newly created uninitialized Extension from other_extension. + void InternalExtensionMergeFromIntoUninitializedExtension( + Extension& dst_extension, const MessageLite* extendee, int number, + const Extension& other_extension, Arena* other_arena); inline static bool is_packable(WireFormatLite::WireType type) { switch (type) { @@ -1044,6 +1112,10 @@ class PROTOBUF_EXPORT ExtensionSet { return map_.flat + flat_size_; } + static KeyValue* AllocateFlatMap(Arena* arena, + uint16_t powerof2_flat_capacity); + static void DeleteFlatMap(const KeyValue* flat, uint16_t flat_capacity); + Arena* arena_; // Manual memory-management: @@ -1058,8 +1130,6 @@ class PROTOBUF_EXPORT ExtensionSet { // which guarantees O(n lg n) CPU but larger constant factors. LargeMap* large; } map_; - - static void DeleteFlatMap(const KeyValue* flat, uint16_t flat_capacity); }; constexpr ExtensionSet::ExtensionSet(Arena* arena) @@ -1373,14 +1443,14 @@ class PROTOBUF_EXPORT RepeatedStringTypeTraits { // ExtensionSet represents enums using integers internally, so we have to // static_cast around. -template <typename Type, bool IsValid(int)> +template <typename Type> class EnumTypeTraits { public: typedef Type ConstType; typedef Type MutableType; using InitType = ConstType; static const ConstType& FromInitType(const InitType& v) { return v; } - typedef EnumTypeTraits<Type, IsValid> Singular; + typedef EnumTypeTraits<Type> Singular; static constexpr bool kLifetimeBound = false; static inline ConstType Get(int number, const ExtensionSet& set, @@ -1394,19 +1464,20 @@ class EnumTypeTraits { } static inline void Set(int number, FieldType field_type, ConstType value, ExtensionSet* set) { - ABSL_DCHECK(IsValid(value)); + ABSL_DCHECK( + internal::ValidateEnum(value, EnumTraits<Type>::validation_data())); set->SetEnum(number, field_type, value, nullptr); } }; -template <typename Type, bool IsValid(int)> +template <typename Type> class RepeatedEnumTypeTraits { public: typedef Type ConstType; typedef Type MutableType; using InitType = ConstType; static const ConstType& FromInitType(const InitType& v) { return v; } - typedef RepeatedEnumTypeTraits<Type, IsValid> Repeated; + typedef RepeatedEnumTypeTraits<Type> Repeated; static constexpr bool kLifetimeBound = false; typedef RepeatedField<Type> RepeatedFieldType; @@ -1421,12 +1492,14 @@ class RepeatedEnumTypeTraits { } static inline void Set(int number, int index, ConstType value, ExtensionSet* set) { - ABSL_DCHECK(IsValid(value)); + ABSL_DCHECK( + internal::ValidateEnum(value, EnumTraits<Type>::validation_data())); set->SetRepeatedEnum(number, index, value); } static inline void Add(int number, FieldType field_type, bool is_packed, ConstType value, ExtensionSet* set) { - ABSL_DCHECK(IsValid(value)); + ABSL_DCHECK( + internal::ValidateEnum(value, EnumTraits<Type>::validation_data())); set->AddEnum(number, field_type, is_packed, value, nullptr); } static inline const RepeatedField<Type>& GetRepeated( @@ -1504,8 +1577,9 @@ class MessageTypeTraits { ExtensionSet* set) { set->UnsafeArenaSetAllocatedMessage(number, field_type, nullptr, message); } - PROTOBUF_NODISCARD static inline MutableType Release( - int number, FieldType /* field_type */, ExtensionSet* set) { + [[nodiscard]] static inline MutableType Release(int number, + FieldType /* field_type */, + ExtensionSet* set) { return static_cast<Type*>( set->ReleaseMessage(number, Type::default_instance())); } diff --git a/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc b/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc index 134d08296a1e7..36e94d95e1827 100644 --- a/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc +++ b/third_party/protobuf/src/google/protobuf/extension_set_heavy.cc @@ -15,6 +15,7 @@ #include <cstddef> #include <cstdint> #include <initializer_list> +#include <variant> #include <vector> #include "absl/base/attributes.h" @@ -285,10 +286,6 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { << "Extension factory's GetPrototype() returned nullptr; extension: " << extension->full_name(); - if (extension->options().has_lazy()) { - output->is_lazy = extension->options().lazy() ? LazyAnnotation::kLazy - : LazyAnnotation::kEager; - } } else if (extension->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { output->enum_validity_check.func = ValidateEnumUsingDescriptor; output->enum_validity_check.arg = extension->enum_type(); diff --git a/third_party/protobuf/src/google/protobuf/extension_set_inl.h b/third_party/protobuf/src/google/protobuf/extension_set_inl.h index 7360f181a34ef..d9d25ab2eec29 100644 --- a/third_party/protobuf/src/google/protobuf/extension_set_inl.h +++ b/third_party/protobuf/src/google/protobuf/extension_set_inl.h @@ -47,8 +47,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( return internal::PackedEnumParserArg<T>( MutableRawRepeatedField(number, extension.type, extension.is_packed, extension.descriptor), - ptr, ctx, extension.enum_validity_check.func, - extension.enum_validity_check.arg, metadata, number); + ptr, ctx, extension.enum_validity_check, metadata, number); case WireFormatLite::TYPE_STRING: case WireFormatLite::TYPE_BYTES: case WireFormatLite::TYPE_GROUP: @@ -123,8 +122,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); int value = tmp; - if (!extension.enum_validity_check.func( - extension.enum_validity_check.arg, value)) { + if (!extension.enum_validity_check.IsValid(value)) { WriteVarint(number, value, metadata->mutable_unknown_fields<T>()); } else if (extension.is_repeated) { AddEnum(number, WireFormatLite::TYPE_ENUM, extension.is_packed, value, diff --git a/third_party/protobuf/src/google/protobuf/extension_set_unittest.cc b/third_party/protobuf/src/google/protobuf/extension_set_unittest.cc index ef3d98059c398..28bc66776721c 100644 --- a/third_party/protobuf/src/google/protobuf/extension_set_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/extension_set_unittest.cc @@ -52,7 +52,6 @@ extern bool fully_verify_message_sets_opt_out; namespace { -using ::google::protobuf::internal::DownCast; using TestUtil::EqualsToSerialized; // This test closely mirrors google/protobuf/compiler/cpp/unittest.cc @@ -685,7 +684,7 @@ TEST(ExtensionSetTest, PackedToUnpackedParsing) { // Make sure we can add extensions. destination.AddExtension(unittest::unpacked_int32_extension, 1); destination.AddExtension(unittest::unpacked_enum_extension, - protobuf_unittest::FOREIGN_BAR); + proto2_unittest::FOREIGN_BAR); } TEST(ExtensionSetTest, UnpackedToPackedParsing) { @@ -709,7 +708,7 @@ TEST(ExtensionSetTest, UnpackedToPackedParsing) { // Make sure we can add extensions. destination.AddExtension(unittest::packed_int32_extension, 1); destination.AddExtension(unittest::packed_enum_extension, - protobuf_unittest::FOREIGN_BAR); + proto2_unittest::FOREIGN_BAR); } TEST(ExtensionSetTest, IsInitialized) { @@ -1184,7 +1183,7 @@ TEST(ExtensionSetTest, InvalidEnumDeath) { EXPECT_DEBUG_DEATH( message.SetExtension(unittest::optional_foreign_enum_extension, static_cast<unittest::ForeignEnum>(53)), - "IsValid"); + "ValidateEnum"); } #endif // GTEST_HAS_DEATH_TEST @@ -1414,7 +1413,7 @@ TEST(ExtensionSetTest, BoolExtension) { unittest::TestAllExtensions msg; uint8_t wire_bytes[2] = {13 * 8, 42 /* out of bounds payload for bool */}; EXPECT_TRUE(msg.ParseFromArray(wire_bytes, 2)); - EXPECT_TRUE(msg.GetExtension(protobuf_unittest::optional_bool_extension)); + EXPECT_TRUE(msg.GetExtension(proto2_unittest::optional_bool_extension)); } TEST(ExtensionSetTest, ConstInit) { @@ -1422,6 +1421,19 @@ TEST(ExtensionSetTest, ConstInit) { EXPECT_EQ(set.NumExtensions(), 0); } +// Make sure that is_cleared is set correctly for repeated fields. +TEST(ExtensionSetTest, NumExtensionsWithRepeatedFields) { + unittest::TestAllExtensions msg; + ExtensionSet set; + const auto* desc = + unittest::TestAllExtensions::descriptor()->file()->FindExtensionByName( + "repeated_int32_extension"); + ASSERT_NE(desc, nullptr); + set.MutableRawRepeatedField(desc->number(), WireFormatLite::TYPE_INT32, false, + desc); + EXPECT_EQ(set.NumExtensions(), 1); +} + TEST(ExtensionSetTest, ExtensionSetSpaceUsed) { unittest::TestAllExtensions msg; size_t l = msg.SpaceUsedLong(); diff --git a/third_party/protobuf/src/google/protobuf/feature_resolver.cc b/third_party/protobuf/src/google/protobuf/feature_resolver.cc index 7bb393a6a7bcc..958ab5d340b05 100644 --- a/third_party/protobuf/src/google/protobuf/feature_resolver.cc +++ b/third_party/protobuf/src/google/protobuf/feature_resolver.cc @@ -38,10 +38,10 @@ // Must be included last. #include "google/protobuf/port_def.inc" -#define RETURN_IF_ERROR(expr) \ - do { \ - const absl::Status _status = (expr); \ - if (PROTOBUF_PREDICT_FALSE(!_status.ok())) return _status; \ +#define RETURN_IF_ERROR(expr) \ + do { \ + const absl::Status _status = (expr); \ + if (ABSL_PREDICT_FALSE(!_status.ok())) return _status; \ } while (0) namespace google { @@ -351,6 +351,8 @@ absl::Status ValidateMergedFeatures(const FeatureSet& features) { CHECK_ENUM_FEATURE(utf8_validation, Utf8Validation, UTF8_VALIDATION) CHECK_ENUM_FEATURE(message_encoding, MessageEncoding, MESSAGE_ENCODING) CHECK_ENUM_FEATURE(json_format, JsonFormat, JSON_FORMAT) + CHECK_ENUM_FEATURE(enforce_naming_style, EnforceNamingStyle, + ENFORCE_NAMING_STYLE) #undef CHECK_ENUM_FEATURE diff --git a/third_party/protobuf/src/google/protobuf/feature_resolver_test.cc b/third_party/protobuf/src/google/protobuf/feature_resolver_test.cc index 60b1f7b565fd7..0a92c333317ed 100644 --- a/third_party/protobuf/src/google/protobuf/feature_resolver_test.cc +++ b/third_party/protobuf/src/google/protobuf/feature_resolver_test.cc @@ -425,7 +425,7 @@ TEST(FeatureResolverTest, CompileDefaultsInvalidExtension) { EXPECT_THAT( FeatureResolver::CompileDefaults( FeatureSet::descriptor(), - {GetExtension(protobuf_unittest::file_opt1, FileOptions::descriptor())}, + {GetExtension(proto2_unittest::file_opt1, FileOptions::descriptor())}, EDITION_2023, EDITION_2023), HasError(HasSubstr("is not an extension of"))); } @@ -1846,6 +1846,7 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.test] { file_feature: VALUE1 } } } @@ -1861,6 +1862,7 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.test] { file_feature: VALUE1 } } } @@ -1875,6 +1877,23 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { json_format: ALLOW [pb.test] { file_feature: VALUE2 } } + fixed_features { + enforce_naming_style: STYLE_LEGACY + [pb.test] {} + } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + [pb.test] { file_feature: VALUE2 } + } fixed_features { [pb.test] {} } @@ -1888,6 +1907,7 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE2024 [pb.test] { file_feature: VALUE3 } } fixed_features { diff --git a/third_party/protobuf/src/google/protobuf/field_mask.pb.cc b/third_party/protobuf/src/google/protobuf/field_mask.pb.cc index 71d578614e20e..3f7c3a405deaa 100644 --- a/third_party/protobuf/src/google/protobuf/field_mask.pb.cc +++ b/third_party/protobuf/src/google/protobuf/field_mask.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/field_mask.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/field_mask.pb.h" @@ -35,7 +35,7 @@ inline constexpr FieldMask::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR FieldMask::FieldMask(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FieldMask_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -53,9 +53,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldMaskDefaultTypeInternal _FieldMask_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -75,7 +75,7 @@ static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::google::protobuf::FieldMask)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_FieldMask_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2ffield_5fmask_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -112,26 +112,27 @@ class FieldMask::_Internal { public: }; -FieldMask::FieldMask(::google::protobuf::Arena* arena) +FieldMask::FieldMask(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldMask_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.FieldMask) } -inline PROTOBUF_NDEBUG_INLINE FieldMask::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::FieldMask& from_msg) +PROTOBUF_NDEBUG_INLINE FieldMask::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::FieldMask& from_msg) : paths_{visibility, arena, from.paths_}, _cached_size_{0} {} FieldMask::FieldMask( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldMask& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FieldMask_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -143,13 +144,13 @@ FieldMask::FieldMask( // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldMask) } -inline PROTOBUF_NDEBUG_INLINE FieldMask::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FieldMask::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : paths_{visibility, arena}, _cached_size_{0} {} -inline void FieldMask::SharedCtor(::_pb::Arena* arena) { +inline void FieldMask::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } FieldMask::~FieldMask() { @@ -163,8 +164,9 @@ inline void FieldMask::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FieldMask::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FieldMask::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FieldMask(arena); } constexpr auto FieldMask::InternalNewImpl_() { @@ -183,35 +185,42 @@ constexpr auto FieldMask::InternalNewImpl_() { alignof(FieldMask)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FieldMask::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FieldMask_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &FieldMask::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FieldMask>(), +constexpr auto FieldMask::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FieldMask_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &FieldMask::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FieldMask>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldMask::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FieldMask>(), &FieldMask::ByteSizeLong, - &FieldMask::_InternalSerialize, + &FieldMask::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FieldMask>(), &FieldMask::ByteSizeLong, + &FieldMask::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldMask, _impl_._cached_size_), - false, - }, - &FieldMask::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FieldMask::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FieldMask, _impl_._cached_size_), + false, + }, + &FieldMask::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FieldMask_class_data_ = + FieldMask::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FieldMask::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FieldMask_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FieldMask_class_data_.tc_table); + return FieldMask_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 39, 2> FieldMask::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 39, 2> +FieldMask::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -222,7 +231,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 39, 2> FieldMask::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + FieldMask_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -246,7 +255,6 @@ const ::_pbi::TcParseTable<0, 1, 0, 39, 2> FieldMask::_table_ = { "paths" }}, }; - PROTOBUF_NOINLINE void FieldMask::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldMask) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -259,66 +267,66 @@ PROTOBUF_NOINLINE void FieldMask::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FieldMask::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FieldMask& this_ = static_cast<const FieldMask&>(base); +::uint8_t* PROTOBUF_NONNULL FieldMask::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FieldMask& this_ = static_cast<const FieldMask&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FieldMask::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FieldMask& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FieldMask::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FieldMask& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldMask) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldMask) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated string paths = 1; - for (int i = 0, n = this_._internal_paths_size(); i < n; ++i) { - const auto& s = this_._internal_paths().Get(i); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.FieldMask.paths"); - target = stream->WriteString(1, s, target); - } + // repeated string paths = 1; + for (int i = 0, n = this_._internal_paths_size(); i < n; ++i) { + const auto& s = this_._internal_paths().Get(i); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.FieldMask.paths"); + target = stream->WriteString(1, s, target); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldMask) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldMask) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FieldMask::ByteSizeLong(const MessageLite& base) { - const FieldMask& this_ = static_cast<const FieldMask&>(base); +::size_t FieldMask::ByteSizeLong(const MessageLite& base) { + const FieldMask& this_ = static_cast<const FieldMask&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FieldMask::ByteSizeLong() const { - const FieldMask& this_ = *this; +::size_t FieldMask::ByteSizeLong() const { + const FieldMask& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldMask) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldMask) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated string paths = 1; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_paths().size()); - for (int i = 0, n = this_._internal_paths().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_paths().Get(i)); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated string paths = 1; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_paths().size()); + for (int i = 0, n = this_._internal_paths().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_paths().Get(i)); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FieldMask::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FieldMask*>(&to_msg); @@ -340,7 +348,7 @@ void FieldMask::CopyFrom(const FieldMask& from) { } -void FieldMask::InternalSwap(FieldMask* PROTOBUF_RESTRICT other) { +void FieldMask::InternalSwap(FieldMask* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); _impl_.paths_.InternalSwap(&other->_impl_.paths_); @@ -358,7 +366,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/field_mask.pb.h b/third_party/protobuf/src/google/protobuf/field_mask.pb.h index 10c89d277e99a..7eb97a01102f1 100644 --- a/third_party/protobuf/src/google/protobuf/field_mask.pb.h +++ b/third_party/protobuf/src/google/protobuf/field_mask.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/field_mask.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2ffield_5fmask_2eproto_2epb_2eh #define google_2fprotobuf_2ffield_5fmask_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -49,13 +49,15 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto; +} // extern "C" namespace google { namespace protobuf { class FieldMask; struct FieldMaskDefaultTypeInternal; PROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldMask_class_data_; } // namespace protobuf } // namespace google @@ -74,15 +76,14 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message ~FieldMask() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldMask* msg, std::destroying_delete_t) { + void operator delete(FieldMask* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldMask)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FieldMask( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FieldMask(::google::protobuf::internal::ConstantInitialized); inline FieldMask(const FieldMask& from) : FieldMask(nullptr, from) {} inline FieldMask(FieldMask&& from) noexcept @@ -105,30 +106,27 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FieldMask& default_instance() { - return *internal_default_instance(); - } - static inline const FieldMask* internal_default_instance() { - return reinterpret_cast<const FieldMask*>( + return *reinterpret_cast<const FieldMask*>( &_FieldMask_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(FieldMask& a, FieldMask& b) { a.Swap(&b); } - inline void Swap(FieldMask* other) { + inline void Swap(FieldMask* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -136,7 +134,7 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FieldMask* other) { + void UnsafeArenaSwap(FieldMask* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -144,7 +142,7 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FieldMask* New(::google::protobuf::Arena* arena = nullptr) const { + FieldMask* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FieldMask>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -153,9 +151,8 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message void MergeFrom(const FieldMask& from) { FieldMask::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -165,49 +162,51 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FieldMask* other); + void InternalSwap(FieldMask* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FieldMask"; } protected: - explicit FieldMask(::google::protobuf::Arena* arena); - FieldMask(::google::protobuf::Arena* arena, const FieldMask& from); - FieldMask(::google::protobuf::Arena* arena, FieldMask&& from) noexcept + explicit FieldMask(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FieldMask(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldMask& from); + FieldMask( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldMask&& from) noexcept : FieldMask(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -223,27 +222,27 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message public: void clear_paths() ; const std::string& paths(int index) const; - std::string* mutable_paths(int index); + std::string* PROTOBUF_NONNULL mutable_paths(int index); template <typename Arg_ = const std::string&, typename... Args_> void set_paths(int index, Arg_&& value, Args_... args); - std::string* add_paths(); + std::string* PROTOBUF_NONNULL add_paths(); template <typename Arg_ = const std::string&, typename... Args_> void add_paths(Arg_&& value, Args_... args); const ::google::protobuf::RepeatedPtrField<std::string>& paths() const; - ::google::protobuf::RepeatedPtrField<std::string>* mutable_paths(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL mutable_paths(); private: const ::google::protobuf::RepeatedPtrField<std::string>& _internal_paths() const; - ::google::protobuf::RepeatedPtrField<std::string>* _internal_mutable_paths(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL _internal_mutable_paths(); public: // @@protoc_insertion_point(class_scope:google.protobuf.FieldMask) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 39, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 39, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -253,13 +252,14 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FieldMask& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FieldMask& from_msg); ::google::protobuf::RepeatedPtrField<std::string> paths_; ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER @@ -268,6 +268,8 @@ class PROTOBUF_EXPORT FieldMask final : public ::google::protobuf::Message friend struct ::TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FieldMask_class_data_; + // =================================================================== @@ -295,7 +297,8 @@ inline void FieldMask::clear_paths() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.paths_.Clear(); } -inline std::string* FieldMask::add_paths() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL FieldMask::add_paths() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); std::string* _s = _internal_mutable_paths()->Add(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.FieldMask.paths) @@ -306,16 +309,15 @@ inline const std::string& FieldMask::paths(int index) const // @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths) return _internal_paths().Get(index); } -inline std::string* FieldMask::mutable_paths(int index) +inline std::string* PROTOBUF_NONNULL FieldMask::mutable_paths(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.FieldMask.paths) return _internal_mutable_paths()->Mutable(index); } template <typename Arg_, typename... Args_> inline void FieldMask::set_paths(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString( - *_internal_mutable_paths()->Mutable(index), - std::forward<Arg_>(value), args... ); + ::google::protobuf::internal::AssignToString(*_internal_mutable_paths()->Mutable(index), std::forward<Arg_>(value), + args... ); // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths) } template <typename Arg_, typename... Args_> @@ -326,12 +328,12 @@ inline void FieldMask::add_paths(Arg_&& value, Args_... args) { args... ); // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths) } -inline const ::google::protobuf::RepeatedPtrField<std::string>& -FieldMask::paths() const ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline const ::google::protobuf::RepeatedPtrField<std::string>& FieldMask::paths() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_list:google.protobuf.FieldMask.paths) return _internal_paths(); } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL FieldMask::mutable_paths() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldMask.paths) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -342,7 +344,7 @@ FieldMask::_internal_paths() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.paths_; } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL FieldMask::_internal_mutable_paths() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.paths_; diff --git a/third_party/protobuf/src/google/protobuf/generated_enum_util.h b/third_party/protobuf/src/google/protobuf/generated_enum_util.h index c9d7a131132f0..5b4d2f1acfa4e 100644 --- a/third_party/protobuf/src/google/protobuf/generated_enum_util.h +++ b/third_party/protobuf/src/google/protobuf/generated_enum_util.h @@ -75,21 +75,21 @@ PROTOBUF_EXPORT bool ValidateEnum(int value, const uint32_t* data); PROTOBUF_EXPORT std::vector<uint32_t> GenerateEnumData( absl::Span<const int32_t> values); -inline PROTOBUF_ALWAYS_INLINE bool ValidateEnumInlined(int value, - const uint32_t* data) { +PROTOBUF_ALWAYS_INLINE bool ValidateEnumInlined(int value, + const uint32_t* data) { const int16_t min_seq = static_cast<int16_t>(data[0] & 0xFFFF); const uint16_t length_seq = static_cast<uint16_t>(data[0] >> 16); uint64_t adjusted = static_cast<uint64_t>(static_cast<int64_t>(value)) - min_seq; // Check if the value is within the sequential part. - if (PROTOBUF_PREDICT_TRUE(adjusted < length_seq)) { + if (ABSL_PREDICT_TRUE(adjusted < length_seq)) { return true; } const uint16_t length_bitmap = static_cast<uint16_t>(data[1] & 0xFFFF); adjusted -= length_seq; // Check if the value is within the bitmap. - if (PROTOBUF_PREDICT_TRUE(adjusted < length_bitmap)) { + if (ABSL_PREDICT_TRUE(adjusted < length_bitmap)) { return ((data[2 + (adjusted / 32)] >> (adjusted % 32)) & 1) == 1; } diff --git a/third_party/protobuf/src/google/protobuf/generated_message_bases.cc b/third_party/protobuf/src/google/protobuf/generated_message_bases.cc index 37016bd4fafb8..2c9c1d642cc9c 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_bases.cc +++ b/third_party/protobuf/src/google/protobuf/generated_message_bases.cc @@ -8,15 +8,16 @@ #include "google/protobuf/generated_message_bases.h" #include <cstddef> +#include <cstdint> +#include "absl/base/optimization.h" +#include "absl/log/absl_check.h" #include "google/protobuf/generated_message_reflection.h" #include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/parse_context.h" #include "google/protobuf/unknown_field_set.h" #include "google/protobuf/wire_format.h" -#include "google/protobuf/wire_format_lite.h" // Must be last: #include "google/protobuf/port_def.inc" @@ -51,7 +52,7 @@ size_t ZeroFieldsBase::ByteSizeLong(const MessageLite& base) { ::uint8_t* target, io::EpsCopyOutputStream* stream) { auto& this_ = static_cast<const ZeroFieldsBase&>(msg); - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { target = internal::WireFormat::InternalSerializeUnknownFieldsToArray( this_._internal_metadata_.unknown_fields<UnknownFieldSet>( UnknownFieldSet::default_instance), diff --git a/third_party/protobuf/src/google/protobuf/generated_message_bases.h b/third_party/protobuf/src/google/protobuf/generated_message_bases.h index 3adc381613fe1..ac53fcc1ca9fd 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_bases.h +++ b/third_party/protobuf/src/google/protobuf/generated_message_bases.h @@ -12,11 +12,13 @@ #ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__ #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__ +#include <cstddef> +#include <cstdint> + +#include "absl/base/attributes.h" #include "google/protobuf/arena.h" #include "google/protobuf/generated_message_util.h" -#include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/message.h" -#include "google/protobuf/parse_context.h" // Must come last: #include "google/protobuf/port_def.inc" @@ -46,14 +48,15 @@ class PROTOBUF_EXPORT ZeroFieldsBase : public Message { static void CopyImpl(Message& to, const Message& from); void InternalSwap(ZeroFieldsBase* other); static void Clear(MessageLite& msg); - static size_t ByteSizeLong(const MessageLite& msg); + static size_t ByteSizeLong(const MessageLite& base); static ::uint8_t* _InternalSerialize(const MessageLite& msg, ::uint8_t* target, io::EpsCopyOutputStream* stream); + // The following naming is required to match protobuf naming conventions. struct { - internal::CachedSize _cached_size_; - } _impl_; + internal::CachedSize _cached_size_; // NOLINT + } _impl_; // NOLINT }; } // namespace internal diff --git a/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc b/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc index 391318ed21e25..d076a101f027f 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc +++ b/third_party/protobuf/src/google/protobuf/generated_message_reflection.cc @@ -25,14 +25,17 @@ #include "absl/base/attributes.h" #include "absl/base/call_once.h" #include "absl/base/const_init.h" +#include "absl/base/optimization.h" #include "absl/container/flat_hash_set.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" +#include "google/protobuf/arena.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/descriptor_lite.h" #include "google/protobuf/extension_set.h" #include "google/protobuf/generated_message_tctable_decl.h" #include "google/protobuf/generated_message_tctable_gen.h" @@ -78,6 +81,11 @@ namespace protobuf { namespace { bool IsMapFieldInApi(const FieldDescriptor* field) { return field->is_map(); } +bool IsMapEntry(const FieldDescriptor* field) { + return (field->containing_type() != nullptr && + field->containing_type()->options().map_entry()); +} + Message* MaybeForceCopy(Arena* arena, Message* msg) { if (arena != nullptr || msg == nullptr) return msg; @@ -162,6 +170,17 @@ PROTOBUF_NOINLINE const std::string& NameOfDenseEnumSlow( } } +bool IsMatchingCType(const FieldDescriptor* field, int ctype) { + switch (field->cpp_string_type()) { + case FieldDescriptor::CppStringType::kCord: + return ctype == FieldOptions::CORD; + case FieldDescriptor::CppStringType::kView: + case FieldDescriptor::CppStringType::kString: + return ctype == FieldOptions::STRING; + } + internal::Unreachable(); +} + } // namespace internal // =================================================================== @@ -203,7 +222,8 @@ void ReportReflectionUsageMessageError(const Descriptor* expected, " Actual type : %s\n" " Field : %s\n" " Problem : Message is not the right object for reflection", - method, expected->full_name(), actual->full_name(), field->full_name()); + method, expected->full_name(), actual->full_name(), + (field != nullptr ? field->full_name() : "n/a")); } #endif @@ -275,11 +295,16 @@ static void ReportReflectionUsageEnumTypeError( #ifdef NDEBUG // Avoid a virtual method call in optimized builds. #define USAGE_CHECK_MESSAGE(METHOD, MESSAGE) +#define STATIC_USAGE_CHECK_MESSAGE(METHOD, MESSAGE) #else #define USAGE_CHECK_MESSAGE(METHOD, MESSAGE) \ if (this != (MESSAGE)->GetReflection()) \ ReportReflectionUsageMessageError(descriptor_, (MESSAGE)->GetDescriptor(), \ field, #METHOD) +#define STATIC_USAGE_CHECK_MESSAGE(METHOD, MESSAGE) \ + if (this != (MESSAGE)->GetReflection()) \ + ReportReflectionUsageMessageError(descriptor_, (MESSAGE)->GetDescriptor(), \ + /*field=*/nullptr, #METHOD) #endif #define USAGE_CHECK_MESSAGE_TYPE(METHOD) \ @@ -328,36 +353,31 @@ Reflection::~Reflection() { const UnknownFieldSet& Reflection::GetUnknownFields( const Message& message) const { + STATIC_USAGE_CHECK_MESSAGE(GetUnknownFields, &message); return GetInternalMetadata(message).unknown_fields<UnknownFieldSet>( UnknownFieldSet::default_instance); } UnknownFieldSet* Reflection::MutableUnknownFields(Message* message) const { + STATIC_USAGE_CHECK_MESSAGE(MutableUnknownFields, message); return MutableInternalMetadata(message) ->mutable_unknown_fields<UnknownFieldSet>(); } bool Reflection::IsLazyExtension(const Message& message, const FieldDescriptor* field) const { + USAGE_CHECK_MESSAGE(IsLazyExtension, &message); return field->is_extension() && GetExtensionSet(message).HasLazy(field->number()); } bool Reflection::IsLazilyVerifiedLazyField(const FieldDescriptor* field) const { - if (field->type() != FieldDescriptor::TYPE_MESSAGE || field->is_repeated()) { - return false; - } - return field->options().unverified_lazy(); + return false; } bool Reflection::IsEagerlyVerifiedLazyField( const FieldDescriptor* field) const { - if (field->type() != FieldDescriptor::TYPE_MESSAGE) return false; - - // Message fields with [lazy=true] will be eagerly verified - // (go/verified-lazy). - if (field->options().lazy() && !field->is_repeated()) return true; - return schema_.IsEagerlyVerifiedLazyField(field); + return false; } internal::field_layout::TransformValidation Reflection::GetLazyStyle( @@ -372,6 +392,7 @@ internal::field_layout::TransformValidation Reflection::GetLazyStyle( } size_t Reflection::SpaceUsedLong(const Message& message) const { + STATIC_USAGE_CHECK_MESSAGE(SpaceUsedLong, &message); // object_size_ already includes the in-memory representation of each field // in the message, so we only need to account for additional memory used by // the fields. @@ -756,7 +777,7 @@ void SwapFieldHelper::SwapRepeatedMessageField(const Reflection* r, auto* lhs_map = r->MutableRaw<MapFieldBase>(lhs, field); auto* rhs_map = r->MutableRaw<MapFieldBase>(rhs, field); if (unsafe_shallow_swap) { - lhs_map->UnsafeShallowSwap(rhs_map); + lhs_map->InternalSwap(rhs_map); } else { lhs_map->Swap(rhs_map); } @@ -1174,7 +1195,7 @@ void Reflection::SwapFieldsImpl( // oneof already. This has to be done after SwapField, because SwapField // may depend on the information in has bits. if (!field->is_repeated()) { - SwapHasBit(message1, message2, field); + NaiveSwapHasBit(message1, message2, field); if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && field->cpp_string_type() == FieldDescriptor::CppStringType::kString && @@ -1318,7 +1339,53 @@ void Reflection::InternalSwap(Message* lhs, Message* rhs) const { } void Reflection::MaybePoisonAfterClear(Message& root) const { + struct MemBlock { + explicit MemBlock(Message& msg) + : ptr(static_cast<void*>(&msg)), size(GetSize(msg)) {} + + static uint32_t GetSize(const Message& msg) { + return msg.GetReflection()->schema_.GetObjectSize(); + } + + void* ptr; + uint32_t size; + }; + + bool heap_alloc = root.GetArena() == nullptr; + std::vector<MemBlock> nodes; + +#ifdef __cpp_if_constexpr + nodes.emplace_back(root); + + std::queue<Message*> queue; + queue.push(&root); + + while (!queue.empty() && !heap_alloc) { + Message* curr = queue.front(); + queue.pop(); + internal::VisitMutableMessageFields(*curr, [&](Message& msg) { + if (msg.GetArena() == nullptr) { + heap_alloc = true; + return; + } + + nodes.emplace_back(msg); + // Also visits child messages. + queue.push(&msg); + }); + } +#endif + root.Clear(); + + // Heap allocated oneof messages will be freed on clear. So, poisoning + // afterwards may cause use-after-free. Bailout. + if (heap_alloc) return; + + for (auto it : nodes) { + (void)it; + internal::PoisonMemoryRegion(it.ptr, it.size); + } } int Reflection::FieldSize(const Message& message, @@ -1434,16 +1501,7 @@ void Reflection::ClearField(Message* message, } case FieldDescriptor::CPPTYPE_MESSAGE: - if (schema_.HasBitIndex(field) == static_cast<uint32_t>(-1)) { - // Proto3 does not have has-bits and we need to set a message field - // to nullptr in order to indicate its un-presence. - if (message->GetArena() == nullptr) { - delete *MutableRaw<Message*>(message, field); - } - *MutableRaw<Message*>(message, field) = nullptr; - } else { - (*MutableRaw<Message*>(message, field))->Clear(); - } + (*MutableRaw<Message*>(message, field))->Clear(); break; } } @@ -1708,7 +1766,8 @@ void Reflection::ListFields(const Message& message, } } else if (has_bits && has_bits_indices[i] != static_cast<uint32_t>(-1)) { // Equivalent to: HasFieldSingular(message, field) - if (IsIndexInHasBitSet(has_bits, has_bits_indices[i])) { + if (IsFieldPresentGivenHasbits(message, field, has_bits, + has_bits_indices[i])) { append_to_output(field); } } else if (HasFieldSingular(message, field)) { @@ -1915,11 +1974,9 @@ absl::Cord Reflection::GetCord(const Message& message, } } -absl::string_view Reflection::GetStringView(const Message& message, - const FieldDescriptor* field, - ScratchSpace& scratch) const { - USAGE_CHECK_ALL(GetStringView, SINGULAR, STRING); - +absl::string_view Reflection::GetStringViewImpl(const Message& message, + const FieldDescriptor* field, + ScratchSpace* scratch) const { if (field->is_extension()) { return GetExtensionSet(message).GetString( field->number(), internal::DefaultValueStringAsString(field)); @@ -1933,7 +1990,8 @@ absl::string_view Reflection::GetStringView(const Message& message, const auto& cord = schema_.InRealOneof(field) ? *GetField<absl::Cord*>(message, field) : GetField<absl::Cord>(message, field); - return scratch.CopyFromCord(cord); + ABSL_DCHECK(scratch); + return scratch->CopyFromCord(cord); } default: auto str = GetField<ArenaStringPtr>(message, field); @@ -1941,6 +1999,13 @@ absl::string_view Reflection::GetStringView(const Message& message, } } +absl::string_view Reflection::GetStringView(const Message& message, + const FieldDescriptor* field, + ScratchSpace& scratch) const { + USAGE_CHECK_ALL(GetStringView, SINGULAR, STRING); + return GetStringViewImpl(message, field, &scratch); +} + void Reflection::SetString(Message* message, const FieldDescriptor* field, std::string value) const { @@ -2133,7 +2198,10 @@ void Reflection::AddString(Message* message, const FieldDescriptor* field, std::string value) const { USAGE_MUTABLE_CHECK_ALL(AddString, REPEATED, STRING); if (field->is_extension()) { - MutableExtensionSet(message)->AddString(field->number(), field->type(), + MutableExtensionSet(message)->AddString(field->number(), + field->requires_utf8_validation() + ? FieldDescriptor::TYPE_STRING + : FieldDescriptor::TYPE_BYTES, std::move(value), field); } else { switch (field->cpp_string_type()) { @@ -2669,8 +2737,7 @@ const void* Reflection::GetRawRepeatedField(const Message& message, ReportReflectionUsageTypeError(descriptor_, field, "GetRawRepeatedField", cpptype); if (ctype >= 0) - ABSL_CHECK_EQ(internal::cpp::EffectiveStringCType(field), ctype) - << "subtype mismatch"; + ABSL_CHECK(IsMatchingCType(field, ctype)) << "subtype mismatch"; if (desc != nullptr) ABSL_CHECK_EQ(field->message_type(), desc) << "wrong submessage type"; if (field->is_extension()) { @@ -2823,7 +2890,7 @@ void* Reflection::MutableRawSplitImpl(Message* message, void* Reflection::MutableRawNonOneofImpl(Message* message, const FieldDescriptor* field) const { - if (PROTOBUF_PREDICT_FALSE(schema_.IsSplit(field))) { + if (ABSL_PREDICT_FALSE(schema_.IsSplit(field))) { return MutableRawSplitImpl(message, field); } @@ -2833,7 +2900,7 @@ void* Reflection::MutableRawNonOneofImpl(Message* message, void* Reflection::MutableRawImpl(Message* message, const FieldDescriptor* field) const { - if (PROTOBUF_PREDICT_TRUE(!schema_.InRealOneof(field))) { + if (ABSL_PREDICT_TRUE(!schema_.InRealOneof(field))) { return MutableRawNonOneofImpl(message, field); } @@ -2949,74 +3016,127 @@ void Reflection::SwapInlinedStringDonated(Message* lhs, Message* rhs, } } -// Simple accessors for manipulating has_bits_. +bool Reflection::IsSingularFieldNonEmpty(const Message& message, + const FieldDescriptor* field) const { + ABSL_DCHECK(IsMapEntry(field) || !field->has_presence()); + ABSL_DCHECK(!field->is_repeated()); + ABSL_DCHECK(!field->is_map()); + ABSL_DCHECK(field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE); + // Scalar primitive (numeric or string/bytes) fields are present if + // their value is non-zero (numeric) or non-empty (string/bytes). N.B.: + // we must use this definition here, rather than the "scalar fields + // always present" in the proto3 docs, because MergeFrom() semantics + // require presence as "present on wire", and reflection-based merge + // (which uses HasField()) needs to be consistent with this. + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_BOOL: + return GetRaw<bool>(message, field) != false; + case FieldDescriptor::CPPTYPE_INT32: + return GetRaw<int32_t>(message, field) != 0; + case FieldDescriptor::CPPTYPE_INT64: + return GetRaw<int64_t>(message, field) != 0; + case FieldDescriptor::CPPTYPE_UINT32: + return GetRaw<uint32_t>(message, field) != 0; + case FieldDescriptor::CPPTYPE_UINT64: + return GetRaw<uint64_t>(message, field) != 0; + case FieldDescriptor::CPPTYPE_FLOAT: + static_assert(sizeof(uint32_t) == sizeof(float), + "Code assumes uint32_t and float are the same size."); + return GetRaw<uint32_t>(message, field) != 0; + case FieldDescriptor::CPPTYPE_DOUBLE: + static_assert(sizeof(uint64_t) == sizeof(double), + "Code assumes uint64_t and double are the same size."); + return GetRaw<uint64_t>(message, field) != 0; + case FieldDescriptor::CPPTYPE_ENUM: + return GetRaw<int>(message, field) != 0; + case FieldDescriptor::CPPTYPE_STRING: + switch (field->cpp_string_type()) { + case FieldDescriptor::CppStringType::kCord: + return !GetField<const absl::Cord>(message, field).empty(); + case FieldDescriptor::CppStringType::kView: + case FieldDescriptor::CppStringType::kString: { + if (IsInlined(field)) { + return !GetField<InlinedStringField>(message, field) + .GetNoArena() + .empty(); + } + + return !GetField<ArenaStringPtr>(message, field).Get().empty(); + } + default: + internal::Unreachable(); + } + case FieldDescriptor::CPPTYPE_MESSAGE: + default: + internal::Unreachable(); + } +} + +bool Reflection::IsFieldPresentGivenHasbits(const Message& message, + const FieldDescriptor* field, + const uint32_t* hasbits, + uint32_t hasbit_index) const { + // If hasbit exists but is not set, field is guaranteed to be missing. + if (!IsIndexInHasBitSet(hasbits, hasbit_index)) { + return false; + } + + // For explicit-presence fields, a set hasbit indicates a present field. + if (field->has_presence()) { + return true; + } + + // proto3: hasbits are present, but an additional zero check must be + // performed because hasbit can be set to true while field is zero. + + // Repeated fields do not have hasbits enabled in proto3. + ABSL_DCHECK(!field->is_repeated()) + << "repeated fields do not have hasbits in proto3."; + + // Handling map entries in proto3: + // Implicit presence map fields are represented as a native C++ map, but their + // corresponding MapEntry messages (e.g. if we want to access them as repeated + // MapEntry fields) will unconditionally be generated with hasbits. MapEntrys + // behave like explicit presence fields. That is, in MapEntry's C++ + // implementation... + // - key can be null, empty, or nonempty; + // - value can be null, empty, or nonempty. + if (IsMapEntry(field)) { + return true; + } + + // This is the vanilla case: for a non-repeated primitive or string field, + // returns if the field is nonzero (i.e. present in proto3 semantics). + return IsSingularFieldNonEmpty(message, field); +} + bool Reflection::HasFieldSingular(const Message& message, const FieldDescriptor* field) const { ABSL_DCHECK(!field->options().weak()); if (schema_.HasBitIndex(field) != static_cast<uint32_t>(-1)) { - return IsIndexInHasBitSet(GetHasBits(message), schema_.HasBitIndex(field)); + return IsFieldPresentGivenHasbits(message, field, GetHasBits(message), + schema_.HasBitIndex(field)); } - // proto3: no has-bits. All fields present except messages, which are + // The python implementation traditionally assumes that proto3 messages don't + // have hasbits. As a result, proto3 objects created through dynamic message + // in Python won't have hasbits. We need the following code to preserve + // compatibility. + // NOTE: It would be nice to be able to remove it, but we need one + // or more breaking changes in order to do so. + // + // proto3 with no has-bits. All fields present except messages, which are // present only if their message-field pointer is non-null. if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { return !schema_.IsDefaultInstance(message) && GetRaw<const Message*>(message, field) != nullptr; - } else { - // Non-message field (and non-oneof, since that was handled in HasField() - // before calling us), and singular (again, checked in HasField). So, this - // field must be a scalar. - - // Scalar primitive (numeric or string/bytes) fields are present if - // their value is non-zero (numeric) or non-empty (string/bytes). N.B.: - // we must use this definition here, rather than the "scalar fields - // always present" in the proto3 docs, because MergeFrom() semantics - // require presence as "present on wire", and reflection-based merge - // (which uses HasField()) needs to be consistent with this. - switch (field->cpp_type()) { - case FieldDescriptor::CPPTYPE_STRING: - switch (field->cpp_string_type()) { - case FieldDescriptor::CppStringType::kCord: - return !GetField<const absl::Cord>(message, field).empty(); - case FieldDescriptor::CppStringType::kView: - case FieldDescriptor::CppStringType::kString: { - if (IsInlined(field)) { - return !GetField<InlinedStringField>(message, field) - .GetNoArena() - .empty(); - } - - return GetField<ArenaStringPtr>(message, field).Get().size() > 0; - } - } - internal::Unreachable(); - case FieldDescriptor::CPPTYPE_BOOL: - return GetRaw<bool>(message, field) != false; - case FieldDescriptor::CPPTYPE_INT32: - return GetRaw<int32_t>(message, field) != 0; - case FieldDescriptor::CPPTYPE_INT64: - return GetRaw<int64_t>(message, field) != 0; - case FieldDescriptor::CPPTYPE_UINT32: - return GetRaw<uint32_t>(message, field) != 0; - case FieldDescriptor::CPPTYPE_UINT64: - return GetRaw<uint64_t>(message, field) != 0; - case FieldDescriptor::CPPTYPE_FLOAT: - static_assert(sizeof(uint32_t) == sizeof(float), - "Code assumes uint32_t and float are the same size."); - return GetRaw<uint32_t>(message, field) != 0; - case FieldDescriptor::CPPTYPE_DOUBLE: - static_assert(sizeof(uint64_t) == sizeof(double), - "Code assumes uint64_t and double are the same size."); - return GetRaw<uint64_t>(message, field) != 0; - case FieldDescriptor::CPPTYPE_ENUM: - return GetRaw<int>(message, field) != 0; - case FieldDescriptor::CPPTYPE_MESSAGE: - // handled above; avoid warning - break; - } - ABSL_LOG(FATAL) << "Reached impossible case in HasFieldSingular()."; - return false; } + + // Non-message field (and non-oneof, since that was handled in HasField() + // before calling us), and singular (again, checked in HasField). So, this + // field must be a scalar. + + return IsSingularFieldNonEmpty(message, field); } void Reflection::SetHasBit(Message* message, @@ -3037,23 +3157,31 @@ void Reflection::ClearHasBit(Message* message, ~(static_cast<uint32_t>(1) << (index % 32)); } -void Reflection::SwapHasBit(Message* message1, Message* message2, - const FieldDescriptor* field) const { +void Reflection::NaiveSwapHasBit(Message* message1, Message* message2, + const FieldDescriptor* field) const { ABSL_DCHECK(!field->options().weak()); if (!schema_.HasHasbits()) { return; } - bool temp_is_present = HasFieldSingular(*message1, field); - if (HasFieldSingular(*message2, field)) { - SetHasBit(message1, field); - } else { - ClearHasBit(message1, field); - } - if (temp_is_present) { + const Reflection* r1 = message1->GetReflection(); + const Reflection* r2 = message2->GetReflection(); + + bool is_m1_hasbit_set = IsIndexInHasBitSet(r1->GetHasBits(*message1), + r1->schema_.HasBitIndex(field)); + bool is_m2_hasbit_set = IsIndexInHasBitSet(r2->GetHasBits(*message2), + r2->schema_.HasBitIndex(field)); + + if (is_m1_hasbit_set) { SetHasBit(message2, field); } else { ClearHasBit(message2, field); } + + if (is_m2_hasbit_set) { + SetHasBit(message1, field); + } else { + ClearHasBit(message1, field); + } } bool Reflection::HasOneof(const Message& message, @@ -3409,6 +3537,7 @@ void Reflection::PopulateTcParseFieldAux( ABSL_LOG(FATAL) << "Not supported"; break; case internal::TailCallTableInfo::kMapAuxInfo: + // TODO: Fix this now that dynamic uses normal map ABIs. // Default constructed info, which causes MpMap to call the fallback. // DynamicMessage uses DynamicMapField, which uses variant keys and // values. TcParser does not support them yet, so mark the field as diff --git a/third_party/protobuf/src/google/protobuf/generated_message_reflection.h b/third_party/protobuf/src/google/protobuf/generated_message_reflection.h index aa75cd0a9511d..84ce8232ceda6 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_reflection.h +++ b/third_party/protobuf/src/google/protobuf/generated_message_reflection.h @@ -21,10 +21,10 @@ #include <string> #include "absl/base/call_once.h" +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/generated_enum_reflection.h" -#include "google/protobuf/port.h" #include "google/protobuf/unknown_field_set.h" // Must be included last. @@ -148,10 +148,15 @@ struct ReflectionSchema { sizeof(uint32_t)); } + // Returns true iff the field object has usable hasbit offset. + // Note that this is not necessarily correlated with *field presence* : + // Fields with implicit presence (i.e. ones that don't expose has_foo API) + // can still have hasbits in their underlying implementation. bool HasHasbits() const { return has_bits_offset_ != -1; } // Bit index within the bit array of hasbits. Bit order is low-to-high. uint32_t HasBitIndex(const FieldDescriptor* field) const { + ABSL_DCHECK(!field->is_extension()); if (has_bits_offset_ == -1) return static_cast<uint32_t>(-1); ABSL_DCHECK(HasHasbits()); return has_bit_indices_[field->index()]; @@ -365,8 +370,8 @@ const std::string& NameOfDenseEnum(int v) { static DenseEnumCacheInfo deci = {/* atomic ptr */ {}, min_val, max_val, descriptor_fn}; const std::string** cache = deci.cache.load(std::memory_order_acquire ); - if (PROTOBUF_PREDICT_TRUE(cache != nullptr)) { - if (PROTOBUF_PREDICT_TRUE(v >= min_val && v <= max_val)) { + if (ABSL_PREDICT_TRUE(cache != nullptr)) { + if (ABSL_PREDICT_TRUE(v >= min_val && v <= max_val)) { return *cache[v - min_val]; } } diff --git a/third_party/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc b/third_party/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc index d13e79ddba231..9c91546f55a53 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc @@ -38,6 +38,7 @@ #include "google/protobuf/message.h" #include "google/protobuf/port.h" #include "google/protobuf/test_util.h" +#include "google/protobuf/text_format.h" #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_mset.pb.h" #include "google/protobuf/unittest_mset_wire_format.pb.h" @@ -193,9 +194,9 @@ TEST(GeneratedMessageReflectionTest, GetStringViewWithExtensions) { descriptor_file->FindExtensionByName("optional_string_piece_extension"); google::protobuf::FieldDescriptor const* cord_ext = descriptor_file->FindExtensionByName("optional_cord_extension"); - message.SetExtension(protobuf_unittest::optional_string_extension, "foo"); - message.SetExtension(protobuf_unittest::optional_string_piece_extension, "bar"); - message.SetExtension(protobuf_unittest::optional_cord_extension, "baz"); + message.SetExtension(proto2_unittest::optional_string_extension, "foo"); + message.SetExtension(proto2_unittest::optional_string_piece_extension, "bar"); + message.SetExtension(proto2_unittest::optional_cord_extension, "baz"); const Reflection* reflection = message.GetReflection(); Reflection::ScratchSpace scratch; @@ -247,9 +248,9 @@ TEST(GeneratedMessageReflectionTest, GetRepeatedStringViewWithExtensions) { descriptor_file->FindExtensionByName("repeated_string_piece_extension"); google::protobuf::FieldDescriptor const* cord_ext = descriptor_file->FindExtensionByName("repeated_cord_extension"); - message.AddExtension(protobuf_unittest::repeated_string_extension, "foo"); - message.AddExtension(protobuf_unittest::repeated_string_piece_extension, "bar"); - message.AddExtension(protobuf_unittest::repeated_cord_extension, "baz"); + message.AddExtension(proto2_unittest::repeated_string_extension, "foo"); + message.AddExtension(proto2_unittest::repeated_string_piece_extension, "bar"); + message.AddExtension(proto2_unittest::repeated_cord_extension, "baz"); const Reflection* reflection = message.GetReflection(); Reflection::ScratchSpace scratch; @@ -735,7 +736,7 @@ TEST(GeneratedMessageReflectionTest, ReleaseLast) { message.Clear(); TestUtil::SetAllFields(&message); ASSERT_EQ(2, message.repeated_foreign_message_size()); - const protobuf_unittest::ForeignMessage* expected = + const proto2_unittest::ForeignMessage* expected = message.mutable_repeated_foreign_message(1); (void)expected; // unused in somce configurations std::unique_ptr<Message> released(message.GetReflection()->ReleaseLast( @@ -765,7 +766,7 @@ TEST(GeneratedMessageReflectionTest, ReleaseLastExtensions) { TestUtil::SetAllExtensions(&message); ASSERT_EQ( 2, message.ExtensionSize(unittest::repeated_foreign_message_extension)); - const protobuf_unittest::ForeignMessage* expected = + const proto2_unittest::ForeignMessage* expected = message.MutableExtension(unittest::repeated_foreign_message_extension, 1); std::unique_ptr<Message> released(message.GetReflection()->ReleaseLast( &message, descriptor->file()->FindExtensionByName( @@ -1432,8 +1433,8 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) { descriptor->FindFieldByName("optional_int64")), "Protocol Buffer reflection usage error:\n" " Method : google::protobuf::Reflection::GetInt32\n" - " Message type: protobuf_unittest\\.TestAllTypes\n" - " Field : protobuf_unittest\\.TestAllTypes\\.optional_int64\n" + " Message type: proto2_unittest\\.TestAllTypes\n" + " Field : proto2_unittest\\.TestAllTypes\\.optional_int64\n" " Problem : Field is not the right type for this message:\n" " Expected : CPPTYPE_INT32\n" " Field type: CPPTYPE_INT64"); @@ -1441,8 +1442,8 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) { message, descriptor->FindFieldByName("repeated_int32")), "Protocol Buffer reflection usage error:\n" " Method : google::protobuf::Reflection::GetInt32\n" - " Message type: protobuf_unittest.TestAllTypes\n" - " Field : protobuf_unittest.TestAllTypes.repeated_int32\n" + " Message type: proto2_unittest.TestAllTypes\n" + " Field : proto2_unittest.TestAllTypes.repeated_int32\n" " Problem : Field is repeated; the method requires a " "singular field."); #ifndef NDEBUG @@ -1451,9 +1452,9 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) { descriptor->FindFieldByName("optional_int32")), "Protocol Buffer reflection usage error:\n" " Method : google::protobuf::Reflection::GetInt32\n" - " Expected type: protobuf_unittest.TestAllTypes\n" - " Actual type : protobuf_unittest.ForeignMessage\n" - " Field : protobuf_unittest.TestAllTypes.optional_int32\n" + " Expected type: proto2_unittest.TestAllTypes\n" + " Actual type : proto2_unittest.ForeignMessage\n" + " Field : proto2_unittest.TestAllTypes.optional_int32\n" " Problem : Message is not the right object for reflection"); #endif EXPECT_DEATH( @@ -1462,8 +1463,8 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) { unittest::ForeignMessage::descriptor()->FindFieldByName("c")), "Protocol Buffer reflection usage error:\n" " Method : google::protobuf::Reflection::GetInt32\n" - " Message type: protobuf_unittest.TestAllTypes\n" - " Field : protobuf_unittest.ForeignMessage.c\n" + " Message type: proto2_unittest.TestAllTypes\n" + " Field : proto2_unittest.ForeignMessage.c\n" " Problem : Field does not match message type."); EXPECT_DEATH( reflection->HasField( @@ -1471,8 +1472,8 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) { unittest::ForeignMessage::descriptor()->FindFieldByName("c")), "Protocol Buffer reflection usage error:\n" " Method : google::protobuf::Reflection::HasField\n" - " Message type: protobuf_unittest.TestAllTypes\n" - " Field : protobuf_unittest.ForeignMessage.c\n" + " Message type: proto2_unittest.TestAllTypes\n" + " Field : proto2_unittest.ForeignMessage.c\n" " Problem : Field does not match message type."); } @@ -1807,6 +1808,22 @@ TEST(GeneratedMessageReflection, SwapImplicitPresenceShouldWork) { EXPECT_EQ(lhs.child().optional_int32(), -1); } +TEST(GeneratedMessageReflection, UnvalidatedStringsAreDowngradedToBytes) { + proto2_unittest::TestChildExtension parsed_msg; + google::protobuf::TextFormat::ParseFromString( + R"pb( + optional_extension < + [proto2_unittest.repeated_string_extension]: "foo" + > + )pb", + &parsed_msg); + proto2_unittest::TestChildExtension msg; + msg.mutable_optional_extension()->AddExtension( + proto2_unittest::repeated_string_extension, "bar"); + parsed_msg.mutable_optional_extension()->Swap( + msg.mutable_optional_extension()); +} + } // namespace } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/generated_message_tctable_decl.h b/third_party/protobuf/src/google/protobuf/generated_message_tctable_decl.h index 88e7b409f0f5d..2fbcd6fcb4b38 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_tctable_decl.h +++ b/third_party/protobuf/src/google/protobuf/generated_message_tctable_decl.h @@ -130,7 +130,7 @@ struct TcFieldData { struct TcParseTableBase; // TailCallParseFunc is the function pointer type used in the tailcall table. -typedef PROTOBUF_CC const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL); +using TailCallParseFunc = PROTOBUF_CC const char* (*)(PROTOBUF_TC_PARAM_DECL); namespace field_layout { struct Offset { @@ -152,92 +152,87 @@ struct FieldAuxEnumData {}; // byte. class MapTypeCard { public: - enum CppType { kBool, k32, k64, kString, kMessage }; MapTypeCard() = default; - constexpr MapTypeCard(WireFormatLite::WireType wiretype, CppType cpp_type, - bool is_zigzag_utf8, bool is_signed) - : data_(static_cast<uint8_t>((static_cast<uint8_t>(wiretype) << 0) | - (static_cast<uint8_t>(cpp_type) << 3) | - (static_cast<uint8_t>(is_zigzag_utf8) << 6) | - (static_cast<uint8_t>(is_signed) << 7))) {} + constexpr MapTypeCard(int number, WireFormatLite::WireType wiretype, + bool is_signed, bool is_zigzag, bool is_utf8) + : tag_(static_cast<uint8_t>(WireFormatLite::MakeTag(number, wiretype))), + is_signed_(is_signed), + is_zigzag_(is_zigzag), + is_utf8_(is_utf8) {} + + uint8_t tag() const { return tag_; } WireFormatLite::WireType wiretype() const { - return static_cast<WireFormatLite::WireType>((data_ >> 0) & 0x7); + return static_cast<WireFormatLite::WireType>(tag_ & 7); } - CppType cpp_type() const { return static_cast<CppType>((data_ >> 3) & 0x7); } - - bool is_signed() const { - ABSL_DCHECK(cpp_type() == CppType::k32 || cpp_type() == CppType::k64); - return static_cast<bool>(data_ >> 7); - } + bool is_signed() const { return is_signed_; } bool is_zigzag() const { ABSL_DCHECK(wiretype() == WireFormatLite::WIRETYPE_VARINT); - ABSL_DCHECK(cpp_type() == CppType::k32 || cpp_type() == CppType::k64); - return is_zigzag_utf8(); + return is_zigzag_; } bool is_utf8() const { ABSL_DCHECK(wiretype() == WireFormatLite::WIRETYPE_LENGTH_DELIMITED); - ABSL_DCHECK(cpp_type() == CppType::kString); - return is_zigzag_utf8(); + return is_utf8_; } private: - bool is_zigzag_utf8() const { return static_cast<bool>((data_ >> 6) & 0x1); } - uint8_t data_; + uint8_t tag_; + bool is_signed_ : 1; + bool is_zigzag_ : 1; + bool is_utf8_ : 1; }; -static_assert(sizeof(MapTypeCard) == sizeof(uint8_t), ""); // Make the map entry type card for a specified field type. -constexpr MapTypeCard MakeMapTypeCard(WireFormatLite::FieldType type) { +constexpr MapTypeCard MakeMapTypeCard(int number, + WireFormatLite::FieldType type) { switch (type) { case WireFormatLite::TYPE_FLOAT: - return {WireFormatLite::WIRETYPE_FIXED32, MapTypeCard::k32, false, true}; + return {number, WireFormatLite::WIRETYPE_FIXED32, true, false, false}; case WireFormatLite::TYPE_FIXED32: - return {WireFormatLite::WIRETYPE_FIXED32, MapTypeCard::k32, false, false}; + return {number, WireFormatLite::WIRETYPE_FIXED32, false, false, false}; case WireFormatLite::TYPE_SFIXED32: - return {WireFormatLite::WIRETYPE_FIXED32, MapTypeCard::k32, false, true}; + return {number, WireFormatLite::WIRETYPE_FIXED32, true, false, false}; case WireFormatLite::TYPE_DOUBLE: - return {WireFormatLite::WIRETYPE_FIXED64, MapTypeCard::k64, false, true}; + return {number, WireFormatLite::WIRETYPE_FIXED64, true, false, false}; case WireFormatLite::TYPE_FIXED64: - return {WireFormatLite::WIRETYPE_FIXED64, MapTypeCard::k64, false, false}; + return {number, WireFormatLite::WIRETYPE_FIXED64, false, false, false}; case WireFormatLite::TYPE_SFIXED64: - return {WireFormatLite::WIRETYPE_FIXED64, MapTypeCard::k64, false, true}; + return {number, WireFormatLite::WIRETYPE_FIXED64, true, false, false}; case WireFormatLite::TYPE_BOOL: - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::kBool, false, - false}; + return {number, WireFormatLite::WIRETYPE_VARINT, false, false, false}; case WireFormatLite::TYPE_ENUM: // Enum validation is handled via `value_is_validated_enum` below. - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::k32, false, true}; + return {number, WireFormatLite::WIRETYPE_VARINT, true, false, false}; case WireFormatLite::TYPE_INT32: - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::k32, false, true}; + return {number, WireFormatLite::WIRETYPE_VARINT, true, false, false}; case WireFormatLite::TYPE_UINT32: - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::k32, false, false}; + return {number, WireFormatLite::WIRETYPE_VARINT, false, false, false}; case WireFormatLite::TYPE_INT64: - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::k64, false, true}; + return {number, WireFormatLite::WIRETYPE_VARINT, true, false, false}; case WireFormatLite::TYPE_UINT64: - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::k64, false, false}; + return {number, WireFormatLite::WIRETYPE_VARINT, false, false, false}; case WireFormatLite::TYPE_SINT32: - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::k32, true, true}; + return {number, WireFormatLite::WIRETYPE_VARINT, true, true, false}; case WireFormatLite::TYPE_SINT64: - return {WireFormatLite::WIRETYPE_VARINT, MapTypeCard::k64, true, true}; + return {number, WireFormatLite::WIRETYPE_VARINT, true, true, false}; case WireFormatLite::TYPE_STRING: - return {WireFormatLite::WIRETYPE_LENGTH_DELIMITED, MapTypeCard::kString, - true, false}; + return {number, WireFormatLite::WIRETYPE_LENGTH_DELIMITED, false, false, + true}; case WireFormatLite::TYPE_BYTES: - return {WireFormatLite::WIRETYPE_LENGTH_DELIMITED, MapTypeCard::kString, - false, false}; + return {number, WireFormatLite::WIRETYPE_LENGTH_DELIMITED, false, false, + false}; case WireFormatLite::TYPE_MESSAGE: - return {WireFormatLite::WIRETYPE_LENGTH_DELIMITED, MapTypeCard::kMessage, - false, false}; + return {number, WireFormatLite::WIRETYPE_LENGTH_DELIMITED, false, false, + false}; case WireFormatLite::TYPE_GROUP: default: @@ -245,8 +240,6 @@ constexpr MapTypeCard MakeMapTypeCard(WireFormatLite::FieldType type) { } } -enum class MapNodeSizeInfoT : uint32_t; - // Aux entry for map fields. struct MapAuxInfo { MapTypeCard key_type_card; @@ -263,8 +256,6 @@ struct MapAuxInfo { uint8_t log_debug_utf8_failure : 1; // If true the next aux contains the enum validator. uint8_t value_is_validated_enum : 1; - // Size information derived from the actual node type. - MapNodeSizeInfoT node_size_info; }; static_assert(sizeof(MapAuxInfo) <= 8, ""); diff --git a/third_party/protobuf/src/google/protobuf/generated_message_tctable_full.cc b/third_party/protobuf/src/google/protobuf/generated_message_tctable_full.cc index d2f4d269e0e6b..363a80221b7de 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_tctable_full.cc +++ b/third_party/protobuf/src/google/protobuf/generated_message_tctable_full.cc @@ -30,6 +30,7 @@ #include <cstdint> +#include "absl/base/optimization.h" #include "google/protobuf/extension_set.h" #include "google/protobuf/generated_message_tctable_impl.h" #include "google/protobuf/message.h" @@ -53,7 +54,7 @@ const char* TcParser::GenericFallback(PROTOBUF_TC_PARAM_DECL) { const char* TcParser::ReflectionFallback(PROTOBUF_TC_PARAM_DECL) { bool must_fallback_to_generic = (ptr == nullptr); - if (PROTOBUF_PREDICT_FALSE(must_fallback_to_generic)) { + if (ABSL_PREDICT_FALSE(must_fallback_to_generic)) { PROTOBUF_MUSTTAIL return GenericFallback(PROTOBUF_TC_PARAM_PASS); } diff --git a/third_party/protobuf/src/google/protobuf/generated_message_tctable_impl.h b/third_party/protobuf/src/google/protobuf/generated_message_tctable_impl.h index 1334822dd82e6..22cdfc5e7e479 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_tctable_impl.h +++ b/third_party/protobuf/src/google/protobuf/generated_message_tctable_impl.h @@ -716,8 +716,8 @@ class PROTOBUF_EXPORT TcParser final { #if !defined(NDEBUG) && !(defined(_MSC_VER) && defined(_M_IX86)) // Check the alignment in debug mode, except in 32-bit msvc because it does // not respect the alignment as expressed by `alignof(T)` - if (PROTOBUF_PREDICT_FALSE( - reinterpret_cast<uintptr_t>(target) % alignof(T) != 0)) { + if (ABSL_PREDICT_FALSE(reinterpret_cast<uintptr_t>(target) % alignof(T) != + 0)) { AlignFail(std::integral_constant<size_t, alignof(T)>(), reinterpret_cast<uintptr_t>(target)); // Explicit abort to let compilers know this code-path does not return @@ -734,8 +734,8 @@ class PROTOBUF_EXPORT TcParser final { #if !defined(NDEBUG) && !(defined(_MSC_VER) && defined(_M_IX86)) // Check the alignment in debug mode, except in 32-bit msvc because it does // not respect the alignment as expressed by `alignof(T)` - if (PROTOBUF_PREDICT_FALSE( - reinterpret_cast<uintptr_t>(target) % alignof(T) != 0)) { + if (ABSL_PREDICT_FALSE(reinterpret_cast<uintptr_t>(target) % alignof(T) != + 0)) { AlignFail(std::integral_constant<size_t, alignof(T)>(), reinterpret_cast<uintptr_t>(target)); // Explicit abort to let compilers know this code-path does not return @@ -800,28 +800,25 @@ class PROTOBUF_EXPORT TcParser final { PROTOBUF_TC_PARAM_DECL); // For `map` mini parsing generate a type card for the key/value. - template <typename MapField> static constexpr MapAuxInfo GetMapAuxInfo(bool fail_on_utf8_failure, bool log_debug_utf8_failure, bool validated_enum_value, - int key_type, int value_type) { - using MapType = typename MapField::MapType; - using Node = typename MapType::Node; - static_assert(alignof(Node) == alignof(NodeBase), ""); - // Verify the assumption made in MpMap, guaranteed by Map<>. - assert(PROTOBUF_FIELD_OFFSET(Node, kv.first) == sizeof(NodeBase)); + int key_type, int value_type, + bool is_lite) { return { - MakeMapTypeCard(static_cast<WireFormatLite::FieldType>(key_type)), - MakeMapTypeCard(static_cast<WireFormatLite::FieldType>(value_type)), + MakeMapTypeCard(1, static_cast<WireFormatLite::FieldType>(key_type)), + MakeMapTypeCard(2, static_cast<WireFormatLite::FieldType>(value_type)), true, - !std::is_base_of<MapFieldBaseForParse, MapField>::value, + is_lite, fail_on_utf8_failure, log_debug_utf8_failure, validated_enum_value, - Node::size_info(), }; } + static void VerifyHasBitConsistency(const MessageLite* msg, + const TcParseTableBase* table); + private: // Optimized small tag varint parser for int32/int64 template <typename FieldType> @@ -856,7 +853,7 @@ class PROTOBUF_EXPORT TcParser final { template <typename TagType> PROTOBUF_CC static const char* FastEndGroupImpl(PROTOBUF_TC_PARAM_DECL); - static inline PROTOBUF_ALWAYS_INLINE void SyncHasbits( + static PROTOBUF_ALWAYS_INLINE void SyncHasbits( MessageLite* msg, uint64_t hasbits, const TcParseTableBase* table) { const uint32_t has_bits_offset = table->has_bits_offset; if (has_bits_offset) { @@ -904,7 +901,7 @@ class PROTOBUF_EXPORT TcParser final { template <class MessageBaseT, class UnknownFieldsT> PROTOBUF_CC static const char* GenericFallbackImpl(PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { // This is the ABI used by GetUnknownFieldOps(). Return the vtable. static constexpr UnknownFieldOps kOps = { WriteVarintToUnknown<UnknownFieldsT>, @@ -1004,22 +1001,15 @@ class PROTOBUF_EXPORT TcParser final { static void WriteMapEntryAsUnknown(MessageLite* msg, const TcParseTableBase* table, - uint32_t tag, NodeBase* node, - MapAuxInfo map_info); + UntypedMapBase& map, uint32_t tag, + NodeBase* node, MapAuxInfo map_info); - static void InitializeMapNodeEntry(void* obj, MapTypeCard type_card, - UntypedMapBase& map, - const TcParseTableBase::FieldAux* aux, - bool is_key); - PROTOBUF_NOINLINE - static void DestroyMapNode(NodeBase* node, MapAuxInfo map_info, - UntypedMapBase& map); static const char* ParseOneMapEntry(NodeBase* node, const char* ptr, ParseContext* ctx, const TcParseTableBase::FieldAux* aux, const TcParseTableBase* table, const TcParseTableBase::FieldEntry& entry, - Arena* arena); + UntypedMapBase& map); // Mini field lookup: static const TcParseTableBase::FieldEntry* FindFieldEntry( @@ -1027,6 +1017,8 @@ class PROTOBUF_EXPORT TcParser final { static absl::string_view MessageName(const TcParseTableBase* table); static absl::string_view FieldName(const TcParseTableBase* table, const TcParseTableBase::FieldEntry*); + static int FieldNumber(const TcParseTableBase* table, + const TcParseTableBase::FieldEntry*); static bool ChangeOneof(const TcParseTableBase* table, const TcParseTableBase::FieldEntry& entry, uint32_t field_num, ParseContext* ctx, @@ -1094,7 +1086,7 @@ class PROTOBUF_EXPORT TcParser final { }; // Dispatch to the designated parse function -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::TagDispatch( +PROTOBUF_ALWAYS_INLINE const char* TcParser::TagDispatch( PROTOBUF_TC_PARAM_NO_DATA_DECL) { const auto coded_tag = UnalignedLoad<uint16_t>(ptr); const size_t idx = coded_tag & table->fast_idx_mask; @@ -1110,7 +1102,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::TagDispatch( // 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. -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ToTagDispatch( +PROTOBUF_ALWAYS_INLINE const char* TcParser::ToTagDispatch( PROTOBUF_TC_PARAM_NO_DATA_DECL) { constexpr bool always_return = !PROTOBUF_TAILCALL; if (always_return || !ctx->DataAvailable(ptr)) { @@ -1119,14 +1111,14 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ToTagDispatch( PROTOBUF_MUSTTAIL return TagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); } -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ToParseLoop( +PROTOBUF_ALWAYS_INLINE const char* TcParser::ToParseLoop( PROTOBUF_TC_PARAM_NO_DATA_DECL) { (void)ctx; SyncHasbits(msg, hasbits, table); return ptr; } -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ParseLoop( +PROTOBUF_ALWAYS_INLINE const char* TcParser::ParseLoop( MessageLite* msg, const char* ptr, ParseContext* ctx, const TcParseTableBase* table) { // Note: TagDispatch uses a dispatch table at "&table->fast_entries". @@ -1152,6 +1144,9 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ParseLoop( if (ABSL_PREDICT_FALSE(table->has_post_loop_handler)) { return table->post_loop_handler(msg, ptr, ctx); } + if (ABSL_PREDICT_FALSE(PerformDebugChecks() && ptr == nullptr)) { + VerifyHasBitConsistency(msg, table); + } return ptr; } diff --git a/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite.cc b/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite.cc index 58612936a9477..0df7c7cdabd3c 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite.cc +++ b/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite.cc @@ -16,11 +16,14 @@ #include <type_traits> #include "absl/base/optimization.h" +#include "absl/functional/overload.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/numeric/bits.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "google/protobuf/arenastring.h" #include "google/protobuf/generated_enum_util.h" #include "google/protobuf/generated_message_tctable_decl.h" @@ -67,6 +70,120 @@ const char* TcParser::GenericFallbackLite(PROTOBUF_TC_PARAM_DECL) { PROTOBUF_TC_PARAM_PASS); } +namespace { +bool ReadHas(const FieldEntry& entry, const MessageLite* msg) { + auto has_idx = static_cast<uint32_t>(entry.has_idx); + const auto& hasblock = TcParser::RefAt<const uint32_t>(msg, has_idx / 32 * 4); + return (hasblock & (uint32_t{1} << (has_idx % 32))) != 0; +} +} // namespace + +void TcParser::VerifyHasBitConsistency(const MessageLite* msg, + const TcParseTableBase* table) { + namespace fl = internal::field_layout; + if (table->has_bits_offset == 0) { + // Nothing to check + return; + } + + for (const auto& entry : table->field_entries()) { + const auto print_error = [&] { + return absl::StrFormat("Type=%s Field=%d\n", msg->GetTypeName(), + FieldNumber(table, &entry)); + }; + if ((entry.type_card & fl::kFcMask) != fl::kFcOptional) return; + const bool has_bit = ReadHas(entry, msg); + const void* base = msg; + const void* default_base = table->default_instance(); + if ((entry.type_card & field_layout::kSplitMask) == + field_layout::kSplitTrue) { + const size_t offset = table->field_aux(kSplitOffsetAuxIdx)->offset; + base = TcParser::RefAt<const void*>(base, offset); + default_base = TcParser::RefAt<const void*>(default_base, offset); + } + switch (entry.type_card & fl::kFkMask) { + case fl::kFkVarint: + case fl::kFkFixed: + // Numerics can have any value when the has bit is on. + if (has_bit) return; + switch (entry.type_card & fl::kRepMask) { + case fl::kRep8Bits: + ABSL_CHECK_EQ(RefAt<bool>(base, entry.offset), + RefAt<bool>(default_base, entry.offset)) + << print_error(); + break; + case fl::kRep32Bits: + ABSL_CHECK_EQ(RefAt<uint32_t>(base, entry.offset), + RefAt<uint32_t>(default_base, entry.offset)) + << print_error(); + break; + case fl::kRep64Bits: + ABSL_CHECK_EQ(RefAt<uint64_t>(base, entry.offset), + RefAt<uint64_t>(default_base, entry.offset)) + << print_error(); + break; + } + break; + + case fl::kFkString: + switch (entry.type_card & fl::kRepMask) { + case field_layout::kRepAString: + if (has_bit) { + // Must not point to the default. + ABSL_CHECK(!RefAt<ArenaStringPtr>(base, entry.offset).IsDefault()) + << print_error(); + } else { + // We should technically check that the value matches the default + // value of the field, but the prototype does not actually contain + // this value. Non-empty defaults are loaded on access. + } + break; + case field_layout::kRepCord: + if (!has_bit) { + // If the has bit is off, it must match the default. + ABSL_CHECK_EQ(RefAt<absl::Cord>(base, entry.offset), + RefAt<absl::Cord>(default_base, entry.offset)) + << print_error(); + } + break; + case field_layout::kRepIString: + if (!has_bit) { + // If the has bit is off, it must match the default. + ABSL_CHECK_EQ( + RefAt<InlinedStringField>(base, entry.offset).Get(), + RefAt<InlinedStringField>(default_base, entry.offset).Get()) + << print_error(); + } + break; + case field_layout::kRepSString: + Unreachable(); + } + break; + case fl::kFkMessage: + switch (entry.type_card & fl::kRepMask) { + case fl::kRepMessage: + case fl::kRepGroup: + if (has_bit) { + ABSL_CHECK(RefAt<const MessageLite*>(base, entry.offset) != + nullptr) + << print_error(); + } else { + // An off has_bit does not imply a null pointer. + // We might have a previous instance that we cached. + } + break; + default: + Unreachable(); + } + break; + + default: + // All other types are not `optional`. + Unreachable(); + } + } +} + ////////////////////////////////////////////////////////////////////////////// // Core fast parsing implementation: ////////////////////////////////////////////////////////////////////////////// @@ -135,10 +252,10 @@ const TcParseTableBase::FieldEntry* TcParser::FindFieldEntry( uint32_t fstart = 1; uint32_t adj_fnum = field_num - fstart; - if (PROTOBUF_PREDICT_TRUE(adj_fnum < 32)) { + if (ABSL_PREDICT_TRUE(adj_fnum < 32)) { uint32_t skipmap = table->skipmap32; uint32_t skipbit = 1 << adj_fnum; - if (PROTOBUF_PREDICT_FALSE(skipmap & skipbit)) return nullptr; + if (ABSL_PREDICT_FALSE(skipmap & skipbit)) return nullptr; skipmap &= skipbit - 1; adj_fnum -= absl::popcount(skipmap); auto* entry = field_entries + adj_fnum; @@ -157,7 +274,7 @@ const TcParseTableBase::FieldEntry* TcParser::FindFieldEntry( if (field_num < fstart) return nullptr; adj_fnum = field_num - fstart; uint32_t skip_num = adj_fnum / 16; - if (PROTOBUF_PREDICT_TRUE(skip_num < num_skip_entries)) { + if (ABSL_PREDICT_TRUE(skip_num < num_skip_entries)) { // for each group of 16 fields we have: // a bitmap of 16 bits // a 16-bit field-entry offset for the first of them. @@ -167,7 +284,7 @@ const TcParseTableBase::FieldEntry* TcParser::FindFieldEntry( adj_fnum &= 15; uint32_t skipmap = se.skipmap; uint16_t skipbit = 1 << adj_fnum; - if (PROTOBUF_PREDICT_FALSE(skipmap & skipbit)) return nullptr; + if (ABSL_PREDICT_FALSE(skipmap & skipbit)) return nullptr; skipmap &= skipbit - 1; adj_fnum += se.field_entry_offset; adj_fnum -= absl::popcount(skipmap); @@ -220,6 +337,46 @@ absl::string_view TcParser::FieldName(const TcParseTableBase* table, field_index + 1); } +int TcParser::FieldNumber(const TcParseTableBase* table, + const TcParseTableBase::FieldEntry* entry) { + // The data structure was not designed to be queried in this direction, so + // we have to do a linear search over the entries to see which one matches + // while keeping track of the field number. + // But it is fine because we are only using this for debug check messages. + size_t need_to_skip = entry - table->field_entries_begin(); + const auto visit_bitmap = [&](uint32_t field_bitmap, + int base_field_number) -> absl::optional<int> { + for (; field_bitmap != 0; field_bitmap &= field_bitmap - 1) { + if (need_to_skip == 0) { + return absl::countr_zero(field_bitmap) + base_field_number; + } + --need_to_skip; + } + return absl::nullopt; + }; + if (auto number = visit_bitmap(~table->skipmap32, 1)) { + return *number; + } + + for (const uint16_t* lookup_table = table->field_lookup_begin(); + lookup_table[0] != 0xFFFF || lookup_table[1] != 0xFFFF;) { + uint32_t fstart = lookup_table[0] | (lookup_table[1] << 16); + lookup_table += 2; + const uint16_t num_skip_entries = *lookup_table++; + for (uint16_t i = 0; i < num_skip_entries; ++i) { + // for each group of 16 fields we have: a + // bitmap of 16 bits a 16-bit field-entry + // offset for the first of them. + if (auto number = visit_bitmap(static_cast<uint16_t>(~*lookup_table), + fstart + 16 * i)) { + return *number; + } + lookup_table += 2; + } + } + Unreachable(); +} + PROTOBUF_NOINLINE const char* TcParser::Error(PROTOBUF_TC_PARAM_NO_DATA_DECL) { (void)ctx; (void)ptr; @@ -228,8 +385,7 @@ PROTOBUF_NOINLINE const char* TcParser::Error(PROTOBUF_TC_PARAM_NO_DATA_DECL) { } template <bool export_called_function> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::MiniParse( - PROTOBUF_TC_PARAM_DECL) { +PROTOBUF_ALWAYS_INLINE const char* TcParser::MiniParse(PROTOBUF_TC_PARAM_DECL) { TestMiniParseResult* test_out; if (export_called_function) { test_out = reinterpret_cast<TestMiniParseResult*>( @@ -238,7 +394,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::MiniParse( uint32_t tag; ptr = ReadTagInlined(ptr, &tag); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { if (export_called_function) *test_out = {Error}; PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } @@ -330,7 +486,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpFallback(PROTOBUF_TC_PARAM_DECL) { template <typename TagType> const char* TcParser::FastEndGroupImpl(PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } ctx->SetLastTag(data.decoded_tag()); @@ -349,7 +505,7 @@ PROTOBUF_NOINLINE const char* TcParser::FastEndG2(PROTOBUF_TC_PARAM_DECL) { // Message fields ////////////////////////////////////////////////////////////////////////////// -inline PROTOBUF_ALWAYS_INLINE MessageLite* TcParser::NewMessage( +PROTOBUF_ALWAYS_INLINE MessageLite* TcParser::NewMessage( const TcParseTableBase* table, Arena* arena) { return table->class_data->New(arena); } @@ -361,11 +517,11 @@ MessageLite* TcParser::AddMessage(const TcParseTableBase* table, } template <typename TagType, bool group_coding, bool aux_is_table> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularParseMessageAuxImpl( +PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularParseMessageAuxImpl( PROTOBUF_TC_PARAM_DECL) { PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 192); PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 256); - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } auto saved_tag = UnalignedLoad<TagType>(ptr); @@ -443,9 +599,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastMlS2(PROTOBUF_TC_PARAM_DECL) { } template <typename TagType, bool group_coding, bool aux_is_table> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedParseMessageAuxImpl( +PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedParseMessageAuxImpl( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 256); @@ -463,10 +619,10 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedParseMessageAuxImpl( ptr = group_coding ? ctx->ParseGroupInlined( ptr, FastDecodeTag(expected_tag), inner_loop) : ctx->ParseLengthDelimitedInlined(ptr, inner_loop); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); } } while (UnalignedLoad<TagType>(ptr) == expected_tag); @@ -519,9 +675,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastGtR2(PROTOBUF_TC_PARAM_DECL) { ////////////////////////////////////////////////////////////////////////////// template <typename LayoutType, typename TagType> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularFixed( +PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularFixed( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } ptr += sizeof(TagType); // Consume tag @@ -549,9 +705,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastF64S2(PROTOBUF_TC_PARAM_DECL) { } template <typename LayoutType, typename TagType> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedFixed( +PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedFixed( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } auto& field = RefAt<RepeatedField<LayoutType>>(msg, data.offset()); @@ -559,7 +715,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedFixed( do { field.Add(UnalignedLoad<LayoutType>(ptr + sizeof(TagType))); ptr += sizeof(TagType) + sizeof(LayoutType); - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); } } while (UnalignedLoad<TagType>(ptr) == tag); @@ -584,9 +740,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastF64R2(PROTOBUF_TC_PARAM_DECL) { } template <typename LayoutType, typename TagType> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedFixed( +PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedFixed( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } ptr += sizeof(TagType); @@ -624,8 +780,7 @@ PROTOBUF_NOINLINE const char* TcParser::FastF64P2(PROTOBUF_TC_PARAM_DECL) { namespace { template <typename Type> -inline PROTOBUF_ALWAYS_INLINE const char* ParseVarint(const char* p, - Type* value) { +PROTOBUF_ALWAYS_INLINE const char* ParseVarint(const char* p, Type* value) { static_assert(sizeof(Type) == 4 || sizeof(Type) == 8, "Only [u]int32_t and [u]int64_t please"); #ifdef __aarch64__ @@ -645,10 +800,9 @@ inline PROTOBUF_ALWAYS_INLINE const char* ParseVarint(const char* p, // This overload is specifically for handling bool, because bools have very // different requirements and performance opportunities than ints. -inline PROTOBUF_ALWAYS_INLINE const char* ParseVarint(const char* p, - bool* value) { +PROTOBUF_ALWAYS_INLINE const char* ParseVarint(const char* p, bool* value) { unsigned char byte = static_cast<unsigned char>(*p++); - if (PROTOBUF_PREDICT_TRUE(byte == 0 || byte == 1)) { + if (ABSL_PREDICT_TRUE(byte == 0 || byte == 1)) { // This is the code path almost always taken, // so we take care to make it very efficient. if (sizeof(byte) == sizeof(*value)) { @@ -662,27 +816,27 @@ inline PROTOBUF_ALWAYS_INLINE const char* ParseVarint(const char* p, // This part, we just care about code size. // Although it's almost never used, we have to support it because we guarantee // compatibility for users who change a field from an int32 or int64 to a bool - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { byte = (byte - 0x80) | *p++; - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { // We only care about the continuation bit and the first bit // of the 10th byte. byte = (byte - 0x80) | (*p++ & 0x81); - if (PROTOBUF_PREDICT_FALSE(byte & 0x80)) { + if (ABSL_PREDICT_FALSE(byte & 0x80)) { return nullptr; } } @@ -715,8 +869,8 @@ inline int64_t ZigZagDecodeHelper<int64_t, true>(int64_t value) { // Prefetch the enum data, if necessary. // We can issue the prefetch before we start parsing the ints. -inline PROTOBUF_ALWAYS_INLINE void PrefetchEnumData( - uint16_t xform_val, TcParseTableBase::FieldAux aux) { +PROTOBUF_ALWAYS_INLINE void PrefetchEnumData(uint16_t xform_val, + TcParseTableBase::FieldAux aux) { } // When `xform_val` is a constant, we want to inline `ValidateEnum` because it @@ -727,8 +881,8 @@ inline PROTOBUF_ALWAYS_INLINE void PrefetchEnumData( // way more common than the kTvEnum cases. It is also called from places that // already have out-of-line functions (like MpVarint) so an extra out-of-line // call to `ValidateEnum` does not affect much. -inline PROTOBUF_ALWAYS_INLINE bool EnumIsValidAux( - int32_t val, uint16_t xform_val, TcParseTableBase::FieldAux aux) { +PROTOBUF_ALWAYS_INLINE bool EnumIsValidAux(int32_t val, uint16_t xform_val, + TcParseTableBase::FieldAux aux) { if (xform_val == field_layout::kTvRange) { auto lo = aux.enum_range.start; return lo <= val && val < (lo + aux.enum_range.length); @@ -743,9 +897,9 @@ inline PROTOBUF_ALWAYS_INLINE bool EnumIsValidAux( } // namespace template <typename FieldType, typename TagType, bool zigzag> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularVarint( +PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularVarint( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } ptr += sizeof(TagType); // Consume tag @@ -754,7 +908,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularVarint( // clang isn't smart enough to be able to only conditionally save // registers to the stack, so we turn the integer-greater-than-128 // case into a separate routine. - if (PROTOBUF_PREDICT_FALSE(static_cast<int8_t>(*ptr) < 0)) { + if (ABSL_PREDICT_FALSE(static_cast<int8_t>(*ptr) < 0)) { PROTOBUF_MUSTTAIL return SingularVarBigint<FieldType, TagType, zigzag>( PROTOBUF_TC_PARAM_PASS); } @@ -795,7 +949,7 @@ PROTOBUF_NOINLINE const char* TcParser::SingularVarBigint( table = spill.table; hasbits = spill.hasbits; - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } RefAt<FieldType>(msg, data.offset()) = @@ -804,15 +958,15 @@ PROTOBUF_NOINLINE const char* TcParser::SingularVarBigint( } template <typename FieldType> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::FastVarintS1( +PROTOBUF_ALWAYS_INLINE const char* TcParser::FastVarintS1( PROTOBUF_TC_PARAM_DECL) { using TagType = uint8_t; - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } int64_t res; ptr = ShiftMixParseVarint<FieldType>(ptr + sizeof(TagType), res); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } hasbits |= (uint64_t{1} << data.hasbit_idx()); @@ -827,7 +981,7 @@ PROTOBUF_NOINLINE const char* TcParser::FastV8S1(PROTOBUF_TC_PARAM_DECL) { // The coded_tag() field will actually contain the value too and we can check // both at the same time. auto coded_tag = data.coded_tag<uint16_t>(); - if (PROTOBUF_PREDICT_TRUE(coded_tag == 0x0000 || coded_tag == 0x0100)) { + if (ABSL_PREDICT_TRUE(coded_tag == 0x0000 || coded_tag == 0x0100)) { auto& field = RefAt<bool>(msg, data.offset()); // Note: we use `data.data` because Clang generates suboptimal code when // using coded_tag. @@ -887,9 +1041,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastZ64S2(PROTOBUF_TC_PARAM_DECL) { } template <typename FieldType, typename TagType, bool zigzag> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedVarint( +PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedVarint( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } auto& field = RefAt<RepeatedField<FieldType>>(msg, data.offset()); @@ -898,11 +1052,11 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedVarint( ptr += sizeof(TagType); FieldType tmp; ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } field.Add(ZigZagDecodeHelper<FieldType, zigzag>(tmp)); - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); } } while (UnalignedLoad<TagType>(ptr) == expected_tag); @@ -952,9 +1106,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastZ64R2(PROTOBUF_TC_PARAM_DECL) { } template <typename FieldType, typename TagType, bool zigzag> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedVarint( +PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedVarint( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } ptr += sizeof(TagType); @@ -1028,12 +1182,12 @@ PROTOBUF_NOINLINE const char* TcParser::FastUnknownEnumFallback( // enum values. uint32_t tag; ptr = ReadTag(ptr, &tag); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } uint64_t tmp; ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } AddUnknownEnum(msg, table, tag, static_cast<int32_t>(tmp)); @@ -1046,7 +1200,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpUnknownEnumFallback( uint32_t tag = data.tag(); uint64_t tmp; ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } AddUnknownEnum(msg, table, tag, static_cast<int32_t>(tmp)); @@ -1054,9 +1208,9 @@ PROTOBUF_NOINLINE const char* TcParser::MpUnknownEnumFallback( } template <typename TagType, uint16_t xform_val> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularEnum( +PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularEnum( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } const TcParseTableBase::FieldAux aux = *table->field_aux(data.aux_idx()); @@ -1065,10 +1219,10 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularEnum( ptr += sizeof(TagType); // Consume tag uint64_t tmp; ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE( + if (ABSL_PREDICT_FALSE( !EnumIsValidAux(static_cast<int32_t>(tmp), xform_val, aux))) { ptr = ptr2; PROTOBUF_MUSTTAIL return FastUnknownEnumFallback(PROTOBUF_TC_PARAM_PASS); @@ -1096,9 +1250,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastEvS2(PROTOBUF_TC_PARAM_DECL) { } template <typename TagType, uint16_t xform_val> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedEnum( +PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedEnum( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } auto& field = RefAt<RepeatedField<int32_t>>(msg, data.offset()); @@ -1110,10 +1264,10 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedEnum( ptr += sizeof(TagType); uint64_t tmp; ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE( + if (ABSL_PREDICT_FALSE( !EnumIsValidAux(static_cast<int32_t>(tmp), xform_val, aux))) { // We can avoid duplicate work in MiniParse by directly calling // table->fallback. @@ -1121,7 +1275,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedEnum( PROTOBUF_MUSTTAIL return FastUnknownEnumFallback(PROTOBUF_TC_PARAM_PASS); } field.Add(static_cast<int32_t>(tmp)); - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); } } while (UnalignedLoad<TagType>(ptr) == expected_tag); @@ -1148,9 +1302,9 @@ PROTOBUF_NOINLINE void TcParser::AddUnknownEnum(MessageLite* msg, } template <typename TagType, uint16_t xform_val> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedEnum( +PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedEnum( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } const auto saved_tag = UnalignedLoad<TagType>(ptr); @@ -1205,14 +1359,14 @@ PROTOBUF_NOINLINE const char* TcParser::FastEvP2(PROTOBUF_TC_PARAM_DECL) { } template <typename TagType, uint8_t min> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularEnumSmallRange( +PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularEnumSmallRange( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } uint8_t v = ptr[sizeof(TagType)]; - if (PROTOBUF_PREDICT_FALSE(min > v || v > data.aux_idx())) { + if (ABSL_PREDICT_FALSE(min > v || v > data.aux_idx())) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } @@ -1243,9 +1397,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastEr1S2(PROTOBUF_TC_PARAM_DECL) { } template <typename TagType, uint8_t min> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedEnumSmallRange( +PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedEnumSmallRange( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } auto& field = RefAt<RepeatedField<int32_t>>(msg, data.offset()); @@ -1253,12 +1407,12 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedEnumSmallRange( const uint8_t max = data.aux_idx(); do { uint8_t v = ptr[sizeof(TagType)]; - if (PROTOBUF_PREDICT_FALSE(min > v || v > max)) { + if (ABSL_PREDICT_FALSE(min > v || v > max)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } field.Add(static_cast<int32_t>(v)); ptr += sizeof(TagType) + 1; - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); } } while (UnalignedLoad<TagType>(ptr) == expected_tag); @@ -1285,9 +1439,9 @@ PROTOBUF_NOINLINE const char* TcParser::FastEr1R2(PROTOBUF_TC_PARAM_DECL) { } template <typename TagType, uint8_t min> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedEnumSmallRange( +PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedEnumSmallRange( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } @@ -1303,7 +1457,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::PackedEnumSmallRange( return ctx->ReadPackedVarint( ptr, [=](int32_t v) { - if (PROTOBUF_PREDICT_FALSE(min > v || v > max)) { + if (ABSL_PREDICT_FALSE(min > v || v > max)) { AddUnknownEnum(msg, table, FastDecodeTag(saved_tag), v); } else { field->Add(v); @@ -1375,7 +1529,7 @@ namespace { // Here are overloads of ReadStringIntoArena, ReadStringNoArena and IsValidUTF8 // for every string class for which we provide fast-table parser support. -PROTOBUF_ALWAYS_INLINE inline const char* ReadStringIntoArena( +PROTOBUF_ALWAYS_INLINE const char* ReadStringIntoArena( MessageLite* /*msg*/, const char* ptr, ParseContext* ctx, uint32_t /*aux_idx*/, const TcParseTableBase* /*table*/, ArenaStringPtr& field, Arena* arena) { @@ -1392,17 +1546,30 @@ const char* ReadStringNoArena(MessageLite* /*msg*/, const char* ptr, return ctx->ReadString(ptr, size, field.MutableNoCopy(nullptr)); } -PROTOBUF_ALWAYS_INLINE inline bool IsValidUTF8(ArenaStringPtr& field) { +PROTOBUF_ALWAYS_INLINE bool IsValidUTF8(ArenaStringPtr& field) { return utf8_range::IsStructurallyValid(field.Get()); } +void EnsureArenaStringIsNotDefault(const MessageLite* msg, + ArenaStringPtr* field) { + // If we failed here we might have left the string in its IsDefault state, but + // already set the has bit which breaks the message invariants. We must make + // it consistent again. We do that by guaranteeing the string always exists. + if (field->IsDefault()) { + field->Set("", msg->GetArena()); + } +} +// The rest do nothing. +[[maybe_unused]] void EnsureArenaStringIsNotDefault(const MessageLite* msg, + void*) {} + } // namespace template <typename TagType, typename FieldType, TcParser::Utf8Type utf8> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularString( +PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularString( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } auto saved_tag = UnalignedLoad<TagType>(ptr); @@ -1416,7 +1583,8 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularString( } else { ptr = ReadStringNoArena(msg, ptr, ctx, data.aux_idx(), table, field); } - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { + EnsureArenaStringIsNotDefault(msg, &field); PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } switch (utf8) { @@ -1426,7 +1594,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::SingularString( #endif break; default: - if (PROTOBUF_PREDICT_TRUE(IsValidUTF8(field))) { + if (ABSL_PREDICT_TRUE(IsValidUTF8(field))) { break; } ReportFastUtf8Error(FastDecodeTag(saved_tag), table); @@ -1508,9 +1676,9 @@ const char* TcParser::FastUcS2(PROTOBUF_TC_PARAM_DECL) { } template <typename TagType, typename FieldType, TcParser::Utf8Type utf8> -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedString( +PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedString( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + if (ABSL_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } const auto expected_tag = UnalignedLoad<TagType>(ptr); @@ -1524,7 +1692,7 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedString( #endif return true; default: - if (PROTOBUF_PREDICT_TRUE( + if (ABSL_PREDICT_TRUE( utf8_range::IsStructurallyValid(field[field.size() - 1]))) { return true; } @@ -1536,27 +1704,27 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedString( auto* arena = field.GetArena(); SerialArena* serial_arena; - if (PROTOBUF_PREDICT_TRUE(arena != nullptr && - arena->impl_.GetSerialArenaFast(&serial_arena) && - field.PrepareForParse())) { + if (ABSL_PREDICT_TRUE(arena != nullptr && + arena->impl_.GetSerialArenaFast(&serial_arena) && + field.PrepareForParse())) { do { ptr += sizeof(TagType); ptr = ParseRepeatedStringOnce(ptr, serial_arena, ctx, field); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr || !validate_last_string())) { + if (ABSL_PREDICT_FALSE(ptr == nullptr || !validate_last_string())) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; } while (UnalignedLoad<TagType>(ptr) == expected_tag); } else { do { ptr += sizeof(TagType); std::string* str = field.Add(); ptr = InlineGreedyStringParser(str, ptr, ctx); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr || !validate_last_string())) { + if (ABSL_PREDICT_FALSE(ptr == nullptr || !validate_last_string())) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; } while (UnalignedLoad<TagType>(ptr) == expected_tag); } PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); @@ -1598,6 +1766,8 @@ PROTOBUF_NOINLINE const char* TcParser::FastUR2(PROTOBUF_TC_PARAM_DECL) { ////////////////////////////////////////////////////////////////////////////// namespace { +// TODO: revisit the use of inline assembly and consider +// benchmarking as bts isn't short latency either. inline void SetHas(const FieldEntry& entry, MessageLite* msg) { auto has_idx = static_cast<uint32_t>(entry.has_idx); #if defined(__x86_64__) && defined(__GNUC__) @@ -1773,9 +1943,9 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedFixed( ptr = ptr2; *field.Add() = UnalignedLoad<uint64_t>(ptr); ptr += size; - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); - if (PROTOBUF_PREDICT_FALSE(ptr2 == nullptr)) goto error; + if (ABSL_PREDICT_FALSE(ptr2 == nullptr)) goto error; } while (next_tag == decoded_tag); } else { ABSL_DCHECK_EQ(rep, static_cast<uint16_t>(field_layout::kRep32Bits)); @@ -1791,9 +1961,9 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedFixed( ptr = ptr2; *field.Add() = UnalignedLoad<uint32_t>(ptr); ptr += size; - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); - if (PROTOBUF_PREDICT_FALSE(ptr2 == nullptr)) goto error; + if (ABSL_PREDICT_FALSE(ptr2 == nullptr)) goto error; } while (next_tag == decoded_tag); } @@ -1829,7 +1999,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpPackedFixed(PROTOBUF_TC_PARAM_DECL) { ptr = ctx->ReadPackedFixed(ptr, size, &field); } - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); @@ -1925,7 +2095,7 @@ const char* TcParser::MpRepeatedVarintT(PROTOBUF_TC_PARAM_DECL) { do { uint64_t tmp; ptr = ParseVarint(ptr2, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) goto error; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) goto error; if (is_validated_enum) { if (!EnumIsValidAux(static_cast<int32_t>(tmp), xform_val, aux)) { ptr = ptr2; @@ -1936,9 +2106,9 @@ const char* TcParser::MpRepeatedVarintT(PROTOBUF_TC_PARAM_DECL) { : WireFormatLite::ZigZagDecode32(tmp); } field.Add(static_cast<FieldType>(tmp)); - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); - if (PROTOBUF_PREDICT_FALSE(ptr2 == nullptr)) goto error; + if (ABSL_PREDICT_FALSE(ptr2 == nullptr)) goto error; } while (next_tag == decoded_tag); parse_loop: @@ -2174,7 +2344,10 @@ PROTOBUF_NOINLINE const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) { std::string* str = field.MutableNoCopy(nullptr); ptr = InlineGreedyStringParser(str, ptr, ctx); } - if (!ptr) break; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { + EnsureArenaStringIsNotDefault(msg, &field); + break; + } is_valid = MpVerifyUtf8(field.Get(), table, entry, xform_val); break; } @@ -2202,21 +2375,21 @@ PROTOBUF_NOINLINE const char* TcParser::MpString(PROTOBUF_TC_PARAM_DECL) { Unreachable(); } - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr || !is_valid)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr || !is_valid)) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); } -inline PROTOBUF_ALWAYS_INLINE const char* TcParser::ParseRepeatedStringOnce( +PROTOBUF_ALWAYS_INLINE const char* TcParser::ParseRepeatedStringOnce( const char* ptr, SerialArena* serial_arena, ParseContext* ctx, RepeatedPtrField<std::string>& field) { int size = ReadSize(&ptr); - if (PROTOBUF_PREDICT_FALSE(!ptr)) return {}; + if (ABSL_PREDICT_FALSE(!ptr)) return {}; auto* str = new (serial_arena->AllocateFromStringBlock()) std::string(); field.AddAllocatedForParse(str); ptr = ctx->ReadString(ptr, size, str); - if (PROTOBUF_PREDICT_FALSE(!ptr)) return {}; + if (ABSL_PREDICT_FALSE(!ptr)) return {}; PROTOBUF_ASSUME(ptr != nullptr); return ptr; } @@ -2245,19 +2418,18 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedString( auto* arena = field.GetArena(); SerialArena* serial_arena; - if (PROTOBUF_PREDICT_TRUE( - arena != nullptr && - arena->impl_.GetSerialArenaFast(&serial_arena) && - field.PrepareForParse())) { + if (ABSL_PREDICT_TRUE(arena != nullptr && + arena->impl_.GetSerialArenaFast(&serial_arena) && + field.PrepareForParse())) { do { ptr = ptr2; ptr = ParseRepeatedStringOnce(ptr, serial_arena, ctx, field); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr || - !MpVerifyUtf8(field[field.size() - 1], - table, entry, xform_val))) { + if (ABSL_PREDICT_FALSE(ptr == nullptr || + !MpVerifyUtf8(field[field.size() - 1], table, + entry, xform_val))) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); } while (next_tag == decoded_tag); } else { @@ -2265,12 +2437,12 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedString( ptr = ptr2; std::string* str = field.Add(); ptr = InlineGreedyStringParser(str, ptr, ctx); - if (PROTOBUF_PREDICT_FALSE( + if (ABSL_PREDICT_FALSE( ptr == nullptr || !MpVerifyUtf8(*str, table, entry, xform_val))) { PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); } while (next_tag == decoded_tag); } @@ -2412,10 +2584,10 @@ const char* TcParser::MpRepeatedMessageOrGroup(PROTOBUF_TC_PARAM_DECL) { }; ptr = is_group ? ctx->ParseGroupInlined(ptr2, decoded_tag, inner_loop) : ctx->ParseLengthDelimitedInlined(ptr2, inner_loop); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) goto error; - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) goto error; + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); - if (PROTOBUF_PREDICT_FALSE(ptr2 == nullptr)) goto error; + if (ABSL_PREDICT_FALSE(ptr2 == nullptr)) goto error; } while (next_tag == decoded_tag); PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); parse_loop: @@ -2424,63 +2596,49 @@ error: PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } -static void SerializeMapKey(const NodeBase* node, MapTypeCard type_card, +static void SerializeMapKey(UntypedMapBase& map, NodeBase* node, + MapTypeCard type_card, io::CodedOutputStream& coded_output) { switch (type_card.wiretype()) { case WireFormatLite::WIRETYPE_VARINT: - switch (type_card.cpp_type()) { - case MapTypeCard::kBool: - WireFormatLite::WriteBool( - 1, static_cast<const KeyNode<bool>*>(node)->key(), &coded_output); - break; - case MapTypeCard::k32: - if (type_card.is_zigzag()) { - WireFormatLite::WriteSInt32( - 1, static_cast<const KeyNode<uint32_t>*>(node)->key(), - &coded_output); - } else if (type_card.is_signed()) { - WireFormatLite::WriteInt32( - 1, static_cast<const KeyNode<uint32_t>*>(node)->key(), - &coded_output); - } else { - WireFormatLite::WriteUInt32( - 1, static_cast<const KeyNode<uint32_t>*>(node)->key(), - &coded_output); - } - break; - case MapTypeCard::k64: - if (type_card.is_zigzag()) { - WireFormatLite::WriteSInt64( - 1, static_cast<const KeyNode<uint64_t>*>(node)->key(), - &coded_output); - } else if (type_card.is_signed()) { - WireFormatLite::WriteInt64( - 1, static_cast<const KeyNode<uint64_t>*>(node)->key(), - &coded_output); - } else { - WireFormatLite::WriteUInt64( - 1, static_cast<const KeyNode<uint64_t>*>(node)->key(), - &coded_output); - } - break; - default: - Unreachable(); - } + map.VisitKey(node, // + absl::Overload{ + [&](const bool* v) { + WireFormatLite::WriteBool(1, *v, &coded_output); + }, + [&](const uint32_t* v) { + if (type_card.is_zigzag()) { + WireFormatLite::WriteSInt32(1, *v, &coded_output); + } else if (type_card.is_signed()) { + WireFormatLite::WriteInt32(1, *v, &coded_output); + } else { + WireFormatLite::WriteUInt32(1, *v, &coded_output); + } + }, + [&](const uint64_t* v) { + if (type_card.is_zigzag()) { + WireFormatLite::WriteSInt64(1, *v, &coded_output); + } else if (type_card.is_signed()) { + WireFormatLite::WriteInt64(1, *v, &coded_output); + } else { + WireFormatLite::WriteUInt64(1, *v, &coded_output); + } + }, + [](const void*) { Unreachable(); }, + }); break; case WireFormatLite::WIRETYPE_FIXED32: - WireFormatLite::WriteFixed32( - 1, static_cast<const KeyNode<uint32_t>*>(node)->key(), &coded_output); + WireFormatLite::WriteFixed32(1, *map.GetKey<uint32_t>(node), + &coded_output); break; case WireFormatLite::WIRETYPE_FIXED64: - WireFormatLite::WriteFixed64( - 1, static_cast<const KeyNode<uint64_t>*>(node)->key(), &coded_output); + WireFormatLite::WriteFixed64(1, *map.GetKey<uint64_t>(node), + &coded_output); break; case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: // We should never have a message here. They can only be values maps. - ABSL_DCHECK_EQ(+type_card.cpp_type(), +MapTypeCard::kString); - WireFormatLite::WriteString( - 1, static_cast<const KeyNode<std::string>*>(node)->key(), - &coded_output); + WireFormatLite::WriteString(1, *map.GetKey<std::string>(node), + &coded_output); break; default: Unreachable(); @@ -2489,65 +2647,24 @@ static void SerializeMapKey(const NodeBase* node, MapTypeCard type_card, void TcParser::WriteMapEntryAsUnknown(MessageLite* msg, const TcParseTableBase* table, - uint32_t tag, NodeBase* node, - MapAuxInfo map_info) { + UntypedMapBase& map, uint32_t tag, + NodeBase* node, MapAuxInfo map_info) { std::string serialized; { io::StringOutputStream string_output(&serialized); io::CodedOutputStream coded_output(&string_output); - SerializeMapKey(node, map_info.key_type_card, coded_output); + SerializeMapKey(map, node, map_info.key_type_card, coded_output); // The mapped_type is always an enum here. ABSL_DCHECK(map_info.value_is_validated_enum); - WireFormatLite::WriteInt32(2, - *reinterpret_cast<int32_t*>( - node->GetVoidValue(map_info.node_size_info)), - &coded_output); + WireFormatLite::WriteInt32(2, *map.GetValue<int32_t>(node), &coded_output); } GetUnknownFieldOps(table).write_length_delimited(msg, tag >> 3, serialized); -} -PROTOBUF_ALWAYS_INLINE inline void TcParser::InitializeMapNodeEntry( - void* obj, MapTypeCard type_card, UntypedMapBase& map, - const TcParseTableBase::FieldAux* aux, bool is_key) { - (void)is_key; - switch (type_card.cpp_type()) { - case MapTypeCard::kBool: - memset(obj, 0, sizeof(bool)); - break; - case MapTypeCard::k32: - memset(obj, 0, sizeof(uint32_t)); - break; - case MapTypeCard::k64: - memset(obj, 0, sizeof(uint64_t)); - break; - case MapTypeCard::kString: - Arena::CreateInArenaStorage(reinterpret_cast<std::string*>(obj), - map.arena()); - break; - case MapTypeCard::kMessage: - aux[1].table->class_data->PlacementNew(obj, map.arena()); - break; - default: - Unreachable(); + if (map.arena() == nullptr) { + map.DeleteNode(node); } } -PROTOBUF_NOINLINE void TcParser::DestroyMapNode(NodeBase* node, - MapAuxInfo map_info, - UntypedMapBase& map) { - if (map_info.key_type_card.cpp_type() == MapTypeCard::kString) { - static_cast<std::string*>(node->GetVoidKey())->~basic_string(); - } - if (map_info.value_type_card.cpp_type() == MapTypeCard::kString) { - static_cast<std::string*>(node->GetVoidValue(map_info.node_size_info)) - ->~basic_string(); - } else if (map_info.value_type_card.cpp_type() == MapTypeCard::kMessage) { - static_cast<MessageLite*>(node->GetVoidValue(map_info.node_size_info)) - ->DestroyInstance(); - } - map.DeallocNode(node, map_info.node_size_info); -} - template <typename T> const char* ReadFixed(void* obj, const char* ptr) { auto v = UnalignedLoad<T>(ptr); @@ -2559,25 +2676,22 @@ const char* ReadFixed(void* obj, const char* ptr) { const char* TcParser::ParseOneMapEntry( NodeBase* node, const char* ptr, ParseContext* ctx, const TcParseTableBase::FieldAux* aux, const TcParseTableBase* table, - const TcParseTableBase::FieldEntry& entry, Arena* arena) { + const TcParseTableBase::FieldEntry& entry, UntypedMapBase& map) { using WFL = WireFormatLite; const auto map_info = aux[0].map_info; - const uint8_t key_tag = WFL::MakeTag(1, map_info.key_type_card.wiretype()); - const uint8_t value_tag = - WFL::MakeTag(2, map_info.value_type_card.wiretype()); + const uint8_t key_tag = map_info.key_type_card.tag(); + const uint8_t value_tag = map_info.value_type_card.tag(); while (!ctx->Done(&ptr)) { uint32_t inner_tag = ptr[0]; - if (PROTOBUF_PREDICT_FALSE(inner_tag != key_tag && - inner_tag != value_tag)) { + if (ABSL_PREDICT_FALSE(inner_tag != key_tag && inner_tag != value_tag)) { // Do a full parse and check again in case the tag has non-canonical // encoding. ptr = ReadTag(ptr, &inner_tag); - if (PROTOBUF_PREDICT_FALSE(inner_tag != key_tag && - inner_tag != value_tag)) { - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(inner_tag != key_tag && inner_tag != value_tag)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; if (inner_tag == 0 || (inner_tag & 7) == WFL::WIRETYPE_END_GROUP) { ctx->SetLastTag(inner_tag); @@ -2585,7 +2699,7 @@ const char* TcParser::ParseOneMapEntry( } ptr = UnknownFieldParse(inner_tag, nullptr, ptr, ctx); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; continue; } } else { @@ -2593,31 +2707,34 @@ const char* TcParser::ParseOneMapEntry( } MapTypeCard type_card; + UntypedMapBase::TypeKind type_kind; void* obj; if (inner_tag == key_tag) { type_card = map_info.key_type_card; + type_kind = map.type_info().key_type_kind(); obj = node->GetVoidKey(); } else { type_card = map_info.value_type_card; - obj = node->GetVoidValue(map_info.node_size_info); + type_kind = map.type_info().value_type_kind(); + obj = map.GetVoidValue(node); } - switch (type_card.wiretype()) { + switch (inner_tag & 7) { case WFL::WIRETYPE_VARINT: uint64_t tmp; ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; - switch (type_card.cpp_type()) { - case MapTypeCard::kBool: + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; + switch (type_kind) { + case UntypedMapBase::TypeKind::kBool: *reinterpret_cast<bool*>(obj) = static_cast<bool>(tmp); continue; - case MapTypeCard::k32: { + case UntypedMapBase::TypeKind::kU32: { uint32_t v = static_cast<uint32_t>(tmp); if (type_card.is_zigzag()) v = WFL::ZigZagDecode32(v); memcpy(obj, &v, sizeof(v)); continue; } - case MapTypeCard::k64: + case UntypedMapBase::TypeKind::kU64: if (type_card.is_zigzag()) tmp = WFL::ZigZagDecode64(tmp); memcpy(obj, &tmp, sizeof(tmp)); continue; @@ -2631,12 +2748,12 @@ const char* TcParser::ParseOneMapEntry( ptr = ReadFixed<uint64_t>(obj, ptr); continue; case WFL::WIRETYPE_LENGTH_DELIMITED: - if (type_card.cpp_type() == MapTypeCard::kString) { + if (type_kind == UntypedMapBase::TypeKind::kString) { const int size = ReadSize(&ptr); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; std::string* str = reinterpret_cast<std::string*>(obj); ptr = ctx->ReadString(ptr, size, str); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; bool do_utf8_check = map_info.fail_on_utf8_failure; #ifndef NDEBUG do_utf8_check |= map_info.log_debug_utf8_failure; @@ -2651,10 +2768,11 @@ const char* TcParser::ParseOneMapEntry( } continue; } else { - ABSL_DCHECK_EQ(+type_card.cpp_type(), +MapTypeCard::kMessage); + ABSL_DCHECK_EQ(static_cast<int>(type_kind), + static_cast<int>(UntypedMapBase::TypeKind::kMessage)); ABSL_DCHECK_EQ(inner_tag, value_tag); ptr = ctx->ParseMessage(reinterpret_cast<MessageLite*>(obj), ptr); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; continue; } default: @@ -2674,9 +2792,9 @@ PROTOBUF_NOINLINE const char* TcParser::MpMap(PROTOBUF_TC_PARAM_DECL) { const auto* aux = table->field_aux(&entry); const auto map_info = aux[0].map_info; - if (PROTOBUF_PREDICT_FALSE(!map_info.is_supported || - (data.tag() & 7) != - WireFormatLite::WIRETYPE_LENGTH_DELIMITED)) { + if (ABSL_PREDICT_FALSE(!map_info.is_supported || + (data.tag() & 7) != + WireFormatLite::WIRETYPE_LENGTH_DELIMITED)) { PROTOBUF_MUSTTAIL return MpFallback(PROTOBUF_TC_PARAM_PASS); } @@ -2693,63 +2811,82 @@ PROTOBUF_NOINLINE const char* TcParser::MpMap(PROTOBUF_TC_PARAM_DECL) { const uint32_t saved_tag = data.tag(); while (true) { - NodeBase* node = map.AllocNode(map_info.node_size_info); + NodeBase* node = map.AllocNode(); + char* const node_end = + reinterpret_cast<char*>(node) + map.type_info().node_size; + void* const node_key = node->GetVoidKey(); - InitializeMapNodeEntry(node->GetVoidKey(), map_info.key_type_card, map, aux, - true); - InitializeMapNodeEntry(node->GetVoidValue(map_info.node_size_info), - map_info.value_type_card, map, aux, false); + // Due to node alignment we can guarantee that we have at least 8 writable + // bytes from the key position to the end of the node. + // We can initialize the first and last 8 bytes, which takes care of all the + // scalar value types. This makes the VisitXXX calls below faster because + // the switch is much smaller. + // Assert this in debug mode, just in case. + ABSL_DCHECK_GE(node_end - static_cast<char*>(node_key), sizeof(uint64_t)); + memset(node_key, 0, sizeof(uint64_t)); + memset(node_end - sizeof(uint64_t), 0, sizeof(uint64_t)); + + map.VisitKey( // + node, absl::Overload{ + [&](std::string* str) { + Arena::CreateInArenaStorage(str, map.arena()); + }, + // Already initialized above. Do nothing here. + [](void*) {}, + }); + + map.VisitValue( // + node, absl::Overload{ + [&](std::string* str) { + Arena::CreateInArenaStorage(str, map.arena()); + }, + [&](MessageLite* msg) { + aux[1].table->class_data->PlacementNew(msg, map.arena()); + }, + // Already initialized above. Do nothing here. + [](void*) {}, + }); ptr = ctx->ParseLengthDelimitedInlined(ptr, [&](const char* ptr) { - return ParseOneMapEntry(node, ptr, ctx, aux, table, entry, map.arena()); + return ParseOneMapEntry(node, ptr, ctx, aux, table, entry, map); }); - if (PROTOBUF_PREDICT_TRUE(ptr != nullptr)) { - if (PROTOBUF_PREDICT_FALSE(map_info.value_is_validated_enum && - !internal::ValidateEnumInlined( - *static_cast<int32_t*>(node->GetVoidValue( - map_info.node_size_info)), - aux[1].enum_data))) { - WriteMapEntryAsUnknown(msg, table, saved_tag, node, map_info); - } else { - // Done parsing the node, try to insert it. - // If it overwrites something we get old node back to destroy it. - switch (map_info.key_type_card.cpp_type()) { - case MapTypeCard::kBool: - node = static_cast<KeyMapBase<bool>&>(map).InsertOrReplaceNode( - static_cast<KeyMapBase<bool>::KeyNode*>(node)); - break; - case MapTypeCard::k32: - node = static_cast<KeyMapBase<uint32_t>&>(map).InsertOrReplaceNode( - static_cast<KeyMapBase<uint32_t>::KeyNode*>(node)); - break; - case MapTypeCard::k64: - node = static_cast<KeyMapBase<uint64_t>&>(map).InsertOrReplaceNode( - static_cast<KeyMapBase<uint64_t>::KeyNode*>(node)); - break; - case MapTypeCard::kString: - node = - static_cast<KeyMapBase<std::string>&>(map).InsertOrReplaceNode( - static_cast<KeyMapBase<std::string>::KeyNode*>(node)); - break; - default: - Unreachable(); - } - } - } - - // Destroy the node if we have it. - // It could be because we failed to parse, or because insertion returned - // an overwritten node. - if (PROTOBUF_PREDICT_FALSE(node != nullptr && map.arena() == nullptr)) { - DestroyMapNode(node, map_info, map); - } - - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + if (ABSL_PREDICT_FALSE(ptr == nullptr)) { + // Parsing failed. Delete the node that we didn't insert. + if (map.arena() == nullptr) map.DeleteNode(node); PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + if (ABSL_PREDICT_FALSE( + map_info.value_is_validated_enum && + !internal::ValidateEnumInlined(*map.GetValue<int32_t>(node), + aux[1].enum_data))) { + WriteMapEntryAsUnknown(msg, table, map, saved_tag, node, map_info); + } else { + // Done parsing the node, insert it. + switch (map.type_info().key_type_kind()) { + case UntypedMapBase::TypeKind::kBool: + static_cast<KeyMapBase<bool>&>(map).InsertOrReplaceNode( + static_cast<KeyMapBase<bool>::KeyNode*>(node)); + break; + case UntypedMapBase::TypeKind::kU32: + static_cast<KeyMapBase<uint32_t>&>(map).InsertOrReplaceNode( + static_cast<KeyMapBase<uint32_t>::KeyNode*>(node)); + break; + case UntypedMapBase::TypeKind::kU64: + static_cast<KeyMapBase<uint64_t>&>(map).InsertOrReplaceNode( + static_cast<KeyMapBase<uint64_t>::KeyNode*>(node)); + break; + case UntypedMapBase::TypeKind::kString: + static_cast<KeyMapBase<std::string>&>(map).InsertOrReplaceNode( + static_cast<KeyMapBase<std::string>::KeyNode*>(node)); + break; + default: + Unreachable(); + } + } + + if (ABSL_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); } diff --git a/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite_test.cc b/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite_test.cc index 136973f63a5b8..7223f9c6c58ab 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite_test.cc +++ b/third_party/protobuf/src/google/protobuf/generated_message_tctable_lite_test.cc @@ -11,15 +11,21 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include "absl/algorithm/container.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/descriptor_database.h" +#include "google/protobuf/descriptor_visitor.h" #include "google/protobuf/generated_message_tctable_decl.h" #include "google/protobuf/generated_message_tctable_impl.h" #include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/message_lite.h" #include "google/protobuf/parse_context.h" +#include "google/protobuf/port.h" #include "google/protobuf/unittest.pb.h" #include "google/protobuf/wire_format_lite.h" @@ -333,6 +339,10 @@ class FindFieldEntryTest : public ::testing::Test { return TcParser::FieldName(&table.header, entry); } + static int FieldNumber(const TcParseTableBase* table, size_t index) { + return TcParser::FieldNumber(table, table->field_entries_begin() + index); + } + // Calls the private `MessageName` function. template <size_t kFastTableSizeLog2, size_t kNumEntries, size_t kNumFieldAux, size_t kNameTableSize, size_t kFieldLookupTableSize> @@ -346,6 +356,36 @@ class FindFieldEntryTest : public ::testing::Test { static constexpr int small_scan_size() { return TcParser::kMtSmallScanSize; } }; +TEST_F(FindFieldEntryTest, FieldNumberWorksForAllFields) { + // Look at all types registered in the binary and verify that field number + // calculation works for all the fields. + auto* gen_db = DescriptorPool::internal_generated_database(); + std::vector<std::string> all_file_names; + gen_db->FindAllFileNames(&all_file_names); + + for (const auto& filename : all_file_names) { + SCOPED_TRACE(filename); + const auto* file = + DescriptorPool::generated_pool()->FindFileByName(filename); + VisitDescriptors(*file, [&](const Descriptor& desc) { + SCOPED_TRACE(desc.full_name()); + const auto* prototype = + MessageFactory::generated_factory()->GetPrototype(&desc); + const auto* tc_table = internal::GetClassData(*prototype)->tc_table; + + std::vector<int> sorted_field_numbers; + for (auto* field : internal::FieldRange(&desc)) { + sorted_field_numbers.push_back(field->number()); + } + absl::c_sort(sorted_field_numbers); + + for (int i = 0; i < desc.field_count(); ++i) { + EXPECT_EQ(FieldNumber(tc_table, i), sorted_field_numbers[i]); + } + }); + } +} + TEST_F(FindFieldEntryTest, SequentialFieldRange) { // Look up fields that are within the range of `lookup_table_offset`. // clang-format off @@ -851,12 +891,12 @@ TEST(GeneratedMessageTctableLiteTest, PackedEnumSmallRange) { // implementation of Reserve() -- Reserve(kNumVals) always results in a // different final capacity than you'd get by adding elements one at a time. constexpr int kNumVals = 1023; - protobuf_unittest::TestPackedEnumSmallRange proto; + proto2_unittest::TestPackedEnumSmallRange proto; for (int i = 0; i < kNumVals; i++) { - proto.add_vals(protobuf_unittest::TestPackedEnumSmallRange::FOO); + proto.add_vals(proto2_unittest::TestPackedEnumSmallRange::FOO); } - protobuf_unittest::TestPackedEnumSmallRange new_proto; + proto2_unittest::TestPackedEnumSmallRange new_proto; new_proto.ParseFromString(proto.SerializeAsString()); // We should have reserved exactly the right size for new_proto's `vals`, @@ -865,7 +905,7 @@ TEST(GeneratedMessageTctableLiteTest, PackedEnumSmallRange) { // Check that new_proto's capacity is equal to exactly what we'd get from // calling Reserve(n). - protobuf_unittest::TestPackedEnumSmallRange empty_proto; + proto2_unittest::TestPackedEnumSmallRange empty_proto; empty_proto.mutable_vals()->Reserve(kNumVals); EXPECT_EQ(new_proto.vals().Capacity(), empty_proto.vals().Capacity()); } @@ -877,10 +917,10 @@ TEST(GeneratedMessageTctableLiteTest, PackedEnumSmallRange) { // This test checks that the parser doesn't overflow an int32 when computing the // array's new length. TEST(GeneratedMessageTctableLiteTest, PackedEnumSmallRangeLargeSize) { -#ifdef PROTOBUF_MSAN - // This test attempts to allocate 8GB of memory, which OOMs MSAN. - return; -#endif + if constexpr (internal::HasAnySanitizer()) { + GTEST_SKIP() << "This test attempts to allocate 8GB of memory, which OOMs " + "in sanitizer mode."; + } #ifdef _WIN32 // This test OOMs on Windows. I think this is because Windows is committing @@ -913,11 +953,11 @@ TEST(GeneratedMessageTctableLiteTest, PackedEnumSmallRangeLargeSize) { // This isn't a legal proto because the given array length (a little less than // 2^31) doesn't match the actual array length (0). But all we're checking // for here is that we don't have UB when deserializing. - protobuf_unittest::TestPackedEnumSmallRange proto; + proto2_unittest::TestPackedEnumSmallRange proto; // Add a few elements to the proto so that when we MergeFromString, the final // array length is greater than INT32_MAX. for (int i = 0; i < 128; i++) { - proto.add_vals(protobuf_unittest::TestPackedEnumSmallRange::FOO); + proto.add_vals(proto2_unittest::TestPackedEnumSmallRange::FOO); } EXPECT_FALSE(proto.MergeFromString(serialized)); } @@ -940,7 +980,7 @@ TEST(GeneratedMessageTctableLiteTest, // The deserialized proto should reserve much less than 2^20 elements for // field 1, because it notices that the input serialized proto is much smaller // than 2^20 bytes. - protobuf_unittest::TestPackedEnumSmallRange proto; + proto2_unittest::TestPackedEnumSmallRange proto; proto.MergeFromString(serialized); EXPECT_LE(proto.vals().Capacity(), 2048); } diff --git a/third_party/protobuf/src/google/protobuf/generated_message_util.cc b/third_party/protobuf/src/google/protobuf/generated_message_util.cc index bdfc5518d8d50..9457a859eb8c1 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_util.cc +++ b/third_party/protobuf/src/google/protobuf/generated_message_util.cc @@ -42,10 +42,6 @@ void DestroyString(const void* s) { static_cast<const std::string*>(s)->~basic_string(); } -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ExplicitlyConstructedArenaString - fixed_address_empty_string{}; // NOLINT - PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT const EmptyCord empty_cord_; @@ -89,7 +85,7 @@ void InitWeakDefaults() {} PROTOBUF_CONSTINIT bool init_protobuf_defaults_state{false}; void InitProtobufDefaultsSlow() { - fixed_address_empty_string.DefaultConstruct(); + fixed_address_empty_string.Init(); init_protobuf_defaults_state = true; InitWeakDefaults(); } diff --git a/third_party/protobuf/src/google/protobuf/generated_message_util.h b/third_party/protobuf/src/google/protobuf/generated_message_util.h index 74a0ef6b5b0b5..f7e29d6028ebc 100644 --- a/third_party/protobuf/src/google/protobuf/generated_message_util.h +++ b/third_party/protobuf/src/google/protobuf/generated_message_util.h @@ -31,6 +31,7 @@ #include "google/protobuf/stubs/common.h" #include "absl/base/call_once.h" #include "absl/base/casts.h" +#include "absl/base/optimization.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "google/protobuf/any.h" @@ -73,7 +74,7 @@ PROTOBUF_EXPORT inline void InitProtobufDefaults() { // as there are no calls to this function from off the main thread, before // main() starts, this is safe. After main() starts, // init_protobuf_defaults_state will always be true. - if (PROTOBUF_PREDICT_FALSE(!init_protobuf_defaults_state)) { + if (ABSL_PREDICT_FALSE(!init_protobuf_defaults_state)) { InitProtobufDefaultsSlow(); } } diff --git a/third_party/protobuf/src/google/protobuf/implicit_weak_message.h b/third_party/protobuf/src/google/protobuf/implicit_weak_message.h index 2b9203d878f1d..de3444ac02719 100644 --- a/third_party/protobuf/src/google/protobuf/implicit_weak_message.h +++ b/third_party/protobuf/src/google/protobuf/implicit_weak_message.h @@ -47,13 +47,10 @@ class PROTOBUF_EXPORT ImplicitWeakMessage final : public MessageLite { // TODO: make this constructor private explicit ImplicitWeakMessage(Arena* arena) - : MessageLite(arena, class_data_.base()), data_(new std::string) {} + : MessageLite(arena, class_data_.base()), + data_(Arena::Create<std::string>(arena)) {} - ~ImplicitWeakMessage() PROTOBUF_FINAL { - // data_ will be null in the default instance, but we can safely call delete - // here because the default instance will never be destroyed. - delete data_; - } + ~ImplicitWeakMessage() PROTOBUF_FINAL { delete data_; } static const ImplicitWeakMessage& default_instance(); @@ -76,7 +73,8 @@ class PROTOBUF_EXPORT ImplicitWeakMessage final : public MessageLite { target); } - typedef void InternalArenaConstructable_; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; static PROTOBUF_CC const char* ParseImpl(ImplicitWeakMessage* msg, const char* ptr, ParseContext* ctx); diff --git a/third_party/protobuf/src/google/protobuf/inlined_string_field.h b/third_party/protobuf/src/google/protobuf/inlined_string_field.h index 25c7a7a573877..ec40008fc5581 100644 --- a/third_party/protobuf/src/google/protobuf/inlined_string_field.h +++ b/third_party/protobuf/src/google/protobuf/inlined_string_field.h @@ -199,20 +199,20 @@ class PROTOBUF_EXPORT InlinedStringField { // 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_NODISCARD std::string* Release(Arena* arena, bool donated); - PROTOBUF_NODISCARD std::string* Release(); + [[nodiscard]] std::string* Release(Arena* arena, bool donated); + [[nodiscard]] std::string* Release(); // -------------------------------------------------------- // Below functions will be removed in subsequent code change // -------------------------------------------------------- #ifdef DEPRECATED_METHODS_TO_BE_DELETED - PROTOBUF_NODISCARD std::string* Release(const std::string*, Arena* arena, - bool donated) { + [[nodiscard]] std::string* Release(const std::string*, Arena* arena, + bool donated) { return Release(arena, donated); } - PROTOBUF_NODISCARD std::string* ReleaseNonDefault(const std::string*, - Arena* arena) { + [[nodiscard]] std::string* ReleaseNonDefault(const std::string*, + Arena* arena) { return Release(); } @@ -312,7 +312,7 @@ class PROTOBUF_EXPORT InlinedStringField { // Arena-safety semantics: this is guarded by the logic in // Swap()/UnsafeArenaSwap() at the message level, so this method is // 'unsafe' if called directly. - inline PROTOBUF_NDEBUG_INLINE static void InternalSwap( + PROTOBUF_NDEBUG_INLINE static void InternalSwap( InlinedStringField* lhs, bool lhs_arena_dtor_registered, MessageLite* lhs_msg, // InlinedStringField* rhs, bool rhs_arena_dtor_registered, @@ -436,7 +436,7 @@ inline void InlinedStringField::SetNoArena(std::string&& value) { get_mutable()->assign(std::move(value)); } -inline PROTOBUF_NDEBUG_INLINE void InlinedStringField::InternalSwap( +PROTOBUF_NDEBUG_INLINE void InlinedStringField::InternalSwap( InlinedStringField* lhs, bool lhs_arena_dtor_registered, MessageLite* lhs_msg, // InlinedStringField* rhs, bool rhs_arena_dtor_registered, diff --git a/third_party/protobuf/src/google/protobuf/io/BUILD.bazel b/third_party/protobuf/src/google/protobuf/io/BUILD.bazel index 192fec3ab1407..3a5f724e5a213 100644 --- a/third_party/protobuf/src/google/protobuf/io/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/io/BUILD.bazel @@ -30,15 +30,15 @@ cc_library( "//src/google/protobuf:endian", "//src/google/protobuf:port", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/base", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/numeric:bits", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:internal", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:internal", + "@abseil-cpp//absl/types:span", ], ) @@ -51,8 +51,8 @@ cc_library( deps = [ ":io", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/types:optional", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/types:optional", ], ) @@ -63,9 +63,9 @@ cc_test( deps = [ ":test_zero_copy_stream", "//src/google/protobuf/stubs", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -89,10 +89,10 @@ cc_test( deps = [ ":zero_copy_sink", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -103,22 +103,23 @@ cc_library( copts = COPTS, strip_include_prefix = "/src", deps = [ + ":io", ":zero_copy_sink", "//src/google/protobuf:port", "//src/google/protobuf/stubs", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/cleanup", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/functional:any_invocable", - "@com_google_absl//absl/functional:function_ref", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/meta:type_traits", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", - "@com_google_absl//absl/types:variant", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/cleanup", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/meta:type_traits", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", + "@abseil-cpp//absl/types:variant", ], ) @@ -138,10 +139,10 @@ cc_library( ":io", "//src/google/protobuf:port", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -149,14 +150,17 @@ cc_library( name = "gzip_stream", srcs = ["gzip_stream.cc"], hdrs = ["gzip_stream.h"], - copts = COPTS, + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": ["-DHAVE_ZLIB"], + }), strip_include_prefix = "/src", deps = [ ":io", "//src/google/protobuf:port", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", ] + select({ "//build_defs:config_msvc": [], "//conditions:default": ["@zlib"], @@ -178,7 +182,7 @@ cc_library( deps = [ "//src/google/protobuf:arena", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -191,7 +195,10 @@ cc_test( "tokenizer_unittest.cc", "zero_copy_stream_unittest.cc", ], - copts = COPTS, + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": ["-DHAVE_ZLIB"], + }), deps = [ ":gzip_stream", ":io", @@ -206,20 +213,21 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/base", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:log_severity", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:scoped_mock_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:cord", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:log_severity", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:scoped_mock_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:optional", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -232,8 +240,8 @@ cc_test( ], deps = [ "//:protobuf_lite", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/io/coded_stream.cc b/third_party/protobuf/src/google/protobuf/io/coded_stream.cc index 104e4307e6de5..c13e31fefcdf9 100644 --- a/third_party/protobuf/src/google/protobuf/io/coded_stream.cc +++ b/third_party/protobuf/src/google/protobuf/io/coded_stream.cc @@ -29,6 +29,7 @@ #include <string> #include <utility> +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/cord.h" @@ -120,9 +121,9 @@ CodedInputStream::Limit CodedInputStream::PushLimit(int byte_limit) { // security: byte_limit is possibly evil, so check for negative values // and overflow. Also check that the new requested limit is before the // previous limit; otherwise we continue to enforce the previous limit. - if (PROTOBUF_PREDICT_TRUE(byte_limit >= 0 && - byte_limit <= INT_MAX - current_position && - byte_limit < current_limit_ - current_position)) { + if (ABSL_PREDICT_TRUE(byte_limit >= 0 && + byte_limit <= INT_MAX - current_position && + byte_limit < current_limit_ - current_position)) { current_limit_ = current_position + byte_limit; RecomputeBufferLimits(); } @@ -333,7 +334,7 @@ bool CodedInputStream::ReadCord(absl::Cord* output, int size) { // Make sure to not cross a limit set by PushLimit() or SetTotalBytesLimit(). const int closest_limit = std::min(current_limit_, total_bytes_limit_); const int available = closest_limit - total_bytes_read_; - if (PROTOBUF_PREDICT_FALSE(size > available)) { + if (ABSL_PREDICT_FALSE(size > available)) { total_bytes_read_ = closest_limit; input_->ReadCord(output, available); return false; @@ -841,7 +842,7 @@ uint8_t* EpsCopyOutputStream::GetDirectBufferForNBytesAndAdvance(int size, uint8_t* EpsCopyOutputStream::Next() { ABSL_DCHECK(!had_error_); // NOLINT - if (PROTOBUF_PREDICT_FALSE(stream_ == nullptr)) return Error(); + if (ABSL_PREDICT_FALSE(stream_ == nullptr)) return Error(); if (buffer_end_) { // We're in the patch buffer and need to fill up the previous buffer. std::memcpy(buffer_end_, buffer_, end_ - buffer_); @@ -849,14 +850,14 @@ uint8_t* EpsCopyOutputStream::Next() { int size; do { void* data; - if (PROTOBUF_PREDICT_FALSE(!stream_->Next(&data, &size))) { + if (ABSL_PREDICT_FALSE(!stream_->Next(&data, &size))) { // Stream has an error, we use the patch buffer to continue to be // able to write. return Error(); } ptr = static_cast<uint8_t*>(data); } while (size == 0); - if (PROTOBUF_PREDICT_TRUE(size > kSlopBytes)) { + if (ABSL_PREDICT_TRUE(size > kSlopBytes)) { std::memcpy(ptr, end_, kSlopBytes); end_ = ptr + size - kSlopBytes; buffer_end_ = nullptr; @@ -879,7 +880,7 @@ uint8_t* EpsCopyOutputStream::Next() { uint8_t* EpsCopyOutputStream::EnsureSpaceFallback(uint8_t* ptr) { do { - if (PROTOBUF_PREDICT_FALSE(had_error_)) return buffer_; + if (ABSL_PREDICT_FALSE(had_error_)) return buffer_; int overrun = ptr - end_; ABSL_DCHECK(overrun >= 0); // NOLINT ABSL_DCHECK(overrun <= kSlopBytes); // NOLINT @@ -984,25 +985,17 @@ uint8_t* EpsCopyOutputStream::WriteCord(const absl::Cord& cord, uint8_t* ptr) { } } -uint8_t* EpsCopyOutputStream::WriteStringMaybeAliasedOutline(uint32_t num, - const std::string& s, - uint8_t* ptr) { +uint8_t* EpsCopyOutputStream::WriteStringMaybeAliasedOutline( + uint32_t num, absl::string_view s, uint8_t* ptr) { ptr = EnsureSpace(ptr); uint32_t size = s.size(); ptr = WriteLengthDelim(num, size, ptr); return WriteRawMaybeAliased(s.data(), size, ptr); } -uint8_t* EpsCopyOutputStream::WriteStringOutline(uint32_t num, const std::string& s, - uint8_t* ptr) { - ptr = EnsureSpace(ptr); - uint32_t size = s.size(); - ptr = WriteLengthDelim(num, size, ptr); - return WriteRaw(s.data(), size, ptr); -} - -uint8_t* EpsCopyOutputStream::WriteStringOutline(uint32_t num, absl::string_view s, - uint8_t* ptr) { +uint8_t* EpsCopyOutputStream::WriteStringOutline(uint32_t num, + absl::string_view s, + uint8_t* ptr) { ptr = EnsureSpace(ptr); uint32_t size = s.size(); ptr = WriteLengthDelim(num, size, ptr); @@ -1026,8 +1019,8 @@ uint8_t* CodedOutputStream::WriteCordToArray(const absl::Cord& cord, } -uint8_t* CodedOutputStream::WriteStringWithSizeToArray(const std::string& str, - uint8_t* target) { +uint8_t* CodedOutputStream::WriteStringWithSizeToArray(absl::string_view str, + uint8_t* target) { ABSL_DCHECK_LE(str.size(), std::numeric_limits<uint32_t>::max()); target = WriteVarint32ToArray(str.size(), target); return WriteStringToArray(str, target); diff --git a/third_party/protobuf/src/google/protobuf/io/coded_stream.h b/third_party/protobuf/src/google/protobuf/io/coded_stream.h index dc03435b22664..228b281cdee9f 100644 --- a/third_party/protobuf/src/google/protobuf/io/coded_stream.h +++ b/third_party/protobuf/src/google/protobuf/io/coded_stream.h @@ -659,15 +659,15 @@ 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_NODISCARD uint8_t* EnsureSpace(uint8_t* ptr) { - if (PROTOBUF_PREDICT_FALSE(ptr >= end_)) { + [[nodiscard]] uint8_t* EnsureSpace(uint8_t* ptr) { + if (ABSL_PREDICT_FALSE(ptr >= end_)) { return EnsureSpaceFallback(ptr); } return ptr; } uint8_t* WriteRaw(const void* data, int size, uint8_t* ptr) { - if (PROTOBUF_PREDICT_FALSE(end_ - ptr < size)) { + if (ABSL_PREDICT_FALSE(end_ - ptr < size)) { return WriteRawFallback(data, size, ptr); } std::memcpy(ptr, data, static_cast<unsigned int>(size)); @@ -693,11 +693,11 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { #ifndef NDEBUG PROTOBUF_NOINLINE #endif - uint8_t* WriteStringMaybeAliased(uint32_t num, const std::string& s, + uint8_t* WriteStringMaybeAliased(uint32_t num, absl::string_view s, uint8_t* ptr) { std::ptrdiff_t size = s.size(); - if (PROTOBUF_PREDICT_FALSE( - size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { + if (ABSL_PREDICT_FALSE(size >= 128 || + end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { return WriteStringMaybeAliasedOutline(num, s, ptr); } ptr = UnsafeVarint((num << 3) | 2, ptr); @@ -705,7 +705,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { std::memcpy(ptr, s.data(), size); return ptr + size; } - uint8_t* WriteBytesMaybeAliased(uint32_t num, const std::string& s, + uint8_t* WriteBytesMaybeAliased(uint32_t num, absl::string_view s, uint8_t* ptr) { return WriteStringMaybeAliased(num, s, ptr); } @@ -714,8 +714,8 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { PROTOBUF_ALWAYS_INLINE uint8_t* WriteString(uint32_t num, const T& s, uint8_t* ptr) { std::ptrdiff_t size = s.size(); - if (PROTOBUF_PREDICT_FALSE( - size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { + if (ABSL_PREDICT_FALSE(size >= 128 || + end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { return WriteStringOutline(num, s, ptr); } ptr = UnsafeVarint((num << 3) | 2, ptr); @@ -864,9 +864,8 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { uint8_t* WriteAliasedRaw(const void* data, int size, uint8_t* ptr); - uint8_t* WriteStringMaybeAliasedOutline(uint32_t num, const std::string& s, + uint8_t* WriteStringMaybeAliasedOutline(uint32_t num, absl::string_view s, uint8_t* ptr); - uint8_t* WriteStringOutline(uint32_t num, const std::string& s, uint8_t* ptr); uint8_t* WriteStringOutline(uint32_t num, absl::string_view s, uint8_t* ptr); uint8_t* WriteCordOutline(const absl::Cord& c, uint8_t* ptr); @@ -898,7 +897,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeVarint(T value, uint8_t* ptr) { static_assert(std::is_unsigned<T>::value, "Varint serialization must be unsigned"); - while (PROTOBUF_PREDICT_FALSE(value >= 0x80)) { + while (ABSL_PREDICT_FALSE(value >= 0x80)) { *ptr = static_cast<uint8_t>(value | 0x80); value >>= 7; ++ptr; @@ -909,7 +908,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeWriteSize(uint32_t value, uint8_t* ptr) { - while (PROTOBUF_PREDICT_FALSE(value >= 0x80)) { + while (ABSL_PREDICT_FALSE(value >= 0x80)) { *ptr = static_cast<uint8_t>(value | 0x80); value >>= 7; ++ptr; @@ -1117,11 +1116,11 @@ class PROTOBUF_EXPORT CodedOutputStream { uint8_t* target); // Equivalent to WriteRaw(str.data(), str.size()). - void WriteString(const std::string& str); + void WriteString(absl::string_view str); // Like WriteString() but writing directly to the target array. - static uint8_t* WriteStringToArray(const std::string& str, uint8_t* target); + static uint8_t* WriteStringToArray(absl::string_view str, uint8_t* target); // Write the varint-encoded size of str followed by str. - static uint8_t* WriteStringWithSizeToArray(const std::string& str, + static uint8_t* WriteStringWithSizeToArray(absl::string_view str, uint8_t* target); // Like WriteString() but writes a Cord. @@ -1295,7 +1294,7 @@ class PROTOBUF_EXPORT CodedOutputStream { inline bool CodedInputStream::ReadVarint32(uint32_t* value) { uint32_t v = 0; - if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { + if (ABSL_PREDICT_TRUE(buffer_ < buffer_end_)) { v = *buffer_; if (v < 0x80) { *value = v; @@ -1309,7 +1308,7 @@ inline bool CodedInputStream::ReadVarint32(uint32_t* value) { } inline bool CodedInputStream::ReadVarint64(uint64_t* value) { - if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_) && *buffer_ < 0x80) { + if (ABSL_PREDICT_TRUE(buffer_ < buffer_end_) && *buffer_ < 0x80) { *value = *buffer_; Advance(1); return true; @@ -1320,7 +1319,7 @@ inline bool CodedInputStream::ReadVarint64(uint64_t* value) { } inline bool CodedInputStream::ReadVarintSizeAsInt(int* value) { - if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { + if (ABSL_PREDICT_TRUE(buffer_ < buffer_end_)) { int v = *buffer_; if (v < 0x80) { *value = v; @@ -1355,7 +1354,7 @@ inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray( } inline bool CodedInputStream::ReadLittleEndian16(uint16_t* value) { - if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { + if (ABSL_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { buffer_ = ReadLittleEndian16FromArray(buffer_, value); return true; } else { @@ -1366,7 +1365,7 @@ inline bool CodedInputStream::ReadLittleEndian16(uint16_t* value) { inline bool CodedInputStream::ReadLittleEndian32(uint32_t* value) { #if defined(ABSL_IS_LITTLE_ENDIAN) && \ !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) - if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { + if (ABSL_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { buffer_ = ReadLittleEndian32FromArray(buffer_, value); return true; } else { @@ -1380,7 +1379,7 @@ inline bool CodedInputStream::ReadLittleEndian32(uint32_t* value) { inline bool CodedInputStream::ReadLittleEndian64(uint64_t* value) { #if defined(ABSL_IS_LITTLE_ENDIAN) && \ !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) - if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { + if (ABSL_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { buffer_ = ReadLittleEndian64FromArray(buffer_, value); return true; } else { @@ -1393,7 +1392,7 @@ inline bool CodedInputStream::ReadLittleEndian64(uint64_t* value) { inline uint32_t CodedInputStream::ReadTagNoLastTag() { uint32_t v = 0; - if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { + if (ABSL_PREDICT_TRUE(buffer_ < buffer_end_)) { v = *buffer_; if (v < 0x80) { Advance(1); @@ -1410,7 +1409,7 @@ inline std::pair<uint32_t, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( // constant, and things like "cutoff >= kMax1ByteVarint" to be evaluated at // compile time. uint32_t first_byte_or_zero = 0; - if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { + if (ABSL_PREDICT_TRUE(buffer_ < buffer_end_)) { // Hot case: buffer_ non_empty, buffer_[0] in [1, 128). // TODO: Is it worth rearranging this? E.g., if the number of fields // is large enough then is it better to check for the two-byte case first? @@ -1424,8 +1423,8 @@ inline std::pair<uint32_t, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( // Other hot case: cutoff >= 0x80, buffer_ has at least two bytes available, // and tag is two bytes. The latter is tested by bitwise-and-not of the // first byte and the second byte. - if (cutoff >= 0x80 && PROTOBUF_PREDICT_TRUE(buffer_ + 1 < buffer_end_) && - PROTOBUF_PREDICT_TRUE((buffer_[0] & ~buffer_[1]) >= 0x80)) { + if (cutoff >= 0x80 && ABSL_PREDICT_TRUE(buffer_ + 1 < buffer_end_) && + ABSL_PREDICT_TRUE((buffer_[0] & ~buffer_[1]) >= 0x80)) { const uint32_t kMax2ByteVarint = (0x7f << 7) + 0x7f; uint32_t tag = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80); Advance(2); @@ -1454,15 +1453,14 @@ inline bool CodedInputStream::ConsumedEntireMessage() { inline bool CodedInputStream::ExpectTag(uint32_t expected) { if (expected < (1 << 7)) { - if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_) && - buffer_[0] == expected) { + if (ABSL_PREDICT_TRUE(buffer_ < buffer_end_) && buffer_[0] == expected) { Advance(1); return true; } else { return false; } } else if (expected < (1 << 14)) { - if (PROTOBUF_PREDICT_TRUE(BufferSize() >= 2) && + if (ABSL_PREDICT_TRUE(BufferSize() >= 2) && buffer_[0] == static_cast<uint8_t>(expected | 0x80) && buffer_[1] == static_cast<uint8_t>(expected >> 7)) { Advance(2); @@ -1632,7 +1630,7 @@ template <class Stream> inline void CodedOutputStream::InitEagerly(Stream* stream) { void* data; int size; - if (PROTOBUF_PREDICT_TRUE(stream->Next(&data, &size) && size > 0)) { + if (ABSL_PREDICT_TRUE(stream->Next(&data, &size) && size > 0)) { cur_ = impl_.SetInitialBuffer(data, size); } } @@ -1791,7 +1789,7 @@ inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne( } #undef PROTOBUF_CODED_STREAM_H_PREFER_BSR -inline void CodedOutputStream::WriteString(const std::string& str) { +inline void CodedOutputStream::WriteString(absl::string_view str) { WriteRaw(str.data(), static_cast<int>(str.size())); } @@ -1806,7 +1804,7 @@ inline uint8_t* CodedOutputStream::WriteRawToArray(const void* data, int size, return target + size; } -inline uint8_t* CodedOutputStream::WriteStringToArray(const std::string& str, +inline uint8_t* CodedOutputStream::WriteStringToArray(absl::string_view str, uint8_t* target) { return WriteRawToArray(str.data(), static_cast<int>(str.size()), target); } diff --git a/third_party/protobuf/src/google/protobuf/io/printer.cc b/third_party/protobuf/src/google/protobuf/io/printer.cc index 4c8316203bc60..a2f7ca8ca25b4 100644 --- a/third_party/protobuf/src/google/protobuf/io/printer.cc +++ b/third_party/protobuf/src/google/protobuf/io/printer.cc @@ -113,13 +113,34 @@ Printer::Format Printer::TokenizeFormat(absl::string_view format_string, // a while loop, not a do/while loop. absl::string_view orig = format_string; + absl::string_view first_pp_directive; while (absl::ConsumePrefix(&format_string, "\n")) { + // clang-format will think a # at the beginning of the line in a raw + // string is a preprocessor directive and put it at the start of the line, + // which throws off indent calculation. Skip past those to find code that + // is indented more realistically. + if (absl::StartsWith(format_string, "#")) { + // We don't want to drop the first #... lines. We just want to skip + // through here. Remember to allow resetting later. + if (first_pp_directive.empty()) { + first_pp_directive = format_string; + } + size_t next_newline_index = format_string.find('\n'); + if (next_newline_index != absl::string_view::npos) { + format_string = format_string.substr(next_newline_index); + continue; + } + } raw_string_indent = 0; format.is_raw_string = true; while (absl::ConsumePrefix(&format_string, " ")) { ++raw_string_indent; } } + // Reset if we skipped through some #... lines, so that we don't drop them. + if (!first_pp_directive.empty()) { + format_string = first_pp_directive; + } // If we consume the entire string, this probably wasn't a raw string and // was probably something like a couple of explicit newlines. @@ -160,6 +181,9 @@ Printer::Format Printer::TokenizeFormat(absl::string_view format_string, if (comment_index != absl::string_view::npos) { line_text = line_text.substr(0, comment_index); if (absl::StripLeadingAsciiWhitespace(line_text).empty()) { + // If the first line is part of an ignored comment, consider that a + // first line as well. + is_first = false; continue; } } diff --git a/third_party/protobuf/src/google/protobuf/io/printer.h b/third_party/protobuf/src/google/protobuf/io/printer.h index 7677e9dbb9e0c..e614c696918db 100644 --- a/third_party/protobuf/src/google/protobuf/io/printer.h +++ b/third_party/protobuf/src/google/protobuf/io/printer.h @@ -32,8 +32,10 @@ #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#include "absl/types/span.h" #include "absl/types/variant.h" #include "google/protobuf/io/zero_copy_sink.h" +#include "google/protobuf/io/zero_copy_stream.h" // Must be included last. @@ -124,8 +126,8 @@ class AnnotationProtoCollector : public AnnotationCollector { const std::string& file_path, const std::vector<int>& path, absl::optional<Semantic> semantic) override { auto* annotation = annotation_proto_->add_annotation(); - for (int i = 0; i < path.size(); ++i) { - annotation->add_path(path[i]); + for (const int segment : path) { + annotation->add_path(segment); } annotation->set_source_file(file_path); annotation->set_begin(begin_offset); diff --git a/third_party/protobuf/src/google/protobuf/io/printer_unittest.cc b/third_party/protobuf/src/google/protobuf/io/printer_unittest.cc index 3e3d256ff5ea9..87091638d7873 100644 --- a/third_party/protobuf/src/google/protobuf/io/printer_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/io/printer_unittest.cc @@ -713,6 +713,46 @@ TEST_F(PrinterTest, EmitWithIndent) { " };\n"); } +TEST_F(PrinterTest, EmitWithIndentAndIgnoredCommentOnFirstLine) { + { + Printer printer(output()); + auto v = printer.WithIndent(); + printer.Emit({{"f1", "x"}, {"f2", "y"}, {"f3", "z"}}, R"cc( + //~ First line comment. + class Foo { + int $f1$, $f2$, $f3$; + }; + )cc"); + } + + EXPECT_EQ(written(), + " class Foo {\n" + " int x, y, z;\n" + " };\n"); +} + +TEST_F(PrinterTest, EmitWithCPPDirectiveOnFirstLine) { + { + Printer printer(output()); + printer.Emit({{"f1", "x"}, {"f2", "y"}, {"f3", "z"}}, R"cc( +#if NDEBUG +#pragma foo + class Foo { + int $f1$, $f2$, $f3$; + }; +#endif + )cc"); + } + + EXPECT_EQ(written(), + "#if NDEBUG\n" + "#pragma foo\n" + "class Foo {\n" + " int x, y, z;\n" + "};\n" + "#endif\n"); +} + TEST_F(PrinterTest, EmitWithPreprocessor) { { Printer printer(output()); @@ -742,9 +782,9 @@ TEST_F(PrinterTest, EmitWithPreprocessor) { EXPECT_EQ(written(), R"( int val = ( #if FOO - 0, + 0, #else - 1, + 1, #endif 0); #pragma foo diff --git a/third_party/protobuf/src/google/protobuf/io/tokenizer.cc b/third_party/protobuf/src/google/protobuf/io/tokenizer.cc index 9f1599b648a2f..80edb3d0b63eb 100644 --- a/third_party/protobuf/src/google/protobuf/io/tokenizer.cc +++ b/third_party/protobuf/src/google/protobuf/io/tokenizer.cc @@ -277,8 +277,8 @@ void Tokenizer::Refresh() { record_start_ = 0; } - const void* data = NULL; - buffer_ = NULL; + const void* data = nullptr; + buffer_ = nullptr; buffer_pos_ = 0; do { if (!input_->Next(&data, &buffer_size_)) { @@ -302,14 +302,14 @@ inline void Tokenizer::RecordTo(std::string* target) { inline void Tokenizer::StopRecording() { // Note: The if() is necessary because some STL implementations crash when - // you call string::append(NULL, 0), presumably because they are trying to - // be helpful by detecting the NULL pointer, even though there's nothing - // wrong with reading zero bytes from NULL. + // you call string::append(nullptr, 0), presumably because they are trying + // to be helpful by detecting the nullptr pointer, even though there's + // nothing wrong with reading zero bytes from nullptr. if (buffer_pos_ != record_start_) { record_target_->append(buffer_ + record_start_, buffer_pos_ - record_start_); } - record_target_ = NULL; + record_target_ = nullptr; record_start_ = -1; } @@ -496,21 +496,21 @@ Tokenizer::TokenType Tokenizer::ConsumeNumber(bool started_with_zero, } void Tokenizer::ConsumeLineComment(std::string* content) { - if (content != NULL) RecordTo(content); + if (content != nullptr) RecordTo(content); while (current_char_ != '\0' && current_char_ != '\n') { NextChar(); } TryConsume('\n'); - if (content != NULL) StopRecording(); + if (content != nullptr) StopRecording(); } void Tokenizer::ConsumeBlockComment(std::string* content) { int start_line = line_; int start_column = column_ - 2; - if (content != NULL) RecordTo(content); + if (content != nullptr) RecordTo(content); while (true) { while (current_char_ != '\0' && current_char_ != '*' && @@ -519,7 +519,7 @@ void Tokenizer::ConsumeBlockComment(std::string* content) { } if (TryConsume('\n')) { - if (content != NULL) StopRecording(); + if (content != nullptr) StopRecording(); // Consume leading whitespace and asterisk; ConsumeZeroOrMore<WhitespaceNoNewline>(); @@ -530,10 +530,10 @@ void Tokenizer::ConsumeBlockComment(std::string* content) { } } - if (content != NULL) RecordTo(content); + if (content != nullptr) RecordTo(content); } else if (TryConsume('*') && TryConsume('/')) { // End of comment. - if (content != NULL) { + if (content != nullptr) { StopRecording(); // Strip trailing "*/". content->erase(content->size() - 2); @@ -548,7 +548,7 @@ void Tokenizer::ConsumeBlockComment(std::string* content) { AddError("End-of-file inside block comment."); error_collector_->RecordError(start_line, start_column, " Comment started here."); - if (content != NULL) StopRecording(); + if (content != nullptr) StopRecording(); break; } } @@ -619,10 +619,10 @@ bool Tokenizer::Next() { switch (TryConsumeCommentStart()) { case LINE_COMMENT: - ConsumeLineComment(NULL); + ConsumeLineComment(nullptr); continue; case BLOCK_COMMENT: - ConsumeBlockComment(NULL); + ConsumeBlockComment(nullptr); continue; case SLASH_NOT_COMMENT: return true; @@ -729,14 +729,14 @@ class CommentCollector { has_comment_(false), is_line_comment_(false), can_attach_to_prev_(true) { - if (prev_trailing_comments != NULL) prev_trailing_comments->clear(); - if (detached_comments != NULL) detached_comments->clear(); - if (next_leading_comments != NULL) next_leading_comments->clear(); + if (prev_trailing_comments != nullptr) prev_trailing_comments->clear(); + if (detached_comments != nullptr) detached_comments->clear(); + if (next_leading_comments != nullptr) next_leading_comments->clear(); } ~CommentCollector() { // Whatever is in the buffer is a leading comment. - if (next_leading_comments_ != NULL && has_comment_) { + if (next_leading_comments_ != nullptr && has_comment_) { comment_buffer_.swap(*next_leading_comments_); } } @@ -774,13 +774,13 @@ class CommentCollector { void Flush() { if (has_comment_) { if (can_attach_to_prev_) { - if (prev_trailing_comments_ != NULL) { + if (prev_trailing_comments_ != nullptr) { prev_trailing_comments_->append(comment_buffer_); } has_trailing_comment_ = true; can_attach_to_prev_ = false; } else { - if (detached_comments_ != NULL) { + if (detached_comments_ != nullptr) { detached_comments_->push_back(comment_buffer_); } } @@ -797,9 +797,9 @@ class CommentCollector { // If there's one comment, make sure it is detached. if (count == 1) { - if (has_trailing_comment_ && prev_trailing_comments_ != NULL) { + if (has_trailing_comment_ && prev_trailing_comments_ != nullptr) { std::string trail = *prev_trailing_comments_; - if (detached_comments_ != NULL) { + if (detached_comments_ != nullptr) { // push trailing comment to front of detached detached_comments_->insert(detached_comments_->begin(), 1, trail); } diff --git a/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc b/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc index e82a94475e686..3658e87694265 100644 --- a/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc @@ -53,9 +53,11 @@ #include "absl/strings/cord_buffer.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/io_win32.h" #include "google/protobuf/io/zero_copy_stream_impl.h" +#include "google/protobuf/port.h" #include "google/protobuf/test_util2.h" #if HAVE_ZLIB @@ -558,7 +560,7 @@ std::string IoTest::Uncompress(const std::string& data) { TEST_F(IoTest, CompressionOptions) { // Some ad-hoc testing of compression options. - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; TestUtil::SetAllFields(&message); std::string golden = message.SerializeAsString(); @@ -1446,14 +1448,14 @@ TEST_F(IoTest, NonBlockingFileIo) { ASSERT_EQ(fcntl(fd[0], F_SETFL, O_NONBLOCK), 0); ASSERT_EQ(fcntl(fd[1], F_SETFL, O_NONBLOCK), 0); - std::mutex go_write; - go_write.lock(); + absl::Mutex go_write; + go_write.Lock(); bool done_reading = false; std::thread write_thread([this, fd, &go_write, i]() { - go_write.lock(); - go_write.unlock(); + go_write.Lock(); + go_write.Unlock(); FileOutputStream output(fd[1], kBlockSizes[i]); WriteStuff(&output); EXPECT_EQ(0, output.GetErrno()); @@ -1472,7 +1474,7 @@ TEST_F(IoTest, NonBlockingFileIo) { // reading thread waits for the data to be available before returning. std::this_thread::sleep_for(std::chrono::milliseconds(100)); EXPECT_FALSE(done_reading); - go_write.unlock(); + go_write.Unlock(); write_thread.join(); read_thread.join(); EXPECT_TRUE(done_reading); diff --git a/third_party/protobuf/src/google/protobuf/json/BUILD.bazel b/third_party/protobuf/src/google/protobuf/json/BUILD.bazel index 72c41364ed0eb..96b459baaf4bc 100644 --- a/third_party/protobuf/src/google/protobuf/json/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/json/BUILD.bazel @@ -26,11 +26,11 @@ cc_library( "//src/google/protobuf/io:zero_copy_sink", "//src/google/protobuf/stubs", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/base", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", ], ) @@ -54,12 +54,12 @@ cc_test( "//src/google/protobuf/util:json_format_cc_proto", "//src/google/protobuf/util:json_format_proto3_cc_proto", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -73,13 +73,13 @@ cc_library( "//src/google/protobuf:port", "//src/google/protobuf/io", "//src/google/protobuf/stubs", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -91,9 +91,9 @@ cc_test( ":zero_copy_buffered_stream", "//src/google/protobuf/io:test_zero_copy_stream", "//src/google/protobuf/stubs", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -112,15 +112,15 @@ cc_library( "//src/google/protobuf/stubs", "//src/google/protobuf/util:type_resolver", "//third_party/utf8_range:utf8_validity", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", - "@com_google_absl//absl/types:variant", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", + "@abseil-cpp//absl/types:variant", ], ) @@ -138,13 +138,13 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/stubs", "//third_party/utf8_range:utf8_validity", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/numeric:bits", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -159,14 +159,14 @@ cc_test( "//src/google/protobuf/io", "//src/google/protobuf/io:test_zero_copy_stream", "//src/google/protobuf/stubs", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:variant", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:variant", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -182,10 +182,10 @@ cc_library( "//src/google/protobuf/io:tokenizer", "//src/google/protobuf/io:zero_copy_sink", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -200,12 +200,12 @@ cc_library( "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/algorithm:container", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:optional", ], ) @@ -223,6 +223,7 @@ cc_library( deps = [ ":descriptor_traits", ":lexer", + ":zero_copy_buffered_stream", "//src/google/protobuf", "//src/google/protobuf:port", "//src/google/protobuf:protobuf_lite", @@ -231,18 +232,18 @@ cc_library( "//src/google/protobuf/io:zero_copy_sink", "//src/google/protobuf/stubs", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/base", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", + "@abseil-cpp//absl/base", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:span", ], ) @@ -265,16 +266,18 @@ cc_library( "//src/google/protobuf:port", "//src/google/protobuf:type_cc_proto", "//src/google/protobuf/io", + "//src/google/protobuf/io:zero_copy_sink", "//src/google/protobuf/stubs", "//src/google/protobuf/util:type_resolver", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:variant", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:optional", + "@abseil-cpp//absl/types:variant", ], ) @@ -287,7 +290,7 @@ cc_library( deps = [ "//src/google/protobuf", "//src/google/protobuf:port", - "@com_google_absl//absl/cleanup", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/cleanup", + "@abseil-cpp//absl/strings", ], ) diff --git a/third_party/protobuf/src/google/protobuf/json/internal/parser.cc b/third_party/protobuf/src/google/protobuf/json/internal/parser.cc index b7631f356a9df..98232252a7396 100644 --- a/third_party/protobuf/src/google/protobuf/json/internal/parser.cc +++ b/third_party/protobuf/src/google/protobuf/json/internal/parser.cc @@ -40,6 +40,7 @@ #include "google/protobuf/json/internal/descriptor_traits.h" #include "google/protobuf/json/internal/lexer.h" #include "google/protobuf/json/internal/parser_traits.h" +#include "google/protobuf/json/internal/zero_copy_buffered_stream.h" #include "google/protobuf/message.h" #include "google/protobuf/util/type_resolver.h" #include "google/protobuf/stubs/status_macros.h" @@ -169,6 +170,28 @@ absl::StatusOr<absl::Span<char>> DecodeBase64InPlace(absl::Span<char> base64) { static_cast<size_t>(out - base64.data())); } +template <typename T> +static absl::Status ParseFloatStringAsInt( + const LocationWith<MaybeOwnedString>& x, T* out, double lo, double hi) { + double d; + if (!absl::SimpleAtod(x.value.AsView(), &d) || !std::isfinite(d)) { + return x.loc.Invalid( + absl::StrFormat("invalid number: '%s'", x.value.AsView())); + } + + // Conversion overflow here would be UB. + if (lo > d || d > hi) { + return x.loc.Invalid("JSON number out of range for int"); + } + *out = static_cast<T>(d); + if (d - static_cast<double>(*out) != 0) { + return x.loc.Invalid( + "expected integer, but JSON number had fractional part"); + } + + return absl::OkStatus(); +} + template <typename T> absl::StatusOr<LocationWith<T>> ParseIntInner(JsonLexer& lex, double lo, double hi) { @@ -185,26 +208,15 @@ absl::StatusOr<LocationWith<T>> ParseIntInner(JsonLexer& lex, double lo, break; } - double d; - if (!absl::SimpleAtod(x->value.AsView(), &d) || !std::isfinite(d)) { - return x->loc.Invalid( - absl::StrFormat("invalid number: '%s'", x->value.AsView())); - } - - // Conversion overflow here would be UB. - if (lo > d || d > hi) { - return lex.Invalid("JSON number out of range for int"); - } - n.value = static_cast<T>(d); - if (d - static_cast<double>(n.value) != 0) { - return lex.Invalid( - "expected integer, but JSON number had fractional part"); - } + RETURN_IF_ERROR(ParseFloatStringAsInt<T>(*x, &n.value, lo, hi)); break; } case JsonLexer::kStr: { absl::StatusOr<LocationWith<MaybeOwnedString>> str = lex.ParseUtf8(); RETURN_IF_ERROR(str.status()); + + n.loc = str->loc; + // SimpleAtoi will ignore leading and trailing whitespace, so we need // to check for it ourselves. for (char c : str->value.AsView()) { @@ -212,10 +224,11 @@ absl::StatusOr<LocationWith<T>> ParseIntInner(JsonLexer& lex, double lo, return lex.Invalid("non-number characters in quoted number"); } } - if (!absl::SimpleAtoi(str->value.AsView(), &n.value)) { - return str->loc.Invalid("non-number characters in quoted number"); + if (absl::SimpleAtoi(str->value.AsView(), &n.value)) { + break; } - n.loc = str->loc; + + RETURN_IF_ERROR(ParseFloatStringAsInt<T>(*str, &n.value, lo, hi)); break; } default: @@ -322,11 +335,11 @@ absl::StatusOr<std::string> ParseStrOrBytes(JsonLexer& lex, } template <typename Traits> -absl::StatusOr<absl::optional<int32_t>> ParseEnumFromStr(JsonLexer& lex, - MaybeOwnedString& str, - Field<Traits> field) { +absl::StatusOr<absl::optional<int32_t>> ParseEnumFromStr( + const json_internal::ParseOptions& options, MaybeOwnedString& str, + Field<Traits> field) { absl::StatusOr<int32_t> value = Traits::EnumNumberByName( - field, str.AsView(), lex.options().case_insensitive_enum_parsing); + field, str.AsView(), options.case_insensitive_enum_parsing); if (value.ok()) { return absl::optional<int32_t>(*value); } @@ -334,7 +347,7 @@ absl::StatusOr<absl::optional<int32_t>> ParseEnumFromStr(JsonLexer& lex, int32_t i; if (absl::SimpleAtoi(str.AsView(), &i)) { return absl::optional<int32_t>(i); - } else if (lex.options().ignore_unknown_fields) { + } else if (options.ignore_unknown_fields) { return {absl::nullopt}; } @@ -355,7 +368,7 @@ absl::StatusOr<absl::optional<int32_t>> ParseEnum(JsonLexer& lex, absl::StatusOr<LocationWith<MaybeOwnedString>> str = lex.ParseUtf8(); RETURN_IF_ERROR(str.status()); - auto e = ParseEnumFromStr<Traits>(lex, str->value, field); + auto e = ParseEnumFromStr<Traits>(lex.options(), str->value, field); RETURN_IF_ERROR(e.status()); if (!e->has_value()) { return {absl::nullopt}; @@ -577,6 +590,72 @@ absl::Status EmitNull(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) { return absl::OkStatus(); } +// Parses map key from already consumed string 'key' into the key field of the +// map entry message 'entry' of type 'type'. +template <typename Traits> +absl::Status ParseMapKey(const Desc<Traits>& type, Msg<Traits>& entry, + LocationWith<MaybeOwnedString>& key) { + auto key_field = Traits::KeyField(type); + switch (Traits::FieldType(key_field)) { + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_SINT64: + case FieldDescriptor::TYPE_SFIXED64: { + int64_t n; + if (!absl::SimpleAtoi(key.value.AsView(), &n)) { + return key.loc.Invalid("non-number characters in quoted number"); + } + Traits::SetInt64(key_field, entry, n); + break; + } + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_FIXED64: { + uint64_t n; + if (!absl::SimpleAtoi(key.value.AsView(), &n)) { + return key.loc.Invalid("non-number characters in quoted number"); + } + Traits::SetUInt64(key_field, entry, n); + break; + } + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_SFIXED32: { + int32_t n; + if (!absl::SimpleAtoi(key.value.AsView(), &n)) { + return key.loc.Invalid("non-number characters in quoted number"); + } + Traits::SetInt32(key_field, entry, n); + break; + } + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_FIXED32: { + uint32_t n; + if (!absl::SimpleAtoi(key.value.AsView(), &n)) { + return key.loc.Invalid("non-number characters in quoted number"); + } + Traits::SetUInt32(key_field, entry, n); + break; + } + case FieldDescriptor::TYPE_BOOL: { + if (key.value == "true") { + Traits::SetBool(key_field, entry, true); + } else if (key.value == "false") { + Traits::SetBool(key_field, entry, false); + } else { + return key.loc.Invalid(absl::StrFormat("expected bool string, got '%s'", + key.value.AsView())); + } + break; + } + case FieldDescriptor::TYPE_STRING: { + Traits::SetString(key_field, entry, std::move(key.value.ToString())); + break; + } + default: + return key.loc.Invalid("unsupported map key type"); + } + return absl::OkStatus(); +} + template <typename Traits> absl::Status ParseArray(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) { if (lex.Peek(JsonLexer::kNull)) { @@ -625,6 +704,71 @@ absl::Status ParseArray(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) { }); } +// Parses one map entry for 'map_field' of type map<*, enum> in 'parent_msg' +// with already consumed 'key'. +// The implementation is careful not to invoke Traits::NewMsg (which emits a new +// message) if the enum value is unknown but we can recover from it. +// This is tested by ParseMapWithEnumValuesProto{2,3}WithUnknownFields tests in +// kReflective codec mode. +template <typename Traits> +absl::Status ParseMapOfEnumsEntry(JsonLexer& lex, Field<Traits> map_field, + Msg<Traits>& parent_msg, + LocationWith<MaybeOwnedString>& key) { + // Parse the enum value from string, advancing the lexer. + absl::optional<int32_t> enum_value; + RETURN_IF_ERROR(Traits::WithFieldType( + map_field, [&lex, &enum_value](const Desc<Traits>& map_entry_desc) { + ASSIGN_OR_RETURN( + enum_value, + ParseEnum<Traits>(lex, Traits::ValueField(map_entry_desc))); + return absl::OkStatus(); + })); + + if (enum_value.has_value()) { + return Traits::NewMsg( + map_field, parent_msg, + [&](const Desc<Traits>& type, Msg<Traits>& entry) -> absl::Status { + RETURN_IF_ERROR(ParseMapKey<Traits>(type, entry, key)); + Traits::SetEnum(Traits::ValueField(type), entry, *enum_value); + return absl::OkStatus(); + }); + } else { + // If we don't have enum value here, it means that it was OK to ignore it + // due to ignore_unknown_fields flag, otherwise ParseEnum call would fail + // above with "unknown enum value: " invalid argument error. + ABSL_DCHECK(lex.options().ignore_unknown_fields); + return absl::OkStatus(); + } +} + +// Parses one map entry for 'map_field' in 'parent_msg' with already consumed +// 'key'. +template <typename Traits> +absl::Status ParseMapEntry(JsonLexer& lex, Field<Traits> map_field, + Msg<Traits>& parent_msg, + LocationWith<MaybeOwnedString>& key) { + bool is_map_of_enums = false; + RETURN_IF_ERROR(Traits::WithFieldType( + map_field, [&is_map_of_enums](const Desc<Traits>& desc) { + is_map_of_enums = Traits::FieldType(Traits::ValueField(desc)) == + FieldDescriptor::TYPE_ENUM; + return absl::OkStatus(); + })); + + // Special case for map<*, enum> due to handling of unknown enum values. + // See comments above ParseMapOfEnumsEntry for details. + if (is_map_of_enums) { + return ParseMapOfEnumsEntry<Traits>(lex, map_field, parent_msg, key); + } + + return Traits::NewMsg( + map_field, parent_msg, + [&](const Desc<Traits>& type, Msg<Traits>& entry) -> absl::Status { + RETURN_IF_ERROR(ParseMapKey<Traits>(type, entry, key)); + return ParseSingular<Traits>(lex, Traits::ValueField(type), entry); + }); +} + template <typename Traits> absl::Status ParseMap(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) { if (lex.Peek(JsonLexer::kNull)) { @@ -641,76 +785,7 @@ absl::Status ParseMap(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) { "got unexpectedly-repeated repeated map key: '%s'", key.value.AsView())); } - return Traits::NewMsg( - field, msg, - [&](const Desc<Traits>& type, Msg<Traits>& entry) -> absl::Status { - auto key_field = Traits::KeyField(type); - switch (Traits::FieldType(key_field)) { - case FieldDescriptor::TYPE_INT64: - case FieldDescriptor::TYPE_SINT64: - case FieldDescriptor::TYPE_SFIXED64: { - int64_t n; - if (!absl::SimpleAtoi(key.value.AsView(), &n)) { - return key.loc.Invalid( - "non-number characters in quoted number"); - } - Traits::SetInt64(key_field, entry, n); - break; - } - case FieldDescriptor::TYPE_UINT64: - case FieldDescriptor::TYPE_FIXED64: { - uint64_t n; - if (!absl::SimpleAtoi(key.value.AsView(), &n)) { - return key.loc.Invalid( - "non-number characters in quoted number"); - } - Traits::SetUInt64(key_field, entry, n); - break; - } - case FieldDescriptor::TYPE_INT32: - case FieldDescriptor::TYPE_SINT32: - case FieldDescriptor::TYPE_SFIXED32: { - int32_t n; - if (!absl::SimpleAtoi(key.value.AsView(), &n)) { - return key.loc.Invalid( - "non-number characters in quoted number"); - } - Traits::SetInt32(key_field, entry, n); - break; - } - case FieldDescriptor::TYPE_UINT32: - case FieldDescriptor::TYPE_FIXED32: { - uint32_t n; - if (!absl::SimpleAtoi(key.value.AsView(), &n)) { - return key.loc.Invalid( - "non-number characters in quoted number"); - } - Traits::SetUInt32(key_field, entry, n); - break; - } - case FieldDescriptor::TYPE_BOOL: { - if (key.value == "true") { - Traits::SetBool(key_field, entry, true); - } else if (key.value == "false") { - Traits::SetBool(key_field, entry, false); - } else { - return key.loc.Invalid(absl::StrFormat( - "expected bool string, got '%s'", key.value.AsView())); - } - break; - } - case FieldDescriptor::TYPE_STRING: { - Traits::SetString(key_field, entry, - std::move(key.value.ToString())); - break; - } - default: - return lex.Invalid("unsupported map key type"); - } - - return ParseSingular<Traits>(lex, Traits::ValueField(type), - entry); - }); + return ParseMapEntry<Traits>(lex, field, msg, key); }); } diff --git a/third_party/protobuf/src/google/protobuf/json/internal/unparser.cc b/third_party/protobuf/src/google/protobuf/json/internal/unparser.cc index 33e4505d1369c..6d5b63b9dc8c8 100644 --- a/third_party/protobuf/src/google/protobuf/json/internal/unparser.cc +++ b/third_party/protobuf/src/google/protobuf/json/internal/unparser.cc @@ -18,10 +18,12 @@ #include <string> #include <type_traits> #include <utility> +#include <vector> #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" @@ -31,11 +33,14 @@ #include "google/protobuf/descriptor.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/io/coded_stream.h" +#include "google/protobuf/io/zero_copy_sink.h" #include "google/protobuf/io/zero_copy_stream.h" +#include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "google/protobuf/json/internal/descriptor_traits.h" #include "google/protobuf/json/internal/unparser_traits.h" #include "google/protobuf/json/internal/writer.h" #include "google/protobuf/message.h" +#include "google/protobuf/util/type_resolver.h" #include "google/protobuf/stubs/status_macros.h" // Must be included last. @@ -905,3 +910,5 @@ absl::Status BinaryToJsonStream(google::protobuf::util::TypeResolver* resolver, } // namespace json_internal } // namespace protobuf } // namespace google + +#include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/json/json_test.cc b/third_party/protobuf/src/google/protobuf/json/json_test.cc index 12a8c6f77bc05..a9e62f250a218 100644 --- a/third_party/protobuf/src/google/protobuf/json/json_test.cc +++ b/third_party/protobuf/src/google/protobuf/json/json_test.cc @@ -236,7 +236,7 @@ TEST_P(JsonTest, TestAlwaysPrintFieldsWithNoPresence) { "}")); EXPECT_THAT( - ToJson(protobuf_unittest::TestAllTypes(), options), + ToJson(proto2_unittest::TestAllTypes(), options), IsOkAndHolds( R"({"repeatedInt32":[],"repeatedInt64":[],"repeatedUint32":[],"repeatedUint64":[],)" R"("repeatedSint32":[],"repeatedSint64":[],"repeatedFixed32":[],"repeatedFixed64":[],)" @@ -258,7 +258,7 @@ TEST_P(JsonTest, TestPreserveProtoFieldNames) { } TEST_P(JsonTest, Camels) { - protobuf_unittest::TestCamelCaseFieldNames m; + proto2_unittest::TestCamelCaseFieldNames m; m.set_stringfield("sTRINGfIELD"); EXPECT_THAT(ToJson(m), IsOkAndHolds(R"({"StringField":"sTRINGfIELD"})")); @@ -347,6 +347,39 @@ TEST_P(JsonTest, QuotedEnumValue) { EXPECT_THAT(m->enum_value1(), proto3::BAR); } +TEST_P(JsonTest, QuotedIntegerValue) { + auto m = ToProto<TestMessage>(R"json( + {"int32Value": "2"} + )json"); + ASSERT_OK(m); + EXPECT_THAT(m->int32_value(), 2); +} + +TEST_P(JsonTest, QuotedIntegerFloatValue) { + auto m = ToProto<TestMessage>(R"json( + {"int32Value": "2.0"} + )json"); + ASSERT_OK(m); + EXPECT_THAT(m->int32_value(), 2); +} + +TEST_P(JsonTest, QuotedIntegerExponentValue) { + auto m = ToProto<TestMessage>(R"json( + {"int32Value": "1e2"} + )json"); + ASSERT_OK(m); + EXPECT_THAT(m->int32_value(), 100); +} + +TEST_P(JsonTest, TestInvalidIntegerValue) { + EXPECT_THAT(ToProto<TestMessage>(R"("{"int32Value": ""})"), + StatusIs(absl::StatusCode::kInvalidArgument)); + EXPECT_THAT(ToProto<TestMessage>(R"("{"int32Value": 1.001})"), + StatusIs(absl::StatusCode::kInvalidArgument)); + EXPECT_THAT(ToProto<TestMessage>(R"("{"int32Value": "1.2e1"})"), + StatusIs(absl::StatusCode::kInvalidArgument)); +} + TEST_P(JsonTest, WebSafeBytes) { auto m = ToProto<TestMessage>(R"json({ "bytesValue": "-_" @@ -496,6 +529,88 @@ TEST_P(JsonTest, ParseLegacySingleRepeatedField) { R"("repeatedMessageValue":[{"value":-1}]})")); } +TEST_P(JsonTest, ParseMapWithEnumValuesProto2) { + ParseOptions options; + options.ignore_unknown_fields = false; + proto2_unittest::TestMapOfEnums message; + const std::string input_json = R"json({ + "enum_map": { + "key1": "PROTOCOL", + "key2": "UNKNOWN_ENUM_STRING_VALUE", + "key3": "BUFFER", + "key4": "UNKNOWN_ENUM_STRING_VALUE", + "key5": "PROTOCOL", + } + })json"; + + // Without ignore_unknown_fields, the unknown enum string value fails to + // parse. + EXPECT_THAT(ToProto(message, input_json, options), + StatusIs(absl::StatusCode::kInvalidArgument)); +} + +TEST_P(JsonTest, ParseMapWithEnumValuesProto3) { + ParseOptions options; + options.ignore_unknown_fields = false; + proto3::MapOfEnums message; + const std::string input_json = R"json({ + "map": { + "key1": "FOO", + "key2": "UNKNOWN_ENUM_STRING_VALUE", + "key3": "BAR", + "key4": "UNKNOWN_ENUM_STRING_VALUE", + "key5": "FOO", + } + })json"; + + // Without ignore_unknown_fields, the unknown enum string value fails to + // parse. + EXPECT_THAT(ToProto(message, input_json, options), + StatusIs(absl::StatusCode::kInvalidArgument)); +} + +TEST_P(JsonTest, ParseMapWithEnumValuesProto2WithUnknownFields) { + ParseOptions options; + options.ignore_unknown_fields = true; + proto2_unittest::TestMapOfEnums message; + const std::string input_json = R"json({ + "enum_map": { + "key1": "PROTOCOL", + "key2": "UNKNOWN_ENUM_STRING_VALUE", + "key3": "BUFFER", + "key4": "UNKNOWN_ENUM_STRING_VALUE", + "key5": "PROTOCOL", + } + })json"; + + ASSERT_OK(ToProto(message, input_json, options)); + + EXPECT_EQ(message.enum_map().size(), 3); + EXPECT_EQ(message.enum_map().contains("key2"), false); + EXPECT_EQ(message.enum_map().contains("key4"), false); +} + +TEST_P(JsonTest, ParseMapWithEnumValuesProto3WithUnknownFields) { + ParseOptions options; + options.ignore_unknown_fields = true; + proto3::MapOfEnums message; + const std::string input_json = R"json({ + "map": { + "key1": "FOO", + "key2": "UNKNOWN_ENUM_STRING_VALUE", + "key3": "BAR", + "key4": "UNKNOWN_ENUM_STRING_VALUE", + "key5": "FOO", + } + })json"; + + ASSERT_OK(ToProto(message, input_json, options)); + + EXPECT_EQ(message.map().size(), 3); + EXPECT_EQ(message.map().contains("key2"), false); + EXPECT_EQ(message.map().contains("key4"), false); +} + TEST_P(JsonTest, ParseMap) { TestMap message; (*message.mutable_string_map())["hello"] = 1234; @@ -673,7 +788,7 @@ TEST_P(JsonTest, TestParsingAnyWithRequiredFields) { auto m = ToProto<TestAny>(R"json( { "value": { - "@type": "type.googleapis.com/protobuf_unittest.TestRequired", + "@type": "type.googleapis.com/proto2_unittest.TestRequired", "a": 5, "dummy2": 6, "b": 7 @@ -682,7 +797,7 @@ TEST_P(JsonTest, TestParsingAnyWithRequiredFields) { )json"); ASSERT_OK(m); - protobuf_unittest::TestRequired t; + proto2_unittest::TestRequired t; // Can't use UnpackTo directly, since that checks IsInitialized. ASSERT_FALSE(m->value().UnpackTo(&t)); @@ -696,7 +811,7 @@ TEST_P(JsonTest, TestParsingAnyWithRequiredFields) { EXPECT_THAT( ToJson(*m), IsOkAndHolds( - R"({"value":{"@type":"type.googleapis.com/protobuf_unittest.TestRequired",)" + R"({"value":{"@type":"type.googleapis.com/proto2_unittest.TestRequired",)" R"("a":5,"dummy2":6,"b":7}})")); } @@ -884,12 +999,12 @@ TEST_P(JsonTest, TestHugeBareString) { TEST_P(JsonTest, TestParsingUnknownEnumsProto2) { absl::string_view input = R"json({"ayuLmao": "UNKNOWN_VALUE"})json"; - EXPECT_THAT(ToProto<protobuf_unittest::TestNumbers>(input), + EXPECT_THAT(ToProto<proto2_unittest::TestNumbers>(input), StatusIs(absl::StatusCode::kInvalidArgument)); ParseOptions options; options.ignore_unknown_fields = true; - auto m = ToProto<protobuf_unittest::TestNumbers>(input, options); + auto m = ToProto<proto2_unittest::TestNumbers>(input, options); ASSERT_OK(m); EXPECT_FALSE(m->has_a()); } @@ -996,36 +1111,36 @@ TEST_P(JsonTest, Extensions) { GTEST_SKIP(); } - auto m = ToProto<protobuf_unittest::TestMixedFieldsAndExtensions>(R"json({ - "[protobuf_unittest.TestMixedFieldsAndExtensions.c]": 42, + auto m = ToProto<proto2_unittest::TestMixedFieldsAndExtensions>(R"json({ + "[proto2_unittest.TestMixedFieldsAndExtensions.c]": 42, "a": 5, "b": [1, 2, 3], - "[protobuf_unittest.TestMixedFieldsAndExtensions.d]": [1, 1, 2, 3, 5, 8, 13] + "[proto2_unittest.TestMixedFieldsAndExtensions.d]": [1, 1, 2, 3, 5, 8, 13] })json"); ASSERT_OK(m); EXPECT_EQ(m->a(), 5); EXPECT_THAT(m->b(), ElementsAre(1, 2, 3)); - EXPECT_EQ(m->GetExtension(protobuf_unittest::TestMixedFieldsAndExtensions::c), + EXPECT_EQ(m->GetExtension(proto2_unittest::TestMixedFieldsAndExtensions::c), 42); EXPECT_THAT( - m->GetRepeatedExtension(protobuf_unittest::TestMixedFieldsAndExtensions::d), + m->GetRepeatedExtension(proto2_unittest::TestMixedFieldsAndExtensions::d), ElementsAre(1, 1, 2, 3, 5, 8, 13)); EXPECT_THAT( ToJson(*m), IsOkAndHolds( R"({"a":5,)" - R"("[protobuf_unittest.TestMixedFieldsAndExtensions.c]":42,)" + R"("[proto2_unittest.TestMixedFieldsAndExtensions.c]":42,)" R"("b":[1,2,3],)" - R"("[protobuf_unittest.TestMixedFieldsAndExtensions.d]":[1,1,2,3,5,8,13]})")); + R"("[proto2_unittest.TestMixedFieldsAndExtensions.d]":[1,1,2,3,5,8,13]})")); - auto m2 = ToProto<protobuf_unittest::TestAllTypes>(R"json({ + auto m2 = ToProto<proto2_unittest::TestAllTypes>(R"json({ "[this.extension.does.not.exist]": 42 })json"); EXPECT_THAT(m2, StatusIs(absl::StatusCode::kInvalidArgument)); - auto m3 = ToProto<protobuf_unittest::TestAllTypes>(R"json({ - "[protobuf_unittest.TestMixedFieldsAndExtensions.c]": 42 + auto m3 = ToProto<proto2_unittest::TestAllTypes>(R"json({ + "[proto2_unittest.TestMixedFieldsAndExtensions.c]": 42 })json"); EXPECT_THAT(m3, StatusIs(absl::StatusCode::kInvalidArgument)); } diff --git a/third_party/protobuf/src/google/protobuf/late_loaded_option.proto b/third_party/protobuf/src/google/protobuf/late_loaded_option.proto new file mode 100644 index 0000000000000..4c1b492b08c32 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/late_loaded_option.proto @@ -0,0 +1,13 @@ +edition = "2023"; + +package proto2_unittest; + +import "google/protobuf/descriptor.proto"; + +message LateLoadedOption { + int32 value = 1; + + extend google.protobuf.MessageOptions { + LateLoadedOption ext = 95126892; + } +} diff --git a/third_party/protobuf/src/google/protobuf/late_loaded_option_user.proto b/third_party/protobuf/src/google/protobuf/late_loaded_option_user.proto new file mode 100644 index 0000000000000..b27a015fda1ca --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/late_loaded_option_user.proto @@ -0,0 +1,11 @@ +edition = "2023"; + +package proto2_unittest; + +import "google/protobuf/late_loaded_option.proto"; + +message LateLoadedOptionUser { + option (proto2_unittest.LateLoadedOption.ext) = { + value: 1 + }; +} diff --git a/third_party/protobuf/src/google/protobuf/lite_arena_unittest.cc b/third_party/protobuf/src/google/protobuf/lite_arena_unittest.cc index 4ed3aecd8452c..0b7b497c7952a 100644 --- a/third_party/protobuf/src/google/protobuf/lite_arena_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/lite_arena_unittest.cc @@ -38,21 +38,21 @@ TEST_F(LiteArenaTest, MapNoHeapAllocation) { // Map. // internal::NoHeapChecker no_heap; - protobuf_unittest::TestArenaMapLite* from = - Arena::Create<protobuf_unittest::TestArenaMapLite>(arena_.get()); + proto2_unittest::TestArenaMapLite* from = + Arena::Create<proto2_unittest::TestArenaMapLite>(arena_.get()); MapLiteTestUtil::SetArenaMapFields(from); from->SerializeToString(&data); - protobuf_unittest::TestArenaMapLite* to = - Arena::Create<protobuf_unittest::TestArenaMapLite>(arena_.get()); + proto2_unittest::TestArenaMapLite* to = + Arena::Create<proto2_unittest::TestArenaMapLite>(arena_.get()); to->ParseFromString(data); MapLiteTestUtil::ExpectArenaMapFieldsSet(*to); } } TEST_F(LiteArenaTest, UnknownFieldMemLeak) { - protobuf_unittest::ForeignMessageArenaLite* message = - Arena::Create<protobuf_unittest::ForeignMessageArenaLite>(arena_.get()); + proto2_unittest::ForeignMessageArenaLite* message = + Arena::Create<proto2_unittest::ForeignMessageArenaLite>(arena_.get()); std::string data = "\012\000"; int original_capacity = data.capacity(); while (data.capacity() <= original_capacity) { diff --git a/third_party/protobuf/src/google/protobuf/lite_unittest.cc b/third_party/protobuf/src/google/protobuf/lite_unittest.cc index c75099b91756c..264f2d171e5f8 100644 --- a/third_party/protobuf/src/google/protobuf/lite_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/lite_unittest.cc @@ -11,6 +11,7 @@ #include <cstdint> #include <iostream> #include <limits> +#include <memory> #include <string> #include <type_traits> #include <utility> @@ -22,6 +23,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena_test_util.h" +#include "google/protobuf/generated_enum_util.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" @@ -29,6 +31,7 @@ #include "google/protobuf/map_lite_test_util.h" #include "google/protobuf/map_lite_unittest.pb.h" #include "google/protobuf/message_lite.h" +#include "google/protobuf/only_one_enum_test.pb.h" #include "google/protobuf/parse_context.h" #include "google/protobuf/test_util_lite.h" #include "google/protobuf/unittest_lite.pb.h" @@ -80,13 +83,13 @@ bool ParseFrom(const std::string& data, MessageLite& msg) { } bool ParseFrom(const absl::Cord& data, MessageLite& msg) { - return msg.ParseFromCord(data); + return msg.ParseFromString(data); } template <typename T> void SetAllTypesInEmptyMessageUnknownFields( unittest::TestEmptyMessageLite* empty_message) { - protobuf_unittest::TestAllTypesLite message; + proto2_unittest::TestAllTypesLite message; TestUtilLite::ExpectClear(message); TestUtilLite::SetAllFields(&message); T data = SerializeAs<T>(message); @@ -95,7 +98,7 @@ void SetAllTypesInEmptyMessageUnknownFields( void SetSomeTypesInEmptyMessageUnknownFields( unittest::TestEmptyMessageLite* empty_message) { - protobuf_unittest::TestAllTypesLite message; + proto2_unittest::TestAllTypesLite message; TestUtilLite::ExpectClear(message); message.set_optional_int32(101); message.set_optional_int64(102); @@ -175,7 +178,7 @@ TYPED_TEST_SUITE(LiteTest, SerializedDataTypes, TypedTestName); TYPED_TEST(LiteTest, AllLite1) { { - protobuf_unittest::TestAllTypesLite message, message2, message3; + proto2_unittest::TestAllTypesLite message, message2, message3; TestUtilLite::ExpectClear(message); TestUtilLite::SetAllFields(&message); message2 = message; @@ -193,7 +196,7 @@ TYPED_TEST(LiteTest, AllLite1) { TYPED_TEST(LiteTest, AllLite2) { { - protobuf_unittest::TestAllExtensionsLite message, message2, message3; + proto2_unittest::TestAllExtensionsLite message, message2, message3; TestUtilLite::ExpectExtensionsClear(message); TestUtilLite::SetAllExtensions(&message); message2 = message; @@ -213,7 +216,7 @@ TYPED_TEST(LiteTest, AllLite3) { TypeParam data, packed_data; { - protobuf_unittest::TestPackedTypesLite message, message2, message3; + proto2_unittest::TestPackedTypesLite message, message2, message3; TestUtilLite::ExpectPackedClear(message); TestUtilLite::SetPackedFields(&message); message2 = message; @@ -229,7 +232,7 @@ TYPED_TEST(LiteTest, AllLite3) { } { - protobuf_unittest::TestPackedExtensionsLite message, message2, message3; + proto2_unittest::TestPackedExtensionsLite message, message2, message3; TestUtilLite::ExpectPackedExtensionsClear(message); TestUtilLite::SetPackedExtensions(&message); message2 = message; @@ -309,8 +312,8 @@ TYPED_TEST(LiteTest, AllLite6) { // Test unknown fields support for lite messages. { - protobuf_unittest::TestAllTypesLite message, message2; - protobuf_unittest::TestEmptyMessageLite empty_message; + proto2_unittest::TestAllTypesLite message, message2; + proto2_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectClear(message); TestUtilLite::SetAllFields(&message); data = SerializeAs<TypeParam>(message); @@ -328,8 +331,8 @@ TYPED_TEST(LiteTest, AllLite7) { TypeParam data; { - protobuf_unittest::TestAllExtensionsLite message, message2; - protobuf_unittest::TestEmptyMessageLite empty_message; + proto2_unittest::TestAllExtensionsLite message, message2; + proto2_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectExtensionsClear(message); TestUtilLite::SetAllExtensions(&message); data = SerializeAs<TypeParam>(message); @@ -347,8 +350,8 @@ TYPED_TEST(LiteTest, AllLite8) { TypeParam data; { - protobuf_unittest::TestPackedTypesLite message, message2; - protobuf_unittest::TestEmptyMessageLite empty_message; + proto2_unittest::TestPackedTypesLite message, message2; + proto2_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectPackedClear(message); TestUtilLite::SetPackedFields(&message); data = SerializeAs<TypeParam>(message); @@ -366,8 +369,8 @@ TYPED_TEST(LiteTest, AllLite9) { TypeParam data; { - protobuf_unittest::TestPackedExtensionsLite message, message2; - protobuf_unittest::TestEmptyMessageLite empty_message; + proto2_unittest::TestPackedExtensionsLite message, message2; + proto2_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectPackedExtensionsClear(message); TestUtilLite::SetPackedExtensions(&message); data = SerializeAs<TypeParam>(message); @@ -386,7 +389,7 @@ TYPED_TEST(LiteTest, AllLite10) { { // Test Unknown fields swap - protobuf_unittest::TestEmptyMessageLite empty_message, empty_message2; + proto2_unittest::TestEmptyMessageLite empty_message, empty_message2; SetAllTypesInEmptyMessageUnknownFields<TypeParam>(&empty_message); SetSomeTypesInEmptyMessageUnknownFields(&empty_message2); data = SerializeAs<TypeParam>(empty_message); @@ -402,7 +405,7 @@ TYPED_TEST(LiteTest, AllLite11) { { // Test unknown fields swap with self - protobuf_unittest::TestEmptyMessageLite empty_message; + proto2_unittest::TestEmptyMessageLite empty_message; SetAllTypesInEmptyMessageUnknownFields<TypeParam>(&empty_message); data = SerializeAs<TypeParam>(empty_message); empty_message.Swap(&empty_message); @@ -415,8 +418,8 @@ TYPED_TEST(LiteTest, AllLite12) { { // Test MergeFrom with unknown fields - protobuf_unittest::TestAllTypesLite message, message2; - protobuf_unittest::TestEmptyMessageLite empty_message, empty_message2; + proto2_unittest::TestAllTypesLite message, message2; + proto2_unittest::TestEmptyMessageLite empty_message, empty_message2; message.set_optional_int32(101); message.add_repeated_int32(201); message.set_optional_nested_enum(unittest::TestAllTypesLite::BAZ); @@ -446,17 +449,17 @@ TYPED_TEST(LiteTest, AllLite13StringStream) { { // Test unknown enum value - protobuf_unittest::TestAllTypesLite message; + proto2_unittest::TestAllTypesLite message; std::string buffer; { io::StringOutputStream output_stream(&buffer); io::CodedOutputStream coded_output(&output_stream); internal::WireFormatLite::WriteTag( - protobuf_unittest::TestAllTypesLite::kOptionalNestedEnumFieldNumber, + proto2_unittest::TestAllTypesLite::kOptionalNestedEnumFieldNumber, internal::WireFormatLite::WIRETYPE_VARINT, &coded_output); coded_output.WriteVarint32(10); internal::WireFormatLite::WriteTag( - protobuf_unittest::TestAllTypesLite::kRepeatedNestedEnumFieldNumber, + proto2_unittest::TestAllTypesLite::kRepeatedNestedEnumFieldNumber, internal::WireFormatLite::WIRETYPE_VARINT, &coded_output); coded_output.WriteVarint32(20); } @@ -471,21 +474,21 @@ TYPED_TEST(LiteTest, AllLite13CordStream) { { // Test unknown enum value - protobuf_unittest::TestAllTypesLite message; + proto2_unittest::TestAllTypesLite message; io::CordOutputStream output_stream; { io::CodedOutputStream coded_output(&output_stream); internal::WireFormatLite::WriteTag( - protobuf_unittest::TestAllTypesLite::kOptionalNestedEnumFieldNumber, + proto2_unittest::TestAllTypesLite::kOptionalNestedEnumFieldNumber, internal::WireFormatLite::WIRETYPE_VARINT, &coded_output); coded_output.WriteVarint32(10); internal::WireFormatLite::WriteTag( - protobuf_unittest::TestAllTypesLite::kRepeatedNestedEnumFieldNumber, + proto2_unittest::TestAllTypesLite::kRepeatedNestedEnumFieldNumber, internal::WireFormatLite::WIRETYPE_VARINT, &coded_output); coded_output.WriteVarint32(20); } absl::Cord buffer = output_stream.Consume(); - message.ParseFromCord(buffer); + message.ParseFromString(buffer); data = SerializeAs<TypeParam>(message); EXPECT_EQ(data, buffer); } @@ -494,7 +497,7 @@ TYPED_TEST(LiteTest, AllLite13CordStream) { TYPED_TEST(LiteTest, AllLite14) { { // Test Clear with unknown fields - protobuf_unittest::TestEmptyMessageLite empty_message; + proto2_unittest::TestEmptyMessageLite empty_message; SetAllTypesInEmptyMessageUnknownFields<TypeParam>(&empty_message); empty_message.Clear(); EXPECT_EQ(0, empty_message.unknown_fields().size()); @@ -506,7 +509,7 @@ TYPED_TEST(LiteTest, AllLite14) { TEST(LiteBasicTest, AllLite15) { { // Accessors - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; MapLiteTestUtil::SetMapFields(&message); MapLiteTestUtil::ExpectMapFieldsSet(message); @@ -519,7 +522,7 @@ TEST(LiteBasicTest, AllLite15) { TYPED_TEST(LiteTest, AllLite16) { { // SetMapFieldsInitialized - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; MapLiteTestUtil::SetMapFieldsInitialized(&message); MapLiteTestUtil::ExpectMapFieldsSetInitialized(message); @@ -529,7 +532,7 @@ TYPED_TEST(LiteTest, AllLite16) { TEST(LiteBasicTest, AllLite17) { { // Clear - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; MapLiteTestUtil::SetMapFields(&message); message.Clear(); @@ -540,7 +543,7 @@ TEST(LiteBasicTest, AllLite17) { TEST(LiteBasicTest, AllLite18) { { // ClearMessageMap - protobuf_unittest::TestMessageMapLite message; + proto2_unittest::TestMessageMapLite message; // Creates a TestAllTypes with default value TestUtilLite::ExpectClear((*message.mutable_map_int32_message())[0]); @@ -550,7 +553,7 @@ TEST(LiteBasicTest, AllLite18) { TEST(LiteBasicTest, AllLite19) { { // CopyFrom - protobuf_unittest::TestMapLite message1, message2; + proto2_unittest::TestMapLite message1, message2; MapLiteTestUtil::SetMapFields(&message1); message2.CopyFrom(message1); // NOLINT @@ -565,7 +568,7 @@ TEST(LiteBasicTest, AllLite19) { TEST(LiteBasicTest, AllLite20) { { // CopyFromMessageMap - protobuf_unittest::TestMessageMapLite message1, message2; + proto2_unittest::TestMessageMapLite message1, message2; (*message1.mutable_map_int32_message())[0].add_repeated_int32(100); (*message2.mutable_map_int32_message())[0].add_repeated_int32(101); @@ -581,7 +584,7 @@ TEST(LiteBasicTest, AllLite20) { TEST(LiteBasicTest, AllLite21) { { // SwapWithEmpty - protobuf_unittest::TestMapLite message1, message2; + proto2_unittest::TestMapLite message1, message2; MapLiteTestUtil::SetMapFields(&message1); MapLiteTestUtil::ExpectMapFieldsSet(message1); @@ -596,7 +599,7 @@ TEST(LiteBasicTest, AllLite21) { TEST(LiteBasicTest, AllLite22) { { // SwapWithSelf - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; MapLiteTestUtil::SetMapFields(&message); MapLiteTestUtil::ExpectMapFieldsSet(message); @@ -609,7 +612,7 @@ TEST(LiteBasicTest, AllLite22) { TEST(LiteBasicTest, AllLite23) { { // SwapWithOther - protobuf_unittest::TestMapLite message1, message2; + proto2_unittest::TestMapLite message1, message2; MapLiteTestUtil::SetMapFields(&message1); MapLiteTestUtil::SetMapFields(&message2); @@ -624,10 +627,10 @@ TEST(LiteBasicTest, AllLite23) { TEST(LiteBasicTest, AllLite24) { { // CopyConstructor - protobuf_unittest::TestMapLite message1; + proto2_unittest::TestMapLite message1; MapLiteTestUtil::SetMapFields(&message1); - protobuf_unittest::TestMapLite message2(message1); + proto2_unittest::TestMapLite message2(message1); MapLiteTestUtil::ExpectMapFieldsSet(message2); } } @@ -635,10 +638,10 @@ TEST(LiteBasicTest, AllLite24) { TEST(LiteBasicTest, AllLite25) { { // CopyAssignmentOperator - protobuf_unittest::TestMapLite message1; + proto2_unittest::TestMapLite message1; MapLiteTestUtil::SetMapFields(&message1); - protobuf_unittest::TestMapLite message2; + proto2_unittest::TestMapLite message2; message2 = message1; MapLiteTestUtil::ExpectMapFieldsSet(message2); @@ -651,7 +654,7 @@ TEST(LiteBasicTest, AllLite25) { TEST(LiteBasicTest, AllLite26) { { // NonEmptyMergeFrom - protobuf_unittest::TestMapLite message1, message2; + proto2_unittest::TestMapLite message1, message2; MapLiteTestUtil::SetMapFields(&message1); @@ -671,7 +674,7 @@ TEST(LiteBasicTest, AllLite26) { TYPED_TEST(LiteTest, AllLite27) { { // MergeFromMessageMap - protobuf_unittest::TestMessageMapLite message1, message2; + proto2_unittest::TestMessageMapLite message1, message2; (*message1.mutable_map_int32_message())[0].add_repeated_int32(100); (*message2.mutable_map_int32_message())[0].add_repeated_int32(101); @@ -687,7 +690,7 @@ TYPED_TEST(LiteTest, AllLite27) { TEST(LiteStringTest, AllLite28) { { // Test the generated SerializeWithCachedSizesToArray() - protobuf_unittest::TestMapLite message1, message2; + proto2_unittest::TestMapLite message1, message2; std::string data; MapLiteTestUtil::SetMapFields(&message1); size_t size = message1.ByteSizeLong(); @@ -703,7 +706,7 @@ TEST(LiteStringTest, AllLite28) { TEST(LiteStreamTest, AllLite29) { { // Test the generated SerializeWithCachedSizes() - protobuf_unittest::TestMapLite message1, message2; + proto2_unittest::TestMapLite message1, message2; MapLiteTestUtil::SetMapFields(&message1); size_t size = message1.ByteSizeLong(); std::string data; @@ -725,30 +728,30 @@ TEST(LiteStreamTest, AllLite29) { TYPED_TEST(LiteTest, AllLite32) { { // Proto2UnknownEnum - protobuf_unittest::TestEnumMapPlusExtraLite from; + proto2_unittest::TestEnumMapPlusExtraLite from; (*from.mutable_known_map_field())[0] = - protobuf_unittest::E_PROTO2_MAP_ENUM_FOO_LITE; + proto2_unittest::E_PROTO2_MAP_ENUM_FOO_LITE; (*from.mutable_unknown_map_field())[0] = - protobuf_unittest::E_PROTO2_MAP_ENUM_EXTRA_LITE; + proto2_unittest::E_PROTO2_MAP_ENUM_EXTRA_LITE; TypeParam data; data = SerializeAs<TypeParam>(from); - protobuf_unittest::TestEnumMapLite to; + proto2_unittest::TestEnumMapLite to; EXPECT_TRUE(ParseFrom(data, to)); EXPECT_EQ(0, to.unknown_map_field().size()); EXPECT_FALSE(to.mutable_unknown_fields()->empty()); ASSERT_EQ(1, to.known_map_field().size()); - EXPECT_EQ(protobuf_unittest::PROTO2_MAP_ENUM_FOO_LITE, + EXPECT_EQ(proto2_unittest::PROTO2_MAP_ENUM_FOO_LITE, to.known_map_field().at(0)); from.Clear(); data = SerializeAs<TypeParam>(to); EXPECT_TRUE(ParseFrom(data, from)); ASSERT_EQ(1, from.known_map_field().size()); - EXPECT_EQ(protobuf_unittest::E_PROTO2_MAP_ENUM_FOO_LITE, + EXPECT_EQ(proto2_unittest::E_PROTO2_MAP_ENUM_FOO_LITE, from.known_map_field().at(0)); ASSERT_EQ(1, from.unknown_map_field().size()); - EXPECT_EQ(protobuf_unittest::E_PROTO2_MAP_ENUM_EXTRA_LITE, + EXPECT_EQ(proto2_unittest::E_PROTO2_MAP_ENUM_EXTRA_LITE, from.unknown_map_field().at(0)); } } @@ -756,7 +759,7 @@ TYPED_TEST(LiteTest, AllLite32) { TYPED_TEST(LiteTest, AllLite33) { { // StandardWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; std::string data = "\x0A\x04\x08\x01\x10\x01"; EXPECT_TRUE(message.ParseFromString(data)); @@ -768,7 +771,7 @@ TYPED_TEST(LiteTest, AllLite33) { TYPED_TEST(LiteTest, AllLite34) { { // UnorderedWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; // put value before key in wire format std::string data = "\x0A\x04\x10\x01\x08\x02"; @@ -786,7 +789,7 @@ TYPED_TEST(LiteTest, AllLite35) { { // DuplicatedKeyWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; // Two key fields in wire format std::string data = "\x0A\x06\x08\x01\x08\x02\x10\x01"; @@ -802,7 +805,7 @@ TYPED_TEST(LiteTest, AllLite36) { { // DuplicatedValueWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; // Two value fields in wire format std::string data = "\x0A\x06\x08\x01\x10\x01\x10\x02"; @@ -816,7 +819,7 @@ TYPED_TEST(LiteTest, AllLite36) { TYPED_TEST(LiteTest, AllLite37) { { // MissedKeyWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; // No key field in wire format std::string data = "\x0A\x02\x10\x01"; @@ -834,7 +837,7 @@ TYPED_TEST(LiteTest, AllLite38) { { // MissedValueWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; // No value field in wire format std::string data = "\x0A\x02\x08\x01"; @@ -850,7 +853,7 @@ TYPED_TEST(LiteTest, AllLite38) { TYPED_TEST(LiteTest, AllLite39) { { // UnknownFieldWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; // Unknown field in wire format std::string data = "\x0A\x06\x08\x02\x10\x03\x18\x01"; @@ -864,7 +867,7 @@ TYPED_TEST(LiteTest, AllLite39) { TYPED_TEST(LiteTest, AllLite40) { { // CorruptedWireFormat - protobuf_unittest::TestMapLite message; + proto2_unittest::TestMapLite message; // corrupted data in wire format std::string data = "\x0A\x06\x08\x02\x11\x03"; @@ -876,7 +879,7 @@ TYPED_TEST(LiteTest, AllLite40) { TYPED_TEST(LiteTest, AllLite41) { { // IsInitialized - protobuf_unittest::TestRequiredMessageMapLite map_message; + proto2_unittest::TestRequiredMessageMapLite map_message; // Add an uninitialized message. (*map_message.mutable_map_field())[0]; @@ -894,24 +897,24 @@ TYPED_TEST(LiteTest, AllLite42) { { // Check that adding more values to enum does not corrupt message // when passed through an old client. - protobuf_unittest::V2MessageLite v2_message; + proto2_unittest::V2MessageLite v2_message; v2_message.set_int_field(800); // Set enum field to the value not understood by the old client. - v2_message.set_enum_field(protobuf_unittest::V2_SECOND); + v2_message.set_enum_field(proto2_unittest::V2_SECOND); std::string v2_bytes = v2_message.SerializeAsString(); - protobuf_unittest::V1MessageLite v1_message; + proto2_unittest::V1MessageLite v1_message; v1_message.ParseFromString(v2_bytes); EXPECT_TRUE(v1_message.IsInitialized()); EXPECT_EQ(v1_message.int_field(), v2_message.int_field()); // V1 client does not understand V2_SECOND value, so it discards it and // uses default value instead. - EXPECT_EQ(v1_message.enum_field(), protobuf_unittest::V1_FIRST); + EXPECT_EQ(v1_message.enum_field(), proto2_unittest::V1_FIRST); // However, when re-serialized, it should preserve enum value. std::string v1_bytes = v1_message.SerializeAsString(); - protobuf_unittest::V2MessageLite same_v2_message; + proto2_unittest::V2MessageLite same_v2_message; same_v2_message.ParseFromString(v1_bytes); EXPECT_EQ(v2_message.int_field(), same_v2_message.int_field()); @@ -922,7 +925,7 @@ TYPED_TEST(LiteTest, AllLite42) { // Test that when parsing a oneof, we can successfully clear whatever already // happened to be stored in the oneof. TYPED_TEST(LiteTest, AllLite43) { - protobuf_unittest::TestOneofParsingLite message1; + proto2_unittest::TestOneofParsingLite message1; message1.set_oneof_int32(17); std::string serialized; @@ -930,7 +933,7 @@ TYPED_TEST(LiteTest, AllLite43) { // Submessage { - protobuf_unittest::TestOneofParsingLite message2; + proto2_unittest::TestOneofParsingLite message2; message2.mutable_oneof_submessage(); io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -941,7 +944,7 @@ TYPED_TEST(LiteTest, AllLite43) { // String { - protobuf_unittest::TestOneofParsingLite message2; + proto2_unittest::TestOneofParsingLite message2; message2.set_oneof_string("string"); io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -952,7 +955,7 @@ TYPED_TEST(LiteTest, AllLite43) { // Bytes { - protobuf_unittest::TestOneofParsingLite message2; + proto2_unittest::TestOneofParsingLite message2; message2.set_oneof_bytes("bytes"); io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -963,7 +966,7 @@ TYPED_TEST(LiteTest, AllLite43) { // Bytes [ctype = CORD] { - protobuf_unittest::TestOneofParsingLite message2; + proto2_unittest::TestOneofParsingLite message2; message2.set_oneof_bytes_cord("bytes cord"); io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -980,11 +983,11 @@ TYPED_TEST(LiteTest, AllLite43) { TYPED_TEST(LiteTest, AllLite44) { // Int32 { - protobuf_unittest::TestOneofParsingLite original; + proto2_unittest::TestOneofParsingLite original; original.set_oneof_int32(17); std::string serialized; EXPECT_TRUE(original.SerializeToString(&serialized)); - protobuf_unittest::TestOneofParsingLite parsed; + proto2_unittest::TestOneofParsingLite parsed; for (int i = 0; i < 2; ++i) { io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -996,11 +999,11 @@ TYPED_TEST(LiteTest, AllLite44) { // Submessage { - protobuf_unittest::TestOneofParsingLite original; + proto2_unittest::TestOneofParsingLite original; original.mutable_oneof_submessage()->set_optional_int32(5); std::string serialized; EXPECT_TRUE(original.SerializeToString(&serialized)); - protobuf_unittest::TestOneofParsingLite parsed; + proto2_unittest::TestOneofParsingLite parsed; for (int i = 0; i < 2; ++i) { io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -1012,11 +1015,11 @@ TYPED_TEST(LiteTest, AllLite44) { // String { - protobuf_unittest::TestOneofParsingLite original; + proto2_unittest::TestOneofParsingLite original; original.set_oneof_string("string"); std::string serialized; EXPECT_TRUE(original.SerializeToString(&serialized)); - protobuf_unittest::TestOneofParsingLite parsed; + proto2_unittest::TestOneofParsingLite parsed; for (int i = 0; i < 2; ++i) { io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -1028,11 +1031,11 @@ TYPED_TEST(LiteTest, AllLite44) { // Bytes { - protobuf_unittest::TestOneofParsingLite original; + proto2_unittest::TestOneofParsingLite original; original.set_oneof_bytes("bytes"); std::string serialized; EXPECT_TRUE(original.SerializeToString(&serialized)); - protobuf_unittest::TestOneofParsingLite parsed; + proto2_unittest::TestOneofParsingLite parsed; for (int i = 0; i < 2; ++i) { io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), @@ -1044,27 +1047,27 @@ TYPED_TEST(LiteTest, AllLite44) { // Enum { - protobuf_unittest::TestOneofParsingLite original; - original.set_oneof_enum(protobuf_unittest::V2_SECOND); + proto2_unittest::TestOneofParsingLite original; + original.set_oneof_enum(proto2_unittest::V2_SECOND); std::string serialized; EXPECT_TRUE(original.SerializeToString(&serialized)); - protobuf_unittest::TestOneofParsingLite parsed; + proto2_unittest::TestOneofParsingLite parsed; for (int i = 0; i < 2; ++i) { io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(serialized.data()), serialized.size()); EXPECT_TRUE(parsed.MergeFromCodedStream(&input_stream)); - EXPECT_EQ(protobuf_unittest::V2_SECOND, parsed.oneof_enum()); + EXPECT_EQ(proto2_unittest::V2_SECOND, parsed.oneof_enum()); } } // Bytes [ctype = CORD] { - protobuf_unittest::TestOneofParsingLite original; + proto2_unittest::TestOneofParsingLite original; original.set_oneof_bytes_cord("bytes cord"); std::string serialized; EXPECT_TRUE(original.SerializeToString(&serialized)); - protobuf_unittest::TestOneofParsingLite parsed; + proto2_unittest::TestOneofParsingLite parsed; EXPECT_TRUE(parsed.MergeFromString(serialized)); EXPECT_EQ("bytes cord", std::string(parsed.oneof_bytes_cord())); EXPECT_TRUE(parsed.MergeFromString(serialized)); @@ -1077,7 +1080,7 @@ TYPED_TEST(LiteTest, AllLite45) { // Test unknown fields are not discarded upon parsing. std::string data = "\20\1"; // varint 1 with field number 2 - protobuf_unittest::ForeignMessageLite a; + proto2_unittest::ForeignMessageLite a; EXPECT_TRUE(a.ParseFromString(data)); io::CodedInputStream input_stream( reinterpret_cast<const ::uint8_t*>(data.data()), data.size()); @@ -1096,24 +1099,24 @@ TYPED_TEST(LiteTest, AllLite45) { // making sure we can parse repeated fields when the tag is higher than we would // expect. TYPED_TEST(LiteTest, AllLite46) { - protobuf_unittest::PackedInt32 packed; + proto2_unittest::PackedInt32 packed; packed.add_repeated_int32(42); std::string serialized; ASSERT_TRUE(packed.SerializeToString(&serialized)); - protobuf_unittest::NonPackedInt32 non_packed; + proto2_unittest::NonPackedInt32 non_packed; ASSERT_TRUE(non_packed.ParseFromString(serialized)); ASSERT_EQ(1, non_packed.repeated_int32_size()); EXPECT_EQ(42, non_packed.repeated_int32(0)); } TYPED_TEST(LiteTest, AllLite47) { - protobuf_unittest::NonPackedFixed32 non_packed; + proto2_unittest::NonPackedFixed32 non_packed; non_packed.add_repeated_fixed32(42); std::string serialized; ASSERT_TRUE(non_packed.SerializeToString(&serialized)); - protobuf_unittest::PackedFixed32 packed; + proto2_unittest::PackedFixed32 packed; ASSERT_TRUE(packed.ParseFromString(serialized)); ASSERT_EQ(1, packed.repeated_fixed32_size()); EXPECT_EQ(42, packed.repeated_fixed32(0)); @@ -1122,7 +1125,7 @@ TYPED_TEST(LiteTest, AllLite47) { TYPED_TEST(LiteTest, MapCrash) { // See b/113635730 Arena arena; - auto msg = Arena::Create<protobuf_unittest::TestMapLite>(&arena); + auto msg = Arena::Create<proto2_unittest::TestMapLite>(&arena); // Payload for the map<string, Enum> with a enum varint that's longer > // 10 bytes. This causes a parse fail and a subsequent delete. field 16 // (map<int32, MapEnumLite>) tag = 128+2 = \202 \1 @@ -1134,7 +1137,7 @@ TYPED_TEST(LiteTest, MapCrash) { } TYPED_TEST(LiteTest, CorrectEnding) { - protobuf_unittest::TestAllTypesLite msg; + proto2_unittest::TestAllTypesLite msg; { // All proto wireformat parsers should act the same on parsing data in as // much as it concerns the parsing, ie. not the interpretation of the data. @@ -1164,7 +1167,7 @@ TYPED_TEST(LiteTest, CorrectEnding) { } TYPED_TEST(LiteTest, DebugString) { - protobuf_unittest::TestAllTypesLite message1, message2; + proto2_unittest::TestAllTypesLite message1, message2; EXPECT_TRUE(absl::StartsWith(message1.DebugString(), "MessageLite at 0x")); EXPECT_TRUE(absl::StartsWith(message2.DebugString(), "MessageLite at 0x")); @@ -1180,104 +1183,104 @@ TYPED_TEST(LiteTest, DebugString) { TYPED_TEST(LiteTest, EnumValueToName) { - EXPECT_EQ("FOREIGN_LITE_FOO", protobuf_unittest::ForeignEnumLite_Name( - protobuf_unittest::FOREIGN_LITE_FOO)); - EXPECT_EQ("FOREIGN_LITE_BAR", protobuf_unittest::ForeignEnumLite_Name( - protobuf_unittest::FOREIGN_LITE_BAR)); - EXPECT_EQ("FOREIGN_LITE_BAZ", protobuf_unittest::ForeignEnumLite_Name( - protobuf_unittest::FOREIGN_LITE_BAZ)); - EXPECT_EQ("", protobuf_unittest::ForeignEnumLite_Name(0)); - EXPECT_EQ("", protobuf_unittest::ForeignEnumLite_Name(999)); + EXPECT_EQ("FOREIGN_LITE_FOO", proto2_unittest::ForeignEnumLite_Name( + proto2_unittest::FOREIGN_LITE_FOO)); + EXPECT_EQ("FOREIGN_LITE_BAR", proto2_unittest::ForeignEnumLite_Name( + proto2_unittest::FOREIGN_LITE_BAR)); + EXPECT_EQ("FOREIGN_LITE_BAZ", proto2_unittest::ForeignEnumLite_Name( + proto2_unittest::FOREIGN_LITE_BAZ)); + EXPECT_EQ("", proto2_unittest::ForeignEnumLite_Name(0)); + EXPECT_EQ("", proto2_unittest::ForeignEnumLite_Name(999)); } TYPED_TEST(LiteTest, NestedEnumValueToName) { - EXPECT_EQ("FOO", protobuf_unittest::TestAllTypesLite::NestedEnum_Name( - protobuf_unittest::TestAllTypesLite::FOO)); - EXPECT_EQ("BAR", protobuf_unittest::TestAllTypesLite::NestedEnum_Name( - protobuf_unittest::TestAllTypesLite::BAR)); - EXPECT_EQ("BAZ", protobuf_unittest::TestAllTypesLite::NestedEnum_Name( - protobuf_unittest::TestAllTypesLite::BAZ)); - EXPECT_EQ("", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(0)); - EXPECT_EQ("", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(999)); + EXPECT_EQ("FOO", proto2_unittest::TestAllTypesLite::NestedEnum_Name( + proto2_unittest::TestAllTypesLite::FOO)); + EXPECT_EQ("BAR", proto2_unittest::TestAllTypesLite::NestedEnum_Name( + proto2_unittest::TestAllTypesLite::BAR)); + EXPECT_EQ("BAZ", proto2_unittest::TestAllTypesLite::NestedEnum_Name( + proto2_unittest::TestAllTypesLite::BAZ)); + EXPECT_EQ("", proto2_unittest::TestAllTypesLite::NestedEnum_Name(0)); + EXPECT_EQ("", proto2_unittest::TestAllTypesLite::NestedEnum_Name(999)); } TYPED_TEST(LiteTest, EnumNameToValue) { - protobuf_unittest::ForeignEnumLite value; + proto2_unittest::ForeignEnumLite value; ASSERT_TRUE( - protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_FOO", &value)); - EXPECT_EQ(protobuf_unittest::FOREIGN_LITE_FOO, value); + proto2_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_FOO", &value)); + EXPECT_EQ(proto2_unittest::FOREIGN_LITE_FOO, value); ASSERT_TRUE( - protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_BAR", &value)); - EXPECT_EQ(protobuf_unittest::FOREIGN_LITE_BAR, value); + proto2_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_BAR", &value)); + EXPECT_EQ(proto2_unittest::FOREIGN_LITE_BAR, value); ASSERT_TRUE( - protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_BAZ", &value)); - EXPECT_EQ(protobuf_unittest::FOREIGN_LITE_BAZ, value); + proto2_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_BAZ", &value)); + EXPECT_EQ(proto2_unittest::FOREIGN_LITE_BAZ, value); // Non-existent values - EXPECT_FALSE(protobuf_unittest::ForeignEnumLite_Parse("E", &value)); + EXPECT_FALSE(proto2_unittest::ForeignEnumLite_Parse("E", &value)); EXPECT_FALSE( - protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_C", &value)); - EXPECT_FALSE(protobuf_unittest::ForeignEnumLite_Parse("G", &value)); + proto2_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_C", &value)); + EXPECT_FALSE(proto2_unittest::ForeignEnumLite_Parse("G", &value)); } TYPED_TEST(LiteTest, NestedEnumNameToValue) { - protobuf_unittest::TestAllTypesLite::NestedEnum value; + proto2_unittest::TestAllTypesLite::NestedEnum value; ASSERT_TRUE( - protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("FOO", &value)); - EXPECT_EQ(protobuf_unittest::TestAllTypesLite::FOO, value); + proto2_unittest::TestAllTypesLite::NestedEnum_Parse("FOO", &value)); + EXPECT_EQ(proto2_unittest::TestAllTypesLite::FOO, value); ASSERT_TRUE( - protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("BAR", &value)); - EXPECT_EQ(protobuf_unittest::TestAllTypesLite::BAR, value); + proto2_unittest::TestAllTypesLite::NestedEnum_Parse("BAR", &value)); + EXPECT_EQ(proto2_unittest::TestAllTypesLite::BAR, value); ASSERT_TRUE( - protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("BAZ", &value)); - EXPECT_EQ(protobuf_unittest::TestAllTypesLite::BAZ, value); + proto2_unittest::TestAllTypesLite::NestedEnum_Parse("BAZ", &value)); + EXPECT_EQ(proto2_unittest::TestAllTypesLite::BAZ, value); // Non-existent values EXPECT_FALSE( - protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("A", &value)); + proto2_unittest::TestAllTypesLite::NestedEnum_Parse("A", &value)); EXPECT_FALSE( - protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("C", &value)); + proto2_unittest::TestAllTypesLite::NestedEnum_Parse("C", &value)); EXPECT_FALSE( - protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("G", &value)); + proto2_unittest::TestAllTypesLite::NestedEnum_Parse("G", &value)); } TYPED_TEST(LiteTest, AliasedEnum) { // Enums with allow_alias = true can have multiple entries with the same // value. - EXPECT_EQ("FOO1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name( - protobuf_unittest::DupEnum::FOO1)); - EXPECT_EQ("FOO1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name( - protobuf_unittest::DupEnum::FOO2)); - EXPECT_EQ("BAR1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name( - protobuf_unittest::DupEnum::BAR1)); - EXPECT_EQ("BAR1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name( - protobuf_unittest::DupEnum::BAR2)); - EXPECT_EQ("BAZ", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name( - protobuf_unittest::DupEnum::BAZ)); - EXPECT_EQ("", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name(999)); + EXPECT_EQ("FOO1", proto2_unittest::DupEnum::TestEnumWithDupValueLite_Name( + proto2_unittest::DupEnum::FOO1)); + EXPECT_EQ("FOO1", proto2_unittest::DupEnum::TestEnumWithDupValueLite_Name( + proto2_unittest::DupEnum::FOO2)); + EXPECT_EQ("BAR1", proto2_unittest::DupEnum::TestEnumWithDupValueLite_Name( + proto2_unittest::DupEnum::BAR1)); + EXPECT_EQ("BAR1", proto2_unittest::DupEnum::TestEnumWithDupValueLite_Name( + proto2_unittest::DupEnum::BAR2)); + EXPECT_EQ("BAZ", proto2_unittest::DupEnum::TestEnumWithDupValueLite_Name( + proto2_unittest::DupEnum::BAZ)); + EXPECT_EQ("", proto2_unittest::DupEnum::TestEnumWithDupValueLite_Name(999)); - protobuf_unittest::DupEnum::TestEnumWithDupValueLite value; + proto2_unittest::DupEnum::TestEnumWithDupValueLite value; ASSERT_TRUE( - protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Parse("FOO1", &value)); - EXPECT_EQ(protobuf_unittest::DupEnum::FOO1, value); + proto2_unittest::DupEnum::TestEnumWithDupValueLite_Parse("FOO1", &value)); + EXPECT_EQ(proto2_unittest::DupEnum::FOO1, value); - value = static_cast<protobuf_unittest::DupEnum::TestEnumWithDupValueLite>(0); + value = static_cast<proto2_unittest::DupEnum::TestEnumWithDupValueLite>(0); ASSERT_TRUE( - protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Parse("FOO2", &value)); - EXPECT_EQ(protobuf_unittest::DupEnum::FOO2, value); + proto2_unittest::DupEnum::TestEnumWithDupValueLite_Parse("FOO2", &value)); + EXPECT_EQ(proto2_unittest::DupEnum::FOO2, value); } TEST(LiteBasicTest, CodedInputStreamRollback) { { - protobuf_unittest::TestAllTypesLite m; + proto2_unittest::TestAllTypesLite m; m.set_optional_bytes(std::string(30, 'a')); std::string serialized = m.SerializeAsString(); serialized += '\014'; @@ -1299,7 +1302,7 @@ TEST(LiteBasicTest, CodedInputStreamRollback) { EXPECT_EQ(memcmp(data, " ", 3), 0); } { - protobuf_unittest::TestPackedTypesLite m; + proto2_unittest::TestPackedTypesLite m; constexpr int kCount = 30; for (int i = 0; i < kCount; i++) m.add_packed_fixed32(i); std::string serialized = m.SerializeAsString(); @@ -1325,7 +1328,7 @@ TEST(LiteBasicTest, CodedInputStreamRollback) { EXPECT_EQ(memcmp(data, " ", 3), 0); } { - protobuf_unittest::TestPackedTypesLite m; + proto2_unittest::TestPackedTypesLite m; constexpr int kCount = 30; // Make sure we output 2 byte varints for (int i = 0; i < kCount; i++) m.add_packed_fixed32(128 + i); @@ -1354,8 +1357,8 @@ TEST(LiteBasicTest, CodedInputStreamRollback) { } // Two arbitrary types -using CastType1 = protobuf_unittest::TestAllTypesLite; -using CastType2 = protobuf_unittest::TestPackedTypesLite; +using CastType1 = proto2_unittest::TestAllTypesLite; +using CastType2 = proto2_unittest::TestPackedTypesLite; TEST(LiteTest, DynamicCastMessage) { CastType1 test_type_1; @@ -1381,18 +1384,36 @@ TEST(LiteTest, DynamicCastMessage) { const MessageLite& test_type_1_pointer_const_ref = test_type_1; EXPECT_EQ(&test_type_1, &DynamicCastMessage<CastType1>(test_type_1_pointer_const_ref)); + + std::shared_ptr<MessageLite> shared(new CastType1); + EXPECT_EQ(1, shared.use_count()); + std::shared_ptr<CastType1> shared_1 = DynamicCastMessage<CastType1>(shared); + // Check that both shared_ptr instances are pointing to the same control + // block by checking use_count(). + EXPECT_EQ(2, shared.use_count()); + EXPECT_EQ(shared_1.get(), shared.get()); + std::shared_ptr<CastType2> shared_2 = DynamicCastMessage<CastType2>(shared); + EXPECT_EQ(2, shared.use_count()); + EXPECT_EQ(shared_2, nullptr); } -#if GTEST_HAS_DEATH_TEST TEST(LiteTest, DynamicCastMessageInvalidReferenceType) { CastType1 test_type_1; const MessageLite& test_type_1_pointer_const_ref = test_type_1; +#if defined(ABSL_HAVE_EXCEPTIONS) + EXPECT_THROW(DynamicCastMessage<CastType2>(test_type_1_pointer_const_ref), + std::bad_cast); +#elif defined(GTEST_HAS_DEATH_TEST) ASSERT_DEATH( DynamicCastMessage<CastType2>(test_type_1_pointer_const_ref), absl::StrCat("Cannot downcast ", test_type_1.GetTypeName(), " to ", CastType2::default_instance().GetTypeName())); +#else + (void)test_type_1; + (void)test_type_1_pointer_const_ref; + GTEST_SKIP() << "Can't test the failure."; +#endif } -#endif // GTEST_HAS_DEATH_TEST TEST(LiteTest, DownCastMessageValidType) { CastType1 test_type_1; @@ -1439,6 +1460,19 @@ TEST(LiteTest, DownCastMessageInvalidReferenceType) { } #endif // GTEST_HAS_DEATH_TEST +TEST(LiteTest, FileWithOnlyAnEnumGeneratesProperValidationHooks) { + EXPECT_TRUE(proto2_unittest::OnlyOneEnum_IsValid(0)); + EXPECT_TRUE(proto2_unittest::OnlyOneEnum_IsValid(10)); + EXPECT_FALSE(proto2_unittest::OnlyOneEnum_IsValid(6)); + + // Traits also work + constexpr auto* data = + internal::EnumTraits<proto2_unittest::OnlyOneEnum>::validation_data(); + EXPECT_TRUE(internal::ValidateEnum(0, data)); + EXPECT_TRUE(internal::ValidateEnum(10, data)); + EXPECT_FALSE(internal::ValidateEnum(6, data)); +} + } // namespace } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/map.cc b/third_party/protobuf/src/google/protobuf/map.cc index 570b61bec86ff..4615786ef6690 100644 --- a/third_party/protobuf/src/google/protobuf/map.cc +++ b/third_party/protobuf/src/google/protobuf/map.cc @@ -8,14 +8,17 @@ #include "google/protobuf/map.h" #include <algorithm> -#include <functional> -#include <iterator> +#include <atomic> +#include <cstddef> +#include <cstdint> #include <string> -#include <type_traits> -#include "absl/hash/hash.h" -#include "absl/strings/string_view.h" +#include "absl/base/optimization.h" +#include "absl/functional/overload.h" +#include "absl/log/absl_check.h" +#include "google/protobuf/arena.h" #include "google/protobuf/message_lite.h" +#include "google/protobuf/port.h" // Must be included last. @@ -25,157 +28,140 @@ namespace google { namespace protobuf { namespace internal { -const TableEntryPtr kGlobalEmptyTable[kGlobalEmptyTableSize] = {}; +std::atomic<MapFieldBaseForParse::SyncFunc> + MapFieldBaseForParse::sync_map_with_repeated{}; -NodeBase* UntypedMapBase::DestroyTree(Tree* tree) { - NodeBase* head = tree->empty() ? nullptr : tree->begin()->second; - if (alloc_.arena() == nullptr) { - delete tree; +NodeBase* const kGlobalEmptyTable[kGlobalEmptyTableSize] = {}; + +void UntypedMapBase::UntypedMergeFrom(const UntypedMapBase& other) { + if (other.empty()) return; + + // Do the merging in steps to avoid Key*Value number of instantiations and + // reduce code duplication per instantation. + NodeBase* nodes = nullptr; + + // First, allocate all the nodes without types. + for (size_t i = 0; i < other.num_elements_; ++i) { + NodeBase* new_node = AllocNode(); + new_node->next = nodes; + nodes = new_node; } - return head; -} -void UntypedMapBase::EraseFromTree(map_index_t b, - typename Tree::iterator tree_it) { - ABSL_DCHECK(TableEntryIsTree(b)); - Tree* tree = TableEntryToTree(table_[b]); - if (tree_it != tree->begin()) { - NodeBase* prev = std::prev(tree_it)->second; - prev->next = prev->next->next; - } - tree->erase(tree_it); - if (tree->empty()) { - DestroyTree(tree); - table_[b] = TableEntryPtr{}; - } -} + // Then, copy the values. + VisitValueType([&](auto value_type) { + using Value = typename decltype(value_type)::type; + NodeBase* out_node = nodes; -void UntypedMapBase::InsertUniqueInTree(map_index_t b, GetKey get_key, - NodeBase* node) { - if (TableEntryIsNonEmptyList(b)) { - // To save in binary size, we delegate to an out-of-line function to do - // the conversion. - table_[b] = ConvertToTree(TableEntryToNode(table_[b]), get_key); - } - ABSL_DCHECK(TableEntryIsTree(b)) - << (void*)table_[b] << " " << (uintptr_t)table_[b]; + // Get the ClassData once to avoid redundant virtual function calls. + const internal::ClassData* class_data = + std::is_same_v<MessageLite, Value> + ? GetClassData(*other.GetValue<MessageLite>(other.begin().node_)) + : nullptr; - Tree* tree = TableEntryToTree(table_[b]); - auto it = tree->try_emplace(get_key(node), node).first; - // Maintain the linked list of the nodes in the tree. - // For simplicity, they are in the same order as the tree iteration. - if (it != tree->begin()) { - NodeBase* prev = std::prev(it)->second; - prev->next = node; - } - auto next = std::next(it); - node->next = next != tree->end() ? next->second : nullptr; -} - -void UntypedMapBase::TransferTree(Tree* tree, GetKey get_key) { - NodeBase* node = DestroyTree(tree); - do { - NodeBase* next = node->next; - - map_index_t b = VariantBucketNumber(get_key(node)); - // This is similar to InsertUnique, but with erasure. - if (TableEntryIsEmpty(b)) { - InsertUniqueInList(b, node); - index_of_first_non_null_ = (std::min)(index_of_first_non_null_, b); - } else if (TableEntryIsNonEmptyList(b) && !TableEntryIsTooLong(b)) { - InsertUniqueInList(b, node); - } else { - InsertUniqueInTree(b, get_key, node); + for (auto it = other.begin(); !it.Equals(EndIterator()); it.PlusPlus()) { + Value* out = GetValue<Value>(out_node); + out_node = out_node->next; + auto& in = *other.GetValue<Value>(it.node_); + if constexpr (std::is_same_v<MessageLite, Value>) { + class_data->PlacementNew(out, arena())->CheckTypeAndMergeFrom(in); + } else { + Arena::CreateInArenaStorage(out, this->arena_, in); + } } + }); - node = next; - } while (node != nullptr); + // Finally, copy the keys and insert the nodes. + VisitKeyType([&](auto key_type) { + using Key = typename decltype(key_type)::type; + for (auto it = other.begin(); !it.Equals(EndIterator()); it.PlusPlus()) { + NodeBase* node = nodes; + nodes = nodes->next; + const Key& in = *other.GetKey<Key>(it.node_); + Key* out = GetKey<Key>(node); + if (!internal::InitializeMapKey(out, in, this->arena_)) { + Arena::CreateInArenaStorage(out, this->arena_, in); + } + + static_cast<KeyMapBase<Key>*>(this)->InsertOrReplaceNode( + static_cast<typename KeyMapBase<Key>::KeyNode*>(node)); + } + }); } -TableEntryPtr UntypedMapBase::ConvertToTree(NodeBase* node, GetKey get_key) { - auto* tree = Arena::Create<Tree>(alloc_.arena(), typename Tree::key_compare(), - typename Tree::allocator_type(alloc_)); - for (; node != nullptr; node = node->next) { - tree->try_emplace(get_key(node), node); +void UntypedMapBase::UntypedSwap(UntypedMapBase& other) { + if (arena() == other.arena()) { + InternalSwap(&other); + } else { + UntypedMapBase tmp(arena_, type_info_); + InternalSwap(&tmp); + + ABSL_DCHECK(empty()); + UntypedMergeFrom(other); + + other.ClearTable(true); + other.UntypedMergeFrom(tmp); + + if (arena_ == nullptr) tmp.ClearTable(false); } - ABSL_DCHECK_EQ(MapTreeLengthThreshold(), tree->size()); - - // Relink the nodes. - NodeBase* next = nullptr; - auto it = tree->end(); - do { - node = (--it)->second; - node->next = next; - next = node; - } while (it != tree->begin()); - - return TreeToTableEntry(tree); } -void UntypedMapBase::ClearTable(const ClearInput input) { +void UntypedMapBase::DeleteNode(NodeBase* node) { + const auto destroy = absl::Overload{ + [](std::string* str) { str->~basic_string(); }, + [](MessageLite* msg) { msg->DestroyInstance(); }, [](void*) {}}; + VisitKey(node, destroy); + VisitValue(node, destroy); + DeallocNode(node); +} + +void UntypedMapBase::ClearTableImpl(bool reset) { ABSL_DCHECK_NE(num_buckets_, kGlobalEmptyTableSize); - if (alloc_.arena() == nullptr) { - const auto loop = [=](auto destroy_node) { - const TableEntryPtr* table = table_; + if (arena_ == nullptr) { + const auto loop = [this](auto destroy_node) { + NodeBase** table = table_; for (map_index_t b = index_of_first_non_null_, end = num_buckets_; b < end; ++b) { - NodeBase* node = - PROTOBUF_PREDICT_FALSE(internal::TableEntryIsTree(table[b])) - ? DestroyTree(TableEntryToTree(table[b])) - : TableEntryToNode(table[b]); - - while (node != nullptr) { + for (NodeBase* node = table[b]; node != nullptr;) { NodeBase* next = node->next; + absl::PrefetchToLocalCacheNta(next); destroy_node(node); - SizedDelete(node, SizeFromInfo(input.size_info)); + SizedDelete(node, type_info_.node_size); node = next; } } }; - switch (input.destroy_bits) { - case 0: - loop([](NodeBase*) {}); - break; - case kKeyIsString: - loop([](NodeBase* node) { + + const auto dispatch_key = [&](auto value_handler) { + if (type_info_.key_type_kind() < TypeKind::kString) { + loop(value_handler); + } else if (type_info_.key_type_kind() == TypeKind::kString) { + loop([=](NodeBase* node) { static_cast<std::string*>(node->GetVoidKey())->~basic_string(); + value_handler(node); }); - break; - case kValueIsString: - loop([size_info = input.size_info](NodeBase* node) { - static_cast<std::string*>(node->GetVoidValue(size_info)) - ->~basic_string(); - }); - break; - case kKeyIsString | kValueIsString: - loop([size_info = input.size_info](NodeBase* node) { - static_cast<std::string*>(node->GetVoidKey())->~basic_string(); - static_cast<std::string*>(node->GetVoidValue(size_info)) - ->~basic_string(); - }); - break; - case kValueIsProto: - loop([size_info = input.size_info](NodeBase* node) { - static_cast<MessageLite*>(node->GetVoidValue(size_info)) - ->DestroyInstance(); - }); - break; - case kKeyIsString | kValueIsProto: - loop([size_info = input.size_info](NodeBase* node) { - static_cast<std::string*>(node->GetVoidKey())->~basic_string(); - static_cast<MessageLite*>(node->GetVoidValue(size_info)) - ->DestroyInstance(); - }); - break; - case kUseDestructFunc: - loop(input.destroy_node); - break; + } else { + Unreachable(); + } + }; + + if (type_info_.value_type_kind() < TypeKind::kString) { + dispatch_key([](NodeBase*) {}); + } else if (type_info_.value_type_kind() == TypeKind::kString) { + dispatch_key([&](NodeBase* node) { + GetValue<std::string>(node)->~basic_string(); + }); + } else if (type_info_.value_type_kind() == TypeKind::kMessage) { + dispatch_key([&](NodeBase* node) { + GetValue<MessageLite>(node)->DestroyInstance(); + }); + } else { + Unreachable(); } } - if (input.reset_table) { - std::fill(table_, table_ + num_buckets_, TableEntryPtr{}); + if (reset) { + std::fill(table_, table_ + num_buckets_, nullptr); num_elements_ = 0; index_of_first_non_null_ = num_buckets_; } else { @@ -183,34 +169,92 @@ void UntypedMapBase::ClearTable(const ClearInput input) { } } -auto UntypedMapBase::FindFromTree(map_index_t b, VariantKey key, - Tree::iterator* it) const -> NodeAndBucket { - Tree* tree = TableEntryToTree(table_[b]); - auto tree_it = tree->find(key); - if (it != nullptr) *it = tree_it; - if (tree_it != tree->end()) { - return {tree_it->second, b}; - } - return {nullptr, b}; -} - -size_t UntypedMapBase::SpaceUsedInTable(size_t sizeof_node) const { +size_t UntypedMapBase::SpaceUsedExcludingSelfLong() const { size_t size = 0; // The size of the table. size += sizeof(void*) * num_buckets_; // All the nodes. - size += sizeof_node * num_elements_; - // For each tree, count the overhead of those nodes. - // Two buckets at a time because we only care about trees. - for (map_index_t b = 0; b < num_buckets_; ++b) { - if (TableEntryIsTree(b)) { - size += sizeof(Tree); - size += sizeof(Tree::value_type) * TableEntryToTree(table_[b])->size(); - } - } + size += type_info_.node_size * num_elements_; + VisitAllNodes([&](auto* key, auto* value) { + const auto space_used = absl::Overload{ + [](const std::string* str) -> size_t { + return StringSpaceUsedExcludingSelfLong(*str); + }, + [&](const MessageLite* msg) -> size_t { + const auto* class_data = GetClassData(*msg); + if (class_data->is_lite) return 0; + return class_data->full().descriptor_methods->space_used_long(*msg) - + class_data->allocation_size(); + }, + [](const void*) -> size_t { return 0; }}; + size += space_used(key); + size += space_used(value); + }); return size; } +static size_t AlignTo(size_t v, size_t alignment, size_t& max_align) { + max_align = std::max<size_t>(max_align, alignment); + return (v + alignment - 1) / alignment * alignment; +} + +struct Offsets { + size_t start; + size_t end; +}; + +template <typename T> +static Offsets AlignAndAddSize(size_t v, size_t& max_align) { + v = AlignTo(v, alignof(T), max_align); + return {v, v + sizeof(T)}; +} + +static Offsets AlignAndAddSizeDynamic( + size_t v, UntypedMapBase::TypeKind kind, + const MessageLite* value_prototype_if_message, size_t& max_align) { + switch (kind) { + case UntypedMapBase::TypeKind::kBool: + return AlignAndAddSize<bool>(v, max_align); + case UntypedMapBase::TypeKind::kU32: + return AlignAndAddSize<int32_t>(v, max_align); + case UntypedMapBase::TypeKind::kU64: + return AlignAndAddSize<int64_t>(v, max_align); + case UntypedMapBase::TypeKind::kFloat: + return AlignAndAddSize<float>(v, max_align); + case UntypedMapBase::TypeKind::kDouble: + return AlignAndAddSize<double>(v, max_align); + case UntypedMapBase::TypeKind::kString: + return AlignAndAddSize<std::string>(v, max_align); + case UntypedMapBase::TypeKind::kMessage: { + auto* class_data = GetClassData(*value_prototype_if_message); + v = AlignTo(v, class_data->alignment(), max_align); + return {v, v + class_data->allocation_size()}; + } + default: + Unreachable(); + } +} + +template <typename T, typename U> +T Narrow(U value) { + ABSL_CHECK_EQ(value, static_cast<T>(value)); + return static_cast<T>(value); +} + +UntypedMapBase::TypeInfo UntypedMapBase::GetTypeInfoDynamic( + TypeKind key_type, TypeKind value_type, + const MessageLite* value_prototype_if_message) { + size_t max_align = alignof(NodeBase); + const auto key_offsets = + AlignAndAddSizeDynamic(sizeof(NodeBase), key_type, nullptr, max_align); + const auto value_offsets = AlignAndAddSizeDynamic( + key_offsets.end, value_type, value_prototype_if_message, max_align); + return TypeInfo{ + Narrow<uint16_t>(AlignTo(value_offsets.end, max_align, max_align)), + Narrow<uint8_t>(value_offsets.start), static_cast<uint8_t>(key_type), + static_cast<uint8_t>(value_type)}; +} + } // namespace internal } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/map.h b/third_party/protobuf/src/google/protobuf/map.h index 7b28ffd5aae6e..2d22dd031c53e 100644 --- a/third_party/protobuf/src/google/protobuf/map.h +++ b/third_party/protobuf/src/google/protobuf/map.h @@ -15,31 +15,32 @@ #define GOOGLE_PROTOBUF_MAP_H__ #include <algorithm> +#include <atomic> #include <cstddef> #include <cstdint> +#include <cstring> #include <functional> #include <initializer_list> #include <iterator> #include <limits> // To support Visual Studio 2008 +#include <new> // IWYU pragma: keep for ::operator new. #include <string> #include <type_traits> #include <utility> -#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__) -#include <time.h> -#endif - -#include "google/protobuf/stubs/common.h" #include "absl/base/attributes.h" +#include "absl/base/optimization.h" +#include "absl/base/prefetch.h" #include "absl/container/btree_map.h" #include "absl/hash/hash.h" #include "absl/log/absl_check.h" #include "absl/meta/type_traits.h" +#include "absl/numeric/bits.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena.h" #include "google/protobuf/generated_enum_util.h" #include "google/protobuf/internal_visibility.h" -#include "google/protobuf/map_type_handler.h" +#include "google/protobuf/message_lite.h" #include "google/protobuf/port.h" #include "google/protobuf/wire_format_lite.h" @@ -67,8 +68,13 @@ struct PtrAndLen; } // namespace rust namespace internal { +namespace v2 { +class TableDriven; +} // namespace v2 + template <typename Key, typename T> class MapFieldLite; +class MapFieldBase; template <typename Derived, typename Key, typename T, WireFormatLite::FieldType key_wire_type, @@ -81,8 +87,6 @@ struct MapBenchmarkPeer; template <typename Key, typename T> class TypeDefinedMapFieldBase; -class DynamicMapField; - class GeneratedMessageReflection; // The largest valid serialization for a message is INT_MAX, so we can't have @@ -97,100 +101,6 @@ struct is_internal_map_key_type : std::false_type {}; template <typename T, typename VoidT = void> struct is_internal_map_value_type : std::false_type {}; -// re-implement std::allocator to use arena allocator for memory allocation. -// Used for Map implementation. Users should not use this class -// directly. -template <typename U> -class MapAllocator { - public: - using value_type = U; - using pointer = value_type*; - using const_pointer = const value_type*; - using reference = value_type&; - using const_reference = const value_type&; - using size_type = size_t; - using difference_type = ptrdiff_t; - - constexpr MapAllocator() : arena_(nullptr) {} - explicit constexpr MapAllocator(Arena* arena) : arena_(arena) {} - template <typename X> - MapAllocator(const MapAllocator<X>& allocator) // NOLINT(runtime/explicit) - : arena_(allocator.arena()) {} - - // MapAllocator does not support alignments beyond 8. Technically we should - // support up to std::max_align_t, but this fails with ubsan and tcmalloc - // debug allocation logic which assume 8 as default alignment. - static_assert(alignof(value_type) <= 8, ""); - - pointer allocate(size_type n, const void* /* hint */ = nullptr) { - // If arena is not given, malloc needs to be called which doesn't - // construct element object. - if (arena_ == nullptr) { - return static_cast<pointer>(::operator new(n * sizeof(value_type))); - } else { - return reinterpret_cast<pointer>( - Arena::CreateArray<uint8_t>(arena_, n * sizeof(value_type))); - } - } - - void deallocate(pointer p, size_type n) { - if (arena_ == nullptr) { - internal::SizedDelete(p, n * sizeof(value_type)); - } - } - -#if !defined(GOOGLE_PROTOBUF_OS_APPLE) && !defined(GOOGLE_PROTOBUF_OS_NACL) && \ - !defined(GOOGLE_PROTOBUF_OS_EMSCRIPTEN) - template <class NodeType, class... Args> - void construct(NodeType* p, Args&&... args) { - // Clang 3.6 doesn't compile static casting to void* directly. (Issue - // #1266) According C++ standard 5.2.9/1: "The static_cast operator shall - // not cast away constness". So first the maybe const pointer is casted to - // const void* and after the const void* is const casted. - new (const_cast<void*>(static_cast<const void*>(p))) - NodeType(std::forward<Args>(args)...); - } - - template <class NodeType> - void destroy(NodeType* p) { - p->~NodeType(); - } -#else - void construct(pointer p, const_reference t) { new (p) value_type(t); } - - void destroy(pointer p) { p->~value_type(); } -#endif - - template <typename X> - struct rebind { - using other = MapAllocator<X>; - }; - - template <typename X> - bool operator==(const MapAllocator<X>& other) const { - return arena_ == other.arena_; - } - - template <typename X> - bool operator!=(const MapAllocator<X>& other) const { - return arena_ != other.arena_; - } - - // To support Visual Studio 2008 - size_type max_size() const { - // parentheses around (std::...:max) prevents macro warning of max() - return (std::numeric_limits<size_type>::max)(); - } - - // To support gcc-4.4, which does not properly - // support templated friend classes - Arena* arena() const { return arena_; } - - private: - using DestructorSkippable_ = void; - Arena* arena_; -}; - // To save on binary size and simplify generic uses of the map types we collapse // signed/unsigned versions of the same sized integer to the unsigned version. template <typename T, typename = void> @@ -210,20 +120,15 @@ using KeyForBase = typename KeyForBaseImpl<T>::type; // only accept `key_type`. template <typename key_type> struct TransparentSupport { - // We hash all the scalars as uint64_t so that we can implement the same hash - // function for VariantKey. This way we can have MapKey provide the same hash - // as the underlying value would have. - using hash = absl::Hash< - std::conditional_t<std::is_scalar<key_type>::value, uint64_t, key_type>>; - - static bool Equals(const key_type& a, const key_type& b) { return a == b; } + static_assert(std::is_scalar<key_type>::value, + "Should only be used for ints."); template <typename K> using key_arg = key_type; - using ViewType = std::conditional_t<std::is_scalar<key_type>::value, key_type, - const key_type&>; - static ViewType ToView(const key_type& v) { return v; } + using ViewType = key_type; + + static key_type ToView(key_type v) { return v; } }; // We add transparent support for std::string keys. We use @@ -232,46 +137,17 @@ struct TransparentSupport { // that is convertible to absl::string_view. template <> struct TransparentSupport<std::string> { - // Use go/ranked-overloads for dispatching. - struct Rank0 {}; - struct Rank1 : Rank0 {}; - struct Rank2 : Rank1 {}; - template <typename T, typename = std::enable_if_t< - std::is_convertible<T, absl::string_view>::value>> - static absl::string_view ImplicitConvertImpl(T&& str, Rank2) { - absl::string_view ref = str; - return ref; - } - template <typename T, typename = std::enable_if_t< - std::is_convertible<T, const std::string&>::value>> - static absl::string_view ImplicitConvertImpl(T&& str, Rank1) { - const std::string& ref = str; - return ref; - } - template <typename T> - static absl::string_view ImplicitConvertImpl(T&& str, Rank0) { - return {str.data(), str.size()}; - } - template <typename T> static absl::string_view ImplicitConvert(T&& str) { - return ImplicitConvertImpl(std::forward<T>(str), Rank2{}); - } - - struct hash : public absl::Hash<absl::string_view> { - using is_transparent = void; - - template <typename T> - size_t operator()(T&& str) const { - return absl::Hash<absl::string_view>::operator()( - ImplicitConvert(std::forward<T>(str))); + if constexpr (std::is_convertible<T, absl::string_view>::value) { + absl::string_view res = str; + return res; + } else if constexpr (std::is_convertible<T, const std::string&>::value) { + const std::string& ref = str; + return ref; + } else { + return {str.data(), str.size()}; } - }; - - template <typename T, typename U> - static bool Equals(T&& t, U&& u) { - return ImplicitConvert(std::forward<T>(t)) == - ImplicitConvert(std::forward<U>(u)); } template <typename K> @@ -284,18 +160,6 @@ struct TransparentSupport<std::string> { } }; -enum class MapNodeSizeInfoT : uint32_t; -inline uint16_t SizeFromInfo(MapNodeSizeInfoT node_size_info) { - return static_cast<uint16_t>(static_cast<uint32_t>(node_size_info) >> 16); -} -inline uint16_t ValueOffsetFromInfo(MapNodeSizeInfoT node_size_info) { - return static_cast<uint16_t>(static_cast<uint32_t>(node_size_info) >> 0); -} -constexpr MapNodeSizeInfoT MakeNodeInfo(uint16_t size, uint16_t value_offset) { - return static_cast<MapNodeSizeInfoT>((static_cast<uint32_t>(size) << 16) | - value_offset); -} - struct NodeBase { // Align the node to allow KeyNode to predict the location of the key. // This way sizeof(NodeBase) contains any possible padding it was going to @@ -304,168 +168,10 @@ struct NodeBase { void* GetVoidKey() { return this + 1; } const void* GetVoidKey() const { return this + 1; } - - void* GetVoidValue(MapNodeSizeInfoT size_info) { - return reinterpret_cast<char*>(this) + ValueOffsetFromInfo(size_info); - } }; -inline NodeBase* EraseFromLinkedList(NodeBase* item, NodeBase* head) { - if (head == item) { - return head->next; - } else { - head->next = EraseFromLinkedList(item, head->next); - return head; - } -} - -constexpr size_t MapTreeLengthThreshold() { return 8; } -inline bool TableEntryIsTooLong(NodeBase* node) { - const size_t kMaxLength = MapTreeLengthThreshold(); - size_t count = 0; - do { - ++count; - node = node->next; - } while (node != nullptr); - // Invariant: no linked list ever is more than kMaxLength in length. - ABSL_DCHECK_LE(count, kMaxLength); - return count >= kMaxLength; -} - -// Similar to the public MapKey, but specialized for the internal -// implementation. -struct VariantKey { - // We make this value 16 bytes to make it cheaper to pass in the ABI. - // Can't overload string_view this way, so we unpack the fields. - // data==nullptr means this is a number and `integral` is the value. - // data!=nullptr means this is a string and `integral` is the size. - const char* data; - uint64_t integral; - - explicit VariantKey(uint64_t v) : data(nullptr), integral(v) {} - explicit VariantKey(absl::string_view v) - : data(v.data()), integral(v.size()) { - // We use `data` to discriminate between the types, so make sure it is never - // null here. - if (data == nullptr) data = ""; - } - - friend bool operator<(const VariantKey& left, const VariantKey& right) { - ABSL_DCHECK_EQ(left.data == nullptr, right.data == nullptr); - if (left.integral != right.integral) { - // If they are numbers with different value, or strings with different - // size, check the number only. - return left.integral < right.integral; - } - if (left.data == nullptr) { - // If they are numbers they have the same value, so return. - return false; - } - // They are strings of the same size, so check the bytes. - return memcmp(left.data, right.data, left.integral) < 0; - } -}; - -// This is to be specialized by MapKey. -template <typename T> -struct RealKeyToVariantKey { - VariantKey operator()(T value) const { return VariantKey(value); } -}; - -template <typename T, typename = void> -struct RealKeyToVariantKeyAlternative; - -template <typename T> -struct RealKeyToVariantKeyAlternative< - T, typename std::enable_if<std::is_integral<T>::value>::type> { - uint64_t operator()(uint64_t value) const { return value; } -}; - -template <> -struct RealKeyToVariantKey<std::string> { - template <typename T> - VariantKey operator()(const T& value) const { - return VariantKey(TransparentSupport<std::string>::ImplicitConvert(value)); - } -}; - -template <> -struct RealKeyToVariantKeyAlternative<std::string> { - absl::string_view operator()(absl::string_view value) const { return value; } -}; - -// We use a single kind of tree for all maps. This reduces code duplication. -using TreeForMap = - absl::btree_map<VariantKey, NodeBase*, std::less<VariantKey>, - MapAllocator<std::pair<const VariantKey, NodeBase*>>>; - -// Type safe tagged pointer. -// We convert to/from nodes and trees using the operations below. -// They ensure that the tags are used correctly. -// There are three states: -// - x == 0: the entry is empty -// - x != 0 && (x&1) == 0: the entry is a node list -// - x != 0 && (x&1) == 1: the entry is a tree -enum class TableEntryPtr : uintptr_t; - -inline bool TableEntryIsEmpty(TableEntryPtr entry) { - return entry == TableEntryPtr{}; -} -inline bool TableEntryIsTree(TableEntryPtr entry) { - return (static_cast<uintptr_t>(entry) & 1) == 1; -} -inline bool TableEntryIsList(TableEntryPtr entry) { - return !TableEntryIsTree(entry); -} -inline bool TableEntryIsNonEmptyList(TableEntryPtr entry) { - return !TableEntryIsEmpty(entry) && TableEntryIsList(entry); -} -inline NodeBase* TableEntryToNode(TableEntryPtr entry) { - ABSL_DCHECK(TableEntryIsList(entry)); - return reinterpret_cast<NodeBase*>(static_cast<uintptr_t>(entry)); -} -inline TableEntryPtr NodeToTableEntry(NodeBase* node) { - ABSL_DCHECK((reinterpret_cast<uintptr_t>(node) & 1) == 0); - return static_cast<TableEntryPtr>(reinterpret_cast<uintptr_t>(node)); -} -inline TreeForMap* TableEntryToTree(TableEntryPtr entry) { - ABSL_DCHECK(TableEntryIsTree(entry)); - return reinterpret_cast<TreeForMap*>(static_cast<uintptr_t>(entry) - 1); -} -inline TableEntryPtr TreeToTableEntry(TreeForMap* node) { - ABSL_DCHECK((reinterpret_cast<uintptr_t>(node) & 1) == 0); - return static_cast<TableEntryPtr>(reinterpret_cast<uintptr_t>(node) | 1); -} - -// This captures all numeric types. -inline size_t MapValueSpaceUsedExcludingSelfLong(bool) { return 0; } -inline size_t MapValueSpaceUsedExcludingSelfLong(const std::string& str) { - return StringSpaceUsedExcludingSelfLong(str); -} -template <typename T, - typename = decltype(std::declval<const T&>().SpaceUsedLong())> -size_t MapValueSpaceUsedExcludingSelfLong(const T& message) { - return message.SpaceUsedLong() - sizeof(T); -} - constexpr size_t kGlobalEmptyTableSize = 1; -PROTOBUF_EXPORT extern const TableEntryPtr - kGlobalEmptyTable[kGlobalEmptyTableSize]; - -template <typename Map, - typename = typename std::enable_if< - !std::is_scalar<typename Map::key_type>::value || - !std::is_scalar<typename Map::mapped_type>::value>::type> -size_t SpaceUsedInValues(const Map* map) { - size_t size = 0; - for (const auto& v : *map) { - size += internal::MapValueSpaceUsedExcludingSelfLong(v.first) + - internal::MapValueSpaceUsedExcludingSelfLong(v.second); - } - return size; -} - -inline size_t SpaceUsedInValues(const void*) { return 0; } +PROTOBUF_EXPORT extern NodeBase* const kGlobalEmptyTable[kGlobalEmptyTableSize]; class UntypedMapBase; @@ -482,10 +188,6 @@ class UntypedMapIterator { // We do not provide any constructors for this type. We need it to be a // trivial type to ensure that we can safely share it with Rust. - // Advance through buckets, looking for the first that isn't empty. - // If nothing non-empty is found then leave node_ == nullptr. - void SearchFrom(map_index_t start_bucket); - // The definition of operator== is handled by the derived type. If we were // to do it in this class it would allow comparing iterators of different // map types. @@ -495,13 +197,7 @@ class UntypedMapIterator { // The definition of operator++ is handled in the derived type. We would not // be able to return the right type from here. - void PlusPlus() { - if (node_->next == nullptr) { - SearchFrom(bucket_index_ + 1); - } else { - node_ = node_->next; - } - } + void PlusPlus(); // Conversion to and from a typed iterator child class is used by FFI. template <class Iter> @@ -552,39 +248,129 @@ static_assert( // Having an untyped base class helps generic consumers (like the table-driven // parser) by having non-template code that can handle all instantiations. class PROTOBUF_EXPORT UntypedMapBase { - using Allocator = internal::MapAllocator<void*>; - using Tree = internal::TreeForMap; - public: using size_type = size_t; - explicit constexpr UntypedMapBase(Arena* arena) + // Possible types that a key/value can take. + // LINT.IfChange(map_ffi) + enum class TypeKind : uint8_t { + kBool, // bool + kU32, // int32_t, uint32_t, enums + kU64, // int64_t, uint64_t + kFloat, // float + kDouble, // double + kString, // std::string + kMessage, // Derived from MessageLite + }; + // LINT.ThenChange(//depot/google3/third_party/protobuf/rust/cpp.rs:map_ffi) + + template <typename T> + static constexpr TypeKind StaticTypeKind() { + if constexpr (std::is_same_v<T, bool>) { + return TypeKind::kBool; + } else if constexpr (std::is_same_v<T, int32_t> || + std::is_same_v<T, uint32_t> || std::is_enum_v<T>) { + static_assert(sizeof(T) == 4, + "Only enums with the right underlying type are supported."); + return TypeKind::kU32; + } else if constexpr (std::is_same_v<T, int64_t> || + std::is_same_v<T, uint64_t>) { + return TypeKind::kU64; + } else if constexpr (std::is_same_v<T, float>) { + return TypeKind::kFloat; + } else if constexpr (std::is_same_v<T, double>) { + return TypeKind::kDouble; + } else if constexpr (std::is_same_v<T, std::string>) { + return TypeKind::kString; + } else if constexpr (std::is_base_of_v<MessageLite, T>) { + return TypeKind::kMessage; + } else { + static_assert(false && sizeof(T)); + } + } + + struct TypeInfo { + // Equivalent to `sizeof(Node)` in the derived type. + uint16_t node_size; + // Equivalent to `offsetof(Node, kv.second)` in the derived type. + uint8_t value_offset; + uint8_t key_type : 4; + uint8_t value_type : 4; + + TypeKind key_type_kind() const { return static_cast<TypeKind>(key_type); } + TypeKind value_type_kind() const { + return static_cast<TypeKind>(value_type); + } + }; + static_assert(sizeof(TypeInfo) == 4); + + static TypeInfo GetTypeInfoDynamic( + TypeKind key_type, TypeKind value_type, + const MessageLite* value_prototype_if_message); + + explicit constexpr UntypedMapBase(Arena* arena, TypeInfo type_info) : num_elements_(0), num_buckets_(internal::kGlobalEmptyTableSize), - seed_(0), index_of_first_non_null_(internal::kGlobalEmptyTableSize), - table_(const_cast<TableEntryPtr*>(internal::kGlobalEmptyTable)), - alloc_(arena) {} + type_info_(type_info), + table_(const_cast<NodeBase**>(internal::kGlobalEmptyTable)), + arena_(arena) {} UntypedMapBase(const UntypedMapBase&) = delete; UntypedMapBase& operator=(const UntypedMapBase&) = delete; + template <typename T> + PROTOBUF_NO_SANITIZE("cfi-unrelated-cast", "vptr") + T* GetKey(NodeBase* node) const { + // Debug check that `T` matches what we expect from the type info. + ABSL_DCHECK_EQ(static_cast<int>(StaticTypeKind<T>()), + static_cast<int>(type_info_.key_type)); + return reinterpret_cast<T*>(node->GetVoidKey()); + } + + void* GetVoidValue(NodeBase* node) const { + return reinterpret_cast<char*>(node) + type_info_.value_offset; + } + + template <typename T> + PROTOBUF_NO_SANITIZE("cfi-unrelated-cast", "vptr") + T* GetValue(NodeBase* node) const { + // Debug check that `T` matches what we expect from the type info. + ABSL_DCHECK_EQ(static_cast<int>(StaticTypeKind<T>()), + static_cast<int>(type_info_.value_type)); + return reinterpret_cast<T*>(GetVoidValue(node)); + } + + void ClearTable(bool reset) { + if (num_buckets_ == internal::kGlobalEmptyTableSize) return; + ClearTableImpl(reset); + } + + // Space used for the table and nodes. + size_t SpaceUsedExcludingSelfLong() const; + + TypeInfo type_info() const { return type_info_; } + protected: // 16 bytes is the minimum useful size for the array cache in the arena. - enum : map_index_t { kMinTableSize = 16 / sizeof(void*) }; + static constexpr map_index_t kMinTableSize = 16 / sizeof(void*); + static constexpr map_index_t kMaxTableSize = map_index_t{1} << 31; public: - Arena* arena() const { return this->alloc_.arena(); } + Arena* arena() const { return arena_; } void InternalSwap(UntypedMapBase* other) { std::swap(num_elements_, other->num_elements_); std::swap(num_buckets_, other->num_buckets_); - std::swap(seed_, other->seed_); std::swap(index_of_first_non_null_, other->index_of_first_non_null_); + std::swap(type_info_, other->type_info_); std::swap(table_, other->table_); - std::swap(alloc_, other->alloc_); + std::swap(arena_, other->arena_); } + void UntypedMergeFrom(const UntypedMapBase& other); + void UntypedSwap(UntypedMapBase& other); + static size_type max_size() { return std::numeric_limits<map_index_t>::max(); } @@ -596,18 +382,44 @@ class PROTOBUF_EXPORT UntypedMapBase { // All the end iterators are singletons anyway. static UntypedMapIterator EndIterator() { return {nullptr, nullptr, 0}; } + // Calls `f(k)` with the key of the node, where `k` is the appropriate type + // according to the stored TypeInfo. + template <typename F> + auto VisitKey(NodeBase* node, F f) const; + + // Calls `f(v)` with the value of the node, where `v` is the appropriate type + // according to the stored TypeInfo. + // Messages are visited as `MessageLite`, and enums are visited as int32. + template <typename F> + auto VisitValue(NodeBase* node, F f) const; + + // As above, but calls `f(k, v)` for every node in the map. + template <typename F> + void VisitAllNodes(F f) const; + protected: + friend class MapFieldBase; friend class TcParser; friend struct MapTestPeer; friend struct MapBenchmarkPeer; friend class UntypedMapIterator; friend class RustMapHelper; + friend class v2::TableDriven; + + // Calls `f(type_t)` where `type_t` is an unspecified type that has a `::type` + // typedef in it representing the dynamic type of key/value of the node. + template <typename F> + auto VisitKeyType(F f) const; + template <typename F> + auto VisitValueType(F f) const; struct NodeAndBucket { NodeBase* node; map_index_t bucket; }; + void ClearTableImpl(bool reset); + // Returns whether we should insert after the head of the list. For // non-optimized builds, we randomly decide whether to insert right at the // head of the list or just after the head. This helps add a little bit of @@ -618,202 +430,124 @@ class PROTOBUF_EXPORT UntypedMapBase { return false; #else // Doing modulo with a prime mixes the bits more. - return (reinterpret_cast<uintptr_t>(node) ^ seed_) % 13 > 6; + return absl::HashOf(node, table_) % 13 > 6; #endif } - // Helper for InsertUnique. Handles the case where bucket b is a - // not-too-long linked list. - void InsertUniqueInList(map_index_t b, NodeBase* node) { - if (!TableEntryIsEmpty(b) && ShouldInsertAfterHead(node)) { - auto* first = TableEntryToNode(table_[b]); - node->next = first->next; - first->next = node; - } else { - node->next = TableEntryToNode(table_[b]); - table_[b] = NodeToTableEntry(node); - } - } - - bool TableEntryIsEmpty(map_index_t b) const { - return internal::TableEntryIsEmpty(table_[b]); - } - bool TableEntryIsNonEmptyList(map_index_t b) const { - return internal::TableEntryIsNonEmptyList(table_[b]); - } - bool TableEntryIsTree(map_index_t b) const { - return internal::TableEntryIsTree(table_[b]); - } - bool TableEntryIsList(map_index_t b) const { - return internal::TableEntryIsList(table_[b]); - } - - // Return whether table_[b] is a linked list that seems awfully long. - // Requires table_[b] to point to a non-empty linked list. - bool TableEntryIsTooLong(map_index_t b) { - return internal::TableEntryIsTooLong(TableEntryToNode(table_[b])); - } - - // Return a power of two no less than max(kMinTableSize, n). - // Assumes either n < kMinTableSize or n is a power of two. - map_index_t TableSize(map_index_t n) { - return n < kMinTableSize ? kMinTableSize : n; - } - - template <typename T> - using AllocFor = absl::allocator_traits<Allocator>::template rebind_alloc<T>; - // Alignment of the nodes is the same as alignment of NodeBase. - NodeBase* AllocNode(MapNodeSizeInfoT size_info) { - return AllocNode(SizeFromInfo(size_info)); - } + NodeBase* AllocNode() { return AllocNode(type_info_.node_size); } NodeBase* AllocNode(size_t node_size) { - PROTOBUF_ASSUME(node_size % sizeof(NodeBase) == 0); - return AllocFor<NodeBase>(alloc_).allocate(node_size / sizeof(NodeBase)); + return static_cast<NodeBase*>(arena_ == nullptr + ? ::operator new(node_size) + : arena_->AllocateAligned(node_size)); } - void DeallocNode(NodeBase* node, MapNodeSizeInfoT size_info) { - DeallocNode(node, SizeFromInfo(size_info)); - } + void DeallocNode(NodeBase* node) { DeallocNode(node, type_info_.node_size); } void DeallocNode(NodeBase* node, size_t node_size) { - PROTOBUF_ASSUME(node_size % sizeof(NodeBase) == 0); - AllocFor<NodeBase>(alloc_).deallocate(node, node_size / sizeof(NodeBase)); + ABSL_DCHECK(arena_ == nullptr); + internal::SizedDelete(node, node_size); } - void DeleteTable(TableEntryPtr* table, map_index_t n) { + void DeleteTable(NodeBase** table, map_index_t n) { if (auto* a = arena()) { - a->ReturnArrayMemory(table, n * sizeof(TableEntryPtr)); + a->ReturnArrayMemory(table, n * sizeof(NodeBase*)); } else { - internal::SizedDelete(table, n * sizeof(TableEntryPtr)); + internal::SizedDelete(table, n * sizeof(NodeBase*)); } } - NodeBase* DestroyTree(Tree* tree); - using GetKey = VariantKey (*)(NodeBase*); - void InsertUniqueInTree(map_index_t b, GetKey get_key, NodeBase* node); - void TransferTree(Tree* tree, GetKey get_key); - TableEntryPtr ConvertToTree(NodeBase* node, GetKey get_key); - void EraseFromTree(map_index_t b, typename Tree::iterator tree_it); - - map_index_t VariantBucketNumber(VariantKey key) const { - return key.data == nullptr - ? VariantBucketNumber(key.integral) - : VariantBucketNumber(absl::string_view( - key.data, static_cast<size_t>(key.integral))); - } - - map_index_t VariantBucketNumber(absl::string_view key) const { - return static_cast<map_index_t>(absl::HashOf(seed_, key) & - (num_buckets_ - 1)); - } - - map_index_t VariantBucketNumber(uint64_t key) const { - return static_cast<map_index_t>(absl::HashOf(key ^ seed_) & - (num_buckets_ - 1)); - } - - TableEntryPtr* CreateEmptyTable(map_index_t n) { + NodeBase** CreateEmptyTable(map_index_t n) { ABSL_DCHECK_GE(n, kMinTableSize); ABSL_DCHECK_EQ(n & (n - 1), 0u); - TableEntryPtr* result = AllocFor<TableEntryPtr>(alloc_).allocate(n); + NodeBase** result = + arena_ == nullptr + ? static_cast<NodeBase**>(::operator new(n * sizeof(NodeBase*))) + : Arena::CreateArray<NodeBase*>(arena_, n); memset(result, 0, n * sizeof(result[0])); return result; } - // Return a randomish value. - map_index_t Seed() const { - uint64_t s = 0; -#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 = clock_gettime_nsec_np(CLOCK_UPTIME_RAW); -#elif defined(__x86_64__) && defined(__GNUC__) - uint32_t hi, lo; - asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); - s = ((static_cast<uint64_t>(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. - uint64_t virtual_timer_value; - asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value)); - s = virtual_timer_value; -#endif -#endif // !defined(GOOGLE_PROTOBUF_NO_RDTSC) - // Add entropy from the address of the map and the address of the table - // array. - return static_cast<map_index_t>( - absl::HashOf(s, table_, static_cast<const void*>(this))); - } - - enum { - kKeyIsString = 1 << 0, - kValueIsString = 1 << 1, - kValueIsProto = 1 << 2, - kUseDestructFunc = 1 << 3, - }; - template <typename Key, typename Value> - static constexpr uint8_t MakeDestroyBits() { - uint8_t result = 0; - if (!std::is_trivially_destructible<Key>::value) { - if (std::is_same<Key, std::string>::value) { - result |= kKeyIsString; - } else { - return kUseDestructFunc; - } - } - if (!std::is_trivially_destructible<Value>::value) { - if (std::is_same<Value, std::string>::value) { - result |= kValueIsString; - } else if (std::is_base_of<MessageLite, Value>::value) { - result |= kValueIsProto; - } else { - return kUseDestructFunc; - } - } - return result; - } - - struct ClearInput { - MapNodeSizeInfoT size_info; - uint8_t destroy_bits; - bool reset_table; - void (*destroy_node)(NodeBase*); - }; - - template <typename Node> - static void DestroyNode(NodeBase* node) { - static_cast<Node*>(node)->~Node(); - } - - template <typename Node> - static constexpr ClearInput MakeClearInput(bool reset) { - constexpr auto bits = - MakeDestroyBits<typename Node::key_type, typename Node::mapped_type>(); - return ClearInput{Node::size_info(), bits, reset, - bits & kUseDestructFunc ? DestroyNode<Node> : nullptr}; - } - - void ClearTable(ClearInput input); - - NodeAndBucket FindFromTree(map_index_t b, VariantKey key, - Tree::iterator* it) const; - - // Space used for the table, trees, and nodes. - // Does not include the indirect space used. Eg the data of a std::string. - size_t SpaceUsedInTable(size_t sizeof_node) const; + void DeleteNode(NodeBase* node); map_index_t num_elements_; map_index_t num_buckets_; - map_index_t seed_; map_index_t index_of_first_non_null_; - TableEntryPtr* table_; // an array with num_buckets_ entries - Allocator alloc_; + TypeInfo type_info_; + NodeBase** table_; // an array with num_buckets_ entries + Arena* arena_; }; +template <typename F> +auto UntypedMapBase::VisitKeyType(F f) const { + switch (type_info_.key_type_kind()) { + case TypeKind::kBool: + return f(std::enable_if<true, bool>{}); + case TypeKind::kU32: + return f(std::enable_if<true, uint32_t>{}); + case TypeKind::kU64: + return f(std::enable_if<true, uint64_t>{}); + case TypeKind::kString: + return f(std::enable_if<true, std::string>{}); + + case TypeKind::kFloat: + case TypeKind::kDouble: + case TypeKind::kMessage: + default: + Unreachable(); + } +} + +template <typename F> +auto UntypedMapBase::VisitValueType(F f) const { + switch (type_info_.value_type_kind()) { + case TypeKind::kBool: + return f(std::enable_if<true, bool>{}); + case TypeKind::kU32: + return f(std::enable_if<true, uint32_t>{}); + case TypeKind::kU64: + return f(std::enable_if<true, uint64_t>{}); + case TypeKind::kFloat: + return f(std::enable_if<true, float>{}); + case TypeKind::kDouble: + return f(std::enable_if<true, double>{}); + case TypeKind::kString: + return f(std::enable_if<true, std::string>{}); + case TypeKind::kMessage: + return f(std::enable_if<true, MessageLite>{}); + + default: + Unreachable(); + } +} + +template <typename F> +void UntypedMapBase::VisitAllNodes(F f) const { + VisitKeyType([&](auto key_type) { + VisitValueType([&](auto value_type) { + for (auto it = begin(); !it.Equals(EndIterator()); it.PlusPlus()) { + f(GetKey<typename decltype(key_type)::type>(it.node_), + GetValue<typename decltype(value_type)::type>(it.node_)); + } + }); + }); +} + +template <typename F> +auto UntypedMapBase::VisitKey(NodeBase* node, F f) const { + return VisitKeyType([&](auto key_type) { + return f(GetKey<typename decltype(key_type)::type>(node)); + }); +} + +template <typename F> +auto UntypedMapBase::VisitValue(NodeBase* node, F f) const { + return VisitValueType([&](auto value_type) { + return f(GetValue<typename decltype(value_type)::type>(node)); + }); +} + inline UntypedMapIterator UntypedMapBase::begin() const { map_index_t bucket_index; NodeBase* node; @@ -822,31 +556,26 @@ inline UntypedMapIterator UntypedMapBase::begin() const { node = nullptr; } else { bucket_index = index_of_first_non_null_; - TableEntryPtr entry = table_[bucket_index]; - node = PROTOBUF_PREDICT_TRUE(internal::TableEntryIsList(entry)) - ? TableEntryToNode(entry) - : TableEntryToTree(entry)->begin()->second; + node = table_[bucket_index]; PROTOBUF_ASSUME(node != nullptr); } return UntypedMapIterator{node, this, bucket_index}; } -inline void UntypedMapIterator::SearchFrom(map_index_t start_bucket) { - ABSL_DCHECK(m_->index_of_first_non_null_ == m_->num_buckets_ || - !m_->TableEntryIsEmpty(m_->index_of_first_non_null_)); - for (map_index_t i = start_bucket; i < m_->num_buckets_; ++i) { - TableEntryPtr entry = m_->table_[i]; - if (entry == TableEntryPtr{}) continue; - bucket_index_ = i; - if (PROTOBUF_PREDICT_TRUE(TableEntryIsList(entry))) { - node_ = TableEntryToNode(entry); - } else { - TreeForMap* tree = TableEntryToTree(entry); - ABSL_DCHECK(!tree->empty()); - node_ = tree->begin()->second; - } +inline void UntypedMapIterator::PlusPlus() { + if (node_->next != nullptr) { + node_ = node_->next; return; } + + for (map_index_t i = bucket_index_ + 1; i < m_->num_buckets_; ++i) { + NodeBase* node = m_->table_[i]; + if (node == nullptr) continue; + node_ = node; + bucket_index_ = i; + return; + } + node_ = nullptr; bucket_index_ = 0; } @@ -857,22 +586,65 @@ inline void UntypedMapIterator::SearchFrom(map_index_t start_bucket) { class MapFieldBaseForParse { public: const UntypedMapBase& GetMap() const { - return vtable_->get_map(*this, false); + const auto p = payload_.load(std::memory_order_acquire); + // If this instance has a payload, then it might need sync'n. + if (ABSL_PREDICT_FALSE(IsPayload(p))) { + sync_map_with_repeated.load(std::memory_order_relaxed)(*this, false); + } + return GetMapRaw(); } + UntypedMapBase* MutableMap() { - return &const_cast<UntypedMapBase&>(vtable_->get_map(*this, true)); + const auto p = payload_.load(std::memory_order_acquire); + // If this instance has a payload, then it might need sync'n. + if (ABSL_PREDICT_FALSE(IsPayload(p))) { + sync_map_with_repeated.load(std::memory_order_relaxed)(*this, true); + } + return &GetMapRaw(); } protected: - struct VTable { - const UntypedMapBase& (*get_map)(const MapFieldBaseForParse&, - bool is_mutable); - }; - explicit constexpr MapFieldBaseForParse(const VTable* vtable) - : vtable_(vtable) {} + static constexpr size_t MapOffset() { return sizeof(MapFieldBaseForParse); } + + // See assertion in TypeDefinedMapFieldBase::TypeDefinedMapFieldBase() + const UntypedMapBase& GetMapRaw() const { + return *reinterpret_cast<const UntypedMapBase*>( + reinterpret_cast<const char*>(this) + MapOffset()); + } + UntypedMapBase& GetMapRaw() { + return *reinterpret_cast<UntypedMapBase*>(reinterpret_cast<char*>(this) + + MapOffset()); + } + + // Injected from map_field.cc once we need to use it. + // We can't have a strong dep on it because it would cause protobuf_lite to + // depend on reflection. + using SyncFunc = void (*)(const MapFieldBaseForParse&, bool is_mutable); + static std::atomic<SyncFunc> sync_map_with_repeated; + + // The prototype is a `Message`, but due to restrictions on constexpr in the + // codegen we are receiving it as `void` during constant evaluation. + explicit constexpr MapFieldBaseForParse(const void* prototype_as_void) + : prototype_as_void_(prototype_as_void) {} + + enum class TaggedPtr : uintptr_t {}; + explicit MapFieldBaseForParse(const Message* prototype, TaggedPtr ptr) + : payload_(ptr), prototype_as_void_(prototype) { + // We should not have a payload on construction. + ABSL_DCHECK(!IsPayload(ptr)); + } + ~MapFieldBaseForParse() = default; - const VTable* vtable_; + static constexpr uintptr_t kHasPayloadBit = 1; + + static bool IsPayload(TaggedPtr p) { + return static_cast<uintptr_t>(p) & kHasPayloadBit; + } + + mutable std::atomic<TaggedPtr> payload_{}; + const void* prototype_as_void_; + PROTOBUF_TSAN_DECLARE_MEMBER; }; // The value might be of different signedness, so use memcpy to extract it. @@ -894,11 +666,7 @@ struct KeyNode : NodeBase { decltype(auto) key() const { return ReadKey<Key>(GetVoidKey()); } }; -// KeyMapBase is a chaining hash map with the additional feature that some -// buckets can be converted to use an ordered container. This ensures O(lg n) -// bounds on find, insert, and erase, while avoiding the overheads of ordered -// containers most of the time. -// +// KeyMapBase is a chaining hash map. // The implementation doesn't need the full generality of unordered_map, // and it doesn't have it. More bells and whistles can be added as needed. // Some implementation details: @@ -906,16 +674,9 @@ struct KeyNode : NodeBase { // 2. As is typical for hash_map and such, the Keys and Values are always // stored in linked list nodes. Pointers to elements are never invalidated // until the element is deleted. -// 3. The trees' payload type is pointer to linked-list node. Tree-converting -// a bucket doesn't copy Key-Value pairs. -// 4. Once we've tree-converted a bucket, it is never converted back unless the -// bucket is completely emptied out. Note that the items a tree contains may -// wind up assigned to trees or lists upon a rehash. -// 5. Mutations to a map do not invalidate the map's iterators, pointers to +// 3. Mutations to a map do not invalidate the map's iterators, pointers to // elements, or references to elements. -// 6. Except for erase(iterator), any non-const method can reorder iterators. -// 7. Uses VariantKey when using the Tree representation, which holds all -// possible key types as a variant value. +// 4. Except for erase(iterator), any non-const method can reorder iterators. template <typename Key> class KeyMapBase : public UntypedMapBase { @@ -925,85 +686,95 @@ class KeyMapBase : public UntypedMapBase { using TS = TransparentSupport<Key>; public: - using hasher = typename TS::hash; - using UntypedMapBase::UntypedMapBase; protected: using KeyNode = internal::KeyNode<Key>; - // Trees. The payload type is a copy of Key, so that we can query the tree - // with Keys that are not in any particular data structure. - // The value is a void* pointing to Node. We use void* instead of Node* to - // avoid code bloat. That way there is only one instantiation of the tree - // class per key type. - using Tree = internal::TreeForMap; - using TreeIterator = typename Tree::iterator; - - public: - hasher hash_function() const { return {}; } - protected: + friend UntypedMapBase; + friend class MapFieldBase; friend class TcParser; friend struct MapTestPeer; friend struct MapBenchmarkPeer; friend class RustMapHelper; + friend class v2::TableDriven; - PROTOBUF_NOINLINE void erase_no_destroy(map_index_t b, KeyNode* node) { - TreeIterator tree_it; - const bool is_list = revalidate_if_necessary(b, node, &tree_it); - if (is_list) { - ABSL_DCHECK(TableEntryIsNonEmptyList(b)); - auto* head = TableEntryToNode(table_[b]); - head = EraseFromLinkedList(node, head); - table_[b] = NodeToTableEntry(head); - } else { - EraseFromTree(b, tree_it); + Key* GetKey(NodeBase* node) const { + return UntypedMapBase::GetKey<Key>(node); + } + + PROTOBUF_NOINLINE size_type EraseImpl(map_index_t b, KeyNode* node, + bool do_destroy) { + // Force bucket_index to be in range. + b &= (num_buckets_ - 1); + + const auto find_prev = [&] { + NodeBase** prev = table_ + b; + for (; *prev != nullptr && *prev != node; prev = &(*prev)->next) { + } + return prev; + }; + + NodeBase** prev = find_prev(); + if (*prev == nullptr) { + // The bucket index is wrong. The table was modified since the iterator + // was made, so let's find the new bucket. + b = FindHelper(TS::ToView(node->key())).bucket; + prev = find_prev(); } + ABSL_DCHECK_EQ(*prev, node); + *prev = (*prev)->next; + --num_elements_; - if (PROTOBUF_PREDICT_FALSE(b == index_of_first_non_null_)) { + if (ABSL_PREDICT_FALSE(b == index_of_first_non_null_)) { while (index_of_first_non_null_ < num_buckets_ && - TableEntryIsEmpty(index_of_first_non_null_)) { + table_[index_of_first_non_null_] == nullptr) { ++index_of_first_non_null_; } } + + if (arena() == nullptr && do_destroy) { + DeleteNode(node); + } + + // To allow for the other overload of EraseImpl to do a tail call. + return 1; } - NodeAndBucket FindHelper(typename TS::ViewType k, - TreeIterator* it = nullptr) const { + PROTOBUF_NOINLINE size_type EraseImpl(typename TS::ViewType k) { + if (auto result = FindHelper(k); result.node != nullptr) { + return EraseImpl(result.bucket, static_cast<KeyNode*>(result.node), true); + } + return 0; + } + + NodeAndBucket FindHelper(typename TS::ViewType k) const { + AssertLoadFactor(); map_index_t b = BucketNumber(k); - if (TableEntryIsNonEmptyList(b)) { - auto* node = internal::TableEntryToNode(table_[b]); - do { - if (TS::Equals(static_cast<KeyNode*>(node)->key(), k)) { - return {node, b}; - } else { - node = node->next; - } - } while (node != nullptr); - } else if (TableEntryIsTree(b)) { - return FindFromTree(b, internal::RealKeyToVariantKey<Key>{}(k), it); + for (auto* node = table_[b]; node != nullptr; node = node->next) { + if (TS::ToView(static_cast<KeyNode*>(node)->key()) == k) { + return {node, b}; + } } return {nullptr, b}; } // Insert the given node. - // If the key is a duplicate, it inserts the new node and returns the old one. - // Gives ownership to the caller. - // If the key is unique, it returns `nullptr`. - KeyNode* InsertOrReplaceNode(KeyNode* node) { - KeyNode* to_erase = nullptr; + // If the key is a duplicate, it inserts the new node and deletes the old one. + bool InsertOrReplaceNode(KeyNode* node) { + bool is_new = true; auto p = this->FindHelper(node->key()); map_index_t b = p.bucket; - if (p.node != nullptr) { - erase_no_destroy(p.bucket, static_cast<KeyNode*>(p.node)); - to_erase = static_cast<KeyNode*>(p.node); + if (ABSL_PREDICT_FALSE(p.node != nullptr)) { + EraseImpl(p.bucket, static_cast<KeyNode*>(p.node), true); + is_new = false; } else if (ResizeIfLoadIsOutOfRange(num_elements_ + 1)) { b = BucketNumber(node->key()); // bucket_number } InsertUnique(b, node); ++num_elements_; - return to_erase; + return is_new; } // Insert the given Node in bucket b. If that would make bucket b too big, @@ -1012,27 +783,27 @@ class KeyMapBase : public UntypedMapBase { // bucket. num_elements_ is not modified. void InsertUnique(map_index_t b, KeyNode* node) { ABSL_DCHECK(index_of_first_non_null_ == num_buckets_ || - !TableEntryIsEmpty(index_of_first_non_null_)); + table_[index_of_first_non_null_] != nullptr); // In practice, the code that led to this point may have already // determined whether we are inserting into an empty list, a short list, // or whatever. But it's probably cheap enough to recompute that here; // it's likely that we're inserting into an empty or short list. - ABSL_DCHECK(FindHelper(node->key()).node == nullptr); - if (TableEntryIsEmpty(b)) { - InsertUniqueInList(b, node); + ABSL_DCHECK(FindHelper(TS::ToView(node->key())).node == nullptr); + AssertLoadFactor(); + auto*& head = table_[b]; + if (head == nullptr) { + head = node; + node->next = nullptr; index_of_first_non_null_ = (std::min)(index_of_first_non_null_, b); - } else if (TableEntryIsNonEmptyList(b) && !TableEntryIsTooLong(b)) { - InsertUniqueInList(b, node); + } else if (ShouldInsertAfterHead(node)) { + node->next = head->next; + head->next = node; } else { - InsertUniqueInTree(b, NodeToVariantKey, node); + node->next = head; + head = node; } } - static VariantKey NodeToVariantKey(NodeBase* node) { - return internal::RealKeyToVariantKey<Key>{}( - static_cast<KeyNode*>(node)->key()); - } - // Have it a separate function for testing. static size_type CalculateHiCutoff(size_type num_buckets) { // We want the high cutoff to follow this rules: @@ -1045,6 +816,29 @@ class KeyMapBase : public UntypedMapBase { return num_buckets - num_buckets / 16 * 4 - num_buckets % 2; } + // For a particular size, calculate the lowest capacity `cap` where + // `size <= CalculateHiCutoff(cap)`. + static size_type CalculateCapacityForSize(size_type size) { + ABSL_DCHECK_NE(size, 0u); + + if (size > kMaxTableSize / 2) { + return kMaxTableSize; + } + + size_t capacity = size_type{1} << (std::numeric_limits<size_type>::digits - + absl::countl_zero(size - 1)); + + if (size > CalculateHiCutoff(capacity)) { + capacity *= 2; + } + + return std::max<size_type>(capacity, kMinTableSize); + } + + void AssertLoadFactor() const { + ABSL_DCHECK_LE(num_elements_, CalculateHiCutoff(num_buckets_)); + } + // Returns whether it did resize. Currently this is only used when // num_elements_ increases, though it could be used in other situations. // It checks for load too low as well as load too high: because any number @@ -1059,19 +853,22 @@ class KeyMapBase : public UntypedMapBase { // We don't care how many elements are in trees. If a lot are, // we may resize even though there are many empty buckets. In // practice, this seems fine. - if (PROTOBUF_PREDICT_FALSE(new_size > hi_cutoff)) { + if (ABSL_PREDICT_FALSE(new_size > hi_cutoff)) { if (num_buckets_ <= max_size() / 2) { - Resize(num_buckets_ * 2); + Resize(kMinTableSize > kGlobalEmptyTableSize * 2 + ? std::max(kMinTableSize, num_buckets_ * 2) + : num_buckets_ * 2); return true; } - } else if (PROTOBUF_PREDICT_FALSE(new_size <= lo_cutoff && - num_buckets_ > kMinTableSize)) { + } else if (ABSL_PREDICT_FALSE(new_size <= lo_cutoff && + num_buckets_ > kMinTableSize)) { size_type lg2_of_size_reduction_factor = 1; // It's possible we want to shrink a lot here... size() could even be 0. // So, estimate how much to shrink by making sure we don't shrink so // much that we would need to grow the table after a few inserts. const size_type hypothetical_size = new_size * 5 / 4 + 1; - while ((hypothetical_size << lg2_of_size_reduction_factor) < hi_cutoff) { + while ((hypothetical_size << (1 + lg2_of_size_reduction_factor)) < + hi_cutoff) { ++lg2_of_size_reduction_factor; } size_type new_num_buckets = std::max<size_type>( @@ -1084,14 +881,35 @@ class KeyMapBase : public UntypedMapBase { return false; } + // Interpret `head` as a linked list and insert all the nodes into `this`. + // REQUIRES: this->empty() + // REQUIRES: the input nodes have unique keys + PROTOBUF_NOINLINE void MergeIntoEmpty(NodeBase* head, size_t num_nodes) { + ABSL_DCHECK_EQ(size(), size_t{0}); + ABSL_DCHECK_NE(num_nodes, size_t{0}); + if (const map_index_t needed_capacity = CalculateCapacityForSize(num_nodes); + needed_capacity != this->num_buckets_) { + Resize(std::max(kMinTableSize, needed_capacity)); + } + num_elements_ = num_nodes; + AssertLoadFactor(); + while (head != nullptr) { + KeyNode* node = static_cast<KeyNode*>(head); + head = head->next; + absl::PrefetchToLocalCacheNta(head); + InsertUnique(BucketNumber(TS::ToView(node->key())), node); + } + } + // Resize to the given number of buckets. void Resize(map_index_t new_num_buckets) { + ABSL_DCHECK_GE(new_num_buckets, kMinTableSize); + ABSL_DCHECK(absl::has_single_bit(new_num_buckets)); if (num_buckets_ == kGlobalEmptyTableSize) { // This is the global empty array. // Just overwrite with a new one. No need to transfer or free anything. - num_buckets_ = index_of_first_non_null_ = kMinTableSize; + num_buckets_ = index_of_first_non_null_ = new_num_buckets; table_ = CreateEmptyTable(num_buckets_); - seed_ = Seed(); return; } @@ -1103,58 +921,20 @@ class KeyMapBase : public UntypedMapBase { const map_index_t start = index_of_first_non_null_; index_of_first_non_null_ = num_buckets_; for (map_index_t i = start; i < old_table_size; ++i) { - if (internal::TableEntryIsNonEmptyList(old_table[i])) { - TransferList(static_cast<KeyNode*>(TableEntryToNode(old_table[i]))); - } else if (internal::TableEntryIsTree(old_table[i])) { - this->TransferTree(TableEntryToTree(old_table[i]), NodeToVariantKey); + for (KeyNode* node = static_cast<KeyNode*>(old_table[i]); + node != nullptr;) { + auto* next = static_cast<KeyNode*>(node->next); + InsertUnique(BucketNumber(TS::ToView(node->key())), node); + node = next; } } DeleteTable(old_table, old_table_size); - } - - // Transfer all nodes in the list `node` into `this`. - void TransferList(KeyNode* node) { - do { - auto* next = static_cast<KeyNode*>(node->next); - InsertUnique(BucketNumber(node->key()), node); - node = next; - } while (node != nullptr); + AssertLoadFactor(); } map_index_t BucketNumber(typename TS::ViewType k) const { - ABSL_DCHECK_EQ( - VariantBucketNumber(RealKeyToVariantKeyAlternative<Key>{}(k)), - VariantBucketNumber(RealKeyToVariantKey<Key>{}(k))); - return VariantBucketNumber(RealKeyToVariantKeyAlternative<Key>{}(k)); - } - - // Assumes node_ and m_ are correct and non-null, but other fields may be - // stale. Fix them as needed. Then return true iff node_ points to a - // Node in a list. If false is returned then *it is modified to be - // a valid iterator for node_. - bool revalidate_if_necessary(map_index_t& bucket_index, KeyNode* node, - TreeIterator* it) const { - // Force bucket_index to be in range. - bucket_index &= (num_buckets_ - 1); - // Common case: the bucket we think is relevant points to `node`. - if (table_[bucket_index] == NodeToTableEntry(node)) return true; - // Less common: the bucket is a linked list with node_ somewhere in it, - // but not at the head. - if (TableEntryIsNonEmptyList(bucket_index)) { - auto* l = TableEntryToNode(table_[bucket_index]); - while ((l = l->next) != nullptr) { - if (l == node) { - return true; - } - } - } - // Well, bucket_index_ still might be correct, but probably - // not. Revalidate just to be sure. This case is rare enough that we - // don't worry about potential optimizations, such as having a custom - // find-like method that compares Node* instead of the key. - auto res = FindHelper(node->key(), it); - bucket_index = res.bucket; - return TableEntryIsList(bucket_index); + return static_cast<map_index_t>(absl::HashOf(k, table_) & + (num_buckets_ - 1)); } }; @@ -1171,25 +951,11 @@ bool InitializeMapKey(T*, K&&, Arena*) { class RustMapHelper { public: using NodeAndBucket = UntypedMapBase::NodeAndBucket; - using ClearInput = UntypedMapBase::ClearInput; - template <typename Key, typename Value> - static constexpr MapNodeSizeInfoT SizeInfo() { - return Map<Key, Value>::Node::size_info(); - } + static NodeBase* AllocNode(UntypedMapBase* m) { return m->AllocNode(); } - enum { - kKeyIsString = UntypedMapBase::kKeyIsString, - kValueIsProto = UntypedMapBase::kValueIsProto, - }; - - static NodeBase* AllocNode(UntypedMapBase* m, MapNodeSizeInfoT size_info) { - return m->AllocNode(size_info); - } - - static void DeallocNode(UntypedMapBase* m, NodeBase* node, - MapNodeSizeInfoT size_info) { - return m->DeallocNode(node, size_info); + static void DeleteNode(UntypedMapBase* m, NodeBase* node) { + return m->DeleteNode(node); } template <typename Map, typename Key> @@ -1198,29 +964,19 @@ class RustMapHelper { } template <typename Map> - static typename Map::KeyNode* InsertOrReplaceNode(Map* m, NodeBase* node) { + static bool InsertOrReplaceNode(Map* m, NodeBase* node) { return m->InsertOrReplaceNode(static_cast<typename Map::KeyNode*>(node)); } - template <typename Map> - static void EraseNoDestroy(Map* m, map_index_t bucket, NodeBase* node) { - m->erase_no_destroy(bucket, static_cast<typename Map::KeyNode*>(node)); + template <typename Map, typename Key> + static bool EraseImpl(Map* m, const Key& key) { + return m->EraseImpl(key); } static google::protobuf::MessageLite* PlacementNew(const MessageLite* prototype, void* mem) { return prototype->GetClassData()->PlacementNew(mem, /* arena = */ nullptr); } - - static void DestroyMessage(MessageLite* m) { m->DestroyInstance(); } - - static void ClearTable(UntypedMapBase* m, ClearInput input) { - m->ClearTable(input); - } - - static bool IsGlobalEmptyTable(const UntypedMapBase* m) { - return m->num_buckets_ == kGlobalEmptyTableSize; - } }; } // namespace internal @@ -1257,14 +1013,16 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { using const_reference = const value_type&; using size_type = size_t; - using hasher = typename TS::hash; + using hasher = absl::Hash<typename TS::ViewType>; - constexpr Map() : Base(nullptr) { StaticValidityCheck(); } + constexpr Map() : Base(nullptr, GetTypeInfo()) { StaticValidityCheck(); } Map(const Map& other) : Map(nullptr, other) {} // Internal Arena constructors: do not use! // TODO: remove non internal ctors - explicit Map(Arena* arena) : Base(arena) { StaticValidityCheck(); } + explicit Map(Arena* arena) : Base(arena, GetTypeInfo()) { + StaticValidityCheck(); + } Map(internal::InternalVisibility, Arena* arena) : Map(arena) {} Map(internal::InternalVisibility, Arena* arena, const Map& other) : Map(arena, other) {} @@ -1298,15 +1056,14 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { // won't trigger for leaked maps that never get destructed. StaticValidityCheck(); - if (this->num_buckets_ != internal::kGlobalEmptyTableSize) { - this->ClearTable(this->template MakeClearInput<Node>(false)); - } + this->AssertLoadFactor(); + this->ClearTable(false); } private: - Map(Arena* arena, const Map& other) : Base(arena) { + Map(Arena* arena, const Map& other) : Map(arena) { StaticValidityCheck(); - insert(other.begin(), other.end()); + CopyFromImpl(other); } static_assert(!std::is_const<mapped_type>::value && !std::is_const<key_type>::value, @@ -1341,6 +1098,19 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { static_assert( sizeof(Map) == sizeof(internal::UntypedMapBase), "Map must not have any data members beyond what is in UntypedMapBase."); + + // Check for MpMap optimizations. + if constexpr (std::is_scalar_v<key_type>) { + static_assert(sizeof(key_type) <= sizeof(uint64_t), + "Scalar must be <= than uint64_t"); + } + if constexpr (std::is_scalar_v<mapped_type>) { + static_assert(sizeof(mapped_type) <= sizeof(uint64_t), + "Scalar must be <= than uint64_t"); + } + static_assert(internal::kMaxMessageAlignment >= sizeof(uint64_t)); + static_assert(sizeof(Node) - sizeof(internal::NodeBase) >= sizeof(uint64_t), + "We must have at least this bytes for MpMap initialization"); } template <typename P> @@ -1435,7 +1205,7 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { } // Allow implicit conversion to const_iterator. - operator const_iterator() const { // NOLINT(runtime/explicit) + operator const_iterator() const { // NOLINT(google-explicit-constructor) return const_iterator(static_cast<const BaseIt&>(*this)); } @@ -1547,16 +1317,33 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { template <typename K, typename... Args> std::pair<iterator, bool> try_emplace(K&& k, Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND { - // Inserts a new element into the container if there is no element with the - // key in the container. - // The new element is: - // (1) Constructed in-place with the given args, if mapped_type is not - // arena constructible. - // (2) Constructed in-place with the arena and then assigned with a - // mapped_type temporary constructed with the given args, otherwise. - return ArenaAwareTryEmplace(Arena::is_arena_constructable<mapped_type>(), - std::forward<K>(k), + // Case 1: `mapped_type` is arena constructible. A temporary object is + // created and then (if `Args` are not empty) assigned to a mapped value + // that was created with the arena. + if constexpr (Arena::is_arena_constructable<mapped_type>::value) { + if constexpr (sizeof...(Args) == 0) { + // case 1.1: "default" constructed (e.g. from arena only). + return TryEmplaceInternal(std::forward<K>(k)); + } else { + // case 1.2: "default" constructed + copy/move assignment + auto p = TryEmplaceInternal(std::forward<K>(k)); + if (p.second) { + if constexpr (std::is_same<void(typename std::decay<Args>::type...), + void(mapped_type)>::value) { + // Avoid the temporary when the input is the right type. + p.first->second = (std::forward<Args>(args), ...); + } else { + p.first->second = mapped_type(std::forward<Args>(args)...); + } + } + return p; + } + } else { + // Case 2: `mapped_type` is not arena constructible. Using in-place + // construction. + return TryEmplaceInternal(std::forward<K>(k), std::forward<Args>(args)...); + } } std::pair<iterator, bool> insert(init_type&& value) ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1570,7 +1357,14 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { template <typename... Args> std::pair<iterator, bool> emplace(Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return EmplaceInternal(Rank0{}, std::forward<Args>(args)...); + // We try to construct `init_type` from `Args` with a fall back to + // `value_type`. The latter is less desired as it unconditionally makes a + // copy of `value_type::first`. + if constexpr (std::is_constructible<init_type, Args...>::value) { + return insert(init_type(std::forward<Args>(args)...)); + } else { + return insert(value_type(std::forward<Args>(args)...)); + } } template <class InputIt> void insert(InputIt first, InputIt last) { @@ -1591,21 +1385,13 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { // Erase and clear template <typename K = key_type> size_type erase(const key_arg<K>& key) { - iterator it = find(key); - if (it == end()) { - return 0; - } else { - erase(it); - return 1; - } + return this->EraseImpl(TS::ToView(key)); } iterator erase(iterator pos) ABSL_ATTRIBUTE_LIFETIME_BOUND { auto next = std::next(pos); ABSL_DCHECK_EQ(pos.m_, static_cast<Base*>(this)); - auto* node = static_cast<Node*>(pos.node_); - this->erase_no_destroy(pos.bucket_index_, node); - DestroyNode(node); + this->EraseImpl(pos.bucket_index_, static_cast<Node*>(pos.node_), true); return next; } @@ -1615,16 +1401,13 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { } } - void clear() { - if (this->num_buckets_ == internal::kGlobalEmptyTableSize) return; - this->ClearTable(this->template MakeClearInput<Node>(true)); - } + void clear() { this->ClearTable(true); } // Assign Map& operator=(const Map& other) ABSL_ATTRIBUTE_LIFETIME_BOUND { if (this != &other) { clear(); - insert(other.begin(), other.end()); + CopyFromImpl(other); } return *this; } @@ -1633,12 +1416,13 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { if (arena() == other.arena()) { InternalSwap(&other); } else { - // TODO: optimize this. The temporary copy can be allocated - // in the same arena as the other message, and the "other = copy" can - // be replaced with the fast-path swap above. - Map copy = *this; - *this = other; - other = copy; + size_t other_size = other.size(); + Node* other_copy = this->CloneFromOther(other); + other = *this; + this->clear(); + if (other_size != 0) { + this->MergeIntoEmpty(other_copy, other_size); + } } } @@ -1650,78 +1434,40 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { size_t SpaceUsedExcludingSelfLong() const { if (empty()) return 0; - return SpaceUsedInternal() + internal::SpaceUsedInValues(this); + return internal::UntypedMapBase::SpaceUsedExcludingSelfLong(); } static constexpr size_t InternalGetArenaOffset(internal::InternalVisibility) { - return PROTOBUF_FIELD_OFFSET(Map, alloc_); + return PROTOBUF_FIELD_OFFSET(Map, arena_); } private: - struct Rank1 {}; - struct Rank0 : Rank1 {}; - // Linked-list nodes, as one would expect for a chaining hash table. struct Node : Base::KeyNode { using key_type = Key; using mapped_type = T; - static constexpr internal::MapNodeSizeInfoT size_info() { - return internal::MakeNodeInfo(sizeof(Node), - PROTOBUF_FIELD_OFFSET(Node, kv.second)); - } value_type kv; }; - using Tree = internal::TreeForMap; - using TreeIterator = typename Tree::iterator; - using TableEntryPtr = internal::TableEntryPtr; - - static Node* NodeFromTreeIterator(TreeIterator it) { - static_assert( - PROTOBUF_FIELD_OFFSET(Node, kv.first) == Base::KeyNode::kOffset, ""); - static_assert(alignof(Node) == alignof(internal::NodeBase), ""); - return static_cast<Node*>(it->second); + static constexpr auto GetTypeInfo() { + return internal::UntypedMapBase::TypeInfo{ + sizeof(Node), + PROTOBUF_FIELD_OFFSET(Node, kv.second), + static_cast<uint8_t>(internal::UntypedMapBase::StaticTypeKind<Key>()), + static_cast<uint8_t>(internal::UntypedMapBase::StaticTypeKind<T>()), + }; } - void DestroyNode(Node* node) { - if (this->alloc_.arena() == nullptr) { + void DeleteNode(Node* node) { + if (this->arena_ == nullptr) { node->kv.first.~key_type(); node->kv.second.~mapped_type(); this->DeallocNode(node, sizeof(Node)); } } - size_t SpaceUsedInternal() const { - return this->SpaceUsedInTable(sizeof(Node)); - } - - // We try to construct `init_type` from `Args` with a fall back to - // `value_type`. The latter is less desired as it unconditionally makes a copy - // of `value_type::first`. - template <typename... Args> - auto EmplaceInternal(Rank0, Args&&... args) -> - typename std::enable_if<std::is_constructible<init_type, Args...>::value, - std::pair<iterator, bool>>::type { - return insert(init_type(std::forward<Args>(args)...)); - } - template <typename... Args> - std::pair<iterator, bool> EmplaceInternal(Rank1, Args&&... args) { - return insert(value_type(std::forward<Args>(args)...)); - } - template <typename K, typename... Args> - std::pair<iterator, bool> TryEmplaceInternal(K&& k, Args&&... args) { - auto p = this->FindHelper(TS::ToView(k)); - internal::map_index_t b = p.bucket; - // Case 1: key was already present. - if (p.node != nullptr) - return std::make_pair(iterator(internal::UntypedMapIterator{ - static_cast<Node*>(p.node), this, p.bucket}), - false); - // Case 2: insert. - if (this->ResizeIfLoadIsOutOfRange(this->num_elements_ + 1)) { - b = this->BucketNumber(TS::ToView(k)); - } + PROTOBUF_ALWAYS_INLINE Node* CreateNode(K&& k, Args&&... args) { // If K is not key_type, make the conversion to key_type explicit. using TypeToInit = typename std::conditional< std::is_same<typename std::decay<K>::type, key_type>::value, K&&, @@ -1733,62 +1479,64 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { // submessage may have its own arena when message-owned arena is enabled. // Note: This only works if `Key` is not arena constructible. if (!internal::InitializeMapKey(const_cast<Key*>(&node->kv.first), - std::forward<K>(k), this->alloc_.arena())) { + std::forward<K>(k), this->arena_)) { Arena::CreateInArenaStorage(const_cast<Key*>(&node->kv.first), - this->alloc_.arena(), + this->arena_, static_cast<TypeToInit>(std::forward<K>(k))); } // Note: if `T` is arena constructible, `Args` needs to be empty. - Arena::CreateInArenaStorage(&node->kv.second, this->alloc_.arena(), + Arena::CreateInArenaStorage(&node->kv.second, this->arena_, std::forward<Args>(args)...); + return node; + } + // Copy all elements from `other`, using the arena from `this`. + // Return them as a linked list, using the `next` pointer in the node. + PROTOBUF_NOINLINE Node* CloneFromOther(const Map& other) { + Node* head = nullptr; + for (const auto& [key, value] : other) { + Node* new_node; + if constexpr (std::is_base_of_v<MessageLite, mapped_type>) { + new_node = CreateNode(key); + new_node->kv.second = value; + } else { + new_node = CreateNode(key, value); + } + new_node->next = head; + head = new_node; + } + return head; + } + + void CopyFromImpl(const Map& other) { + if (other.empty()) return; + // We split the logic in two: first we clone the data which requires + // Key/Value types, then we insert them all which only requires Key. + // That way we reduce code duplication. + this->MergeIntoEmpty(CloneFromOther(other), other.size()); + } + + template <typename K, typename... Args> + std::pair<iterator, bool> TryEmplaceInternal(K&& k, Args&&... args) { + auto p = this->FindHelper(TS::ToView(k)); + internal::map_index_t b = p.bucket; + // Case 1: key was already present. + if (p.node != nullptr) { + return std::make_pair(iterator(internal::UntypedMapIterator{ + static_cast<Node*>(p.node), this, p.bucket}), + false); + } + // Case 2: insert. + if (this->ResizeIfLoadIsOutOfRange(this->num_elements_ + 1)) { + b = this->BucketNumber(TS::ToView(k)); + } + auto* node = CreateNode(std::forward<K>(k), std::forward<Args>(args)...); this->InsertUnique(b, node); ++this->num_elements_; return std::make_pair(iterator(internal::UntypedMapIterator{node, this, b}), true); } - // A helper function to perform an assignment of `mapped_type`. - // If the first argument is true, then it is a regular assignment. - // Otherwise, we first create a temporary and then perform an assignment. - template <typename V> - static void AssignMapped(std::true_type, mapped_type& mapped, V&& v) { - mapped = std::forward<V>(v); - } - template <typename... Args> - static void AssignMapped(std::false_type, mapped_type& mapped, - Args&&... args) { - mapped = mapped_type(std::forward<Args>(args)...); - } - - // Case 1: `mapped_type` is arena constructible. A temporary object is - // created and then (if `Args` are not empty) assigned to a mapped value - // that was created with the arena. - template <typename K> - std::pair<iterator, bool> ArenaAwareTryEmplace(std::true_type, K&& k) { - // case 1.1: "default" constructed (e.g. from arena only). - return TryEmplaceInternal(std::forward<K>(k)); - } - template <typename K, typename... Args> - std::pair<iterator, bool> ArenaAwareTryEmplace(std::true_type, K&& k, - Args&&... args) { - // case 1.2: "default" constructed + copy/move assignment - auto p = TryEmplaceInternal(std::forward<K>(k)); - if (p.second) { - AssignMapped(std::is_same<void(typename std::decay<Args>::type...), - void(mapped_type)>(), - p.first->second, std::forward<Args>(args)...); - } - return p; - } - // Case 2: `mapped_type` is not arena constructible. Using in-place - // construction. - template <typename... Args> - std::pair<iterator, bool> ArenaAwareTryEmplace(std::false_type, - Args&&... args) { - return TryEmplaceInternal(std::forward<Args>(args)...); - } - using Base::arena; friend class Arena; @@ -1802,6 +1550,7 @@ class Map : private internal::KeyMapBase<internal::KeyForBase<Key>> { friend struct internal::MapTestPeer; friend struct internal::MapBenchmarkPeer; friend class internal::RustMapHelper; + friend class internal::v2::TableDriven; }; namespace internal { diff --git a/third_party/protobuf/src/google/protobuf/map_field.cc b/third_party/protobuf/src/google/protobuf/map_field.cc index 359026adf2e7b..1867dc4dbc06b 100644 --- a/third_party/protobuf/src/google/protobuf/map_field.cc +++ b/third_party/protobuf/src/google/protobuf/map_field.cc @@ -8,15 +8,21 @@ #include "google/protobuf/map_field.h" #include <atomic> +#include <cstddef> +#include <cstdint> #include <string> -#include <utility> -#include <vector> +#include <type_traits> +#include "absl/functional/overload.h" #include "absl/log/absl_check.h" +#include "absl/synchronization/mutex.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/descriptor.h" #include "google/protobuf/map.h" #include "google/protobuf/map_field_inl.h" #include "google/protobuf/port.h" #include "google/protobuf/raw_ptr.h" +#include "google/protobuf/repeated_ptr_field.h" // Must be included last. #include "google/protobuf/port_def.inc" @@ -25,37 +31,107 @@ namespace google { namespace protobuf { namespace internal { -VariantKey RealKeyToVariantKey<MapKey>::operator()(const MapKey& value) const { - switch (value.type()) { - case FieldDescriptor::CPPTYPE_STRING: - return VariantKey(value.GetStringValue()); - case FieldDescriptor::CPPTYPE_INT64: - return VariantKey(value.GetInt64Value()); - case FieldDescriptor::CPPTYPE_INT32: - return VariantKey(value.GetInt32Value()); - case FieldDescriptor::CPPTYPE_UINT64: - return VariantKey(value.GetUInt64Value()); - case FieldDescriptor::CPPTYPE_UINT32: - return VariantKey(value.GetUInt32Value()); - case FieldDescriptor::CPPTYPE_BOOL: - return VariantKey(static_cast<uint64_t>(value.GetBoolValue())); - default: - Unreachable(); - return VariantKey(uint64_t{}); - } -} - MapFieldBase::~MapFieldBase() { ABSL_DCHECK_EQ(arena(), nullptr); delete maybe_payload(); } -const UntypedMapBase& MapFieldBase::GetMapImpl(const MapFieldBaseForParse& map, - bool is_mutable) { - const auto& self = static_cast<const MapFieldBase&>(map); - self.SyncMapWithRepeatedField(); - if (is_mutable) const_cast<MapFieldBase&>(self).SetMapDirty(); - return self.GetMapRaw(); +void MapFieldBase::MergeFrom(const MapFieldBase& other) { + MutableMap()->UntypedMergeFrom(other.GetMap()); +} + +void MapFieldBase::Swap(MapFieldBase* other) { + if (arena() == other->arena()) { + InternalSwap(other); + return; + } + MapFieldBase::SwapPayload(*this, *other); + GetMapRaw().UntypedSwap(other->GetMapRaw()); +} + +template <typename Map, typename F> +auto VisitMapKey(const MapKey& map_key, Map& map, F f) { + switch (map_key.type()) { +#define HANDLE_TYPE(CPPTYPE, Type, KeyBaseType) \ + case FieldDescriptor::CPPTYPE_##CPPTYPE: { \ + using KMB = KeyMapBase<KeyBaseType>; \ + return f( \ + static_cast< \ + std::conditional_t<std::is_const_v<Map>, const KMB&, KMB&>>(map), \ + TransparentSupport<KeyBaseType>::ToView(map_key.Get##Type##Value())); \ + } + HANDLE_TYPE(INT32, Int32, uint32_t); + HANDLE_TYPE(UINT32, UInt32, uint32_t); + HANDLE_TYPE(INT64, Int64, uint64_t); + HANDLE_TYPE(UINT64, UInt64, uint64_t); + HANDLE_TYPE(BOOL, Bool, bool); + HANDLE_TYPE(STRING, String, std::string); +#undef HANDLE_TYPE + default: + Unreachable(); + } +} + +bool MapFieldBase::InsertOrLookupMapValueNoSync(const MapKey& map_key, + MapValueRef* val) { + if (LookupMapValueNoSync(map_key, static_cast<MapValueConstRef*>(val))) { + return false; + } + + auto& map = GetMapRaw(); + + NodeBase* node = map.AllocNode(); + map.VisitValue(node, [&](auto* v) { InitializeKeyValue(v); }); + val->SetValue(map.GetVoidValue(node)); + + return VisitMapKey(map_key, map, [&](auto& map, const auto& key) { + InitializeKeyValue(map.GetKey(node), key); + map.InsertOrReplaceNode( + static_cast<typename std::decay_t<decltype(map)>::KeyNode*>(node)); + return true; + }); +} + +bool MapFieldBase::DeleteMapValue(const MapKey& map_key) { + return VisitMapKey(map_key, *MutableMap(), [](auto& map, const auto& key) { + return map.EraseImpl(key); + }); +} + +void MapFieldBase::ClearMapNoSync() { GetMapRaw().ClearTable(true); } + +void MapFieldBase::SetMapIteratorValue(MapIterator* map_iter) const { + if (map_iter->iter_.Equals(UntypedMapBase::EndIterator())) return; + + const UntypedMapBase& map = *map_iter->iter_.m_; + NodeBase* node = map_iter->iter_.node_; + auto& key = map_iter->key_; + map.VisitKey(node, + absl::Overload{ + [&](const std::string* v) { key.val_.string_value = *v; }, + [&](const auto* v) { + // Memcpy the scalar into the union. + memcpy(static_cast<void*>(&key.val_), v, sizeof(*v)); + }, + }); + map_iter->value_.SetValue(map.GetVoidValue(node)); +} + +bool MapFieldBase::LookupMapValueNoSync(const MapKey& map_key, + MapValueConstRef* val) const { + auto& map = GetMapRaw(); + if (map.empty()) return false; + + return VisitMapKey(map_key, map, [&](auto& map, const auto& key) { + auto res = map.FindHelper(key); + if (res.node == nullptr) { + return false; + } + if (val != nullptr) { + val->SetValue(map.GetVoidValue(res.node)); + } + return true; + }); } void MapFieldBase::MapBegin(MapIterator* map_iter) const { @@ -111,8 +187,18 @@ static void SwapRelaxed(std::atomic<T>& a, std::atomic<T>& b) { MapFieldBase::ReflectionPayload& MapFieldBase::PayloadSlow() const { auto p = payload_.load(std::memory_order_acquire); if (!IsPayload(p)) { + // Inject the sync callback. + sync_map_with_repeated.store( + [](auto& map, bool is_mutable) { + const auto& self = static_cast<const MapFieldBase&>(map); + self.SyncMapWithRepeatedField(); + if (is_mutable) const_cast<MapFieldBase&>(self).SetMapDirty(); + }, + std::memory_order_relaxed); + auto* arena = ToArena(p); auto* payload = Arena::Create<ReflectionPayload>(arena, arena); + auto new_p = ToTaggedPtr(payload); if (payload_.compare_exchange_strong(p, new_p, std::memory_order_acq_rel)) { // We were able to store it. @@ -126,9 +212,9 @@ MapFieldBase::ReflectionPayload& MapFieldBase::PayloadSlow() const { return *ToPayload(p); } -void MapFieldBase::SwapImpl(MapFieldBase& lhs, MapFieldBase& rhs) { +void MapFieldBase::SwapPayload(MapFieldBase& lhs, MapFieldBase& rhs) { if (lhs.arena() == rhs.arena()) { - lhs.InternalSwap(&rhs); + SwapRelaxed(lhs.payload_, rhs.payload_); return; } auto* p1 = lhs.maybe_payload(); @@ -141,23 +227,24 @@ void MapFieldBase::SwapImpl(MapFieldBase& lhs, MapFieldBase& rhs) { SwapRelaxed(p1->state, p2->state); } -void MapFieldBase::UnsafeShallowSwapImpl(MapFieldBase& lhs, MapFieldBase& rhs) { - ABSL_DCHECK_EQ(lhs.arena(), rhs.arena()); - lhs.InternalSwap(&rhs); -} - void MapFieldBase::InternalSwap(MapFieldBase* other) { - SwapRelaxed(payload_, other->payload_); + GetMapRaw().InternalSwap(&other->GetMapRaw()); + SwapPayload(*this, *other); } size_t MapFieldBase::SpaceUsedExcludingSelfLong() const { ConstAccess(); size_t size = 0; if (auto* p = maybe_payload()) { - { - absl::MutexLock lock(&p->mutex); - size = SpaceUsedExcludingSelfNoLock(); - } + absl::MutexLock lock(&p->mutex); + // Measure the map under the lock, because there could be some repeated + // field data that might be sync'd back into the map. + size = GetMapRaw().SpaceUsedExcludingSelfLong(); + size += p->repeated_field.SpaceUsedExcludingSelfLong(); + ConstAccess(); + } else { + // Only measure the map without the repeated field, because it is not there. + size = GetMapRaw().SpaceUsedExcludingSelfLong(); ConstAccess(); } return size; @@ -175,13 +262,6 @@ bool MapFieldBase::IsRepeatedFieldValid() const { return state() != STATE_MODIFIED_MAP; } -void MapFieldBase::SetMapDirty() { - MutableAccess(); - // These are called by (non-const) mutator functions. So by our API it's the - // callers responsibility to have these calls properly ordered. - payload().state.store(STATE_MODIFIED_MAP, std::memory_order_relaxed); -} - void MapFieldBase::SetRepeatedDirty() { MutableAccess(); // These are called by (non-const) mutator functions. So by our API it's the @@ -269,7 +349,8 @@ void MapFieldBase::SyncRepeatedFieldWithMapNoLock() { const MapValueRef& map_val = it.GetValueRef(); switch (val_des->cpp_type()) { case FieldDescriptor::CPPTYPE_STRING: - reflection->SetString(new_entry, val_des, map_val.GetStringValue()); + reflection->SetString(new_entry, val_des, + std::string(map_val.GetStringValue())); break; case FieldDescriptor::CPPTYPE_INT64: reflection->SetInt64(new_entry, val_des, map_val.GetInt64Value()); @@ -415,206 +496,6 @@ bool MapFieldBase::InsertOrLookupMapValue(const MapKey& map_key, return InsertOrLookupMapValueNoSync(map_key, val); } -// ------------------DynamicMapField------------------ -DynamicMapField::DynamicMapField(const Message* default_entry) - : DynamicMapField::TypeDefinedMapFieldBase(&kVTable), - default_entry_(default_entry) {} - -DynamicMapField::DynamicMapField(const Message* default_entry, Arena* arena) - : TypeDefinedMapFieldBase<MapKey, MapValueRef>(&kVTable, arena), - default_entry_(default_entry) {} - -constexpr DynamicMapField::VTable DynamicMapField::kVTable = - MakeVTable<DynamicMapField>(); - -DynamicMapField::~DynamicMapField() { - ABSL_DCHECK_EQ(arena(), nullptr); - // DynamicMapField owns map values. Need to delete them before clearing the - // map. - for (auto& kv : map_) { - kv.second.DeleteData(); - } - map_.clear(); -} - -void DynamicMapField::ClearMapNoSyncImpl(MapFieldBase& base) { - auto& self = static_cast<DynamicMapField&>(base); - if (self.arena() == nullptr) { - for (auto& elem : self.map_) { - elem.second.DeleteData(); - } - } - - self.map_.clear(); -} - -void DynamicMapField::AllocateMapValue(MapValueRef* map_val) { - const FieldDescriptor* val_des = default_entry_->GetDescriptor()->map_value(); - map_val->SetType(val_des->cpp_type()); - // Allocate memory for the MapValueRef, and initialize to - // default value. - switch (val_des->cpp_type()) { -#define HANDLE_TYPE(CPPTYPE, TYPE) \ - case FieldDescriptor::CPPTYPE_##CPPTYPE: { \ - auto* value = Arena::Create<TYPE>(arena()); \ - map_val->SetValue(value); \ - break; \ - } - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); - HANDLE_TYPE(DOUBLE, double); - HANDLE_TYPE(FLOAT, float); - HANDLE_TYPE(BOOL, bool); - HANDLE_TYPE(STRING, std::string); - HANDLE_TYPE(ENUM, int32_t); -#undef HANDLE_TYPE - case FieldDescriptor::CPPTYPE_MESSAGE: { - const Message& message = - default_entry_->GetReflection()->GetMessage(*default_entry_, val_des); - Message* value = message.New(arena()); - map_val->SetValue(value); - break; - } - } -} - -bool DynamicMapField::InsertOrLookupMapValueNoSyncImpl(MapFieldBase& base, - const MapKey& map_key, - MapValueRef* val) { - auto& self = static_cast<DynamicMapField&>(base); - Map<MapKey, MapValueRef>::iterator iter = self.map_.find(map_key); - if (iter == self.map_.end()) { - MapValueRef& map_val = self.map_[map_key]; - self.AllocateMapValue(&map_val); - val->CopyFrom(map_val); - return true; - } - // map_key is already in the map. Make sure (*map)[map_key] is not called. - // [] may reorder the map and iterators. - val->CopyFrom(iter->second); - return false; -} - -void DynamicMapField::MergeFromImpl(MapFieldBase& base, - const MapFieldBase& other) { - auto& self = static_cast<DynamicMapField&>(base); - ABSL_DCHECK(self.IsMapValid() && other.IsMapValid()); - Map<MapKey, MapValueRef>* map = self.MutableMap(); - const DynamicMapField& other_field = - reinterpret_cast<const DynamicMapField&>(other); - for (Map<MapKey, MapValueRef>::const_iterator other_it = - other_field.map_.begin(); - other_it != other_field.map_.end(); ++other_it) { - Map<MapKey, MapValueRef>::iterator iter = map->find(other_it->first); - MapValueRef* map_val; - if (iter == map->end()) { - map_val = &self.map_[other_it->first]; - self.AllocateMapValue(map_val); - } else { - map_val = &iter->second; - } - - // Copy map value - const FieldDescriptor* field_descriptor = - self.default_entry_->GetDescriptor()->map_value(); - switch (field_descriptor->cpp_type()) { - case FieldDescriptor::CPPTYPE_INT32: { - map_val->SetInt32Value(other_it->second.GetInt32Value()); - break; - } - case FieldDescriptor::CPPTYPE_INT64: { - map_val->SetInt64Value(other_it->second.GetInt64Value()); - break; - } - case FieldDescriptor::CPPTYPE_UINT32: { - map_val->SetUInt32Value(other_it->second.GetUInt32Value()); - break; - } - case FieldDescriptor::CPPTYPE_UINT64: { - map_val->SetUInt64Value(other_it->second.GetUInt64Value()); - break; - } - case FieldDescriptor::CPPTYPE_FLOAT: { - map_val->SetFloatValue(other_it->second.GetFloatValue()); - break; - } - case FieldDescriptor::CPPTYPE_DOUBLE: { - map_val->SetDoubleValue(other_it->second.GetDoubleValue()); - break; - } - case FieldDescriptor::CPPTYPE_BOOL: { - map_val->SetBoolValue(other_it->second.GetBoolValue()); - break; - } - case FieldDescriptor::CPPTYPE_STRING: { - map_val->SetStringValue(other_it->second.GetStringValue()); - break; - } - case FieldDescriptor::CPPTYPE_ENUM: { - map_val->SetEnumValue(other_it->second.GetEnumValue()); - break; - } - case FieldDescriptor::CPPTYPE_MESSAGE: { - map_val->MutableMessageValue()->CopyFrom( - other_it->second.GetMessageValue()); - break; - } - } - } -} - -const Message* DynamicMapField::GetPrototypeImpl(const MapFieldBase& map) { - return static_cast<const DynamicMapField&>(map).default_entry_; -} - -size_t DynamicMapField::SpaceUsedExcludingSelfNoLockImpl( - const MapFieldBase& map) { - auto& self = static_cast<const DynamicMapField&>(map); - size_t size = 0; - if (auto* p = self.maybe_payload()) { - size += p->repeated_field.SpaceUsedExcludingSelfLong(); - } - size_t map_size = self.map_.size(); - if (map_size) { - Map<MapKey, MapValueRef>::const_iterator it = self.map_.begin(); - size += sizeof(it->first) * map_size; - size += sizeof(it->second) * map_size; - // If key is string, add the allocated space. - if (it->first.type() == FieldDescriptor::CPPTYPE_STRING) { - size += sizeof(std::string) * map_size; - } - // Add the allocated space in MapValueRef. - switch (it->second.type()) { -#define HANDLE_TYPE(CPPTYPE, TYPE) \ - case FieldDescriptor::CPPTYPE_##CPPTYPE: { \ - size += sizeof(TYPE) * map_size; \ - break; \ - } - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); - HANDLE_TYPE(DOUBLE, double); - HANDLE_TYPE(FLOAT, float); - HANDLE_TYPE(BOOL, bool); - HANDLE_TYPE(STRING, std::string); - HANDLE_TYPE(ENUM, int32_t); -#undef HANDLE_TYPE - case FieldDescriptor::CPPTYPE_MESSAGE: { - while (it != self.map_.end()) { - const Message& message = it->second.GetMessageValue(); - size += message.GetReflection()->SpaceUsedLong(message); - ++it; - } - break; - } - } - } - return size; -} - } // namespace internal } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/map_field.h b/third_party/protobuf/src/google/protobuf/map_field.h index 656a99fdc04e1..8fbf37b583f58 100644 --- a/third_party/protobuf/src/google/protobuf/map_field.h +++ b/third_party/protobuf/src/google/protobuf/map_field.h @@ -16,13 +16,16 @@ #include <type_traits> #include <utility> +#include "absl/base/attributes.h" +#include "absl/base/config.h" +#include "absl/hash/hash.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" +#include "absl/types/variant.h" #include "google/protobuf/arena.h" #include "google/protobuf/descriptor.h" -#include "google/protobuf/explicitly_constructed.h" #include "google/protobuf/generated_message_reflection.h" #include "google/protobuf/generated_message_util.h" #include "google/protobuf/internal_visibility.h" @@ -65,23 +68,14 @@ class MapIterator; << FieldDescriptor::CppTypeName(type()); \ } -// MapKey is an union type for representing any possible -// map key. +// MapKey is an union type for representing any possible map key. For strings, +// map key does not own the underlying data. It is up to the caller to ensure +// any supplied strings outlive any instance of this class. class PROTOBUF_EXPORT MapKey { public: - MapKey() : type_() {} - MapKey(const MapKey& other) : type_() { CopyFrom(other); } - - MapKey& operator=(const MapKey& other) { - CopyFrom(other); - return *this; - } - - ~MapKey() { - if (type_ == FieldDescriptor::CPPTYPE_STRING) { - val_.string_value.Destruct(); - } - } + MapKey() = default; + MapKey(const MapKey&) = default; + MapKey& operator=(const MapKey&) = default; FieldDescriptor::CppType type() const { if (type_ == FieldDescriptor::CppType()) { @@ -114,7 +108,7 @@ class PROTOBUF_EXPORT MapKey { } void SetStringValue(absl::string_view val) { SetType(FieldDescriptor::CPPTYPE_STRING); - val_.string_value.get_mutable()->assign(val.data(), val.size()); + val_.string_value = val; } int64_t GetInt64Value() const { @@ -139,7 +133,7 @@ class PROTOBUF_EXPORT MapKey { } absl::string_view GetStringValue() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_STRING, "MapKey::GetStringValue"); - return val_.string_value.get(); + return val_.string_value; } bool operator<(const MapKey& other) const { @@ -156,7 +150,7 @@ class PROTOBUF_EXPORT MapKey { ABSL_LOG(FATAL) << "Unsupported"; return false; case FieldDescriptor::CPPTYPE_STRING: - return val_.string_value.get() < other.val_.string_value.get(); + return val_.string_value < other.val_.string_value; case FieldDescriptor::CPPTYPE_INT64: return val_.int64_value < other.val_.int64_value; case FieldDescriptor::CPPTYPE_INT32: @@ -184,7 +178,7 @@ class PROTOBUF_EXPORT MapKey { ABSL_LOG(FATAL) << "Unsupported"; break; case FieldDescriptor::CPPTYPE_STRING: - return val_.string_value.get() == other.val_.string_value.get(); + return val_.string_value == other.val_.string_value; case FieldDescriptor::CPPTYPE_INT64: return val_.int64_value == other.val_.int64_value; case FieldDescriptor::CPPTYPE_INT32: @@ -210,7 +204,7 @@ class PROTOBUF_EXPORT MapKey { ABSL_LOG(FATAL) << "Unsupported"; break; case FieldDescriptor::CPPTYPE_STRING: - *val_.string_value.get_mutable() = other.val_.string_value.get(); + val_.string_value = other.val_.string_value; break; case FieldDescriptor::CPPTYPE_INT64: val_.int64_value = other.val_.int64_value; @@ -235,11 +229,30 @@ class PROTOBUF_EXPORT MapKey { friend class internal::TypeDefinedMapFieldBase; friend class internal::MapFieldBase; friend class MapIterator; - friend class internal::DynamicMapField; + + template <typename H> + friend auto AbslHashValue(H state, const MapKey& key) { + switch (key.type()) { + case FieldDescriptor::CPPTYPE_STRING: + return H::combine(std::move(state), key.GetStringValue()); + case FieldDescriptor::CPPTYPE_INT64: + return H::combine(std::move(state), key.GetInt64Value()); + case FieldDescriptor::CPPTYPE_INT32: + return H::combine(std::move(state), key.GetInt32Value()); + case FieldDescriptor::CPPTYPE_UINT64: + return H::combine(std::move(state), key.GetUInt64Value()); + case FieldDescriptor::CPPTYPE_UINT32: + return H::combine(std::move(state), key.GetUInt32Value()); + case FieldDescriptor::CPPTYPE_BOOL: + return H::combine(std::move(state), key.GetBoolValue()); + default: + internal::Unreachable(); + } + } union KeyValue { KeyValue() {} - internal::ExplicitlyConstructed<std::string> string_value; + absl::string_view string_value; int64_t int64_value; int32_t int32_value; uint64_t uint64_value; @@ -247,20 +260,11 @@ class PROTOBUF_EXPORT MapKey { bool bool_value; } val_; - void SetType(FieldDescriptor::CppType type) { - if (type_ == type) return; - if (type_ == FieldDescriptor::CPPTYPE_STRING) { - val_.string_value.Destruct(); - } - type_ = type; - if (type_ == FieldDescriptor::CPPTYPE_STRING) { - val_.string_value.DefaultConstruct(); - } - } + void SetType(FieldDescriptor::CppType type) { type_ = type; } // type_ is 0 or a valid FieldDescriptor::CppType. // Use "CppType()" to indicate zero. - FieldDescriptor::CppType type_; + FieldDescriptor::CppType type_ = FieldDescriptor::CppType(); }; namespace internal { @@ -268,18 +272,6 @@ namespace internal { template <> struct is_internal_map_key_type<MapKey> : std::true_type {}; -template <> -struct RealKeyToVariantKey<MapKey> { - VariantKey operator()(const MapKey& value) const; -}; - -template <> -struct RealKeyToVariantKeyAlternative<MapKey> { - VariantKey operator()(const MapKey& value) const { - return RealKeyToVariantKey<MapKey>{}(value); - } -}; - } // namespace internal namespace internal { @@ -292,15 +284,23 @@ template <typename MessageT> struct MapDynamicFieldInfo; struct MapFieldTestPeer; +// Return the prototype message for a Map entry. +// REQUIRES: `default_entry` is a map entry message. +// REQUIRES: mapped_type is of type message. +inline const Message& GetMapEntryValuePrototype(const Message& default_entry) { + return default_entry.GetReflection()->GetMessage( + default_entry, default_entry.GetDescriptor()->map_value()); +} + // This class provides access to map field using reflection, which is the same // as those provided for RepeatedPtrField<Message>. It is used for internal // reflection implementation only. Users should never use this directly. class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { public: - explicit constexpr MapFieldBase(const VTable* vtable) - : MapFieldBaseForParse(vtable) {} - explicit MapFieldBase(const VTable* vtable, Arena* arena) - : MapFieldBaseForParse(vtable), payload_{ToTaggedPtr(arena)} {} + explicit constexpr MapFieldBase(const void* prototype_as_void) + : MapFieldBaseForParse(prototype_as_void) {} + explicit MapFieldBase(const Message* prototype, Arena* arena) + : MapFieldBaseForParse(prototype, ToTaggedPtr(arena)) {} MapFieldBase(const MapFieldBase&) = delete; MapFieldBase& operator=(const MapFieldBase&) = delete; @@ -308,39 +308,6 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { // "protected" stops users from deleting a `MapFieldBase *` ~MapFieldBase(); - struct VTable : MapFieldBaseForParse::VTable { - bool (*lookup_map_value)(const MapFieldBase& map, const MapKey& map_key, - MapValueConstRef* val); - bool (*delete_map_value)(MapFieldBase& map, const MapKey& map_key); - void (*set_map_iterator_value)(MapIterator* map_iter); - bool (*insert_or_lookup_no_sync)(MapFieldBase& map, const MapKey& map_key, - MapValueRef* val); - - void (*clear_map_no_sync)(MapFieldBase& map); - void (*merge_from)(MapFieldBase& map, const MapFieldBase& other); - void (*swap)(MapFieldBase& lhs, MapFieldBase& rhs); - void (*unsafe_shallow_swap)(MapFieldBase& lhs, MapFieldBase& rhs); - size_t (*space_used_excluding_self_nolock)(const MapFieldBase& map); - - const Message* (*get_prototype)(const MapFieldBase& map); - }; - template <typename T> - static constexpr VTable MakeVTable() { - VTable out{}; - out.get_map = &T::GetMapImpl; - out.lookup_map_value = &T::LookupMapValueImpl; - out.delete_map_value = &T::DeleteMapValueImpl; - out.set_map_iterator_value = &T::SetMapIteratorValueImpl; - out.insert_or_lookup_no_sync = &T::InsertOrLookupMapValueNoSyncImpl; - out.clear_map_no_sync = &T::ClearMapNoSyncImpl; - out.merge_from = &T::MergeFromImpl; - out.swap = &T::SwapImpl; - out.unsafe_shallow_swap = &T::UnsafeShallowSwapImpl; - out.space_used_excluding_self_nolock = &T::SpaceUsedExcludingSelfNoLockImpl; - out.get_prototype = &T::GetPrototypeImpl; - return out; - } - public: // Returns reference to internal repeated field. Data written using // Map's api prior to calling this function is guarantted to be @@ -350,13 +317,12 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { // Like above. Returns mutable pointer to the internal repeated field. RepeatedPtrFieldBase* MutableRepeatedField(); - const VTable* vtable() const { return static_cast<const VTable*>(vtable_); } - bool ContainsMapKey(const MapKey& map_key) const { return LookupMapValue(map_key, static_cast<MapValueConstRef*>(nullptr)); } bool LookupMapValue(const MapKey& map_key, MapValueConstRef* val) const { - return vtable()->lookup_map_value(*this, map_key, val); + SyncMapWithRepeatedField(); + return LookupMapValueNoSync(map_key, val); } bool LookupMapValue(const MapKey&, MapValueRef*) const = delete; @@ -366,22 +332,14 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { bool IsRepeatedFieldValid() const; // Insures operations after won't get executed before calling this. bool IsMapValid() const; - bool DeleteMapValue(const MapKey& map_key) { - return vtable()->delete_map_value(*this, map_key); - } - void MergeFrom(const MapFieldBase& other) { - vtable()->merge_from(*this, other); - } - void Swap(MapFieldBase* other) { vtable()->swap(*this, *other); } - void UnsafeShallowSwap(MapFieldBase* other) { - vtable()->unsafe_shallow_swap(*this, *other); - } + bool DeleteMapValue(const MapKey& map_key); + void MergeFrom(const MapFieldBase& other); + void Swap(MapFieldBase* other); + void InternalSwap(MapFieldBase* other); // Sync Map with repeated field and returns the size of map. int size() const; void Clear(); - void SetMapIteratorValue(MapIterator* map_iter) const { - return vtable()->set_map_iterator_value(map_iter); - } + void SetMapIteratorValue(MapIterator* map_iter) const; void MapBegin(MapIterator* map_iter) const; void MapEnd(MapIterator* map_iter) const; @@ -400,13 +358,10 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { } protected: - // Gets the size of space used by map field. - size_t SpaceUsedExcludingSelfNoLock() const { - return vtable()->space_used_excluding_self_nolock(*this); + const Message* GetPrototype() const { + return reinterpret_cast<const Message*>(prototype_as_void_); } - - const Message* GetPrototype() const { return vtable()->get_prototype(*this); } - void ClearMapNoSync() { return vtable()->clear_map_no_sync(*this); } + void ClearMapNoSync(); // Synchronizes the content in Map to RepeatedPtrField if there is any change // to Map after last synchronization. @@ -418,11 +373,18 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { void SyncMapWithRepeatedField() const; void SyncMapWithRepeatedFieldNoLock(); - static void SwapImpl(MapFieldBase& lhs, MapFieldBase& rhs); - static void UnsafeShallowSwapImpl(MapFieldBase& lhs, MapFieldBase& rhs); + static void SwapPayload(MapFieldBase& lhs, MapFieldBase& rhs); // Tells MapFieldBase that there is new change to Map. - void SetMapDirty(); + void SetMapDirty() { + MutableAccess(); + // These are called by (non-const) mutator functions. So by our API it's the + // callers responsibility to have these calls properly ordered. + if (auto* p = maybe_payload()) { + // If we don't have a payload, it is already assumed `STATE_MODIFIED_MAP`. + p->state.store(STATE_MODIFIED_MAP, std::memory_order_relaxed); + } + } // Tells MapFieldBase that there is new change to RepeatedPtrField. void SetRepeatedDirty(); @@ -430,27 +392,24 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { // Provides derived class the access to repeated field. void* MutableRepeatedPtrField() const; - bool InsertOrLookupMapValueNoSync(const MapKey& map_key, MapValueRef* val) { - return vtable()->insert_or_lookup_no_sync(*this, map_key, val); - } - - void InternalSwap(MapFieldBase* other); + bool InsertOrLookupMapValueNoSync(const MapKey& map_key, MapValueRef* val); // Support thread sanitizer (tsan) by making const / mutable races // more apparent. If one thread calls MutableAccess() while another // thread calls either ConstAccess() or MutableAccess(), on the same // MapFieldBase-derived object, and there is no synchronization going // on between them, tsan will alert. -#if defined(PROTOBUF_TSAN) - void ConstAccess() const { ABSL_CHECK_EQ(seq1_, seq2_); } - void MutableAccess() { - if (seq1_ & 1) { - seq2_ = ++seq1_; - } else { - seq1_ = ++seq2_; - } +#if defined(ABSL_HAVE_THREAD_SANITIZER) + // Using prototype_as_void_ as an arbitrary member that we can read/write. + void ConstAccess() const { + auto* p = prototype_as_void_; + asm volatile("" : "+r"(p)); + } + void MutableAccess() { + auto* p = prototype_as_void_; + asm volatile("" : "+r"(p)); + prototype_as_void_ = p; } - unsigned int seq1_ = 0, seq2_ = 0; #else void ConstAccess() const {} void MutableAccess() {} @@ -497,9 +456,6 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { : STATE_MODIFIED_MAP; } - static const UntypedMapBase& GetMapImpl(const MapFieldBaseForParse& map, - bool is_mutable); - private: friend class ContendedMapCleanTest; friend class GeneratedMessageReflection; @@ -507,12 +463,19 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { friend class google::protobuf::Reflection; friend class google::protobuf::DynamicMessage; - // See assertion in TypeDefinedMapFieldBase::TypeDefinedMapFieldBase() - const UntypedMapBase& GetMapRaw() const { - return *reinterpret_cast<const UntypedMapBase*>(this + 1); + template <typename T, typename... U> + void InitializeKeyValue(T* v, const U&... init) { + ::new (static_cast<void*>(v)) T(init...); + if constexpr (std::is_same_v<std::string, T>) { + if (arena() != nullptr) { + arena()->OwnDestructor(v); + } + } } - UntypedMapBase& GetMapRaw() { - return *reinterpret_cast<UntypedMapBase*>(this + 1); + + void InitializeKeyValue(MessageLite* msg) { + GetClassData(GetMapEntryValuePrototype(*GetPrototype())) + ->PlacementNew(msg, arena()); } // Virtual helper methods for MapIterator. MapIterator doesn't have the @@ -529,9 +492,7 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { // It implements the ++ operator of MapIterator. void IncreaseIterator(MapIterator* map_iter) const; - enum class TaggedPtr : uintptr_t {}; - static constexpr uintptr_t kHasPayloadBit = 1; - + bool LookupMapValueNoSync(const MapKey& map_key, MapValueConstRef* val) const; static ReflectionPayload* ToPayload(TaggedPtr p) { ABSL_DCHECK(IsPayload(p)); auto* res = reinterpret_cast<ReflectionPayload*>(static_cast<uintptr_t>(p) - @@ -550,11 +511,6 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { static TaggedPtr ToTaggedPtr(Arena* p) { return static_cast<TaggedPtr>(reinterpret_cast<uintptr_t>(p)); } - static bool IsPayload(TaggedPtr p) { - return static_cast<uintptr_t>(p) & kHasPayloadBit; - } - - mutable std::atomic<TaggedPtr> payload_{}; }; // This class provides common Map Reflection implementations for generated @@ -562,27 +518,26 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { template <typename Key, typename T> class TypeDefinedMapFieldBase : public MapFieldBase { public: - explicit constexpr TypeDefinedMapFieldBase(const VTable* vtable) - : MapFieldBase(vtable), map_() { - // This invariant is required by MapFieldBase to easily access the map - // member without paying for dynamic dispatch. It reduces code size. - static_assert(PROTOBUF_FIELD_OFFSET(TypeDefinedMapFieldBase, map_) == - sizeof(MapFieldBase), - ""); + explicit constexpr TypeDefinedMapFieldBase(const void* prototype_as_void) + : MapFieldBase(prototype_as_void), map_() { + // This invariant is required by `GetMapRaw` to easily access the map + // member without paying for dynamic dispatch. + static_assert(MapFieldBaseForParse::MapOffset() == + PROTOBUF_FIELD_OFFSET(TypeDefinedMapFieldBase, map_)); } TypeDefinedMapFieldBase(const TypeDefinedMapFieldBase&) = delete; TypeDefinedMapFieldBase& operator=(const TypeDefinedMapFieldBase&) = delete; - TypeDefinedMapFieldBase(const VTable* vtable, Arena* arena) - : MapFieldBase(vtable, arena), map_(arena) {} + TypeDefinedMapFieldBase(const Message* prototype, Arena* arena) + : MapFieldBase(prototype, arena), map_(arena) {} + + TypeDefinedMapFieldBase(const Message* prototype, Arena* arena, + const TypeDefinedMapFieldBase& from) + : MapFieldBase(prototype, arena), map_(arena, from.GetMap()) {} protected: ~TypeDefinedMapFieldBase() { map_.~Map(); } - // Not all overrides are marked `final` here because DynamicMapField overrides - // them. DynamicMapField does extra memory management for the elements and - // needs to override the functions that create or destroy elements. - public: const Map<Key, T>& GetMap() const { SyncMapWithRepeatedField(); @@ -595,12 +550,13 @@ class TypeDefinedMapFieldBase : public MapFieldBase { return &map_; } - static void ClearMapNoSyncImpl(MapFieldBase& map) { - static_cast<TypeDefinedMapFieldBase&>(map).map_.clear(); + // This overload is called from codegen, so we use templates for speed. + // If there is no codegen (eg optimize_for=CODE_SIZE), then only the + // reflection based one above will be used. + void MergeFrom(const TypeDefinedMapFieldBase& other) { + internal::MapMergeFrom(*MutableMap(), other.GetMap()); } - void InternalSwap(TypeDefinedMapFieldBase* other); - static constexpr size_t InternalGetArenaOffsetAlt( internal::InternalVisibility access) { return PROTOBUF_FIELD_OFFSET(TypeDefinedMapFieldBase, map_) + @@ -612,20 +568,6 @@ class TypeDefinedMapFieldBase : public MapFieldBase { using Iter = typename Map<Key, T>::const_iterator; - static bool DeleteMapValueImpl(MapFieldBase& map, const MapKey& map_key); - static bool LookupMapValueImpl(const MapFieldBase& self, - const MapKey& map_key, MapValueConstRef* val); - static void SetMapIteratorValueImpl(MapIterator* map_iter); - static bool InsertOrLookupMapValueNoSyncImpl(MapFieldBase& map, - const MapKey& map_key, - MapValueRef* val); - - static void MergeFromImpl(MapFieldBase& base, const MapFieldBase& other); - static void SwapImpl(MapFieldBase& lhs, MapFieldBase& rhs); - static void UnsafeShallowSwapImpl(MapFieldBase& lhs, MapFieldBase& rhs); - - static size_t SpaceUsedExcludingSelfNoLockImpl(const MapFieldBase& map); - // map_ is inside an anonymous union so we can explicitly control its // destruction union { @@ -650,40 +592,33 @@ class MapField final : public TypeDefinedMapFieldBase<Key, T> { static constexpr WireFormatLite::FieldType kKeyFieldType = kKeyFieldType_; static constexpr WireFormatLite::FieldType kValueFieldType = kValueFieldType_; - constexpr MapField() : MapField::TypeDefinedMapFieldBase(&kVTable) {} + constexpr MapField() + : MapField::TypeDefinedMapFieldBase( + Derived::internal_default_instance()) {} MapField(const MapField&) = delete; MapField& operator=(const MapField&) = delete; ~MapField() = default; explicit MapField(Arena* arena) - : TypeDefinedMapFieldBase<Key, T>(&kVTable, arena) {} + : TypeDefinedMapFieldBase<Key, T>( + static_cast<const Message*>(Derived::internal_default_instance()), + arena) {} MapField(ArenaInitialized, Arena* arena) : MapField(arena) {} MapField(InternalVisibility, Arena* arena) : MapField(arena) {} MapField(InternalVisibility, Arena* arena, const MapField& from) - : MapField(arena) { - this->MergeFromImpl(*this, from); - } + : TypeDefinedMapFieldBase<Key, T>( + static_cast<const Message*>(Derived::internal_default_instance()), + arena, from) {} private: typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - static const Message* GetPrototypeImpl(const MapFieldBase& map); - - static const MapFieldBase::VTable kVTable; - friend class google::protobuf::Arena; friend class MapFieldBase; friend class MapFieldStateTest; // For testing, it needs raw access to impl_ }; -template <typename Derived, typename Key, typename T, - WireFormatLite::FieldType kKeyFieldType_, - WireFormatLite::FieldType kValueFieldType_> -PROTOBUF_CONSTINIT_WITH_PTR const MapFieldBase::VTable - MapField<Derived, Key, T, kKeyFieldType_, kValueFieldType_>::kVTable = - MapField::template MakeVTable<MapField>(); - template <typename Key, typename T> bool AllAreInitialized(const TypeDefinedMapFieldBase<Key, T>& field) { for (const auto& p : field.GetMap()) { @@ -692,40 +627,6 @@ bool AllAreInitialized(const TypeDefinedMapFieldBase<Key, T>& field) { return true; } -class PROTOBUF_EXPORT DynamicMapField final - : public TypeDefinedMapFieldBase<MapKey, MapValueRef> { - public: - explicit DynamicMapField(const Message* default_entry); - DynamicMapField(const Message* default_entry, Arena* arena); - DynamicMapField(const DynamicMapField&) = delete; - DynamicMapField& operator=(const DynamicMapField&) = delete; - ~DynamicMapField(); - - private: - friend class MapFieldBase; - - const Message* default_entry_; - - static const VTable kVTable; - - void AllocateMapValue(MapValueRef* map_val); - - static void MergeFromImpl(MapFieldBase& base, const MapFieldBase& other); - static bool InsertOrLookupMapValueNoSyncImpl(MapFieldBase& base, - const MapKey& map_key, - MapValueRef* val); - static void ClearMapNoSyncImpl(MapFieldBase& base); - - static void UnsafeShallowSwapImpl(MapFieldBase& lhs, MapFieldBase& rhs) { - static_cast<DynamicMapField&>(lhs).Swap( - static_cast<DynamicMapField*>(&rhs)); - } - - static size_t SpaceUsedExcludingSelfNoLockImpl(const MapFieldBase& map); - - static const Message* GetPrototypeImpl(const MapFieldBase& map); -}; - } // namespace internal // MapValueConstRef points to a map value. Users can NOT modify @@ -762,10 +663,10 @@ class PROTOBUF_EXPORT MapValueConstRef { TYPE_CHECK(FieldDescriptor::CPPTYPE_ENUM, "MapValueConstRef::GetEnumValue"); return *reinterpret_cast<int*>(data_); } - const std::string& GetStringValue() const { + absl::string_view GetStringValue() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_STRING, "MapValueConstRef::GetStringValue"); - return *reinterpret_cast<std::string*>(data_); + return absl::string_view(*reinterpret_cast<std::string*>(data_)); } float GetFloatValue() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_FLOAT, @@ -810,7 +711,6 @@ class PROTOBUF_EXPORT MapValueConstRef { friend class internal::TypeDefinedMapFieldBase; friend class google::protobuf::MapIterator; friend class Reflection; - friend class internal::DynamicMapField; friend class internal::MapFieldBase; void SetValueOrCopy(const void* val) { SetValue(val); } @@ -855,9 +755,9 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef { TYPE_CHECK(FieldDescriptor::CPPTYPE_ENUM, "MapValueRef::SetEnumValue"); *reinterpret_cast<int*>(data_) = value; } - void SetStringValue(const std::string& value) { + void SetStringValue(absl::string_view value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_STRING, "MapValueRef::SetStringValue"); - *reinterpret_cast<std::string*>(data_) = value; + reinterpret_cast<std::string*>(data_)->assign(value.data(), value.size()); } void SetFloatValue(float value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_FLOAT, "MapValueRef::SetFloatValue"); @@ -873,31 +773,6 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef { "MapValueRef::MutableMessageValue"); return reinterpret_cast<Message*>(data_); } - - private: - friend class internal::DynamicMapField; - - // Only used in DynamicMapField - void DeleteData() { - switch (type_) { -#define HANDLE_TYPE(CPPTYPE, TYPE) \ - case FieldDescriptor::CPPTYPE_##CPPTYPE: { \ - delete reinterpret_cast<TYPE*>(data_); \ - break; \ - } - HANDLE_TYPE(INT32, int32_t); - HANDLE_TYPE(INT64, int64_t); - HANDLE_TYPE(UINT32, uint32_t); - HANDLE_TYPE(UINT64, uint64_t); - HANDLE_TYPE(DOUBLE, double); - HANDLE_TYPE(FLOAT, float); - HANDLE_TYPE(BOOL, bool); - HANDLE_TYPE(STRING, std::string); - HANDLE_TYPE(ENUM, int32_t); - HANDLE_TYPE(MESSAGE, Message); -#undef HANDLE_TYPE - } - } }; #undef TYPE_CHECK @@ -943,7 +818,6 @@ class PROTOBUF_EXPORT MapIterator { private: template <typename Key, typename T> friend class internal::TypeDefinedMapFieldBase; - friend class internal::DynamicMapField; template <typename Derived, typename Key, typename T, internal::WireFormatLite::FieldType kKeyFieldType, internal::WireFormatLite::FieldType kValueFieldType> diff --git a/third_party/protobuf/src/google/protobuf/map_field_inl.h b/third_party/protobuf/src/google/protobuf/map_field_inl.h index 5dfed435468ca..5d23bd38f8349 100644 --- a/third_party/protobuf/src/google/protobuf/map_field_inl.h +++ b/third_party/protobuf/src/google/protobuf/map_field_inl.h @@ -23,175 +23,6 @@ #include "google/protobuf/message.h" #include "google/protobuf/port.h" -// must be last -#include "google/protobuf/port_def.inc" - -#ifdef SWIG -#error "You cannot SWIG proto headers" -#endif - -namespace google { -namespace protobuf { -namespace internal { -// UnwrapMapKey template. We're using overloading rather than template -// specialization so that we can return a value or reference type depending on -// `T`. -inline int32_t UnwrapMapKeyImpl(const MapKey& map_key, const int32_t*) { - return map_key.GetInt32Value(); -} -inline uint32_t UnwrapMapKeyImpl(const MapKey& map_key, const uint32_t*) { - return map_key.GetUInt32Value(); -} -inline int64_t UnwrapMapKeyImpl(const MapKey& map_key, const int64_t*) { - return map_key.GetInt64Value(); -} -inline uint64_t UnwrapMapKeyImpl(const MapKey& map_key, const uint64_t*) { - return map_key.GetUInt64Value(); -} -inline bool UnwrapMapKeyImpl(const MapKey& map_key, const bool*) { - return map_key.GetBoolValue(); -} -inline absl::string_view UnwrapMapKeyImpl(const MapKey& map_key, - const std::string*) { - return map_key.GetStringValue(); -} -inline const MapKey& UnwrapMapKeyImpl(const MapKey& map_key, const MapKey*) { - return map_key; -} - -template <typename T> -decltype(auto) UnwrapMapKey(const MapKey& map_key) { - return UnwrapMapKeyImpl(map_key, static_cast<T*>(nullptr)); -} - -// SetMapKey -inline void SetMapKey(MapKey* map_key, int32_t value) { - map_key->SetInt32Value(value); -} -inline void SetMapKey(MapKey* map_key, uint32_t value) { - map_key->SetUInt32Value(value); -} -inline void SetMapKey(MapKey* map_key, int64_t value) { - map_key->SetInt64Value(value); -} -inline void SetMapKey(MapKey* map_key, uint64_t value) { - map_key->SetUInt64Value(value); -} -inline void SetMapKey(MapKey* map_key, bool value) { - map_key->SetBoolValue(value); -} -inline void SetMapKey(MapKey* map_key, const std::string& value) { - map_key->SetStringValue(value); -} -inline void SetMapKey(MapKey* map_key, const MapKey& value) { - map_key->CopyFrom(value); -} - -// ------------------------TypeDefinedMapFieldBase--------------- -template <typename Key, typename T> -void TypeDefinedMapFieldBase<Key, T>::SetMapIteratorValueImpl( - MapIterator* map_iter) { - if (map_iter->iter_.Equals(UntypedMapBase::EndIterator())) return; - auto iter = typename Map<Key, T>::const_iterator(map_iter->iter_); - SetMapKey(&map_iter->key_, iter->first); - map_iter->value_.SetValueOrCopy(&iter->second); -} - -template <typename Key, typename T> -bool TypeDefinedMapFieldBase<Key, T>::InsertOrLookupMapValueNoSyncImpl( - MapFieldBase& map, const MapKey& map_key, MapValueRef* val) { - auto res = static_cast<TypeDefinedMapFieldBase&>(map).map_.try_emplace( - UnwrapMapKey<Key>(map_key)); - val->SetValue(&res.first->second); - return res.second; -} - -template <typename Key, typename T> -bool TypeDefinedMapFieldBase<Key, T>::LookupMapValueImpl( - const MapFieldBase& self, const MapKey& map_key, MapValueConstRef* val) { - const auto& map = static_cast<const TypeDefinedMapFieldBase&>(self).GetMap(); - auto iter = map.find(UnwrapMapKey<Key>(map_key)); - if (map.end() == iter) { - return false; - } - if (val != nullptr) { - val->SetValueOrCopy(&iter->second); - } - return true; -} - -template <typename Key, typename T> -bool TypeDefinedMapFieldBase<Key, T>::DeleteMapValueImpl( - MapFieldBase& map, const MapKey& map_key) { - return static_cast<TypeDefinedMapFieldBase&>(map).MutableMap()->erase( - UnwrapMapKey<Key>(map_key)); -} - -template <typename Key, typename T> -void TypeDefinedMapFieldBase<Key, T>::SwapImpl(MapFieldBase& lhs, - MapFieldBase& rhs) { - MapFieldBase::SwapImpl(lhs, rhs); - static_cast<TypeDefinedMapFieldBase&>(lhs).map_.swap( - static_cast<TypeDefinedMapFieldBase&>(rhs).map_); -} - -template <typename Key, typename T> -void TypeDefinedMapFieldBase<Key, T>::MergeFromImpl(MapFieldBase& base, - const MapFieldBase& other) { - auto& self = static_cast<TypeDefinedMapFieldBase&>(base); - self.SyncMapWithRepeatedField(); - const auto& other_field = static_cast<const TypeDefinedMapFieldBase&>(other); - other_field.SyncMapWithRepeatedField(); - internal::MapMergeFrom(self.map_, other_field.map_); - self.SetMapDirty(); -} - -template <typename Key, typename T> -size_t TypeDefinedMapFieldBase<Key, T>::SpaceUsedExcludingSelfNoLockImpl( - const MapFieldBase& map) { - auto& self = static_cast<const TypeDefinedMapFieldBase&>(map); - size_t size = 0; - if (auto* p = self.maybe_payload()) { - size += p->repeated_field.SpaceUsedExcludingSelfLong(); - } - // We can't compile this expression for DynamicMapField even though it is - // never used at runtime, so disable it at compile time. - std::get<std::is_same<Map<Key, T>, Map<MapKey, MapValueRef>>::value>( - std::make_tuple( - [&](const auto& map) { size += map.SpaceUsedExcludingSelfLong(); }, - [](const auto&) {}))(self.map_); - return size; -} - -template <typename Key, typename T> -void TypeDefinedMapFieldBase<Key, T>::UnsafeShallowSwapImpl(MapFieldBase& lhs, - MapFieldBase& rhs) { - static_cast<TypeDefinedMapFieldBase&>(lhs).InternalSwap( - static_cast<TypeDefinedMapFieldBase*>(&rhs)); -} - -template <typename Key, typename T> -void TypeDefinedMapFieldBase<Key, T>::InternalSwap( - TypeDefinedMapFieldBase* other) { - MapFieldBase::InternalSwap(other); - map_.InternalSwap(&other->map_); -} - -// ---------------------------------------------------------------------- - -template <typename Derived, typename Key, typename T, - WireFormatLite::FieldType kKeyFieldType, - WireFormatLite::FieldType kValueFieldType> -const Message* -MapField<Derived, Key, T, kKeyFieldType, kValueFieldType>::GetPrototypeImpl( - const MapFieldBase&) { - return Derived::internal_default_instance(); -} - -} // namespace internal -} // namespace protobuf -} // namespace google - -#include "google/protobuf/port_undef.inc" +// TODO: Remove this file now that it is empty #endif // GOOGLE_PROTOBUF_MAP_FIELD_INL_H__ diff --git a/third_party/protobuf/src/google/protobuf/map_field_test.cc b/third_party/protobuf/src/google/protobuf/map_field_test.cc index 94e7465dd3226..f2ce0d91dc53e 100644 --- a/third_party/protobuf/src/google/protobuf/map_field_test.cc +++ b/third_party/protobuf/src/google/protobuf/map_field_test.cc @@ -452,6 +452,18 @@ TEST(MapFieldTest, ConstInit) { EXPECT_EQ(field.size(), 0); } +TEST(MapFieldTest, MutableMapDoesNotAllocatePayload) { + struct MaybePayload : MapFieldBase { + // Use a derived type to get access to the protected method. + // We steal the function pointer here to use below to inspect the instance. + static constexpr auto getter() { return &MaybePayload::maybe_payload; } + }; + MyMapField field; + EXPECT_FALSE((field.*MaybePayload::getter())()); + field.MutableMap(); + EXPECT_FALSE((field.*MaybePayload::getter())()); +} + } // namespace internal } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/map_lite_test_util.h b/third_party/protobuf/src/google/protobuf/map_lite_test_util.h index aab850d70fcad..766ce35801258 100644 --- a/third_party/protobuf/src/google/protobuf/map_lite_test_util.h +++ b/third_party/protobuf/src/google/protobuf/map_lite_test_util.h @@ -16,39 +16,39 @@ namespace protobuf { class MapLiteTestUtil { public: // Set every field in the TestMapLite message to a unique value. - static void SetMapFields(protobuf_unittest::TestMapLite* message); + static void SetMapFields(proto2_unittest::TestMapLite* message); // Set every field in the TestArenaMapLite message to a unique value. - static void SetArenaMapFields(protobuf_unittest::TestArenaMapLite* message); + static void SetArenaMapFields(proto2_unittest::TestArenaMapLite* message); // Set every field in the message to a default value. - static void SetMapFieldsInitialized(protobuf_unittest::TestMapLite* message); + static void SetMapFieldsInitialized(proto2_unittest::TestMapLite* message); // Modify all the map fields of the message (which should already have been // initialized with SetMapFields()). - static void ModifyMapFields(protobuf_unittest::TestMapLite* message); + static void ModifyMapFields(proto2_unittest::TestMapLite* message); // Check that all fields have the values that they should have after // SetMapFields() is called. - static void ExpectMapFieldsSet(const protobuf_unittest::TestMapLite& message); + static void ExpectMapFieldsSet(const proto2_unittest::TestMapLite& message); // Check that all fields have the values that they should have after // SetMapFields() is called for TestArenaMapLite. static void ExpectArenaMapFieldsSet( - const protobuf_unittest::TestArenaMapLite& message); + const proto2_unittest::TestArenaMapLite& message); // Check that all fields have the values that they should have after // SetMapFieldsInitialized() is called. static void ExpectMapFieldsSetInitialized( - const protobuf_unittest::TestMapLite& message); + const proto2_unittest::TestMapLite& message); // Expect that the message is modified as would be expected from // ModifyMapFields(). static void ExpectMapFieldsModified( - const protobuf_unittest::TestMapLite& message); + const proto2_unittest::TestMapLite& message); // Check that all fields are empty. - static void ExpectClear(const protobuf_unittest::TestMapLite& message); + static void ExpectClear(const proto2_unittest::TestMapLite& message); }; } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/map_lite_unittest.proto b/third_party/protobuf/src/google/protobuf/map_lite_unittest.proto index b42b3de88e1f0..3bf3e2c23ddbd 100644 --- a/third_party/protobuf/src/google/protobuf/map_lite_unittest.proto +++ b/third_party/protobuf/src/google/protobuf/map_lite_unittest.proto @@ -7,7 +7,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/unittest_lite.proto"; diff --git a/third_party/protobuf/src/google/protobuf/map_probe_benchmark.cc b/third_party/protobuf/src/google/protobuf/map_probe_benchmark.cc index 550de51a4edd6..cee6d3ffd3ba7 100644 --- a/third_party/protobuf/src/google/protobuf/map_probe_benchmark.cc +++ b/third_party/protobuf/src/google/protobuf/map_probe_benchmark.cc @@ -30,36 +30,16 @@ struct MapBenchmarkPeer { static double GetMeanProbeLength(const T& map) { double total_probe_cost = 0; for (map_index_t b = 0; b < map.num_buckets_; ++b) { - if (map.TableEntryIsList(b)) { - auto* node = internal::TableEntryToNode(map.table_[b]); - size_t cost = 0; - while (node != nullptr) { - total_probe_cost += static_cast<double>(cost); - cost++; - node = node->next; - } - } else if (map.TableEntryIsTree(b)) { - // Overhead factor to account for more costly binary search. - constexpr double kTreeOverhead = 2.0; - size_t tree_size = TableEntryToTree(map.table_[b])->size(); - total_probe_cost += kTreeOverhead * static_cast<double>(tree_size) * - std::log2(tree_size); + auto* node = map.table_[b]; + size_t cost = 0; + while (node != nullptr) { + total_probe_cost += static_cast<double>(cost); + cost++; + node = node->next; } } return total_probe_cost / map.size(); } - - template <typename T> - static double GetPercentTree(const T& map) { - size_t total_tree_size = 0; - for (map_index_t b = 0; b < map.num_buckets_; ++b) { - if (map.TableEntryIsTree(b)) { - total_tree_size += TableEntryToTree(map.table_[b])->size(); - } - } - return static_cast<double>(total_tree_size) / - static_cast<double>(map.size()); - } }; } // namespace protobuf } // namespace google::internal @@ -111,7 +91,6 @@ struct Ratios { double min_load; double avg_load; double max_load; - double percent_tree; }; template <class ElemFn> @@ -132,7 +111,6 @@ Ratios CollectMeanProbeLengths() { while (t.size() < min_max_sizes.max_load) t[elem()]; result.max_load = Peer::GetMeanProbeLength(t); - result.percent_tree = Peer::GetPercentTree(t); return result; } @@ -297,7 +275,6 @@ int main(int argc, char** argv) { print("min", &Ratios::min_load); print("avg", &Ratios::avg_load); print("max", &Ratios::max_load); - print("tree_percent", &Ratios::percent_tree); } absl::PrintF(" ],\n"); absl::PrintF(" \"context\": {\n"); diff --git a/third_party/protobuf/src/google/protobuf/map_proto2_unittest.proto b/third_party/protobuf/src/google/protobuf/map_proto2_unittest.proto index 34a3812898836..a9c09e80c1da9 100644 --- a/third_party/protobuf/src/google/protobuf/map_proto2_unittest.proto +++ b/third_party/protobuf/src/google/protobuf/map_proto2_unittest.proto @@ -13,8 +13,8 @@ option cc_enable_arenas = true; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -// In map_test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest; +// In map_test_util.h we do "using namespace unittest = proto2_unittest". +package proto2_unittest; enum Proto2MapEnum { PROTO2_MAP_ENUM_FOO = 0; @@ -68,7 +68,7 @@ message TestEnumMapPlusExtra { } message TestImportEnumMap { - map<int32, protobuf_unittest_import.ImportEnumForMap> import_enum_amp = 1; + map<int32, proto2_unittest_import.ImportEnumForMap> import_enum_amp = 1; } message TestIntIntMap { diff --git a/third_party/protobuf/src/google/protobuf/map_proto3_unittest.proto b/third_party/protobuf/src/google/protobuf/map_proto3_unittest.proto index 29a3b367a28f7..5c9d5c512941a 100644 --- a/third_party/protobuf/src/google/protobuf/map_proto3_unittest.proto +++ b/third_party/protobuf/src/google/protobuf/map_proto3_unittest.proto @@ -14,7 +14,7 @@ option features.field_presence = IMPLICIT; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -// In map_test_util.h we do "using namespace unittest = protobuf_unittest". +// In map_test_util.h we do "using namespace unittest = proto2_unittest". package proto3_unittest; message TestProto3BytesMap { diff --git a/third_party/protobuf/src/google/protobuf/map_test.cc b/third_party/protobuf/src/google/protobuf/map_test.cc index a779c0fcb16f5..4dfc292f219c1 100644 --- a/third_party/protobuf/src/google/protobuf/map_test.cc +++ b/third_party/protobuf/src/google/protobuf/map_test.cc @@ -7,6 +7,7 @@ #include "google/protobuf/map.h" +#include <algorithm> #include <array> #include <cstddef> #include <cstdint> @@ -30,10 +31,9 @@ #include "google/protobuf/unittest_import.pb.h" -#define BRIDGE_UNITTEST ::google::protobuf::bridge_unittest -#define UNITTEST ::protobuf_unittest -#define UNITTEST_IMPORT ::protobuf_unittest_import -#define UNITTEST_PACKAGE_NAME "protobuf_unittest" +#define UNITTEST ::proto2_unittest +#define UNITTEST_IMPORT ::proto2_unittest_import +#define UNITTEST_PACKAGE_NAME "proto2_unittest" // Must include after defining UNITTEST, etc. // clang-format off @@ -48,19 +48,6 @@ namespace google { namespace protobuf { namespace internal { - -struct AlignedAsDefault { - int x; -}; -struct alignas(8) AlignedAs8 { - int x; -}; - -template <> -struct is_internal_map_value_type<AlignedAsDefault> : std::true_type {}; -template <> -struct is_internal_map_value_type<AlignedAs8> : std::true_type {}; - namespace { using ::testing::AllOf; @@ -68,7 +55,7 @@ using ::testing::FieldsAre; using ::testing::Ge; using ::testing::Le; using ::testing::UnorderedElementsAre; - +using ::testing::UnorderedElementsAreArray; TEST(MapTest, CopyConstructIntegers) { auto token = internal::InternalVisibilityForTesting{}; @@ -172,10 +159,40 @@ TEST(MapTest, CopyConstructMessagesWithArena) { EXPECT_EQ(map1["2"].GetArena(), &arena); } +TEST(MapTest, CopyConstructionMaintainsProperLoadFactor) { + Map<int, int> original; + for (size_t size = 1; size < 50; ++size) { + // Add one element. + original[size]; + Map<int, int> copy = original; + ASSERT_THAT(copy, UnorderedElementsAreArray(original)); + EXPECT_LE(copy.size(), + MapTestPeer::CalculateHiCutoff(MapTestPeer::NumBuckets(copy))); + } +} + +TEST(MapTest, CalculateCapacityForSizeTest) { + for (size_t size = 1; size < 1000; ++size) { + size_t capacity = MapTestPeer::CalculateCapacityForSize(size); + // Verify is large enough for `size`. + EXPECT_LE(size, MapTestPeer::CalculateHiCutoff(capacity)); + if (capacity > MapTestPeer::kMinTableSize) { + // Verify it's the smallest capacity that's large enough. + EXPECT_GT(size, MapTestPeer::CalculateHiCutoff(capacity / 2)); + } + } + + // Verify very large size does not overflow bucket calculation. + for (size_t size : {0x30000001u, 0x40000000u, 0x50000000u, 0x60000000u, + 0x70000000u, 0x80000000u, 0x90000000u, 0xFFFFFFFFu}) { + EXPECT_EQ(0x80000000u, MapTestPeer::CalculateCapacityForSize(size)); + } +} + TEST(MapTest, AlwaysSerializesBothEntries) { for (const Message* prototype : {static_cast<const Message*>( - &protobuf_unittest::TestI32StrMap::default_instance()), + &proto2_unittest::TestI32StrMap::default_instance()), static_cast<const Message*>( &proto3_unittest::TestI32StrMap::default_instance())}) { const FieldDescriptor* map_field = @@ -260,6 +277,27 @@ TEST(MapTest, NaturalGrowthOnArenasReuseBlocks) { EXPECT_THAT(arena.SpaceUsed(), AllOf(Ge(expected), Le(1.02 * expected))); } +TEST(MapTest, ErasingEnoughCausesDownwardRehashOnNextInsert) { + for (size_t capacity = 1; capacity < 1000; capacity *= 2) { + const size_t max_size = MapTestPeer::CalculateHiCutoff(capacity); + for (size_t min_size = 1; min_size < max_size / 4; ++min_size) { + Map<int, int> m; + while (m.size() < max_size) m[m.size()]; + const size_t num_buckets = MapTestPeer::NumBuckets(m); + while (m.size() > min_size) m.erase(m.size() - 1); + // Erasing doesn't shrink the table. + ASSERT_EQ(num_buckets, MapTestPeer::NumBuckets(m)); + // This insertion causes a shrinking rehash because the load factor is too + // low. + m[99999]; + size_t new_num_buckets = MapTestPeer::NumBuckets(m); + EXPECT_LT(new_num_buckets, num_buckets); + EXPECT_LE(m.size(), + MapTestPeer::CalculateHiCutoff(MapTestPeer::NumBuckets(m))); + } + } +} + // We changed the internal implementation to use a smaller size type, but the // public API will still use size_t to avoid changing the API. Test that. TEST(MapTest, SizeTypeIsSizeT) { @@ -271,6 +309,132 @@ TEST(MapTest, SizeTypeIsSizeT) { (void)x; } +using KeyTypes = void (*)(bool, int32_t, uint32_t, int64_t, uint64_t, + std::string); +// Some arbitrary proto enum. +using SomeEnum = proto2_unittest::TestAllTypes::NestedEnum; +using ValueTypes = void (*)(bool, int32_t, uint32_t, int64_t, uint64_t, float, + double, std::string, SomeEnum, + proto2_unittest::TestEmptyMessage, + proto2_unittest::TestAllTypes); + +TEST(MapTest, StaticTypeKindWorks) { + using UMB = UntypedMapBase; + EXPECT_EQ(UMB::TypeKind::kBool, UMB::StaticTypeKind<bool>()); + EXPECT_EQ(UMB::TypeKind::kU32, UMB::StaticTypeKind<int32_t>()); + EXPECT_EQ(UMB::TypeKind::kU32, UMB::StaticTypeKind<uint32_t>()); + EXPECT_EQ(UMB::TypeKind::kU32, UMB::StaticTypeKind<SomeEnum>()); + EXPECT_EQ(UMB::TypeKind::kU64, UMB::StaticTypeKind<int64_t>()); + EXPECT_EQ(UMB::TypeKind::kU64, UMB::StaticTypeKind<uint64_t>()); + EXPECT_EQ(UMB::TypeKind::kString, UMB::StaticTypeKind<std::string>()); + EXPECT_EQ(UMB::TypeKind::kMessage, + UMB::StaticTypeKind<proto2_unittest::TestAllTypes>()); +} + +#if !defined(__GNUC__) || defined(__clang__) || PROTOBUF_GNUC_MIN(9, 4) +// Parameter pack expansion bug before GCC 8.2: +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85305 + +template <typename F, typename... Key, typename... Value> +void TestAllKeyValueTypes(void (*)(Key...), void (*)(Value...), F f) { + ( + [f]() { + using K = Key; + (f(K{}, Value{}), ...); + }(), + ...); +} + +TEST(MapTest, StaticTypeInfoMatchesDynamicOne) { + TestAllKeyValueTypes(KeyTypes(), ValueTypes(), [](auto key, auto value) { + using Key = decltype(key); + using Value = decltype(value); + const MessageLite* value_prototype = nullptr; + if constexpr (std::is_base_of_v<MessageLite, Value>) { + value_prototype = &Value::default_instance(); + } + const auto type_info = MapTestPeer::GetTypeInfo<Map<Key, Value>>(); + const auto dyn_type_info = internal::UntypedMapBase::GetTypeInfoDynamic( + type_info.key_type_kind(), type_info.value_type_kind(), + value_prototype); + EXPECT_EQ(dyn_type_info.node_size, type_info.node_size); + EXPECT_EQ(dyn_type_info.value_offset, type_info.value_offset); + EXPECT_EQ(dyn_type_info.key_type, type_info.key_type); + EXPECT_EQ(dyn_type_info.value_type, type_info.value_type); + }); +} + +template <typename LHS, typename RHS> +void TestEqPtr(LHS* lhs, RHS* rhs) { + // To silence some false positive compiler errors in gcc 9.5 + (void)lhs; + (void)rhs; + if constexpr (std::is_integral_v<LHS> && std::is_signed_v<LHS>) { + // Visitation uses unsigned types always, so fix that here. + return TestEqPtr(reinterpret_cast<std::make_unsigned_t<LHS>*>(lhs), rhs); + } else if constexpr (std::is_enum_v<LHS>) { + // Enums are visited as uint32_t, so check that. + EXPECT_TRUE((std::is_same_v<uint32_t, RHS>)); + EXPECT_EQ(static_cast<void*>(lhs), static_cast<void*>(rhs)); + } else if constexpr (std::is_same_v<std::decay_t<LHS>, std::decay_t<RHS>> || + std::is_base_of_v<LHS, RHS> || + std::is_base_of_v<RHS, LHS>) { + EXPECT_EQ(lhs, rhs); + } else { + FAIL() << "Wrong types"; + } +} + +TEST(MapTest, VistiKeyValueUsesTheRightTypes) { + TestAllKeyValueTypes(KeyTypes(), ValueTypes(), [](auto key, auto value) { + using Key = decltype(key); + using Value = decltype(value); + Map<Key, Value> map; + map[Key{}]; + auto& base = reinterpret_cast<UntypedMapBase&>(map); + NodeBase* node = base.begin().node_; + // We use a runtime check because all the different overloads are + // instantiated, but only the right one should be called at runtime. + int key_result = base.VisitKey(node, [&](auto* k) { + TestEqPtr(&map.begin()->first, k); + return 17; + }); + EXPECT_EQ(key_result, 17); + int value_result = base.VisitValue(node, [&](auto* v) { + TestEqPtr(&map.begin()->second, v); + return 1979; + }); + EXPECT_EQ(value_result, 1979); + }); +} + +TEST(MapTest, VisitAllNodesUsesTheRightTypesOnAllNodes) { + TestAllKeyValueTypes(KeyTypes(), ValueTypes(), [](auto key, auto value) { + using Key = decltype(key); + using Value = decltype(value); + Map<Key, Value> map; + for (int i = 0; i < 3; ++i, key += 1) { + map[key]; + } + + // We should have 3 elements, unless key is bool. + ASSERT_EQ(map.size(), (std::is_same_v<Key, bool> ? 2 : 3)); + + auto it = map.begin(); + auto& base = reinterpret_cast<UntypedMapBase&>(map); + base.VisitAllNodes([&](auto* key, auto* value) { + // We use a runtime check because all the different overloads are + // instantiated, but only the right one should be called at runtime. + TestEqPtr(&it->first, key); + TestEqPtr(&it->second, value); + ++it; + }); + EXPECT_TRUE(it == map.end()); + }); +} + +#endif + TEST(MapTest, IteratorNodeFieldIsNullPtrAtEnd) { Map<int, int> map; EXPECT_EQ(internal::UntypedMapIterator::FromTyped(map.cbegin()).node_, @@ -282,23 +446,6 @@ TEST(MapTest, IteratorNodeFieldIsNullPtrAtEnd) { EXPECT_EQ(internal::UntypedMapIterator::FromTyped(map.cend()).node_, nullptr); } -template <typename Aligned, bool on_arena = false> -void MapTest_Aligned() { - Arena arena; - constexpr size_t align_mask = alignof(Aligned) - 1; - Map<int, Aligned> map(on_arena ? &arena : nullptr); - map.insert({1, Aligned{}}); - auto it = map.find(1); - ASSERT_NE(it, map.end()); - ASSERT_EQ(reinterpret_cast<intptr_t>(&it->second) & align_mask, 0); - map.clear(); -} - -TEST(MapTest, Aligned) { MapTest_Aligned<AlignedAsDefault>(); } -TEST(MapTest, AlignedOnArena) { MapTest_Aligned<AlignedAsDefault, true>(); } -TEST(MapTest, Aligned8) { MapTest_Aligned<AlignedAs8>(); } -TEST(MapTest, Aligned8OnArena) { MapTest_Aligned<AlignedAs8, true>(); } - } // namespace diff --git a/third_party/protobuf/src/google/protobuf/map_test.inc b/third_party/protobuf/src/google/protobuf/map_test.inc index 6e4d261c1318a..7e5b062c00069 100644 --- a/third_party/protobuf/src/google/protobuf/map_test.inc +++ b/third_party/protobuf/src/google/protobuf/map_test.inc @@ -15,6 +15,7 @@ #endif // _WIN32 #include <algorithm> +#include <cstddef> #include <memory> #include <random> #include <sstream> @@ -49,6 +50,7 @@ #include "google/protobuf/port.h" #include "google/protobuf/reflection.h" #include "google/protobuf/reflection_ops.h" +#include "google/protobuf/test_textproto.h" #include "google/protobuf/test_util2.h" #include "google/protobuf/text_format.h" #include "google/protobuf/util/message_differencer.h" @@ -76,93 +78,6 @@ void MapTestForceDeterministic() { io::CodedOutputStream::SetDefaultSerializationDeterministic(); } -struct MoveTestKey { - MoveTestKey(int data, int* copies) : data(data), copies(copies) {} - - MoveTestKey(const MoveTestKey& other) - : data(other.data), copies(other.copies) { - ++*copies; - } - - MoveTestKey(MoveTestKey&& other) noexcept - : data(other.data), copies(other.copies) {} - - friend bool operator==(const MoveTestKey& lhs, const MoveTestKey& rhs) { - return lhs.data == rhs.data; - } - friend bool operator<(const MoveTestKey& lhs, const MoveTestKey& rhs) { - return lhs.data < rhs.data; - } - - int data; - int* copies; -}; - -enum class ConstructorType { - kDefault, - kCopy, - kMove, -}; - -struct ConstructorTag { - ConstructorTag() : invoked_constructor(ConstructorType::kDefault) {} - ConstructorTag(const ConstructorTag&) - : invoked_constructor(ConstructorType::kCopy) {} - ConstructorTag(ConstructorTag&&) - : invoked_constructor(ConstructorType::kMove) {} - - bool operator<(const ConstructorTag&) const { return false; } - - ConstructorType invoked_constructor; -}; - -struct CountedInstance { - CountedInstance() { ++num_created; } - CountedInstance(const CountedInstance&) : CountedInstance() {} - CountedInstance(CountedInstance&&) : CountedInstance() {} - - CountedInstance& operator=(const CountedInstance&) { - ++num_assigned; - return *this; - } - - explicit CountedInstance(int x) : CountedInstance() {} - - static int num_created; - static int num_assigned; -}; - -int CountedInstance::num_created = 0; -int CountedInstance::num_assigned = 0; - -struct ArenaConstructible { - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - - ArenaConstructible() = default; - ArenaConstructible(const ArenaConstructible&) = default; - ArenaConstructible(Arena*) : ArenaConstructible() {} - - ArenaConstructible& operator=(const ArenaConstructible&) = default; - - explicit ArenaConstructible(int) : ArenaConstructible() {} - - Arena* arena() const { return nullptr; } - - CountedInstance unused; -}; - -template <> -struct is_internal_map_key_type<MoveTestKey> : std::true_type {}; -template <> -struct is_internal_map_key_type<ConstructorTag> : std::true_type {}; -template <> -struct is_internal_map_value_type<ConstructorTag> : std::true_type {}; -template <> -struct is_internal_map_value_type<ArenaConstructible> : std::true_type {}; -template <> -struct is_internal_map_value_type<CountedInstance> : std::true_type {}; - struct MapTestPeer { template <typename T> static typename T::KeyMapBase& GetKeyMapBase(T& value) { @@ -175,13 +90,7 @@ struct MapTestPeer { using Node = typename T::Node; auto* node = static_cast<Node*>(map.AllocNode(sizeof(Node))); ::new (static_cast<void*>(&node->kv)) typename T::value_type{key, value}; - node = static_cast<Node*>(GetKeyMapBase(map).InsertOrReplaceNode(node)); - if (node) { - node->~Node(); - GetKeyMapBase(map).DeallocNode(node, sizeof(Node)); - return false; - } - return true; + return GetKeyMapBase(map).InsertOrReplaceNode(node); } template <typename T> @@ -199,21 +108,23 @@ struct MapTestPeer { map.Resize(num_buckets); } - template <typename T> - static bool HasTreeBuckets(T& map) { - for (size_t i = 0; i < map.num_buckets_; ++i) { - if (TableEntryIsTree(map.table_[i])) return true; - } - return false; - } - - static int CalculateHiCutoff(int num_buckets) { + static size_t CalculateHiCutoff(size_t num_buckets) { return Map<int, int>::CalculateHiCutoff(num_buckets); } + + static size_t CalculateCapacityForSize(size_t size) { + return Map<int, int>::CalculateCapacityForSize(size); + } + + template <typename Map> + static auto GetTypeInfo() { + return Map::GetTypeInfo(); + } + + static constexpr size_t kMinTableSize = UntypedMapBase::kMinTableSize; }; namespace { -using internal::DownCast; // Map API Test ===================================================== @@ -315,47 +226,30 @@ TEST_F(MapImplTest, OperatorBracket) { } // namespace protobuf } // namespace google -namespace std { - -template <> // NOLINT -struct hash<google::protobuf::internal::MoveTestKey> { - size_t operator()(const google::protobuf::internal::MoveTestKey& key) const { - return hash<uint64_t>{}(key.data); - } -}; -} // namespace std - namespace google { namespace protobuf { namespace internal { - -template <> -struct RealKeyToVariantKey<MoveTestKey> { - VariantKey operator()(const MoveTestKey& value) const { - return VariantKey(value.data); - } -}; - -template <> -struct RealKeyToVariantKeyAlternative<MoveTestKey> { - VariantKey operator()(const MoveTestKey& value) const { - return VariantKey(value.data); - } -}; - namespace { TEST_F(MapImplTest, OperatorBracketRValue) { Arena arena; for (Arena* arena_to_use : {&arena, static_cast<Arena*>(nullptr)}) { - int copies = 0; - Map<MoveTestKey, int> map(arena_to_use); - MoveTestKey key1(1, &copies); - EXPECT_EQ(copies, 0); - map[key1] = 0; - EXPECT_EQ(copies, 1); - map[MoveTestKey(2, &copies)] = 2; - EXPECT_EQ(copies, 1); + Map<std::string, int> map(arena_to_use); + { + std::string key(10000, 'a'); + const char* const data = key.data(); + map[key] = 0; + EXPECT_EQ(data, key.data()); + EXPECT_NE(data, map.find(std::string(10000, 'a'))->first.data()); + } + + { + std::string key(10000, 'b'); + const char* const data = key.data(); + map[std::move(key)] = 0; + EXPECT_NE(data, key.data()); // NOLINT + EXPECT_EQ(data, map.find(std::string(10000, 'b'))->first.data()); + } } } @@ -489,49 +383,6 @@ static int k0 = 812398771; static int k1 = 1312938717; static int k2 = 1321555333; -// Finds inputs that will fall in the first few buckets for this particular map -// (with the random seed it has) and this particular size. -static std::vector<int> FindBadInputs(Map<int, int>& map, int num_inputs) { - // Make sure the seed and the size is set so that BucketNumber works. - while (map.size() < num_inputs) map[map.size()]; - map.clear(); - - std::vector<int> out; - - for (int i = 0; out.size() < num_inputs; ++i) { - if (MapTestPeer::BucketNumber(map, i) < 3) { - out.push_back(i); - } - } - - // Reset the table to get it to grow from scratch again. - // The capacity will be lost, but we will get it again on insertion. - // It will also keep the seed. - map.clear(); - MapTestPeer::Resize(map, 8); - - return out; -} - -TEST_F(MapImplTest, TreePathWorksAsExpected) { - const std::vector<int> s = FindBadInputs(map_, 1000); - - for (int i : s) { - map_[i] = 0; - } - // Make sure we are testing what we think we are testing. - ASSERT_TRUE(MapTestPeer::HasTreeBuckets(map_)); - for (int i : s) { - ASSERT_NE(map_.find(i), map_.end()) << i; - } - for (int i : s) { - ASSERT_EQ(1, map_.erase(i)) << i; - } - EXPECT_FALSE(MapTestPeer::HasTreeBuckets(map_)); - EXPECT_TRUE(map_.empty()); -} - - TEST_F(MapImplTest, CopyIteratorStressTest) { std::vector<Map<int32_t, int32_t>::iterator> v; const int kIters = 1e5; @@ -865,84 +716,21 @@ TEST_F(MapImplTest, Emplace) { m, UnorderedElementsAre(Pair(1, "one"), Pair(2, "two"), Pair(42, "aaa"))); } -TEST_F(MapImplTest, ValueTypeHasMoveConstructor) { - using vt = typename Map<ConstructorTag, ConstructorTag>::value_type; - ConstructorTag l, r; - - vt pair(l, std::move(r)); - - EXPECT_EQ(pair.first.invoked_constructor, ConstructorType::kCopy); - EXPECT_EQ(pair.second.invoked_constructor, ConstructorType::kMove); -} - TEST_F(MapImplTest, TryEmplaceExisting) { - Map<int32_t, CountedInstance> m; + Arena arena; + Map<int32_t, int32_t>& m = *Arena::Create<Map<int32_t, int32_t>>(&arena); + const size_t size1 = arena.SpaceUsed(); m.try_emplace(1, 1); ASSERT_EQ(m.size(), 1); - CountedInstance::num_created = 0; - CountedInstance::num_assigned = 0; + const size_t size2 = arena.SpaceUsed(); + ASSERT_GT(size2, size1); + m.try_emplace(1, 123); EXPECT_EQ(m.size(), 1); - EXPECT_EQ(CountedInstance::num_created, 0); - EXPECT_EQ(CountedInstance::num_assigned, 0); -} -TEST_F(MapImplTest, TryEmplaceArenaConstructible) { - ASSERT_TRUE(Arena::is_arena_constructable<ArenaConstructible>::value); - - ArenaConstructible v1, v2; - - Map<int32_t, ArenaConstructible> m; - - // "default" construction - CountedInstance::num_created = 0; - CountedInstance::num_assigned = 0; - m.try_emplace(1); - EXPECT_EQ(m.size(), 1); - EXPECT_EQ(CountedInstance::num_created, 1); - EXPECT_EQ(CountedInstance::num_assigned, 0); - - // "default" construction + copy assignment - CountedInstance::num_created = 0; - CountedInstance::num_assigned = 0; - m.try_emplace(2, v1); - EXPECT_EQ(m.size(), 2); - EXPECT_EQ(CountedInstance::num_created, 1); - EXPECT_EQ(CountedInstance::num_assigned, 1); - - // "default" construction + move assignment - CountedInstance::num_created = 0; - CountedInstance::num_assigned = 0; - m.try_emplace(3, std::move(v2)); - EXPECT_EQ(m.size(), 3); - EXPECT_EQ(CountedInstance::num_created, 1); - EXPECT_EQ(CountedInstance::num_assigned, 1); - - // "default" construction + in-place temporary + move assignment - CountedInstance::num_created = 0; - CountedInstance::num_assigned = 0; - m.try_emplace(4, 239); - EXPECT_EQ(m.size(), 4); - EXPECT_EQ(CountedInstance::num_created, 2); - EXPECT_EQ(CountedInstance::num_assigned, 1); -} - -TEST_F(MapImplTest, TryEmplaceExistingArenaConstructible) { - ASSERT_TRUE(Arena::is_arena_constructable<ArenaConstructible>::value); - - Map<int32_t, ArenaConstructible> m; - - m.try_emplace(1, 1); - ASSERT_EQ(m.size(), 1); - - CountedInstance::num_created = 0; - CountedInstance::num_assigned = 0; - m.try_emplace(1, 123); - EXPECT_EQ(m.size(), 1); - EXPECT_EQ(CountedInstance::num_created, 0); - EXPECT_EQ(CountedInstance::num_assigned, 0); + EXPECT_EQ(size2, arena.SpaceUsed()); } TEST_F(MapImplTest, EmplaceSingle) { @@ -1283,6 +1071,110 @@ TEST_F(MapImplTest, SwapFieldArenaReflection) { } } +TEST_F(MapImplTest, RecursiveMapTypeDoesNotDeadlockOnDynamicMessage) { + const auto* descriptor = UNITTEST::TestRecursiveMapMessage::descriptor(); + const auto* entry_descriptor = + descriptor->FindFieldByNumber(1)->message_type(); + + { + // Start at the message + DynamicMessageFactory factory; + const Message* prototype = factory.GetPrototype(descriptor); + std::unique_ptr<Message> msg(prototype->New()); + } + { + // Start at the map entry + DynamicMessageFactory factory; + const Message* prototype = factory.GetPrototype(entry_descriptor); + std::unique_ptr<Message> msg(prototype->New()); + } +} + +TEST_F(MapImplTest, DeleteMapValues) { + auto* descriptor = UNITTEST::TestMap::descriptor(); + + DynamicMessageFactory factory; + std::unique_ptr<Message> dyn_message(factory.GetPrototype(descriptor)->New()); + std::unique_ptr<Message> gen_message = std::make_unique<TestMap>(); + Arena arena; + + for (auto* message : {gen_message.get(), dyn_message.get(), + gen_message->New(&arena), dyn_message->New(&arena)}) { + MapReflectionTester reflection_tester(descriptor); + reflection_tester.SetMapFieldsViaMapReflection(message); + + // Each maps has two elements. Let's remove the smallest one first, so that + // we can test the result. Then remove the rest and test again. + + for (int i = 0; i < descriptor->field_count(); ++i) { + auto* field = descriptor->field(i); + if (!field->is_map()) continue; + + MapIterator it = reflection_tester.MapBegin(message, field->name()); + MapIterator end = reflection_tester.MapEnd(message, field->name()); + // It's unordered, so search for it. + if (it == end) continue; + auto next = it; + ++next; + ASSERT_NE(next, end); + if (next.GetKey() < it.GetKey()) { + it = next; + } + + EXPECT_EQ(reflection_tester.MapSize(*message, field->name()), 2); + reflection_tester.DeleteMapValueViaMapReflection( + message, field->name(), it.GetKey()); + EXPECT_EQ(reflection_tester.MapSize(*message, field->name()), 1); + } + + EXPECT_THAT(*message, EqualsProto(R"pb( + map_int32_int32 { key: 1 value: 1 } + map_int64_int64 { key: 1 value: 1 } + map_uint32_uint32 { key: 1 value: 1 } + map_uint64_uint64 { key: 1 value: 1 } + map_sint32_sint32 { key: 1 value: 1 } + map_sint64_sint64 { key: 1 value: 1 } + map_fixed32_fixed32 { key: 1 value: 1 } + map_fixed64_fixed64 { key: 1 value: 1 } + map_sfixed32_sfixed32 { key: 1 value: 1 } + map_sfixed64_sfixed64 { key: 1 value: 1 } + map_int32_float { key: 1 value: 1 } + map_int32_double { key: 1 value: 1 } + map_bool_bool { key: true value: true } + map_string_string { + key: "This is another very long string that goes in the heap" + value: "This is another very long string that goes in the heap" + } + map_int32_bytes { + key: 1 + value: "This is another very long string that goes in the heap" + } + map_int32_enum { key: 1 value: MAP_ENUM_BAZ } + map_int32_foreign_message { + key: 1 + value { c: 1 } + } + )pb")); + + for (int i = 0; i < descriptor->field_count(); ++i) { + auto* field = descriptor->field(i); + if (!field->is_map()) continue; + + MapIterator it = reflection_tester.MapBegin(message, field->name()); + MapIterator end = reflection_tester.MapEnd(message, field->name()); + + while (it != end) { + auto next = it; + ++next; + reflection_tester.DeleteMapValueViaMapReflection( + message, field->name(), it.GetKey()); + it = next; + } + EXPECT_EQ(reflection_tester.MapSize(*message, field->name()), 0); + } + } +} + TEST_F(MapImplTest, CopyAssignMapIterator) { TestMap message; MapReflectionTester reflection_tester(UNITTEST::TestMap::descriptor()); @@ -1293,6 +1185,167 @@ TEST_F(MapImplTest, CopyAssignMapIterator) { EXPECT_EQ(it1.GetKey().GetInt32Value(), it2.GetKey().GetInt32Value()); } +class MapTestWithParams + : public testing::TestWithParam<std::tuple<bool, bool, bool>> {}; + +INSTANTIATE_TEST_SUITE_P(MapTestWithParamsSuite, MapTestWithParams, + testing::Combine(testing::Bool(), testing::Bool(), + testing::Bool())); + +TEST_P(MapTestWithParams, SwapMapsFieldsViaReflection) { + auto* descriptor = UNITTEST::TestMap::descriptor(); + auto [use_dynamic, lhs_arena, rhs_arena] = GetParam(); + + DynamicMessageFactory factory; + std::unique_ptr<const Message> dyn_message( + factory.GetPrototype(descriptor)->New()); + TestMap gen_message; + Arena arena; + + std::vector<const FieldDescriptor*> fields; + for (int i = 0; i < descriptor->field_count(); ++i) { + fields.push_back(descriptor->field(i)); + } + + const auto make = [&, use_dynamic = use_dynamic](bool in_arena) { + auto* prototype = use_dynamic ? dyn_message.get() : &gen_message; + return in_arena ? prototype->New(&arena) + : Arena::Create<std::unique_ptr<Message>>(&arena, + prototype->New()) + ->get(); + }; + + auto* lhs = make(lhs_arena); + auto* rhs = make(rhs_arena); + MapReflectionTester reflection_tester(descriptor); + reflection_tester.SetMapFieldsViaMapReflection(lhs); + + reflection_tester.ExpectMapFieldsSetViaReflectionIterator(lhs); + reflection_tester.ExpectClearViaReflectionIterator(rhs); + + lhs->GetReflection()->SwapFields(lhs, rhs, fields); + + reflection_tester.ExpectClearViaReflectionIterator(lhs); + reflection_tester.ExpectMapFieldsSetViaReflectionIterator(rhs); + + if (lhs_arena == rhs_arena) { + // If they are the same arena, we can try the unsafe swap. + lhs->GetReflection()->UnsafeArenaSwapFields(lhs, rhs, fields); + reflection_tester.ExpectClearViaReflectionIterator(rhs); + reflection_tester.ExpectMapFieldsSetViaReflectionIterator(lhs); + } +} + +class MapTestCodegenOrDynamic : public testing::TestWithParam<bool> {}; + +INSTANTIATE_TEST_SUITE_P(MapTestCodegenOrDynamicSuite, MapTestCodegenOrDynamic, + testing::Bool()); + +TEST_F(MapImplTest, CopyConstructMapSyncsRepeatedFieldRep) { + TestMap msg; + + const auto* reflection = msg.GetReflection(); + const auto* field = msg.GetDescriptor()->FindFieldByName("map_int32_int32"); + + { + auto* sub = reflection->AddMessage(&msg, field); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_key(), 10); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_value(), 100); + } + + TestMap copy = msg; + EXPECT_THAT(msg, + EqualsProto(R"pb(map_int32_int32 { key: 10 value: 100 })pb")); + EXPECT_THAT(copy, + EqualsProto(R"pb(map_int32_int32 { key: 10 value: 100 })pb")); +} + +TEST_F(MapImplTest, CopyAssignMapSyncsRepeatedFieldRep) { + TestMap msg; + + const auto* reflection = msg.GetReflection(); + const auto* field = msg.GetDescriptor()->FindFieldByName("map_int32_int32"); + + { + auto* sub = reflection->AddMessage(&msg, field); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_key(), 10); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_value(), 100); + } + + TestMap dst; + dst = msg; + EXPECT_THAT(msg, + EqualsProto(R"pb(map_int32_int32 { key: 10 value: 100 })pb")); + EXPECT_THAT(dst, + EqualsProto(R"pb(map_int32_int32 { key: 10 value: 100 })pb")); +} + +TEST_F(MapImplTest, MergeMapSyncsRepeatedFieldRep) { + TestMap msg; + + const auto* reflection = msg.GetReflection(); + const auto* field = msg.GetDescriptor()->FindFieldByName("map_int32_int32"); + + { + auto* sub = reflection->AddMessage(&msg, field); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_key(), 10); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_value(), 100); + } + + TestMap dst; + { + auto* sub = reflection->AddMessage(&dst, field); + // A duplicate key + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_key(), 10); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_value(), 200); + sub = reflection->AddMessage(&dst, field); + // A unique key + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_key(), 11); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_value(), 17); + } + dst.MergeFrom(msg); + EXPECT_THAT(msg, + EqualsProto(R"pb(map_int32_int32 { key: 10 value: 100 })pb")); + EXPECT_THAT(dst, EqualsProto(R"pb( + map_int32_int32 { key: 10 value: 100 } + map_int32_int32 { key: 11 value: 17 } + )pb")); +} + +TEST_P(MapTestCodegenOrDynamic, LookupMapValueSyncsRepeatedFieldRep) { + auto* descriptor = UNITTEST::TestMap::descriptor(); + bool use_dynamic = GetParam(); + + DynamicMessageFactory factory; + std::unique_ptr<Message> dyn_message( + factory.GetPrototype(descriptor)->New()); + TestMap gen_message; + Message* msg = use_dynamic ? dyn_message.get() : &gen_message; + + const auto* reflection = msg->GetReflection(); + const auto* field = msg->GetDescriptor()->FindFieldByName("map_int32_int32"); + + MapKey map_key; + map_key.SetInt32Value(10); + auto res = + MapReflectionTester::LookupMapValue(*reflection, *msg, *field, map_key); + // Check that we don't have it yet. + ASSERT_FALSE(res.has_value()); + + { + auto* sub = reflection->AddMessage(msg, field); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_key(), 10); + sub->GetReflection()->SetInt32(sub, sub->GetDescriptor()->map_value(), 100); + } + + + res = MapReflectionTester::LookupMapValue(*reflection, *msg, *field, map_key); + // If this fails, LookupMapValue might have failed to sync from the repeated + // field. + ASSERT_TRUE(res.has_value()); + EXPECT_EQ(res->GetInt32Value(), 100); +} + TEST_F(MapImplTest, SpaceUsed) { constexpr size_t kMinCap = 16 / sizeof(void*); @@ -1341,9 +1394,9 @@ TEST_F(MapImplTest, SpaceUsed) { bool MapOrderingIsRandom(int a, int b) { bool saw_a_first = false; bool saw_b_first = false; - std::vector<Map<int32_t, int32_t>> v(50); - for (int i = 0; i < 50; ++i) { - Map<int32_t, int32_t>& m = v[i]; + std::vector<Map<int32_t, int32_t>> v; + while (v.size() < 100) { + Map<int32_t, int32_t>& m = v.emplace_back(); m[a] = 0; m[b] = 0; int32_t first_element = m.begin()->first; @@ -2336,7 +2389,10 @@ class MyMapEntry constexpr MyMapEntry() : MyMapEntry::MapEntry(static_cast<ClassData*>(nullptr)) {} MyMapEntry(Arena* arena) : MyMapEntry::MapEntry(arena, nullptr) {} - const ClassData* GetClassData() const { ABSL_CHECK(false); } + const ClassData* GetClassData() const { + ABSL_CHECK(false); + return nullptr; + } static bool ValidateKey(void*) { return true; } static bool ValidateValue(void*) { return true; } }; @@ -4284,7 +4340,7 @@ TEST(KeyMapBaseTest, InsertOrReplaceNodeWorks) { } TEST(NonUtf8Test, StringValuePassesInProto2) { - protobuf_unittest::TestProto2BytesMap message; + proto2_unittest::TestProto2BytesMap message; (*message.mutable_map_string())[1] = "\xFF"; auto serialized = message.SerializeAsString(); @@ -4294,7 +4350,7 @@ TEST(NonUtf8Test, StringValuePassesInProto2) { } TEST(NonUtf8Test, BytesValuePassesInProto2) { - protobuf_unittest::TestProto2BytesMap message; + proto2_unittest::TestProto2BytesMap message; (*message.mutable_map_bytes())[1] = "\xFF"; auto serialized = message.SerializeAsString(); diff --git a/third_party/protobuf/src/google/protobuf/map_test_util.h b/third_party/protobuf/src/google/protobuf/map_test_util.h index 2ddc52b669f46..7ad15e7bc1fec 100644 --- a/third_party/protobuf/src/google/protobuf/map_test_util.h +++ b/third_party/protobuf/src/google/protobuf/map_test_util.h @@ -12,7 +12,7 @@ #include "google/protobuf/reflection_tester.h" #include "google/protobuf/unittest.pb.h" -#define UNITTEST ::protobuf_unittest +#define UNITTEST ::proto2_unittest #define BRIDGE_UNITTEST ::google::protobuf::bridge_unittest // Must be included after defining UNITTEST, etc. diff --git a/third_party/protobuf/src/google/protobuf/map_test_util_impl.h b/third_party/protobuf/src/google/protobuf/map_test_util_impl.h index 5a4e1801b8af5..74447a6b4c058 100644 --- a/third_party/protobuf/src/google/protobuf/map_test_util_impl.h +++ b/third_party/protobuf/src/google/protobuf/map_test_util_impl.h @@ -13,12 +13,12 @@ #include <gtest/gtest.h> -namespace protobuf_unittest {} // namespace protobuf_unittest +namespace proto2_unittest {} // namespace proto2_unittest namespace google { namespace protobuf { -namespace unittest = ::protobuf_unittest; +namespace unittest = ::proto2_unittest; class MapTestUtilImpl { public: diff --git a/third_party/protobuf/src/google/protobuf/map_unittest.proto b/third_party/protobuf/src/google/protobuf/map_unittest.proto index 91ee855a93dab..869b45dd7d75f 100644 --- a/third_party/protobuf/src/google/protobuf/map_unittest.proto +++ b/third_party/protobuf/src/google/protobuf/map_unittest.proto @@ -13,8 +13,8 @@ import "google/protobuf/unittest.proto"; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -// In map_test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest; +// In map_test_util.h we do "using namespace unittest = proto2_unittest". +package proto2_unittest; // Tests maps. message TestMap { diff --git a/third_party/protobuf/src/google/protobuf/message.cc b/third_party/protobuf/src/google/protobuf/message.cc index 3870efcd903da..e1439640560fc 100644 --- a/third_party/protobuf/src/google/protobuf/message.cc +++ b/third_party/protobuf/src/google/protobuf/message.cc @@ -195,7 +195,7 @@ size_t Message::ComputeUnknownFieldsSize( size_t Message::MaybeComputeUnknownFieldsSize( size_t total_size, const internal::CachedSize* cached_size) const { - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + if (ABSL_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ComputeUnknownFieldsSize(total_size, cached_size); } cached_size->Set(internal::ToCachedSize(total_size)); @@ -502,17 +502,6 @@ template <> // Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue // #240 PROTOBUF_NOINLINE -#endif - Message* - GenericTypeHandler<Message>::NewFromPrototype(const Message* prototype, - Arena* arena) { - return prototype->New(arena); -} -template <> -#if defined(_MSC_VER) && (_MSC_VER >= 1800) -// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue -// #240 -PROTOBUF_NOINLINE #endif Arena* GenericTypeHandler<Message>::GetArena(Message* value) { diff --git a/third_party/protobuf/src/google/protobuf/message.h b/third_party/protobuf/src/google/protobuf/message.h index 92edb721bdcc6..3a2b9298f76fa 100644 --- a/third_party/protobuf/src/google/protobuf/message.h +++ b/third_party/protobuf/src/google/protobuf/message.h @@ -97,6 +97,7 @@ #include "absl/base/attributes.h" #include "absl/base/call_once.h" #include "absl/base/macros.h" +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/memory/memory.h" #include "absl/strings/cord.h" @@ -149,6 +150,10 @@ class ReflectionVisit; class SwapFieldHelper; class CachedSize; struct TailCallTableInfo; +template <typename MessageT, typename FieldT> +struct RepeatedEntityDynamicFieldInfoBase; +template <typename MessageT, typename FieldT> +struct RepeatedPtrEntityDynamicFieldInfoBase; namespace field_layout { enum TransformValidation : uint16_t; @@ -515,8 +520,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_NODISCARD Message* ReleaseLast(Message* message, - const FieldDescriptor* field) const; + [[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 @@ -716,7 +721,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_NODISCARD Message* ReleaseMessage( + [[nodiscard]] Message* ReleaseMessage( Message* message, const FieldDescriptor* field, MessageFactory* factory = nullptr) const; @@ -982,6 +987,11 @@ class PROTOBUF_EXPORT Reflection final { RepeatedPtrField<T>* MutableRepeatedPtrFieldInternal( Message* message, const FieldDescriptor* field) const; + // REQUIRES: If the field is Cord, then `scratch != nullptr`. + absl::string_view GetStringViewImpl(const Message& message, + const FieldDescriptor* field, + ScratchSpace* scratch) const; + // Obtain a pointer to a Repeated Field Structure and do some type checking: // on field->cpp_type(), // on field->field_option().ctype() (if ctype >= 0) @@ -1096,6 +1106,10 @@ class PROTOBUF_EXPORT Reflection final { friend class RepeatedFieldRef; template <typename T, typename Enable> friend class MutableRepeatedFieldRef; + template <typename MessageT, typename FieldT> + friend struct internal::RepeatedEntityDynamicFieldInfoBase; + template <typename MessageT, typename FieldT> + friend struct internal::RepeatedPtrEntityDynamicFieldInfoBase; friend class Message; friend class MessageLayoutInspector; friend class AssignDescriptorsHelper; @@ -1234,6 +1248,17 @@ class PROTOBUF_EXPORT Reflection final { return schema_.IsFieldInlined(field); } + // For "proto3 non-optional" primitive fields, aka implicit-presence fields, + // returns true if the field is populated, i.e., nonzero. False otherwise. + bool IsSingularFieldNonEmpty(const Message& message, + const FieldDescriptor* field) const; + // Returns whether the field is present if there are usable hasbits in the + // field schema. (Note that in some cases hasbits are merely a hint to + // indicate "possible presence", and another empty-check is required). + bool IsFieldPresentGivenHasbits(const Message& message, + const FieldDescriptor* field, + const uint32_t* hasbits, + uint32_t hasbit_index) const; // Returns true if the field is considered to be present. // Requires the input to be 'singular' i.e. non-extension, non-oneof, non-weak // field. @@ -1243,8 +1268,14 @@ class PROTOBUF_EXPORT Reflection final { const FieldDescriptor* field) const; void SetHasBit(Message* message, const FieldDescriptor* field) const; inline void ClearHasBit(Message* message, const FieldDescriptor* field) const; - inline void SwapHasBit(Message* message1, Message* message2, - const FieldDescriptor* field) const; + // Naively swaps the hasbit without checking for field existence. + // For explicit presence fields, the hasbit is swapped normally. + // For implicit presence fields, the hasbit is swapped without checking for + // field emptiness. That is, the destination message may have hasbit set even + // if the field is empty. This should still result in correct behaviour due to + // HasbitMode being set to kHintHasbits for implicit presence fields. + inline void NaiveSwapHasBit(Message* message1, Message* message2, + const FieldDescriptor* field) const; inline const uint32_t* GetInlinedStringDonatedArray( const Message& message) const; @@ -1586,12 +1617,12 @@ bool SplitFieldHasExtraIndirectionStatic(const FieldDescriptor* field) { inline void MaybePoisonAfterClear(Message* root) { if (root == nullptr) return; -#ifndef PROTOBUF_ASAN - root->Clear(); -#else - const Reflection* reflection = root->GetReflection(); - reflection->MaybePoisonAfterClear(*root); -#endif + if constexpr (HasMemoryPoisoning()) { + const Reflection* reflection = root->GetReflection(); + reflection->MaybePoisonAfterClear(*root); + } else { + root->Clear(); + } } } // namespace internal @@ -1612,7 +1643,7 @@ const Type& Reflection::GetRawSplit(const Message& message, template <class Type> const Type& Reflection::GetRawNonOneof(const Message& message, const FieldDescriptor* field) const { - if (PROTOBUF_PREDICT_FALSE(schema_.IsSplit(field))) { + if (ABSL_PREDICT_FALSE(schema_.IsSplit(field))) { return GetRawSplit<Type>(message, field); } const uint32_t field_offset = schema_.GetFieldOffsetNonOneof(field); @@ -1625,7 +1656,7 @@ const Type& Reflection::GetRaw(const Message& message, ABSL_DCHECK(!schema_.InRealOneof(field) || HasOneofField(message, field)) << "Field = " << field->full_name(); - if (PROTOBUF_PREDICT_TRUE(!schema_.InRealOneof(field))) { + if (ABSL_PREDICT_TRUE(!schema_.InRealOneof(field))) { return GetRawNonOneof<Type>(message, field); } @@ -1639,12 +1670,14 @@ const Type& Reflection::GetRaw(const Message& message, template <typename T> RepeatedFieldRef<T> Reflection::GetRepeatedFieldRef( const Message& message, const FieldDescriptor* field) const { + ABSL_DCHECK_EQ(message.GetReflection(), this); return RepeatedFieldRef<T>(message, field); } template <typename T> MutableRepeatedFieldRef<T> Reflection::GetMutableRepeatedFieldRef( Message* message, const FieldDescriptor* field) const { + ABSL_DCHECK_EQ(message->GetReflection(), this); return MutableRepeatedFieldRef<T>(message, field); } diff --git a/third_party/protobuf/src/google/protobuf/message_lite.cc b/third_party/protobuf/src/google/protobuf/message_lite.cc index 6bb2f434db2c1..f0bb9379d7d10 100644 --- a/third_party/protobuf/src/google/protobuf/message_lite.cc +++ b/third_party/protobuf/src/google/protobuf/message_lite.cc @@ -19,8 +19,11 @@ #include <istream> #include <ostream> #include <string> +#include <typeinfo> #include <utility> +#include "absl/base/config.h" +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/cord.h" @@ -37,6 +40,7 @@ #include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "google/protobuf/metadata_lite.h" #include "google/protobuf/parse_context.h" +#include "google/protobuf/port.h" // Must be included last. @@ -45,6 +49,13 @@ namespace google { namespace protobuf { +MessageLite* MessageLite::CopyConstruct(Arena* arena, const MessageLite& from) { + auto* data = from.GetClassData(); + auto* res = data->New(arena); + data->merge_to_from(*res, from); + return res; +} + void MessageLite::DestroyInstance() { #if defined(PROTOBUF_CUSTOM_VTABLE) _class_data_->destroy_message(*this); @@ -181,7 +192,7 @@ 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)) { + if (ABSL_PREDICT_FALSE((parse_flags & MessageLite::kMergePartial) != 0)) { return true; } return msg.IsInitializedWithErrors(); @@ -215,7 +226,7 @@ bool MergeFromImpl(absl::string_view input, MessageLite* msg, aliasing, &ptr, input); ptr = internal::TcParser::ParseLoop(msg, ptr, &ctx, tc_table); // ctx has an explicit limit set (length of string_view). - if (PROTOBUF_PREDICT_TRUE(ptr && ctx.EndedAtLimit())) { + if (ABSL_PREDICT_TRUE(ptr && ctx.EndedAtLimit())) { return CheckFieldPresence(ctx, *msg, parse_flags); } return false; @@ -230,7 +241,7 @@ bool MergeFromImpl(io::ZeroCopyInputStream* input, MessageLite* msg, aliasing, &ptr, input); ptr = internal::TcParser::ParseLoop(msg, ptr, &ctx, tc_table); // ctx has no explicit limit (hence we end on end of stream) - if (PROTOBUF_PREDICT_TRUE(ptr && ctx.EndedAtEndOfStream())) { + if (ABSL_PREDICT_TRUE(ptr && ctx.EndedAtEndOfStream())) { return CheckFieldPresence(ctx, *msg, parse_flags); } return false; @@ -244,9 +255,9 @@ bool MergeFromImpl(BoundedZCIS input, MessageLite* msg, internal::ParseContext ctx(io::CodedInputStream::GetDefaultRecursionLimit(), aliasing, &ptr, input.zcis, input.limit); ptr = internal::TcParser::ParseLoop(msg, ptr, &ctx, tc_table); - if (PROTOBUF_PREDICT_FALSE(!ptr)) return false; + if (ABSL_PREDICT_FALSE(!ptr)) return false; ctx.BackUp(ptr); - if (PROTOBUF_PREDICT_TRUE(ctx.EndedAtLimit())) { + if (ABSL_PREDICT_TRUE(ctx.EndedAtLimit())) { return CheckFieldPresence(ctx, *msg, parse_flags); } return false; @@ -272,7 +283,6 @@ template bool MergeFromImpl<false>(BoundedZCIS input, MessageLite* msg, template bool MergeFromImpl<true>(BoundedZCIS input, MessageLite* msg, const internal::TcParseTableBase* tc_table, MessageLite::ParseFlags parse_flags); - } // namespace internal class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream { @@ -291,7 +301,7 @@ class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream { bool ReadCord(absl::Cord* cord, int count) final { // Fast path: tail call into ReadCord reading new value. - if (PROTOBUF_PREDICT_TRUE(cord->empty())) { + if (ABSL_PREDICT_TRUE(cord->empty())) { return cis_->ReadCord(cord, count); } absl::Cord tmp; @@ -299,6 +309,7 @@ class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream { cord->Append(std::move(tmp)); return res; } + private: io::CodedInputStream* cis_; }; @@ -316,7 +327,7 @@ bool MessageLite::MergeFromImpl(io::CodedInputStream* input, ctx.data().pool = input->GetExtensionPool(); ctx.data().factory = input->GetExtensionFactory(); ptr = internal::TcParser::ParseLoop(this, ptr, &ctx, GetTcParseTable()); - if (PROTOBUF_PREDICT_FALSE(!ptr)) return false; + if (ABSL_PREDICT_FALSE(!ptr)) return false; ctx.BackUp(ptr); if (!ctx.EndedAtEndOfStream()) { ABSL_DCHECK_NE(ctx.LastTag(), 1u); // We can't end on a pushed limit. @@ -438,20 +449,20 @@ struct SourceWrapper<absl::Cord> { } // namespace internal -bool MessageLite::MergeFromCord(const absl::Cord& cord) { - return ParseFrom<kMerge>(internal::SourceWrapper<absl::Cord>(&cord)); +bool MessageLite::MergeFromString(const absl::Cord& data) { + return ParseFrom<kMerge>(internal::SourceWrapper<absl::Cord>(&data)); } -bool MessageLite::MergePartialFromCord(const absl::Cord& cord) { - return ParseFrom<kMergePartial>(internal::SourceWrapper<absl::Cord>(&cord)); +bool MessageLite::MergePartialFromString(const absl::Cord& data) { + return ParseFrom<kMergePartial>(internal::SourceWrapper<absl::Cord>(&data)); } -bool MessageLite::ParseFromCord(const absl::Cord& cord) { - return ParseFrom<kParse>(internal::SourceWrapper<absl::Cord>(&cord)); +bool MessageLite::ParseFromString(const absl::Cord& data) { + return ParseFrom<kParse>(internal::SourceWrapper<absl::Cord>(&data)); } -bool MessageLite::ParsePartialFromCord(const absl::Cord& cord) { - return ParseFrom<kParsePartial>(internal::SourceWrapper<absl::Cord>(&cord)); +bool MessageLite::ParsePartialFromString(const absl::Cord& data) { + return ParseFrom<kParsePartial>(internal::SourceWrapper<absl::Cord>(&data)); } // =================================================================== @@ -634,13 +645,13 @@ std::string MessageLite::SerializePartialAsString() const { return output; } -bool MessageLite::AppendToCord(absl::Cord* output) const { +bool MessageLite::AppendToString(absl::Cord* output) const { ABSL_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); - return AppendPartialToCord(output); + return AppendPartialToString(output); } -bool MessageLite::AppendPartialToCord(absl::Cord* output) const { +bool MessageLite::AppendPartialToString(absl::Cord* output) const { // For efficiency, we'd like to pass a size hint to CordOutputStream with // the exact total size expected. const size_t size = ByteSizeLong(); @@ -686,40 +697,30 @@ bool MessageLite::AppendPartialToCord(absl::Cord* output) const { return true; } -bool MessageLite::SerializeToCord(absl::Cord* output) const { +bool MessageLite::SerializeToString(absl::Cord* output) const { output->Clear(); - return AppendToCord(output); + return AppendToString(output); } -bool MessageLite::SerializePartialToCord(absl::Cord* output) const { +bool MessageLite::SerializePartialToString(absl::Cord* output) const { output->Clear(); - return AppendPartialToCord(output); + return AppendPartialToString(output); } absl::Cord MessageLite::SerializeAsCord() const { absl::Cord output; - if (!AppendToCord(&output)) output.Clear(); + if (!AppendToString(&output)) output.Clear(); return output; } absl::Cord MessageLite::SerializePartialAsCord() const { absl::Cord output; - if (!AppendPartialToCord(&output)) output.Clear(); + if (!AppendPartialToString(&output)) output.Clear(); return output; } namespace internal { -MessageLite* NewFromPrototypeHelper(const MessageLite* prototype, - Arena* arena) { - return prototype->New(arena); -} -template <> -void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from, - MessageLite* to) { - to->CheckTypeAndMergeFrom(from); -} - // Non-inline variants of std::string specializations for // various InternalMetadata routines. template <> diff --git a/third_party/protobuf/src/google/protobuf/message_lite.h b/third_party/protobuf/src/google/protobuf/message_lite.h index 99bb9fe038aa5..353f51fa1f85a 100644 --- a/third_party/protobuf/src/google/protobuf/message_lite.h +++ b/third_party/protobuf/src/google/protobuf/message_lite.h @@ -21,9 +21,11 @@ #include <cstdint> #include <cstring> #include <iosfwd> +#include <memory> #include <new> #include <string> #include <type_traits> +#include <utility> #include "absl/base/attributes.h" #include "absl/base/casts.h" @@ -77,6 +79,10 @@ class MessageTableTester; namespace internal { +namespace v2 { +class TableDriven; +} // namespace v2 + class MessageCreator { public: using Func = void* (*)(const void*, void*, Arena*); @@ -172,7 +178,7 @@ class PROTOBUF_EXPORT CachedSize { // NOLINTNEXTLINE(google-explicit-constructor) constexpr CachedSize(Scalar desired) noexcept : atom_(desired) {} -#if PROTOBUF_BUILTIN_ATOMIC +#ifdef PROTOBUF_BUILTIN_ATOMIC constexpr CachedSize(const CachedSize& other) = default; Scalar Get() const noexcept { @@ -189,6 +195,11 @@ class PROTOBUF_EXPORT CachedSize { } void SetNonZero(Scalar desired) const noexcept { + ABSL_DCHECK_NE(desired, 0); + __atomic_store_n(&atom_, desired, __ATOMIC_RELAXED); + } + + void SetNoDefaultInstance(Scalar desired) const noexcept { __atomic_store_n(&atom_, desired, __ATOMIC_RELAXED); } #else @@ -212,34 +223,49 @@ class PROTOBUF_EXPORT CachedSize { } void SetNonZero(Scalar desired) const noexcept { + ABSL_DCHECK_NE(desired, 0); + atom_.store(desired, std::memory_order_relaxed); + } + + void SetNoDefaultInstance(Scalar desired) const noexcept { atom_.store(desired, std::memory_order_relaxed); } #endif private: -#if PROTOBUF_BUILTIN_ATOMIC +#ifdef PROTOBUF_BUILTIN_ATOMIC mutable Scalar atom_; #else mutable std::atomic<Scalar> atom_; #endif }; -// TODO: Upgrade to `auto` parameters when we drop C++14 support. -template <typename T, const T* kDefault> +auto GetClassData(const MessageLite& msg); + +template <const auto* kDefault, const auto* kClassData> struct GeneratedMessageTraitsT { static constexpr const void* default_instance() { return kDefault; } + static constexpr const auto* class_data() { return kClassData->base(); } static constexpr auto StrongPointer() { return default_instance(); } }; template <typename T> struct FallbackMessageTraits { - static const void* default_instance() { return T::default_instance(); } + static const void* default_instance() { return &T::default_instance(); } + static constexpr const auto* class_data() { + return GetClassData(T::default_instance()); + } // We can't make a constexpr pointer to the default, so use a function pointer // instead. static constexpr auto StrongPointer() { return &T::default_instance; } }; -// Traits for message T. +template <const uint32_t* kValidationData> +struct EnumTraitsT { + static constexpr const uint32_t* validation_data() { return kValidationData; } +}; + +// Traits for messages and enums. // We use a class scope variable template, which can be specialized with a // different type in a non-defining declaration. // We need non-defining declarations because we might have duplicates of the @@ -252,8 +278,13 @@ struct MessageTraitsImpl { template <typename T> using MessageTraits = decltype(MessageTraitsImpl::value<T>); -// For MessageLite to friend. -auto GetClassData(const MessageLite& msg); +struct EnumTraitsImpl { + struct Undefined; + template <typename T> + static Undefined value; +}; +template <typename T> +using EnumTraits = decltype(EnumTraitsImpl::value<T>); class SwapFieldHelper; @@ -304,14 +335,8 @@ using GetTypeNameReturnType = absl::string_view; using GetTypeNameReturnType = std::string; #endif -// Default empty string object. Don't use this directly. Instead, call -// GetEmptyString() to get the reference. This empty string is aligned with a -// minimum alignment of 8 bytes to match the requirement of ArenaStringPtr. -PROTOBUF_EXPORT extern ExplicitlyConstructedArenaString - fixed_address_empty_string; - -PROTOBUF_EXPORT constexpr const std::string& GetEmptyStringAlreadyInited() { +PROTOBUF_EXPORT inline const std::string& GetEmptyStringAlreadyInited() { return fixed_address_empty_string.get(); } @@ -629,16 +654,20 @@ class PROTOBUF_EXPORT MessageLite { // missing required fields. ABSL_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(). + // Parses a protocol buffer contained in a string or Cord. 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(). ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromString(absl::string_view data); + ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromString(const absl::Cord& data); // Like ParseFromString(), but accepts messages that are missing // required fields. ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromString( absl::string_view data); + ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromString( + const absl::Cord& data); // Parse a protocol buffer contained in an array of bytes. ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromArray(const void* data, int size); // Like ParseFromArray(), but accepts messages that are missing @@ -669,6 +698,12 @@ class PROTOBUF_EXPORT MessageLite { // Merge a protocol buffer contained in a string. bool MergeFromString(absl::string_view data); + bool MergeFromString(const absl::Cord& data); + + // Like MergeFromString(), but accepts messages that are missing required + // fields. + bool MergePartialFromString(absl::string_view data); + bool MergePartialFromString(const absl::Cord& data); // Serialization --------------------------------------------------- @@ -689,8 +724,12 @@ class PROTOBUF_EXPORT MessageLite { // Serialize the message and store it in the given string. All required // fields must be set. bool SerializeToString(std::string* output) const; + // Serialize the message and store it in the given Cord. All required + // fields must be set. + bool SerializeToString(absl::Cord* output) const; // Like SerializeToString(), but allows missing required fields. bool SerializePartialToString(std::string* output) const; + bool SerializePartialToString(absl::Cord* output) const; // Serialize the message and store it in the given byte array. All required // fields must be set. bool SerializeToArray(void* data, int size) const; @@ -721,26 +760,45 @@ class PROTOBUF_EXPORT MessageLite { // Like SerializeToString(), but appends to the data to the string's // existing contents. All required fields must be set. bool AppendToString(std::string* output) const; + bool AppendToString(absl::Cord* output) const; // Like AppendToString(), but allows missing required fields. bool AppendPartialToString(std::string* output) const; + bool AppendPartialToString(absl::Cord* output) const; // Reads a protocol buffer from a Cord and merges it into this message. - bool MergeFromCord(const absl::Cord& cord); + PROTOBUF_DEPRECATE_AND_INLINE() bool MergeFromCord(const absl::Cord& data) { + return MergeFromString(data); + } // Like MergeFromCord(), but accepts messages that are missing // required fields. - bool MergePartialFromCord(const absl::Cord& cord); + PROTOBUF_DEPRECATE_AND_INLINE() + bool MergePartialFromCord(const absl::Cord& data) { + return MergePartialFromString(data); + } // Parse a protocol buffer contained in a Cord. - ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromCord(const absl::Cord& cord); + PROTOBUF_DEPRECATE_AND_INLINE() + ABSL_ATTRIBUTE_REINITIALIZES bool ParseFromCord(const absl::Cord& data) { + return ParseFromString(data); + } // Like ParseFromCord(), but accepts messages that are missing // required fields. - ABSL_ATTRIBUTE_REINITIALIZES bool ParsePartialFromCord( - const absl::Cord& cord); + PROTOBUF_DEPRECATE_AND_INLINE() + ABSL_ATTRIBUTE_REINITIALIZES + bool ParsePartialFromCord(const absl::Cord& data) { + return ParsePartialFromString(data); + } // Serialize the message and store it in the given Cord. All required // fields must be set. - bool SerializeToCord(absl::Cord* output) const; + PROTOBUF_DEPRECATE_AND_INLINE() + bool SerializeToCord(absl::Cord* output) const { + return SerializeToString(output); + } // Like SerializeToCord(), but allows missing required fields. - bool SerializePartialToCord(absl::Cord* output) const; + PROTOBUF_DEPRECATE_AND_INLINE() + bool SerializePartialToCord(absl::Cord* output) const { + return SerializePartialToString(output); + } // Make a Cord encoding the message. Is equivalent to calling // SerializeToCord() on a Cord and using that. Returns an empty @@ -751,9 +809,14 @@ class PROTOBUF_EXPORT MessageLite { // Like SerializeToCord(), but appends to the data to the Cord's existing // contents. All required fields must be set. - bool AppendToCord(absl::Cord* output) const; + PROTOBUF_DEPRECATE_AND_INLINE() bool AppendToCord(absl::Cord* output) const { + return AppendToString(output); + } // Like AppendToCord(), but allows missing required fields. - bool AppendPartialToCord(absl::Cord* output) const; + PROTOBUF_DEPRECATE_AND_INLINE() + bool AppendPartialToCord(absl::Cord* output) const { + return AppendPartialToString(output); + } // Computes the serialized size of the message. This recursively calls // ByteSizeLong() on all embedded messages. @@ -859,6 +922,15 @@ class PROTOBUF_EXPORT MessageLite { return static_cast<T*>(Arena::CopyConstruct<T>(arena, &from)); } + // As above, but for fields that use base class type. Eg foreign weak fields. + static MessageLite* CopyConstruct(Arena* arena, const MessageLite& from); + + PROTOBUF_ALWAYS_INLINE static Message* CopyConstruct(Arena* arena, + const Message& from) { + return reinterpret_cast<Message*>( + CopyConstruct(arena, reinterpret_cast<const MessageLite&>(from))); + } + const internal::TcParseTableBase* GetTcParseTable() const { auto* data = GetClassData(); ABSL_DCHECK(data != nullptr); @@ -871,6 +943,7 @@ class PROTOBUF_EXPORT MessageLite { return tc_table; } + #if defined(PROTOBUF_CUSTOM_VTABLE) explicit constexpr MessageLite(const internal::ClassData* data) : _class_data_(data) {} @@ -900,16 +973,6 @@ class PROTOBUF_EXPORT MessageLite { virtual const internal::ClassData* GetClassData() const = 0; #endif // PROTOBUF_CUSTOM_VTABLE - template <typename T> - static auto GetClassDataGenerated() { - static_assert(std::is_base_of<MessageLite, T>::value, ""); - // We could speed this up if needed by avoiding the function call. - // In LTO this is likely inlined, so it might not matter. - static_assert( - std::is_same<const T&, decltype(T::default_instance())>::value, ""); - return T::default_instance().T::GetClassData(); - } - internal::InternalMetadata _internal_metadata_; #if defined(PROTOBUF_CUSTOM_VTABLE) const internal::ClassData* _class_data_; @@ -995,6 +1058,7 @@ class PROTOBUF_EXPORT MessageLite { friend class internal::WeakFieldMap; friend class internal::WireFormatLite; friend class internal::RustMapHelper; + friend class internal::v2::TableDriven; friend internal::MessageCreator; template <typename Type> @@ -1040,7 +1104,7 @@ class TypeId { template <typename T> static TypeId Get() { - return TypeId(MessageLite::GetClassDataGenerated<T>()); + return TypeId(internal::MessageTraits<T>::class_data()); } // Name of the message type. @@ -1184,13 +1248,8 @@ T* OnShutdownDelete(T* p) { return p; } -inline void AssertDownCast(const MessageLite& from, const MessageLite& to) { - ABSL_DCHECK(TypeId::Get(from) == TypeId::Get(to)) - << "Cannot downcast " << from.GetTypeName() << " to " << to.GetTypeName(); -} - template <bool test_call, typename MessageLite> -PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::PlacementNew( +PROTOBUF_ALWAYS_INLINE MessageLite* MessageCreator::PlacementNew( const MessageLite* prototype_for_func, const MessageLite* prototype_for_copy, void* mem, Arena* arena) const { ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) % alignment_, 0u); @@ -1214,11 +1273,6 @@ PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::PlacementNew( // - We know the minimum size is 16. We have a fallback for when it is not. // - We can "underflow" the buffer because those are the MessageLite bytes // we will set later. -#ifndef PROTO2_OPENSOURCE - // This manual handling shows a 1.85% improvement in the parsing - // microbenchmark. - // TODO: Verify this is still the case. -#endif // !PROTO2_OPENSOUCE if (as_tag == kZeroInit) { // Make sure the input is really all zeros. ABSL_DCHECK(std::all_of(src + sizeof(MessageLite), src + size, @@ -1296,7 +1350,7 @@ PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::PlacementNew( } template <bool test_call, typename MessageLite> -PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::New( +PROTOBUF_ALWAYS_INLINE MessageLite* MessageCreator::New( const MessageLite* prototype_for_func, const MessageLite* prototype_for_copy, Arena* arena) const { return PlacementNew<test_call>(prototype_for_func, prototype_for_copy, @@ -1321,7 +1375,7 @@ std::string Utf8Format(const MessageLite& message_lite); // // `DynamicCastMessage` is similar to `dynamic_cast`, returns `nullptr` when the // input is not an instance of `T`. The overloads that take a reference will -// terminate on mismatch. +// throw std::bad_cast on mismatch, or terminate if compiled without exceptions. // // `DownCastMessage` is a lightweight function for downcasting base // `MessageLite` pointer to derived type, where it only does type checking if @@ -1355,6 +1409,11 @@ template <typename T> const T& DynamicCastMessage(const MessageLite& from) { const T* destination_message = DynamicCastMessage<T>(&from); if (ABSL_PREDICT_FALSE(destination_message == nullptr)) { + // If exceptions are enabled, throw. + // Otherwise, log a fatal error. +#if defined(ABSL_HAVE_EXCEPTIONS) + throw std::bad_cast(); +#endif // Move the logging into an out-of-line function to reduce bloat in the // caller. internal::FailDynamicCast(from, T::default_instance()); @@ -1452,6 +1511,28 @@ T& DownCastToGenerated(MessageLite& from) { return DownCastMessage<T>(from); } +// Overloads for `std::shared_ptr` to substitute `std::dynamic_pointer_cast` +template <typename T> +std::shared_ptr<T> DynamicCastMessage(std::shared_ptr<MessageLite> ptr) { + if (auto* res = DynamicCastMessage<T>(ptr.get())) { + // Use aliasing constructor to keep the same control block. + return std::shared_ptr<T>(std::move(ptr), res); + } else { + return nullptr; + } +} + +template <typename T> +std::shared_ptr<const T> DynamicCastMessage( + std::shared_ptr<const MessageLite> ptr) { + if (auto* res = DynamicCastMessage<T>(ptr.get())) { + // Use aliasing constructor to keep the same control block. + return std::shared_ptr<const T>(std::move(ptr), res); + } else { + return nullptr; + } +} + } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/message_unittest.cc b/third_party/protobuf/src/google/protobuf/message_unittest.cc index 745fb1423c369..d4a785ef89074 100644 --- a/third_party/protobuf/src/google/protobuf/message_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/message_unittest.cc @@ -29,9 +29,9 @@ #define MESSAGE_TEST_NAME MessageTest #define MESSAGE_FACTORY_TEST_NAME MessageFactoryTest -#define UNITTEST_PACKAGE_NAME "protobuf_unittest" -#define UNITTEST ::protobuf_unittest -#define UNITTEST_IMPORT ::protobuf_unittest_import +#define UNITTEST_PACKAGE_NAME "proto2_unittest" +#define UNITTEST ::proto2_unittest +#define UNITTEST_IMPORT ::proto2_unittest_import // Must include after the above macros. // clang-format off diff --git a/third_party/protobuf/src/google/protobuf/message_unittest.inc b/third_party/protobuf/src/google/protobuf/message_unittest.inc index e555c21ad798f..723b8fd19b5e4 100644 --- a/third_party/protobuf/src/google/protobuf/message_unittest.inc +++ b/third_party/protobuf/src/google/protobuf/message_unittest.inc @@ -35,11 +35,13 @@ #include <gmock/gmock.h> #include "google/protobuf/testing/googletest.h" #include <gtest/gtest.h> +#include "absl/base/config.h" #include "absl/log/absl_check.h" #include "absl/log/scoped_mock_log.h" #include "absl/strings/cord.h" #include "absl/strings/substitute.h" #include "google/protobuf/arena.h" +#include "google/protobuf/arena_test_util.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/generated_message_reflection.h" @@ -51,11 +53,15 @@ #include "google/protobuf/message.h" #include "google/protobuf/reflection_ops.h" #include "google/protobuf/test_util2.h" +#include "google/protobuf/wire_format_lite.h" // Must be included last. #include "google/protobuf/port_def.inc" +using ::testing::IsEmpty; +using ::testing::Not; + namespace google { namespace protobuf { @@ -364,6 +370,29 @@ TEST(MESSAGE_TEST_NAME, ExplicitLazyExceedRecursionLimit) { EXPECT_NE(parsed.lazy_child().child().payload().optional_int32(), -1); } +TEST(MESSAGE_TEST_NAME, ExplicitLazyBadLengthDelimitedSize) { + std::string serialized; + + // This is a regression test for a bug in lazy field verification. It + // requires invalid wire format to trigger the bug. + + // NestedMessage optional_lazy_message = 27 [lazy=true]; + uint32_t tag = internal::WireFormatLite::MakeTag( + 1, internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + ASSERT_LT(tag, INT8_MAX); + serialized.push_back(tag); + serialized.push_back(6); + + // bytes bytes_field = 1; + serialized.push_back(tag); + + // To trigger this bug, we need an overlong size. + serialized.append(5, 0xff); + + UNITTEST::TestLazyMessage parsed; + EXPECT_FALSE(parsed.ParseFromString(serialized)); +} + TEST(MESSAGE_TEST_NAME, NestedLazyRecursionLimit) { UNITTEST::NestedTestAllTypes original, parsed; original.mutable_lazy_child() @@ -395,6 +424,12 @@ TEST(MESSAGE_TEST_NAME, UnparsedEmpty) { EXPECT_EQ(message.lazy_child().ByteSizeLong(), 0); } +TEST(MESSAGE_TEST_NAME, DefaultInstanceByteSizeLong) { + EXPECT_EQ(UNITTEST::NestedTestAllTypes::default_instance().ByteSizeLong(), 0); + EXPECT_EQ(UNITTEST::NestedTestAllTypes::default_instance().GetCachedSize(), + 0); +} + TEST(MESSAGE_TEST_NAME, ParseFailNonCanonicalZeroTag) { const char encoded[] = {"\n\x3\x80\0\0"}; UNITTEST::NestedTestAllTypes parsed; @@ -792,11 +827,17 @@ TEST(MESSAGE_TEST_NAME, DynamicCastMessage) { TEST(MESSAGE_TEST_NAME, DynamicCastMessageInvalidReferenceType) { UNITTEST::TestAllTypes test_all_types; const MessageLite& test_all_types_pointer_const_ref = test_all_types; +#if defined(ABSL_HAVE_EXCEPTIONS) + EXPECT_THROW(DynamicCastMessage<UNITTEST::TestRequired>( + test_all_types_pointer_const_ref), + std::bad_cast); +#else ASSERT_DEATH( DynamicCastMessage<UNITTEST::TestRequired>( test_all_types_pointer_const_ref), absl::StrCat("Cannot downcast ", test_all_types.GetTypeName(), " to ", UNITTEST::TestRequired::default_instance().GetTypeName())); +#endif } TEST(MESSAGE_TEST_NAME, DownCastMessageValidType) { @@ -854,6 +895,17 @@ TEST(MESSAGE_TEST_NAME, MessageDebugStringMatchesBehindPointerAndLitePointer) { ASSERT_EQ(test_all_types.DebugString(), msg_lite_pointer->DebugString()); } +TEST(MESSAGE_TEST_NAME, CordFieldGetsProperlyRegisteredInTheArena) { + Arena arena; + auto* msg = Arena::Create<UNITTEST::TestCord>(&arena); + // Very large input that needs allocation. + msg->set_optional_bytes_cord(std::string(1000, 'x')); + // Something should be registered for destruction. + EXPECT_THAT(internal::ArenaTestPeer::PeekCleanupListForTesting(&arena), + Not(IsEmpty())); + // We expect memory leaks here if the Cord was not properly destroyed. +} + #if GTEST_HAS_DEATH_TEST // death tests do not work on Windows yet. TEST(MESSAGE_TEST_NAME, SerializeFailsIfNotInitialized) { @@ -1307,6 +1359,15 @@ TEST(MESSAGE_TEST_NAME, MOMIParserEdgeCases) { } } +TEST(MESSAGE_TEST_NAME, MessageTraitsWork) { + EXPECT_EQ( + &UNITTEST::TestAllTypes::default_instance(), + internal::MessageTraits<UNITTEST::TestAllTypes>::default_instance()); + EXPECT_EQ( + internal::GetClassData(UNITTEST::TestAllTypes::default_instance()), + internal::MessageTraits<UNITTEST::TestAllTypes>::class_data()); +} + TEST(MESSAGE_TEST_NAME, CheckSerializationWhenInterleavedExtensions) { UNITTEST::TestExtensionRangeSerialize in_message; @@ -1526,7 +1587,7 @@ TEST(MESSAGE_TEST_NAME, TestEnumParsers) { constexpr int kInvalidValue = 0x900913; auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_packed : {false, true}) { SCOPED_TRACE(use_packed); for (bool use_tail_field : {false, true}) { @@ -1623,7 +1684,7 @@ TEST(MESSAGE_TEST_NAME, TestEnumParserForUnknownEnumValue) { // For unknown enum values, for consistency we must include the // int32_t enum value in the unknown field set, which might not be exactly the // same as the input. - PROTOBUF_UNUSED auto* descriptor = non_dynamic.descriptor(); + [[maybe_unused]] auto* descriptor = non_dynamic.descriptor(); const std::vector<const FieldDescriptor*> fields = GetFields<UNITTEST::EnumParseTester>(); @@ -1676,7 +1737,7 @@ TEST(MESSAGE_TEST_NAME, TestBoolParsers) { GetFields<UNITTEST::BoolParseTester>(); auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_tail_field : {false, true}) { SCOPED_TRACE(use_tail_field); for (int non_canonical_bytes = 0; non_canonical_bytes < 10; @@ -1740,7 +1801,7 @@ TEST(MESSAGE_TEST_NAME, TestInt32Parsers) { GetFields<UNITTEST::Int32ParseTester>(); auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_tail_field : {false, true}) { SCOPED_TRACE(use_tail_field); for (int non_canonical_bytes = 0; non_canonical_bytes < 10; @@ -1805,7 +1866,7 @@ TEST(MESSAGE_TEST_NAME, TestInt64Parsers) { GetFields<UNITTEST::Int64ParseTester>(); auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_tail_field : {false, true}) { SCOPED_TRACE(use_tail_field); for (int non_canonical_bytes = 0; non_canonical_bytes < 10; @@ -1909,7 +1970,7 @@ TEST(MESSAGE_TEST_NAME, TestRepeatedStringParsers) { "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - PROTOBUF_UNUSED const auto* const descriptor = + [[maybe_unused]] const auto* const descriptor = UNITTEST::StringParseTester::descriptor(); const std::vector<const FieldDescriptor*> fields = diff --git a/third_party/protobuf/src/google/protobuf/metadata_lite.h b/third_party/protobuf/src/google/protobuf/metadata_lite.h index d2299e67e9f32..6425863a53da7 100644 --- a/third_party/protobuf/src/google/protobuf/metadata_lite.h +++ b/third_party/protobuf/src/google/protobuf/metadata_lite.h @@ -10,6 +10,7 @@ #include <string> +#include "absl/base/optimization.h" #include "google/protobuf/arena.h" #include "google/protobuf/port.h" @@ -63,7 +64,7 @@ class PROTOBUF_EXPORT InternalMetadata { } PROTOBUF_NDEBUG_INLINE Arena* arena() const { - if (PROTOBUF_PREDICT_FALSE(have_unknown_fields())) { + if (ABSL_PREDICT_FALSE(have_unknown_fields())) { return PtrValue<ContainerBase>()->arena; } else { return PtrValue<Arena>(); @@ -81,7 +82,7 @@ class PROTOBUF_EXPORT InternalMetadata { template <typename T> PROTOBUF_NDEBUG_INLINE const T& unknown_fields( const T& (*default_instance)()) const { - if (PROTOBUF_PREDICT_FALSE(have_unknown_fields())) { + if (ABSL_PREDICT_FALSE(have_unknown_fields())) { return PtrValue<Container<T>>()->unknown_fields; } else { return default_instance(); @@ -90,7 +91,7 @@ class PROTOBUF_EXPORT InternalMetadata { template <typename T> PROTOBUF_NDEBUG_INLINE T* mutable_unknown_fields() { - if (PROTOBUF_PREDICT_TRUE(have_unknown_fields())) { + if (ABSL_PREDICT_TRUE(have_unknown_fields())) { return &PtrValue<Container<T>>()->unknown_fields; } else { return mutable_unknown_fields_slow<T>(); diff --git a/third_party/protobuf/src/google/protobuf/no_field_presence_map_test.cc b/third_party/protobuf/src/google/protobuf/no_field_presence_map_test.cc index 08772a3b35e92..37a4decd599a9 100644 --- a/third_party/protobuf/src/google/protobuf/no_field_presence_map_test.cc +++ b/third_party/protobuf/src/google/protobuf/no_field_presence_map_test.cc @@ -8,6 +8,7 @@ #include <cstdint> #include <string> #include <type_traits> +#include <vector> #include "google/protobuf/descriptor.pb.h" #include <gmock/gmock.h> @@ -55,6 +56,33 @@ MATCHER(MapEntryHasValue, "") { return r->HasField(arg, key); } +// The following pattern is used to create a monomorphic matcher that matches an +// input type (to avoid implicit casts between sign and unsigned integers). +// Intentionally choose a verbose and specific namespace name so that there are +// no namespace conflicts. MSVC seems to not know how to prioritize +// ns::internal vs. ns::(anonymous namespace)::internal. +// Sample error: +// D:\a\protobuf\protobuf\src\google/protobuf/map.h(138): error C2872: +// 'internal': ambiguous symbol +// D:\a\protobuf\protobuf\google/protobuf/unittest_no_field_presence.pb.h(46): +// note: could be 'google::protobuf::internal' +// D:\a\protobuf\protobuf\src\google\protobuf\no_field_presence_map_test.cc(61): +// note: or 'google::protobuf::`anonymous-namespace'::internal' +namespace no_presence_map_test_internal { +// `MATCHER_P` defines a polymorphic matcher; we monomorphize it for +// `uint64_t` below to avoid conflicting deduced template arguments. +MATCHER_P(MapEntryListFieldsSize, expected_size, "") { + const Reflection* r = arg.GetReflection(); + + std::vector<const FieldDescriptor*> list_fields_output; + r->ListFields(arg, &list_fields_output); + return list_fields_output.size() == expected_size; +} +} // namespace no_presence_map_test_internal +// TODO: b/371232929 - can make this `inline constexpr` with C++17 as baseline. +constexpr auto& MapEntryListFieldsSize = + no_presence_map_test_internal::MapEntryListFieldsSize<uint64_t>; + MATCHER(MapEntryKeyExplicitPresence, "") { const Descriptor* desc = arg.GetDescriptor(); const FieldDescriptor* key = desc->map_key(); @@ -314,6 +342,7 @@ TEST(NoFieldPresenceTest, TestNonZeroStringMapEntriesPopulatedInReflection) { // HasField for both key and value returns true. EXPECT_THAT(bytes_map_entry, MapEntryHasKey()); EXPECT_THAT(bytes_map_entry, MapEntryHasValue()); + EXPECT_THAT(bytes_map_entry, MapEntryListFieldsSize(2)); } TEST(NoFieldPresenceTest, TestNonZeroIntMapEntriesPopulatedInReflection) { @@ -336,6 +365,7 @@ TEST(NoFieldPresenceTest, TestNonZeroIntMapEntriesPopulatedInReflection) { // HasField for both key and value returns true. EXPECT_THAT(enum_map_entry, MapEntryHasKey()); EXPECT_THAT(enum_map_entry, MapEntryHasValue()); + EXPECT_THAT(enum_map_entry, MapEntryListFieldsSize(2)); } TEST(NoFieldPresenceTest, @@ -357,6 +387,7 @@ TEST(NoFieldPresenceTest, // HasField for both key and value returns true. EXPECT_THAT(msg_map_entry, MapEntryHasKey()); EXPECT_THAT(msg_map_entry, MapEntryHasValue()); + EXPECT_THAT(msg_map_entry, MapEntryListFieldsSize(2)); // For value types that are messages, further test that the message fields // show up on reflection. @@ -383,6 +414,7 @@ TEST(NoFieldPresenceTest, // HasField for both key and value returns true. EXPECT_THAT(explicit_msg_map_entry, MapEntryHasKey()); EXPECT_THAT(explicit_msg_map_entry, MapEntryHasValue()); + EXPECT_THAT(explicit_msg_map_entry, MapEntryListFieldsSize(2)); // For value types that are messages, further test that the message fields // show up on reflection. @@ -595,6 +627,7 @@ TEST(NoFieldPresenceTest, TestEmptyStringMapEntriesPopulatedInReflection) { // HasField even though they are zero. EXPECT_THAT(bytes_map_entry, MapEntryHasKey()); EXPECT_THAT(bytes_map_entry, MapEntryHasValue()); + EXPECT_THAT(bytes_map_entry, MapEntryListFieldsSize(2)); } TEST(NoFieldPresenceTest, TestEmptyIntMapEntriesPopulatedInReflection) { @@ -624,6 +657,7 @@ TEST(NoFieldPresenceTest, TestEmptyIntMapEntriesPopulatedInReflection) { // HasField even though they are zero. EXPECT_THAT(enum_map_entry, MapEntryHasKey()); EXPECT_THAT(enum_map_entry, MapEntryHasValue()); + EXPECT_THAT(enum_map_entry, MapEntryListFieldsSize(2)); } TEST(NoFieldPresenceTest, TestEmptySubMessageMapEntriesPopulatedInReflection) { @@ -653,6 +687,7 @@ TEST(NoFieldPresenceTest, TestEmptySubMessageMapEntriesPopulatedInReflection) { // HasField even though they are zero. EXPECT_THAT(msg_map_entry, MapEntryHasKey()); EXPECT_THAT(msg_map_entry, MapEntryHasValue()); + EXPECT_THAT(msg_map_entry, MapEntryListFieldsSize(2)); // For value types that are messages, further test that the message fields // do not show up on reflection. @@ -688,6 +723,7 @@ TEST(NoFieldPresenceTest, // HasField even though they are zero. EXPECT_THAT(explicit_msg_map_entry, MapEntryHasKey()); EXPECT_THAT(explicit_msg_map_entry, MapEntryHasValue()); + EXPECT_THAT(explicit_msg_map_entry, MapEntryListFieldsSize(2)); // For value types that are messages, further test that the message fields // do not show up on reflection. @@ -707,7 +743,7 @@ bool TestSerialize<std::string>(const MessageLite& message, template <> bool TestSerialize<absl::Cord>(const MessageLite& message, absl::Cord* output) { - return message.SerializeToCord(output); + return message.SerializeToString(output); } template <typename T> diff --git a/third_party/protobuf/src/google/protobuf/no_field_presence_test.cc b/third_party/protobuf/src/google/protobuf/no_field_presence_test.cc index 9cff7909147f1..62f8a2a639b1c 100644 --- a/third_party/protobuf/src/google/protobuf/no_field_presence_test.cc +++ b/third_party/protobuf/src/google/protobuf/no_field_presence_test.cc @@ -9,6 +9,7 @@ #include <memory> #include <string> #include <type_traits> +#include <vector> #include "google/protobuf/descriptor.pb.h" #include <gmock/gmock.h> @@ -32,6 +33,7 @@ using ::proto2_nofieldpresence_unittest::ForeignMessage; using ::proto2_nofieldpresence_unittest::TestAllTypes; using ::testing::Eq; using ::testing::Gt; +using ::testing::IsEmpty; using ::testing::Not; using ::testing::StrEq; using ::testing::UnorderedPointwise; @@ -66,6 +68,7 @@ void CheckDefaultValues(const TestAllTypes& m) { EXPECT_EQ(TestAllTypes::FOO, m.optional_nested_enum()); EXPECT_EQ(FOREIGN_FOO, m.optional_foreign_enum()); + EXPECT_EQ(0, m.optional_string_piece().size()); EXPECT_EQ(0, m.repeated_int32_size()); EXPECT_EQ(0, m.repeated_int64_size()); @@ -87,6 +90,7 @@ void CheckDefaultValues(const TestAllTypes& m) { EXPECT_EQ(0, m.repeated_proto2_message_size()); EXPECT_EQ(0, m.repeated_nested_enum_size()); EXPECT_EQ(0, m.repeated_foreign_enum_size()); + EXPECT_EQ(0, m.repeated_string_piece_size()); EXPECT_EQ(0, m.repeated_lazy_message_size()); EXPECT_EQ(TestAllTypes::ONEOF_FIELD_NOT_SET, m.oneof_field_case()); } @@ -112,6 +116,7 @@ void FillValues(TestAllTypes* m) { m->mutable_optional_proto2_message()->set_optional_int32(44); m->set_optional_nested_enum(TestAllTypes::BAZ); m->set_optional_foreign_enum(FOREIGN_BAZ); + m->set_optional_string_piece("test"); m->mutable_optional_lazy_message()->set_bb(45); m->add_repeated_int32(100); m->add_repeated_int64(101); @@ -133,6 +138,7 @@ void FillValues(TestAllTypes* m) { m->add_repeated_proto2_message()->set_optional_int32(48); m->add_repeated_nested_enum(TestAllTypes::BAZ); m->add_repeated_foreign_enum(FOREIGN_BAZ); + m->add_repeated_string_piece("test"); m->add_repeated_lazy_message()->set_bb(49); m->set_oneof_uint32(1); @@ -164,6 +170,7 @@ void CheckNonDefaultValues(const TestAllTypes& m) { EXPECT_EQ(44, m.optional_proto2_message().optional_int32()); EXPECT_EQ(TestAllTypes::BAZ, m.optional_nested_enum()); EXPECT_EQ(FOREIGN_BAZ, m.optional_foreign_enum()); + EXPECT_EQ("test", m.optional_string_piece()); EXPECT_EQ(true, m.has_optional_lazy_message()); EXPECT_EQ(45, m.optional_lazy_message().bb()); @@ -207,6 +214,8 @@ void CheckNonDefaultValues(const TestAllTypes& m) { EXPECT_EQ(TestAllTypes::BAZ, m.repeated_nested_enum(0)); EXPECT_EQ(1, m.repeated_foreign_enum_size()); EXPECT_EQ(FOREIGN_BAZ, m.repeated_foreign_enum(0)); + EXPECT_EQ(1, m.repeated_string_piece_size()); + EXPECT_EQ("test", m.repeated_string_piece(0)); EXPECT_EQ(1, m.repeated_lazy_message_size()); EXPECT_EQ(49, m.repeated_lazy_message(0).bb()); @@ -257,6 +266,452 @@ TEST(NoFieldPresenceTest, MessageFieldPresenceTest) { TestAllTypes::default_instance().has_optional_nested_message()); } +TEST(NoFieldPresenceTest, MergeFromDefaultStringFieldTest) { + // As an optimization, we maintain a default string in memory and messages + // with uninitialized fields will be constructed with a pointer to this + // default string object. The destructor should clear the field only when it + // is "set" to a nondefault object. + TestAllTypes src, dst; + dst.MergeFrom(src); + + dst.Clear(); +} + +TEST(NoFieldPresenceTest, MergeFromAllocatedStringFieldTest) { + // As an optimization, we maintain a default string in memory and messages + // with uninitialized fields will be constructed with a pointer to this + // default string object. The destructor should clear the field only when it + // is "set" to a nondefault object. + TestAllTypes src, dst; + + src.mutable_optional_string(); // this causes a memory allocation. + dst.MergeFrom(src); + + dst.Clear(); +} + +TEST(NoFieldPresenceTest, MergeFromEmptyStringFieldTest) { + // As an optimization, we maintain a default string in memory and messages + // with uninitialized fields will be constructed with a pointer to this + // default string object. The destructor should clear the field only when it + // is "set" to a nondefault object. + TestAllTypes src, dst; + + // set one field to zero. + src.set_optional_string(""); + dst.MergeFrom(src); + + dst.Clear(); +} + +TEST(NoFieldPresenceTest, CopyTwiceDefaultStringFieldTest) { + // As an optimization, we maintain a default string in memory and messages + // with uninitialized fields will be constructed with a pointer to this + // default string object. The destructor should clear the field only when it + // is "set" to a nondefault object. + TestAllTypes src, dst; + + dst = src; + dst = src; +} + +TEST(NoFieldPresenceTest, CopyTwiceAllocatedStringFieldTest) { + // As an optimization, we maintain a default string in memory and messages + // with uninitialized fields will be constructed with a pointer to this + // default string object. The destructor should clear the field only when it + // is "set" to a nondefault object. + TestAllTypes src, dst; + + src.mutable_optional_string(); // this causes a memory allocation. + + dst = src; + dst = src; +} + +TEST(NoFieldPresenceTest, CopyTwiceEmptyStringFieldTest) { + // As an optimization, we maintain a default string in memory and messages + // with uninitialized fields will be constructed with a pointer to this + // default string object. The destructor should clear the field only when it + // is "set" to a nondefault object. + TestAllTypes src, dst; + + // set one field to zero. + src.set_optional_string(""); + + dst = src; + dst = src; +} + +class NoFieldPresenceSwapFieldTest : public testing::Test { + protected: + NoFieldPresenceSwapFieldTest() + : m1_(), + m2_(), + r1_(m1_.GetReflection()), + r2_(m2_.GetReflection()), + d1_(m1_.GetDescriptor()), + d2_(m2_.GetDescriptor()) {} + + // Returns a field descriptor that corresponds to the field name. + // Note that different messages would still return the same field descriptor. + const FieldDescriptor* FindFieldByName(absl::string_view field_name) { + const FieldDescriptor* f1 = d1_->FindFieldByName(field_name); + const FieldDescriptor* f2 = d2_->FindFieldByName(field_name); + + // We actually ensure uniqueness of *field descriptors* even if we try to + // obtain them from different *message descriptors*. + ABSL_CHECK_EQ(f1, f2); + return f1; + } + + TestAllTypes m1_; + TestAllTypes m2_; + const Reflection* r1_; + const Reflection* r2_; + const Descriptor* d1_; + const Descriptor* d2_; +}; + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldScalarNonZeroTest) { + m1_.set_optional_int32(1); + m2_.set_optional_int32(2); + + const FieldDescriptor* f = FindFieldByName("optional_int32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_TRUE(r1_->HasField(m1_, f)); + EXPECT_TRUE(r2_->HasField(m2_, f)); + EXPECT_EQ(2, m1_.optional_int32()); + EXPECT_EQ(1, m2_.optional_int32()); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped again. + EXPECT_TRUE(r1_->HasField(m1_, f)); + EXPECT_TRUE(r2_->HasField(m2_, f)); + EXPECT_EQ(1, m1_.optional_int32()); + EXPECT_EQ(2, m2_.optional_int32()); +} + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldScalarOneZeroTest) { + m1_.set_optional_int32(1); + + const FieldDescriptor* f = FindFieldByName("optional_int32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_FALSE(r1_->HasField(m1_, f)); + EXPECT_TRUE(r2_->HasField(m2_, f)); + EXPECT_EQ(0, m1_.optional_int32()); + EXPECT_EQ(1, m2_.optional_int32()); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped again. + EXPECT_TRUE(r1_->HasField(m1_, f)); + EXPECT_FALSE(r2_->HasField(m2_, f)); + EXPECT_EQ(1, m1_.optional_int32()); + EXPECT_EQ(0, m2_.optional_int32()); +} + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldScalarBothZeroTest) { + m1_.set_optional_int32(0); // setting an int field to zero should be noop + + const FieldDescriptor* f = FindFieldByName("optional_int32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_FALSE(r1_->HasField(m1_, f)); + EXPECT_FALSE(r2_->HasField(m2_, f)); + EXPECT_EQ(0, m1_.optional_int32()); + EXPECT_EQ(0, m2_.optional_int32()); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped again. + EXPECT_FALSE(r1_->HasField(m1_, f)); + EXPECT_FALSE(r2_->HasField(m2_, f)); + EXPECT_EQ(0, m1_.optional_int32()); + EXPECT_EQ(0, m2_.optional_int32()); +} + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldRepeatedNonZeroTest) { + m1_.add_repeated_int32(1); + m2_.add_repeated_int32(2); + m2_.add_repeated_int32(22); + + const FieldDescriptor* f = FindFieldByName("repeated_int32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_EQ(r1_->FieldSize(m1_, f), 2); + EXPECT_EQ(r2_->FieldSize(m2_, f), 1); + EXPECT_THAT(m1_.repeated_int32(), UnorderedPointwise(Eq(), {2, 22})); + EXPECT_THAT(m2_.repeated_int32(), UnorderedPointwise(Eq(), {1})); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped again. + EXPECT_EQ(r1_->FieldSize(m1_, f), 1); + EXPECT_EQ(r2_->FieldSize(m2_, f), 2); + EXPECT_THAT(m1_.repeated_int32(), UnorderedPointwise(Eq(), {1})); + EXPECT_THAT(m2_.repeated_int32(), UnorderedPointwise(Eq(), {2, 22})); +} + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldRepeatedOneZeroTest) { + m1_.add_repeated_int32(1); + + const FieldDescriptor* f = FindFieldByName("repeated_int32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_EQ(r1_->FieldSize(m1_, f), 0); + EXPECT_EQ(r2_->FieldSize(m2_, f), 1); + EXPECT_THAT(m1_.repeated_int32(), IsEmpty()); + EXPECT_THAT(m2_.repeated_int32(), UnorderedPointwise(Eq(), {1})); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped again. + EXPECT_EQ(r1_->FieldSize(m1_, f), 1); + EXPECT_EQ(r2_->FieldSize(m2_, f), 0); + EXPECT_THAT(m1_.repeated_int32(), UnorderedPointwise(Eq(), {1})); + EXPECT_THAT(m2_.repeated_int32(), IsEmpty()); +} + +TEST_F(NoFieldPresenceSwapFieldTest, + ReflectionSwapFieldRepeatedExplicitZeroTest) { + // For repeated fields, explicitly adding zero would cause it to be added into + // the repeated field. + m1_.add_repeated_int32(0); + + const FieldDescriptor* f = FindFieldByName("repeated_int32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_EQ(r1_->FieldSize(m1_, f), 0); + EXPECT_EQ(r2_->FieldSize(m2_, f), 1); + EXPECT_THAT(m1_.repeated_int32(), IsEmpty()); + EXPECT_THAT(m2_.repeated_int32(), UnorderedPointwise(Eq(), {0})); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped again. + EXPECT_EQ(r1_->FieldSize(m1_, f), 1); + EXPECT_EQ(r2_->FieldSize(m2_, f), 0); + EXPECT_THAT(m1_.repeated_int32(), UnorderedPointwise(Eq(), {0})); + EXPECT_THAT(m2_.repeated_int32(), IsEmpty()); +} + +TEST_F(NoFieldPresenceSwapFieldTest, + ReflectionSwapFieldOneofFieldDescriptorTest) { + m1_.set_oneof_uint32(1); + m2_.set_oneof_string("test"); + + // NOTE: Calling swap on any field descriptor within the oneof works -- + // even a completely unrelated field. + const FieldDescriptor* never_set_field = d1_->FindFieldByName("oneof_enum"); + + r1_->SwapFields(&m1_, &m2_, /*fields=*/{never_set_field}); + + // Fields should be swapped. + EXPECT_FALSE(r1_->HasField(m1_, never_set_field)); + EXPECT_FALSE(r1_->HasField(m2_, never_set_field)); + EXPECT_TRUE(m1_.has_oneof_string()); + EXPECT_TRUE(m2_.has_oneof_uint32()); + EXPECT_EQ(m1_.oneof_string(), "test"); + EXPECT_EQ(m2_.oneof_uint32(), 1); + + // Calling oneof accessors on a swapped-out field will give the default value. + EXPECT_FALSE(m1_.has_oneof_uint32()); + EXPECT_FALSE(m2_.has_oneof_string()); + EXPECT_EQ(m1_.oneof_uint32(), 0); + EXPECT_THAT(m2_.oneof_string(), IsEmpty()); +} + +TEST_F(NoFieldPresenceSwapFieldTest, + ReflectionSwapFieldOneofFieldMultipleIdenticalDescriptorTest) { + m1_.set_oneof_uint32(1); + m2_.set_oneof_string("test"); + + // NOTE: Calling swap on any field descriptor within the oneof works -- + // even a completely unrelated field. + const FieldDescriptor* never_set_field = d1_->FindFieldByName("oneof_enum"); + const FieldDescriptor* f1 = d1_->FindFieldByName("oneof_uint32"); + const FieldDescriptor* f2 = d2_->FindFieldByName("oneof_string"); + + // Multiple instances of the identical descriptor is ignored. + r1_->SwapFields(&m1_, &m2_, /*fields=*/{never_set_field, never_set_field}); + + // Fields should be swapped (just once). + EXPECT_EQ(m1_.oneof_string(), "test"); + EXPECT_EQ(m2_.oneof_uint32(), 1); + + // Multiple instances of the identical descriptor is ignored. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f1, f2, never_set_field}); + + // Fields should be swapped (just once). + EXPECT_TRUE(m1_.has_oneof_uint32()); + EXPECT_TRUE(m2_.has_oneof_string()); + EXPECT_TRUE(r1_->HasField(m1_, f1)); + EXPECT_TRUE(r2_->HasField(m2_, f2)); + EXPECT_EQ(m1_.oneof_uint32(), 1); + EXPECT_EQ(m2_.oneof_string(), "test"); + + // Calling oneof accessors on a swapped-out field will give the default value. + EXPECT_FALSE(m1_.has_oneof_string()); + EXPECT_FALSE(m2_.has_oneof_uint32()); + EXPECT_FALSE(r1_->HasField(m1_, d1_->FindFieldByName("oneof_string"))); + EXPECT_FALSE(r2_->HasField(m2_, d2_->FindFieldByName("oneof_uint32"))); + EXPECT_THAT(m1_.oneof_string(), IsEmpty()); + EXPECT_EQ(m2_.oneof_uint32(), 0); +} + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldOneofNonZeroTest) { + m1_.set_oneof_uint32(1); + m2_.set_oneof_string("test"); + + const FieldDescriptor* f = FindFieldByName("oneof_uint32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_TRUE(m1_.has_oneof_string()); + EXPECT_TRUE(m2_.has_oneof_uint32()); + EXPECT_TRUE(r1_->HasField(m1_, d1_->FindFieldByName("oneof_string"))); + EXPECT_TRUE(r2_->HasField(m2_, f)); + EXPECT_EQ(m1_.oneof_string(), "test"); + EXPECT_EQ(m2_.oneof_uint32(), 1); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_TRUE(m1_.has_oneof_uint32()); + EXPECT_TRUE(m2_.has_oneof_string()); + EXPECT_TRUE(r1_->HasField(m1_, f)); + EXPECT_TRUE(r2_->HasField(m2_, d2_->FindFieldByName("oneof_string"))); + EXPECT_EQ(m1_.oneof_uint32(), 1); + EXPECT_EQ(m2_.oneof_string(), "test"); +} + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldOneofDefaultTest) { + m1_.set_oneof_uint32(1); + + const FieldDescriptor* f = FindFieldByName("oneof_uint32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_FALSE(r1_->HasField(m1_, d1_->FindFieldByName("oneof_string"))); + EXPECT_TRUE(r2_->HasField(m2_, f)); + EXPECT_FALSE(m1_.has_oneof_string()); + EXPECT_EQ(m2_.oneof_uint32(), 1); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_TRUE(r1_->HasField(m1_, f)); + EXPECT_FALSE(r2_->HasField(m2_, d2_->FindFieldByName("oneof_string"))); + EXPECT_EQ(m1_.oneof_uint32(), 1); + EXPECT_FALSE(m2_.has_oneof_string()); +} + +TEST_F(NoFieldPresenceSwapFieldTest, ReflectionSwapFieldOneofExplicitZeroTest) { + // Oneof fields essentially have explicit presence -- if set to zero, they + // will still be considered present. + m1_.set_oneof_uint32(0); + + const FieldDescriptor* f = FindFieldByName("oneof_uint32"); + r1_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_FALSE(r1_->HasField(m1_, f)); + EXPECT_TRUE(r2_->HasField(m2_, f)); + EXPECT_FALSE(m1_.has_oneof_uint32()); + EXPECT_TRUE(m2_.has_oneof_uint32()); + EXPECT_EQ(m2_.oneof_uint32(), 0); + + // It doesn't matter which reflection or descriptor gets used; swapping should + // still work if m2_'s descriptor is provided. + r2_->SwapFields(&m1_, &m2_, /*fields=*/{f}); + + // Fields should be swapped. + EXPECT_TRUE(r1_->HasField(m1_, f)); + EXPECT_FALSE(r2_->HasField(m2_, f)); + EXPECT_TRUE(m1_.has_oneof_uint32()); + EXPECT_EQ(m1_.oneof_uint32(), 0); + EXPECT_FALSE(m2_.has_oneof_uint32()); +} + +class NoFieldPresenceListFieldsTest : public testing::Test { + protected: + NoFieldPresenceListFieldsTest() + : message_(), r_(message_.GetReflection()), fields_() { + // Check initial state: scalars not present (due to need to be consistent + // with MergeFrom()), message fields not present, oneofs not present. + r_->ListFields(message_, &fields_); + ABSL_CHECK(fields_.empty()); + } + + TestAllTypes message_; + const Reflection* r_; + std::vector<const FieldDescriptor*> fields_; +}; + +TEST_F(NoFieldPresenceListFieldsTest, ScalarTest) { + // Check zero/empty-means-not-present semantics. + message_.set_optional_int32(0); + r_->ListFields(message_, &fields_); + EXPECT_TRUE(fields_.empty()); + + message_.Clear(); + message_.set_optional_int32(42); + r_->ListFields(message_, &fields_); + EXPECT_EQ(1, fields_.size()); +} + +TEST_F(NoFieldPresenceListFieldsTest, MessageTest) { + // Message fields always have explicit presence. + message_.mutable_optional_nested_message(); + r_->ListFields(message_, &fields_); + EXPECT_EQ(1, fields_.size()); + + fields_.clear(); + message_.Clear(); + message_.mutable_optional_nested_message()->set_bb(123); + r_->ListFields(message_, &fields_); + EXPECT_EQ(1, fields_.size()); +} + +TEST_F(NoFieldPresenceListFieldsTest, OneOfTest) { + // Oneof fields behave essentially like an explicit presence field. + message_.set_oneof_uint32(0); + r_->ListFields(message_, &fields_); + EXPECT_EQ(1, fields_.size()); + + fields_.clear(); + // Note: + // we don't clear message_ -- oneof must only maintain one present field. + message_.set_oneof_uint32(42); + r_->ListFields(message_, &fields_); + EXPECT_EQ(1, fields_.size()); +} + TEST(NoFieldPresenceTest, ReflectionHasFieldTest) { // check that HasField reports true on all scalar fields. Check that it // behaves properly for message fields. @@ -285,7 +740,7 @@ TEST(NoFieldPresenceTest, ReflectionHasFieldTest) { if (field->is_repeated() || field->containing_oneof()) { continue; } - if (field->options().ctype() != FieldOptions::STRING) { + if (internal::cpp::IsStringFieldWithPrivatizedAccessors(*field)) { continue; } EXPECT_EQ(true, r->HasField(message, field)); @@ -507,7 +962,7 @@ bool TestSerialize<std::string>(const MessageLite& message, template <> bool TestSerialize<absl::Cord>(const MessageLite& message, absl::Cord* output) { - return message.SerializeToCord(output); + return message.SerializeToString(output); } template <typename T> @@ -579,6 +1034,7 @@ TYPED_TEST(NoFieldPresenceSerializeTest, DontSerializeDefaultValuesTest) { message.set_optional_bytes(""); message.set_optional_nested_enum(TestAllTypes::FOO); // first enum entry message.set_optional_foreign_enum(FOREIGN_FOO); // first enum entry + message.set_optional_string_piece(""); ASSERT_TRUE(TestSerialize(message, &output_sink)); EXPECT_EQ(0, this->GetOutput().size()); diff --git a/third_party/protobuf/src/google/protobuf/only_one_enum_test.proto b/third_party/protobuf/src/google/protobuf/only_one_enum_test.proto new file mode 100644 index 0000000000000..f20fb20ab45a4 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/only_one_enum_test.proto @@ -0,0 +1,14 @@ +edition = "2023"; + +package proto2_unittest; + +option optimize_for = LITE_RUNTIME; + +// A file with only a single enum, without any use of it. +// This is useful for testing enum specific codegen that is not directly related +// to field codegen. + +enum OnlyOneEnum { + ONLY_ONE_ENUM_DEFAULT = 0; + ONLY_ONE_ENUM_VALID = 10; +} diff --git a/third_party/protobuf/src/google/protobuf/parse_context.cc b/third_party/protobuf/src/google/protobuf/parse_context.cc index 9b78a57b670be..32e3639bb486b 100644 --- a/third_party/protobuf/src/google/protobuf/parse_context.cc +++ b/third_party/protobuf/src/google/protobuf/parse_context.cc @@ -10,6 +10,7 @@ #include <algorithm> #include <cstring> +#include "absl/base/optimization.h" #include "absl/strings/cord.h" #include "absl/strings/string_view.h" #include "google/protobuf/message_lite.h" @@ -148,7 +149,7 @@ const char* EpsCopyInputStream::Next() { std::pair<const char*, bool> EpsCopyInputStream::DoneFallback(int overrun, int depth) { // Did we exceeded the limit (parse error). - if (PROTOBUF_PREDICT_FALSE(overrun > limit_)) return {nullptr, true}; + if (ABSL_PREDICT_FALSE(overrun > limit_)) return {nullptr, true}; ABSL_DCHECK(overrun != limit_); // Guaranteed by caller. ABSL_DCHECK(overrun < limit_); // Follows from above // TODO Instead of this dcheck we could just assign, and remove @@ -166,7 +167,7 @@ std::pair<const char*, bool> EpsCopyInputStream::DoneFallback(int overrun, p = NextBuffer(overrun, depth); if (p == nullptr) { // We are at the end of the stream - if (PROTOBUF_PREDICT_FALSE(overrun != 0)) return {nullptr, true}; + if (ABSL_PREDICT_FALSE(overrun != 0)) return {nullptr, true}; ABSL_DCHECK_GT(limit_, 0); limit_end_ = buffer_end_; // Distinguish ending on a pushed limit or ending on end-of-stream. @@ -188,7 +189,7 @@ const char* EpsCopyInputStream::SkipFallback(const char* ptr, int size) { const char* EpsCopyInputStream::ReadStringFallback(const char* ptr, int size, std::string* str) { str->clear(); - if (PROTOBUF_PREDICT_TRUE(size <= buffer_end_ - ptr + limit_)) { + if (ABSL_PREDICT_TRUE(size <= buffer_end_ - ptr + limit_)) { // Reserve the string up to a static safe size. If strings are bigger than // this we proceed by growing the string as needed. This protects against // malicious payloads making protobuf hold on to a lot of memory. @@ -200,7 +201,7 @@ const char* EpsCopyInputStream::ReadStringFallback(const char* ptr, int size, const char* EpsCopyInputStream::AppendStringFallback(const char* ptr, int size, std::string* str) { - if (PROTOBUF_PREDICT_TRUE(size <= buffer_end_ - ptr + limit_)) { + if (ABSL_PREDICT_TRUE(size <= buffer_end_ - ptr + limit_)) { // Reserve the string up to a static safe size. If strings are bigger than // this we proceed by growing the string as needed. This protects against // malicious payloads making protobuf hold on to a lot of memory. @@ -337,14 +338,14 @@ std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, for (std::uint32_t i = 1; i < 5; i++) { uint32_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); - if (PROTOBUF_PREDICT_TRUE(byte < 128)) { + if (ABSL_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } // Accept >5 bytes for (std::uint32_t i = 5; i < 10; i++) { uint32_t byte = static_cast<uint8_t>(p[i]); - if (PROTOBUF_PREDICT_TRUE(byte < 128)) { + if (ABSL_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } @@ -357,7 +358,7 @@ std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, for (std::uint32_t i = 1; i < 10; i++) { uint64_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); - if (PROTOBUF_PREDICT_TRUE(byte < 128)) { + if (ABSL_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } @@ -368,7 +369,7 @@ std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res) { for (std::uint32_t i = 2; i < 5; i++) { uint32_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); - if (PROTOBUF_PREDICT_TRUE(byte < 128)) { + if (ABSL_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } @@ -379,17 +380,17 @@ std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t res) { for (std::uint32_t i = 1; i < 4; i++) { uint32_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); - if (PROTOBUF_PREDICT_TRUE(byte < 128)) { + if (ABSL_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } std::uint32_t byte = static_cast<uint8_t>(p[4]); - if (PROTOBUF_PREDICT_FALSE(byte >= 8)) return {nullptr, 0}; // size >= 2gb + if (ABSL_PREDICT_FALSE(byte >= 8)) return {nullptr, 0}; // size >= 2gb res += (byte - 1) << 28; // Protect against sign integer overflow in PushLimit. Limits are relative // to buffer ends and ptr could potential be kSlopBytes beyond a buffer end. // To protect against overflow we reject limits absurdly close to INT_MAX. - if (PROTOBUF_PREDICT_FALSE(res > INT_MAX - ParseContext::kSlopBytes)) { + if (ABSL_PREDICT_FALSE(res > INT_MAX - ParseContext::kSlopBytes)) { return {nullptr, 0}; } return {p + 5, res}; diff --git a/third_party/protobuf/src/google/protobuf/parse_context.h b/third_party/protobuf/src/google/protobuf/parse_context.h index 1f6f72629720a..7d663df2974df 100644 --- a/third_party/protobuf/src/google/protobuf/parse_context.h +++ b/third_party/protobuf/src/google/protobuf/parse_context.h @@ -8,13 +8,18 @@ #ifndef GOOGLE_PROTOBUF_PARSE_CONTEXT_H__ #define GOOGLE_PROTOBUF_PARSE_CONTEXT_H__ +#include <algorithm> +#include <climits> +#include <cstddef> #include <cstdint> #include <cstring> +#include <limits> #include <string> #include <type_traits> #include <utility> #include "absl/base/config.h" +#include "absl/base/prefetch.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/cord.h" @@ -26,9 +31,11 @@ #include "google/protobuf/inlined_string_field.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream.h" +#include "google/protobuf/message_lite.h" #include "google/protobuf/metadata_lite.h" #include "google/protobuf/port.h" #include "google/protobuf/repeated_field.h" +#include "google/protobuf/repeated_ptr_field.h" #include "google/protobuf/wire_format_lite.h" @@ -50,9 +57,9 @@ PROTOBUF_EXPORT void WriteVarint(uint32_t num, uint64_t val, std::string* s); PROTOBUF_EXPORT void WriteLengthDelimited(uint32_t num, absl::string_view val, std::string* s); // Inline because it is just forwarding to s->WriteVarint -inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* s); +inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* unknown); inline void WriteLengthDelimited(uint32_t num, absl::string_view val, - UnknownFieldSet* s); + UnknownFieldSet* unknown); // The basic abstraction the parser is designed for is a slight modification @@ -102,7 +109,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { ABSL_DCHECK(ptr <= buffer_end_ + kSlopBytes); int count; if (next_chunk_ == patch_buffer_) { - count = static_cast<int>(buffer_end_ + kSlopBytes - ptr); + count = BytesAvailable(ptr); } else { count = size_ + static_cast<int>(buffer_end_ - ptr); } @@ -115,10 +122,10 @@ class PROTOBUF_EXPORT EpsCopyInputStream { // __asan_address_is_poisoned is allowed to have false negatives. class LimitToken { public: - LimitToken() { PROTOBUF_POISON_MEMORY_REGION(&token_, sizeof(token_)); } + LimitToken() { internal::PoisonMemoryRegion(&token_, sizeof(token_)); } explicit LimitToken(int token) : token_(token) { - PROTOBUF_UNPOISON_MEMORY_REGION(&token_, sizeof(token_)); + internal::UnpoisonMemoryRegion(&token_, sizeof(token_)); } LimitToken(const LimitToken&) = delete; @@ -127,17 +134,17 @@ class PROTOBUF_EXPORT EpsCopyInputStream { LimitToken(LimitToken&& other) { *this = std::move(other); } LimitToken& operator=(LimitToken&& other) { - PROTOBUF_UNPOISON_MEMORY_REGION(&token_, sizeof(token_)); + internal::UnpoisonMemoryRegion(&token_, sizeof(token_)); token_ = other.token_; - PROTOBUF_POISON_MEMORY_REGION(&other.token_, sizeof(token_)); + internal::PoisonMemoryRegion(&other.token_, sizeof(token_)); return *this; } - ~LimitToken() { PROTOBUF_UNPOISON_MEMORY_REGION(&token_, sizeof(token_)); } + ~LimitToken() { internal::UnpoisonMemoryRegion(&token_, sizeof(token_)); } int token() && { int t = token_; - PROTOBUF_POISON_MEMORY_REGION(&token_, sizeof(token_)); + internal::PoisonMemoryRegion(&token_, sizeof(token_)); return t; } @@ -146,7 +153,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { }; // If return value is negative it's an error - PROTOBUF_NODISCARD LimitToken PushLimit(const char* ptr, int limit) { + [[nodiscard]] LimitToken PushLimit(const char* ptr, int limit) { ABSL_DCHECK(limit >= 0 && limit <= INT_MAX - kSlopBytes); // This add is safe due to the invariant above, because // ptr - buffer_end_ <= kSlopBytes. @@ -157,26 +164,26 @@ class PROTOBUF_EXPORT EpsCopyInputStream { return LimitToken(old_limit - limit); } - PROTOBUF_NODISCARD bool PopLimit(LimitToken delta) { + [[nodiscard]] bool PopLimit(LimitToken delta) { // We must update the limit first before the early return. Otherwise, we can // end up with an invalid limit and it can lead to integer overflows. limit_ = limit_ + std::move(delta).token(); - if (PROTOBUF_PREDICT_FALSE(!EndedAtLimit())) return false; + if (ABSL_PREDICT_FALSE(!EndedAtLimit())) return false; // TODO We could remove this line and hoist the code to // DoneFallback. Study the perf/bin-size effects. limit_end_ = buffer_end_ + (std::min)(0, limit_); return true; } - PROTOBUF_NODISCARD const char* Skip(const char* ptr, int size) { - if (size <= buffer_end_ + kSlopBytes - ptr) { + [[nodiscard]] const char* Skip(const char* ptr, int size) { + if (size <= BytesAvailable(ptr)) { return ptr + size; } return SkipFallback(ptr, size); } - PROTOBUF_NODISCARD const char* ReadString(const char* ptr, int size, - std::string* s) { - if (size <= buffer_end_ + kSlopBytes - ptr) { + [[nodiscard]] const char* ReadString(const char* ptr, int size, + std::string* s) { + if (size <= BytesAvailable(ptr)) { // Fundamentally we just want to do assign to the string. // However micro-benchmarks regress on string reading cases. So we copy // the same logic from the old CodedInputStream ReadString. Note: as of @@ -188,23 +195,21 @@ class PROTOBUF_EXPORT EpsCopyInputStream { } return ReadStringFallback(ptr, size, s); } - PROTOBUF_NODISCARD const char* AppendString(const char* ptr, int size, - std::string* s) { - if (size <= buffer_end_ + kSlopBytes - ptr) { + [[nodiscard]] const char* AppendString(const char* ptr, int size, + std::string* s) { + if (size <= BytesAvailable(ptr)) { s->append(ptr, size); return ptr + size; } return AppendStringFallback(ptr, size, s); } // Implemented in arenastring.cc - PROTOBUF_NODISCARD const char* ReadArenaString(const char* ptr, - ArenaStringPtr* s, - Arena* arena); + [[nodiscard]] const char* ReadArenaString(const char* ptr, ArenaStringPtr* s, + Arena* arena); - PROTOBUF_NODISCARD const char* ReadCord(const char* ptr, int size, - ::absl::Cord* cord) { - if (size <= std::min<int>(static_cast<int>(buffer_end_ + kSlopBytes - ptr), - kMaxCordBytesToCopy)) { + [[nodiscard]] const char* ReadCord(const char* ptr, int size, + ::absl::Cord* cord) { + if (size <= std::min<int>(BytesAvailable(ptr), kMaxCordBytesToCopy)) { *cord = absl::string_view(ptr, size); return ptr + size; } @@ -213,20 +218,19 @@ class PROTOBUF_EXPORT EpsCopyInputStream { template <typename Tag, typename T> - PROTOBUF_NODISCARD const char* ReadRepeatedFixed(const char* ptr, - Tag expected_tag, - RepeatedField<T>* out); + [[nodiscard]] const char* ReadRepeatedFixed(const char* ptr, Tag expected_tag, + RepeatedField<T>* out); template <typename T> - PROTOBUF_NODISCARD const char* ReadPackedFixed(const char* ptr, int size, - RepeatedField<T>* out); + [[nodiscard]] const char* ReadPackedFixed(const char* ptr, int size, + RepeatedField<T>* out); template <typename Add> - PROTOBUF_NODISCARD const char* ReadPackedVarint(const char* ptr, Add add) { + [[nodiscard]] const char* ReadPackedVarint(const char* ptr, Add add) { return ReadPackedVarint(ptr, add, [](int) {}); } template <typename Add, typename SizeCb> - PROTOBUF_NODISCARD const char* ReadPackedVarint(const char* ptr, Add add, - SizeCb size_callback); + [[nodiscard]] const char* ReadPackedVarint(const char* ptr, Add add, + SizeCb size_callback); uint32_t LastTag() const { return last_tag_minus_1_ + 1; } bool ConsumeEndGroup(uint32_t start_tag) { @@ -260,7 +264,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { // If limit is exceeded, it returns true and ptr is set to null. bool DoneWithCheck(const char** ptr, int d) { ABSL_DCHECK(*ptr); - if (PROTOBUF_PREDICT_TRUE(*ptr < limit_end_)) return false; + if (ABSL_PREDICT_TRUE(*ptr < limit_end_)) return false; int overrun = static_cast<int>(*ptr - buffer_end_); ABSL_DCHECK_LE(overrun, kSlopBytes); // Guaranteed by parse loop. if (overrun == @@ -344,6 +348,14 @@ class PROTOBUF_EXPORT EpsCopyInputStream { // systems. TODO do we need to set this as build flag? enum { kSafeStringSize = 50000000 }; + int BytesAvailable(const char* ptr) const { + ABSL_DCHECK_NE(ptr, nullptr); + ptrdiff_t available = buffer_end_ + kSlopBytes - ptr; + ABSL_DCHECK_GE(available, 0); + ABSL_DCHECK_LE(available, INT_MAX); + return static_cast<int>(available); + } + // Advances to next buffer chunk returns a pointer to the same logical place // in the stream as set by overrun. Overrun indicates the position in the slop // region the parse was left (0 <= overrun <= kSlopBytes). Returns true if at @@ -381,7 +393,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { template <typename A> const char* AppendSize(const char* ptr, int size, const A& append) { - int chunk_size = static_cast<int>(buffer_end_ + kSlopBytes - ptr); + int chunk_size = BytesAvailable(ptr); do { ABSL_DCHECK(size > chunk_size); if (next_chunk_ == nullptr) return nullptr; @@ -395,7 +407,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { ptr = Next(); if (ptr == nullptr) return nullptr; // passed the limit ptr += kSlopBytes; - chunk_size = static_cast<int>(buffer_end_ + kSlopBytes - ptr); + chunk_size = BytesAvailable(ptr); } while (size > chunk_size); append(ptr, size); return ptr + size; @@ -410,7 +422,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { const char* AppendUntilEnd(const char* ptr, const A& append) { if (ptr - buffer_end_ > limit_) return nullptr; while (limit_ > kSlopBytes) { - size_t chunk_size = buffer_end_ + kSlopBytes - ptr; + size_t chunk_size = BytesAvailable(ptr); append(ptr, chunk_size); ptr = Next(); if (ptr == nullptr) return limit_end_; @@ -422,8 +434,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { return end; } - PROTOBUF_NODISCARD const char* AppendString(const char* ptr, - std::string* str) { + [[nodiscard]] const char* AppendString(const char* ptr, std::string* str) { return AppendUntilEnd( ptr, [str](const char* p, ptrdiff_t s) { str->append(p, s); }); } @@ -495,15 +506,15 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { // Read the length prefix, push the new limit, call the func(ptr), and then // pop the limit. Useful for situations that don't have an actual message. template <typename Func> - PROTOBUF_NODISCARD const char* ParseLengthDelimitedInlined(const char*, - const Func& func); + [[nodiscard]] const char* ParseLengthDelimitedInlined(const char*, + const Func& func); // Push the recursion depth, call the func(ptr), and then pop depth. Useful // for situations that don't have an actual message. template <typename Func> - PROTOBUF_NODISCARD const char* ParseGroupInlined(const char* ptr, - uint32_t start_tag, - const Func& func); + [[nodiscard]] const char* ParseGroupInlined(const char* ptr, + uint32_t start_tag, + const Func& func); // Use a template to avoid the strong dep into TcParser. All callers will have // the dep. @@ -523,8 +534,9 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { }); } - PROTOBUF_NODISCARD PROTOBUF_NDEBUG_INLINE const char* ParseGroup( - MessageLite* msg, const char* ptr, uint32_t tag) { + [[nodiscard]] PROTOBUF_NDEBUG_INLINE const char* ParseGroup(MessageLite* msg, + const char* ptr, + uint32_t tag) { if (--depth_ < 0) return nullptr; group_depth_++; auto old_depth = depth_; @@ -536,7 +548,7 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { } group_depth_--; depth_++; - if (PROTOBUF_PREDICT_FALSE(!ConsumeEndGroup(tag))) return nullptr; + if (ABSL_PREDICT_FALSE(!ConsumeEndGroup(tag))) return nullptr; return ptr; } @@ -549,12 +561,12 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { // if (!ptr) return nullptr; // LimitToken old = PushLimit(ptr, size); // if (--depth_ < 0) return nullptr; - PROTOBUF_NODISCARD const char* ReadSizeAndPushLimitAndDepth( - const char* ptr, LimitToken* old_limit); + [[nodiscard]] const char* ReadSizeAndPushLimitAndDepth(const char* ptr, + LimitToken* old_limit); // As above, but fully inlined for the cases where we care about performance // more than size. eg TcParser. - PROTOBUF_NODISCARD PROTOBUF_ALWAYS_INLINE const char* + [[nodiscard]] PROTOBUF_ALWAYS_INLINE const char* ReadSizeAndPushLimitAndDepthInlined(const char* ptr, LimitToken* old_limit); // The context keeps an internal stack to keep track of the recursive @@ -716,26 +728,24 @@ inline const char* VarintParseSlow(const char* p, uint32_t res, uint64_t* out) { // Falsely indicate that the specific value is modified at this location. This // prevents code which depends on this value from being scheduled earlier. template <typename V1Type> -PROTOBUF_ALWAYS_INLINE inline V1Type ValueBarrier(V1Type value1) { +PROTOBUF_ALWAYS_INLINE V1Type ValueBarrier(V1Type value1) { asm("" : "+r"(value1)); return value1; } template <typename V1Type, typename V2Type> -PROTOBUF_ALWAYS_INLINE inline V1Type ValueBarrier(V1Type value1, - V2Type value2) { +PROTOBUF_ALWAYS_INLINE V1Type ValueBarrier(V1Type value1, V2Type value2) { asm("" : "+r"(value1) : "r"(value2)); return value1; } // Performs a 7 bit UBFX (Unsigned Bit Extract) starting at the indicated bit. -static PROTOBUF_ALWAYS_INLINE inline uint64_t Ubfx7(uint64_t data, - uint64_t start) { +static PROTOBUF_ALWAYS_INLINE uint64_t Ubfx7(uint64_t data, uint64_t start) { return ValueBarrier((data >> start) & 0x7f); } -PROTOBUF_ALWAYS_INLINE inline uint64_t ExtractAndMergeTwoChunks( - uint64_t data, uint64_t first_byte) { +PROTOBUF_ALWAYS_INLINE uint64_t ExtractAndMergeTwoChunks(uint64_t data, + uint64_t first_byte) { ABSL_DCHECK_LE(first_byte, 6U); uint64_t first = Ubfx7(data, first_byte * 8); uint64_t second = Ubfx7(data, (first_byte + 1) * 8); @@ -753,8 +763,8 @@ struct SlowPathEncodedInfo { // Performs multiple actions which are identical between 32 and 64 bit Varints // in order to compute the length of the encoded Varint and compute the new // of p. -PROTOBUF_ALWAYS_INLINE inline SlowPathEncodedInfo ComputeLengthAndUpdateP( - const char* p) { +PROTOBUF_ALWAYS_INLINE SlowPathEncodedInfo +ComputeLengthAndUpdateP(const char* p) { SlowPathEncodedInfo result; // Load the last two bytes of the encoded Varint. std::memcpy(&result.last8, p + 2, sizeof(result.last8)); @@ -778,8 +788,8 @@ PROTOBUF_ALWAYS_INLINE inline SlowPathEncodedInfo ComputeLengthAndUpdateP( return result; } -inline PROTOBUF_ALWAYS_INLINE std::pair<const char*, uint64_t> -VarintParseSlowArm64(const char* p, uint64_t first8) { +PROTOBUF_ALWAYS_INLINE std::pair<const char*, uint64_t> VarintParseSlowArm64( + const char* p, uint64_t first8) { constexpr uint64_t kResultMaskUnshifted = 0xffffffffffffc000ULL; constexpr uint64_t kFirstResultBitChunk2 = 2 * 7; constexpr uint64_t kFirstResultBitChunk4 = 4 * 7; @@ -798,12 +808,12 @@ VarintParseSlowArm64(const char* p, uint64_t first8) { // This immediate ends in 14 zeroes since valid_chunk_bits is too low by 14. uint64_t result_mask = kResultMaskUnshifted << info.valid_chunk_bits; // iff the Varint i invalid. - if (PROTOBUF_PREDICT_FALSE(info.masked_cont_bits == 0)) { + if (ABSL_PREDICT_FALSE(info.masked_cont_bits == 0)) { return {nullptr, 0}; } // Test for early exit if Varint does not exceed 6 chunks. Branching on one // bit is faster on ARM than via a compare and branch. - if (PROTOBUF_PREDICT_FALSE((info.valid_bits & 0x20) != 0)) { + if (ABSL_PREDICT_FALSE((info.valid_bits & 0x20) != 0)) { // Extract data bits from high four chunks. uint64_t merged_67 = ExtractAndMergeTwoChunks(first8, /*first_chunk=*/6); // Last two chunks come from last two bytes of info.last8. @@ -820,8 +830,8 @@ VarintParseSlowArm64(const char* p, uint64_t first8) { // See comments in VarintParseSlowArm64 for a description of the algorithm. // Differences in the 32 bit version are noted below. -inline PROTOBUF_ALWAYS_INLINE std::pair<const char*, uint32_t> -VarintParseSlowArm32(const char* p, uint64_t first8) { +PROTOBUF_ALWAYS_INLINE std::pair<const char*, uint32_t> VarintParseSlowArm32( + const char* p, uint64_t first8) { constexpr uint64_t kResultMaskUnshifted = 0xffffffffffffc000ULL; constexpr uint64_t kFirstResultBitChunk1 = 1 * 7; constexpr uint64_t kFirstResultBitChunk3 = 3 * 7; @@ -841,7 +851,7 @@ VarintParseSlowArm32(const char* p, uint64_t first8) { // condition isn't on the critical path. Here we make sure that we don't do so // until result has been computed. info.masked_cont_bits = ValueBarrier(info.masked_cont_bits, result); - if (PROTOBUF_PREDICT_FALSE(info.masked_cont_bits == 0)) { + if (ABSL_PREDICT_FALSE(info.masked_cont_bits == 0)) { return {nullptr, 0}; } return {info.p, result}; @@ -864,16 +874,17 @@ static const char* VarintParseSlowArm(const char* p, uint64_t* out, // The caller must ensure that p points to at least 10 valid bytes. template <typename T> -PROTOBUF_NODISCARD const char* VarintParse(const char* p, T* out) { +[[nodiscard]] const char* VarintParse(const char* p, T* out) { + AssertBytesAreReadable(p, 10); #if defined(__aarch64__) && defined(ABSL_IS_LITTLE_ENDIAN) && !defined(_MSC_VER) // This optimization is not supported in big endian mode uint64_t first8; std::memcpy(&first8, p, sizeof(first8)); - if (PROTOBUF_PREDICT_TRUE((first8 & 0x80) == 0)) { + if (ABSL_PREDICT_TRUE((first8 & 0x80) == 0)) { *out = static_cast<uint8_t>(first8); return p + 1; } - if (PROTOBUF_PREDICT_TRUE((first8 & 0x8000) == 0)) { + if (ABSL_PREDICT_TRUE((first8 & 0x8000) == 0)) { uint64_t chunk1; uint64_t chunk2; // Extracting the two chunks this way gives a speedup for this path. @@ -925,13 +936,13 @@ inline const char* ReadTag(const char* p, uint32_t* out, // // Two support routines for ReadTagInlined come first... template <class T> -PROTOBUF_NODISCARD PROTOBUF_ALWAYS_INLINE constexpr T RotateLeft( - T x, int s) noexcept { +[[nodiscard]] PROTOBUF_ALWAYS_INLINE constexpr T RotateLeft(T x, + int s) noexcept { return static_cast<T>(x << (s & (std::numeric_limits<T>::digits - 1))) | static_cast<T>(x >> ((-s) & (std::numeric_limits<T>::digits - 1))); } -PROTOBUF_NODISCARD inline PROTOBUF_ALWAYS_INLINE uint64_t +[[nodiscard]] PROTOBUF_ALWAYS_INLINE uint64_t RotRight7AndReplaceLowByte(uint64_t res, const char& byte) { // TODO: remove the inline assembly #if defined(__x86_64__) && defined(__GNUC__) @@ -954,21 +965,21 @@ RotRight7AndReplaceLowByte(uint64_t res, const char& byte) { return res; } -inline PROTOBUF_ALWAYS_INLINE const char* ReadTagInlined(const char* ptr, - uint32_t* out) { +PROTOBUF_ALWAYS_INLINE const char* ReadTagInlined(const char* ptr, + uint32_t* out) { uint64_t res = 0xFF & ptr[0]; - if (PROTOBUF_PREDICT_FALSE(res >= 128)) { + if (ABSL_PREDICT_FALSE(res >= 128)) { res = RotRight7AndReplaceLowByte(res, ptr[1]); - if (PROTOBUF_PREDICT_FALSE(res & 0x80)) { + if (ABSL_PREDICT_FALSE(res & 0x80)) { res = RotRight7AndReplaceLowByte(res, ptr[2]); - if (PROTOBUF_PREDICT_FALSE(res & 0x80)) { + if (ABSL_PREDICT_FALSE(res & 0x80)) { res = RotRight7AndReplaceLowByte(res, ptr[3]); - if (PROTOBUF_PREDICT_FALSE(res & 0x80)) { + if (ABSL_PREDICT_FALSE(res & 0x80)) { // Note: this wouldn't work if res were 32-bit, // because then replacing the low byte would overwrite // the bottom 4 bits of the result. res = RotRight7AndReplaceLowByte(res, ptr[4]); - if (PROTOBUF_PREDICT_FALSE(res & 0x80)) { + if (ABSL_PREDICT_FALSE(res & 0x80)) { // The proto format does not permit longer than 5-byte encodings for // tags. *out = 0; @@ -1025,7 +1036,7 @@ inline const char* ParseBigVarint(const char* p, uint64_t* out) { auto pnew = p; auto tmp = DecodeTwoBytes(&pnew); uint64_t res = tmp >> 1; - if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { + if (ABSL_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { *out = res; return pnew; } @@ -1033,7 +1044,7 @@ inline const char* ParseBigVarint(const char* p, uint64_t* out) { pnew = p + 2 * i; tmp = DecodeTwoBytes(&pnew); res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * i - 1); - if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { + if (ABSL_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { *out = res; return pnew; } @@ -1043,9 +1054,11 @@ inline const char* ParseBigVarint(const char* p, uint64_t* out) { PROTOBUF_EXPORT std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t first); -// Used for tags, could read up to 5 bytes which must be available. Additionally -// it makes sure the unsigned value fits a int32_t, otherwise returns nullptr. -// Caller must ensure its safe to call. + +// Used for length prefixes. Could read up to 5 bytes, but no more than +// necessary for a single varint. The caller must ensure enough bytes are +// available. Additionally it makes sure the unsigned value fits in an int32_t, +// otherwise returns nullptr. Caller must ensure it is safe to call. inline uint32_t ReadSize(const char** pp) { auto p = *pp; uint32_t res = static_cast<uint8_t>(p[0]); @@ -1088,7 +1101,7 @@ inline int32_t ReadVarintZigZag32(const char** p) { } template <typename Func> -PROTOBUF_NODISCARD inline PROTOBUF_ALWAYS_INLINE const char* +[[nodiscard]] PROTOBUF_ALWAYS_INLINE const char* ParseContext::ParseLengthDelimitedInlined(const char* ptr, const Func& func) { LimitToken old; ptr = ReadSizeAndPushLimitAndDepthInlined(ptr, &old); @@ -1102,7 +1115,7 @@ ParseContext::ParseLengthDelimitedInlined(const char* ptr, const Func& func) { } template <typename Func> -PROTOBUF_NODISCARD inline PROTOBUF_ALWAYS_INLINE const char* +[[nodiscard]] PROTOBUF_ALWAYS_INLINE const char* ParseContext::ParseGroupInlined(const char* ptr, uint32_t start_tag, const Func& func) { if (--depth_ < 0) return nullptr; @@ -1116,14 +1129,14 @@ ParseContext::ParseGroupInlined(const char* ptr, uint32_t start_tag, } group_depth_--; depth_++; - if (PROTOBUF_PREDICT_FALSE(!ConsumeEndGroup(start_tag))) return nullptr; + if (ABSL_PREDICT_FALSE(!ConsumeEndGroup(start_tag))) return nullptr; return ptr; } inline const char* ParseContext::ReadSizeAndPushLimitAndDepthInlined( const char* ptr, LimitToken* old_limit) { int size = ReadSize(&ptr); - if (PROTOBUF_PREDICT_FALSE(!ptr) || depth_ <= 0) { + if (ABSL_PREDICT_FALSE(!ptr) || depth_ <= 0) { return nullptr; } *old_limit = PushLimit(ptr, size); @@ -1138,7 +1151,7 @@ const char* EpsCopyInputStream::ReadRepeatedFixed(const char* ptr, do { out->Add(UnalignedLoad<T>(ptr)); ptr += sizeof(T); - if (PROTOBUF_PREDICT_FALSE(ptr >= limit_end_)) return ptr; + if (ABSL_PREDICT_FALSE(ptr >= limit_end_)) return ptr; } while (UnalignedLoad<Tag>(ptr) == expected_tag && (ptr += sizeof(Tag))); return ptr; } @@ -1159,7 +1172,7 @@ template <typename T> const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size, RepeatedField<T>* out) { GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - int nbytes = static_cast<int>(buffer_end_ + kSlopBytes - ptr); + int nbytes = BytesAvailable(ptr); while (size > nbytes) { int num = nbytes / sizeof(T); int old_entries = out->size(); @@ -1177,7 +1190,7 @@ const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size, ptr = Next(); if (ptr == nullptr) return nullptr; ptr += kSlopBytes - (nbytes - block_size); - nbytes = static_cast<int>(buffer_end_ + kSlopBytes - ptr); + nbytes = BytesAvailable(ptr); } int num = size / sizeof(T); int block_size = num * sizeof(T); @@ -1255,12 +1268,12 @@ inline bool VerifyUTF8(const std::string* s, const char* field_name) { } // All the string parsers with or without UTF checking and for all CTypes. -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* InlineGreedyStringParser( +[[nodiscard]] PROTOBUF_EXPORT const char* InlineGreedyStringParser( std::string* s, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD inline const char* InlineCordParser(::absl::Cord* cord, - const char* ptr, - ParseContext* ctx) { +[[nodiscard]] inline const char* InlineCordParser(::absl::Cord* cord, + const char* ptr, + ParseContext* ctx) { int size = ReadSize(&ptr); if (!ptr) return nullptr; return ctx->ReadCord(ptr, size, cord); @@ -1268,8 +1281,8 @@ PROTOBUF_NODISCARD inline const char* InlineCordParser(::absl::Cord* cord, template <typename T> -PROTOBUF_NODISCARD const char* FieldParser(uint64_t tag, T& field_parser, - const char* ptr, ParseContext* ctx) { +[[nodiscard]] const char* FieldParser(uint64_t tag, T& field_parser, + const char* ptr, ParseContext* ctx) { uint32_t number = tag >> 3; GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0); using WireType = internal::WireFormatLite::WireType; @@ -1314,9 +1327,8 @@ PROTOBUF_NODISCARD const char* FieldParser(uint64_t tag, T& field_parser, } template <typename T> -PROTOBUF_NODISCARD const char* WireFormatParser(T& field_parser, - const char* ptr, - ParseContext* ctx) { +[[nodiscard]] const char* WireFormatParser(T& field_parser, const char* ptr, + ParseContext* ctx) { while (!ctx->Done(&ptr)) { uint32_t tag; ptr = ReadTag(ptr, &tag); @@ -1335,30 +1347,37 @@ PROTOBUF_NODISCARD const char* WireFormatParser(T& field_parser, // corresponding field // These are packed varints -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedInt32Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedUInt32Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedInt64Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedUInt64Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSInt32Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSInt64Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedEnumParser( - void* object, const char* ptr, ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedInt32Parser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedUInt32Parser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedInt64Parser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedUInt64Parser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedSInt32Parser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedSInt64Parser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedEnumParser(void* object, + const char* ptr, + ParseContext* ctx); -template <typename T> -PROTOBUF_NODISCARD const char* PackedEnumParser(void* object, const char* ptr, - ParseContext* ctx, - bool (*is_valid)(int), - InternalMetadata* metadata, - int field_num) { +template <typename T, typename Validator> +[[nodiscard]] const char* PackedEnumParserArg(void* object, const char* ptr, + ParseContext* ctx, + Validator validator, + InternalMetadata* metadata, + int field_num) { return ctx->ReadPackedVarint( - ptr, [object, is_valid, metadata, field_num](int32_t val) { - if (is_valid(val)) { + ptr, [object, validator, metadata, field_num](int32_t val) { + if (validator.IsValid(val)) { static_cast<RepeatedField<int>*>(object)->Add(val); } else { WriteVarint(field_num, val, metadata->mutable_unknown_fields<T>()); @@ -1366,43 +1385,31 @@ PROTOBUF_NODISCARD const char* PackedEnumParser(void* object, const char* ptr, }); } -template <typename T> -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) { - return ctx->ReadPackedVarint( - ptr, [object, is_valid, data, metadata, field_num](int32_t val) { - if (is_valid(data, val)) { - static_cast<RepeatedField<int>*>(object)->Add(val); - } else { - WriteVarint(field_num, val, metadata->mutable_unknown_fields<T>()); - } - }); -} - -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedBoolParser( +[[nodiscard]] PROTOBUF_EXPORT const char* PackedBoolParser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedFixed32Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedFixed32Parser( +[[nodiscard]] PROTOBUF_EXPORT const char* PackedSFixed32Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSFixed32Parser( +[[nodiscard]] PROTOBUF_EXPORT const char* PackedFixed64Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedFixed64Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedSFixed64Parser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedFloatParser( - void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* PackedDoubleParser( +[[nodiscard]] PROTOBUF_EXPORT const char* PackedSFixed64Parser( void* object, const char* ptr, ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedFloatParser(void* object, + const char* ptr, + ParseContext* ctx); +[[nodiscard]] PROTOBUF_EXPORT const char* PackedDoubleParser(void* object, + const char* ptr, + ParseContext* ctx); // This is the only recursive parser. -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* UnknownGroupLiteParse( +[[nodiscard]] PROTOBUF_EXPORT const char* UnknownGroupLiteParse( std::string* 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 std::string* vs // UnknownFieldSet* to make the generated code isomorphic between full and lite. -PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* UnknownFieldParse( +[[nodiscard]] PROTOBUF_EXPORT const char* UnknownFieldParse( uint32_t tag, std::string* unknown, const char* ptr, ParseContext* ctx); } // namespace internal diff --git a/third_party/protobuf/src/google/protobuf/port.cc b/third_party/protobuf/src/google/protobuf/port.cc index 51b1c9b4208ec..af668e9e2b40e 100644 --- a/third_party/protobuf/src/google/protobuf/port.cc +++ b/third_party/protobuf/src/google/protobuf/port.cc @@ -7,14 +7,17 @@ // #include "google/protobuf/port.h" +#include <cstdint> #include <cstdio> #include <cstdlib> #include <map> #include <utility> +#include "absl/strings/numbers.h" #include "absl/strings/str_format.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" +#include "absl/types/variant.h" // Must be included last #include "google/protobuf/port_def.inc" @@ -35,7 +38,8 @@ void protobuf_assumption_failed(const char* pred, const char* file, int line) { static void PrintAllCounters(); static auto& CounterMap() { using Map = std::map<absl::string_view, - std::map<absl::string_view, const RealDebugCounter*>>; + std::map<absl::variant<int64_t, absl::string_view>, + const RealDebugCounter*>>; static auto* counter_map = new Map{}; static bool dummy = std::atexit(PrintAllCounters); (void)dummy; @@ -60,7 +64,15 @@ static void PrintAllCounters() { } for (auto& count : category.second) { size_t value = count.second->value(); - absl::FPrintF(stderr, " %-10s: %10zu", count.first, value); + if (absl::holds_alternative<int64_t>(count.first)) { + // For integers, right align + absl::FPrintF(stderr, " %9d : %10zu", + absl::get<int64_t>(count.first), value); + } else { + // For strings, left align + absl::FPrintF(stderr, " %-10s: %10zu", + absl::get<absl::string_view>(count.first), value); + } if (total != 0 && category.second.size() > 1) { absl::FPrintF( stderr, " (%5.2f%%)", @@ -77,9 +89,23 @@ static void PrintAllCounters() { void RealDebugCounter::Register(absl::string_view name) { std::pair<absl::string_view, absl::string_view> parts = absl::StrSplit(name, '.'); - CounterMap()[parts.first][parts.second] = this; + int64_t as_int; + if (absl::SimpleAtoi(parts.second, &as_int)) { + CounterMap()[parts.first][as_int] = this; + } else { + CounterMap()[parts.first][parts.second] = this; + } } +#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT const GlobalEmptyString + fixed_address_empty_string{}; +#else +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GlobalEmptyString + fixed_address_empty_string{}; +#endif + } // namespace internal } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/port.h b/third_party/protobuf/src/google/protobuf/port.h index 3a0162ca94fb2..5f9e909a00333 100644 --- a/third_party/protobuf/src/google/protobuf/port.h +++ b/third_party/protobuf/src/google/protobuf/port.h @@ -29,6 +29,10 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#if defined(ABSL_HAVE_ADDRESS_SANITIZER) +#include <sanitizer/asan_interface.h> +#endif + // must be last #include "google/protobuf/port_def.inc" @@ -43,7 +47,7 @@ namespace internal { struct MessageTraitsImpl; template <typename T> -inline PROTOBUF_ALWAYS_INLINE void StrongPointer(T* var) { +PROTOBUF_ALWAYS_INLINE void StrongPointer(T* var) { #if defined(__GNUC__) asm("" : : "r"(var)); #else @@ -57,14 +61,14 @@ inline PROTOBUF_ALWAYS_INLINE void StrongPointer(T* var) { // Optimized implementation for clang where we can generate a relocation without // adding runtime instructions. template <typename T, T ptr> -inline PROTOBUF_ALWAYS_INLINE void StrongPointer() { +PROTOBUF_ALWAYS_INLINE void StrongPointer() { // This injects a relocation in the code path without having to run code, but // we can only do it with a newer clang. asm(".reloc ., BFD_RELOC_NONE, %p0" ::"Ws"(ptr)); } template <typename T, typename TraitsImpl = MessageTraitsImpl> -inline PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() { +PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() { static constexpr auto ptr = decltype(TraitsImpl::template value<T>)::StrongPointer(); // This is identical to the implementation of StrongPointer() above, but it @@ -76,12 +80,12 @@ inline PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() { // Portable fallback. It usually generates a single LEA instruction or // equivalent. template <typename T, T ptr> -inline PROTOBUF_ALWAYS_INLINE void StrongPointer() { +PROTOBUF_ALWAYS_INLINE void StrongPointer() { StrongPointer(ptr); } template <typename T, typename TraitsImpl = MessageTraitsImpl> -inline PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() { +PROTOBUF_ALWAYS_INLINE void StrongReferenceToType() { return StrongPointer( decltype(TraitsImpl::template value<T>)::StrongPointer()); } @@ -174,14 +178,9 @@ template <typename To, typename From> void AssertDownCast(From* from) { static_assert(std::is_base_of<From, To>::value, "illegal DownCast"); -#if defined(__cpp_concepts) // Check that this function is not used to downcast message types. // For those we should use {Down,Dynamic}CastTo{Message,Generated}. - static_assert(!requires { - std::derived_from<std::remove_pointer_t<To>, - typename std::remove_pointer_t<To>::MessageLite>; - }); -#endif + static_assert(!std::is_base_of_v<MessageLite, To>); #if PROTOBUF_RTTI // RTTI: debug mode only! @@ -258,9 +257,18 @@ inline constexpr bool DebugHardenClearOneofMessageOnArena() { #endif } +constexpr bool HasAnySanitizer() { +#if defined(ABSL_HAVE_ADDRESS_SANITIZER) || \ + defined(ABSL_HAVE_MEMORY_SANITIZER) || defined(ABSL_HAVE_THREAD_SANITIZER) + return true; +#else + return false; +#endif +} + constexpr bool PerformDebugChecks() { -#if defined(NDEBUG) && !defined(PROTOBUF_ASAN) && !defined(PROTOBUF_MSAN) && \ - !defined(PROTOBUF_TSAN) + if (HasAnySanitizer()) return true; +#if defined(NDEBUG) return false; #else return true; @@ -293,6 +301,18 @@ constexpr bool DebugHardenFuzzMessageSpaceUsedLong() { return false; } +// Reads n bytes from p, if PerformDebugChecks() is true. This allows ASAN to +// detect if a range of memory is not valid when we expect it to be. The +// volatile keyword is necessary here to prevent the compiler from optimizing +// away the memory reads below. +inline void AssertBytesAreReadable(const volatile char* p, int n) { + if (PerformDebugChecks()) { + for (int i = 0; i < n; ++i) { + p[i]; + } + } +} + // Returns true if pointers are 8B aligned, leaving least significant 3 bits // available. inline constexpr bool PtrIsAtLeast8BAligned() { return alignof(void*) >= 8; } @@ -311,7 +331,7 @@ inline constexpr bool IsLazyParsingSupported() { // past the end of message/valid memory, however we are doing this // inside inline asm block, since computing the invalid pointer // is a potential UB. Only insert prefetch once per function, -inline PROTOBUF_ALWAYS_INLINE void Prefetch5LinesFrom7Lines(const void* ptr) { +PROTOBUF_ALWAYS_INLINE void Prefetch5LinesFrom7Lines(const void* ptr) { PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 448); PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 512); PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 576); @@ -320,7 +340,7 @@ inline PROTOBUF_ALWAYS_INLINE void Prefetch5LinesFrom7Lines(const void* ptr) { } // Prefetch 5 64-byte cache lines starting from 1 cache-line ahead. -inline PROTOBUF_ALWAYS_INLINE void Prefetch5LinesFrom1Line(const void* ptr) { +PROTOBUF_ALWAYS_INLINE void Prefetch5LinesFrom1Line(const void* ptr) { PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 64); PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 128); PROTOBUF_PREFETCH_WITH_OFFSET(ptr, 192); @@ -329,8 +349,7 @@ inline PROTOBUF_ALWAYS_INLINE void Prefetch5LinesFrom1Line(const void* ptr) { } #if defined(NDEBUG) && ABSL_HAVE_BUILTIN(__builtin_unreachable) -[[noreturn]] ABSL_ATTRIBUTE_COLD PROTOBUF_ALWAYS_INLINE inline void -Unreachable() { +[[noreturn]] ABSL_ATTRIBUTE_COLD PROTOBUF_ALWAYS_INLINE void Unreachable() { __builtin_unreachable(); } #elif ABSL_HAVE_BUILTIN(__builtin_FILE) && ABSL_HAVE_BUILTIN(__builtin_LINE) @@ -344,13 +363,45 @@ Unreachable() { } #endif -#ifdef PROTOBUF_TSAN +constexpr bool HasMemoryPoisoning() { +#if defined(ABSL_HAVE_ADDRESS_SANITIZER) + return true; +#else + return false; +#endif +} + +// Poison memory region when supported by sanitizer config. +inline void PoisonMemoryRegion(const void* p, size_t n) { +#if defined(ABSL_HAVE_ADDRESS_SANITIZER) + ASAN_POISON_MEMORY_REGION(p, n); +#else + // Nothing +#endif +} + +inline void UnpoisonMemoryRegion(const void* p, size_t n) { +#if defined(ABSL_HAVE_ADDRESS_SANITIZER) + ASAN_UNPOISON_MEMORY_REGION(p, n); +#else + // Nothing +#endif +} + +inline bool IsMemoryPoisoned(const void* p) { +#if defined(ABSL_HAVE_ADDRESS_SANITIZER) + return __asan_address_is_poisoned(p); +#else + return false; +#endif +} + +#if defined(ABSL_HAVE_THREAD_SANITIZER) // TODO: it would be preferable to use __tsan_external_read/ // __tsan_external_write, but they can cause dlopen issues. template <typename T> -inline PROTOBUF_ALWAYS_INLINE void TSanRead(const T* impl) { - char protobuf_tsan_dummy = - *reinterpret_cast<const char*>(&impl->_tsan_detect_race); +PROTOBUF_ALWAYS_INLINE void TSanRead(const T* impl) { + char protobuf_tsan_dummy = impl->_tsan_detect_race; asm volatile("" : "+r"(protobuf_tsan_dummy)); } @@ -358,12 +409,12 @@ inline PROTOBUF_ALWAYS_INLINE void TSanRead(const T* impl) { // member is not important. We can unconditionally write to it without affecting // correctness of the rest of the class. template <typename T> -inline PROTOBUF_ALWAYS_INLINE void TSanWrite(T* impl) { - *reinterpret_cast<char*>(&impl->_tsan_detect_race) = 0; +PROTOBUF_ALWAYS_INLINE void TSanWrite(T* impl) { + impl->_tsan_detect_race = 0; } #else -inline PROTOBUF_ALWAYS_INLINE void TSanRead(const void*) {} -inline PROTOBUF_ALWAYS_INLINE void TSanWrite(const void*) {} +PROTOBUF_ALWAYS_INLINE void TSanRead(const void*) {} +PROTOBUF_ALWAYS_INLINE void TSanWrite(const void*) {} #endif // This trampoline allows calling from codegen without needing a #include to @@ -440,6 +491,37 @@ class NoopDebugCounter { constexpr void Inc() {} }; +// Default empty string object. Don't use this directly. Instead, call +// GetEmptyString() to get the reference. This empty string is aligned with a +// minimum alignment of 8 bytes to match the requirement of ArenaStringPtr. +#if defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L +// Take advantage of C++20 constexpr support in std::string. +class alignas(8) GlobalEmptyString { + public: + const std::string& get() const { return value_; } + // Nothing to init, or destroy. + std::string* Init() const { return nullptr; } + + private: + std::string value_; +}; +PROTOBUF_EXPORT extern const GlobalEmptyString fixed_address_empty_string; +#else +class alignas(8) GlobalEmptyString { + public: + const std::string& get() const { + return *reinterpret_cast<const std::string*>(internal::Launder(buffer_)); + } + std::string* Init() { + return ::new (static_cast<void*>(buffer_)) std::string(); + } + + private: + alignas(std::string) char buffer_[sizeof(std::string)]; +}; +PROTOBUF_EXPORT extern GlobalEmptyString fixed_address_empty_string; +#endif + } // namespace internal } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/port_def.inc b/third_party/protobuf/src/google/protobuf/port_def.inc index 999032346b18a..6420abec69341 100644 --- a/third_party/protobuf/src/google/protobuf/port_def.inc +++ b/third_party/protobuf/src/google/protobuf/port_def.inc @@ -116,7 +116,8 @@ static_assert(PROTOBUF_GNUC_MIN(7, 3), "Protobuf only supports GCC 7.3 and newer #elif defined(_MSVC_LANG) static_assert(PROTOBUF_MSC_VER_MIN(1910), "Protobuf only supports MSVC 2017 and newer."); #endif -static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer."); +static_assert(PROTOBUF_CPLUSPLUS_MIN(201703L), + "Protobuf only supports C++17 and newer."); // Check minimum Abseil version. #if defined(ABSL_LTS_RELEASE_VERSION) && defined(ABSL_LTS_RELEASE_PATCH_LEVEL) @@ -143,10 +144,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // Owner: shaod@, gberg@ #define PROTOBUF_FUTURE_DESCRIPTOR_EXTENSION_DECL 1 -// Removes Arena::CreateMessage, as Arena::Create is equivalent -// Owner: ckennelly@, mkruskal@ -#define PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE 1 - // Renames DescriptorPool::AddUnusedImportTrackFile // Owner: mkruskal@ #define PROTOBUF_FUTURE_RENAME_ADD_UNUSED_IMPORT 1 @@ -156,22 +153,20 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #ifdef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE #error PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE was previously defined #endif -#if defined(PROTOBUF_TEMPORARY_ENABLE_STRING_VIEW_RETURN_TYPE) #define PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE 1 -#endif #ifdef PROTOBUF_ALWAYS_INLINE #error PROTOBUF_ALWAYS_INLINE was previously defined #endif // For functions we want to force inline. #if defined(PROTOBUF_NO_INLINE) -# define PROTOBUF_ALWAYS_INLINE +#define PROTOBUF_ALWAYS_INLINE inline #elif defined(__GNUC__) -# define PROTOBUF_ALWAYS_INLINE __attribute__((always_inline)) +#define PROTOBUF_ALWAYS_INLINE inline __attribute__((always_inline)) #elif defined(_MSC_VER) -# define PROTOBUF_ALWAYS_INLINE __forceinline +#define PROTOBUF_ALWAYS_INLINE inline __forceinline #else -# define PROTOBUF_ALWAYS_INLINE +#define PROTOBUF_ALWAYS_INLINE inline #endif #ifdef PROTOBUF_ALWAYS_INLINE_CALL @@ -199,7 +194,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #if defined(NDEBUG) || (defined(_MSC_VER) && !defined(_DEBUG)) # define PROTOBUF_NDEBUG_INLINE PROTOBUF_ALWAYS_INLINE #else -# define PROTOBUF_NDEBUG_INLINE +#define PROTOBUF_NDEBUG_INLINE inline #endif // Note that PROTOBUF_NOINLINE is an attribute applied to functions, to prevent @@ -369,28 +364,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), # define PROTOC_EXPORT #endif -#if defined(PROTOBUF_PREDICT_TRUE) || defined(PROTOBUF_PREDICT_FALSE) -#error PROTOBUF_PREDICT_(TRUE|FALSE) was previously defined -#endif -#if defined(__GNUC__) -# define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(false || (x), true)) -# define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect(false || (x), false)) -#else -# define PROTOBUF_PREDICT_TRUE(x) (x) -# define PROTOBUF_PREDICT_FALSE(x) (x) -#endif - -#ifdef PROTOBUF_NODISCARD -#error PROTOBUF_NODISCARD was previously defined -#endif -#if ABSL_HAVE_CPP_ATTRIBUTE(nodiscard) && PROTOBUF_CPLUSPLUS_MIN(201703L) -#define PROTOBUF_NODISCARD [[nodiscard]] -#elif ABSL_HAVE_ATTRIBUTE(warn_unused_result) || defined(__GNUC__) -#define PROTOBUF_NODISCARD __attribute__((warn_unused_result)) -#else -#define PROTOBUF_NODISCARD -#endif - #ifdef PROTOBUF_RESTRICT #error PROTOBUF_RESTRICT was previously defined #endif @@ -540,56 +513,9 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #define PROTOBUF_HAVE_ATTRIBUTE_WEAK 0 #endif -// Macros to detect sanitizers. -#ifdef PROTOBUF_ASAN -#error PROTOBUF_ASAN was previously defined -#endif -#ifdef PROTOBUF_MSAN -#error PROTOBUF_MSAN was previously defined -#endif -#ifdef PROTOBUF_TSAN -#error PROTOBUF_TSAN was previously defined -#endif -#if defined(__clang__) -#if ABSL_HAVE_FEATURE(address_sanitizer) -# define PROTOBUF_ASAN 1 -# endif -#if ABSL_HAVE_FEATURE(thread_sanitizer) -# define PROTOBUF_TSAN 1 -# endif -#if ABSL_HAVE_FEATURE(memory_sanitizer) -# define PROTOBUF_MSAN 1 -# endif -#elif defined(__GNUC__) -// 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 -# ifdef __SANITIZE_MEMORY__ -# if __SANITIZE_MEMORY__ -# define PROTOBUF_ASAN 1 -# endif -# endif -#endif - -#ifdef PROTOBUF_ASAN -#include <sanitizer/asan_interface.h> -#define PROTOBUF_POISON_MEMORY_REGION(p, n) ASAN_POISON_MEMORY_REGION(p, n) -#define PROTOBUF_UNPOISON_MEMORY_REGION(p, n) ASAN_UNPOISON_MEMORY_REGION(p, n) -#else // PROTOBUF_ASAN -#define PROTOBUF_POISON_MEMORY_REGION(p, n) -#define PROTOBUF_UNPOISON_MEMORY_REGION(p, n) -#endif // PROTOBUF_ASAN - -#ifdef PROTOBUF_TSAN -#define PROTOBUF_TSAN_DECLARE_MEMBER ::uint32_t _tsan_detect_race = 0; +// Variable used to inject artificial language races to detect API level races. +#if defined(ABSL_HAVE_THREAD_SANITIZER) +#define PROTOBUF_TSAN_DECLARE_MEMBER char _tsan_detect_race = 0; #else #define PROTOBUF_TSAN_DECLARE_MEMBER #endif @@ -624,18 +550,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #define PROTOBUF_TC_PARAM_NO_DATA_PASS \ msg, ptr, ctx, ::google::protobuf::internal::TcFieldData::DefaultInit(), table, hasbits -#ifdef PROTOBUF_UNUSED -#error PROTOBUF_UNUSED was previously defined -#endif -#if ABSL_HAVE_CPP_ATTRIBUTE(maybe_unused) || \ - (PROTOBUF_MSC_VER_MIN(1911) && PROTOBUF_CPLUSPLUS_MIN(201703L)) -#define PROTOBUF_UNUSED [[maybe_unused]] -#elif ABSL_HAVE_ATTRIBUTE(unused) || defined(__GNUC__) -#define PROTOBUF_UNUSED __attribute__((__unused__)) -#else -#define PROTOBUF_UNUSED -#endif - // For the toolchains that support it, evaluates to `true` if the input is // determined to be a compile time constant after optimizations have happened // (like inlining and constant propagation). A `false` result means that the @@ -684,6 +598,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // ThreadSafeArenaz is turned off completely in opensource builds. + // noreturn is defined as a macro in C's stdnoreturn.h #ifdef noreturn #define PROTOBUF_DID_UNDEF_noreturn @@ -719,6 +634,13 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #define PROTOBUF_DID_UNDEF_LINUX #endif +// netdb.h defines this on some platforms. +#ifdef NO_DATA +#pragma push_macro("NO_DATA") +#undef NO_DATA +#define PROTOBUF_DID_UNDEF_NO_DATA +#endif + // Windows declares several inconvenient macro names. We #undef them and then // restore them in port_undef.inc. #ifdef _WIN32 @@ -854,6 +776,8 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // for (int i = 0; i < public_dep->message_type_count(); ++i) #pragma clang diagnostic ignored "-Wshadow" #pragma clang diagnostic ignored "-Wextra-semi" +// Ensure we don't regress nullability annotations (related: b/383569842) +#pragma clang diagnostic error "-Wnullability-completeness" #endif #ifdef __GNUC__ #pragma GCC diagnostic push @@ -870,6 +794,12 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // captured `this`. // https://bugzilla.mozilla.org/show_bug.cgi?id=1373625 #pragma GCC diagnostic ignored "-Wunused-lambda-capture" +// GCC complains when attributes are specified on anything other than the first +// declaration for enums, even if they all specify the same set. +// Eg this would trigger the warning: +// enum [[deprecated]] foo : int; +// enum [[deprecated]] foo : int; +#pragma GCC diagnostic ignored "-Wattributes" // -Wsign-conversion causes a lot of warnings on mostly code like: // int index = ... // int value = vec[index]; @@ -914,7 +844,8 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #pragma warning(disable: 4125) #endif -#if PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII +#if defined(PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII) && \ + PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII #define PROTOBUF_DEBUG true #else #define PROTOBUF_DEBUG false @@ -967,6 +898,20 @@ namespace internal { #endif // !NDEBUG #endif // has_builtin(__builtin_assume) +// PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY(expr, prob) tells the compiler that +// the expression expr is likely to be true with probability prob. This is +// helpful for the compiler to make better optimization decisions when we know +// the probability of a certain branch (e.g. from a profile). +#ifdef PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY +#error PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY was previously defined +#endif +#if ABSL_HAVE_BUILTIN(__builtin_expect_with_probability) +#define PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY(expr, prob) \ + __builtin_expect_with_probability((expr), 1, (prob)) +#else +#define PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY(expr, prob) (expr) +#endif + #ifdef PROTOBUF_DEPRECATE_AND_INLINE #error PROTOBUF_DEPRECATE_AND_INLINE was previously defined #endif @@ -976,6 +921,13 @@ namespace internal { #define PROTOBUF_DEPRECATE_AND_INLINE() [[deprecated]] #endif +#ifdef PROTOBUF_NONNULL +#error PROTOBUF_NONNULL was previously defined +#endif +#ifndef PROTOBUF_NONNULL +#define PROTOBUF_NONNULL +#define PROTOBUF_NULLABLE +#endif namespace google { namespace protobuf { diff --git a/third_party/protobuf/src/google/protobuf/port_test.cc b/third_party/protobuf/src/google/protobuf/port_test.cc index 879408b22bd6f..8968623da5747 100644 --- a/third_party/protobuf/src/google/protobuf/port_test.cc +++ b/third_party/protobuf/src/google/protobuf/port_test.cc @@ -25,10 +25,17 @@ int assume_var_for_test = 1; TEST(PortTest, ProtobufAssume) { PROTOBUF_ASSUME(assume_var_for_test == 1); #ifdef GTEST_HAS_DEATH_TEST +#if defined(NDEBUG) + // If NDEBUG is defined, then instead of reliably crashing, the code below + // will assume a false statement. This is undefined behavior which will trip + // up sanitizers. + GTEST_SKIP() << "Can't test PROTOBUF_ASSUME()"; +#else EXPECT_DEBUG_DEATH( PROTOBUF_ASSUME(assume_var_for_test == 2), "port_test\\.cc:.*Assumption failed: 'assume_var_for_test == 2'"); #endif +#endif } TEST(PortTest, UnreachableTrapsOnDebugMode) { diff --git a/third_party/protobuf/src/google/protobuf/port_undef.inc b/third_party/protobuf/src/google/protobuf/port_undef.inc index fa6de4dccd008..f94321f015822 100644 --- a/third_party/protobuf/src/google/protobuf/port_undef.inc +++ b/third_party/protobuf/src/google/protobuf/port_undef.inc @@ -14,8 +14,6 @@ #endif #undef PROTOBUF_PORT_ -#undef PROTOBUF_POISON_MEMORY_REGION -#undef PROTOBUF_UNPOISON_MEMORY_REGION #undef PROTOBUF_BUILTIN_ATOMIC #undef PROTOBUF_GNUC_MIN #undef PROTOBUF_CLANG_MIN @@ -33,14 +31,12 @@ #undef PROTOBUF_IGNORE_DEPRECATION_STOP #undef PROTOBUF_RTTI #undef PROTOBUF_FIELD_OFFSET -#undef PROTOBUF_PREDICT_TRUE -#undef PROTOBUF_PREDICT_FALSE #undef PROTOBUF_EXPORT #undef PROTOC_EXPORT -#undef PROTOBUF_NODISCARD #undef PROTOBUF_RESTRICT #undef PROTOBUF_UNUSED #undef PROTOBUF_ASSUME +#undef PROTOBUF_EXPECT_TRUE_WITH_PROBABILITY #undef PROTOBUF_DEPRECATE_AND_INLINE #undef PROTOBUF_EXPORT_TEMPLATE_DECLARE #undef PROTOBUF_EXPORT_TEMPLATE_DEFINE @@ -56,9 +52,6 @@ #undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 #undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 #undef PROTOBUF_PRAGMA_INIT_SEG -#undef PROTOBUF_ASAN -#undef PROTOBUF_MSAN -#undef PROTOBUF_TSAN #undef PROTOBUF_TSAN_DECLARE_MEMBER #undef PROTOBUF_BUILTIN_CONSTANT_P #undef PROTOBUF_CUSTOM_VTABLE @@ -72,14 +65,18 @@ #undef PROTOBUF_TC_PARAM_DECL #undef PROTOBUF_DEBUG #undef PROTOBUF_NO_THREADLOCAL +#undef PROTOBUF_NONNULL +#undef PROTOBUF_NULLABLE #ifdef PROTOBUF_FUTURE_BREAKING_CHANGES #undef PROTOBUF_FUTURE_BREAKING_CHANGES #undef PROTOBUF_FUTURE_DESCRIPTOR_EXTENSION_DECL -#undef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE #undef PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE #endif +#undef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE +#undef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE_TYPENAME + // Restore macros that may have been #undef'd in port_def.inc. #ifdef PROTOBUF_DID_UNDEF_noreturn @@ -106,6 +103,11 @@ #pragma pop_macro("linux") #endif +#ifdef PROTOBUF_DID_UNDEF_NO_DATA +#pragma pop_macro("NO_DATA") +#undef PROTOBUF_DID_UNDEF_NO_DATA +#endif + #ifdef _WIN32 #pragma pop_macro("CompareString") #pragma pop_macro("CREATE_NEW") diff --git a/third_party/protobuf/src/google/protobuf/preserve_unknown_enum_test.cc b/third_party/protobuf/src/google/protobuf/preserve_unknown_enum_test.cc index 51b6876fb30b7..b58371bf33e27 100644 --- a/third_party/protobuf/src/google/protobuf/preserve_unknown_enum_test.cc +++ b/third_party/protobuf/src/google/protobuf/preserve_unknown_enum_test.cc @@ -213,7 +213,7 @@ TEST(PreserveUnknownEnumTest, IntegerEnumReflectionAPI) { // Test that the EnumValue API works properly for proto2 messages as well. TEST(PreserveUnknownEnumTest, Proto2CatchesUnknownValues) { - protobuf_unittest::TestAllTypes message; // proto2 message + proto2_unittest::TestAllTypes message; // proto2 message const Reflection* r = message.GetReflection(); const Descriptor* d = message.GetDescriptor(); const FieldDescriptor* repeated_field = @@ -231,11 +231,11 @@ TEST(PreserveUnknownEnumTest, Proto2CatchesUnknownValues) { // unknown fields. r->SetEnumValue(&message, singular_field, 4242); EXPECT_EQ(r->GetEnum(message, singular_field)->number(), - protobuf_unittest::TestAllTypes::FOO); + proto2_unittest::TestAllTypes::FOO); r->SetRepeatedEnumValue(&message, repeated_field, 0, 4242); // repeated_nested_enum was set to bar above, this should not have changed. EXPECT_EQ(r->GetRepeatedEnum(message, repeated_field, 0)->number(), - protobuf_unittest::TestAllTypes::BAR); + proto2_unittest::TestAllTypes::BAR); r->AddEnumValue(&message, repeated_field, 4242); // No element should be added EXPECT_EQ(message.repeated_nested_enum_size(), 1); diff --git a/third_party/protobuf/src/google/protobuf/proto3_arena_unittest.cc b/third_party/protobuf/src/google/protobuf/proto3_arena_unittest.cc index 1c56ebee4014c..af43563d721a4 100644 --- a/third_party/protobuf/src/google/protobuf/proto3_arena_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/proto3_arena_unittest.cc @@ -243,7 +243,7 @@ TEST(Proto3ArenaTest, MessageFieldClearViaReflection) { } TEST(Proto3OptionalTest, OptionalFields) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; EXPECT_FALSE(msg.has_optional_int32()); msg.set_optional_int32(0); EXPECT_TRUE(msg.has_optional_int32()); @@ -287,17 +287,17 @@ TEST(Proto3ArenaTest, CheckOneofMessageFieldIsCleared) { child->set_bb(100); msg->Clear(); -#ifndef PROTOBUF_ASAN - EXPECT_EQ(child->bb(), 0); -#else -#if GTEST_HAS_DEATH_TEST && defined(__cpp_if_constexpr) - EXPECT_DEATH(EXPECT_EQ(child->bb(), 100), "use-after-poison"); -#endif -#endif + if (internal::HasMemoryPoisoning()) { +#if GTEST_HAS_DEATH_TEST + EXPECT_DEATH(EXPECT_EQ(child->bb(), 100), "use-after-poison"); +#endif // !GTEST_HAS_DEATH_TEST + } else { + EXPECT_EQ(child->bb(), 0); + } } TEST(Proto3OptionalTest, OptionalFieldDescriptor) { - const Descriptor* d = protobuf_unittest::TestProto3Optional::descriptor(); + const Descriptor* d = proto2_unittest::TestProto3Optional::descriptor(); for (int i = 0; i < d->field_count(); i++) { const FieldDescriptor* f = d->field(i); @@ -316,32 +316,32 @@ TEST(Proto3OptionalTest, OptionalFieldDescriptor) { TEST(Proto3OptionalTest, Extensions) { const DescriptorPool* p = DescriptorPool::generated_pool(); const FieldDescriptor* no_optional = p->FindExtensionByName( - "protobuf_unittest.Proto3OptionalExtensions.ext_no_optional"); + "proto2_unittest.Proto3OptionalExtensions.ext_no_optional"); const FieldDescriptor* with_optional = p->FindExtensionByName( - "protobuf_unittest.Proto3OptionalExtensions.ext_with_optional"); + "proto2_unittest.Proto3OptionalExtensions.ext_with_optional"); ABSL_CHECK(no_optional); ABSL_CHECK(with_optional); - const Descriptor* d = protobuf_unittest::Proto3OptionalExtensions::descriptor(); + const Descriptor* d = proto2_unittest::Proto3OptionalExtensions::descriptor(); EXPECT_TRUE(d->options().HasExtension( - protobuf_unittest::Proto3OptionalExtensions::ext_no_optional)); + proto2_unittest::Proto3OptionalExtensions::ext_no_optional)); EXPECT_TRUE(d->options().HasExtension( - protobuf_unittest::Proto3OptionalExtensions::ext_with_optional)); + proto2_unittest::Proto3OptionalExtensions::ext_with_optional)); EXPECT_EQ(8, d->options().GetExtension( - protobuf_unittest::Proto3OptionalExtensions::ext_no_optional)); + proto2_unittest::Proto3OptionalExtensions::ext_no_optional)); EXPECT_EQ(16, d->options().GetExtension( - protobuf_unittest::Proto3OptionalExtensions::ext_with_optional)); + proto2_unittest::Proto3OptionalExtensions::ext_with_optional)); - const Descriptor* d2 = protobuf_unittest::TestProto3Optional::descriptor(); + const Descriptor* d2 = proto2_unittest::TestProto3Optional::descriptor(); EXPECT_FALSE(d2->options().HasExtension( - protobuf_unittest::Proto3OptionalExtensions::ext_no_optional)); + proto2_unittest::Proto3OptionalExtensions::ext_no_optional)); EXPECT_FALSE(d2->options().HasExtension( - protobuf_unittest::Proto3OptionalExtensions::ext_with_optional)); + proto2_unittest::Proto3OptionalExtensions::ext_with_optional)); } TEST(Proto3OptionalTest, OptionalField) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; EXPECT_FALSE(msg.has_optional_int32()); msg.set_optional_int32(0); EXPECT_TRUE(msg.has_optional_int32()); @@ -361,7 +361,7 @@ TEST(Proto3OptionalTest, OptionalFieldReflection) { // // We test this more deeply elsewhere by parsing/serializing TextFormat (which // doesn't treat synthetic oneofs specially, so reflects over them normally). - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; const google::protobuf::Descriptor* d = msg.GetDescriptor(); const google::protobuf::Reflection* r = msg.GetReflection(); const google::protobuf::FieldDescriptor* f = d->FindFieldByName("optional_int32"); @@ -406,7 +406,7 @@ TEST(Proto3OptionalTest, OptionalFieldReflection) { // It's a regression test for b/160665543. TEST(Proto3OptionalTest, ClearNonOptionalMessageField) { - protobuf_unittest::TestProto3OptionalMessage msg; + proto2_unittest::TestProto3OptionalMessage msg; msg.mutable_nested_message(); const google::protobuf::Descriptor* d = msg.GetDescriptor(); const google::protobuf::Reflection* r = msg.GetReflection(); @@ -415,7 +415,7 @@ TEST(Proto3OptionalTest, ClearNonOptionalMessageField) { } TEST(Proto3OptionalTest, ClearOptionalMessageField) { - protobuf_unittest::TestProto3OptionalMessage msg; + proto2_unittest::TestProto3OptionalMessage msg; msg.mutable_optional_nested_message(); const google::protobuf::Descriptor* d = msg.GetDescriptor(); const google::protobuf::Reflection* r = msg.GetReflection(); @@ -425,8 +425,8 @@ TEST(Proto3OptionalTest, ClearOptionalMessageField) { } TEST(Proto3OptionalTest, SwapNonOptionalMessageField) { - protobuf_unittest::TestProto3OptionalMessage msg1; - protobuf_unittest::TestProto3OptionalMessage msg2; + proto2_unittest::TestProto3OptionalMessage msg1; + proto2_unittest::TestProto3OptionalMessage msg2; msg1.mutable_nested_message(); const google::protobuf::Descriptor* d = msg1.GetDescriptor(); const google::protobuf::Reflection* r = msg1.GetReflection(); @@ -435,8 +435,8 @@ TEST(Proto3OptionalTest, SwapNonOptionalMessageField) { } TEST(Proto3OptionalTest, SwapOptionalMessageField) { - protobuf_unittest::TestProto3OptionalMessage msg1; - protobuf_unittest::TestProto3OptionalMessage msg2; + proto2_unittest::TestProto3OptionalMessage msg1; + proto2_unittest::TestProto3OptionalMessage msg2; msg1.mutable_optional_nested_message(); const google::protobuf::Descriptor* d = msg1.GetDescriptor(); const google::protobuf::Reflection* r = msg1.GetReflection(); @@ -445,7 +445,7 @@ TEST(Proto3OptionalTest, SwapOptionalMessageField) { r->SwapFields(&msg1, &msg2, {f}); } -void SetAllFieldsZero(protobuf_unittest::TestProto3Optional* msg) { +void SetAllFieldsZero(proto2_unittest::TestProto3Optional* msg) { msg->set_optional_int32(0); msg->set_optional_int64(0); msg->set_optional_uint32(0); @@ -464,10 +464,10 @@ void SetAllFieldsZero(protobuf_unittest::TestProto3Optional* msg) { msg->mutable_optional_nested_message(); msg->mutable_lazy_nested_message(); msg->set_optional_nested_enum( - protobuf_unittest::TestProto3Optional::UNSPECIFIED); + proto2_unittest::TestProto3Optional::UNSPECIFIED); } -void SetAllFieldsNonZero(protobuf_unittest::TestProto3Optional* msg) { +void SetAllFieldsNonZero(proto2_unittest::TestProto3Optional* msg) { msg->set_optional_int32(101); msg->set_optional_int64(102); msg->set_optional_uint32(103); @@ -485,10 +485,10 @@ void SetAllFieldsNonZero(protobuf_unittest::TestProto3Optional* msg) { msg->set_optional_bytes("def"); msg->mutable_optional_nested_message(); msg->mutable_lazy_nested_message(); - msg->set_optional_nested_enum(protobuf_unittest::TestProto3Optional::BAZ); + msg->set_optional_nested_enum(proto2_unittest::TestProto3Optional::BAZ); } -void TestAllFieldsZero(const protobuf_unittest::TestProto3Optional& msg) { +void TestAllFieldsZero(const proto2_unittest::TestProto3Optional& msg) { EXPECT_EQ(0, msg.optional_int32()); EXPECT_EQ(0, msg.optional_int64()); EXPECT_EQ(0, msg.optional_uint32()); @@ -504,7 +504,7 @@ void TestAllFieldsZero(const protobuf_unittest::TestProto3Optional& msg) { EXPECT_EQ(0, msg.optional_bool()); EXPECT_EQ("", msg.optional_string()); EXPECT_EQ("", msg.optional_bytes()); - EXPECT_EQ(protobuf_unittest::TestProto3Optional::UNSPECIFIED, + EXPECT_EQ(proto2_unittest::TestProto3Optional::UNSPECIFIED, msg.optional_nested_enum()); const Reflection* r = msg.GetReflection(); @@ -512,7 +512,7 @@ void TestAllFieldsZero(const protobuf_unittest::TestProto3Optional& msg) { EXPECT_EQ("", r->GetString(msg, d->FindFieldByName("optional_string"))); } -void TestAllFieldsNonZero(const protobuf_unittest::TestProto3Optional& msg) { +void TestAllFieldsNonZero(const proto2_unittest::TestProto3Optional& msg) { EXPECT_EQ(101, msg.optional_int32()); EXPECT_EQ(102, msg.optional_int64()); EXPECT_EQ(103, msg.optional_uint32()); @@ -528,11 +528,11 @@ void TestAllFieldsNonZero(const protobuf_unittest::TestProto3Optional& msg) { EXPECT_EQ(true, msg.optional_bool()); EXPECT_EQ("abc", msg.optional_string()); EXPECT_EQ("def", msg.optional_bytes()); - EXPECT_EQ(protobuf_unittest::TestProto3Optional::BAZ, + EXPECT_EQ(proto2_unittest::TestProto3Optional::BAZ, msg.optional_nested_enum()); } -void TestAllFieldsSet(const protobuf_unittest::TestProto3Optional& msg, +void TestAllFieldsSet(const proto2_unittest::TestProto3Optional& msg, bool set) { EXPECT_EQ(set, msg.has_optional_int32()); EXPECT_EQ(set, msg.has_optional_int64()); @@ -555,13 +555,13 @@ void TestAllFieldsSet(const protobuf_unittest::TestProto3Optional& msg, } TEST(Proto3OptionalTest, BinaryRoundTrip) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; TestAllFieldsSet(msg, false); SetAllFieldsZero(&msg); TestAllFieldsZero(msg); TestAllFieldsSet(msg, true); - protobuf_unittest::TestProto3Optional msg2; + proto2_unittest::TestProto3Optional msg2; std::string serialized; msg.SerializeToString(&serialized); EXPECT_TRUE(msg2.ParseFromString(serialized)); @@ -570,10 +570,10 @@ TEST(Proto3OptionalTest, BinaryRoundTrip) { } TEST(Proto3OptionalTest, TextFormatRoundTripZeros) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; SetAllFieldsZero(&msg); - protobuf_unittest::TestProto3Optional msg2; + proto2_unittest::TestProto3Optional msg2; std::string text; EXPECT_TRUE(TextFormat::PrintToString(msg, &text)); EXPECT_TRUE(TextFormat::ParseFromString(text, &msg2)); @@ -582,10 +582,10 @@ TEST(Proto3OptionalTest, TextFormatRoundTripZeros) { } TEST(Proto3OptionalTest, TextFormatRoundTripNonZeros) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; SetAllFieldsNonZero(&msg); - protobuf_unittest::TestProto3Optional msg2; + proto2_unittest::TestProto3Optional msg2; std::string text; EXPECT_TRUE(TextFormat::PrintToString(msg, &text)); EXPECT_TRUE(TextFormat::ParseFromString(text, &msg2)); @@ -594,33 +594,33 @@ TEST(Proto3OptionalTest, TextFormatRoundTripNonZeros) { } TEST(Proto3OptionalTest, SwapRoundTripZero) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; SetAllFieldsZero(&msg); TestAllFieldsSet(msg, true); - protobuf_unittest::TestProto3Optional msg2; + proto2_unittest::TestProto3Optional msg2; msg.Swap(&msg2); TestAllFieldsSet(msg2, true); TestAllFieldsZero(msg2); } TEST(Proto3OptionalTest, SwapRoundTripNonZero) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; SetAllFieldsNonZero(&msg); TestAllFieldsSet(msg, true); - protobuf_unittest::TestProto3Optional msg2; + proto2_unittest::TestProto3Optional msg2; msg.Swap(&msg2); TestAllFieldsSet(msg2, true); TestAllFieldsNonZero(msg2); } TEST(Proto3OptionalTest, ReflectiveSwapRoundTrip) { - protobuf_unittest::TestProto3Optional msg; + proto2_unittest::TestProto3Optional msg; SetAllFieldsZero(&msg); TestAllFieldsSet(msg, true); - protobuf_unittest::TestProto3Optional msg2; + proto2_unittest::TestProto3Optional msg2; msg2.GetReflection()->Swap(&msg, &msg2); TestAllFieldsSet(msg2, true); TestAllFieldsZero(msg2); diff --git a/third_party/protobuf/src/google/protobuf/redaction_metric_test.cc b/third_party/protobuf/src/google/protobuf/redaction_metric_test.cc index b0d7bcd1fa3c7..8e6df988cbaa1 100644 --- a/third_party/protobuf/src/google/protobuf/redaction_metric_test.cc +++ b/third_party/protobuf/src/google/protobuf/redaction_metric_test.cc @@ -27,7 +27,7 @@ using ::testing::HasSubstr; TEST(TextFormatParsingMetricsTest, MetricsTest) { std::string value_replacement = "[REDACTED]"; - protobuf_unittest::RedactedFields proto; + proto2_unittest::RedactedFields proto; proto.set_optional_redacted_string("foo"); int64_t before = internal::GetRedactedFieldCount(); EXPECT_THAT(absl::StrCat(proto), HasSubstr(value_replacement)); diff --git a/third_party/protobuf/src/google/protobuf/reflection.h b/third_party/protobuf/src/google/protobuf/reflection.h index b493fcc738ac7..d8aa64e9456b6 100644 --- a/third_party/protobuf/src/google/protobuf/reflection.h +++ b/third_party/protobuf/src/google/protobuf/reflection.h @@ -13,6 +13,7 @@ #include <memory> #include <type_traits> +#include "absl/base/attributes.h" #include "google/protobuf/generated_enum_util.h" #include "google/protobuf/descriptor.h" @@ -96,7 +97,6 @@ class MutableRepeatedFieldRef< } void Add(const T& value) const { accessor_->template Add<T>(data_, value); } void RemoveLast() const { accessor_->RemoveLast(data_); } - void Reserve(int size) const { accessor_->Reserve(data_, size); } void SwapElements(int index1, int index2) const { accessor_->SwapElements(data_, index1, index2); } @@ -215,7 +215,6 @@ class MutableRepeatedFieldRef< } void Add(const T& value) const { accessor_->Add(data_, &value); } void RemoveLast() const { accessor_->RemoveLast(data_); } - void Reserve(int size) const { accessor_->Reserve(data_, size); } void SwapElements(int index1, int index2) const { accessor_->SwapElements(data_, index1, index2); } @@ -303,7 +302,6 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor { virtual void Set(Field* data, int index, const Value* value) const = 0; virtual void Add(Field* data, const Value* value) const = 0; virtual void RemoveLast(Field* data) const = 0; - virtual void Reserve(Field* data, int size) const = 0; virtual void SwapElements(Field* data, int index1, int index2) const = 0; virtual void Swap(Field* data, const RepeatedFieldAccessor* other_mutator, Field* other_data) const = 0; diff --git a/third_party/protobuf/src/google/protobuf/reflection_internal.h b/third_party/protobuf/src/google/protobuf/reflection_internal.h index ea4bac293a185..062d64f92c1da 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_internal.h +++ b/third_party/protobuf/src/google/protobuf/reflection_internal.h @@ -8,14 +8,20 @@ #ifndef GOOGLE_PROTOBUF_REFLECTION_INTERNAL_H__ #define GOOGLE_PROTOBUF_REFLECTION_INTERNAL_H__ +#include <cstdint> +#include <string> + +#include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include "google/protobuf/map_field.h" #include "google/protobuf/reflection.h" #include "google/protobuf/repeated_field.h" +#include "google/protobuf/repeated_ptr_field.h" namespace google { namespace protobuf { namespace internal { + // A base class for RepeatedFieldAccessor implementations that can support // random-access efficiently. All iterator methods delegates the work to // corresponding random-access methods. @@ -64,7 +70,7 @@ class RandomAccessRepeatedFieldAccessor : public RepeatedFieldAccessor { template <typename T> class RepeatedFieldWrapper : public RandomAccessRepeatedFieldAccessor { public: - RepeatedFieldWrapper() {} + RepeatedFieldWrapper() = default; bool IsEmpty(const Field* data) const override { return GetRepeatedField(data)->empty(); } @@ -87,20 +93,21 @@ class RepeatedFieldWrapper : public RandomAccessRepeatedFieldAccessor { void RemoveLast(Field* data) const override { MutableRepeatedField(data)->RemoveLast(); } - void Reserve(Field* data, int size) const override { - MutableRepeatedField(data)->Reserve(size); - } void SwapElements(Field* data, int index1, int index2) const override { MutableRepeatedField(data)->SwapElements(index1, index2); } protected: + // Type synonyms that subclasses can use. + using Type = T; + using RepeatedFieldType = RepeatedField<T>; + ~RepeatedFieldWrapper() = default; - typedef RepeatedField<T> RepeatedFieldType; - static const RepeatedFieldType* GetRepeatedField(const Field* data) { + + virtual const RepeatedFieldType* GetRepeatedField(const Field* data) const { return reinterpret_cast<const RepeatedFieldType*>(data); } - static RepeatedFieldType* MutableRepeatedField(Field* data) { + virtual RepeatedFieldType* MutableRepeatedField(Field* data) const { return reinterpret_cast<RepeatedFieldType*>(data); } @@ -146,20 +153,21 @@ class RepeatedPtrFieldWrapper : public RandomAccessRepeatedFieldAccessor { void RemoveLast(Field* data) const override { MutableRepeatedField(data)->RemoveLast(); } - void Reserve(Field* data, int size) const override { - MutableRepeatedField(data)->Reserve(size); - } void SwapElements(Field* data, int index1, int index2) const override { MutableRepeatedField(data)->SwapElements(index1, index2); } protected: + // Typedefs that subclasses can use. + using Type = T; + using RepeatedFieldType = RepeatedPtrField<T>; + ~RepeatedPtrFieldWrapper() = default; - typedef RepeatedPtrField<T> RepeatedFieldType; - static const RepeatedFieldType* GetRepeatedField(const Field* data) { + + virtual const RepeatedFieldType* GetRepeatedField(const Field* data) const { return reinterpret_cast<const RepeatedFieldType*>(data); } - static RepeatedFieldType* MutableRepeatedField(Field* data) { + virtual RepeatedFieldType* MutableRepeatedField(Field* data) const { return reinterpret_cast<RepeatedFieldType*>(data); } @@ -182,83 +190,16 @@ class RepeatedPtrFieldWrapper : public RandomAccessRepeatedFieldAccessor { Value* scratch_space) const = 0; }; -// An implementation of RandomAccessRepeatedFieldAccessor that manipulates -// MapFieldBase. -class MapFieldAccessor final : public RandomAccessRepeatedFieldAccessor { - public: - MapFieldAccessor() {} - virtual ~MapFieldAccessor() {} - bool IsEmpty(const Field* data) const override { - return GetRepeatedField(data)->empty(); - } - int Size(const Field* data) const override { - return GetRepeatedField(data)->size(); - } - const Value* Get(const Field* data, int index, - Value* scratch_space) const override { - return ConvertFromEntry(GetRepeatedField(data)->Get(index), scratch_space); - } - void Clear(Field* data) const override { - MutableRepeatedField(data)->Clear(); - } - void Set(Field* data, int index, const Value* value) const override { - ConvertToEntry(value, MutableRepeatedField(data)->Mutable(index)); - } - void Add(Field* data, const Value* value) const override { - Message* allocated = New(value); - ConvertToEntry(value, allocated); - MutableRepeatedField(data)->AddAllocated(allocated); - } - void RemoveLast(Field* data) const override { - MutableRepeatedField(data)->RemoveLast(); - } - void Reserve(Field* data, int size) const override { - MutableRepeatedField(data)->Reserve(size); - } - void SwapElements(Field* data, int index1, int index2) const override { - MutableRepeatedField(data)->SwapElements(index1, index2); - } - void Swap(Field* data, const internal::RepeatedFieldAccessor* other_mutator, - Field* other_data) const override { - ABSL_CHECK(this == other_mutator); - MutableRepeatedField(data)->Swap(MutableRepeatedField(other_data)); - } - - protected: - typedef RepeatedPtrField<Message> RepeatedFieldType; - static const RepeatedFieldType* GetRepeatedField(const Field* data) { - return reinterpret_cast<const RepeatedFieldType*>( - (&reinterpret_cast<const MapFieldBase*>(data)->GetRepeatedField())); - } - static RepeatedFieldType* MutableRepeatedField(Field* data) { - return reinterpret_cast<RepeatedFieldType*>( - reinterpret_cast<MapFieldBase*>(data)->MutableRepeatedField()); - } - virtual Message* New(const Value* value) const { - return static_cast<const Message*>(value)->New(); - } - // Convert an object received by this accessor to an MapEntry message to be - // stored in the underlying MapFieldBase. - virtual void ConvertToEntry(const Value* value, Message* result) const { - result->CopyFrom(*static_cast<const Message*>(value)); - } - // 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 { - return static_cast<const Value*>(&value); - } -}; - // Default implementations of RepeatedFieldAccessor for primitive types. template <typename T> class RepeatedFieldPrimitiveAccessor final : public RepeatedFieldWrapper<T> { - typedef void Field; - typedef void Value; + using Field = void; + using Value = void; + using RepeatedFieldWrapper<T>::MutableRepeatedField; public: - RepeatedFieldPrimitiveAccessor() {} + RepeatedFieldPrimitiveAccessor() = default; void Swap(Field* data, const internal::RepeatedFieldAccessor* other_mutator, Field* other_data) const override { // Currently RepeatedFieldPrimitiveAccessor is the only implementation of @@ -282,12 +223,13 @@ class RepeatedFieldPrimitiveAccessor final : public RepeatedFieldWrapper<T> { // ctype=STRING. class RepeatedPtrFieldStringAccessor final : public RepeatedPtrFieldWrapper<std::string> { - typedef void Field; - typedef void Value; + using Field = void; + using Value = void; + using RepeatedFieldAccessor::Add; public: - RepeatedPtrFieldStringAccessor() {} + RepeatedPtrFieldStringAccessor() = default; void Swap(Field* data, const internal::RepeatedFieldAccessor* other_mutator, Field* other_data) const override { if (this == other_mutator) { @@ -319,16 +261,18 @@ class RepeatedPtrFieldStringAccessor final }; -class RepeatedPtrFieldMessageAccessor final +class RepeatedPtrFieldMessageAccessor : public RepeatedPtrFieldWrapper<Message> { - typedef void Field; - typedef void Value; + using Field = void; + using Value = void; public: - RepeatedPtrFieldMessageAccessor() {} + RepeatedPtrFieldMessageAccessor() = default; + virtual ~RepeatedPtrFieldMessageAccessor() = default; + void Swap(Field* data, const internal::RepeatedFieldAccessor* other_mutator, Field* other_data) const override { - ABSL_CHECK(this == other_mutator); + ABSL_CHECK_EQ(this, other_mutator); MutableRepeatedField(data)->Swap(MutableRepeatedField(other_data)); } @@ -344,6 +288,24 @@ class RepeatedPtrFieldMessageAccessor final return static_cast<const Value*>(&value); } }; + +// An (transitive) implementation of RandomAccessRepeatedFieldAccessor that +// manipulates MapFieldBase. +class MapFieldAccessor final : public RepeatedPtrFieldMessageAccessor { + using Field = void; + using Value = void; + + protected: + const RepeatedFieldType* GetRepeatedField(const Field* data) const override { + return reinterpret_cast<const RepeatedFieldType*>( + &(reinterpret_cast<const MapFieldBase*>(data)->GetRepeatedField())); + } + RepeatedFieldType* MutableRepeatedField(Field* data) const override { + return reinterpret_cast<RepeatedFieldType*>( + reinterpret_cast<MapFieldBase*>(data)->MutableRepeatedField()); + } +}; + } // namespace internal } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/reflection_ops.cc b/third_party/protobuf/src/google/protobuf/reflection_ops.cc index 6d6811becf5c5..8fcd031015751 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_ops.cc +++ b/third_party/protobuf/src/google/protobuf/reflection_ops.cc @@ -13,6 +13,7 @@ #include <string> #include <vector> +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/str_cat.h" @@ -20,6 +21,7 @@ #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/map_field.h" #include "google/protobuf/map_field_inl.h" +#include "google/protobuf/port.h" #include "google/protobuf/unknown_field_set.h" // Must be included last. @@ -190,7 +192,7 @@ bool ReflectionOps::IsInitialized(const Message& message, bool check_fields, for (const FieldDescriptor* field = begin; field != end; ++field) { if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { const Descriptor* message_type = field->message_type(); - if (PROTOBUF_PREDICT_FALSE(message_type->options().map_entry())) { + if (ABSL_PREDICT_FALSE(message_type->options().map_entry())) { if (message_type->field(1)->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { const MapFieldBase* map_field = @@ -320,7 +322,9 @@ static bool IsMapValueMessageTyped(const FieldDescriptor* map_field) { void ReflectionOps::DiscardUnknownFields(Message* message) { const Reflection* reflection = GetReflectionOrDie(*message); - reflection->MutableUnknownFields(message)->Clear(); + if (reflection->GetUnknownFields(*message).field_count() != 0) { + reflection->MutableUnknownFields(message)->Clear(); + } // Walk through the fields of this message and DiscardUnknownFields on any // messages present. @@ -361,16 +365,12 @@ static std::string SubMessagePrefix(const std::string& prefix, const FieldDescriptor* field, int index) { std::string result(prefix); if (field->is_extension()) { - result.append("("); - result.append(field->full_name()); - result.append(")"); + absl::StrAppend(&result, "(", field->full_name(), ")"); } else { - result.append(field->name()); + absl::StrAppend(&result, field->name()); } if (index != -1) { - result.append("["); - result.append(absl::StrCat(index)); - result.append("]"); + absl::StrAppend(&result, "[", index, "]"); } result.append("."); return result; diff --git a/third_party/protobuf/src/google/protobuf/reflection_ops_unittest.cc b/third_party/protobuf/src/google/protobuf/reflection_ops_unittest.cc index 8f14edc778a0a..6ad2b8e2efc40 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_ops_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/reflection_ops_unittest.cc @@ -274,6 +274,15 @@ TEST(ReflectionOpsTest, DiscardUnknownFields) { message.repeated_nested_message(0).unknown_fields().field_count()); } +TEST(ReflectionOpsTest, DiscardUnknownFieldsIsANoopIfNotPresent) { + unittest::TestAllTypes message; + EXPECT_EQ(&message.unknown_fields(), + &google::protobuf::UnknownFieldSet::default_instance()); + ReflectionOps::DiscardUnknownFields(&message); + EXPECT_EQ(&message.unknown_fields(), + &google::protobuf::UnknownFieldSet::default_instance()); +} + TEST(ReflectionOpsTest, DiscardUnknownExtensions) { unittest::TestAllExtensions message; TestUtil::SetAllExtensions(&message); @@ -466,15 +475,15 @@ TEST(ReflectionOpsTest, FindExtensionInitializationErrors) { message.AddExtension(unittest::TestRequired::multi); message.AddExtension(unittest::TestRequired::multi); EXPECT_EQ( - "(protobuf_unittest.TestRequired.single).a," - "(protobuf_unittest.TestRequired.single).b," - "(protobuf_unittest.TestRequired.single).c," - "(protobuf_unittest.TestRequired.multi)[0].a," - "(protobuf_unittest.TestRequired.multi)[0].b," - "(protobuf_unittest.TestRequired.multi)[0].c," - "(protobuf_unittest.TestRequired.multi)[1].a," - "(protobuf_unittest.TestRequired.multi)[1].b," - "(protobuf_unittest.TestRequired.multi)[1].c", + "(proto2_unittest.TestRequired.single).a," + "(proto2_unittest.TestRequired.single).b," + "(proto2_unittest.TestRequired.single).c," + "(proto2_unittest.TestRequired.multi)[0].a," + "(proto2_unittest.TestRequired.multi)[0].b," + "(proto2_unittest.TestRequired.multi)[0].c," + "(proto2_unittest.TestRequired.multi)[1].a," + "(proto2_unittest.TestRequired.multi)[1].b," + "(proto2_unittest.TestRequired.multi)[1].c", FindInitializationErrors(message)); } diff --git a/third_party/protobuf/src/google/protobuf/reflection_tester.cc b/third_party/protobuf/src/google/protobuf/reflection_tester.cc index e7ed260c729c7..d48adaaf422a8 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_tester.cc +++ b/third_party/protobuf/src/google/protobuf/reflection_tester.cc @@ -192,7 +192,7 @@ MapReflectionTester::MapReflectionTester(const Descriptor* base_descriptor) } // Shorthand to get a FieldDescriptor for a field of unittest::TestMap. -const FieldDescriptor* MapReflectionTester::F(const std::string& name) { +const FieldDescriptor* MapReflectionTester::F(absl::string_view name) { const FieldDescriptor* result = nullptr; result = base_descriptor_->FindFieldByName(name); ABSL_CHECK(result != nullptr); @@ -604,33 +604,39 @@ void MapReflectionTester::SetMapFieldsViaMapReflection(Message* message) { } void MapReflectionTester::GetMapValueViaMapReflection( - Message* message, const std::string& field_name, const MapKey& map_key, + Message* message, absl::string_view field_name, const MapKey& map_key, MapValueRef* map_val) { const Reflection* reflection = message->GetReflection(); EXPECT_FALSE(reflection->InsertOrLookupMapValue(message, F(field_name), map_key, map_val)); } +void MapReflectionTester::DeleteMapValueViaMapReflection( + Message* message, absl::string_view field_name, const MapKey& map_key) { + const Reflection* reflection = message->GetReflection(); + reflection->DeleteMapValue(message, F(field_name), map_key); +} + Message* MapReflectionTester::GetMapEntryViaReflection( - Message* message, const std::string& field_name, int index) { + Message* message, absl::string_view field_name, int index) { const Reflection* reflection = message->GetReflection(); return reflection->MutableRepeatedMessage(message, F(field_name), index); } MapIterator MapReflectionTester::MapBegin(Message* message, - const std::string& field_name) { + absl::string_view field_name) { const Reflection* reflection = message->GetReflection(); return reflection->MapBegin(message, F(field_name)); } MapIterator MapReflectionTester::MapEnd(Message* message, - const std::string& field_name) { + absl::string_view field_name) { const Reflection* reflection = message->GetReflection(); return reflection->MapEnd(message, F(field_name)); } int MapReflectionTester::MapSize(const Message& message, - const std::string& field_name) { + absl::string_view field_name) { const Reflection* reflection = message.GetReflection(); return reflection->MapSize(message, F(field_name)); } diff --git a/third_party/protobuf/src/google/protobuf/reflection_tester.h b/third_party/protobuf/src/google/protobuf/reflection_tester.h index 4d258485b1095..9ac05b9d64449 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_tester.h +++ b/third_party/protobuf/src/google/protobuf/reflection_tester.h @@ -8,6 +8,9 @@ #ifndef GOOGLE_PROTOBUF_REFLECTION_TESTER_H__ #define GOOGLE_PROTOBUF_REFLECTION_TESTER_H__ +#include <optional> + +#include "absl/strings/string_view.h" #include "google/protobuf/map_field.h" #include "google/protobuf/message.h" @@ -38,21 +41,26 @@ class MapReflectionTester { void ExpectClearViaReflection(const Message& message); void ExpectClearViaReflectionIterator(Message* message); void GetMapValueViaMapReflection(Message* message, - const std::string& field_name, + absl::string_view field_name, const MapKey& map_key, MapValueRef* map_val); + void DeleteMapValueViaMapReflection(Message* message, + absl::string_view field_name, + const MapKey& map_key); Message* GetMapEntryViaReflection(Message* message, - const std::string& field_name, int index); - MapIterator MapBegin(Message* message, const std::string& field_name); - MapIterator MapEnd(Message* message, const std::string& field_name); - int MapSize(const Message& message, const std::string& field_name); + absl::string_view field_name, int index); + MapIterator MapBegin(Message* message, absl::string_view field_name); + MapIterator MapEnd(Message* message, absl::string_view field_name); + int MapSize(const Message& message, absl::string_view field_name); - static MapValueConstRef LookupMapValue(const Reflection& reflection, - const Message& message, - const FieldDescriptor& descriptor, - const MapKey& map_key) { + static std::optional<MapValueConstRef> LookupMapValue( + const Reflection& reflection, const Message& message, + const FieldDescriptor& descriptor, const MapKey& map_key) { MapValueConstRef map_val_const; - reflection.LookupMapValue(message, &descriptor, map_key, &map_val_const); - return map_val_const; + if (reflection.LookupMapValue(message, &descriptor, map_key, + &map_val_const)) { + return map_val_const; + } + return std::nullopt; } static std::string long_string() { @@ -63,7 +71,7 @@ class MapReflectionTester { } private: - const FieldDescriptor* F(const std::string& name); + const FieldDescriptor* F(absl::string_view name); const Descriptor* base_descriptor_; diff --git a/third_party/protobuf/src/google/protobuf/reflection_visit_field_info.h b/third_party/protobuf/src/google/protobuf/reflection_visit_field_info.h index c6758271e1480..35bb8c704d2af 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_visit_field_info.h +++ b/third_party/protobuf/src/google/protobuf/reflection_visit_field_info.h @@ -117,8 +117,8 @@ struct DynamicFieldInfoHelper { static absl::string_view GetStringView(const Reflection* reflection, const Message& message, const FieldDescriptor* field) { - auto ctype = cpp::EffectiveStringCType(field); - ABSL_DCHECK_NE(ctype, FieldOptions::CORD); + auto string_type = field->cpp_string_type(); + ABSL_DCHECK(string_type != FieldDescriptor::CppStringType::kCord); ABSL_DCHECK(!is_oneof || reflection->HasOneofField(message, field)); auto str = Get<ArenaStringPtr>(reflection, message, field); ABSL_DCHECK(!str.IsDefault()); @@ -709,11 +709,12 @@ struct RepeatedEntityDynamicFieldInfoBase { return {const_repeated.cbegin(), const_repeated.cend()}; } iterator_range<typename RepeatedField<FieldT>::iterator> Mutable() { - auto& rep = *reflection->MutableRepeatedField<FieldT>(&message, field); + auto& rep = + *reflection->MutableRepeatedFieldInternal<FieldT>(&message, field); return {rep.begin(), rep.end()}; } void Clear() { - reflection->MutableRepeatedField<FieldT>(&message, field)->Clear(); + reflection->MutableRepeatedFieldInternal<FieldT>(&message, field)->Clear(); } const Reflection* reflection; @@ -809,11 +810,13 @@ struct RepeatedPtrEntityDynamicFieldInfoBase { return {const_repeated.cbegin(), const_repeated.cend()}; } iterator_range<typename RepeatedPtrField<FieldT>::iterator> Mutable() { - auto& rep = *reflection->MutableRepeatedPtrField<FieldT>(&message, field); + auto& rep = + *reflection->MutableRepeatedPtrFieldInternal<FieldT>(&message, field); return {rep.begin(), rep.end()}; } void Clear() { - reflection->MutableRepeatedPtrField<FieldT>(&message, field)->Clear(); + reflection->MutableRepeatedPtrFieldInternal<FieldT>(&message, field) + ->Clear(); } const Reflection* reflection; @@ -1137,6 +1140,13 @@ struct RepeatedGroupDynamicExtensionInfo // users from a similar dispatch without creating KeyInfo or ValueInfo per type. template <FieldDescriptor::CppType cpp_type, typename T> inline size_t MapPrimitiveFieldByteSize(FieldDescriptor::Type type, T value) { + // There is a bug in GCC 9.5 where if-constexpr arguments are not understood + // if encased in a switch statement. A reproduction of the bug can be found + // at: https://godbolt.org/z/qo51cKe7b + // This is fixed in GCC 10.1+. + (void)type; // Suppress -Wunused-but-set-parameter + (void)value; // Suppress -Wunused-but-set-parameter + if constexpr (cpp_type == FieldDescriptor::CPPTYPE_INT32) { static_assert(std::is_same_v<T, int32_t>, "type mismatch"); switch (type) { @@ -1245,7 +1255,7 @@ PROTOBUF_MAP_VALUE_INFO(Bool, bool, BOOL); PROTOBUF_MAP_VALUE_INFO(Enum, int, ENUM); PROTOBUF_MAP_VALUE_INFO(Float, float, FLOAT); PROTOBUF_MAP_VALUE_INFO(Double, double, DOUBLE); -PROTOBUF_MAP_VALUE_INFO(String, const std::string&, STRING); +PROTOBUF_MAP_VALUE_INFO(String, absl::string_view, STRING); #undef PROTOBUF_MAP_VALUE_INFO diff --git a/third_party/protobuf/src/google/protobuf/reflection_visit_fields.h b/third_party/protobuf/src/google/protobuf/reflection_visit_fields.h index d1b317bc2fd3a..9430303300245 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_visit_fields.h +++ b/third_party/protobuf/src/google/protobuf/reflection_visit_fields.h @@ -6,6 +6,7 @@ #include <utility> #include "absl/base/attributes.h" +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include "google/protobuf/descriptor.h" @@ -85,7 +86,7 @@ class ReflectionVisit final { }; inline bool ShouldVisit(FieldMask mask, FieldDescriptor::CppType cpptype) { - if (PROTOBUF_PREDICT_TRUE(mask == FieldMask::kAll)) return true; + if (ABSL_PREDICT_TRUE(mask == FieldMask::kAll)) return true; return (static_cast<uint32_t>(mask) & (1 << cpptype)) != 0; } @@ -140,7 +141,7 @@ void ReflectionVisit::VisitFields(MessageT& message, CallbackFn&& func, #define PROTOBUF_HANDLE_REPEATED_PTR_CASE(TYPE, CPPTYPE, NAME) \ case FieldDescriptor::TYPE_##TYPE: { \ - if (PROTOBUF_PREDICT_TRUE(!field->is_map())) { \ + if (ABSL_PREDICT_TRUE(!field->is_map())) { \ /* Handle repeated fields. */ \ const auto& rep = reflection->GetRawNonOneof<RepeatedPtrField<CPPTYPE>>( \ message, field); \ @@ -174,9 +175,10 @@ void ReflectionVisit::VisitFields(MessageT& message, CallbackFn&& func, reflection, message, field, rep}); \ } - switch (cpp::EffectiveStringCType(field)) { - default: - case FieldOptions::STRING: + switch (field->cpp_string_type()) { + case FieldDescriptor::CppStringType::kCord: + case FieldDescriptor::CppStringType::kView: + case FieldDescriptor::CppStringType::kString: PROTOBUF_IMPL_STRING_CASE(std::string, String); break; } @@ -227,13 +229,16 @@ void ReflectionVisit::VisitFields(MessageT& message, CallbackFn&& func, case FieldDescriptor::TYPE_BYTES: case FieldDescriptor::TYPE_STRING: { - auto ctype = cpp::EffectiveStringCType(field); - if (ctype == FieldOptions::CORD) { - func(CordDynamicFieldInfo<MessageT, true>{reflection, message, - field}); - } else { - func(StringDynamicFieldInfo<MessageT, true>{reflection, message, + switch (field->cpp_string_type()) { + case FieldDescriptor::CppStringType::kCord: + func(CordDynamicFieldInfo<MessageT, true>{reflection, message, field}); + break; + case FieldDescriptor::CppStringType::kString: + case FieldDescriptor::CppStringType::kView: + func(StringDynamicFieldInfo<MessageT, true>{reflection, message, + field}); + break; } break; } @@ -245,7 +250,7 @@ void ReflectionVisit::VisitFields(MessageT& message, CallbackFn&& func, } else { auto index = has_bits_indices[i]; bool check_hasbits = has_bits && index != static_cast<uint32_t>(-1); - if (PROTOBUF_PREDICT_TRUE(check_hasbits)) { + if (ABSL_PREDICT_TRUE(check_hasbits)) { if ((has_bits[index / 32] & (1u << (index % 32))) == 0) continue; } else { // Skip if it has default values. @@ -279,13 +284,16 @@ void ReflectionVisit::VisitFields(MessageT& message, CallbackFn&& func, break; case FieldDescriptor::TYPE_BYTES: case FieldDescriptor::TYPE_STRING: { - auto ctype = cpp::EffectiveStringCType(field); - if (ctype == FieldOptions::CORD) { - func(CordDynamicFieldInfo<MessageT, false>{reflection, message, - field}); - } else { - func(StringDynamicFieldInfo<MessageT, false>{reflection, message, + switch (field->cpp_string_type()) { + case FieldDescriptor::CppStringType::kCord: + func(CordDynamicFieldInfo<MessageT, false>{reflection, message, field}); + break; + case FieldDescriptor::CppStringType::kString: + case FieldDescriptor::CppStringType::kView: + func(StringDynamicFieldInfo<MessageT, false>{reflection, message, + field}); + break; } break; } diff --git a/third_party/protobuf/src/google/protobuf/reflection_visit_fields_test.cc b/third_party/protobuf/src/google/protobuf/reflection_visit_fields_test.cc index ac84893bd72d4..c1f027b1d8ac6 100644 --- a/third_party/protobuf/src/google/protobuf/reflection_visit_fields_test.cc +++ b/third_party/protobuf/src/google/protobuf/reflection_visit_fields_test.cc @@ -29,13 +29,13 @@ namespace { #ifdef __cpp_if_constexpr -using ::protobuf_unittest::NestedTestAllTypes; -using ::protobuf_unittest::TestAllExtensions; -using ::protobuf_unittest::TestAllTypes; -using ::protobuf_unittest::TestMap; -using ::protobuf_unittest::TestOneof2; -using ::protobuf_unittest::TestPackedExtensions; -using ::protobuf_unittest::TestPackedTypes; +using ::proto2_unittest::NestedTestAllTypes; +using ::proto2_unittest::TestAllExtensions; +using ::proto2_unittest::TestAllTypes; +using ::proto2_unittest::TestMap; +using ::proto2_unittest::TestOneof2; +using ::proto2_unittest::TestPackedExtensions; +using ::proto2_unittest::TestPackedTypes; using ::proto2_wireformat_unittest::TestMessageSet; struct TestParam { @@ -172,7 +172,7 @@ void MutateNothingByVisit(Message& message) { } } else { for (auto& it : info.Mutable()) { - it = it; + it = *⁢ // Avoid -Wself-assign. } } } else { @@ -207,6 +207,12 @@ TEST_P(VisitFieldsTest, MutateNothingByVisitIdempotent) { template <typename InfoT> inline size_t MapKeyByteSizeLong(FieldDescriptor::Type type, InfoT info) { + // There is a bug in GCC 9.5 where if-constexpr arguments are not understood + // if passed into a helper function. A reproduction of the bug can be found + // at: https://godbolt.org/z/65qW3vGhP + // This is fixed in GCC 10.1+. + (void)type; // Suppress -Wunused-but-set-parameter + if constexpr (info.cpp_type == FieldDescriptor::CPPTYPE_STRING) { return WireFormatLite::StringSize(info.Get()); } else { @@ -216,6 +222,12 @@ inline size_t MapKeyByteSizeLong(FieldDescriptor::Type type, InfoT info) { template <typename InfoT> inline size_t MapValueByteSizeLong(FieldDescriptor::Type type, InfoT info) { + // There is a bug in GCC 9.5 where if-constexpr arguments are not understood + // if passed into a helper function. A reproduction of the bug can be found + // at: https://godbolt.org/z/65qW3vGhP + // This is fixed in GCC 10.1+. + (void)type; // Suppress -Wunused-but-set-parameter + if constexpr (info.cpp_type == FieldDescriptor::CPPTYPE_STRING) { return WireFormatLite::StringSize(info.Get()); } else if constexpr (info.cpp_type == FieldDescriptor::CPPTYPE_MESSAGE) { diff --git a/third_party/protobuf/src/google/protobuf/repeated_field.cc b/third_party/protobuf/src/google/protobuf/repeated_field.cc index 0626e157361e6..3547256c6bd8e 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_field.cc +++ b/third_party/protobuf/src/google/protobuf/repeated_field.cc @@ -19,6 +19,7 @@ #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/cord.h" +#include "google/protobuf/repeated_ptr_field.h" // Must be included last. #include "google/protobuf/port_def.inc" @@ -26,6 +27,16 @@ namespace google { namespace protobuf { +namespace internal { + +void LogIndexOutOfBounds(int index, int size) { + ABSL_DLOG(FATAL) << "Index " << index << " out of bounds " << size; +} + +[[noreturn]] void LogIndexOutOfBoundsAndAbort(int index, int size) { + ABSL_LOG(FATAL) << "index: " << index << ", size: " << size; +} +} // namespace internal template <> PROTOBUF_EXPORT_TEMPLATE_DEFINE size_t diff --git a/third_party/protobuf/src/google/protobuf/repeated_field.h b/third_party/protobuf/src/google/protobuf/repeated_field.h index e428811d27169..e42df754c43ee 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_field.h +++ b/third_party/protobuf/src/google/protobuf/repeated_field.h @@ -559,8 +559,8 @@ class RepeatedField final // We need to manually unpoison the SOO buffer because in reflection for // split repeated fields, we poison the whole SOO buffer even when we // don't actually use the whole SOO buffer (e.g. for RepeatedField<bool>). - PROTOBUF_UNPOISON_MEMORY_REGION(soo_rep_.short_rep.data, - sizeof(soo_rep_.short_rep.data)); + internal::UnpoisonMemoryRegion(soo_rep_.short_rep.data, + sizeof(soo_rep_.short_rep.data)); } } @@ -1147,7 +1147,7 @@ inline int CalculateReserveSize(int capacity, int new_size) { } constexpr int kMaxSizeBeforeClamp = (std::numeric_limits<int>::max() - kHeapRepHeaderSize) / 2; - if (PROTOBUF_PREDICT_FALSE(capacity > kMaxSizeBeforeClamp)) { + if (ABSL_PREDICT_FALSE(capacity > kMaxSizeBeforeClamp)) { return std::numeric_limits<int>::max(); } constexpr int kSooCapacityElements = SooCapacityElements(sizeof(T)); diff --git a/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc b/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc index d24efa7693f9d..050869533e8c6 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc @@ -13,9 +13,9 @@ #include "google/protobuf/unittest.pb.h" // IWYU pragma: keep, used in UNITTEST #define REFLECTION_TEST RepeatedFieldReflectionTest -#define UNITTEST_PACKAGE_NAME "protobuf_unittest" -#define UNITTEST ::protobuf_unittest -#define UNITTEST_IMPORT ::protobuf_unittest_import +#define UNITTEST_PACKAGE_NAME "proto2_unittest" +#define UNITTEST ::proto2_unittest +#define UNITTEST_IMPORT ::proto2_unittest_import // Must include after the above macros. // clang-format off diff --git a/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.inc b/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.inc index da4136fff9ed9..2f6ff2b121f68 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.inc +++ b/third_party/protobuf/src/google/protobuf/repeated_field_reflection_unittest.inc @@ -22,7 +22,6 @@ namespace protobuf { namespace { -using internal::DownCast; using UNITTEST::ForeignMessage; using UNITTEST::TestAllExtensions; using UNITTEST::TestAllTypes; @@ -340,12 +339,6 @@ TEST(REFLECTION_TEST, RepeatedFieldRefForRegularFields) { } EXPECT_EQ(10, index); - // Test MutableRepeatedFieldRef::Reserve() - mrf_int32.Reserve(mrf_int32.size() + 1); - mrf_double.Reserve(mrf_double.size() + 1); - mrf_string.Reserve(mrf_string.size() + 1); - mrf_foreign_message.Reserve(mrf_foreign_message.size() + 1); - // Test MutableRepeatedFieldRef::Add() mrf_int32.Add(1234); mrf_double.Add(1234.0); diff --git a/third_party/protobuf/src/google/protobuf/repeated_field_unittest.cc b/third_party/protobuf/src/google/protobuf/repeated_field_unittest.cc index 17f26042706ee..d2a39c316bba3 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_field_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/repeated_field_unittest.cc @@ -30,6 +30,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include "absl/base/config.h" #include "absl/numeric/bits.h" #include "absl/strings/cord.h" #include "absl/types/span.h" @@ -38,6 +39,7 @@ #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "google/protobuf/parse_context.h" +#include "google/protobuf/port.h" // TODO: Remove. #include "google/protobuf/repeated_ptr_field.h" #include "google/protobuf/unittest.pb.h" @@ -50,7 +52,7 @@ namespace google { namespace protobuf { namespace { -using ::protobuf_unittest::TestAllTypes; +using ::proto2_unittest::TestAllTypes; using ::testing::A; using ::testing::AllOf; using ::testing::ElementsAre; @@ -474,9 +476,9 @@ TEST(RepeatedField, ReserveLarge) { } TEST(RepeatedField, ReserveHuge) { -#if defined(PROTOBUF_ASAN) || defined(PROTOBUF_MSAN) - GTEST_SKIP() << "Disabled because sanitizer is active"; -#endif + if (internal::HasAnySanitizer()) { + GTEST_SKIP() << "Disabled because sanitizer is active"; + } // Largest value that does not clamp to the large limit: constexpr int non_clamping_limit = (std::numeric_limits<int>::max() - sizeof(Arena*)) / 2; @@ -940,36 +942,6 @@ TEST(RepeatedField, MoveAssign) { } } -TEST(Movable, Works) { - class NonMoveConstructible { - public: - NonMoveConstructible(NonMoveConstructible&&) = delete; - NonMoveConstructible& operator=(NonMoveConstructible&&) { return *this; } - }; - class NonMoveAssignable { - public: - NonMoveAssignable(NonMoveAssignable&&) {} - NonMoveAssignable& operator=(NonMoveConstructible&&) = delete; - }; - class NonMovable { - public: - NonMovable(NonMovable&&) = delete; - NonMovable& operator=(NonMovable&&) = delete; - }; - - EXPECT_TRUE(internal::IsMovable<std::string>::value); - - EXPECT_FALSE(std::is_move_constructible<NonMoveConstructible>::value); - EXPECT_TRUE(std::is_move_assignable<NonMoveConstructible>::value); - EXPECT_FALSE(internal::IsMovable<NonMoveConstructible>::value); - - EXPECT_TRUE(std::is_move_constructible<NonMoveAssignable>::value); - EXPECT_FALSE(std::is_move_assignable<NonMoveAssignable>::value); - EXPECT_FALSE(internal::IsMovable<NonMoveAssignable>::value); - - EXPECT_FALSE(internal::IsMovable<NonMovable>::value); -} - TEST(RepeatedField, MutableDataIsMutable) { RepeatedField<int> field; field.Add(1); @@ -1164,17 +1136,17 @@ TEST(RepeatedField, HardenAgainstBadTruncate) { } } -#if defined(GTEST_HAS_DEATH_TEST) && \ - (defined(PROTOBUF_ASAN) || defined(PROTOBUF_MSAN)) +#if defined(GTEST_HAS_DEATH_TEST) && (defined(ABSL_HAVE_ADDRESS_SANITIZER) || \ + defined(ABSL_HAVE_MEMORY_SANITIZER)) // This function verifies that the code dies under ASAN or MSAN trying to both // read and write the reserved element directly beyond the last element. void VerifyDeathOnWriteAndReadAccessBeyondEnd(RepeatedField<int64_t>& field) { auto* end = field.Mutable(field.size() - 1) + 1; -#if defined(PROTOBUF_ASAN) +#if defined(ABSL_HAVE_ADDRESS_SANITIZER) EXPECT_DEATH(*end = 1, "container-overflow"); EXPECT_DEATH(EXPECT_NE(*end, 1), "container-overflow"); -#elif defined(PROTOBUF_MSAN) +#elif defined(ABSL_HAVE_MEMORY_SANITIZER) EXPECT_DEATH(EXPECT_NE(*end, 1), "use-of-uninitialized-value"); #endif diff --git a/third_party/protobuf/src/google/protobuf/repeated_ptr_field.cc b/third_party/protobuf/src/google/protobuf/repeated_ptr_field.cc index f923dfd45e4e7..40b2c7a0dd11d 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_ptr_field.cc +++ b/third_party/protobuf/src/google/protobuf/repeated_ptr_field.cc @@ -19,6 +19,8 @@ #include <new> #include <string> +#include "absl/base/optimization.h" +#include "absl/base/prefetch.h" #include "absl/log/absl_check.h" #include "google/protobuf/arena.h" #include "google/protobuf/message_lite.h" @@ -33,6 +35,15 @@ namespace protobuf { namespace internal { +MessageLite* CloneSlow(Arena* arena, const MessageLite& value) { + auto* msg = value.New(arena); + msg->CheckTypeAndMergeFrom(value); + return msg; +} +std::string* CloneSlow(Arena* arena, const std::string& value) { + return Arena::Create<std::string>(arena, value); +} + void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) { ABSL_DCHECK(extend_amount > 0); constexpr size_t kPtrSize = sizeof(rep()->elements[0]); @@ -183,12 +194,21 @@ void RepeatedPtrFieldBase::MergeFromConcreteMessage( void** dst = InternalReserve(new_size); const void* const* src = from.elements(); auto end = src + from.current_size_; - if (PROTOBUF_PREDICT_FALSE(ClearedCount() > 0)) { + constexpr ptrdiff_t kPrefetchstride = 1; + if (ABSL_PREDICT_FALSE(ClearedCount() > 0)) { int recycled = MergeIntoClearedMessages(from); dst += recycled; src += recycled; } Arena* arena = GetArena(); + if (from.current_size_ >= kPrefetchstride) { + auto prefetch_end = end - kPrefetchstride; + for (; src < prefetch_end; ++src, ++dst) { + auto next = src + kPrefetchstride; + absl::PrefetchToLocalCache(*next); + *dst = copy_fn(arena, *src); + } + } for (; src < end; ++src, ++dst) { *dst = copy_fn(arena, *src); } @@ -211,7 +231,7 @@ RepeatedPtrFieldBase::MergeFrom<MessageLite>( auto end = src + from.current_size_; const MessageLite* prototype = src[0]; ABSL_DCHECK(prototype != nullptr); - if (PROTOBUF_PREDICT_FALSE(ClearedCount() > 0)) { + if (ABSL_PREDICT_FALSE(ClearedCount() > 0)) { int recycled = MergeIntoClearedMessages(from); dst += recycled; src += recycled; diff --git a/third_party/protobuf/src/google/protobuf/repeated_ptr_field.h b/third_party/protobuf/src/google/protobuf/repeated_ptr_field.h index 36ca1c65c954b..52032a7d7ac0a 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_ptr_field.h +++ b/third_party/protobuf/src/google/protobuf/repeated_ptr_field.h @@ -24,6 +24,7 @@ #include <algorithm> #include <cstddef> #include <cstdint> +#include <cstdlib> #include <iterator> #include <limits> #include <new> @@ -32,6 +33,7 @@ #include <utility> #include "absl/base/attributes.h" +#include "absl/base/optimization.h" #include "absl/base/prefetch.h" #include "absl/log/absl_check.h" #include "absl/meta/type_traits.h" @@ -61,7 +63,6 @@ namespace internal { class MergePartialFromCodedStreamHelper; class SwapFieldHelper; - } // namespace internal namespace internal { @@ -81,11 +82,6 @@ inline void memswap(char* PROTOBUF_RESTRICT a, char* PROTOBUF_RESTRICT b) { std::swap_ranges(a, a + N, b); } -template <typename T> -struct IsMovable - : std::integral_constant<bool, std::is_move_constructible<T>::value && - std::is_move_assignable<T>::value> {}; - // A trait that tells offset of `T::arena_`. // // Do not use this struct - it exists for internal use only. @@ -94,6 +90,11 @@ struct ArenaOffsetHelper { static constexpr size_t value = offsetof(T, arena_); }; +// Copies the object in the arena. +// Used in the slow path. Out-of-line for lower binary size cost. +PROTOBUF_EXPORT MessageLite* CloneSlow(Arena* arena, const MessageLite& value); +PROTOBUF_EXPORT std::string* CloneSlow(Arena* arena, const std::string& value); + // Defined further below. template <typename Type> class GenericTypeHandler; @@ -106,20 +107,18 @@ class GenericTypeHandler; // class TypeHandler { // public: // using Type = MyType; -// using Movable = ...; // // static Type*(*)(Arena*) GetNewFunc(); // static void GetArena(Type* value); // -// static Type* New(Arena* arena); // static Type* New(Arena* arena, Type&& value); -// static Type* NewFromPrototype(const Type* prototype, Arena* arena); // static void Delete(Type*, Arena* arena); // 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&); +// +// static const Type& default_instance(); // }; class PROTOBUF_EXPORT RepeatedPtrFieldBase { template <typename TypeHandler> @@ -198,10 +197,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { return cast<TypeHandler>(AddMessageLite(TypeHandler::GetNewFunc())); } - template < - typename TypeHandler, - typename std::enable_if<TypeHandler::Movable::value>::type* = nullptr> + template <typename TypeHandler> inline void Add(Value<TypeHandler>&& value) { + static_assert(std::is_move_constructible<Value<TypeHandler>>::value, ""); + static_assert(std::is_move_assignable<Value<TypeHandler>>::value, ""); if (current_size_ < allocated_size()) { *cast<TypeHandler>(element_at(ExchangeCurrentSize(current_size_ + 1))) = std::move(value); @@ -222,7 +221,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // TODO: arena check is redundant once all `RepeatedPtrField`s // with non-null arena are owned by the arena. - if (PROTOBUF_PREDICT_FALSE(arena_ != nullptr)) return; + if (ABSL_PREDICT_FALSE(arena_ != nullptr)) return; using H = CommonHandler<TypeHandler>; int n = allocated_size(); @@ -241,6 +240,8 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // allocated Rep. return tagged_rep_or_elem_ != nullptr; } + + // Pre-condition: NeedsDestroy() returns true. void DestroyProtos(); public: @@ -300,7 +301,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // Pre-condition: PrepareForParse() is true. void AddAllocatedForParse(void* value) { ABSL_DCHECK(PrepareForParse()); - if (PROTOBUF_PREDICT_FALSE(SizeAtCapacity())) { + if (ABSL_PREDICT_FALSE(SizeAtCapacity())) { *InternalExtend(1) = value; ++rep()->allocated_size; } else { @@ -337,10 +338,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template <typename TypeHandler> static inline Value<TypeHandler>* copy(const Value<TypeHandler>* value) { - using H = CommonHandler<TypeHandler>; - auto* new_value = H::NewFromPrototype(value, nullptr); - H::Merge(*value, new_value); - return cast<TypeHandler>(new_value); + return cast<TypeHandler>(CloneSlow(nullptr, *value)); } // Used for constructing iterators. @@ -454,7 +452,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { } template <typename TypeHandler> - PROTOBUF_NODISCARD Value<TypeHandler>* ReleaseLast() { + [[nodiscard]] Value<TypeHandler>* ReleaseLast() { Value<TypeHandler>* result = UnsafeArenaReleaseLast<TypeHandler>(); // Now perform a copy if we're on an arena. Arena* arena = GetArena(); @@ -505,9 +503,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { my_arena->Own(value); } else if (my_arena != value_arena) { ABSL_DCHECK(value_arena != nullptr); - auto* new_value = TypeHandler::NewFromPrototype(value, my_arena); - H::Merge(*value, new_value); - value = new_value; + value = cast<TypeHandler>(CloneSlow(my_arena, *value)); } UnsafeArenaAddAllocated<H>(value); @@ -580,6 +576,8 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { friend class google::protobuf::Reflection; friend class internal::SwapFieldHelper; + friend class RustRepeatedMessageHelper; + // Concrete Arena enabled copy function used to copy messages instances. // This follows the `Arena::CopyConstruct` signature so that the compiler // can have the inlined call into the out of line copy function(s) simply pass @@ -797,7 +795,7 @@ void* RepeatedPtrFieldBase::AddInternal(Factory factory) { return result; } Rep* r = rep(); - if (PROTOBUF_PREDICT_FALSE(SizeAtCapacity())) { + if (ABSL_PREDICT_FALSE(SizeAtCapacity())) { InternalExtend(1); r = rep(); } else { @@ -817,23 +815,15 @@ template <typename GenericType> class GenericTypeHandler { public: using Type = GenericType; - using Movable = IsMovable<Type>; static constexpr auto GetNewFunc() { return Arena::DefaultConstruct<Type>; } static inline Arena* GetArena(Type* value) { return Arena::InternalGetArena(value); } - static inline Type* New(Arena* arena) { - return static_cast<Type*>(Arena::DefaultConstruct<Type>(arena)); - } static inline Type* New(Arena* arena, Type&& value) { return Arena::Create<Type>(arena, std::move(value)); } - static inline Type* NewFromPrototype(const Type* /*prototype*/, - Arena* arena = nullptr) { - return New(arena); - } static inline void Delete(Type* value, Arena* arena) { if (arena != nullptr) return; #ifdef __cpp_if_constexpr @@ -849,44 +839,25 @@ class GenericTypeHandler { #endif } static inline void Clear(Type* value) { value->Clear(); } - static void Merge(const Type& from, Type* to); static inline size_t SpaceUsedLong(const Type& value) { return value.SpaceUsedLong(); } + + static const Type& default_instance() { + return *static_cast<const GenericType*>( + MessageTraits<Type>::default_instance()); + } }; -// NewFromPrototypeHelper() is not defined inline here, as we will need to do a -// virtual function dispatch anyways to go from Message* to call New/Merge. (The -// additional helper is needed as a workaround for MSVC.) -PROTOBUF_EXPORT MessageLite* NewFromPrototypeHelper( - const MessageLite* prototype, Arena* arena); - -template <> -inline MessageLite* GenericTypeHandler<MessageLite>::NewFromPrototype( - const MessageLite* prototype, Arena* arena) { - return NewFromPrototypeHelper(prototype, arena); -} template <> inline Arena* GenericTypeHandler<MessageLite>::GetArena(MessageLite* value) { return value->GetArena(); } -template <typename GenericType> -PROTOBUF_NOINLINE inline void GenericTypeHandler<GenericType>::Merge( - const GenericType& from, GenericType* to) { - to->MergeFrom(from); -} -template <> -PROTOBUF_EXPORT void GenericTypeHandler<MessageLite>::Merge( - const MessageLite& from, MessageLite* 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>::GetArena(Message* value); PROTOBUF_EXPORT void* NewStringElement(Arena* arena); @@ -895,20 +866,13 @@ template <> class GenericTypeHandler<std::string> { public: using Type = std::string; - using Movable = IsMovable<Type>; static constexpr auto GetNewFunc() { return NewStringElement; } static inline Arena* GetArena(Type*) { return nullptr; } - static PROTOBUF_NOINLINE Type* New(Arena* arena) { - return Arena::Create<Type>(arena); - } static PROTOBUF_NOINLINE Type* New(Arena* arena, Type&& value) { return Arena::Create<Type>(arena, std::move(value)); } - static inline Type* NewFromPrototype(const Type*, Arena* arena) { - return New(arena); - } static inline void Delete(Type* value, Arena* arena) { if (arena == nullptr) { delete value; @@ -919,6 +883,10 @@ class GenericTypeHandler<std::string> { static size_t SpaceUsedLong(const Type& value) { return sizeof(value) + StringSpaceUsedExcludingSelfLong(value); } + + static const Type& default_instance() { + return GetEmptyStringAlreadyInited(); + } }; } // namespace internal @@ -941,6 +909,8 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase { internal::is_supported_string_type<Element>, internal::is_supported_message_type<Element>>::value, "We only support string and Message types in RepeatedPtrField."); + static_assert(alignof(Element) <= internal::ArenaAlignDefault::align, + "Overaligned types are not supported"); } public: @@ -1139,7 +1109,7 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase { // 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(); + [[nodiscard]] Element* ReleaseLast(); // Adds an already-allocated object, skipping arena-ownership checks. The user // must guarantee that the given object is in the same arena as this @@ -1193,10 +1163,6 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase { // Hardcore programs may choose to manipulate these cleared objects // to better optimize memory management using the following routines. - // Gets the number of cleared objects that are currently being kept - // around for reuse. - ABSL_DEPRECATED("This will be removed in a future release") - int ClearedCount() const; // Removes the element referenced by position. // @@ -1226,7 +1192,6 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase { using RepeatedPtrFieldBase::InternalGetArenaOffset; - private: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; @@ -1359,7 +1324,6 @@ inline Element& RepeatedPtrField<Element>::at(int index) return RepeatedPtrFieldBase::at<TypeHandler>(index); } - template <typename Element> inline Element* RepeatedPtrField<Element>::Mutable(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1573,10 +1537,6 @@ 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>::Reserve(int new_size) { @@ -1592,6 +1552,39 @@ inline int RepeatedPtrField<Element>::Capacity() const { namespace internal { +// This class gives the Rust implementation access to some protected methods on +// RepeatedPtrFieldBase. These methods allow us to operate solely on the +// MessageLite interface so that we do not need to generate code for each +// concrete message type. +class RustRepeatedMessageHelper { + public: + static RepeatedPtrFieldBase* New() { return new RepeatedPtrFieldBase; } + + static void Delete(RepeatedPtrFieldBase* field) { + if (field->NeedsDestroy()) { + field->DestroyProtos(); + } + delete field; + } + + static size_t Size(const RepeatedPtrFieldBase& field) { + return static_cast<size_t>(field.size()); + } + + static void Reserve(RepeatedPtrFieldBase& field, size_t additional) { + field.Reserve(field.size() + additional); + } + + static const MessageLite& At(const RepeatedPtrFieldBase& field, + size_t index) { + return field.at<GenericTypeHandler<MessageLite>>(index); + } + + static MessageLite& At(RepeatedPtrFieldBase& field, size_t index) { + return field.at<GenericTypeHandler<MessageLite>>(index); + } +}; + // STL-like iterator implementation for RepeatedPtrField. You should not // refer to this class directly; use RepeatedPtrField<T>::iterator instead. // @@ -1743,7 +1736,7 @@ class RepeatedPtrOverPtrsIterator { typename OtherElement, typename OtherVoidPtr, typename std::enable_if< std::is_convertible<OtherElement*, pointer>::value && - std::is_convertible<OtherVoidPtr*, VoidPtr>::value>::type* = nullptr> + std::is_convertible<OtherVoidPtr, VoidPtr>::value>::type* = nullptr> RepeatedPtrOverPtrsIterator( const RepeatedPtrOverPtrsIterator<OtherElement, OtherVoidPtr>& other) : it_(other.it_) {} @@ -1988,6 +1981,44 @@ class UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator { RepeatedPtrField<T>* field_; }; +// A utility function for logging that doesn't need any template types. +PROTOBUF_EXPORT void LogIndexOutOfBounds(int index, int size); + +// A utility function for logging that doesn't need any template types. Same as +// LogIndexOutOfBounds, but aborts the program in all cases by logging to FATAL +// instead of DFATAL. +[[noreturn]] PROTOBUF_EXPORT void LogIndexOutOfBoundsAndAbort(int index, + int size); + +template <typename T> +const T& CheckedGetOrDefault(const RepeatedPtrField<T>& field, int index) { + if (ABSL_PREDICT_FALSE(index < 0 || index >= field.size())) { + LogIndexOutOfBounds(index, field.size()); + return GenericTypeHandler<T>::default_instance(); + } + return field.Get(index); +} + +template <typename T> +inline void CheckIndexInBoundsOrAbort(const RepeatedPtrField<T>& field, + int index) { + if (ABSL_PREDICT_FALSE(index < 0 || index >= field.size())) { + LogIndexOutOfBoundsAndAbort(index, field.size()); + } +} + +template <typename T> +const T& CheckedGetOrAbort(const RepeatedPtrField<T>& field, int index) { + CheckIndexInBoundsOrAbort(field, index); + return field.Get(index); +} + +template <typename T> +inline T* CheckedMutableOrAbort(RepeatedPtrField<T>* field, int index) { + CheckIndexInBoundsOrAbort(*field, index); + return field->Mutable(index); +} + } // namespace internal // Provides a back insert iterator for RepeatedPtrField instances, diff --git a/third_party/protobuf/src/google/protobuf/repeated_ptr_field_unittest.cc b/third_party/protobuf/src/google/protobuf/repeated_ptr_field_unittest.cc index f6667ed924e4b..6b3021fbbf077 100644 --- a/third_party/protobuf/src/google/protobuf/repeated_ptr_field_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/repeated_ptr_field_unittest.cc @@ -8,10 +8,12 @@ #include "google/protobuf/repeated_ptr_field.h" #include <algorithm> +#include <csignal> #include <cstddef> #include <cstdint> #include <cstdlib> #include <cstring> +#include <iostream> #include <iterator> #include <list> #include <memory> @@ -22,6 +24,7 @@ #include <gmock/gmock.h> #include <gtest/gtest.h> +#include "absl/base/config.h" #include "absl/log/absl_check.h" #include "absl/numeric/bits.h" #include "absl/strings/str_cat.h" @@ -38,8 +41,8 @@ namespace google { namespace protobuf { namespace { -using ::protobuf_unittest::TestAllTypes; -using ::protobuf_unittest::TestMessageWithManyRepeatedPtrFields; +using ::proto2_unittest::TestAllTypes; +using ::proto2_unittest::TestMessageWithManyRepeatedPtrFields; using ::testing::A; using ::testing::AllOf; using ::testing::ElementsAre; @@ -458,37 +461,6 @@ TEST(RepeatedPtrField, ReserveDoesntLoseAllocated) { EXPECT_EQ(first, field.Add()); } -// Clearing elements is tricky with RepeatedPtrFields since the memory for -// the elements is retained and reused. -TEST(RepeatedPtrField, ClearedElements) { - PROTOBUF_IGNORE_DEPRECATION_START - RepeatedPtrField<std::string> field; - - std::string* original = field.Add(); - *original = "foo"; - - EXPECT_EQ(field.ClearedCount(), 0); - - field.RemoveLast(); - EXPECT_TRUE(original->empty()); - EXPECT_EQ(field.ClearedCount(), 1); - - EXPECT_EQ(field.Add(), - original); // Should return same string for reuse. - EXPECT_EQ(field.UnsafeArenaReleaseLast(), original); // We take ownership. - EXPECT_EQ(field.ClearedCount(), 0); - - EXPECT_NE(field.Add(), original); // Should NOT return the same string. - EXPECT_EQ(field.ClearedCount(), 0); - - field.UnsafeArenaAddAllocated(original); // Give ownership back. - EXPECT_EQ(field.ClearedCount(), 0); - EXPECT_EQ(field.Mutable(1), original); - - field.Clear(); - EXPECT_EQ(field.ClearedCount(), 2); - PROTOBUF_IGNORE_DEPRECATION_STOP -} // Test all code paths in AddAllocated(). TEST(RepeatedPtrField, AddAllocated) { @@ -512,7 +484,6 @@ TEST(RepeatedPtrField, AddAllocated) { std::string* foo = new std::string("foo"); field.AddAllocated(foo); EXPECT_EQ(index + 1, field.size()); - EXPECT_EQ(0, field.ClearedCount()); EXPECT_EQ(foo, &field.Get(index)); // Last branch: Field is not at capacity and there are no cleared objects. @@ -521,7 +492,6 @@ TEST(RepeatedPtrField, AddAllocated) { field.AddAllocated(bar); ++index; EXPECT_EQ(index + 1, field.size()); - EXPECT_EQ(0, field.ClearedCount()); EXPECT_EQ(bar, &field.Get(index)); // Third branch: Field is not at capacity and there are no cleared objects. @@ -530,7 +500,6 @@ TEST(RepeatedPtrField, AddAllocated) { std::string* baz = new std::string("baz"); field.AddAllocated(baz); EXPECT_EQ(index + 1, field.size()); - EXPECT_EQ(1, field.ClearedCount()); EXPECT_EQ(baz, &field.Get(index)); // Second branch: Field is at capacity but has some cleared objects. @@ -541,7 +510,6 @@ TEST(RepeatedPtrField, AddAllocated) { field.AddAllocated(moo); EXPECT_EQ(index + 1, field.size()); // We should have discarded the cleared object. - EXPECT_EQ(0, field.ClearedCount()); EXPECT_EQ(moo, &field.Get(index)); } @@ -937,7 +905,6 @@ TEST(RepeatedPtrField, ExtractSubrange) { EXPECT_EQ(field.size(), sz + extra); for (int i = 0; i < extra; ++i) field.RemoveLast(); EXPECT_EQ(field.size(), sz); - EXPECT_EQ(field.ClearedCount(), extra); // Create a catcher array and call ExtractSubrange. std::string* catcher[10]; @@ -959,9 +926,7 @@ TEST(RepeatedPtrField, ExtractSubrange) { EXPECT_EQ(field.Mutable(i), subject[i + num]); // Reinstate the cleared elements. - EXPECT_EQ(field.ClearedCount(), extra); for (int i = 0; i < extra; ++i) field.Add(); - EXPECT_EQ(field.ClearedCount(), 0); EXPECT_EQ(field.size(), sz - num + extra); // Make sure the extra elements are all there (in some order). @@ -997,6 +962,37 @@ TEST(RepeatedPtrField, Cleanups) { } +TEST(RepeatedPtrField, CheckedGetOrAbortTest) { + RepeatedPtrField<std::string> field; + + // Empty container tests. + EXPECT_DEATH(internal::CheckedGetOrAbort(field, -1), "index: -1, size: 0"); + EXPECT_DEATH(internal::CheckedGetOrAbort(field, field.size()), + "index: 0, size: 0"); + + // Non-empty container tests + field.Add()->assign("foo"); + field.Add()->assign("bar"); + EXPECT_DEATH(internal::CheckedGetOrAbort(field, 2), "index: 2, size: 2"); + EXPECT_DEATH(internal::CheckedGetOrAbort(field, -1), "index: -1, size: 2"); +} + +TEST(RepeatedPtrField, CheckedMutableOrAbortTest) { + RepeatedPtrField<std::string> field; + + // Empty container tests. + EXPECT_DEATH(internal::CheckedMutableOrAbort(&field, -1), + "index: -1, size: 0"); + EXPECT_DEATH(internal::CheckedMutableOrAbort(&field, field.size()), + "index: 0, size: 0"); + + // Non-empty container tests + field.Add()->assign("foo"); + field.Add()->assign("bar"); + EXPECT_DEATH(internal::CheckedMutableOrAbort(&field, 2), "index: 2, size: 2"); + EXPECT_DEATH(internal::CheckedMutableOrAbort(&field, -1), + "index: -1, size: 2"); +} // =================================================================== class RepeatedPtrFieldIteratorTest : public testing::Test { diff --git a/third_party/protobuf/src/google/protobuf/retention_test.cc b/third_party/protobuf/src/google/protobuf/retention_test.cc index 8b777699bb7ae..a43e0763da777 100644 --- a/third_party/protobuf/src/google/protobuf/retention_test.cc +++ b/third_party/protobuf/src/google/protobuf/retention_test.cc @@ -30,19 +30,19 @@ namespace { TEST(RetentionTest, DirectOptions) { const FileOptions& file_options = - protobuf_unittest::OptionsMessage::descriptor()->file()->options(); - EXPECT_EQ(file_options.GetExtension(protobuf_unittest::plain_option), 1); + proto2_unittest::OptionsMessage::descriptor()->file()->options(); + EXPECT_EQ(file_options.GetExtension(proto2_unittest::plain_option), 1); EXPECT_EQ( - file_options.GetExtension(protobuf_unittest::runtime_retention_option), 2); + file_options.GetExtension(proto2_unittest::runtime_retention_option), 2); // RETENTION_SOURCE option should be stripped. EXPECT_FALSE( - file_options.HasExtension(protobuf_unittest::source_retention_option)); - EXPECT_EQ(file_options.GetExtension(protobuf_unittest::source_retention_option), + file_options.HasExtension(proto2_unittest::source_retention_option)); + EXPECT_EQ(file_options.GetExtension(proto2_unittest::source_retention_option), 0); } void CheckOptionsMessageIsStrippedCorrectly( - const protobuf_unittest::OptionsMessage& options) { + const proto2_unittest::OptionsMessage& options) { EXPECT_EQ(options.plain_field(), 1); EXPECT_EQ(options.runtime_retention_field(), 2); // RETENTION_SOURCE field should be stripped. @@ -52,113 +52,113 @@ void CheckOptionsMessageIsStrippedCorrectly( TEST(RetentionTest, FieldsNestedInRepeatedMessage) { const FileOptions& file_options = - protobuf_unittest::OptionsMessage::descriptor()->file()->options(); - ASSERT_EQ(1, file_options.ExtensionSize(protobuf_unittest::repeated_options)); - const protobuf_unittest::OptionsMessage& options_message = - file_options.GetRepeatedExtension(protobuf_unittest::repeated_options)[0]; + proto2_unittest::OptionsMessage::descriptor()->file()->options(); + ASSERT_EQ(1, file_options.ExtensionSize(proto2_unittest::repeated_options)); + const proto2_unittest::OptionsMessage& options_message = + file_options.GetRepeatedExtension(proto2_unittest::repeated_options)[0]; CheckOptionsMessageIsStrippedCorrectly(options_message); } TEST(RetentionTest, File) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::OptionsMessage::descriptor() + proto2_unittest::OptionsMessage::descriptor() ->file() ->options() - .GetExtension(protobuf_unittest::file_option)); + .GetExtension(proto2_unittest::file_option)); } TEST(RetentionTest, TopLevelMessage) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor()->options().GetExtension( - protobuf_unittest::message_option)); + proto2_unittest::TopLevelMessage::descriptor()->options().GetExtension( + proto2_unittest::message_option)); } TEST(RetentionTest, NestedMessage) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::NestedMessage::descriptor() + proto2_unittest::TopLevelMessage::NestedMessage::descriptor() ->options() - .GetExtension(protobuf_unittest::message_option)); + .GetExtension(proto2_unittest::message_option)); } TEST(RetentionTest, TopLevelEnum) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelEnum_descriptor()->options().GetExtension( - protobuf_unittest::enum_option)); + proto2_unittest::TopLevelEnum_descriptor()->options().GetExtension( + proto2_unittest::enum_option)); } TEST(RetentionTest, NestedEnum) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::NestedEnum_descriptor() + proto2_unittest::TopLevelMessage::NestedEnum_descriptor() ->options() - .GetExtension(protobuf_unittest::enum_option)); + .GetExtension(proto2_unittest::enum_option)); } TEST(RetentionTest, EnumEntry) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelEnum_descriptor() + proto2_unittest::TopLevelEnum_descriptor() ->value(0) ->options() - .GetExtension(protobuf_unittest::enum_entry_option)); + .GetExtension(proto2_unittest::enum_entry_option)); } TEST(RetentionTest, TopLevelExtension) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor() + proto2_unittest::TopLevelMessage::descriptor() ->file() ->FindExtensionByName("i") ->options() - .GetExtension(protobuf_unittest::field_option)); + .GetExtension(proto2_unittest::field_option)); } TEST(RetentionTest, NestedExtension) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor() + proto2_unittest::TopLevelMessage::descriptor() ->extension(0) ->options() - .GetExtension(protobuf_unittest::field_option)); + .GetExtension(proto2_unittest::field_option)); } TEST(RetentionTest, Field) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor() + proto2_unittest::TopLevelMessage::descriptor() ->field(0) ->options() - .GetExtension(protobuf_unittest::field_option)); + .GetExtension(proto2_unittest::field_option)); } TEST(RetentionTest, Oneof) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor() + proto2_unittest::TopLevelMessage::descriptor() ->oneof_decl(0) ->options() - .GetExtension(protobuf_unittest::oneof_option)); + .GetExtension(proto2_unittest::oneof_option)); } TEST(RetentionTest, ExtensionRange) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor() + proto2_unittest::TopLevelMessage::descriptor() ->extension_range(0) ->options() - .GetExtension(protobuf_unittest::extension_range_option)); + .GetExtension(proto2_unittest::extension_range_option)); } TEST(RetentionTest, Service) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor() + proto2_unittest::TopLevelMessage::descriptor() ->file() ->service(0) ->options() - .GetExtension(protobuf_unittest::service_option)); + .GetExtension(proto2_unittest::service_option)); } TEST(RetentionTest, Method) { CheckOptionsMessageIsStrippedCorrectly( - protobuf_unittest::TopLevelMessage::descriptor() + proto2_unittest::TopLevelMessage::descriptor() ->file() ->service(0) ->method(0) ->options() - .GetExtension(protobuf_unittest::method_option)); + .GetExtension(proto2_unittest::method_option)); } class SimpleErrorCollector : public io::ErrorCollector { diff --git a/third_party/protobuf/src/google/protobuf/runtime_version.h b/third_party/protobuf/src/google/protobuf/runtime_version.h index e0680943a37ba..f2ad6502f55d0 100644 --- a/third_party/protobuf/src/google/protobuf/runtime_version.h +++ b/third_party/protobuf/src/google/protobuf/runtime_version.h @@ -18,7 +18,7 @@ #endif // PROTOBUF_OSS_VERSION_SUFFIX // The OSS versions are not stripped to avoid merging conflicts. -#define PROTOBUF_OSS_VERSION 5029003 +#define PROTOBUF_OSS_VERSION 6030001 #define PROTOBUF_OSS_VERSION_SUFFIX "" #define PROTOBUF_VERSION PROTOBUF_OSS_VERSION diff --git a/third_party/protobuf/src/google/protobuf/serial_arena.h b/third_party/protobuf/src/google/protobuf/serial_arena.h index 82c8ee343ab68..acd1b159d3eca 100644 --- a/third_party/protobuf/src/google/protobuf/serial_arena.h +++ b/third_party/protobuf/src/google/protobuf/serial_arena.h @@ -90,17 +90,17 @@ class PROTOBUF_EXPORT SerialArena { // See comments on `cached_blocks_` member for details. PROTOBUF_ALWAYS_INLINE void* TryAllocateFromCachedBlock(size_t size) { - if (PROTOBUF_PREDICT_FALSE(size < 16)) return nullptr; + if (ABSL_PREDICT_FALSE(size < 16)) return nullptr; // We round up to the next larger block in case the memory doesn't match // the pattern we are looking for. const size_t index = absl::bit_width(size - 1) - 4; - if (PROTOBUF_PREDICT_FALSE(index >= cached_block_length_)) return nullptr; + if (ABSL_PREDICT_FALSE(index >= cached_block_length_)) return nullptr; auto& cached_head = cached_blocks_[index]; if (cached_head == nullptr) return nullptr; void* ret = cached_head; - PROTOBUF_UNPOISON_MEMORY_REGION(ret, size); + internal::UnpoisonMemoryRegion(ret, size); cached_head = cached_head->next; return ret; } @@ -124,15 +124,14 @@ class PROTOBUF_EXPORT SerialArena { } void* ptr; - if (PROTOBUF_PREDICT_TRUE(MaybeAllocateAligned(n, &ptr))) { + if (ABSL_PREDICT_TRUE(MaybeAllocateAligned(n, &ptr))) { return ptr; } return AllocateAlignedFallback(n); } private: - static inline PROTOBUF_ALWAYS_INLINE constexpr size_t AlignUpTo(size_t n, - size_t a) { + static PROTOBUF_ALWAYS_INLINE constexpr size_t AlignUpTo(size_t n, size_t a) { // We are wasting space by over allocating align - 8 bytes. Compared to a // dedicated function that takes current alignment in consideration. Such a // scheme would only waste (align - 8)/2 bytes on average, but requires a @@ -141,7 +140,7 @@ class PROTOBUF_EXPORT SerialArena { return a <= 8 ? ArenaAlignDefault::Ceil(n) : ArenaAlignAs(a).Padded(n); } - static inline PROTOBUF_ALWAYS_INLINE void* AlignTo(void* p, size_t a) { + static PROTOBUF_ALWAYS_INLINE void* AlignTo(void* p, size_t a) { return (a <= ArenaAlignDefault::align) ? ArenaAlignDefault::CeilDefaultAligned(p) : ArenaAlignAs(a).CeilDefaultAligned(p); @@ -153,7 +152,7 @@ class PROTOBUF_EXPORT SerialArena { // In 64-bit platforms the minimum allocation size from Repeated*Field will // be 16 guaranteed. if (sizeof(void*) < 8) { - if (PROTOBUF_PREDICT_FALSE(size < 16)) return; + if (ABSL_PREDICT_FALSE(size < 16)) return; } else { PROTOBUF_ASSUME(size >= 16); } @@ -163,7 +162,7 @@ class PROTOBUF_EXPORT SerialArena { // on the repeated field. const size_t index = absl::bit_width(size) - 5; - if (PROTOBUF_PREDICT_FALSE(index >= cached_block_length_)) { + if (ABSL_PREDICT_FALSE(index >= cached_block_length_)) { // We can't put this object on the freelist so make this object the // freelist. It is guaranteed it is larger than the one we have, and // large enough to hold another allocation of `size`. @@ -175,7 +174,7 @@ class PROTOBUF_EXPORT SerialArena { // We need to unpoison this memory before filling it in case it has been // poisoned by another sanitizer client. - PROTOBUF_UNPOISON_MEMORY_REGION( + internal::UnpoisonMemoryRegion( new_list + cached_block_length_, (new_size - cached_block_length_) * sizeof(CachedBlock*)); @@ -194,7 +193,7 @@ class PROTOBUF_EXPORT SerialArena { auto* new_node = static_cast<CachedBlock*>(p); new_node->next = cached_head; cached_head = new_node; - PROTOBUF_POISON_MEMORY_REGION(p, size); + internal::PoisonMemoryRegion(p, size); } public: @@ -206,11 +205,11 @@ class PROTOBUF_EXPORT SerialArena { // ret + n may point out of the block bounds, or ret may be nullptr. // Both computations have undefined behavior when done on pointers, // so do them on uintptr_t instead. - if (PROTOBUF_PREDICT_FALSE(reinterpret_cast<uintptr_t>(ret) + n > - reinterpret_cast<uintptr_t>(limit_))) { + if (ABSL_PREDICT_FALSE(reinterpret_cast<uintptr_t>(ret) + n > + reinterpret_cast<uintptr_t>(limit_))) { return false; } - PROTOBUF_UNPOISON_MEMORY_REGION(ret, n); + internal::UnpoisonMemoryRegion(ret, n); *out = ret; char* next = ret + n; set_ptr(next); @@ -232,11 +231,11 @@ class PROTOBUF_EXPORT SerialArena { n = ArenaAlignDefault::Ceil(n); char* ret = ArenaAlignAs(align).CeilDefaultAligned(ptr()); // See the comment in MaybeAllocateAligned re uintptr_t. - if (PROTOBUF_PREDICT_FALSE(reinterpret_cast<uintptr_t>(ret) + n > - reinterpret_cast<uintptr_t>(limit_))) { + if (ABSL_PREDICT_FALSE(reinterpret_cast<uintptr_t>(ret) + n > + reinterpret_cast<uintptr_t>(limit_))) { return AllocateAlignedWithCleanupFallback(n, align, destructor); } - PROTOBUF_UNPOISON_MEMORY_REGION(ret, n); + internal::UnpoisonMemoryRegion(ret, n); char* next = ret + n; set_ptr(next); AddCleanup(ret, destructor); @@ -284,9 +283,9 @@ class PROTOBUF_EXPORT SerialArena { static const char* MaybePrefetchImpl(const ptrdiff_t prefetch_degree, const char* next, const char* limit, const char* prefetch_ptr) { - if (PROTOBUF_PREDICT_TRUE(prefetch_ptr - next > prefetch_degree)) + if (ABSL_PREDICT_TRUE(prefetch_ptr - next > prefetch_degree)) return prefetch_ptr; - if (PROTOBUF_PREDICT_TRUE(prefetch_ptr < limit)) { + if (ABSL_PREDICT_TRUE(prefetch_ptr < limit)) { prefetch_ptr = std::max(next, prefetch_ptr); ABSL_DCHECK(prefetch_ptr != nullptr); const char* end = std::min(limit, prefetch_ptr + prefetch_degree); @@ -409,10 +408,10 @@ class PROTOBUF_EXPORT SerialArena { CachedBlock** cached_blocks_ = nullptr; }; -inline PROTOBUF_ALWAYS_INLINE bool SerialArena::MaybeAllocateString(void*& p) { +PROTOBUF_ALWAYS_INLINE bool SerialArena::MaybeAllocateString(void*& p) { // Check how many unused instances are in the current block. size_t unused_bytes = string_block_unused_.load(std::memory_order_relaxed); - if (PROTOBUF_PREDICT_TRUE(unused_bytes != 0)) { + if (ABSL_PREDICT_TRUE(unused_bytes != 0)) { unused_bytes -= sizeof(std::string); string_block_unused_.store(unused_bytes, std::memory_order_relaxed); p = string_block_.load(std::memory_order_relaxed)->AtOffset(unused_bytes); @@ -421,7 +420,7 @@ inline PROTOBUF_ALWAYS_INLINE bool SerialArena::MaybeAllocateString(void*& p) { return false; } -ABSL_ATTRIBUTE_RETURNS_NONNULL inline PROTOBUF_ALWAYS_INLINE void* +ABSL_ATTRIBUTE_RETURNS_NONNULL PROTOBUF_ALWAYS_INLINE void* SerialArena::AllocateFromStringBlock() { void* p; if (ABSL_PREDICT_TRUE(MaybeAllocateString(p))) return p; diff --git a/third_party/protobuf/src/google/protobuf/source_context.pb.cc b/third_party/protobuf/src/google/protobuf/source_context.pb.cc index 2c6530857a436..02f182c95fc27 100644 --- a/third_party/protobuf/src/google/protobuf/source_context.pb.cc +++ b/third_party/protobuf/src/google/protobuf/source_context.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/source_context.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/source_context.pb.h" @@ -29,15 +29,15 @@ namespace protobuf { inline constexpr SourceContext::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : file_name_( + : _cached_size_{0}, + file_name_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template <typename> PROTOBUF_CONSTEXPR SourceContext::SourceContext(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(SourceContext_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -55,14 +55,14 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 SourceContextDefaultTypeInternal _SourceContext_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceContext, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceContext, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -71,13 +71,14 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceContext, _impl_.file_name_), + 0, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::SourceContext)}, + {0, 9, -1, sizeof(::google::protobuf::SourceContext)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_SourceContext_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2fsource_5fcontext_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -112,28 +113,34 @@ namespace protobuf { class SourceContext::_Internal { public: + using HasBits = + decltype(std::declval<SourceContext>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(SourceContext, _impl_._has_bits_); }; -SourceContext::SourceContext(::google::protobuf::Arena* arena) +SourceContext::SourceContext(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, SourceContext_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.SourceContext) } -inline PROTOBUF_NDEBUG_INLINE SourceContext::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::SourceContext& from_msg) - : file_name_(arena, from.file_name_), - _cached_size_{0} {} +PROTOBUF_NDEBUG_INLINE SourceContext::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::SourceContext& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + file_name_(arena, from.file_name_) {} SourceContext::SourceContext( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SourceContext& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, SourceContext_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -145,13 +152,13 @@ SourceContext::SourceContext( // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext) } -inline PROTOBUF_NDEBUG_INLINE SourceContext::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE SourceContext::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : file_name_(arena), - _cached_size_{0} {} + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + file_name_(arena) {} -inline void SourceContext::SharedCtor(::_pb::Arena* arena) { +inline void SourceContext::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } SourceContext::~SourceContext() { @@ -166,45 +173,53 @@ inline void SourceContext::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* SourceContext::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL SourceContext::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) SourceContext(arena); } constexpr auto SourceContext::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(SourceContext), alignof(SourceContext)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull SourceContext::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_SourceContext_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &SourceContext::MergeImpl, - ::google::protobuf::Message::GetNewImpl<SourceContext>(), +constexpr auto SourceContext::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_SourceContext_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &SourceContext::MergeImpl, + ::google::protobuf::Message::GetNewImpl<SourceContext>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &SourceContext::SharedDtor, - ::google::protobuf::Message::GetClearImpl<SourceContext>(), &SourceContext::ByteSizeLong, - &SourceContext::_InternalSerialize, + &SourceContext::SharedDtor, + ::google::protobuf::Message::GetClearImpl<SourceContext>(), &SourceContext::ByteSizeLong, + &SourceContext::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(SourceContext, _impl_._cached_size_), - false, - }, - &SourceContext::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* SourceContext::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(SourceContext, _impl_._cached_size_), + false, + }, + &SourceContext::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + SourceContext_class_data_ = + SourceContext::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL SourceContext::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&SourceContext_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(SourceContext_class_data_.tc_table); + return SourceContext_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 47, 2> SourceContext::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 47, 2> +SourceContext::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(SourceContext, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -213,7 +228,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 47, 2> SourceContext::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + SourceContext_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -222,13 +237,13 @@ const ::_pbi::TcParseTable<0, 1, 0, 47, 2> SourceContext::_table_ = { }, {{ // string file_name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_)}}, }}, {{ 65535, 65535 }}, {{ // string file_name = 1; - {PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(SourceContext, _impl_.file_name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -237,7 +252,6 @@ const ::_pbi::TcParseTable<0, 1, 0, 47, 2> SourceContext::_table_ = { "file_name" }}, }; - PROTOBUF_NOINLINE void SourceContext::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceContext) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -245,66 +259,75 @@ PROTOBUF_NOINLINE void SourceContext::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.file_name_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.file_name_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* SourceContext::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const SourceContext& this_ = static_cast<const SourceContext&>(base); +::uint8_t* PROTOBUF_NONNULL SourceContext::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const SourceContext& this_ = static_cast<const SourceContext&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* SourceContext::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const SourceContext& this_ = *this; +::uint8_t* PROTOBUF_NONNULL SourceContext::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const SourceContext& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceContext) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceContext) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string file_name = 1; - if (!this_._internal_file_name().empty()) { - const std::string& _s = this_._internal_file_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.SourceContext.file_name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string file_name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_file_name().empty()) { + const std::string& _s = this_._internal_file_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.SourceContext.file_name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceContext) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceContext) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t SourceContext::ByteSizeLong(const MessageLite& base) { - const SourceContext& this_ = static_cast<const SourceContext&>(base); +::size_t SourceContext::ByteSizeLong(const MessageLite& base) { + const SourceContext& this_ = static_cast<const SourceContext&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t SourceContext::ByteSizeLong() const { - const SourceContext& this_ = *this; +::size_t SourceContext::ByteSizeLong() const { + const SourceContext& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceContext) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceContext) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // string file_name = 1; - if (!this_._internal_file_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_file_name()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // string file_name = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_file_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_file_name()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void SourceContext::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<SourceContext*>(&to_msg); @@ -314,9 +337,17 @@ void SourceContext::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::g ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_file_name().empty()) { - _this->_internal_set_file_name(from._internal_file_name()); + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_file_name().empty()) { + _this->_internal_set_file_name(from._internal_file_name()); + } else { + if (_this->_impl_.file_name_.IsDefault()) { + _this->_internal_set_file_name(""); + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -328,11 +359,12 @@ void SourceContext::CopyFrom(const SourceContext& from) { } -void SourceContext::InternalSwap(SourceContext* PROTOBUF_RESTRICT other) { +void SourceContext::InternalSwap(SourceContext* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.file_name_, &other->_impl_.file_name_, arena); } @@ -348,7 +380,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/source_context.pb.h b/third_party/protobuf/src/google/protobuf/source_context.pb.h index e2a37b2f80208..268ffacccc297 100644 --- a/third_party/protobuf/src/google/protobuf/source_context.pb.h +++ b/third_party/protobuf/src/google/protobuf/source_context.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/source_context.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fsource_5fcontext_2eproto_2epb_2eh #define google_2fprotobuf_2fsource_5fcontext_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -49,13 +49,15 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto; +} // extern "C" namespace google { namespace protobuf { class SourceContext; struct SourceContextDefaultTypeInternal; PROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull SourceContext_class_data_; } // namespace protobuf } // namespace google @@ -74,15 +76,14 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message ~SourceContext() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(SourceContext* msg, std::destroying_delete_t) { + void operator delete(SourceContext* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(SourceContext)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR SourceContext( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR SourceContext(::google::protobuf::internal::ConstantInitialized); inline SourceContext(const SourceContext& from) : SourceContext(nullptr, from) {} inline SourceContext(SourceContext&& from) noexcept @@ -105,30 +106,27 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const SourceContext& default_instance() { - return *internal_default_instance(); - } - static inline const SourceContext* internal_default_instance() { - return reinterpret_cast<const SourceContext*>( + return *reinterpret_cast<const SourceContext*>( &_SourceContext_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(SourceContext& a, SourceContext& b) { a.Swap(&b); } - inline void Swap(SourceContext* other) { + inline void Swap(SourceContext* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -136,7 +134,7 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(SourceContext* other) { + void UnsafeArenaSwap(SourceContext* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -144,7 +142,7 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - SourceContext* New(::google::protobuf::Arena* arena = nullptr) const { + SourceContext* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<SourceContext>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -153,9 +151,8 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message void MergeFrom(const SourceContext& from) { SourceContext::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -165,49 +162,51 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(SourceContext* other); + void InternalSwap(SourceContext* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.SourceContext"; } protected: - explicit SourceContext(::google::protobuf::Arena* arena); - SourceContext(::google::protobuf::Arena* arena, const SourceContext& from); - SourceContext(::google::protobuf::Arena* arena, SourceContext&& from) noexcept + explicit SourceContext(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + SourceContext(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SourceContext& from); + SourceContext( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, SourceContext&& from) noexcept : SourceContext(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -220,24 +219,23 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message const std::string& file_name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_file_name(Arg_&& arg, Args_... args); - std::string* mutable_file_name(); - PROTOBUF_NODISCARD std::string* release_file_name(); - void set_allocated_file_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_file_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_file_name(); + void set_allocated_file_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_file_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_file_name( - const std::string& value); - std::string* _internal_mutable_file_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_file_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_file_name(); public: // @@protoc_insertion_point(class_scope:google.protobuf.SourceContext) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 47, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 47, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -247,21 +245,25 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const SourceContext& from_msg); - ::google::protobuf::internal::ArenaStringPtr file_name_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const SourceContext& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr file_name_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull SourceContext_class_data_; + // =================================================================== @@ -282,6 +284,7 @@ class PROTOBUF_EXPORT SourceContext final : public ::google::protobuf::Message inline void SourceContext::clear_file_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.file_name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& SourceContext::file_name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -289,13 +292,14 @@ inline const std::string& SourceContext::file_name() const return _internal_file_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void SourceContext::set_file_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void SourceContext::set_file_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.file_name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name) } -inline std::string* SourceContext::mutable_file_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL SourceContext::mutable_file_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_file_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.SourceContext.file_name) return _s; @@ -306,19 +310,34 @@ inline const std::string& SourceContext::_internal_file_name() const { } inline void SourceContext::_internal_set_file_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.file_name_.Set(value, GetArena()); } -inline std::string* SourceContext::_internal_mutable_file_name() { +inline std::string* PROTOBUF_NONNULL SourceContext::_internal_mutable_file_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.file_name_.Mutable( GetArena()); } -inline std::string* SourceContext::release_file_name() { +inline std::string* PROTOBUF_NULLABLE SourceContext::release_file_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.SourceContext.file_name) - return _impl_.file_name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.file_name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.file_name_.Set("", GetArena()); + } + return released; } -inline void SourceContext::set_allocated_file_name(std::string* value) { +inline void SourceContext::set_allocated_file_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.file_name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.file_name_.IsDefault()) { _impl_.file_name_.Set("", GetArena()); diff --git a/third_party/protobuf/src/google/protobuf/string_view_test.cc b/third_party/protobuf/src/google/protobuf/string_view_test.cc index d348f1fbee871..9c6674203dec1 100644 --- a/third_party/protobuf/src/google/protobuf/string_view_test.cc +++ b/third_party/protobuf/src/google/protobuf/string_view_test.cc @@ -19,7 +19,7 @@ namespace google { namespace protobuf { namespace { -using ::protobuf_unittest::TestStringView; +using ::proto2_unittest::TestStringView; using ::testing::ElementsAre; using ::testing::StrEq; @@ -311,6 +311,13 @@ TEST(StringViewFieldTest, RepeatedSetAndGetByReflection) { StrEq("222222222222")); } +TEST(StringViewFieldTest, MergeAndClearEmptyImplicitPresence) { + TestStringView message, other; + other.set_implicit_presence(""); + message.MergeFrom(other); + message.Clear(); +} + } // namespace } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/struct.pb.cc b/third_party/protobuf/src/google/protobuf/struct.pb.cc index 289b032f67ee8..2ccd2ecfac94c 100644 --- a/third_party/protobuf/src/google/protobuf/struct.pb.cc +++ b/third_party/protobuf/src/google/protobuf/struct.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/struct.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/struct.pb.h" @@ -35,7 +35,7 @@ inline constexpr ListValue::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR ListValue::ListValue(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(ListValue_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -60,7 +60,7 @@ inline constexpr Struct::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR Struct::Struct(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Struct_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -76,10 +76,10 @@ struct StructDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StructDefaultTypeInternal _Struct_default_instance_; - template <typename> +template <typename> PROTOBUF_CONSTEXPR Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : Struct_FieldsEntry_DoNotUse::MapEntry(_class_data_.base()){} + : Struct_FieldsEntry_DoNotUse::MapEntry(Struct_FieldsEntry_DoNotUse_class_data_.base()){} #else // PROTOBUF_CUSTOM_VTABLE : Struct_FieldsEntry_DoNotUse::MapEntry() { } @@ -104,7 +104,7 @@ inline constexpr Value::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR Value::Value(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Value_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -122,8 +122,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ValueDefaultTypeInternal _Value_default_instance_; } // namespace protobuf } // namespace google -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[1]; -static constexpr const ::_pb::ServiceDescriptor** +static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL + file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[1]; +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fstruct_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -182,7 +183,7 @@ static const ::_pbi::MigrationSchema {21, -1, -1, sizeof(::google::protobuf::Value)}, {36, -1, -1, sizeof(::google::protobuf::ListValue)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_Struct_FieldsEntry_DoNotUse_default_instance_._instance, &::google::protobuf::_Struct_default_instance_._instance, &::google::protobuf::_Value_default_instance_._instance, @@ -226,64 +227,69 @@ PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fproto }; namespace google { namespace protobuf { -const ::google::protobuf::EnumDescriptor* NullValue_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL NullValue_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fstruct_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[0]; } PROTOBUF_CONSTINIT const uint32_t NullValue_internal_data_[] = { 65536u, 0u, }; -bool NullValue_IsValid(int value) { - return 0 <= value && value <= 0; -} // =================================================================== #if defined(PROTOBUF_CUSTOM_VTABLE) - Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse() : SuperType(_class_data_.base()) {} - Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena) - : SuperType(arena, _class_data_.base()) {} +Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse() + : SuperType(Struct_FieldsEntry_DoNotUse_class_data_.base()) {} +Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : SuperType(arena, Struct_FieldsEntry_DoNotUse_class_data_.base()) {} #else // PROTOBUF_CUSTOM_VTABLE - Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse() : SuperType() {} - Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena) : SuperType(arena) {} +Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse() : SuperType() {} +Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : SuperType(arena) {} #endif // PROTOBUF_CUSTOM_VTABLE - inline void* Struct_FieldsEntry_DoNotUse::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { - return ::new (mem) Struct_FieldsEntry_DoNotUse(arena); - } - constexpr auto Struct_FieldsEntry_DoNotUse::InternalNewImpl_() { - return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Struct_FieldsEntry_DoNotUse), - alignof(Struct_FieldsEntry_DoNotUse)); - } - PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 - const ::google::protobuf::internal::ClassDataFull Struct_FieldsEntry_DoNotUse::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Struct_FieldsEntry_DoNotUse_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Struct_FieldsEntry_DoNotUse::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Struct_FieldsEntry_DoNotUse>(), - #if defined(PROTOBUF_CUSTOM_VTABLE) - &Struct_FieldsEntry_DoNotUse::SharedDtor, - static_cast<void (::google::protobuf::MessageLite::*)()>( - &Struct_FieldsEntry_DoNotUse::ClearImpl), - ::google::protobuf::Message::ByteSizeLongImpl, ::google::protobuf::Message::_InternalSerializeImpl - , - #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_._cached_size_), - false, - }, - &Struct_FieldsEntry_DoNotUse::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fstruct_2eproto, - nullptr, // tracker - }; - const ::google::protobuf::internal::ClassData* Struct_FieldsEntry_DoNotUse::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); - } +inline void* PROTOBUF_NONNULL Struct_FieldsEntry_DoNotUse::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { + return ::new (mem) Struct_FieldsEntry_DoNotUse(arena); +} +constexpr auto Struct_FieldsEntry_DoNotUse::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Struct_FieldsEntry_DoNotUse), + alignof(Struct_FieldsEntry_DoNotUse)); +} +constexpr auto Struct_FieldsEntry_DoNotUse::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Struct_FieldsEntry_DoNotUse_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Struct_FieldsEntry_DoNotUse::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Struct_FieldsEntry_DoNotUse>(), +#if defined(PROTOBUF_CUSTOM_VTABLE) + &Struct_FieldsEntry_DoNotUse::SharedDtor, + static_cast<void (::google::protobuf::MessageLite::*)()>(&Struct_FieldsEntry_DoNotUse::ClearImpl), + ::google::protobuf::Message::ByteSizeLongImpl, ::google::protobuf::Message::_InternalSerializeImpl + , +#endif // PROTOBUF_CUSTOM_VTABLE + PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_._cached_size_), + false, + }, + &Struct_FieldsEntry_DoNotUse::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fstruct_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Struct_FieldsEntry_DoNotUse_class_data_ = + Struct_FieldsEntry_DoNotUse::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Struct_FieldsEntry_DoNotUse::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Struct_FieldsEntry_DoNotUse_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Struct_FieldsEntry_DoNotUse_class_data_.tc_table); + return Struct_FieldsEntry_DoNotUse_class_data_.base(); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 1, 46, 2> Struct_FieldsEntry_DoNotUse::_table_ = { +const ::_pbi::TcParseTable<1, 2, 1, 46, 2> +Struct_FieldsEntry_DoNotUse::_table_ = { { PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_._has_bits_), 0, // no _extensions_ @@ -294,7 +300,7 @@ const ::_pbi::TcParseTable<1, 2, 1, 46, 2> Struct_FieldsEntry_DoNotUse::_table_ 2, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Struct_FieldsEntry_DoNotUse_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::DiscardEverythingFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -303,54 +309,56 @@ const ::_pbi::TcParseTable<1, 2, 1, 46, 2> Struct_FieldsEntry_DoNotUse::_table_ }, {{ // .google.protobuf.Value value = 2; {::_pbi::TcParser::FastMtS1, - {18, 0, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_)}}, // string key = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_)}}, }}, {{ 65535, 65535 }}, {{ // string key = 1; - {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.key_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // .google.protobuf.Value value = 2; - {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + {PROTOBUF_FIELD_OFFSET(Struct_FieldsEntry_DoNotUse, _impl_.value_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Value>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Value>()}, + }}, + {{ "\42\3\0\0\0\0\0\0" "google.protobuf.Struct.FieldsEntry" "key" }}, }; - // =================================================================== class Struct::_Internal { public: }; -Struct::Struct(::google::protobuf::Arena* arena) +Struct::Struct(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Struct_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Struct) } -inline PROTOBUF_NDEBUG_INLINE Struct::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Struct& from_msg) +PROTOBUF_NDEBUG_INLINE Struct::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Struct& from_msg) : fields_{visibility, arena, from.fields_}, _cached_size_{0} {} Struct::Struct( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Struct& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Struct_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -362,13 +370,13 @@ Struct::Struct( // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct) } -inline PROTOBUF_NDEBUG_INLINE Struct::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Struct::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : fields_{visibility, arena}, _cached_size_{0} {} -inline void Struct::SharedCtor(::_pb::Arena* arena) { +inline void Struct::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } Struct::~Struct() { @@ -382,8 +390,9 @@ inline void Struct::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Struct::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Struct::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Struct(arena); } constexpr auto Struct::InternalNewImpl_() { @@ -406,35 +415,42 @@ constexpr auto Struct::InternalNewImpl_() { alignof(Struct)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Struct::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Struct_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Struct::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Struct>(), +constexpr auto Struct::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Struct_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Struct::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Struct>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Struct::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Struct>(), &Struct::ByteSizeLong, - &Struct::_InternalSerialize, + &Struct::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Struct>(), &Struct::ByteSizeLong, + &Struct::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Struct, _impl_._cached_size_), - false, - }, - &Struct::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fstruct_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Struct::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Struct, _impl_._cached_size_), + false, + }, + &Struct::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fstruct_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Struct_class_data_ = + Struct::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Struct::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Struct_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Struct_class_data_.tc_table); + return Struct_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 2, 37, 2> Struct::_table_ = { +const ::_pbi::TcParseTable<0, 1, 2, 37, 2> +Struct::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -445,7 +461,7 @@ const ::_pbi::TcParseTable<0, 1, 2, 37, 2> Struct::_table_ = { 1, // num_field_entries 2, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Struct_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -459,19 +475,19 @@ const ::_pbi::TcParseTable<0, 1, 2, 37, 2> Struct::_table_ = { // map<string, .google.protobuf.Value> fields = 1; {PROTOBUF_FIELD_OFFSET(Struct, _impl_.fields_), 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMap)}, - }}, {{ - {::_pbi::TcParser::GetMapAuxInfo< - decltype(Struct()._impl_.fields_)>( - 1, 0, 0, 9, - 11)}, - {::_pbi::TcParser::GetTable<::google::protobuf::Value>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetMapAuxInfo(1, 0, 0, + 9, 11, + 0)}, + {::_pbi::TcParser::GetTable<::google::protobuf::Value>()}, + }}, + {{ "\26\6\0\0\0\0\0\0" "google.protobuf.Struct" "fields" }}, }; - PROTOBUF_NOINLINE void Struct::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Struct) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -484,86 +500,86 @@ PROTOBUF_NOINLINE void Struct::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Struct::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Struct& this_ = static_cast<const Struct&>(base); +::uint8_t* PROTOBUF_NONNULL Struct::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Struct& this_ = static_cast<const Struct&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Struct::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Struct& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Struct::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Struct& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // map<string, .google.protobuf.Value> fields = 1; - if (!this_._internal_fields().empty()) { - using MapType = ::google::protobuf::Map<std::string, ::google::protobuf::Value>; - using WireHelper = _pbi::MapEntryFuncs<std::string, ::google::protobuf::Value, - _pbi::WireFormatLite::TYPE_STRING, - _pbi::WireFormatLite::TYPE_MESSAGE>; - const auto& field = this_._internal_fields(); + // map<string, .google.protobuf.Value> fields = 1; + if (!this_._internal_fields().empty()) { + using MapType = ::google::protobuf::Map<std::string, ::google::protobuf::Value>; + using WireHelper = _pbi::MapEntryFuncs<std::string, ::google::protobuf::Value, + _pbi::WireFormatLite::TYPE_STRING, + _pbi::WireFormatLite::TYPE_MESSAGE>; + const auto& field = this_._internal_fields(); - if (stream->IsSerializationDeterministic() && field.size() > 1) { - for (const auto& entry : ::google::protobuf::internal::MapSorterPtr<MapType>(field)) { - target = WireHelper::InternalSerialize( - 1, entry.first, entry.second, target, stream); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - entry.first.data(), static_cast<int>(entry.first.length()), + if (stream->IsSerializationDeterministic() && field.size() > 1) { + for (const auto& entry : ::google::protobuf::internal::MapSorterPtr<MapType>(field)) { + target = WireHelper::InternalSerialize( + 1, entry.first, entry.second, target, stream); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + entry.first.data(), static_cast<int>(entry.first.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Struct.fields"); - } - } else { - for (const auto& entry : field) { - target = WireHelper::InternalSerialize( - 1, entry.first, entry.second, target, stream); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - entry.first.data(), static_cast<int>(entry.first.length()), + } + } else { + for (const auto& entry : field) { + target = WireHelper::InternalSerialize( + 1, entry.first, entry.second, target, stream); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + entry.first.data(), static_cast<int>(entry.first.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Struct.fields"); - } - } - } + } + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Struct) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Struct) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Struct::ByteSizeLong(const MessageLite& base) { - const Struct& this_ = static_cast<const Struct&>(base); +::size_t Struct::ByteSizeLong(const MessageLite& base) { + const Struct& this_ = static_cast<const Struct&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Struct::ByteSizeLong() const { - const Struct& this_ = *this; +::size_t Struct::ByteSizeLong() const { + const Struct& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Struct) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Struct) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // map<string, .google.protobuf.Value> fields = 1; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_fields_size()); - for (const auto& entry : this_._internal_fields()) { - total_size += _pbi::MapEntryFuncs<std::string, ::google::protobuf::Value, - _pbi::WireFormatLite::TYPE_STRING, - _pbi::WireFormatLite::TYPE_MESSAGE>::ByteSizeLong(entry.first, entry.second); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // map<string, .google.protobuf.Value> fields = 1; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_fields_size()); + for (const auto& entry : this_._internal_fields()) { + total_size += _pbi::MapEntryFuncs<std::string, ::google::protobuf::Value, + _pbi::WireFormatLite::TYPE_STRING, + _pbi::WireFormatLite::TYPE_MESSAGE>::ByteSizeLong(entry.first, entry.second); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Struct::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Struct*>(&to_msg); @@ -585,7 +601,7 @@ void Struct::CopyFrom(const Struct& from) { } -void Struct::InternalSwap(Struct* PROTOBUF_RESTRICT other) { +void Struct::InternalSwap(Struct* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); _impl_.fields_.InternalSwap(&other->_impl_.fields_); @@ -602,7 +618,7 @@ class Value::_Internal { PROTOBUF_FIELD_OFFSET(::google::protobuf::Value, _impl_._oneof_case_); }; -void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) { +void Value::set_allocated_struct_value(::google::protobuf::Struct* PROTOBUF_NULLABLE struct_value) { ::google::protobuf::Arena* message_arena = GetArena(); clear_kind(); if (struct_value) { @@ -615,7 +631,7 @@ void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) } // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value) } -void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) { +void Value::set_allocated_list_value(::google::protobuf::ListValue* PROTOBUF_NULLABLE list_value) { ::google::protobuf::Arena* message_arena = GetArena(); clear_kind(); if (list_value) { @@ -628,27 +644,28 @@ void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) } // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value) } -Value::Value(::google::protobuf::Arena* arena) +Value::Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Value_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Value) } -inline PROTOBUF_NDEBUG_INLINE Value::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Value& from_msg) +PROTOBUF_NDEBUG_INLINE Value::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Value& from_msg) : kind_{}, _cached_size_{0}, _oneof_case_{from._oneof_case_[0]} {} Value::Value( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Value& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Value_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -673,23 +690,23 @@ Value::Value( _impl_.kind_.bool_value_ = from._impl_.kind_.bool_value_; break; case kStructValue: - _impl_.kind_.struct_value_ = ::google::protobuf::Message::CopyConstruct<::google::protobuf::Struct>(arena, *from._impl_.kind_.struct_value_); + _impl_.kind_.struct_value_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.kind_.struct_value_); break; case kListValue: - _impl_.kind_.list_value_ = ::google::protobuf::Message::CopyConstruct<::google::protobuf::ListValue>(arena, *from._impl_.kind_.list_value_); + _impl_.kind_.list_value_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.kind_.list_value_); break; } // @@protoc_insertion_point(copy_constructor:google.protobuf.Value) } -inline PROTOBUF_NDEBUG_INLINE Value::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Value::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : kind_{}, _cached_size_{0}, _oneof_case_{} {} -inline void Value::SharedCtor(::_pb::Arena* arena) { +inline void Value::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } Value::~Value() { @@ -750,43 +767,51 @@ void Value::clear_kind() { } -inline void* Value::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Value::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Value(arena); } constexpr auto Value::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(Value), alignof(Value)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Value::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Value_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Value::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Value>(), +constexpr auto Value::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Value_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Value::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Value>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Value::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Value>(), &Value::ByteSizeLong, - &Value::_InternalSerialize, + &Value::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Value>(), &Value::ByteSizeLong, + &Value::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Value, _impl_._cached_size_), - false, - }, - &Value::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fstruct_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Value::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Value, _impl_._cached_size_), + false, + }, + &Value::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fstruct_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Value_class_data_ = + Value::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Value::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Value_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Value_class_data_.tc_table); + return Value_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 6, 2, 42, 2> Value::_table_ = { +const ::_pbi::TcParseTable<0, 6, 2, 42, 2> +Value::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -797,7 +822,7 @@ const ::_pbi::TcParseTable<0, 6, 2, 42, 2> Value::_table_ = { 6, // num_field_entries 2, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Value_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -826,16 +851,17 @@ const ::_pbi::TcParseTable<0, 6, 2, 42, 2> Value::_table_ = { // .google.protobuf.ListValue list_value = 6; {PROTOBUF_FIELD_OFFSET(Value, _impl_.kind_.list_value_), _Internal::kOneofCaseOffset + 0, 1, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Struct>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::ListValue>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Struct>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::ListValue>()}, + }}, + {{ "\25\0\0\14\0\0\0\0" "google.protobuf.Value" "string_value" }}, }; - PROTOBUF_NOINLINE void Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Value) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -848,126 +874,126 @@ PROTOBUF_NOINLINE void Value::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Value::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Value& this_ = static_cast<const Value&>(base); +::uint8_t* PROTOBUF_NONNULL Value::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Value& this_ = static_cast<const Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Value::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Value& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Value::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - switch (this_.kind_case()) { - case kNullValue: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this_._internal_null_value(), target); - break; - } - case kNumberValue: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 2, this_._internal_number_value(), target); - break; - } - case kStringValue: { - const std::string& _s = this_._internal_string_value(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Value.string_value"); - target = stream->WriteStringMaybeAliased(3, _s, target); - break; - } - case kBoolValue: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 4, this_._internal_bool_value(), target); - break; - } - case kStructValue: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.kind_.struct_value_, this_._impl_.kind_.struct_value_->GetCachedSize(), target, - stream); - break; - } - case kListValue: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, *this_._impl_.kind_.list_value_, this_._impl_.kind_.list_value_->GetCachedSize(), target, - stream); - break; - } - default: - break; - } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Value) - return target; - } + switch (this_.kind_case()) { + case kNullValue: { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this_._internal_null_value(), target); + break; + } + case kNumberValue: { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteDoubleToArray( + 2, this_._internal_number_value(), target); + break; + } + case kStringValue: { + const std::string& _s = this_._internal_string_value(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Value.string_value"); + target = stream->WriteStringMaybeAliased(3, _s, target); + break; + } + case kBoolValue: { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 4, this_._internal_bool_value(), target); + break; + } + case kStructValue: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 5, *this_._impl_.kind_.struct_value_, this_._impl_.kind_.struct_value_->GetCachedSize(), target, + stream); + break; + } + case kListValue: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 6, *this_._impl_.kind_.list_value_, this_._impl_.kind_.list_value_->GetCachedSize(), target, + stream); + break; + } + default: + break; + } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Value) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Value::ByteSizeLong(const MessageLite& base) { - const Value& this_ = static_cast<const Value&>(base); +::size_t Value::ByteSizeLong(const MessageLite& base) { + const Value& this_ = static_cast<const Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Value::ByteSizeLong() const { - const Value& this_ = *this; +::size_t Value::ByteSizeLong() const { + const Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Value) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Value) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - switch (this_.kind_case()) { - // .google.protobuf.NullValue null_value = 1; - case kNullValue: { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_null_value()); - break; - } - // double number_value = 2; - case kNumberValue: { - total_size += 9; - break; - } - // string string_value = 3; - case kStringValue: { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_string_value()); - break; - } - // bool bool_value = 4; - case kBoolValue: { - total_size += 2; - break; - } - // .google.protobuf.Struct struct_value = 5; - case kStructValue: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.kind_.struct_value_); - break; - } - // .google.protobuf.ListValue list_value = 6; - case kListValue: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.kind_.list_value_); - break; - } - case KIND_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + switch (this_.kind_case()) { + // .google.protobuf.NullValue null_value = 1; + case kNullValue: { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_null_value()); + break; + } + // double number_value = 2; + case kNumberValue: { + total_size += 9; + break; + } + // string string_value = 3; + case kStringValue: { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_string_value()); + break; + } + // bool bool_value = 4; + case kBoolValue: { + total_size += 2; + break; + } + // .google.protobuf.Struct struct_value = 5; + case kStructValue: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.kind_.struct_value_); + break; + } + // .google.protobuf.ListValue list_value = 6; + case kListValue: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.kind_.list_value_); + break; + } + case KIND_NOT_SET: { + break; + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Value*>(&to_msg); @@ -1010,19 +1036,17 @@ void Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::p } case kStructValue: { if (oneof_needs_init) { - _this->_impl_.kind_.struct_value_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::Struct>(arena, *from._impl_.kind_.struct_value_); + _this->_impl_.kind_.struct_value_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.kind_.struct_value_); } else { - _this->_impl_.kind_.struct_value_->MergeFrom(from._internal_struct_value()); + _this->_impl_.kind_.struct_value_->MergeFrom(*from._impl_.kind_.struct_value_); } break; } case kListValue: { if (oneof_needs_init) { - _this->_impl_.kind_.list_value_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::ListValue>(arena, *from._impl_.kind_.list_value_); + _this->_impl_.kind_.list_value_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.kind_.list_value_); } else { - _this->_impl_.kind_.list_value_->MergeFrom(from._internal_list_value()); + _this->_impl_.kind_.list_value_->MergeFrom(*from._impl_.kind_.list_value_); } break; } @@ -1041,7 +1065,7 @@ void Value::CopyFrom(const Value& from) { } -void Value::InternalSwap(Value* PROTOBUF_RESTRICT other) { +void Value::InternalSwap(Value* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_.kind_, other->_impl_.kind_); @@ -1057,26 +1081,27 @@ class ListValue::_Internal { public: }; -ListValue::ListValue(::google::protobuf::Arena* arena) +ListValue::ListValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ListValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.ListValue) } -inline PROTOBUF_NDEBUG_INLINE ListValue::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::ListValue& from_msg) +PROTOBUF_NDEBUG_INLINE ListValue::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::ListValue& from_msg) : values_{visibility, arena, from.values_}, _cached_size_{0} {} ListValue::ListValue( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ListValue& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, ListValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1088,13 +1113,13 @@ ListValue::ListValue( // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue) } -inline PROTOBUF_NDEBUG_INLINE ListValue::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE ListValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : values_{visibility, arena}, _cached_size_{0} {} -inline void ListValue::SharedCtor(::_pb::Arena* arena) { +inline void ListValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } ListValue::~ListValue() { @@ -1108,8 +1133,9 @@ inline void ListValue::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* ListValue::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL ListValue::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) ListValue(arena); } constexpr auto ListValue::InternalNewImpl_() { @@ -1128,35 +1154,42 @@ constexpr auto ListValue::InternalNewImpl_() { alignof(ListValue)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull ListValue::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_ListValue_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &ListValue::MergeImpl, - ::google::protobuf::Message::GetNewImpl<ListValue>(), +constexpr auto ListValue::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_ListValue_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &ListValue::MergeImpl, + ::google::protobuf::Message::GetNewImpl<ListValue>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &ListValue::SharedDtor, - ::google::protobuf::Message::GetClearImpl<ListValue>(), &ListValue::ByteSizeLong, - &ListValue::_InternalSerialize, + &ListValue::SharedDtor, + ::google::protobuf::Message::GetClearImpl<ListValue>(), &ListValue::ByteSizeLong, + &ListValue::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(ListValue, _impl_._cached_size_), - false, - }, - &ListValue::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fstruct_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* ListValue::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(ListValue, _impl_._cached_size_), + false, + }, + &ListValue::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fstruct_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + ListValue_class_data_ = + ListValue::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL ListValue::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&ListValue_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(ListValue_class_data_.tc_table); + return ListValue_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 1, 0, 2> ListValue::_table_ = { +const ::_pbi::TcParseTable<0, 1, 1, 0, 2> +ListValue::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -1167,7 +1200,7 @@ const ::_pbi::TcParseTable<0, 1, 1, 0, 2> ListValue::_table_ = { 1, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + ListValue_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1183,12 +1216,13 @@ const ::_pbi::TcParseTable<0, 1, 1, 0, 2> ListValue::_table_ = { // repeated .google.protobuf.Value values = 1; {PROTOBUF_FIELD_OFFSET(ListValue, _impl_.values_), 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Value>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Value>()}, + }}, + {{ }}, }; - PROTOBUF_NOINLINE void ListValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ListValue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1201,67 +1235,67 @@ PROTOBUF_NOINLINE void ListValue::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* ListValue::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const ListValue& this_ = static_cast<const ListValue&>(base); +::uint8_t* PROTOBUF_NONNULL ListValue::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const ListValue& this_ = static_cast<const ListValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* ListValue::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const ListValue& this_ = *this; +::uint8_t* PROTOBUF_NONNULL ListValue::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const ListValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // repeated .google.protobuf.Value values = 1; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_values_size()); - i < n; i++) { - const auto& repfield = this_._internal_values().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Value values = 1; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_values_size()); + i < n; i++) { + const auto& repfield = this_._internal_values().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, repfield, repfield.GetCachedSize(), + target, stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t ListValue::ByteSizeLong(const MessageLite& base) { - const ListValue& this_ = static_cast<const ListValue&>(base); +::size_t ListValue::ByteSizeLong(const MessageLite& base) { + const ListValue& this_ = static_cast<const ListValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ListValue::ByteSizeLong() const { - const ListValue& this_ = *this; +::size_t ListValue::ByteSizeLong() const { + const ListValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ListValue) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ListValue) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.Value values = 1; - { - total_size += 1UL * this_._internal_values_size(); - for (const auto& msg : this_._internal_values()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.Value values = 1; + { + total_size += 1UL * this_._internal_values_size(); + for (const auto& msg : this_._internal_values()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void ListValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<ListValue*>(&to_msg); @@ -1284,7 +1318,7 @@ void ListValue::CopyFrom(const ListValue& from) { } -void ListValue::InternalSwap(ListValue* PROTOBUF_RESTRICT other) { +void ListValue::InternalSwap(ListValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); _impl_.values_.InternalSwap(&other->_impl_.values_); @@ -1302,7 +1336,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fstruct_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/struct.pb.h b/third_party/protobuf/src/google/protobuf/struct.pb.h index 6234e56b921ea..00e0a5e683b09 100644 --- a/third_party/protobuf/src/google/protobuf/struct.pb.h +++ b/third_party/protobuf/src/google/protobuf/struct.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/struct.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fstruct_2eproto_2epb_2eh #define google_2fprotobuf_2fstruct_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -29,6 +29,7 @@ #include "google/protobuf/repeated_field.h" // IWYU pragma: export #include "google/protobuf/extension_set.h" // IWYU pragma: export #include "google/protobuf/map.h" // IWYU pragma: export +#include "google/protobuf/map_type_handler.h" // IWYU pragma: export #include "google/protobuf/map_entry.h" #include "google/protobuf/map_field_inl.h" #include "google/protobuf/generated_enum_reflection.h" @@ -53,22 +54,32 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fstruct_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fstruct_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fstruct_2eproto; +} // extern "C" namespace google { namespace protobuf { +enum NullValue : int; +PROTOBUF_EXPORT extern const uint32_t NullValue_internal_data_[]; class ListValue; struct ListValueDefaultTypeInternal; PROTOBUF_EXPORT extern ListValueDefaultTypeInternal _ListValue_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ListValue_class_data_; class Struct; struct StructDefaultTypeInternal; PROTOBUF_EXPORT extern StructDefaultTypeInternal _Struct_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Struct_class_data_; class Struct_FieldsEntry_DoNotUse; struct Struct_FieldsEntry_DoNotUseDefaultTypeInternal; PROTOBUF_EXPORT extern Struct_FieldsEntry_DoNotUseDefaultTypeInternal _Struct_FieldsEntry_DoNotUse_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Struct_FieldsEntry_DoNotUse_class_data_; class Value; struct ValueDefaultTypeInternal; PROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Value_class_data_; +template <> +internal::EnumTraitsT<::google::protobuf::NullValue_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::NullValue>; } // namespace protobuf } // namespace google @@ -82,13 +93,16 @@ enum NullValue : int { std::numeric_limits<::int32_t>::max(), }; -PROTOBUF_EXPORT bool NullValue_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t NullValue_internal_data_[]; -constexpr NullValue NullValue_MIN = static_cast<NullValue>(0); -constexpr NullValue NullValue_MAX = static_cast<NullValue>(0); -constexpr int NullValue_ARRAYSIZE = 0 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -NullValue_descriptor(); +inline constexpr NullValue NullValue_MIN = + static_cast<NullValue>(0); +inline constexpr NullValue NullValue_MAX = + static_cast<NullValue>(0); +inline bool NullValue_IsValid(int value) { + return 0 <= value && value <= 0; +} +inline constexpr int NullValue_ARRAYSIZE = 0 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL NullValue_descriptor(); template <typename T> const std::string& NullValue_Name(T value) { static_assert(std::is_same<T, NullValue>::value || @@ -98,13 +112,13 @@ const std::string& NullValue_Name(T value) { } template <> inline const std::string& NullValue_Name(NullValue value) { - return ::google::protobuf::internal::NameOfDenseEnum<NullValue_descriptor, - 0, 0>( + return ::google::protobuf::internal::NameOfDenseEnum<NullValue_descriptor, 0, 0>( static_cast<int>(value)); } -inline bool NullValue_Parse(absl::string_view name, NullValue* value) { - return ::google::protobuf::internal::ParseNamedEnum<NullValue>( - NullValue_descriptor(), name, value); +inline bool NullValue_Parse( + absl::string_view name, NullValue* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<NullValue>(NullValue_descriptor(), name, + value); } // =================================================================== @@ -119,15 +133,14 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message ~ListValue() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(ListValue* msg, std::destroying_delete_t) { + void operator delete(ListValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(ListValue)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR ListValue( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR ListValue(::google::protobuf::internal::ConstantInitialized); inline ListValue(const ListValue& from) : ListValue(nullptr, from) {} inline ListValue(ListValue&& from) noexcept @@ -150,30 +163,27 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const ListValue& default_instance() { - return *internal_default_instance(); - } - static inline const ListValue* internal_default_instance() { - return reinterpret_cast<const ListValue*>( + return *reinterpret_cast<const ListValue*>( &_ListValue_default_instance_); } static constexpr int kIndexInFileMessages = 3; friend void swap(ListValue& a, ListValue& b) { a.Swap(&b); } - inline void Swap(ListValue* other) { + inline void Swap(ListValue* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -181,7 +191,7 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(ListValue* other) { + void UnsafeArenaSwap(ListValue* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -189,7 +199,7 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - ListValue* New(::google::protobuf::Arena* arena = nullptr) const { + ListValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<ListValue>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -198,9 +208,8 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message void MergeFrom(const ListValue& from) { ListValue::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -210,49 +219,51 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(ListValue* other); + void InternalSwap(ListValue* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.ListValue"; } protected: - explicit ListValue(::google::protobuf::Arena* arena); - ListValue(::google::protobuf::Arena* arena, const ListValue& from); - ListValue(::google::protobuf::Arena* arena, ListValue&& from) noexcept + explicit ListValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + ListValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const ListValue& from); + ListValue( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, ListValue&& from) noexcept : ListValue(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -267,23 +278,23 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message public: void clear_values() ; - ::google::protobuf::Value* mutable_values(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* mutable_values(); + ::google::protobuf::Value* PROTOBUF_NONNULL mutable_values(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* PROTOBUF_NONNULL mutable_values(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>& _internal_values() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* _internal_mutable_values(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* PROTOBUF_NONNULL _internal_mutable_values(); public: const ::google::protobuf::Value& values(int index) const; - ::google::protobuf::Value* add_values(); + ::google::protobuf::Value* PROTOBUF_NONNULL add_values(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>& values() const; // @@protoc_insertion_point(class_scope:google.protobuf.ListValue) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 1, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 1, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -293,13 +304,14 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const ListValue& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ListValue& from_msg); ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value > values_; ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER @@ -307,6 +319,8 @@ class PROTOBUF_EXPORT ListValue final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull ListValue_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message @@ -316,15 +330,14 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message ~Struct() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Struct* msg, std::destroying_delete_t) { + void operator delete(Struct* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Struct)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Struct( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Struct(::google::protobuf::internal::ConstantInitialized); inline Struct(const Struct& from) : Struct(nullptr, from) {} inline Struct(Struct&& from) noexcept @@ -347,30 +360,27 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Struct& default_instance() { - return *internal_default_instance(); - } - static inline const Struct* internal_default_instance() { - return reinterpret_cast<const Struct*>( + return *reinterpret_cast<const Struct*>( &_Struct_default_instance_); } static constexpr int kIndexInFileMessages = 1; friend void swap(Struct& a, Struct& b) { a.Swap(&b); } - inline void Swap(Struct* other) { + inline void Swap(Struct* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -378,7 +388,7 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Struct* other) { + void UnsafeArenaSwap(Struct* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -386,7 +396,7 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Struct* New(::google::protobuf::Arena* arena = nullptr) const { + Struct* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Struct>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -395,9 +405,8 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message void MergeFrom(const Struct& from) { Struct::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -407,49 +416,51 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Struct* other); + void InternalSwap(Struct* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Struct"; } protected: - explicit Struct(::google::protobuf::Arena* arena); - Struct(::google::protobuf::Arena* arena, const Struct& from); - Struct(::google::protobuf::Arena* arena, Struct&& from) noexcept + explicit Struct(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Struct(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Struct& from); + Struct( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Struct&& from) noexcept : Struct(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -465,20 +476,20 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message public: void clear_fields() ; const ::google::protobuf::Map<std::string, ::google::protobuf::Value>& fields() const; - ::google::protobuf::Map<std::string, ::google::protobuf::Value>* mutable_fields(); + ::google::protobuf::Map<std::string, ::google::protobuf::Value>* PROTOBUF_NONNULL mutable_fields(); private: const ::google::protobuf::Map<std::string, ::google::protobuf::Value>& _internal_fields() const; - ::google::protobuf::Map<std::string, ::google::protobuf::Value>* _internal_mutable_fields(); + ::google::protobuf::Map<std::string, ::google::protobuf::Value>* PROTOBUF_NONNULL _internal_mutable_fields(); public: // @@protoc_insertion_point(class_scope:google.protobuf.Struct) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 2, - 37, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 2, 37, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -488,13 +499,14 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Struct& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Struct& from_msg); ::google::protobuf::internal::MapField<Struct_FieldsEntry_DoNotUse, std::string, ::google::protobuf::Value, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE> @@ -505,45 +517,47 @@ class PROTOBUF_EXPORT Struct final : public ::google::protobuf::Message union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Struct_class_data_; // ------------------------------------------------------------------- class Struct_FieldsEntry_DoNotUse final - : public ::google::protobuf::internal::MapEntry< - std::string, ::google::protobuf::Message, - ::google::protobuf::internal::WireFormatLite::TYPE_STRING, - ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE> { + : public ::google::protobuf::internal::MapEntry<std::string, ::google::protobuf::Message, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE> { public: - using SuperType = ::google::protobuf::internal::MapEntry< - std::string, ::google::protobuf::Message, - ::google::protobuf::internal::WireFormatLite::TYPE_STRING, - ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE>; + using SuperType = + ::google::protobuf::internal::MapEntry<std::string, ::google::protobuf::Message, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE>; Struct_FieldsEntry_DoNotUse(); template <typename = void> - explicit PROTOBUF_CONSTEXPR Struct_FieldsEntry_DoNotUse( - ::google::protobuf::internal::ConstantInitialized); - explicit Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena); - static const Struct_FieldsEntry_DoNotUse* internal_default_instance() { - return reinterpret_cast<const Struct_FieldsEntry_DoNotUse*>( - &_Struct_FieldsEntry_DoNotUse_default_instance_); + explicit PROTOBUF_CONSTEXPR Struct_FieldsEntry_DoNotUse(::google::protobuf::internal::ConstantInitialized); + explicit Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + static constexpr const void* PROTOBUF_NONNULL internal_default_instance() { + return &_Struct_FieldsEntry_DoNotUse_default_instance_; } + static constexpr auto InternalGenerateClassData_(); + private: friend class ::google::protobuf::MessageLite; friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 1, - 46, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 1, 46, + 2> _table_; - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Struct_FieldsEntry_DoNotUse_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message @@ -553,15 +567,14 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message ~Value() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Value* msg, std::destroying_delete_t) { + void operator delete(Value* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Value)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Value( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Value(::google::protobuf::internal::ConstantInitialized); inline Value(const Value& from) : Value(nullptr, from) {} inline Value(Value&& from) noexcept @@ -584,22 +597,23 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Value& default_instance() { - return *internal_default_instance(); + return *reinterpret_cast<const Value*>( + &_Value_default_instance_); } enum KindCase { kNullValue = 1, @@ -610,13 +624,9 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message kListValue = 6, KIND_NOT_SET = 0, }; - static inline const Value* internal_default_instance() { - return reinterpret_cast<const Value*>( - &_Value_default_instance_); - } static constexpr int kIndexInFileMessages = 2; friend void swap(Value& a, Value& b) { a.Swap(&b); } - inline void Swap(Value* other) { + inline void Swap(Value* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -624,7 +634,7 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Value* other) { + void UnsafeArenaSwap(Value* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -632,7 +642,7 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Value* New(::google::protobuf::Arena* arena = nullptr) const { + Value* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Value>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -641,9 +651,8 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message void MergeFrom(const Value& from) { Value::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -653,49 +662,51 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Value* other); + void InternalSwap(Value* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Value"; } protected: - explicit Value(::google::protobuf::Arena* arena); - Value(::google::protobuf::Arena* arena, const Value& from); - Value(::google::protobuf::Arena* arena, Value&& from) noexcept + explicit Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Value& from); + Value( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Value&& from) noexcept : Value(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -736,15 +747,14 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message const std::string& string_value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_string_value(Arg_&& arg, Args_... args); - std::string* mutable_string_value(); - PROTOBUF_NODISCARD std::string* release_string_value(); - void set_allocated_string_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_string_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_string_value(); + void set_allocated_string_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_string_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_string_value( - const std::string& value); - std::string* _internal_mutable_string_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_string_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_string_value(); public: // bool bool_value = 4; @@ -766,15 +776,15 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message public: void clear_struct_value() ; const ::google::protobuf::Struct& struct_value() const; - PROTOBUF_NODISCARD ::google::protobuf::Struct* release_struct_value(); - ::google::protobuf::Struct* mutable_struct_value(); - void set_allocated_struct_value(::google::protobuf::Struct* value); - void unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* value); - ::google::protobuf::Struct* unsafe_arena_release_struct_value(); + [[nodiscard]] ::google::protobuf::Struct* PROTOBUF_NULLABLE release_struct_value(); + ::google::protobuf::Struct* PROTOBUF_NONNULL mutable_struct_value(); + void set_allocated_struct_value(::google::protobuf::Struct* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* PROTOBUF_NULLABLE value); + ::google::protobuf::Struct* PROTOBUF_NULLABLE unsafe_arena_release_struct_value(); private: const ::google::protobuf::Struct& _internal_struct_value() const; - ::google::protobuf::Struct* _internal_mutable_struct_value(); + ::google::protobuf::Struct* PROTOBUF_NONNULL _internal_mutable_struct_value(); public: // .google.protobuf.ListValue list_value = 6; @@ -785,15 +795,15 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message public: void clear_list_value() ; const ::google::protobuf::ListValue& list_value() const; - PROTOBUF_NODISCARD ::google::protobuf::ListValue* release_list_value(); - ::google::protobuf::ListValue* mutable_list_value(); - void set_allocated_list_value(::google::protobuf::ListValue* value); - void unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* value); - ::google::protobuf::ListValue* unsafe_arena_release_list_value(); + [[nodiscard]] ::google::protobuf::ListValue* PROTOBUF_NULLABLE release_list_value(); + ::google::protobuf::ListValue* PROTOBUF_NONNULL mutable_list_value(); + void set_allocated_list_value(::google::protobuf::ListValue* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* PROTOBUF_NULLABLE value); + ::google::protobuf::ListValue* PROTOBUF_NULLABLE unsafe_arena_release_list_value(); private: const ::google::protobuf::ListValue& _internal_list_value() const; - ::google::protobuf::ListValue* _internal_mutable_list_value(); + ::google::protobuf::ListValue* PROTOBUF_NONNULL _internal_mutable_list_value(); public: void clear_kind(); @@ -810,9 +820,9 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message inline bool has_kind() const; inline void clear_has_kind(); friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 6, 2, - 42, 2> + static const ::google::protobuf::internal::TcParseTable<0, 6, + 2, 42, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -822,13 +832,14 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Value& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Value& from_msg); union KindUnion { constexpr KindUnion() : _constinit_{} {} ::google::protobuf::internal::ConstantInitialized _constinit_; @@ -836,8 +847,8 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message double number_value_; ::google::protobuf::internal::ArenaStringPtr string_value_; bool bool_value_; - ::google::protobuf::Struct* struct_value_; - ::google::protobuf::ListValue* list_value_; + ::google::protobuf::Struct* PROTOBUF_NULLABLE struct_value_; + ::google::protobuf::ListValue* PROTOBUF_NULLABLE list_value_; } kind_; ::google::protobuf::internal::CachedSize _cached_size_; ::uint32_t _oneof_case_[1]; @@ -847,6 +858,8 @@ class PROTOBUF_EXPORT Value final : public ::google::protobuf::Message friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Value_class_data_; + // =================================================================== @@ -884,11 +897,12 @@ inline const ::google::protobuf::Map<std::string, ::google::protobuf::Value>& St // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields) return _internal_fields(); } -inline ::google::protobuf::Map<std::string, ::google::protobuf::Value>* Struct::_internal_mutable_fields() { +inline ::google::protobuf::Map<std::string, ::google::protobuf::Value>* PROTOBUF_NONNULL Struct::_internal_mutable_fields() { ::google::protobuf::internal::TSanWrite(&_impl_); return _impl_.fields_.MutableMap(); } -inline ::google::protobuf::Map<std::string, ::google::protobuf::Value>* Struct::mutable_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Map<std::string, ::google::protobuf::Value>* PROTOBUF_NONNULL Struct::mutable_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields) return _internal_mutable_fields(); } @@ -983,8 +997,7 @@ inline const std::string& Value::string_value() const return _internal_string_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Value::set_string_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Value::set_string_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); if (kind_case() != kStringValue) { clear_kind(); @@ -995,7 +1008,8 @@ inline PROTOBUF_ALWAYS_INLINE void Value::set_string_value(Arg_&& arg, _impl_.kind_.string_value_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) } -inline std::string* Value::mutable_string_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Value::mutable_string_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_string_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value) return _s; @@ -1017,7 +1031,7 @@ inline void Value::_internal_set_string_value(const std::string& value) { } _impl_.kind_.string_value_.Set(value, GetArena()); } -inline std::string* Value::_internal_mutable_string_value() { +inline std::string* PROTOBUF_NONNULL Value::_internal_mutable_string_value() { ::google::protobuf::internal::TSanWrite(&_impl_); if (kind_case() != kStringValue) { clear_kind(); @@ -1027,7 +1041,7 @@ inline std::string* Value::_internal_mutable_string_value() { } return _impl_.kind_.string_value_.Mutable( GetArena()); } -inline std::string* Value::release_string_value() { +inline std::string* PROTOBUF_NULLABLE Value::release_string_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Value.string_value) if (kind_case() != kStringValue) { @@ -1036,7 +1050,7 @@ inline std::string* Value::release_string_value() { clear_has_kind(); return _impl_.kind_.string_value_.Release(); } -inline void Value::set_allocated_string_value(std::string* value) { +inline void Value::set_allocated_string_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (has_kind()) { clear_kind(); @@ -1102,7 +1116,7 @@ inline void Value::clear_struct_value() { clear_has_kind(); } } -inline ::google::protobuf::Struct* Value::release_struct_value() { +inline ::google::protobuf::Struct* PROTOBUF_NULLABLE Value::release_struct_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value) if (kind_case() == kStructValue) { clear_has_kind(); @@ -1123,7 +1137,7 @@ inline const ::google::protobuf::Struct& Value::struct_value() const ABSL_ATTRIB // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) return _internal_struct_value(); } -inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() { +inline ::google::protobuf::Struct* PROTOBUF_NULLABLE Value::unsafe_arena_release_struct_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value) if (kind_case() == kStructValue) { clear_has_kind(); @@ -1134,7 +1148,8 @@ inline ::google::protobuf::Struct* Value::unsafe_arena_release_struct_value() { return nullptr; } } -inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::Struct* value) { +inline void Value::unsafe_arena_set_allocated_struct_value( + ::google::protobuf::Struct* PROTOBUF_NULLABLE value) { // We rely on the oneof clear method to free the earlier contents // of this oneof. We can directly use the pointer we're given to // set the new value. @@ -1145,16 +1160,17 @@ inline void Value::unsafe_arena_set_allocated_struct_value(::google::protobuf::S } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value) } -inline ::google::protobuf::Struct* Value::_internal_mutable_struct_value() { +inline ::google::protobuf::Struct* PROTOBUF_NONNULL Value::_internal_mutable_struct_value() { if (kind_case() != kStructValue) { clear_kind(); set_has_struct_value(); - _impl_.kind_.struct_value_ = + _impl_.kind_.struct_value_ = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Struct>(GetArena()); } return _impl_.kind_.struct_value_; } -inline ::google::protobuf::Struct* Value::mutable_struct_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Struct* PROTOBUF_NONNULL Value::mutable_struct_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::Struct* _msg = _internal_mutable_struct_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) return _msg; @@ -1181,7 +1197,7 @@ inline void Value::clear_list_value() { clear_has_kind(); } } -inline ::google::protobuf::ListValue* Value::release_list_value() { +inline ::google::protobuf::ListValue* PROTOBUF_NULLABLE Value::release_list_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.list_value) if (kind_case() == kListValue) { clear_has_kind(); @@ -1202,7 +1218,7 @@ inline const ::google::protobuf::ListValue& Value::list_value() const ABSL_ATTRI // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) return _internal_list_value(); } -inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() { +inline ::google::protobuf::ListValue* PROTOBUF_NULLABLE Value::unsafe_arena_release_list_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value) if (kind_case() == kListValue) { clear_has_kind(); @@ -1213,7 +1229,8 @@ inline ::google::protobuf::ListValue* Value::unsafe_arena_release_list_value() { return nullptr; } } -inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::ListValue* value) { +inline void Value::unsafe_arena_set_allocated_list_value( + ::google::protobuf::ListValue* PROTOBUF_NULLABLE value) { // We rely on the oneof clear method to free the earlier contents // of this oneof. We can directly use the pointer we're given to // set the new value. @@ -1224,16 +1241,17 @@ inline void Value::unsafe_arena_set_allocated_list_value(::google::protobuf::Lis } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value) } -inline ::google::protobuf::ListValue* Value::_internal_mutable_list_value() { +inline ::google::protobuf::ListValue* PROTOBUF_NONNULL Value::_internal_mutable_list_value() { if (kind_case() != kListValue) { clear_kind(); set_has_list_value(); - _impl_.kind_.list_value_ = + _impl_.kind_.list_value_ = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::ListValue>(GetArena()); } return _impl_.kind_.list_value_; } -inline ::google::protobuf::ListValue* Value::mutable_list_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::ListValue* PROTOBUF_NONNULL Value::mutable_list_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::ListValue* _msg = _internal_mutable_list_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) return _msg; @@ -1263,12 +1281,12 @@ inline void ListValue::clear_values() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.values_.Clear(); } -inline ::google::protobuf::Value* ListValue::mutable_values(int index) +inline ::google::protobuf::Value* PROTOBUF_NONNULL ListValue::mutable_values(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values) return _internal_mutable_values()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* ListValue::mutable_values() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* PROTOBUF_NONNULL ListValue::mutable_values() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1279,7 +1297,8 @@ inline const ::google::protobuf::Value& ListValue::values(int index) const // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values) return _internal_values().Get(index); } -inline ::google::protobuf::Value* ListValue::add_values() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Value* PROTOBUF_NONNULL ListValue::add_values() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Value* _add = _internal_mutable_values()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values) @@ -1295,7 +1314,7 @@ ListValue::_internal_values() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.values_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Value>* PROTOBUF_NONNULL ListValue::_internal_mutable_values() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.values_; @@ -1316,7 +1335,7 @@ namespace protobuf { template <> struct is_proto_enum<::google::protobuf::NullValue> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::NullValue>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::NullValue>() { return ::google::protobuf::NullValue_descriptor(); } diff --git a/third_party/protobuf/src/google/protobuf/stubs/BUILD.bazel b/third_party/protobuf/src/google/protobuf/stubs/BUILD.bazel index fb044714fcebd..95bc0152ad71f 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/stubs/BUILD.bazel @@ -22,14 +22,20 @@ cc_library( "status_macros.h", ], copts = COPTS, + defines = ["GOOGLE_PROTOBUF_USING_BAZEL=1"] + select({ + "//build_defs:protobuf_allow_msvc": [ + "GOOGLE_PROTOBUF_MSVC_BAZEL_OVERRIDE=1", + ], + "//conditions:default": [], + }), linkopts = LINK_OPTS, strip_include_prefix = "/src", deps = [ "//src/google/protobuf:port", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", ], ) @@ -51,9 +57,9 @@ cc_library( deps = [ ":lite", "//src/google/protobuf:port", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", ], ) @@ -74,10 +80,10 @@ cc_test( ":stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/stubs/common.h b/third_party/protobuf/src/google/protobuf/stubs/common.h index b36213a15e633..d315ee4e3b338 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/common.h +++ b/third_party/protobuf/src/google/protobuf/stubs/common.h @@ -45,7 +45,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 5029003 +#define GOOGLE_PROTOBUF_VERSION 6030001 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" diff --git a/third_party/protobuf/src/google/protobuf/stubs/port.h b/third_party/protobuf/src/google/protobuf/stubs/port.h index 8ec56022feab8..ba155018f39bf 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/port.h +++ b/third_party/protobuf/src/google/protobuf/stubs/port.h @@ -31,6 +31,13 @@ #include <byteswap.h> // IWYU pragma: export #endif +#if defined(_MSC_VER) && !defined(__clang__) && \ + defined(GOOGLE_PROTOBUF_USING_BAZEL) && \ + !defined(GOOGLE_PROTOBUF_MSVC_BAZEL_OVERRIDE) +#error \ + "Protobuf will be dropping support for MSVC + Bazel in 34.0. To continue using it until then, use the flag --define=protobuf_allow_msvc=true. For feedback or discussion, see github.com/protocolbuffers/protobuf/issues/20085." +#endif + // Legacy: some users reference these (internal-only) macros even though we // don't need them any more. #if defined(COMPONENT_BUILD) && defined(PROTOBUF_USE_DLLS) diff --git a/third_party/protobuf/src/google/protobuf/stubs/status_macros.h b/third_party/protobuf/src/google/protobuf/stubs/status_macros.h index 6fe753b9a66e5..93d6b8b005b31 100644 --- a/third_party/protobuf/src/google/protobuf/stubs/status_macros.h +++ b/third_party/protobuf/src/google/protobuf/stubs/status_macros.h @@ -30,7 +30,7 @@ namespace util { do { \ /* Using _status below to avoid capture problems if expr is "status". */ \ const absl::Status _status = (expr); \ - if (PROTOBUF_PREDICT_FALSE(!_status.ok())) return _status; \ + if (ABSL_PREDICT_FALSE(!_status.ok())) return _status; \ } while (0) // Internal helper for concatenating macro values. @@ -45,9 +45,10 @@ absl::Status DoAssignOrReturn(T& lhs, absl::StatusOr<T> result) { return result.status(); } -#define ASSIGN_OR_RETURN_IMPL(status, lhs, rexpr) \ - absl::Status status = DoAssignOrReturn(lhs, (rexpr)); \ - if (PROTOBUF_PREDICT_FALSE(!status.ok())) return status; +#define ASSIGN_OR_RETURN_IMPL(status, lhs, rexpr) \ + absl::Status status = \ + ::google::protobuf::util::DoAssignOrReturn(lhs, (rexpr)); \ + if (ABSL_PREDICT_FALSE(!status.ok())) return status; // Executes an expression that returns a util::StatusOr, extracting its value // into the variable defined by lhs (or returning on error). diff --git a/third_party/protobuf/src/google/protobuf/test_messages_proto2.proto b/third_party/protobuf/src/google/protobuf/test_messages_proto2.proto index 73cba558c4e9d..932717144b9e8 100644 --- a/third_party/protobuf/src/google/protobuf/test_messages_proto2.proto +++ b/third_party/protobuf/src/google/protobuf/test_messages_proto2.proto @@ -385,3 +385,18 @@ message TestAllRequiredTypesProto2 { required int32 i = 9; } } + +message TestLargeOneof { + message A1 {} + message A2 {} + message A3 {} + message A4 {} + message A5 {} + oneof large_oneof { + A1 a1 = 1; + A2 a2 = 2; + A3 a3 = 3; + A4 a4 = 4; + A5 a5 = 5; + } +} diff --git a/third_party/protobuf/src/google/protobuf/test_util.h b/third_party/protobuf/src/google/protobuf/test_util.h index 9e43eda0e91a7..74bd1aaea81cc 100644 --- a/third_party/protobuf/src/google/protobuf/test_util.h +++ b/third_party/protobuf/src/google/protobuf/test_util.h @@ -15,8 +15,8 @@ #include "absl/strings/string_view.h" #include "google/protobuf/unittest.pb.h" -#define UNITTEST ::protobuf_unittest -#define UNITTEST_IMPORT ::protobuf_unittest_import +#define UNITTEST ::proto2_unittest +#define UNITTEST_IMPORT ::proto2_unittest_import // Must be included when the preprocessor symbols above are defined. #include "google/protobuf/test_util.inc" #undef UNITTEST @@ -28,8 +28,8 @@ namespace google { namespace protobuf { // This file doesn't use these declarations, but some .cc files do. -namespace unittest = ::protobuf_unittest; -namespace unittest_import = ::protobuf_unittest_import; +namespace unittest = ::proto2_unittest; +namespace unittest_import = ::proto2_unittest_import; namespace TestUtil { diff --git a/third_party/protobuf/src/google/protobuf/test_util_lite.h b/third_party/protobuf/src/google/protobuf/test_util_lite.h index 57ec0641a1908..21b24da91f1d3 100644 --- a/third_party/protobuf/src/google/protobuf/test_util_lite.h +++ b/third_party/protobuf/src/google/protobuf/test_util_lite.h @@ -17,8 +17,8 @@ namespace google { namespace protobuf { -namespace unittest = protobuf_unittest; -namespace unittest_import = protobuf_unittest_import; +namespace unittest = proto2_unittest; +namespace unittest_import = proto2_unittest_import; class TestUtilLite { public: diff --git a/third_party/protobuf/src/google/protobuf/testdata/extdecl/invalid/extdecl_field_options.txtpb b/third_party/protobuf/src/google/protobuf/testdata/extdecl/invalid/extdecl_field_options.txtpb deleted file mode 100644 index c9ed7ef179741..0000000000000 --- a/third_party/protobuf/src/google/protobuf/testdata/extdecl/invalid/extdecl_field_options.txtpb +++ /dev/null @@ -1,11 +0,0 @@ -# For Protobuf extension declaration test only. -# DO NOT add extension declaration to this file. -# -# proto-file: path/to/my_file.proto -# proto-message: MyMessage - -no_declaration { - number: 525000000 - full_name: ".protoc.extension.declaration.test" - type: "string" -} diff --git a/third_party/protobuf/src/google/protobuf/testdata/invalid_extdecl/extdecl_field_options.textpb b/third_party/protobuf/src/google/protobuf/testdata/invalid_extdecl/extdecl_field_options.textpb deleted file mode 100644 index c9ed7ef179741..0000000000000 --- a/third_party/protobuf/src/google/protobuf/testdata/invalid_extdecl/extdecl_field_options.textpb +++ /dev/null @@ -1,11 +0,0 @@ -# For Protobuf extension declaration test only. -# DO NOT add extension declaration to this file. -# -# proto-file: path/to/my_file.proto -# proto-message: MyMessage - -no_declaration { - number: 525000000 - full_name: ".protoc.extension.declaration.test" - type: "string" -} diff --git a/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt b/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt index 8ab4d2e85b0c0..6f4d746d57bba 100644 --- a/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt +++ b/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt @@ -1,138 +1,138 @@ -[protobuf_unittest.optional_int32_extension]: 101 -[protobuf_unittest.optional_int64_extension]: 102 -[protobuf_unittest.optional_uint32_extension]: 103 -[protobuf_unittest.optional_uint64_extension]: 104 -[protobuf_unittest.optional_sint32_extension]: 105 -[protobuf_unittest.optional_sint64_extension]: 106 -[protobuf_unittest.optional_fixed32_extension]: 107 -[protobuf_unittest.optional_fixed64_extension]: 108 -[protobuf_unittest.optional_sfixed32_extension]: 109 -[protobuf_unittest.optional_sfixed64_extension]: 110 -[protobuf_unittest.optional_float_extension]: 111 -[protobuf_unittest.optional_double_extension]: 112 -[protobuf_unittest.optional_bool_extension]: true -[protobuf_unittest.optional_string_extension]: "115" -[protobuf_unittest.optional_bytes_extension]: "116" -[protobuf_unittest.optionalgroup_extension] { +[proto2_unittest.optional_int32_extension]: 101 +[proto2_unittest.optional_int64_extension]: 102 +[proto2_unittest.optional_uint32_extension]: 103 +[proto2_unittest.optional_uint64_extension]: 104 +[proto2_unittest.optional_sint32_extension]: 105 +[proto2_unittest.optional_sint64_extension]: 106 +[proto2_unittest.optional_fixed32_extension]: 107 +[proto2_unittest.optional_fixed64_extension]: 108 +[proto2_unittest.optional_sfixed32_extension]: 109 +[proto2_unittest.optional_sfixed64_extension]: 110 +[proto2_unittest.optional_float_extension]: 111 +[proto2_unittest.optional_double_extension]: 112 +[proto2_unittest.optional_bool_extension]: true +[proto2_unittest.optional_string_extension]: "115" +[proto2_unittest.optional_bytes_extension]: "116" +[proto2_unittest.optionalgroup_extension] { a: 117 } -[protobuf_unittest.optional_nested_message_extension] { +[proto2_unittest.optional_nested_message_extension] { bb: 118 } -[protobuf_unittest.optional_foreign_message_extension] { +[proto2_unittest.optional_foreign_message_extension] { c: 119 } -[protobuf_unittest.optional_import_message_extension] { +[proto2_unittest.optional_import_message_extension] { d: 120 } -[protobuf_unittest.optional_nested_enum_extension]: BAZ -[protobuf_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ -[protobuf_unittest.optional_import_enum_extension]: IMPORT_BAZ -[protobuf_unittest.optional_string_piece_extension]: "124" -[protobuf_unittest.optional_cord_extension]: "125" -[protobuf_unittest.optional_public_import_message_extension] { +[proto2_unittest.optional_nested_enum_extension]: BAZ +[proto2_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ +[proto2_unittest.optional_import_enum_extension]: IMPORT_BAZ +[proto2_unittest.optional_string_piece_extension]: "124" +[proto2_unittest.optional_cord_extension]: "125" +[proto2_unittest.optional_public_import_message_extension] { e: 126 } -[protobuf_unittest.optional_lazy_message_extension] { +[proto2_unittest.optional_lazy_message_extension] { bb: 127 } -[protobuf_unittest.optional_unverified_lazy_message_extension] { +[proto2_unittest.optional_unverified_lazy_message_extension] { bb: 128 } -[protobuf_unittest.repeated_int32_extension]: 201 -[protobuf_unittest.repeated_int32_extension]: 301 -[protobuf_unittest.repeated_int64_extension]: 202 -[protobuf_unittest.repeated_int64_extension]: 302 -[protobuf_unittest.repeated_uint32_extension]: 203 -[protobuf_unittest.repeated_uint32_extension]: 303 -[protobuf_unittest.repeated_uint64_extension]: 204 -[protobuf_unittest.repeated_uint64_extension]: 304 -[protobuf_unittest.repeated_sint32_extension]: 205 -[protobuf_unittest.repeated_sint32_extension]: 305 -[protobuf_unittest.repeated_sint64_extension]: 206 -[protobuf_unittest.repeated_sint64_extension]: 306 -[protobuf_unittest.repeated_fixed32_extension]: 207 -[protobuf_unittest.repeated_fixed32_extension]: 307 -[protobuf_unittest.repeated_fixed64_extension]: 208 -[protobuf_unittest.repeated_fixed64_extension]: 308 -[protobuf_unittest.repeated_sfixed32_extension]: 209 -[protobuf_unittest.repeated_sfixed32_extension]: 309 -[protobuf_unittest.repeated_sfixed64_extension]: 210 -[protobuf_unittest.repeated_sfixed64_extension]: 310 -[protobuf_unittest.repeated_float_extension]: 211 -[protobuf_unittest.repeated_float_extension]: 311 -[protobuf_unittest.repeated_double_extension]: 212 -[protobuf_unittest.repeated_double_extension]: 312 -[protobuf_unittest.repeated_bool_extension]: true -[protobuf_unittest.repeated_bool_extension]: false -[protobuf_unittest.repeated_string_extension]: "215" -[protobuf_unittest.repeated_string_extension]: "315" -[protobuf_unittest.repeated_bytes_extension]: "216" -[protobuf_unittest.repeated_bytes_extension]: "316" -[protobuf_unittest.repeatedgroup_extension] { +[proto2_unittest.repeated_int32_extension]: 201 +[proto2_unittest.repeated_int32_extension]: 301 +[proto2_unittest.repeated_int64_extension]: 202 +[proto2_unittest.repeated_int64_extension]: 302 +[proto2_unittest.repeated_uint32_extension]: 203 +[proto2_unittest.repeated_uint32_extension]: 303 +[proto2_unittest.repeated_uint64_extension]: 204 +[proto2_unittest.repeated_uint64_extension]: 304 +[proto2_unittest.repeated_sint32_extension]: 205 +[proto2_unittest.repeated_sint32_extension]: 305 +[proto2_unittest.repeated_sint64_extension]: 206 +[proto2_unittest.repeated_sint64_extension]: 306 +[proto2_unittest.repeated_fixed32_extension]: 207 +[proto2_unittest.repeated_fixed32_extension]: 307 +[proto2_unittest.repeated_fixed64_extension]: 208 +[proto2_unittest.repeated_fixed64_extension]: 308 +[proto2_unittest.repeated_sfixed32_extension]: 209 +[proto2_unittest.repeated_sfixed32_extension]: 309 +[proto2_unittest.repeated_sfixed64_extension]: 210 +[proto2_unittest.repeated_sfixed64_extension]: 310 +[proto2_unittest.repeated_float_extension]: 211 +[proto2_unittest.repeated_float_extension]: 311 +[proto2_unittest.repeated_double_extension]: 212 +[proto2_unittest.repeated_double_extension]: 312 +[proto2_unittest.repeated_bool_extension]: true +[proto2_unittest.repeated_bool_extension]: false +[proto2_unittest.repeated_string_extension]: "215" +[proto2_unittest.repeated_string_extension]: "315" +[proto2_unittest.repeated_bytes_extension]: "216" +[proto2_unittest.repeated_bytes_extension]: "316" +[proto2_unittest.repeatedgroup_extension] { a: 217 } -[protobuf_unittest.repeatedgroup_extension] { +[proto2_unittest.repeatedgroup_extension] { a: 317 } -[protobuf_unittest.repeated_nested_message_extension] { +[proto2_unittest.repeated_nested_message_extension] { bb: 218 } -[protobuf_unittest.repeated_nested_message_extension] { +[proto2_unittest.repeated_nested_message_extension] { bb: 318 } -[protobuf_unittest.repeated_foreign_message_extension] { +[proto2_unittest.repeated_foreign_message_extension] { c: 219 } -[protobuf_unittest.repeated_foreign_message_extension] { +[proto2_unittest.repeated_foreign_message_extension] { c: 319 } -[protobuf_unittest.repeated_import_message_extension] { +[proto2_unittest.repeated_import_message_extension] { d: 220 } -[protobuf_unittest.repeated_import_message_extension] { +[proto2_unittest.repeated_import_message_extension] { d: 320 } -[protobuf_unittest.repeated_nested_enum_extension]: BAR -[protobuf_unittest.repeated_nested_enum_extension]: BAZ -[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR -[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ -[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAR -[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAZ -[protobuf_unittest.repeated_string_piece_extension]: "224" -[protobuf_unittest.repeated_string_piece_extension]: "324" -[protobuf_unittest.repeated_cord_extension]: "225" -[protobuf_unittest.repeated_cord_extension]: "325" -[protobuf_unittest.repeated_lazy_message_extension] { +[proto2_unittest.repeated_nested_enum_extension]: BAR +[proto2_unittest.repeated_nested_enum_extension]: BAZ +[proto2_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR +[proto2_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ +[proto2_unittest.repeated_import_enum_extension]: IMPORT_BAR +[proto2_unittest.repeated_import_enum_extension]: IMPORT_BAZ +[proto2_unittest.repeated_string_piece_extension]: "224" +[proto2_unittest.repeated_string_piece_extension]: "324" +[proto2_unittest.repeated_cord_extension]: "225" +[proto2_unittest.repeated_cord_extension]: "325" +[proto2_unittest.repeated_lazy_message_extension] { bb: 227 } -[protobuf_unittest.repeated_lazy_message_extension] { +[proto2_unittest.repeated_lazy_message_extension] { bb: 327 } -[protobuf_unittest.default_int32_extension]: 401 -[protobuf_unittest.default_int64_extension]: 402 -[protobuf_unittest.default_uint32_extension]: 403 -[protobuf_unittest.default_uint64_extension]: 404 -[protobuf_unittest.default_sint32_extension]: 405 -[protobuf_unittest.default_sint64_extension]: 406 -[protobuf_unittest.default_fixed32_extension]: 407 -[protobuf_unittest.default_fixed64_extension]: 408 -[protobuf_unittest.default_sfixed32_extension]: 409 -[protobuf_unittest.default_sfixed64_extension]: 410 -[protobuf_unittest.default_float_extension]: 411 -[protobuf_unittest.default_double_extension]: 412 -[protobuf_unittest.default_bool_extension]: false -[protobuf_unittest.default_string_extension]: "415" -[protobuf_unittest.default_bytes_extension]: "416" -[protobuf_unittest.default_nested_enum_extension]: FOO -[protobuf_unittest.default_foreign_enum_extension]: FOREIGN_FOO -[protobuf_unittest.default_import_enum_extension]: IMPORT_FOO -[protobuf_unittest.default_string_piece_extension]: "424" -[protobuf_unittest.default_cord_extension]: "425" -[protobuf_unittest.optional_bytes_cord_extension]: "optional bytes cord" -[protobuf_unittest.oneof_uint32_extension]: 601 -[protobuf_unittest.oneof_nested_message_extension] { +[proto2_unittest.default_int32_extension]: 401 +[proto2_unittest.default_int64_extension]: 402 +[proto2_unittest.default_uint32_extension]: 403 +[proto2_unittest.default_uint64_extension]: 404 +[proto2_unittest.default_sint32_extension]: 405 +[proto2_unittest.default_sint64_extension]: 406 +[proto2_unittest.default_fixed32_extension]: 407 +[proto2_unittest.default_fixed64_extension]: 408 +[proto2_unittest.default_sfixed32_extension]: 409 +[proto2_unittest.default_sfixed64_extension]: 410 +[proto2_unittest.default_float_extension]: 411 +[proto2_unittest.default_double_extension]: 412 +[proto2_unittest.default_bool_extension]: false +[proto2_unittest.default_string_extension]: "415" +[proto2_unittest.default_bytes_extension]: "416" +[proto2_unittest.default_nested_enum_extension]: FOO +[proto2_unittest.default_foreign_enum_extension]: FOREIGN_FOO +[proto2_unittest.default_import_enum_extension]: IMPORT_FOO +[proto2_unittest.default_string_piece_extension]: "424" +[proto2_unittest.default_cord_extension]: "425" +[proto2_unittest.optional_bytes_cord_extension]: "optional bytes cord" +[proto2_unittest.oneof_uint32_extension]: 601 +[proto2_unittest.oneof_nested_message_extension] { bb: 602 } -[protobuf_unittest.oneof_string_extension]: "603" -[protobuf_unittest.oneof_bytes_extension]: "604" +[proto2_unittest.oneof_string_extension]: "603" +[proto2_unittest.oneof_bytes_extension]: "604" diff --git a/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt b/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt index 20b5ea1162921..00e59634a3982 100644 --- a/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt +++ b/third_party/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt @@ -1,138 +1,138 @@ -[protobuf_unittest.optional_int32_extension]: 101 -[protobuf_unittest.optional_int64_extension]: 102 -[protobuf_unittest.optional_uint32_extension]: 103 -[protobuf_unittest.optional_uint64_extension]: 104 -[protobuf_unittest.optional_sint32_extension]: 105 -[protobuf_unittest.optional_sint64_extension]: 106 -[protobuf_unittest.optional_fixed32_extension]: 107 -[protobuf_unittest.optional_fixed64_extension]: 108 -[protobuf_unittest.optional_sfixed32_extension]: 109 -[protobuf_unittest.optional_sfixed64_extension]: 110 -[protobuf_unittest.optional_float_extension]: 111 -[protobuf_unittest.optional_double_extension]: 112 -[protobuf_unittest.optional_bool_extension]: true -[protobuf_unittest.optional_string_extension]: "115" -[protobuf_unittest.optional_bytes_extension]: "116" -[protobuf_unittest.optionalgroup_extension] < +[proto2_unittest.optional_int32_extension]: 101 +[proto2_unittest.optional_int64_extension]: 102 +[proto2_unittest.optional_uint32_extension]: 103 +[proto2_unittest.optional_uint64_extension]: 104 +[proto2_unittest.optional_sint32_extension]: 105 +[proto2_unittest.optional_sint64_extension]: 106 +[proto2_unittest.optional_fixed32_extension]: 107 +[proto2_unittest.optional_fixed64_extension]: 108 +[proto2_unittest.optional_sfixed32_extension]: 109 +[proto2_unittest.optional_sfixed64_extension]: 110 +[proto2_unittest.optional_float_extension]: 111 +[proto2_unittest.optional_double_extension]: 112 +[proto2_unittest.optional_bool_extension]: true +[proto2_unittest.optional_string_extension]: "115" +[proto2_unittest.optional_bytes_extension]: "116" +[proto2_unittest.optionalgroup_extension] < a: 117 > -[protobuf_unittest.optional_nested_message_extension] < +[proto2_unittest.optional_nested_message_extension] < bb: 118 > -[protobuf_unittest.optional_foreign_message_extension] < +[proto2_unittest.optional_foreign_message_extension] < c: 119 > -[protobuf_unittest.optional_import_message_extension] < +[proto2_unittest.optional_import_message_extension] < d: 120 > -[protobuf_unittest.optional_nested_enum_extension]: BAZ -[protobuf_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ -[protobuf_unittest.optional_import_enum_extension]: IMPORT_BAZ -[protobuf_unittest.optional_string_piece_extension]: "124" -[protobuf_unittest.optional_cord_extension]: "125" -[protobuf_unittest.optional_public_import_message_extension] < +[proto2_unittest.optional_nested_enum_extension]: BAZ +[proto2_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ +[proto2_unittest.optional_import_enum_extension]: IMPORT_BAZ +[proto2_unittest.optional_string_piece_extension]: "124" +[proto2_unittest.optional_cord_extension]: "125" +[proto2_unittest.optional_public_import_message_extension] < e: 126 > -[protobuf_unittest.optional_lazy_message_extension] < +[proto2_unittest.optional_lazy_message_extension] < bb: 127 > -[protobuf_unittest.optional_unverified_lazy_message_extension] < +[proto2_unittest.optional_unverified_lazy_message_extension] < bb: 128 > -[protobuf_unittest.repeated_int32_extension]: 201 -[protobuf_unittest.repeated_int32_extension]: 301 -[protobuf_unittest.repeated_int64_extension]: 202 -[protobuf_unittest.repeated_int64_extension]: 302 -[protobuf_unittest.repeated_uint32_extension]: 203 -[protobuf_unittest.repeated_uint32_extension]: 303 -[protobuf_unittest.repeated_uint64_extension]: 204 -[protobuf_unittest.repeated_uint64_extension]: 304 -[protobuf_unittest.repeated_sint32_extension]: 205 -[protobuf_unittest.repeated_sint32_extension]: 305 -[protobuf_unittest.repeated_sint64_extension]: 206 -[protobuf_unittest.repeated_sint64_extension]: 306 -[protobuf_unittest.repeated_fixed32_extension]: 207 -[protobuf_unittest.repeated_fixed32_extension]: 307 -[protobuf_unittest.repeated_fixed64_extension]: 208 -[protobuf_unittest.repeated_fixed64_extension]: 308 -[protobuf_unittest.repeated_sfixed32_extension]: 209 -[protobuf_unittest.repeated_sfixed32_extension]: 309 -[protobuf_unittest.repeated_sfixed64_extension]: 210 -[protobuf_unittest.repeated_sfixed64_extension]: 310 -[protobuf_unittest.repeated_float_extension]: 211 -[protobuf_unittest.repeated_float_extension]: 311 -[protobuf_unittest.repeated_double_extension]: 212 -[protobuf_unittest.repeated_double_extension]: 312 -[protobuf_unittest.repeated_bool_extension]: true -[protobuf_unittest.repeated_bool_extension]: false -[protobuf_unittest.repeated_string_extension]: "215" -[protobuf_unittest.repeated_string_extension]: "315" -[protobuf_unittest.repeated_bytes_extension]: "216" -[protobuf_unittest.repeated_bytes_extension]: "316" -[protobuf_unittest.repeatedgroup_extension] < +[proto2_unittest.repeated_int32_extension]: 201 +[proto2_unittest.repeated_int32_extension]: 301 +[proto2_unittest.repeated_int64_extension]: 202 +[proto2_unittest.repeated_int64_extension]: 302 +[proto2_unittest.repeated_uint32_extension]: 203 +[proto2_unittest.repeated_uint32_extension]: 303 +[proto2_unittest.repeated_uint64_extension]: 204 +[proto2_unittest.repeated_uint64_extension]: 304 +[proto2_unittest.repeated_sint32_extension]: 205 +[proto2_unittest.repeated_sint32_extension]: 305 +[proto2_unittest.repeated_sint64_extension]: 206 +[proto2_unittest.repeated_sint64_extension]: 306 +[proto2_unittest.repeated_fixed32_extension]: 207 +[proto2_unittest.repeated_fixed32_extension]: 307 +[proto2_unittest.repeated_fixed64_extension]: 208 +[proto2_unittest.repeated_fixed64_extension]: 308 +[proto2_unittest.repeated_sfixed32_extension]: 209 +[proto2_unittest.repeated_sfixed32_extension]: 309 +[proto2_unittest.repeated_sfixed64_extension]: 210 +[proto2_unittest.repeated_sfixed64_extension]: 310 +[proto2_unittest.repeated_float_extension]: 211 +[proto2_unittest.repeated_float_extension]: 311 +[proto2_unittest.repeated_double_extension]: 212 +[proto2_unittest.repeated_double_extension]: 312 +[proto2_unittest.repeated_bool_extension]: true +[proto2_unittest.repeated_bool_extension]: false +[proto2_unittest.repeated_string_extension]: "215" +[proto2_unittest.repeated_string_extension]: "315" +[proto2_unittest.repeated_bytes_extension]: "216" +[proto2_unittest.repeated_bytes_extension]: "316" +[proto2_unittest.repeatedgroup_extension] < a: 217 > -[protobuf_unittest.repeatedgroup_extension] < +[proto2_unittest.repeatedgroup_extension] < a: 317 > -[protobuf_unittest.repeated_nested_message_extension] < +[proto2_unittest.repeated_nested_message_extension] < bb: 218 > -[protobuf_unittest.repeated_nested_message_extension] < +[proto2_unittest.repeated_nested_message_extension] < bb: 318 > -[protobuf_unittest.repeated_foreign_message_extension] < +[proto2_unittest.repeated_foreign_message_extension] < c: 219 > -[protobuf_unittest.repeated_foreign_message_extension] < +[proto2_unittest.repeated_foreign_message_extension] < c: 319 > -[protobuf_unittest.repeated_import_message_extension] < +[proto2_unittest.repeated_import_message_extension] < d: 220 > -[protobuf_unittest.repeated_import_message_extension] < +[proto2_unittest.repeated_import_message_extension] < d: 320 > -[protobuf_unittest.repeated_nested_enum_extension]: BAR -[protobuf_unittest.repeated_nested_enum_extension]: BAZ -[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR -[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ -[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAR -[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAZ -[protobuf_unittest.repeated_string_piece_extension]: "224" -[protobuf_unittest.repeated_string_piece_extension]: "324" -[protobuf_unittest.repeated_cord_extension]: "225" -[protobuf_unittest.repeated_cord_extension]: "325" -[protobuf_unittest.repeated_lazy_message_extension] < +[proto2_unittest.repeated_nested_enum_extension]: BAR +[proto2_unittest.repeated_nested_enum_extension]: BAZ +[proto2_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR +[proto2_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ +[proto2_unittest.repeated_import_enum_extension]: IMPORT_BAR +[proto2_unittest.repeated_import_enum_extension]: IMPORT_BAZ +[proto2_unittest.repeated_string_piece_extension]: "224" +[proto2_unittest.repeated_string_piece_extension]: "324" +[proto2_unittest.repeated_cord_extension]: "225" +[proto2_unittest.repeated_cord_extension]: "325" +[proto2_unittest.repeated_lazy_message_extension] < bb: 227 > -[protobuf_unittest.repeated_lazy_message_extension] < +[proto2_unittest.repeated_lazy_message_extension] < bb: 327 > -[protobuf_unittest.default_int32_extension]: 401 -[protobuf_unittest.default_int64_extension]: 402 -[protobuf_unittest.default_uint32_extension]: 403 -[protobuf_unittest.default_uint64_extension]: 404 -[protobuf_unittest.default_sint32_extension]: 405 -[protobuf_unittest.default_sint64_extension]: 406 -[protobuf_unittest.default_fixed32_extension]: 407 -[protobuf_unittest.default_fixed64_extension]: 408 -[protobuf_unittest.default_sfixed32_extension]: 409 -[protobuf_unittest.default_sfixed64_extension]: 410 -[protobuf_unittest.default_float_extension]: 411 -[protobuf_unittest.default_double_extension]: 412 -[protobuf_unittest.default_bool_extension]: false -[protobuf_unittest.default_string_extension]: "415" -[protobuf_unittest.default_bytes_extension]: "416" -[protobuf_unittest.default_nested_enum_extension]: FOO -[protobuf_unittest.default_foreign_enum_extension]: FOREIGN_FOO -[protobuf_unittest.default_import_enum_extension]: IMPORT_FOO -[protobuf_unittest.default_string_piece_extension]: "424" -[protobuf_unittest.default_cord_extension]: "425" -[protobuf_unittest.optional_bytes_cord_extension]: "optional bytes cord" -[protobuf_unittest.oneof_uint32_extension]: 601 -[protobuf_unittest.oneof_nested_message_extension] < +[proto2_unittest.default_int32_extension]: 401 +[proto2_unittest.default_int64_extension]: 402 +[proto2_unittest.default_uint32_extension]: 403 +[proto2_unittest.default_uint64_extension]: 404 +[proto2_unittest.default_sint32_extension]: 405 +[proto2_unittest.default_sint64_extension]: 406 +[proto2_unittest.default_fixed32_extension]: 407 +[proto2_unittest.default_fixed64_extension]: 408 +[proto2_unittest.default_sfixed32_extension]: 409 +[proto2_unittest.default_sfixed64_extension]: 410 +[proto2_unittest.default_float_extension]: 411 +[proto2_unittest.default_double_extension]: 412 +[proto2_unittest.default_bool_extension]: false +[proto2_unittest.default_string_extension]: "415" +[proto2_unittest.default_bytes_extension]: "416" +[proto2_unittest.default_nested_enum_extension]: FOO +[proto2_unittest.default_foreign_enum_extension]: FOREIGN_FOO +[proto2_unittest.default_import_enum_extension]: IMPORT_FOO +[proto2_unittest.default_string_piece_extension]: "424" +[proto2_unittest.default_cord_extension]: "425" +[proto2_unittest.optional_bytes_cord_extension]: "optional bytes cord" +[proto2_unittest.oneof_uint32_extension]: 601 +[proto2_unittest.oneof_nested_message_extension] < bb: 602 > -[protobuf_unittest.oneof_string_extension]: "603" -[protobuf_unittest.oneof_bytes_extension]: "604" +[proto2_unittest.oneof_string_extension]: "603" +[proto2_unittest.oneof_bytes_extension]: "604" diff --git a/third_party/protobuf/src/google/protobuf/testing/BUILD.bazel b/third_party/protobuf/src/google/protobuf/testing/BUILD.bazel index 66b4f4abe9954..29324d9a25746 100644 --- a/third_party/protobuf/src/google/protobuf/testing/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/testing/BUILD.bazel @@ -11,6 +11,7 @@ package( cc_library( name = "file", + testonly = 1, srcs = ["file.cc"], hdrs = ["file.h"], copts = COPTS, @@ -20,10 +21,10 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/io:io_win32", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", ], ) @@ -46,14 +47,14 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/io:io_win32", "//src/google/protobuf/stubs:lite", - "@com_google_absl//absl/base:log_severity", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:log_sink", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", + "@abseil-cpp//absl/base:log_severity", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:log_sink", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", ], ) diff --git a/third_party/protobuf/src/google/protobuf/testing/file.cc b/third_party/protobuf/src/google/protobuf/testing/file.cc index 277e0f23d4d88..a75872c52802f 100644 --- a/third_party/protobuf/src/google/protobuf/testing/file.cc +++ b/third_party/protobuf/src/google/protobuf/testing/file.cc @@ -196,8 +196,8 @@ void File::DeleteRecursively(const std::string& name, void* dummy1, #endif } -bool File::ChangeWorkingDirectory(const std::string& new_working_directory) { - return chdir(new_working_directory.c_str()) == 0; +bool File::ChangeWorkingDirectory(absl::string_view new_working_directory) { + return chdir(new_working_directory.data()) == 0; } } // namespace protobuf diff --git a/third_party/protobuf/src/google/protobuf/testing/file.h b/third_party/protobuf/src/google/protobuf/testing/file.h index 74dfdbf98a0a1..7cfc7d2197a4b 100644 --- a/third_party/protobuf/src/google/protobuf/testing/file.h +++ b/third_party/protobuf/src/google/protobuf/testing/file.h @@ -63,7 +63,7 @@ class File { void* dummy2); // Change working directory to given directory. - static bool ChangeWorkingDirectory(const std::string& new_working_directory); + static bool ChangeWorkingDirectory(absl::string_view new_working_directory); static absl::Status GetContents(const std::string& name, std::string* output, bool /*is_default*/) { diff --git a/third_party/protobuf/src/google/protobuf/text_format.cc b/third_party/protobuf/src/google/protobuf/text_format.cc index b71e466062a9a..966626d175549 100644 --- a/third_party/protobuf/src/google/protobuf/text_format.cc +++ b/third_party/protobuf/src/google/protobuf/text_format.cc @@ -21,10 +21,12 @@ #include <cstdint> #include <limits> #include <memory> +#include <random> #include <string> #include <utility> #include <vector> +#include "absl/base/macros.h" #include "absl/container/btree_set.h" #include "absl/log/absl_check.h" #include "absl/strings/ascii.h" @@ -36,6 +38,8 @@ #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" #include "google/protobuf/any.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" @@ -99,7 +103,7 @@ const char kDebugStringSilentMarkerForDetection[] = "\t "; // Controls insertion of a marker making debug strings non-parseable, and // redacting annotated fields in Protobuf's DebugString APIs. -PROTOBUF_EXPORT std::atomic<bool> enable_debug_string_safe_format{false}; +PROTOBUF_EXPORT std::atomic<bool> enable_debug_string_safe_format{true}; int64_t GetRedactedFieldCount() { return num_redacted_field.load(std::memory_order_relaxed); @@ -480,7 +484,7 @@ class TextFormat::Parser::ParserImpl { // Consumes the specified message with the given starting delimiter. // This method checks to see that the end delimiter at the conclusion of // the consumption matches the starting delimiter passed in here. - bool ConsumeMessage(Message* message, const std::string delimiter) { + bool ConsumeMessage(Message* message, const std::string& delimiter) { while (!LookingAt(">") && !LookingAt("}")) { DO(ConsumeField(message)); } @@ -513,6 +517,26 @@ class TextFormat::Parser::ParserImpl { int start_line = tokenizer_.current().line; int start_column = tokenizer_.current().column; + auto skip_parsing = [&](bool result) { + // For historical reasons, fields may optionally be separated by commas or + // semicolons. + TryConsume(";") || TryConsume(","); + + // If a parse info tree exists, add the location for the parsed + // field. + if (parse_info_tree_ != nullptr) { + int end_line = tokenizer_.previous().line; + int end_column = tokenizer_.previous().end_column; + + RecordLocation( + parse_info_tree_, field, + ParseLocationRange(ParseLocation(start_line, start_column), + ParseLocation(end_line, end_column))); + } + + return result; + }; + const FieldDescriptor* any_type_url_field; const FieldDescriptor* any_value_field; if (internal::GetAnyFieldDescriptors(*message, &any_type_url_field, @@ -553,7 +577,7 @@ class TextFormat::Parser::ParserImpl { std::move(prefix_and_full_type_name)); reflection->SetString(message, any_value_field, std::move(serialized_value)); - return true; + return skip_parsing(true); } if (TryConsume("[")) { // Extension. @@ -649,10 +673,10 @@ class TextFormat::Parser::ParserImpl { if (TryConsumeBeforeWhitespace(":")) { TryConsumeWhitespace(); if (!LookingAt("{") && !LookingAt("<")) { - return SkipFieldValue(); + return skip_parsing(SkipFieldValue()); } } - return SkipFieldMessage(); + return skip_parsing(SkipFieldMessage()); } if (field->options().deprecated()) { @@ -700,7 +724,7 @@ class TextFormat::Parser::ParserImpl { finder_ ? finder_->FindExtensionFactory(field) : nullptr; reflection->MutableMessage(message, field, factory) ->ParseFromString(tmp); - goto label_skip_parsing; + return skip_parsing(true); } } else { // ':' is required here. @@ -730,23 +754,8 @@ class TextFormat::Parser::ParserImpl { } else { DO(ConsumeFieldValue(message, reflection, field)); } - label_skip_parsing: - // For historical reasons, fields may optionally be separated by commas or - // semicolons. - TryConsume(";") || TryConsume(","); - // If a parse info tree exists, add the location for the parsed - // field. - if (parse_info_tree_ != nullptr) { - int end_line = tokenizer_.previous().line; - int end_column = tokenizer_.previous().end_column; - - RecordLocation(parse_info_tree_, field, - ParseLocationRange(ParseLocation(start_line, start_column), - ParseLocation(end_line, end_column))); - } - - return true; + return skip_parsing(true); } // Skips the next field including the field's name and value. @@ -2294,6 +2303,9 @@ bool TextFormat::Printer::Print(const Message& message, internal::FieldReporterLevel reporter) const { TextGenerator generator(output, insert_silent_marker_, initial_indent_level_); + internal::PrintTextMarker(&generator, redact_debug_string_, + randomize_debug_string_, single_line_mode_); + Print(message, &generator); @@ -2608,7 +2620,8 @@ void MapFieldPrinterHelper::CopyValue(const MapValueRef& value, return; } case FieldDescriptor::CPPTYPE_STRING: - reflection->SetString(message, field_desc, value.GetStringValue()); + reflection->SetString(message, field_desc, + std::string(value.GetStringValue())); return; case FieldDescriptor::CPPTYPE_INT64: reflection->SetInt64(message, field_desc, value.GetInt64Value()); @@ -3020,20 +3033,71 @@ void TextFormat::Printer::PrintUnknownFields( } } -namespace internal { - -// Check if the field is sensitive and should be redacted. -bool ShouldRedactField(const FieldDescriptor* field) { - if (field->options().debug_redact()) return true; - return false; +// Traverse the tree of field options and check if any of them are sensitive. +// We check for sensitive enum values in the options and in the fields of the +// message-type options, recursively. +TextFormat::RedactionState TextFormat::IsOptionSensitive( + const Message& opts, const Reflection* reflection, + const FieldDescriptor* option) { + if (option->type() == FieldDescriptor::TYPE_ENUM) { + auto count = + option->is_repeated() ? reflection->FieldSize(opts, option) : 1; + for (auto i = 0; i < count; i++) { + int enum_val = option->is_repeated() + ? reflection->GetRepeatedEnumValue(opts, option, i) + : reflection->GetEnumValue(opts, option); + const EnumValueDescriptor* option_value = + option->enum_type()->FindValueByNumber(enum_val); + if (option_value->options().debug_redact()) { + return TextFormat::RedactionState{true, false}; + } + } + } else if (option->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + auto count = + option->is_repeated() ? reflection->FieldSize(opts, option) : 1; + for (auto i = 0; i < count; i++) { + const Message& sub_message = + option->is_repeated() + ? reflection->GetRepeatedMessage(opts, option, i) + : reflection->GetMessage(opts, option); + const Reflection* sub_reflection = sub_message.GetReflection(); + std::vector<const FieldDescriptor*> message_fields; + sub_reflection->ListFields(sub_message, &message_fields); + for (const FieldDescriptor* message_field : message_fields) { + auto result = TextFormat::IsOptionSensitive(sub_message, sub_reflection, + message_field); + if (result.redact) { + return result; + } + } + } + } + return TextFormat::RedactionState{false, false}; } -} // namespace internal - +TextFormat::RedactionState TextFormat::GetRedactionState( + const FieldDescriptor* field) { + auto options = field->options(); + auto state = TextFormat::RedactionState{options.debug_redact(), false}; + std::vector<const FieldDescriptor*> field_options; + const Reflection* reflection = options.GetReflection(); + reflection->ListFields(options, &field_options); + for (const FieldDescriptor* option : field_options) { + auto result = TextFormat::IsOptionSensitive(options, reflection, option); + state = TextFormat::RedactionState{state.redact || result.redact, + state.report || result.report}; + } + return state; +} bool TextFormat::Printer::TryRedactFieldValue( const Message& message, const FieldDescriptor* field, BaseTextGenerator* generator, bool insert_value_separator) const { - if (internal::ShouldRedactField(field)) { + TextFormat::RedactionState redaction_state = + field->file()->pool()->MemoizeProjection( + field, [](const FieldDescriptor* field) { + return TextFormat::GetRedactionState(field); + }); + if (redaction_state.redact) { if (redact_debug_string_) { IncrementRedactedFieldCounter(); if (insert_value_separator) { @@ -3053,6 +3117,73 @@ bool TextFormat::Printer::TryRedactFieldValue( return false; } +class TextMarkerGenerator final { + public: + static TextMarkerGenerator CreateRandom(); + + void PrintMarker(TextFormat::BaseTextGenerator* generator, bool redact, + bool randomize, bool single_line_mode) const { + if (redact) { + generator->Print(redaction_marker_.data(), redaction_marker_.size()); + } + if (randomize) { + generator->Print(random_marker_.data(), random_marker_.size()); + } + if ((redact || randomize) && !single_line_mode) { + generator->PrintLiteral("\n"); + } + } + + private: + static constexpr absl::string_view kRedactionMarkers[] = { + "goo.gle/debugonly ", "goo.gle/nodeserialize ", "goo.gle/debugstr ", + "goo.gle/debugproto "}; + + static constexpr absl::string_view kRandomMarker = " "; + + static_assert(!kRandomMarker.empty(), "The random marker cannot be empty!"); + + constexpr TextMarkerGenerator(absl::string_view redaction_marker, + absl::string_view random_marker) + : redaction_marker_(redaction_marker), random_marker_(random_marker) {} + + absl::string_view redaction_marker_; + absl::string_view random_marker_; +}; + +TextMarkerGenerator TextMarkerGenerator::CreateRandom() { + // We avoid using sources backed by system entropy to allow the marker + // generator to work in sandboxed environments that have no access to syscalls + // such as getrandom or getpid. Note that this randomization has no security + // implications, it's only used to break code that attempts to deserialize + // debug strings. + std::mt19937_64 random{ + static_cast<uint64_t>(absl::ToUnixMicros(absl::Now()))}; + + size_t redaction_marker_index = std::uniform_int_distribution<size_t>{ + 0, ABSL_ARRAYSIZE(kRedactionMarkers) - 1}(random); + + size_t random_marker_size = + std::uniform_int_distribution<size_t>{1, kRandomMarker.size()}(random); + + return TextMarkerGenerator(kRedactionMarkers[redaction_marker_index], + kRandomMarker.substr(0, random_marker_size)); +} + +const TextMarkerGenerator& GetGlobalTextMarkerGenerator() { + static const TextMarkerGenerator kTextMarkerGenerator = + TextMarkerGenerator::CreateRandom(); + return kTextMarkerGenerator; +} + +namespace internal { +void PrintTextMarker(TextFormat::BaseTextGenerator* generator, bool redact, + bool randomize, bool single_line_mode) { + GetGlobalTextMarkerGenerator().PrintMarker(generator, redact, randomize, + single_line_mode); +} +} // namespace internal + } // namespace protobuf } // namespace google diff --git a/third_party/protobuf/src/google/protobuf/text_format.h b/third_party/protobuf/src/google/protobuf/text_format.h index 7360aa29e00e0..980919795520e 100644 --- a/third_party/protobuf/src/google/protobuf/text_format.h +++ b/third_party/protobuf/src/google/protobuf/text_format.h @@ -46,7 +46,6 @@ PROTOBUF_EXPORT extern const char kDebugStringSilentMarkerForDetection[3]; PROTOBUF_EXPORT extern std::atomic<bool> enable_debug_string_safe_format; PROTOBUF_EXPORT int64_t GetRedactedFieldCount(); -PROTOBUF_EXPORT bool ShouldRedactField(const FieldDescriptor* field); // This enum contains all the APIs that convert protos to human-readable // formats. A higher-level API must correspond to a greater number than any @@ -618,6 +617,17 @@ class PROTOBUF_EXPORT TextFormat { : start(start_param), end(end_param) {} }; + struct RedactionState { + bool redact; + bool report; + }; + + static TextFormat::RedactionState GetRedactionState( + const FieldDescriptor* field); + + static TextFormat::RedactionState IsOptionSensitive( + const Message& opts, const Reflection* reflection, + const FieldDescriptor* option); // Data structure which is populated with the locations of each field // value parsed from the text. class PROTOBUF_EXPORT ParseInfoTree { @@ -819,6 +829,10 @@ class PROTOBUF_EXPORT TextFormat { const T&... values); }; +namespace internal { +void PrintTextMarker(TextFormat::BaseTextGenerator* generator, bool redact, + bool randomize, bool single_line_mode); +} // namespace internal inline void TextFormat::RecordLocation(ParseInfoTree* info_tree, const FieldDescriptor* field, diff --git a/third_party/protobuf/src/google/protobuf/text_format_unittest.cc b/third_party/protobuf/src/google/protobuf/text_format_unittest.cc index 747be25271bd9..db8c734e9baac 100644 --- a/third_party/protobuf/src/google/protobuf/text_format_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/text_format_unittest.cc @@ -49,6 +49,7 @@ #include "google/protobuf/unittest_mset.pb.h" #include "google/protobuf/unittest_mset_wire_format.pb.h" #include "google/protobuf/unittest_proto3.pb.h" +#include "google/protobuf/unittest_redaction.pb.h" #include "utf8_validity.h" @@ -75,7 +76,6 @@ class UnsetFieldsMetadataTextFormatTestUtil { // Can't use an anonymous namespace here due to brokenness of Tru64 compiler. namespace text_format_unittest { -using ::google::protobuf::internal::kDebugStringSilentMarker; using ::google::protobuf::internal::UnsetFieldsMetadataTextFormatTestUtil; using ::testing::AllOf; using ::testing::HasSubstr; @@ -93,10 +93,16 @@ constexpr absl::string_view kEscapeTestStringEscaped = constexpr absl::string_view value_replacement = "\\[REDACTED\\]"; +constexpr absl::string_view kTextMarkerRegex = "goo\\.gle/.+ +"; + class TextFormatTestBase : public testing::Test { public: void SetUp() override { - single_line_debug_format_prefix_ = ""; + // DebugString APIs insert a per-process randomized + // prefix. Here we obtain the prefixes by calling DebugString APIs on an + // empty proto. Note that Message::ShortDebugString() trims the last empty + // space so we have to add it back. + single_line_debug_format_prefix_ = proto_.ShortDebugString() + " "; multi_line_debug_format_prefix_ = proto_.DebugString(); } @@ -209,6 +215,7 @@ TEST_F(TextFormatTest, ShortFormat) { std::string value_replacement = "\\[REDACTED\\]"; EXPECT_THAT(google::protobuf::ShortFormat(proto), testing::MatchesRegex(absl::Substitute( + "$1" "optional_redacted_string: $0 " "optional_unredacted_string: \"bar\" " "repeated_redacted_string: $0 " @@ -225,7 +232,7 @@ TEST_F(TextFormatTest, ShortFormat) { "\\{ optional_unredacted_nested_string: \"8\" \\} " "map_redacted_string: $0 " "map_unredacted_string \\{ key: \"ghi\" value: \"jkl\" \\}", - value_replacement))); + value_replacement, kTextMarkerRegex))); } TEST_F(TextFormatTest, Utf8Format) { @@ -261,6 +268,7 @@ TEST_F(TextFormatTest, Utf8Format) { EXPECT_THAT(google::protobuf::Utf8Format(proto), testing::MatchesRegex(absl::Substitute( + "$1\n" "optional_redacted_string: $0\n" "optional_unredacted_string: \"bar\"\n" "repeated_redacted_string: $0\n" @@ -279,7 +287,7 @@ TEST_F(TextFormatTest, Utf8Format) { "map_redacted_string: $0\n" "map_unredacted_string \\{\n " "key: \"ghi\"\n value: \"jkl\"\n\\}\n", - value_replacement))); + value_replacement, kTextMarkerRegex))); } TEST_F(TextFormatTest, ShortPrimitiveRepeateds) { @@ -432,6 +440,7 @@ TEST_F(TextFormatTest, PrintUnknownFields) { message_text); EXPECT_THAT(absl::StrCat(message), testing::MatchesRegex(absl::Substitute( + "$1\n" "5: UNKNOWN_VARINT $0\n" "5: UNKNOWN_FIXED32 $0\n" "5: UNKNOWN_FIXED64 $0\n" @@ -440,7 +449,7 @@ TEST_F(TextFormatTest, PrintUnknownFields) { "8: UNKNOWN_VARINT $0\n" "8: UNKNOWN_VARINT $0\n" "8: UNKNOWN_VARINT $0\n", - value_replacement))); + value_replacement, kTextMarkerRegex))); } TEST_F(TextFormatTest, PrintUnknownFieldsDeepestStackWorks) { @@ -487,7 +496,7 @@ TEST_F(TextFormatTest, PrintUnknownFieldsHidden) { TEST_F(TextFormatTest, PrintUnknownMessage) { // Test heuristic printing of messages in an UnknownFieldSet. - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; // Cases which should not be interpreted as sub-messages. @@ -563,7 +572,7 @@ TEST_F(TextFormatTest, PrintDeeplyNestedUnknownMessage) { TEST_F(TextFormatTest, PrintMessageWithIndent) { // Test adding an initial indent to printing. - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.add_repeated_string("abc"); message.add_repeated_string("def"); @@ -585,7 +594,7 @@ TEST_F(TextFormatTest, PrintMessageWithIndent) { TEST_F(TextFormatTest, PrintMessageSingleLine) { // Test printing a message on a single line. - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.add_repeated_string("abc"); message.add_repeated_string("def"); @@ -605,7 +614,7 @@ TEST_F(TextFormatTest, PrintMessageSingleLine) { TEST_F(TextFormatTest, PrintBufferTooSmall) { // Test printing a message to a buffer that is too small. - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.add_repeated_string("abc"); message.add_repeated_string("def"); @@ -626,7 +635,7 @@ class CustomUInt32FieldValuePrinter : public TextFormat::FieldValuePrinter { }; TEST_F(TextFormatTest, DefaultCustomFieldPrinter) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.set_optional_uint32(42); message.add_repeated_uint32(1); @@ -650,7 +659,7 @@ class CustomInt32FieldValuePrinter : public TextFormat::FieldValuePrinter { }; TEST_F(TextFormatTest, FieldSpecificCustomPrinter) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.set_optional_int32(42); // This will be handled by our Printer. message.add_repeated_int32(42); // This will be printed as number. @@ -665,7 +674,7 @@ TEST_F(TextFormatTest, FieldSpecificCustomPrinter) { } TEST_F(TextFormatTest, FieldSpecificCustomPrinterRegisterSameFieldTwice) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; TextFormat::Printer printer; const FieldDescriptor* const field = message.GetDescriptor()->FindFieldByName("optional_int32"); @@ -678,7 +687,7 @@ TEST_F(TextFormatTest, FieldSpecificCustomPrinterRegisterSameFieldTwice) { } TEST_F(TextFormatTest, ErrorCasesRegisteringFieldValuePrinterShouldFail) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; TextFormat::Printer printer; // nullptr printer. EXPECT_FALSE(printer.RegisterFieldValuePrinter( @@ -712,7 +721,7 @@ class CustomMessageFieldValuePrinter : public TextFormat::FieldValuePrinter { }; TEST_F(TextFormatTest, CustomPrinterForComments) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.mutable_optional_nested_message(); message.mutable_optional_import_message()->set_d(42); message.add_repeated_nested_message(); @@ -759,7 +768,7 @@ class CustomMessageContentFieldValuePrinter }; TEST_F(TextFormatTest, CustomPrinterForMessageContent) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.mutable_optional_nested_message(); message.mutable_optional_import_message()->set_d(42); message.add_repeated_nested_message(); @@ -801,7 +810,7 @@ class CustomMultilineCommentPrinter : public TextFormat::FieldValuePrinter { }; TEST_F(TextFormatTest, CustomPrinterForMultilineComments) { - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.mutable_optional_nested_message(); message.mutable_optional_import_message()->set_d(42); TextFormat::Printer printer; @@ -873,7 +882,7 @@ TEST_F(TextFormatTest, CompactRepeatedFieldPrinter) { unittest::TestAllTypes::kRepeatedNestedMessageFieldNumber), new CompactRepeatedFieldPrinter)); - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.add_repeated_nested_message()->set_bb(1); message.add_repeated_nested_message()->set_bb(2); message.add_repeated_nested_message()->set_bb(3); @@ -923,7 +932,7 @@ TEST_F(TextFormatTest, MultilineStringPrinter) { unittest::TestAllTypes::kOptionalStringFieldNumber), new MultilineStringPrinter)); - protobuf_unittest::TestAllTypes message; + proto2_unittest::TestAllTypes message; message.set_optional_string("first line\nsecond line\nthird line"); std::string text; @@ -1331,6 +1340,32 @@ TEST_F(TextFormatTest, ParseShortRepeatedWithTrailingComma) { ASSERT_FALSE(TextFormat::ParseFromString(parse_string, &proto_)); } +TEST_F(TextFormatTest, ParseWithTrailingComma) { + EXPECT_TRUE(TextFormat::ParseFromString("optional_int32: 456 ,\n", &proto_)); + EXPECT_TRUE(TextFormat::ParseFromString( + "optional_foreign_enum: FOREIGN_FOO ,", &proto_)); + EXPECT_TRUE( + TextFormat::ParseFromString("repeated_string: [ \"foo\" ] ,", &proto_)); + EXPECT_TRUE(TextFormat::ParseFromString( + "repeated_nested_message: [ { bb: 1 , } ]", &proto_)); +} + +TEST_F(TextFormatTest, ParseUnknownWithTrailingComma) { + TextFormat::Parser parser; + parser.AllowUnknownField(true); + parser.AllowUnknownExtension(true); + + EXPECT_TRUE(parser.ParseFromString("unknown_int: 456 ,\n", &proto_)); + EXPECT_TRUE(parser.ParseFromString("unknown_enum: FOREIGN_FOO ,", &proto_)); + EXPECT_TRUE( + parser.ParseFromString("unknown_repeated: [ \"foo\" ] ,", &proto_)); + EXPECT_TRUE( + parser.ParseFromString("unknown_message: { bb: 1 , } ,", &proto_)); + EXPECT_TRUE( + parser.ParseFromString("unknown_message: { bb: 1 , } ,", &proto_)); + EXPECT_TRUE(parser.ParseFromString("[foo.unknown_extension]: 1 ,", &proto_)); +} + TEST_F(TextFormatTest, ParseShortRepeatedEmpty) { std::string parse_string = "repeated_int32: []\n" @@ -1674,7 +1709,7 @@ TEST_F(TextFormatTest, ParseExotic) { } TEST_F(TextFormatTest, PrintFieldsInIndexOrder) { - protobuf_unittest::TestFieldOrderings message; + proto2_unittest::TestFieldOrderings message; // Fields are listed in index order instead of field number. message.set_my_string("str"); // Field number 11 message.set_my_int(12345); // Field number 1 @@ -1683,20 +1718,20 @@ TEST_F(TextFormatTest, PrintFieldsInIndexOrder) { // Extension number 12. message .MutableExtension( - protobuf_unittest::TestExtensionOrderings2::test_ext_orderings2) + proto2_unittest::TestExtensionOrderings2::test_ext_orderings2) ->set_my_string("ext_str2"); // Extension number 13. message .MutableExtension( - protobuf_unittest::TestExtensionOrderings1::test_ext_orderings1) + proto2_unittest::TestExtensionOrderings1::test_ext_orderings1) ->set_my_string("ext_str1"); // Extension number 14. message - .MutableExtension(protobuf_unittest::TestExtensionOrderings2:: + .MutableExtension(proto2_unittest::TestExtensionOrderings2:: TestExtensionOrderings3::test_ext_orderings3) ->set_my_string("ext_str3"); // Extension number 50. - *message.MutableExtension(protobuf_unittest::my_extension_string) = "ext_str0"; + *message.MutableExtension(proto2_unittest::my_extension_string) = "ext_str0"; TextFormat::Printer printer; std::string text; @@ -1704,28 +1739,28 @@ TEST_F(TextFormatTest, PrintFieldsInIndexOrder) { // By default, print in field number order. // my_int: 12345 // my_string: "str" - // [protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] { + // [proto2_unittest.TestExtensionOrderings2.test_ext_orderings2] { // my_string: "ext_str2" // } - // [protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] { + // [proto2_unittest.TestExtensionOrderings1.test_ext_orderings1] { // my_string: "ext_str1" // } - // [protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3.test_ext_orderings3] + // [proto2_unittest.TestExtensionOrderings2.TestExtensionOrderings3.test_ext_orderings3] // { // my_string: "ext_str3" // } - // [protobuf_unittest.my_extension_string]: "ext_str0" + // [proto2_unittest.my_extension_string]: "ext_str0" // my_float: 0.999 printer.PrintToString(message, &text); EXPECT_EQ( "my_int: 12345\nmy_string: " - "\"str\"\n[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] " + "\"str\"\n[proto2_unittest.TestExtensionOrderings2.test_ext_orderings2] " "{\n my_string: " - "\"ext_str2\"\n}\n[protobuf_unittest.TestExtensionOrderings1.test_ext_" + "\"ext_str2\"\n}\n[proto2_unittest.TestExtensionOrderings1.test_ext_" "orderings1] {\n my_string: " - "\"ext_str1\"\n}\n[protobuf_unittest.TestExtensionOrderings2." + "\"ext_str1\"\n}\n[proto2_unittest.TestExtensionOrderings2." "TestExtensionOrderings3.test_ext_orderings3] {\n my_string: " - "\"ext_str3\"\n}\n[protobuf_unittest.my_extension_string]: " + "\"ext_str3\"\n}\n[proto2_unittest.my_extension_string]: " "\"ext_str0\"\nmy_float: 0.999\n", text); @@ -1733,28 +1768,28 @@ TEST_F(TextFormatTest, PrintFieldsInIndexOrder) { // my_string: "str" // my_int: 12345 // my_float: 0.999 - // [protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] { + // [proto2_unittest.TestExtensionOrderings2.test_ext_orderings2] { // my_string: "ext_str2" // } - // [protobuf_unittest.TestExtensionOrderings1.test_ext_orderings1] { + // [proto2_unittest.TestExtensionOrderings1.test_ext_orderings1] { // my_string: "ext_str1" // } - // [protobuf_unittest.TestExtensionOrderings2.TestExtensionOrderings3.test_ext_orderings3] + // [proto2_unittest.TestExtensionOrderings2.TestExtensionOrderings3.test_ext_orderings3] // { // my_string: "ext_str3" // } - // [protobuf_unittest.my_extension_string]: "ext_str0" + // [proto2_unittest.my_extension_string]: "ext_str0" printer.SetPrintMessageFieldsInIndexOrder(true); printer.PrintToString(message, &text); EXPECT_EQ( "my_string: \"str\"\nmy_int: 12345\nmy_float: " - "0.999\n[protobuf_unittest.TestExtensionOrderings2.test_ext_orderings2] " + "0.999\n[proto2_unittest.TestExtensionOrderings2.test_ext_orderings2] " "{\n my_string: " - "\"ext_str2\"\n}\n[protobuf_unittest.TestExtensionOrderings1.test_ext_" + "\"ext_str2\"\n}\n[proto2_unittest.TestExtensionOrderings1.test_ext_" "orderings1] {\n my_string: " - "\"ext_str1\"\n}\n[protobuf_unittest.TestExtensionOrderings2." + "\"ext_str1\"\n}\n[proto2_unittest.TestExtensionOrderings2." "TestExtensionOrderings3.test_ext_orderings3] {\n my_string: " - "\"ext_str3\"\n}\n[protobuf_unittest.my_extension_string]: \"ext_str0\"\n", + "\"ext_str3\"\n}\n[proto2_unittest.my_extension_string]: \"ext_str0\"\n", text); } @@ -2043,7 +2078,7 @@ TEST_F(TextFormatParserTest, InvalidToken) { TEST_F(TextFormatParserTest, InvalidFieldName) { ExpectFailure( "invalid_field: somevalue\n", - "Message type \"protobuf_unittest.TestAllTypes\" has no field named " + "Message type \"proto2_unittest.TestAllTypes\" has no field named " "\"invalid_field\".", 1, 14); } @@ -2056,12 +2091,12 @@ TEST_F(TextFormatParserTest, GroupCapitalization) { ExpectFailure( "OPTIONALgroup {\na: 15\n}\n", - "Message type \"protobuf_unittest.TestAllTypes\" has no field named " + "Message type \"proto2_unittest.TestAllTypes\" has no field named " "\"OPTIONALgroup\".", 1, 15); ExpectFailure( "Optional_Double: 10.0\n", - "Message type \"protobuf_unittest.TestAllTypes\" has no field named " + "Message type \"proto2_unittest.TestAllTypes\" has no field named " "\"Optional_Double\".", 1, 16); } @@ -2089,7 +2124,7 @@ TEST_F(TextFormatParserTest, DelimitedCapitalization) { TEST_F(TextFormatParserTest, AllowIgnoreCapitalizationError) { TextFormat::Parser parser; - protobuf_unittest::TestAllTypes proto; + proto2_unittest::TestAllTypes proto; // These fields have a mismatching case. EXPECT_FALSE(parser.ParseFromString("Optional_Double: 10.0", &proto)); @@ -2210,7 +2245,7 @@ TEST_F(TextFormatParserTest, UnknownExtension) { // Non-matching delimiters. ExpectFailure("[blahblah]: 123", "Extension \"blahblah\" is not defined or is not an " - "extension of \"protobuf_unittest.TestAllTypes\".", + "extension of \"proto2_unittest.TestAllTypes\".", 1, 11); } @@ -2262,8 +2297,8 @@ TEST_F(TextFormatParserTest, PrintErrorsToStderr) { EXPECT_CALL( log, Log(absl::LogSeverity::kError, testing::_, - "Error parsing text-format protobuf_unittest.TestAllTypes: " - "1:14: Message type \"protobuf_unittest.TestAllTypes\" has no field " + "Error parsing text-format proto2_unittest.TestAllTypes: " + "1:14: Message type \"proto2_unittest.TestAllTypes\" has no field " "named \"no_such_field\".")) .Times(1); log.StartCapturingLogs(); @@ -2277,7 +2312,7 @@ TEST_F(TextFormatParserTest, FailsOnTokenizationError) { absl::ScopedMockLog log(absl::MockLogDefault::kDisallowUnexpected); EXPECT_CALL(log, Log(absl::LogSeverity::kError, testing::_, - "Error parsing text-format protobuf_unittest.TestAllTypes: " + "Error parsing text-format proto2_unittest.TestAllTypes: " "1:1: Invalid control characters encountered in text.")) .Times(1); log.StartCapturingLogs(); @@ -2333,7 +2368,7 @@ TEST_F(TextFormatParserTest, SetRecursionLimitUnknownFieldValue) { std::string deep_input = absl::StrCat("unknown_nested_array: ", input); ExpectMessage( deep_input, - "WARNING:Message type \"protobuf_unittest.NestedTestAllTypes\" has no " + "WARNING:Message type \"proto2_unittest.NestedTestAllTypes\" has no " "field named \"unknown_nested_array\".\n1:123: Message is too deep, the " "parser exceeded the configured recursion limit of 100.", 1, 21, &message, false); @@ -2356,7 +2391,7 @@ TEST_F(TextFormatParserTest, SetRecursionLimitUnknownFieldMessage) { input = absl::Substitute(format, input); ExpectMessage( input, - "WARNING:Message type \"protobuf_unittest.NestedTestAllTypes\" has no " + "WARNING:Message type \"proto2_unittest.NestedTestAllTypes\" has no " "field named \"unknown_child\".\n1:1716: Message is too deep, the parser " "exceeded the configured recursion limit of 100.", 1, 14, &message, false); @@ -2368,7 +2403,7 @@ TEST_F(TextFormatParserTest, SetRecursionLimitUnknownFieldMessage) { TEST_F(TextFormatParserTest, ParseAnyFieldWithAdditionalWhiteSpaces) { Any any; std::string parse_string = - "[type.googleapis.com/protobuf_unittest.TestAllTypes] \t : \t {\n" + "[type.googleapis.com/proto2_unittest.TestAllTypes] \t : \t {\n" " optional_int32: 321\n" " optional_string: \"teststr0\"\n" "}\n"; @@ -2380,7 +2415,7 @@ TEST_F(TextFormatParserTest, ParseAnyFieldWithAdditionalWhiteSpaces) { std::string text; ASSERT_TRUE(printer.PrintToString(any, &text)); EXPECT_EQ(text, - "[type.googleapis.com/protobuf_unittest.TestAllTypes] {\n" + "[type.googleapis.com/proto2_unittest.TestAllTypes] {\n" " optional_int32: 321\n" " optional_string: \"teststr0\"\n" "}\n"); @@ -2389,8 +2424,8 @@ TEST_F(TextFormatParserTest, ParseAnyFieldWithAdditionalWhiteSpaces) { TEST_F(TextFormatParserTest, ParseExtensionFieldWithAdditionalWhiteSpaces) { unittest::TestAllExtensions proto; std::string parse_string = - "[protobuf_unittest.optional_int32_extension] : \t 101\n" - "[protobuf_unittest.optional_int64_extension] \t : 102\n"; + "[proto2_unittest.optional_int32_extension] : \t 101\n" + "[proto2_unittest.optional_int64_extension] \t : 102\n"; ASSERT_TRUE(TextFormat::ParseFromString(parse_string, &proto)); @@ -2398,8 +2433,8 @@ TEST_F(TextFormatParserTest, ParseExtensionFieldWithAdditionalWhiteSpaces) { std::string text; ASSERT_TRUE(printer.PrintToString(proto, &text)); EXPECT_EQ(text, - "[protobuf_unittest.optional_int32_extension]: 101\n" - "[protobuf_unittest.optional_int64_extension]: 102\n"); + "[proto2_unittest.optional_int32_extension]: 101\n" + "[proto2_unittest.optional_int64_extension]: 102\n"); } TEST_F(TextFormatParserTest, ParseNormalFieldWithAdditionalWhiteSpaces) { @@ -2437,7 +2472,7 @@ TEST_F(TextFormatParserTest, ParseNormalFieldWithAdditionalWhiteSpaces) { } TEST_F(TextFormatParserTest, ParseSkippedFieldWithAdditionalWhiteSpaces) { - protobuf_unittest::TestAllTypes proto; + proto2_unittest::TestAllTypes proto; TextFormat::Parser parser; parser.AllowUnknownField(true); EXPECT_TRUE( @@ -2467,23 +2502,23 @@ class TextFormatMessageSetTest : public testing::Test { }; const char TextFormatMessageSetTest::proto_text_format_[] = "message_set {\n" - " [protobuf_unittest.TestMessageSetExtension1] {\n" + " [proto2_unittest.TestMessageSetExtension1] {\n" " i: 23\n" " }\n" - " [protobuf_unittest.TestMessageSetExtension2] {\n" + " [proto2_unittest.TestMessageSetExtension2] {\n" " str: \"foo\"\n" " }\n" "}\n"; TEST_F(TextFormatMessageSetTest, Serialize) { - protobuf_unittest::TestMessageSetContainer proto; - protobuf_unittest::TestMessageSetExtension1* item_a = + proto2_unittest::TestMessageSetContainer proto; + proto2_unittest::TestMessageSetExtension1* item_a = proto.mutable_message_set()->MutableExtension( - protobuf_unittest::TestMessageSetExtension1::message_set_extension); + proto2_unittest::TestMessageSetExtension1::message_set_extension); item_a->set_i(23); - protobuf_unittest::TestMessageSetExtension2* item_b = + proto2_unittest::TestMessageSetExtension2* item_b = proto.mutable_message_set()->MutableExtension( - protobuf_unittest::TestMessageSetExtension2::message_set_extension); + proto2_unittest::TestMessageSetExtension2::message_set_extension); item_b->set_str("foo"); std::string actual_proto_text_format; TextFormat::PrintToString(proto, &actual_proto_text_format); @@ -2491,19 +2526,19 @@ TEST_F(TextFormatMessageSetTest, Serialize) { } TEST_F(TextFormatMessageSetTest, Deserialize) { - protobuf_unittest::TestMessageSetContainer proto; + proto2_unittest::TestMessageSetContainer proto; ASSERT_TRUE(TextFormat::ParseFromString(proto_text_format_, &proto)); EXPECT_EQ( 23, proto.message_set() .GetExtension( - protobuf_unittest::TestMessageSetExtension1::message_set_extension) + proto2_unittest::TestMessageSetExtension1::message_set_extension) .i()); EXPECT_EQ( "foo", proto.message_set() .GetExtension( - protobuf_unittest::TestMessageSetExtension2::message_set_extension) + proto2_unittest::TestMessageSetExtension2::message_set_extension) .str()); // Ensure that these are the only entries present. @@ -2514,7 +2549,7 @@ TEST_F(TextFormatMessageSetTest, Deserialize) { } TEST(TextFormatUnknownFieldTest, TestUnknownField) { - protobuf_unittest::TestAllTypes proto; + proto2_unittest::TestAllTypes proto; TextFormat::Parser parser; // Unknown field is not permitted by default. EXPECT_FALSE(parser.ParseFromString("unknown_field: 12345", &proto)); @@ -2618,7 +2653,7 @@ TEST(TextFormatUnknownFieldTest, TestUnknownField) { } TEST(TextFormatUnknownFieldTest, TestAnyInUnknownField) { - protobuf_unittest::TestAllTypes proto; + proto2_unittest::TestAllTypes proto; TextFormat::Parser parser; parser.AllowUnknownField(true); EXPECT_TRUE( @@ -2630,7 +2665,7 @@ TEST(TextFormatUnknownFieldTest, TestAnyInUnknownField) { } TEST(TextFormatUnknownFieldTest, TestUnknownExtension) { - protobuf_unittest::TestAllTypes proto; + proto2_unittest::TestAllTypes proto; TextFormat::Parser parser; std::string message_with_ext = "[test.extension1] {\n" @@ -2652,6 +2687,101 @@ TEST(TextFormatUnknownFieldTest, TestUnknownExtension) { EXPECT_FALSE(parser.ParseFromString("unknown_field: 1", &proto)); } +TEST(AbslStringifyTest, DebugStringIsTheSame) { + unittest::TestAllTypes proto; + proto.set_optional_int32(1); + proto.set_optional_string("foo"); + + EXPECT_THAT(proto.DebugString(), absl::StrCat(proto)); +} + +TEST(AbslStringifyTest, TextFormatIsUnchanged) { + unittest::TestAllTypes proto; + proto.set_optional_int32(1); + proto.set_optional_string("foo"); + + std::string text; + ASSERT_TRUE(TextFormat::PrintToString(proto, &text)); + EXPECT_EQ( + "optional_int32: 1\n" + "optional_string: \"foo\"\n", + text); +} + +TEST(AbslStringifyTest, StringifyHasRedactionMarker) { + unittest::TestAllTypes proto; + proto.set_optional_int32(1); + proto.set_optional_string("foo"); + + EXPECT_THAT(absl::StrCat(proto), testing::MatchesRegex(absl::Substitute( + "$0\n" + "optional_int32: 1\n" + "optional_string: \"foo\"\n", + kTextMarkerRegex))); +} + + +TEST(AbslStringifyTest, StringifyMetaAnnotatedIsRedacted) { + unittest::TestRedactedMessage proto; + proto.set_meta_annotated("foo"); + EXPECT_THAT(absl::StrCat(proto), testing::MatchesRegex(absl::Substitute( + "$0\n" + "meta_annotated: $1\n", + kTextMarkerRegex, value_replacement))); +} + +TEST(AbslStringifyTest, StringifyRepeatedMetaAnnotatedIsRedacted) { + unittest::TestRedactedMessage proto; + proto.set_repeated_meta_annotated("foo"); + EXPECT_THAT(absl::StrCat(proto), testing::MatchesRegex(absl::Substitute( + "$0\n" + "repeated_meta_annotated: $1\n", + kTextMarkerRegex, value_replacement))); +} + +TEST(AbslStringifyTest, StringifyRepeatedMetaAnnotatedIsNotRedacted) { + unittest::TestRedactedMessage proto; + proto.set_unredacted_repeated_annotations("foo"); + EXPECT_THAT(absl::StrCat(proto), + testing::MatchesRegex( + absl::Substitute("$0\n" + "unredacted_repeated_annotations: \"foo\"\n", + kTextMarkerRegex))); +} + +TEST(AbslStringifyTest, TextFormatMetaAnnotatedIsNotRedacted) { + unittest::TestRedactedMessage proto; + proto.set_meta_annotated("foo"); + std::string text; + ASSERT_TRUE(TextFormat::PrintToString(proto, &text)); + EXPECT_EQ("meta_annotated: \"foo\"\n", text); +} +TEST(AbslStringifyTest, StringifyDirectMessageEnumIsRedacted) { + unittest::TestRedactedMessage proto; + proto.set_test_direct_message_enum("foo"); + EXPECT_THAT(absl::StrCat(proto), testing::MatchesRegex(absl::Substitute( + "$0\n" + "test_direct_message_enum: $1\n", + kTextMarkerRegex, value_replacement))); +} +TEST(AbslStringifyTest, StringifyNestedMessageEnumIsRedacted) { + unittest::TestRedactedMessage proto; + proto.set_test_nested_message_enum("foo"); + EXPECT_THAT(absl::StrCat(proto), testing::MatchesRegex(absl::Substitute( + "$0\n" + "test_nested_message_enum: $1\n", + kTextMarkerRegex, value_replacement))); +} + +TEST(AbslStringifyTest, StringifyRedactedOptionDoesNotRedact) { + unittest::TestRedactedMessage proto; + proto.set_test_redacted_message_enum("foo"); + EXPECT_THAT(absl::StrCat(proto), testing::MatchesRegex(absl::Substitute( + "$0\n" + "test_redacted_message_enum: \"foo\"\n", + kTextMarkerRegex))); +} + TEST(TextFormatFloatingPointTest, PreservesNegative0) { proto3_unittest::TestAllTypes in_message; diff --git a/third_party/protobuf/src/google/protobuf/thread_safe_arena.h b/third_party/protobuf/src/google/protobuf/thread_safe_arena.h index 2065ee98e807b..b5bb21dc2df10 100644 --- a/third_party/protobuf/src/google/protobuf/thread_safe_arena.h +++ b/third_party/protobuf/src/google/protobuf/thread_safe_arena.h @@ -17,6 +17,7 @@ #include <vector> #include "absl/base/attributes.h" +#include "absl/base/optimization.h" #include "absl/synchronization/mutex.h" #include "google/protobuf/arena_align.h" #include "google/protobuf/arena_allocation_policy.h" @@ -68,7 +69,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { template <AllocationClient alloc_client = AllocationClient::kDefault> void* AllocateAligned(size_t n) { SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + if (ABSL_PREDICT_TRUE(GetSerialArenaFast(&arena))) { return arena->AllocateAligned<alloc_client>(n); } else { return AllocateAlignedFallback<alloc_client>(n); @@ -76,8 +77,8 @@ class PROTOBUF_EXPORT ThreadSafeArena { } void ReturnArrayMemory(void* p, size_t size) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + SerialArena* arena = nullptr; + if (ABSL_PREDICT_TRUE(GetSerialArenaFast(&arena))) { arena->ReturnArrayMemory(p, size); } } @@ -88,8 +89,8 @@ class PROTOBUF_EXPORT ThreadSafeArena { // have fallback function calls in tail position. This substantially improves // code for the happy path. PROTOBUF_NDEBUG_INLINE bool MaybeAllocateAligned(size_t n, void** out) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + SerialArena* arena = nullptr; + if (ABSL_PREDICT_TRUE(GetSerialArenaFast(&arena))) { return arena->MaybeAllocateAligned(n, out); } return false; @@ -175,7 +176,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { // This fast path optimizes the case where multiple threads allocate from // the same arena. ThreadCache* tc = &thread_cache(); - if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == tag_and_id_)) { + if (ABSL_PREDICT_TRUE(tc->last_lifecycle_id_seen == tag_and_id_)) { *arena = tc->last_serial_arena; return true; } diff --git a/third_party/protobuf/src/google/protobuf/timestamp.pb.cc b/third_party/protobuf/src/google/protobuf/timestamp.pb.cc index b631fcc3de02c..fbeaa82dc5673 100644 --- a/third_party/protobuf/src/google/protobuf/timestamp.pb.cc +++ b/third_party/protobuf/src/google/protobuf/timestamp.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/timestamp.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/timestamp.pb.h" @@ -29,14 +29,14 @@ namespace protobuf { inline constexpr Timestamp::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : seconds_{::int64_t{0}}, - nanos_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + seconds_{::int64_t{0}}, + nanos_{0} {} template <typename> PROTOBUF_CONSTEXPR Timestamp::Timestamp(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Timestamp_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -54,14 +54,14 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 TimestampDefaultTypeInternal _Timestamp_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -71,13 +71,15 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _impl_.seconds_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Timestamp, _impl_.nanos_), + 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::Timestamp)}, + {0, 10, -1, sizeof(::google::protobuf::Timestamp)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_Timestamp_default_instance_._instance, }; const char descriptor_table_protodef_google_2fprotobuf_2ftimestamp_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -112,11 +114,15 @@ namespace protobuf { class Timestamp::_Internal { public: + using HasBits = + decltype(std::declval<Timestamp>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Timestamp, _impl_._has_bits_); }; -Timestamp::Timestamp(::google::protobuf::Arena* arena) +Timestamp::Timestamp(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Timestamp_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -124,16 +130,22 @@ Timestamp::Timestamp(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.Timestamp) } Timestamp::Timestamp( - ::google::protobuf::Arena* arena, const Timestamp& from) - : Timestamp(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Timestamp& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, Timestamp_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE Timestamp::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Timestamp::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void Timestamp::SharedCtor(::_pb::Arena* arena) { +inline void Timestamp::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, seconds_), @@ -153,45 +165,53 @@ inline void Timestamp::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Timestamp::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Timestamp::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Timestamp(arena); } constexpr auto Timestamp::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(Timestamp), alignof(Timestamp)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Timestamp::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Timestamp_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Timestamp::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Timestamp>(), +constexpr auto Timestamp::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Timestamp_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Timestamp::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Timestamp>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Timestamp::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Timestamp>(), &Timestamp::ByteSizeLong, - &Timestamp::_InternalSerialize, + &Timestamp::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Timestamp>(), &Timestamp::ByteSizeLong, + &Timestamp::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Timestamp, _impl_._cached_size_), - false, - }, - &Timestamp::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2ftimestamp_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Timestamp::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Timestamp, _impl_._cached_size_), + false, + }, + &Timestamp::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2ftimestamp_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Timestamp_class_data_ = + Timestamp::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Timestamp::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Timestamp_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Timestamp_class_data_.tc_table); + return Timestamp_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Timestamp::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 0, 2> +Timestamp::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Timestamp, _impl_._has_bits_), 0, // no _extensions_ 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -200,7 +220,7 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Timestamp::_table_ = { 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Timestamp_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -208,26 +228,25 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> Timestamp::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int32 nanos = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Timestamp, _impl_.nanos_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Timestamp, _impl_.nanos_), 1>(), + {16, 1, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_)}}, // int64 seconds = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Timestamp, _impl_.seconds_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Timestamp, _impl_.seconds_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_)}}, }}, {{ 65535, 65535 }}, {{ // int64 seconds = 1; - {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt64)}, + {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.seconds_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, // int32 nanos = 2; - {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void Timestamp::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -235,80 +254,93 @@ PROTOBUF_NOINLINE void Timestamp::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( - reinterpret_cast<char*>(&_impl_.nanos_) - - reinterpret_cast<char*>(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + ::memset(&_impl_.seconds_, 0, static_cast<::size_t>( + reinterpret_cast<char*>(&_impl_.nanos_) - + reinterpret_cast<char*>(&_impl_.seconds_)) + sizeof(_impl_.nanos_)); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Timestamp::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Timestamp& this_ = static_cast<const Timestamp&>(base); +::uint8_t* PROTOBUF_NONNULL Timestamp::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Timestamp& this_ = static_cast<const Timestamp&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Timestamp::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Timestamp& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Timestamp::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Timestamp& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Timestamp) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Timestamp) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64ToArrayWithField<1>( - stream, this_._internal_seconds(), target); - } + // int64 seconds = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_seconds() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<1>( + stream, this_._internal_seconds(), target); + } + } - // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_nanos(), target); - } + // int32 nanos = 2; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (this_._internal_nanos() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_nanos(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Timestamp) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Timestamp) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Timestamp::ByteSizeLong(const MessageLite& base) { - const Timestamp& this_ = static_cast<const Timestamp&>(base); +::size_t Timestamp::ByteSizeLong(const MessageLite& base) { + const Timestamp& this_ = static_cast<const Timestamp&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Timestamp::ByteSizeLong() const { - const Timestamp& this_ = *this; +::size_t Timestamp::ByteSizeLong() const { + const Timestamp& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Timestamp) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Timestamp) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // int64 seconds = 1; - if (this_._internal_seconds() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_seconds()); - } - // int32 nanos = 2; - if (this_._internal_nanos() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_nanos()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // int64 seconds = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (this_._internal_seconds() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( + this_._internal_seconds()); + } + } + // int32 nanos = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + if (this_._internal_nanos() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_nanos()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Timestamp::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Timestamp*>(&to_msg); @@ -318,12 +350,20 @@ void Timestamp::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::googl ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_seconds() != 0) { - _this->_impl_.seconds_ = from._impl_.seconds_; - } - if (from._internal_nanos() != 0) { - _this->_impl_.nanos_ = from._impl_.nanos_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (from._internal_seconds() != 0) { + _this->_impl_.seconds_ = from._impl_.seconds_; + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (from._internal_nanos() != 0) { + _this->_impl_.nanos_ = from._impl_.nanos_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -335,9 +375,10 @@ void Timestamp::CopyFrom(const Timestamp& from) { } -void Timestamp::InternalSwap(Timestamp* PROTOBUF_RESTRICT other) { +void Timestamp::InternalSwap(Timestamp* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::google::protobuf::internal::memswap< PROTOBUF_FIELD_OFFSET(Timestamp, _impl_.nanos_) + sizeof(Timestamp::_impl_.nanos_) @@ -358,7 +399,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2ftimestamp_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/timestamp.pb.h b/third_party/protobuf/src/google/protobuf/timestamp.pb.h index 219f2ad5ca79f..a0d5d8fa66068 100644 --- a/third_party/protobuf/src/google/protobuf/timestamp.pb.h +++ b/third_party/protobuf/src/google/protobuf/timestamp.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/timestamp.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2ftimestamp_2eproto_2epb_2eh #define google_2fprotobuf_2ftimestamp_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -49,13 +49,15 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ftimestamp_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2ftimestamp_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftimestamp_2eproto; +} // extern "C" namespace google { namespace protobuf { class Timestamp; struct TimestampDefaultTypeInternal; PROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Timestamp_class_data_; } // namespace protobuf } // namespace google @@ -74,15 +76,14 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message ~Timestamp() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Timestamp* msg, std::destroying_delete_t) { + void operator delete(Timestamp* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Timestamp)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Timestamp( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Timestamp(::google::protobuf::internal::ConstantInitialized); inline Timestamp(const Timestamp& from) : Timestamp(nullptr, from) {} inline Timestamp(Timestamp&& from) noexcept @@ -105,30 +106,27 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Timestamp& default_instance() { - return *internal_default_instance(); - } - static inline const Timestamp* internal_default_instance() { - return reinterpret_cast<const Timestamp*>( + return *reinterpret_cast<const Timestamp*>( &_Timestamp_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(Timestamp& a, Timestamp& b) { a.Swap(&b); } - inline void Swap(Timestamp* other) { + inline void Swap(Timestamp* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -136,7 +134,7 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Timestamp* other) { + void UnsafeArenaSwap(Timestamp* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -144,7 +142,7 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Timestamp* New(::google::protobuf::Arena* arena = nullptr) const { + Timestamp* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Timestamp>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -153,9 +151,8 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message void MergeFrom(const Timestamp& from) { Timestamp::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -165,49 +162,51 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Timestamp* other); + void InternalSwap(Timestamp* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Timestamp"; } protected: - explicit Timestamp(::google::protobuf::Arena* arena); - Timestamp(::google::protobuf::Arena* arena, const Timestamp& from); - Timestamp(::google::protobuf::Arena* arena, Timestamp&& from) noexcept + explicit Timestamp(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Timestamp(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Timestamp& from); + Timestamp( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Timestamp&& from) noexcept : Timestamp(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -240,9 +239,9 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -252,22 +251,26 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Timestamp& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Timestamp& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::int64_t seconds_; ::int32_t nanos_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2ftimestamp_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Timestamp_class_data_; + // =================================================================== @@ -288,6 +291,7 @@ class PROTOBUF_EXPORT Timestamp final : public ::google::protobuf::Message inline void Timestamp::clear_seconds() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.seconds_ = ::int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int64_t Timestamp::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds) @@ -295,6 +299,7 @@ inline ::int64_t Timestamp::seconds() const { } inline void Timestamp::set_seconds(::int64_t value) { _internal_set_seconds(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds) } inline ::int64_t Timestamp::_internal_seconds() const { @@ -310,6 +315,7 @@ inline void Timestamp::_internal_set_seconds(::int64_t value) { inline void Timestamp::clear_nanos() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.nanos_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; } inline ::int32_t Timestamp::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos) @@ -317,6 +323,7 @@ inline ::int32_t Timestamp::nanos() const { } inline void Timestamp::set_nanos(::int32_t value) { _internal_set_nanos(value); + _impl_._has_bits_[0] |= 0x00000002u; // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos) } inline ::int32_t Timestamp::_internal_nanos() const { diff --git a/third_party/protobuf/src/google/protobuf/type.pb.cc b/third_party/protobuf/src/google/protobuf/type.pb.cc index 20a9dd59639ce..9bfe6f41e8e60 100644 --- a/third_party/protobuf/src/google/protobuf/type.pb.cc +++ b/third_party/protobuf/src/google/protobuf/type.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/type.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/type.pb.h" @@ -38,7 +38,7 @@ inline constexpr Option::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR Option::Option(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Option_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -57,7 +57,8 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Field::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : options_{}, + : _cached_size_{0}, + options_{}, name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), @@ -74,13 +75,12 @@ inline constexpr Field::Impl_::Impl_( cardinality_{static_cast< ::google::protobuf::Field_Cardinality >(0)}, number_{0}, oneof_index_{0}, - packed_{false}, - _cached_size_{0} {} + packed_{false} {} template <typename> PROTOBUF_CONSTEXPR Field::Field(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Field_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -99,17 +99,17 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr EnumValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : options_{}, + : _cached_size_{0}, + options_{}, name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), - number_{0}, - _cached_size_{0} {} + number_{0} {} template <typename> PROTOBUF_CONSTEXPR EnumValue::EnumValue(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(EnumValue_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -144,7 +144,7 @@ inline constexpr Type::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR Type::Type(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Type_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -178,7 +178,7 @@ inline constexpr Enum::Impl_::Impl_( template <typename> PROTOBUF_CONSTEXPR Enum::Enum(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Enum_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -196,8 +196,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumDefaultTypeInternal _Enum_default_instance_; } // namespace protobuf } // namespace google -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[3]; -static constexpr const ::_pb::ServiceDescriptor** +static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL + file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[3]; +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2ftype_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( @@ -217,14 +218,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, _impl_.syntax_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, _impl_.edition_), - ~0u, - ~0u, - ~0u, - ~0u, 0, ~0u, ~0u, - ~0u, // no _has_bits_ + ~0u, + 2, + 3, + 1, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -242,6 +243,16 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_.options_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_.json_name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _impl_.default_value_), + 4, + 5, + 6, + 0, + 1, + 7, + 8, + ~0u, + 2, + 3, PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _internal_metadata_), ~0u, // no _extensions_ @@ -256,13 +267,13 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_.source_context_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_.syntax_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _impl_.edition_), - ~0u, - ~0u, - ~0u, 0, ~0u, ~0u, - ~0u, // no _has_bits_ + 2, + 3, + 1, + PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -273,6 +284,9 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_.name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_.number_), PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _impl_.options_), + 0, + 1, + ~0u, PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _internal_metadata_), ~0u, // no _extensions_ @@ -283,19 +297,19 @@ const ::uint32_t ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _impl_.name_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _impl_.value_), - ~0u, 0, + 1, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, 15, -1, sizeof(::google::protobuf::Type)}, - {22, -1, -1, sizeof(::google::protobuf::Field)}, - {40, 54, -1, sizeof(::google::protobuf::Enum)}, - {60, -1, -1, sizeof(::google::protobuf::EnumValue)}, - {71, 81, -1, sizeof(::google::protobuf::Option)}, + {22, 40, -1, sizeof(::google::protobuf::Field)}, + {50, 64, -1, sizeof(::google::protobuf::Enum)}, + {70, 81, -1, sizeof(::google::protobuf::EnumValue)}, + {84, 94, -1, sizeof(::google::protobuf::Option)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_Type_default_instance_._instance, &::google::protobuf::_Field_default_instance_._instance, &::google::protobuf::_Enum_default_instance_._instance, @@ -347,8 +361,8 @@ const char descriptor_table_protodef_google_2fprotobuf_2ftype_2eproto[] ABSL_ATT "\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypesb" "\006proto3" }; -static const ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2ftype_2eproto_deps[2] = - { +static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const + descriptor_table_google_2fprotobuf_2ftype_2eproto_deps[2] = { &::descriptor_table_google_2fprotobuf_2fany_2eproto, &::descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto, }; @@ -371,74 +385,24 @@ PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fproto }; namespace google { namespace protobuf { -const ::google::protobuf::EnumDescriptor* Field_Kind_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Field_Kind_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[0]; } PROTOBUF_CONSTINIT const uint32_t Field_Kind_internal_data_[] = { 1245184u, 0u, }; -bool Field_Kind_IsValid(int value) { - return 0 <= value && value <= 18; -} -#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; -constexpr Field_Kind Field::TYPE_INT64; -constexpr Field_Kind Field::TYPE_UINT64; -constexpr Field_Kind Field::TYPE_INT32; -constexpr Field_Kind Field::TYPE_FIXED64; -constexpr Field_Kind Field::TYPE_FIXED32; -constexpr Field_Kind Field::TYPE_BOOL; -constexpr Field_Kind Field::TYPE_STRING; -constexpr Field_Kind Field::TYPE_GROUP; -constexpr Field_Kind Field::TYPE_MESSAGE; -constexpr Field_Kind Field::TYPE_BYTES; -constexpr Field_Kind Field::TYPE_UINT32; -constexpr Field_Kind Field::TYPE_ENUM; -constexpr Field_Kind Field::TYPE_SFIXED32; -constexpr Field_Kind Field::TYPE_SFIXED64; -constexpr Field_Kind Field::TYPE_SINT32; -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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* Field_Cardinality_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Field_Cardinality_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[1]; } PROTOBUF_CONSTINIT const uint32_t Field_Cardinality_internal_data_[] = { 262144u, 0u, }; -bool Field_Cardinality_IsValid(int value) { - return 0 <= value && value <= 3; -} -#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; -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 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* Syntax_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Syntax_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[2]; } PROTOBUF_CONSTINIT const uint32_t Syntax_internal_data_[] = { 196608u, 0u, }; -bool Syntax_IsValid(int value) { - return 0 <= value && value <= 2; -} // =================================================================== class Type::_Internal { @@ -452,20 +416,21 @@ class Type::_Internal { void Type::clear_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } -Type::Type(::google::protobuf::Arena* arena) +Type::Type(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Type_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Type) } -inline PROTOBUF_NDEBUG_INLINE Type::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Type& from_msg) +PROTOBUF_NDEBUG_INLINE Type::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Type& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, fields_{visibility, arena, from.fields_}, @@ -475,10 +440,10 @@ inline PROTOBUF_NDEBUG_INLINE Type::Impl_::Impl_( edition_(arena, from.edition_) {} Type::Type( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Type& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Type_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -488,16 +453,16 @@ Type::Type( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.source_context_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( - arena, *from._impl_.source_context_) - : nullptr; + _impl_.source_context_ = ((cached_has_bits & 0x00000004u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_context_) + : nullptr; _impl_.syntax_ = from._impl_.syntax_; // @@protoc_insertion_point(copy_constructor:google.protobuf.Type) } -inline PROTOBUF_NDEBUG_INLINE Type::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Type::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, fields_{visibility, arena}, oneofs_{visibility, arena}, @@ -505,7 +470,7 @@ inline PROTOBUF_NDEBUG_INLINE Type::Impl_::Impl_( name_(arena), edition_(arena) {} -inline void Type::SharedCtor(::_pb::Arena* arena) { +inline void Type::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, source_context_), @@ -528,8 +493,9 @@ inline void Type::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Type::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Type::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Type(arena); } constexpr auto Type::InternalNewImpl_() { @@ -556,35 +522,42 @@ constexpr auto Type::InternalNewImpl_() { alignof(Type)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Type::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Type_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Type::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Type>(), +constexpr auto Type::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Type_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Type::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Type>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Type::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Type>(), &Type::ByteSizeLong, - &Type::_InternalSerialize, + &Type::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Type>(), &Type::ByteSizeLong, + &Type::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Type, _impl_._cached_size_), - false, - }, - &Type::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2ftype_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Type::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Type, _impl_._cached_size_), + false, + }, + &Type::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2ftype_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Type_class_data_ = + Type::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Type::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Type_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Type_class_data_.tc_table); + return Type_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { +const ::_pbi::TcParseTable<3, 7, 3, 46, 2> +Type::_table_ = { { PROTOBUF_FIELD_OFFSET(Type, _impl_._has_bits_), 0, // no _extensions_ @@ -595,7 +568,7 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { 7, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Type_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -605,7 +578,7 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.name_)}}, // repeated .google.protobuf.Field fields = 2; {::_pbi::TcParser::FastMtR1, {18, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.fields_)}}, @@ -617,19 +590,19 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { {34, 63, 1, PROTOBUF_FIELD_OFFSET(Type, _impl_.options_)}}, // .google.protobuf.SourceContext source_context = 5; {::_pbi::TcParser::FastMtS1, - {42, 0, 2, PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_)}}, + {42, 2, 2, PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_)}}, // .google.protobuf.Syntax syntax = 6; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Type, _impl_.syntax_), 63>(), - {48, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Type, _impl_.syntax_), 3>(), + {48, 3, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_)}}, // string edition = 7; {::_pbi::TcParser::FastUS1, - {58, 63, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_)}}, + {58, 1, 0, PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Type, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // repeated .google.protobuf.Field fields = 2; {PROTOBUF_FIELD_OFFSET(Type, _impl_.fields_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, @@ -640,19 +613,21 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { {PROTOBUF_FIELD_OFFSET(Type, _impl_.options_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.SourceContext source_context = 5; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_), _Internal::kHasBitsOffset + 0, 2, + {PROTOBUF_FIELD_OFFSET(Type, _impl_.source_context_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 6; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Type, _impl_.syntax_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // string edition = 7; - {PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Field>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::SourceContext>()}, - }}, {{ + {PROTOBUF_FIELD_OFFSET(Type, _impl_.edition_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Field>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::SourceContext>()}, + }}, + {{ "\24\4\0\6\0\0\0\7" "google.protobuf.Type" "name" @@ -660,7 +635,6 @@ const ::_pbi::TcParseTable<3, 7, 3, 46, 2> Type::_table_ = { "edition" }}, }; - PROTOBUF_NOINLINE void Type::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Type) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -671,12 +645,18 @@ PROTOBUF_NOINLINE void Type::Clear() { _impl_.fields_.Clear(); _impl_.oneofs_.Clear(); _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.edition_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.source_context_ != nullptr); - _impl_.source_context_->Clear(); + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + _impl_.edition_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000004u) != 0) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); + } } _impl_.syntax_ = 0; _impl_._has_bits_.Clear(); @@ -684,160 +664,168 @@ PROTOBUF_NOINLINE void Type::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Type::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Type& this_ = static_cast<const Type&>(base); +::uint8_t* PROTOBUF_NONNULL Type::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Type& this_ = static_cast<const Type&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Type::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Type& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Type::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Type& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Type) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Type) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - // repeated .google.protobuf.Field fields = 2; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_fields_size()); - i < n; i++) { - const auto& repfield = this_._internal_fields().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Field fields = 2; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_fields_size()); + i < n; i++) { + const auto& repfield = this_._internal_fields().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated string oneofs = 3; - for (int i = 0, n = this_._internal_oneofs_size(); i < n; ++i) { - const auto& s = this_._internal_oneofs().Get(i); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.oneofs"); - target = stream->WriteString(3, s, target); - } + // repeated string oneofs = 3; + for (int i = 0, n = this_._internal_oneofs_size(); i < n; ++i) { + const auto& s = this_._internal_oneofs().Get(i); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + s.data(), static_cast<int>(s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.oneofs"); + target = stream->WriteString(3, s, target); + } - // repeated .google.protobuf.Option options = 4; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_options_size()); - i < n; i++) { - const auto& repfield = this_._internal_options().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Option options = 4; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_options_size()); + i < n; i++) { + const auto& repfield = this_._internal_options().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, repfield, repfield.GetCachedSize(), + target, stream); + } - cached_has_bits = this_._impl_._has_bits_[0]; - // .google.protobuf.SourceContext source_context = 5; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, - stream); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // .google.protobuf.SourceContext source_context = 5; + if ((cached_has_bits & 0x00000004u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 5, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, + stream); + } - // .google.protobuf.Syntax syntax = 6; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 6, this_._internal_syntax(), target); - } + // .google.protobuf.Syntax syntax = 6; + if ((cached_has_bits & 0x00000008u) != 0) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 6, this_._internal_syntax(), target); + } + } - // string edition = 7; - if (!this_._internal_edition().empty()) { - const std::string& _s = this_._internal_edition(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.edition"); - target = stream->WriteStringMaybeAliased(7, _s, target); - } + // string edition = 7; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_edition().empty()) { + const std::string& _s = this_._internal_edition(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Type.edition"); + target = stream->WriteStringMaybeAliased(7, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Type) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Type) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Type::ByteSizeLong(const MessageLite& base) { - const Type& this_ = static_cast<const Type&>(base); +::size_t Type::ByteSizeLong(const MessageLite& base) { + const Type& this_ = static_cast<const Type&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Type::ByteSizeLong() const { - const Type& this_ = *this; +::size_t Type::ByteSizeLong() const { + const Type& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Type) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Type) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.Field fields = 2; - { - total_size += 1UL * this_._internal_fields_size(); - for (const auto& msg : this_._internal_fields()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated string oneofs = 3; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_oneofs().size()); - for (int i = 0, n = this_._internal_oneofs().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_oneofs().Get(i)); - } - } - // repeated .google.protobuf.Option options = 4; - { - total_size += 1UL * this_._internal_options_size(); - for (const auto& msg : this_._internal_options()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - { - // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // string edition = 7; - if (!this_._internal_edition().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_edition()); - } - } - { - // .google.protobuf.SourceContext source_context = 5; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); - } - } - { - // .google.protobuf.Syntax syntax = 6; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.Field fields = 2; + { + total_size += 1UL * this_._internal_fields_size(); + for (const auto& msg : this_._internal_fields()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated string oneofs = 3; + { + total_size += + 1 * ::google::protobuf::internal::FromIntSize(this_._internal_oneofs().size()); + for (int i = 0, n = this_._internal_oneofs().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_oneofs().Get(i)); + } + } + // repeated .google.protobuf.Option options = 4; + { + total_size += 1UL * this_._internal_options_size(); + for (const auto& msg : this_._internal_options()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // string edition = 7; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_edition().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_edition()); + } + } + // .google.protobuf.SourceContext source_context = 5; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); + } + // .google.protobuf.Syntax syntax = 6; + if ((cached_has_bits & 0x00000008u) != 0) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Type::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Type*>(&to_msg); @@ -853,24 +841,39 @@ void Type::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pr _this->_internal_mutable_oneofs()->MergeFrom(from._internal_oneofs()); _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_edition().empty()) { - _this->_internal_set_edition(from._internal_edition()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.source_context_ != nullptr); - if (_this->_impl_.source_context_ == nullptr) { - _this->_impl_.source_context_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); - } else { - _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (!from._internal_edition().empty()) { + _this->_internal_set_edition(from._internal_edition()); + } else { + if (_this->_impl_.edition_.IsDefault()) { + _this->_internal_set_edition(""); + } + } + } + if ((cached_has_bits & 0x00000004u) != 0) { + ABSL_DCHECK(from._impl_.source_context_ != nullptr); + if (_this->_impl_.source_context_ == nullptr) { + _this->_impl_.source_context_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_context_); + } else { + _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + } + } + if ((cached_has_bits & 0x00000008u) != 0) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } } - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); @@ -884,7 +887,7 @@ void Type::CopyFrom(const Type& from) { } -void Type::InternalSwap(Type* PROTOBUF_RESTRICT other) { +void Type::InternalSwap(Type* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -910,32 +913,38 @@ void Type::InternalSwap(Type* PROTOBUF_RESTRICT other) { class Field::_Internal { public: + using HasBits = + decltype(std::declval<Field>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Field, _impl_._has_bits_); }; -Field::Field(::google::protobuf::Arena* arena) +Field::Field(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Field_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Field) } -inline PROTOBUF_NDEBUG_INLINE Field::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Field& from_msg) - : options_{visibility, arena, from.options_}, +PROTOBUF_NDEBUG_INLINE Field::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Field& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + options_{visibility, arena, from.options_}, name_(arena, from.name_), type_url_(arena, from.type_url_), json_name_(arena, from.json_name_), - default_value_(arena, from.default_value_), - _cached_size_{0} {} + default_value_(arena, from.default_value_) {} Field::Field( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Field& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Field_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -954,17 +963,17 @@ Field::Field( // @@protoc_insertion_point(copy_constructor:google.protobuf.Field) } -inline PROTOBUF_NDEBUG_INLINE Field::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Field::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : options_{visibility, arena}, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + options_{visibility, arena}, name_(arena), type_url_(arena), json_name_(arena), - default_value_(arena), - _cached_size_{0} {} + default_value_(arena) {} -inline void Field::SharedCtor(::_pb::Arena* arena) { +inline void Field::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, kind_), @@ -988,8 +997,9 @@ inline void Field::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Field::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Field::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Field(arena); } constexpr auto Field::InternalNewImpl_() { @@ -1008,37 +1018,44 @@ constexpr auto Field::InternalNewImpl_() { alignof(Field)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Field::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Field_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Field::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Field>(), +constexpr auto Field::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Field_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Field::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Field>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Field::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Field>(), &Field::ByteSizeLong, - &Field::_InternalSerialize, + &Field::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Field>(), &Field::ByteSizeLong, + &Field::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Field, _impl_._cached_size_), - false, - }, - &Field::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2ftype_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Field::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Field, _impl_._cached_size_), + false, + }, + &Field::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2ftype_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Field_class_data_ = + Field::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Field::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Field_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Field_class_data_.tc_table); + return Field_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { +const ::_pbi::TcParseTable<4, 10, 1, 72, 2> +Field::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Field, _impl_._has_bits_), 0, // no _extensions_ 11, 120, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1047,7 +1064,7 @@ const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { 10, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Field_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1056,36 +1073,36 @@ const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { }, {{ {::_pbi::TcParser::MiniParse, {}}, // .google.protobuf.Field.Kind kind = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.kind_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.kind_), 4>(), + {8, 4, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_)}}, // .google.protobuf.Field.Cardinality cardinality = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.cardinality_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.cardinality_), 5>(), + {16, 5, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_)}}, // int32 number = 3; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.number_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.number_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.number_), 6>(), + {24, 6, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.number_)}}, // string name = 4; {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.name_)}}, + {34, 0, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.name_)}}, {::_pbi::TcParser::MiniParse, {}}, // string type_url = 6; {::_pbi::TcParser::FastUS1, - {50, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_)}}, + {50, 1, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_)}}, // int32 oneof_index = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.oneof_index_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Field, _impl_.oneof_index_), 7>(), + {56, 7, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_)}}, // bool packed = 8; - {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(Field, _impl_.packed_), 63>(), - {64, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(Field, _impl_.packed_), 8>(), + {64, 8, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_)}}, // repeated .google.protobuf.Option options = 9; {::_pbi::TcParser::FastMtR1, {74, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.options_)}}, // string json_name = 10; {::_pbi::TcParser::FastUS1, - {82, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_)}}, + {82, 2, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_)}}, // string default_value = 11; {::_pbi::TcParser::FastUS1, - {90, 63, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_)}}, + {90, 3, 0, PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_)}}, {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, @@ -1094,38 +1111,40 @@ const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { 65535, 65535 }}, {{ // .google.protobuf.Field.Kind kind = 1; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.kind_), _Internal::kHasBitsOffset + 4, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // .google.protobuf.Field.Cardinality cardinality = 2; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.cardinality_), _Internal::kHasBitsOffset + 5, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // int32 number = 3; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.number_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.number_), _Internal::kHasBitsOffset + 6, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, // string name = 4; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string type_url = 6; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.type_url_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // int32 oneof_index = 7; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.oneof_index_), _Internal::kHasBitsOffset + 7, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, // bool packed = 8; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.packed_), _Internal::kHasBitsOffset + 8, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, // repeated .google.protobuf.Option options = 9; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.options_), 0, 0, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.options_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // string json_name = 10; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Field, _impl_.json_name_), _Internal::kHasBitsOffset + 2, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // string default_value = 11; - {PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, - }}, {{ + {PROTOBUF_FIELD_OFFSET(Field, _impl_.default_value_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, + }}, + {{ "\25\0\0\0\4\10\0\0\0\11\15\0\0\0\0\0" "google.protobuf.Field" "name" @@ -1134,7 +1153,6 @@ const ::_pbi::TcParseTable<4, 10, 1, 72, 2> Field::_table_ = { "default_value" }}, }; - PROTOBUF_NOINLINE void Field::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Field) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1143,191 +1161,245 @@ PROTOBUF_NOINLINE void Field::Clear() { (void) cached_has_bits; _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.type_url_.ClearToEmpty(); - _impl_.json_name_.ClearToEmpty(); - _impl_.default_value_.ClearToEmpty(); - ::memset(&_impl_.kind_, 0, static_cast<::size_t>( - reinterpret_cast<char*>(&_impl_.packed_) - - reinterpret_cast<char*>(&_impl_.kind_)) + sizeof(_impl_.packed_)); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + _impl_.type_url_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000004u) != 0) { + _impl_.json_name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000008u) != 0) { + _impl_.default_value_.ClearNonDefaultToEmpty(); + } + } + if ((cached_has_bits & 0x000000f0u) != 0) { + ::memset(&_impl_.kind_, 0, static_cast<::size_t>( + reinterpret_cast<char*>(&_impl_.oneof_index_) - + reinterpret_cast<char*>(&_impl_.kind_)) + sizeof(_impl_.oneof_index_)); + } + _impl_.packed_ = false; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Field::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Field& this_ = static_cast<const Field&>(base); +::uint8_t* PROTOBUF_NONNULL Field::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Field& this_ = static_cast<const Field&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Field::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Field& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Field::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Field& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Field) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Field) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // .google.protobuf.Field.Kind kind = 1; - if (this_._internal_kind() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this_._internal_kind(), target); - } + // .google.protobuf.Field.Kind kind = 1; + if ((this_._impl_._has_bits_[0] & 0x00000010u) != 0) { + if (this_._internal_kind() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this_._internal_kind(), target); + } + } - // .google.protobuf.Field.Cardinality cardinality = 2; - if (this_._internal_cardinality() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 2, this_._internal_cardinality(), target); - } + // .google.protobuf.Field.Cardinality cardinality = 2; + if ((this_._impl_._has_bits_[0] & 0x00000020u) != 0) { + if (this_._internal_cardinality() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this_._internal_cardinality(), target); + } + } - // int32 number = 3; - if (this_._internal_number() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this_._internal_number(), target); - } + // int32 number = 3; + if ((this_._impl_._has_bits_[0] & 0x00000040u) != 0) { + if (this_._internal_number() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<3>( + stream, this_._internal_number(), target); + } + } - // string name = 4; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); - target = stream->WriteStringMaybeAliased(4, _s, target); - } + // string name = 4; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.name"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } + } - // string type_url = 6; - if (!this_._internal_type_url().empty()) { - const std::string& _s = this_._internal_type_url(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); - target = stream->WriteStringMaybeAliased(6, _s, target); - } + // string type_url = 6; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (!this_._internal_type_url().empty()) { + const std::string& _s = this_._internal_type_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.type_url"); + target = stream->WriteStringMaybeAliased(6, _s, target); + } + } - // int32 oneof_index = 7; - if (this_._internal_oneof_index() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<7>( - stream, this_._internal_oneof_index(), target); - } + // int32 oneof_index = 7; + if ((this_._impl_._has_bits_[0] & 0x00000080u) != 0) { + if (this_._internal_oneof_index() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<7>( + stream, this_._internal_oneof_index(), target); + } + } - // bool packed = 8; - if (this_._internal_packed() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 8, this_._internal_packed(), target); - } + // bool packed = 8; + if ((this_._impl_._has_bits_[0] & 0x00000100u) != 0) { + if (this_._internal_packed() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 8, this_._internal_packed(), target); + } + } - // repeated .google.protobuf.Option options = 9; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_options_size()); - i < n; i++) { - const auto& repfield = this_._internal_options().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 9, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Option options = 9; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_options_size()); + i < n; i++) { + const auto& repfield = this_._internal_options().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 9, repfield, repfield.GetCachedSize(), + target, stream); + } - // string json_name = 10; - if (!this_._internal_json_name().empty()) { - const std::string& _s = this_._internal_json_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); - target = stream->WriteStringMaybeAliased(10, _s, target); - } + // string json_name = 10; + if ((this_._impl_._has_bits_[0] & 0x00000004u) != 0) { + if (!this_._internal_json_name().empty()) { + const std::string& _s = this_._internal_json_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.json_name"); + target = stream->WriteStringMaybeAliased(10, _s, target); + } + } - // string default_value = 11; - if (!this_._internal_default_value().empty()) { - const std::string& _s = this_._internal_default_value(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); - target = stream->WriteStringMaybeAliased(11, _s, target); - } + // string default_value = 11; + if ((this_._impl_._has_bits_[0] & 0x00000008u) != 0) { + if (!this_._internal_default_value().empty()) { + const std::string& _s = this_._internal_default_value(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Field.default_value"); + target = stream->WriteStringMaybeAliased(11, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Field) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Field) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Field::ByteSizeLong(const MessageLite& base) { - const Field& this_ = static_cast<const Field&>(base); +::size_t Field::ByteSizeLong(const MessageLite& base) { + const Field& this_ = static_cast<const Field&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Field::ByteSizeLong() const { - const Field& this_ = *this; +::size_t Field::ByteSizeLong() const { + const Field& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Field) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Field) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.Option options = 9; - { - total_size += 1UL * this_._internal_options_size(); - for (const auto& msg : this_._internal_options()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - { - // string name = 4; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // string type_url = 6; - if (!this_._internal_type_url().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_type_url()); - } - // string json_name = 10; - if (!this_._internal_json_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_json_name()); - } - // string default_value = 11; - if (!this_._internal_default_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_default_value()); - } - // .google.protobuf.Field.Kind kind = 1; - if (this_._internal_kind() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_kind()); - } - // .google.protobuf.Field.Cardinality cardinality = 2; - if (this_._internal_cardinality() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_cardinality()); - } - // int32 number = 3; - if (this_._internal_number() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); - } - // int32 oneof_index = 7; - if (this_._internal_oneof_index() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_oneof_index()); - } - // bool packed = 8; - if (this_._internal_packed() != 0) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.Option options = 9; + { + total_size += 1UL * this_._internal_options_size(); + for (const auto& msg : this_._internal_options()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x000000ffu) != 0) { + // string name = 4; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // string type_url = 6; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_type_url().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_type_url()); + } + } + // string json_name = 10; + if ((cached_has_bits & 0x00000004u) != 0) { + if (!this_._internal_json_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_json_name()); + } + } + // string default_value = 11; + if ((cached_has_bits & 0x00000008u) != 0) { + if (!this_._internal_default_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_default_value()); + } + } + // .google.protobuf.Field.Kind kind = 1; + if ((cached_has_bits & 0x00000010u) != 0) { + if (this_._internal_kind() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_kind()); + } + } + // .google.protobuf.Field.Cardinality cardinality = 2; + if ((cached_has_bits & 0x00000020u) != 0) { + if (this_._internal_cardinality() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_cardinality()); + } + } + // int32 number = 3; + if ((cached_has_bits & 0x00000040u) != 0) { + if (this_._internal_number() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_number()); + } + } + // int32 oneof_index = 7; + if ((cached_has_bits & 0x00000080u) != 0) { + if (this_._internal_oneof_index() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_oneof_index()); + } + } + } + { + // bool packed = 8; + if ((cached_has_bits & 0x00000100u) != 0) { + if (this_._internal_packed() != 0) { + total_size += 2; + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Field::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Field*>(&to_msg); @@ -1339,33 +1411,71 @@ void Field::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::p _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x000000ffu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (!from._internal_type_url().empty()) { + _this->_internal_set_type_url(from._internal_type_url()); + } else { + if (_this->_impl_.type_url_.IsDefault()) { + _this->_internal_set_type_url(""); + } + } + } + if ((cached_has_bits & 0x00000004u) != 0) { + if (!from._internal_json_name().empty()) { + _this->_internal_set_json_name(from._internal_json_name()); + } else { + if (_this->_impl_.json_name_.IsDefault()) { + _this->_internal_set_json_name(""); + } + } + } + if ((cached_has_bits & 0x00000008u) != 0) { + if (!from._internal_default_value().empty()) { + _this->_internal_set_default_value(from._internal_default_value()); + } else { + if (_this->_impl_.default_value_.IsDefault()) { + _this->_internal_set_default_value(""); + } + } + } + if ((cached_has_bits & 0x00000010u) != 0) { + if (from._internal_kind() != 0) { + _this->_impl_.kind_ = from._impl_.kind_; + } + } + if ((cached_has_bits & 0x00000020u) != 0) { + if (from._internal_cardinality() != 0) { + _this->_impl_.cardinality_ = from._impl_.cardinality_; + } + } + if ((cached_has_bits & 0x00000040u) != 0) { + if (from._internal_number() != 0) { + _this->_impl_.number_ = from._impl_.number_; + } + } + if ((cached_has_bits & 0x00000080u) != 0) { + if (from._internal_oneof_index() != 0) { + _this->_impl_.oneof_index_ = from._impl_.oneof_index_; + } + } } - if (!from._internal_type_url().empty()) { - _this->_internal_set_type_url(from._internal_type_url()); - } - if (!from._internal_json_name().empty()) { - _this->_internal_set_json_name(from._internal_json_name()); - } - if (!from._internal_default_value().empty()) { - _this->_internal_set_default_value(from._internal_default_value()); - } - if (from._internal_kind() != 0) { - _this->_impl_.kind_ = from._impl_.kind_; - } - if (from._internal_cardinality() != 0) { - _this->_impl_.cardinality_ = from._impl_.cardinality_; - } - if (from._internal_number() != 0) { - _this->_impl_.number_ = from._impl_.number_; - } - if (from._internal_oneof_index() != 0) { - _this->_impl_.oneof_index_ = from._impl_.oneof_index_; - } - if (from._internal_packed() != 0) { - _this->_impl_.packed_ = from._impl_.packed_; + if ((cached_has_bits & 0x00000100u) != 0) { + if (from._internal_packed() != 0) { + _this->_impl_.packed_ = from._impl_.packed_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1377,11 +1487,12 @@ void Field::CopyFrom(const Field& from) { } -void Field::InternalSwap(Field* PROTOBUF_RESTRICT other) { +void Field::InternalSwap(Field* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.options_.InternalSwap(&other->_impl_.options_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.type_url_, &other->_impl_.type_url_, arena); @@ -1411,20 +1522,21 @@ class Enum::_Internal { void Enum::clear_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ != nullptr) _impl_.source_context_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } -Enum::Enum(::google::protobuf::Arena* arena) +Enum::Enum(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Enum_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Enum) } -inline PROTOBUF_NDEBUG_INLINE Enum::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Enum& from_msg) +PROTOBUF_NDEBUG_INLINE Enum::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Enum& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, enumvalue_{visibility, arena, from.enumvalue_}, @@ -1433,10 +1545,10 @@ inline PROTOBUF_NDEBUG_INLINE Enum::Impl_::Impl_( edition_(arena, from.edition_) {} Enum::Enum( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Enum& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Enum_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1446,23 +1558,23 @@ Enum::Enum( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.source_context_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>( - arena, *from._impl_.source_context_) - : nullptr; + _impl_.source_context_ = ((cached_has_bits & 0x00000004u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_context_) + : nullptr; _impl_.syntax_ = from._impl_.syntax_; // @@protoc_insertion_point(copy_constructor:google.protobuf.Enum) } -inline PROTOBUF_NDEBUG_INLINE Enum::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Enum::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, enumvalue_{visibility, arena}, options_{visibility, arena}, name_(arena), edition_(arena) {} -inline void Enum::SharedCtor(::_pb::Arena* arena) { +inline void Enum::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast<char *>(&_impl_) + offsetof(Impl_, source_context_), @@ -1485,8 +1597,9 @@ inline void Enum::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Enum::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Enum::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Enum(arena); } constexpr auto Enum::InternalNewImpl_() { @@ -1509,35 +1622,42 @@ constexpr auto Enum::InternalNewImpl_() { alignof(Enum)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Enum::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Enum_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Enum::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Enum>(), +constexpr auto Enum::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Enum_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Enum::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Enum>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Enum::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Enum>(), &Enum::ByteSizeLong, - &Enum::_InternalSerialize, + &Enum::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Enum>(), &Enum::ByteSizeLong, + &Enum::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Enum, _impl_._cached_size_), - false, - }, - &Enum::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2ftype_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Enum::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Enum, _impl_._cached_size_), + false, + }, + &Enum::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2ftype_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Enum_class_data_ = + Enum::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Enum::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Enum_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Enum_class_data_.tc_table); + return Enum_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { +const ::_pbi::TcParseTable<3, 6, 3, 40, 2> +Enum::_table_ = { { PROTOBUF_FIELD_OFFSET(Enum, _impl_._has_bits_), 0, // no _extensions_ @@ -1548,7 +1668,7 @@ const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { 6, // num_field_entries 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Enum_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1558,7 +1678,7 @@ const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_)}}, // repeated .google.protobuf.EnumValue enumvalue = 2; {::_pbi::TcParser::FastMtR1, {18, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.enumvalue_)}}, @@ -1567,20 +1687,20 @@ const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { {26, 63, 1, PROTOBUF_FIELD_OFFSET(Enum, _impl_.options_)}}, // .google.protobuf.SourceContext source_context = 4; {::_pbi::TcParser::FastMtS1, - {34, 0, 2, PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_)}}, + {34, 2, 2, PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_)}}, // .google.protobuf.Syntax syntax = 5; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Enum, _impl_.syntax_), 63>(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Enum, _impl_.syntax_), 3>(), + {40, 3, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_)}}, // string edition = 6; {::_pbi::TcParser::FastUS1, - {50, 63, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_)}}, + {50, 1, 0, PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_)}}, {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // repeated .google.protobuf.EnumValue enumvalue = 2; {PROTOBUF_FIELD_OFFSET(Enum, _impl_.enumvalue_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, @@ -1588,26 +1708,27 @@ const ::_pbi::TcParseTable<3, 6, 3, 40, 2> Enum::_table_ = { {PROTOBUF_FIELD_OFFSET(Enum, _impl_.options_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.SourceContext source_context = 4; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_), _Internal::kHasBitsOffset + 0, 2, + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.source_context_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // .google.protobuf.Syntax syntax = 5; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.syntax_), _Internal::kHasBitsOffset + 3, 0, + (0 | ::_fl::kFcOptional | ::_fl::kOpenEnum)}, // string edition = 6; - {PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::EnumValue>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::SourceContext>()}, - }}, {{ + {PROTOBUF_FIELD_OFFSET(Enum, _impl_.edition_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::EnumValue>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, + {::_pbi::TcParser::GetTable<::google::protobuf::SourceContext>()}, + }}, + {{ "\24\4\0\0\0\0\7\0" "google.protobuf.Enum" "name" "edition" }}, }; - PROTOBUF_NOINLINE void Enum::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Enum) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1617,12 +1738,18 @@ PROTOBUF_NOINLINE void Enum::Clear() { _impl_.enumvalue_.Clear(); _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.edition_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.source_context_ != nullptr); - _impl_.source_context_->Clear(); + if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + _impl_.edition_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000004u) != 0) { + ABSL_DCHECK(_impl_.source_context_ != nullptr); + _impl_.source_context_->Clear(); + } } _impl_.syntax_ = 0; _impl_._has_bits_.Clear(); @@ -1630,143 +1757,151 @@ PROTOBUF_NOINLINE void Enum::Clear() { } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Enum::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Enum& this_ = static_cast<const Enum&>(base); +::uint8_t* PROTOBUF_NONNULL Enum::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Enum& this_ = static_cast<const Enum&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Enum::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Enum& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Enum::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Enum& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Enum) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Enum) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - // repeated .google.protobuf.EnumValue enumvalue = 2; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_enumvalue_size()); - i < n; i++) { - const auto& repfield = this_._internal_enumvalue().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.EnumValue enumvalue = 2; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_enumvalue_size()); + i < n; i++) { + const auto& repfield = this_._internal_enumvalue().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, repfield, repfield.GetCachedSize(), + target, stream); + } - // repeated .google.protobuf.Option options = 3; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_options_size()); - i < n; i++) { - const auto& repfield = this_._internal_options().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Option options = 3; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_options_size()); + i < n; i++) { + const auto& repfield = this_._internal_options().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, repfield, repfield.GetCachedSize(), + target, stream); + } - cached_has_bits = this_._impl_._has_bits_[0]; - // .google.protobuf.SourceContext source_context = 4; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, - stream); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // .google.protobuf.SourceContext source_context = 4; + if ((cached_has_bits & 0x00000004u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, *this_._impl_.source_context_, this_._impl_.source_context_->GetCachedSize(), target, + stream); + } - // .google.protobuf.Syntax syntax = 5; - if (this_._internal_syntax() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 5, this_._internal_syntax(), target); - } + // .google.protobuf.Syntax syntax = 5; + if ((cached_has_bits & 0x00000008u) != 0) { + if (this_._internal_syntax() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 5, this_._internal_syntax(), target); + } + } - // string edition = 6; - if (!this_._internal_edition().empty()) { - const std::string& _s = this_._internal_edition(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.edition"); - target = stream->WriteStringMaybeAliased(6, _s, target); - } + // string edition = 6; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_edition().empty()) { + const std::string& _s = this_._internal_edition(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Enum.edition"); + target = stream->WriteStringMaybeAliased(6, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Enum) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Enum) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Enum::ByteSizeLong(const MessageLite& base) { - const Enum& this_ = static_cast<const Enum&>(base); +::size_t Enum::ByteSizeLong(const MessageLite& base) { + const Enum& this_ = static_cast<const Enum&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Enum::ByteSizeLong() const { - const Enum& this_ = *this; +::size_t Enum::ByteSizeLong() const { + const Enum& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Enum) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Enum) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.EnumValue enumvalue = 2; - { - total_size += 1UL * this_._internal_enumvalue_size(); - for (const auto& msg : this_._internal_enumvalue()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.Option options = 3; - { - total_size += 1UL * this_._internal_options_size(); - for (const auto& msg : this_._internal_options()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - { - // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // string edition = 6; - if (!this_._internal_edition().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_edition()); - } - } - { - // .google.protobuf.SourceContext source_context = 4; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); - } - } - { - // .google.protobuf.Syntax syntax = 5; - if (this_._internal_syntax() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.EnumValue enumvalue = 2; + { + total_size += 1UL * this_._internal_enumvalue_size(); + for (const auto& msg : this_._internal_enumvalue()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + // repeated .google.protobuf.Option options = 3; + { + total_size += 1UL * this_._internal_options_size(); + for (const auto& msg : this_._internal_options()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x0000000fu) != 0) { + // string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // string edition = 6; + if ((cached_has_bits & 0x00000002u) != 0) { + if (!this_._internal_edition().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_edition()); + } + } + // .google.protobuf.SourceContext source_context = 4; + if ((cached_has_bits & 0x00000004u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.source_context_); + } + // .google.protobuf.Syntax syntax = 5; + if ((cached_has_bits & 0x00000008u) != 0) { + if (this_._internal_syntax() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_syntax()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Enum::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Enum*>(&to_msg); @@ -1781,24 +1916,39 @@ void Enum::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::pr from._internal_enumvalue()); _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_edition().empty()) { - _this->_internal_set_edition(from._internal_edition()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.source_context_ != nullptr); - if (_this->_impl_.source_context_ == nullptr) { - _this->_impl_.source_context_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::SourceContext>(arena, *from._impl_.source_context_); - } else { - _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + if ((cached_has_bits & 0x0000000fu) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (!from._internal_edition().empty()) { + _this->_internal_set_edition(from._internal_edition()); + } else { + if (_this->_impl_.edition_.IsDefault()) { + _this->_internal_set_edition(""); + } + } + } + if ((cached_has_bits & 0x00000004u) != 0) { + ABSL_DCHECK(from._impl_.source_context_ != nullptr); + if (_this->_impl_.source_context_ == nullptr) { + _this->_impl_.source_context_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.source_context_); + } else { + _this->_impl_.source_context_->MergeFrom(*from._impl_.source_context_); + } + } + if ((cached_has_bits & 0x00000008u) != 0) { + if (from._internal_syntax() != 0) { + _this->_impl_.syntax_ = from._impl_.syntax_; + } } - } - if (from._internal_syntax() != 0) { - _this->_impl_.syntax_ = from._impl_.syntax_; } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); @@ -1812,7 +1962,7 @@ void Enum::CopyFrom(const Enum& from) { } -void Enum::InternalSwap(Enum* PROTOBUF_RESTRICT other) { +void Enum::InternalSwap(Enum* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -1837,29 +1987,35 @@ void Enum::InternalSwap(Enum* PROTOBUF_RESTRICT other) { class EnumValue::_Internal { public: + using HasBits = + decltype(std::declval<EnumValue>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(EnumValue, _impl_._has_bits_); }; -EnumValue::EnumValue(::google::protobuf::Arena* arena) +EnumValue::EnumValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.EnumValue) } -inline PROTOBUF_NDEBUG_INLINE EnumValue::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::EnumValue& from_msg) - : options_{visibility, arena, from.options_}, - name_(arena, from.name_), - _cached_size_{0} {} +PROTOBUF_NDEBUG_INLINE EnumValue::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::EnumValue& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + options_{visibility, arena, from.options_}, + name_(arena, from.name_) {} EnumValue::EnumValue( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumValue& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, EnumValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1872,14 +2028,14 @@ EnumValue::EnumValue( // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValue) } -inline PROTOBUF_NDEBUG_INLINE EnumValue::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE EnumValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : options_{visibility, arena}, - name_(arena), - _cached_size_{0} {} + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + options_{visibility, arena}, + name_(arena) {} -inline void EnumValue::SharedCtor(::_pb::Arena* arena) { +inline void EnumValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.number_ = {}; } @@ -1895,8 +2051,9 @@ inline void EnumValue::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* EnumValue::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL EnumValue::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) EnumValue(arena); } constexpr auto EnumValue::InternalNewImpl_() { @@ -1915,37 +2072,44 @@ constexpr auto EnumValue::InternalNewImpl_() { alignof(EnumValue)); } } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull EnumValue::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_EnumValue_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &EnumValue::MergeImpl, - ::google::protobuf::Message::GetNewImpl<EnumValue>(), +constexpr auto EnumValue::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_EnumValue_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &EnumValue::MergeImpl, + ::google::protobuf::Message::GetNewImpl<EnumValue>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &EnumValue::SharedDtor, - ::google::protobuf::Message::GetClearImpl<EnumValue>(), &EnumValue::ByteSizeLong, - &EnumValue::_InternalSerialize, + &EnumValue::SharedDtor, + ::google::protobuf::Message::GetClearImpl<EnumValue>(), &EnumValue::ByteSizeLong, + &EnumValue::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(EnumValue, _impl_._cached_size_), - false, - }, - &EnumValue::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2ftype_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* EnumValue::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(EnumValue, _impl_._cached_size_), + false, + }, + &EnumValue::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2ftype_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + EnumValue_class_data_ = + EnumValue::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL EnumValue::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&EnumValue_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(EnumValue_class_data_.tc_table); + return EnumValue_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 1, 38, 2> EnumValue::_table_ = { +const ::_pbi::TcParseTable<2, 3, 1, 38, 2> +EnumValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(EnumValue, _impl_._has_bits_), 0, // no _extensions_ 3, 24, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1954,7 +2118,7 @@ const ::_pbi::TcParseTable<2, 3, 1, 38, 2> EnumValue::_table_ = { 3, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + EnumValue_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1964,10 +2128,10 @@ const ::_pbi::TcParseTable<2, 3, 1, 38, 2> EnumValue::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_)}}, // int32 number = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(EnumValue, _impl_.number_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(EnumValue, _impl_.number_), 1>(), + {16, 1, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_)}}, // repeated .google.protobuf.Option options = 3; {::_pbi::TcParser::FastMtR1, {26, 63, 0, PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.options_)}}, @@ -1975,23 +2139,24 @@ const ::_pbi::TcParseTable<2, 3, 1, 38, 2> EnumValue::_table_ = { 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // int32 number = 2; - {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.number_), _Internal::kHasBitsOffset + 1, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, // repeated .google.protobuf.Option options = 3; - {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.options_), 0, 0, + {PROTOBUF_FIELD_OFFSET(EnumValue, _impl_.options_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Option>()}, + }}, + {{ "\31\4\0\0\0\0\0\0" "google.protobuf.EnumValue" "name" }}, }; - PROTOBUF_NOINLINE void EnumValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2000,100 +2165,113 @@ PROTOBUF_NOINLINE void EnumValue::Clear() { (void) cached_has_bits; _impl_.options_.Clear(); - _impl_.name_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } _impl_.number_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* EnumValue::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const EnumValue& this_ = static_cast<const EnumValue&>(base); +::uint8_t* PROTOBUF_NONNULL EnumValue::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const EnumValue& this_ = static_cast<const EnumValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* EnumValue::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const EnumValue& this_ = *this; +::uint8_t* PROTOBUF_NONNULL EnumValue::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const EnumValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValue) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValue) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.EnumValue.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - // int32 number = 2; - if (this_._internal_number() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this_._internal_number(), target); - } + // int32 number = 2; + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { + if (this_._internal_number() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( + stream, this_._internal_number(), target); + } + } - // repeated .google.protobuf.Option options = 3; - for (unsigned i = 0, n = static_cast<unsigned>( - this_._internal_options_size()); - i < n; i++) { - const auto& repfield = this_._internal_options().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, repfield, repfield.GetCachedSize(), - target, stream); - } + // repeated .google.protobuf.Option options = 3; + for (unsigned i = 0, n = static_cast<unsigned>( + this_._internal_options_size()); + i < n; i++) { + const auto& repfield = this_._internal_options().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, repfield, repfield.GetCachedSize(), + target, stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValue) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValue) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t EnumValue::ByteSizeLong(const MessageLite& base) { - const EnumValue& this_ = static_cast<const EnumValue&>(base); +::size_t EnumValue::ByteSizeLong(const MessageLite& base) { + const EnumValue& this_ = static_cast<const EnumValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t EnumValue::ByteSizeLong() const { - const EnumValue& this_ = *this; +::size_t EnumValue::ByteSizeLong() const { + const EnumValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValue) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValue) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .google.protobuf.Option options = 3; - { - total_size += 1UL * this_._internal_options_size(); - for (const auto& msg : this_._internal_options()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - { - // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - // int32 number = 2; - if (this_._internal_number() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_number()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + { + // repeated .google.protobuf.Option options = 3; + { + total_size += 1UL * this_._internal_options_size(); + for (const auto& msg : this_._internal_options()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + } + } + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // int32 number = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + if (this_._internal_number() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_number()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void EnumValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<EnumValue*>(&to_msg); @@ -2105,12 +2283,24 @@ void EnumValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::googl _this->_internal_mutable_options()->MergeFrom( from._internal_options()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (from._internal_number() != 0) { - _this->_impl_.number_ = from._impl_.number_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + if (from._internal_number() != 0) { + _this->_impl_.number_ = from._impl_.number_; + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -2122,14 +2312,15 @@ void EnumValue::CopyFrom(const EnumValue& from) { } -void EnumValue::InternalSwap(EnumValue* PROTOBUF_RESTRICT other) { +void EnumValue::InternalSwap(EnumValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.options_.InternalSwap(&other->_impl_.options_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); - swap(_impl_.number_, other->_impl_.number_); + swap(_impl_.number_, other->_impl_.number_); } ::google::protobuf::Metadata EnumValue::GetMetadata() const { @@ -2148,29 +2339,30 @@ class Option::_Internal { void Option::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.value_ != nullptr) _impl_.value_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } -Option::Option(::google::protobuf::Arena* arena) +Option::Option(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Option_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Option) } -inline PROTOBUF_NDEBUG_INLINE Option::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::Option& from_msg) +PROTOBUF_NDEBUG_INLINE Option::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::Option& from_msg) : _has_bits_{from._has_bits_}, _cached_size_{0}, name_(arena, from.name_) {} Option::Option( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Option& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Option_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -2180,19 +2372,19 @@ Option::Option( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.value_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::Any>( - arena, *from._impl_.value_) - : nullptr; + _impl_.value_ = ((cached_has_bits & 0x00000002u) != 0) + ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.value_) + : nullptr; // @@protoc_insertion_point(copy_constructor:google.protobuf.Option) } -inline PROTOBUF_NDEBUG_INLINE Option::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Option::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0}, name_(arena) {} -inline void Option::SharedCtor(::_pb::Arena* arena) { +inline void Option::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -2209,43 +2401,51 @@ inline void Option::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Option::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Option::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Option(arena); } constexpr auto Option::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Option), alignof(Option)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Option::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Option_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Option::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Option>(), +constexpr auto Option::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Option_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Option::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Option>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Option::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Option>(), &Option::ByteSizeLong, - &Option::_InternalSerialize, + &Option::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Option>(), &Option::ByteSizeLong, + &Option::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Option, _impl_._cached_size_), - false, - }, - &Option::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2ftype_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Option::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Option, _impl_._cached_size_), + false, + }, + &Option::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2ftype_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Option_class_data_ = + Option::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Option::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Option_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Option_class_data_.tc_table); + return Option_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 1, 35, 2> Option::_table_ = { +const ::_pbi::TcParseTable<1, 2, 1, 35, 2> +Option::_table_ = { { PROTOBUF_FIELD_OFFSET(Option, _impl_._has_bits_), 0, // no _extensions_ @@ -2256,7 +2456,7 @@ const ::_pbi::TcParseTable<1, 2, 1, 35, 2> Option::_table_ = { 2, // num_field_entries 1, // num_aux_entries offsetof(decltype(_table_), aux_entries), - _class_data_.base(), + Option_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -2265,28 +2465,29 @@ const ::_pbi::TcParseTable<1, 2, 1, 35, 2> Option::_table_ = { }, {{ // .google.protobuf.Any value = 2; {::_pbi::TcParser::FastMtS1, - {18, 0, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.value_)}}, + {18, 1, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.value_)}}, // string name = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.name_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(Option, _impl_.name_)}}, }}, {{ 65535, 65535 }}, {{ // string name = 1; - {PROTOBUF_FIELD_OFFSET(Option, _impl_.name_), -1, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(Option, _impl_.name_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, // .google.protobuf.Any value = 2; - {PROTOBUF_FIELD_OFFSET(Option, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + {PROTOBUF_FIELD_OFFSET(Option, _impl_.value_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Any>()}, - }}, {{ + }}, + {{ + {::_pbi::TcParser::GetTable<::google::protobuf::Any>()}, + }}, + {{ "\26\4\0\0\0\0\0\0" "google.protobuf.Option" "name" }}, }; - PROTOBUF_NOINLINE void Option::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Option) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2294,89 +2495,95 @@ PROTOBUF_NOINLINE void Option::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.name_.ClearToEmpty(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.value_ != nullptr); - _impl_.value_->Clear(); + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.name_.ClearNonDefaultToEmpty(); + } + if ((cached_has_bits & 0x00000002u) != 0) { + ABSL_DCHECK(_impl_.value_ != nullptr); + _impl_.value_->Clear(); + } } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Option::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Option& this_ = static_cast<const Option&>(base); +::uint8_t* PROTOBUF_NONNULL Option::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Option& this_ = static_cast<const Option&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Option::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Option& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Option::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Option& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Option) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Option) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string name = 1; - if (!this_._internal_name().empty()) { - const std::string& _s = this_._internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string name = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + const std::string& _s = this_._internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.Option.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - cached_has_bits = this_._impl_._has_bits_[0]; - // .google.protobuf.Any value = 2; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *this_._impl_.value_, this_._impl_.value_->GetCachedSize(), target, - stream); - } + cached_has_bits = this_._impl_._has_bits_[0]; + // .google.protobuf.Any value = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, *this_._impl_.value_, this_._impl_.value_->GetCachedSize(), target, + stream); + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Option) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Option) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Option::ByteSizeLong(const MessageLite& base) { - const Option& this_ = static_cast<const Option&>(base); +::size_t Option::ByteSizeLong(const MessageLite& base) { + const Option& this_ = static_cast<const Option&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Option::ByteSizeLong() const { - const Option& this_ = *this; +::size_t Option::ByteSizeLong() const { + const Option& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Option) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Option) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // string name = 1; - if (!this_._internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_name()); - } - } - { - // .google.protobuf.Any value = 2; - cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.value_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + ::_pbi::Prefetch5LinesFrom7Lines(&this_); + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000003u) != 0) { + // string name = 1; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_name()); + } + } + // .google.protobuf.Any value = 2; + if ((cached_has_bits & 0x00000002u) != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.value_); + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Option::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Option*>(&to_msg); @@ -2387,17 +2594,24 @@ void Option::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google:: ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.value_ != nullptr); - if (_this->_impl_.value_ == nullptr) { - _this->_impl_.value_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::Any>(arena, *from._impl_.value_); - } else { - _this->_impl_.value_->MergeFrom(*from._impl_.value_); + if ((cached_has_bits & 0x00000003u) != 0) { + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } else { + if (_this->_impl_.name_.IsDefault()) { + _this->_internal_set_name(""); + } + } + } + if ((cached_has_bits & 0x00000002u) != 0) { + ABSL_DCHECK(from._impl_.value_ != nullptr); + if (_this->_impl_.value_ == nullptr) { + _this->_impl_.value_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.value_); + } else { + _this->_impl_.value_->MergeFrom(*from._impl_.value_); + } } } _this->_impl_._has_bits_[0] |= cached_has_bits; @@ -2412,7 +2626,7 @@ void Option::CopyFrom(const Option& from) { } -void Option::InternalSwap(Option* PROTOBUF_RESTRICT other) { +void Option::InternalSwap(Option* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); @@ -2434,7 +2648,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/type.pb.h b/third_party/protobuf/src/google/protobuf/type.pb.h index 17524e7cda243..6c113f933ce65 100644 --- a/third_party/protobuf/src/google/protobuf/type.pb.h +++ b/third_party/protobuf/src/google/protobuf/type.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/type.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2ftype_2eproto_2epb_2eh #define google_2fprotobuf_2ftype_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -52,25 +52,46 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ftype_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2ftype_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftype_2eproto; +} // extern "C" namespace google { namespace protobuf { +enum Field_Cardinality : int; +PROTOBUF_EXPORT extern const uint32_t Field_Cardinality_internal_data_[]; +enum Field_Kind : int; +PROTOBUF_EXPORT extern const uint32_t Field_Kind_internal_data_[]; +enum Syntax : int; +PROTOBUF_EXPORT extern const uint32_t Syntax_internal_data_[]; class Enum; struct EnumDefaultTypeInternal; PROTOBUF_EXPORT extern EnumDefaultTypeInternal _Enum_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Enum_class_data_; class EnumValue; struct EnumValueDefaultTypeInternal; PROTOBUF_EXPORT extern EnumValueDefaultTypeInternal _EnumValue_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumValue_class_data_; class Field; struct FieldDefaultTypeInternal; PROTOBUF_EXPORT extern FieldDefaultTypeInternal _Field_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Field_class_data_; class Option; struct OptionDefaultTypeInternal; PROTOBUF_EXPORT extern OptionDefaultTypeInternal _Option_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Option_class_data_; class Type; struct TypeDefaultTypeInternal; PROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Type_class_data_; +template <> +internal::EnumTraitsT<::google::protobuf::Field_Cardinality_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::Field_Cardinality>; +template <> +internal::EnumTraitsT<::google::protobuf::Field_Kind_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::Field_Kind>; +template <> +internal::EnumTraitsT<::google::protobuf::Syntax_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::Syntax>; } // namespace protobuf } // namespace google @@ -102,13 +123,16 @@ enum Field_Kind : int { std::numeric_limits<::int32_t>::max(), }; -PROTOBUF_EXPORT bool Field_Kind_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t Field_Kind_internal_data_[]; -constexpr Field_Kind Field_Kind_Kind_MIN = static_cast<Field_Kind>(0); -constexpr Field_Kind Field_Kind_Kind_MAX = static_cast<Field_Kind>(18); -constexpr int Field_Kind_Kind_ARRAYSIZE = 18 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -Field_Kind_descriptor(); +inline constexpr Field_Kind Field_Kind_Kind_MIN = + static_cast<Field_Kind>(0); +inline constexpr Field_Kind Field_Kind_Kind_MAX = + static_cast<Field_Kind>(18); +inline bool Field_Kind_IsValid(int value) { + return 0 <= value && value <= 18; +} +inline constexpr int Field_Kind_Kind_ARRAYSIZE = 18 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Field_Kind_descriptor(); template <typename T> const std::string& Field_Kind_Name(T value) { static_assert(std::is_same<T, Field_Kind>::value || @@ -118,13 +142,13 @@ const std::string& Field_Kind_Name(T value) { } template <> inline const std::string& Field_Kind_Name(Field_Kind value) { - return ::google::protobuf::internal::NameOfDenseEnum<Field_Kind_descriptor, - 0, 18>( + return ::google::protobuf::internal::NameOfDenseEnum<Field_Kind_descriptor, 0, 18>( static_cast<int>(value)); } -inline bool Field_Kind_Parse(absl::string_view name, Field_Kind* value) { - return ::google::protobuf::internal::ParseNamedEnum<Field_Kind>( - Field_Kind_descriptor(), name, value); +inline bool Field_Kind_Parse( + absl::string_view name, Field_Kind* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<Field_Kind>(Field_Kind_descriptor(), name, + value); } enum Field_Cardinality : int { Field_Cardinality_CARDINALITY_UNKNOWN = 0, @@ -137,13 +161,16 @@ enum Field_Cardinality : int { std::numeric_limits<::int32_t>::max(), }; -PROTOBUF_EXPORT bool Field_Cardinality_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t Field_Cardinality_internal_data_[]; -constexpr Field_Cardinality Field_Cardinality_Cardinality_MIN = static_cast<Field_Cardinality>(0); -constexpr Field_Cardinality Field_Cardinality_Cardinality_MAX = static_cast<Field_Cardinality>(3); -constexpr int Field_Cardinality_Cardinality_ARRAYSIZE = 3 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -Field_Cardinality_descriptor(); +inline constexpr Field_Cardinality Field_Cardinality_Cardinality_MIN = + static_cast<Field_Cardinality>(0); +inline constexpr Field_Cardinality Field_Cardinality_Cardinality_MAX = + static_cast<Field_Cardinality>(3); +inline bool Field_Cardinality_IsValid(int value) { + return 0 <= value && value <= 3; +} +inline constexpr int Field_Cardinality_Cardinality_ARRAYSIZE = 3 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Field_Cardinality_descriptor(); template <typename T> const std::string& Field_Cardinality_Name(T value) { static_assert(std::is_same<T, Field_Cardinality>::value || @@ -153,13 +180,13 @@ const std::string& Field_Cardinality_Name(T value) { } template <> inline const std::string& Field_Cardinality_Name(Field_Cardinality value) { - return ::google::protobuf::internal::NameOfDenseEnum<Field_Cardinality_descriptor, - 0, 3>( + return ::google::protobuf::internal::NameOfDenseEnum<Field_Cardinality_descriptor, 0, 3>( static_cast<int>(value)); } -inline bool Field_Cardinality_Parse(absl::string_view name, Field_Cardinality* value) { - return ::google::protobuf::internal::ParseNamedEnum<Field_Cardinality>( - Field_Cardinality_descriptor(), name, value); +inline bool Field_Cardinality_Parse( + absl::string_view name, Field_Cardinality* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<Field_Cardinality>(Field_Cardinality_descriptor(), name, + value); } enum Syntax : int { SYNTAX_PROTO2 = 0, @@ -171,13 +198,16 @@ enum Syntax : int { std::numeric_limits<::int32_t>::max(), }; -PROTOBUF_EXPORT bool Syntax_IsValid(int value); PROTOBUF_EXPORT extern const uint32_t Syntax_internal_data_[]; -constexpr Syntax Syntax_MIN = static_cast<Syntax>(0); -constexpr Syntax Syntax_MAX = static_cast<Syntax>(2); -constexpr int Syntax_ARRAYSIZE = 2 + 1; -PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* -Syntax_descriptor(); +inline constexpr Syntax Syntax_MIN = + static_cast<Syntax>(0); +inline constexpr Syntax Syntax_MAX = + static_cast<Syntax>(2); +inline bool Syntax_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int Syntax_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Syntax_descriptor(); template <typename T> const std::string& Syntax_Name(T value) { static_assert(std::is_same<T, Syntax>::value || @@ -187,13 +217,13 @@ const std::string& Syntax_Name(T value) { } template <> inline const std::string& Syntax_Name(Syntax value) { - return ::google::protobuf::internal::NameOfDenseEnum<Syntax_descriptor, - 0, 2>( + return ::google::protobuf::internal::NameOfDenseEnum<Syntax_descriptor, 0, 2>( static_cast<int>(value)); } -inline bool Syntax_Parse(absl::string_view name, Syntax* value) { - return ::google::protobuf::internal::ParseNamedEnum<Syntax>( - Syntax_descriptor(), name, value); +inline bool Syntax_Parse( + absl::string_view name, Syntax* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum<Syntax>(Syntax_descriptor(), name, + value); } // =================================================================== @@ -208,15 +238,14 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message ~Option() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Option* msg, std::destroying_delete_t) { + void operator delete(Option* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Option)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Option( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Option(::google::protobuf::internal::ConstantInitialized); inline Option(const Option& from) : Option(nullptr, from) {} inline Option(Option&& from) noexcept @@ -239,30 +268,27 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Option& default_instance() { - return *internal_default_instance(); - } - static inline const Option* internal_default_instance() { - return reinterpret_cast<const Option*>( + return *reinterpret_cast<const Option*>( &_Option_default_instance_); } static constexpr int kIndexInFileMessages = 4; friend void swap(Option& a, Option& b) { a.Swap(&b); } - inline void Swap(Option* other) { + inline void Swap(Option* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -270,7 +296,7 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Option* other) { + void UnsafeArenaSwap(Option* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -278,7 +304,7 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Option* New(::google::protobuf::Arena* arena = nullptr) const { + Option* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Option>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -287,9 +313,8 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message void MergeFrom(const Option& from) { Option::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -299,49 +324,51 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Option* other); + void InternalSwap(Option* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Option"; } protected: - explicit Option(::google::protobuf::Arena* arena); - Option(::google::protobuf::Arena* arena, const Option& from); - Option(::google::protobuf::Arena* arena, Option&& from) noexcept + explicit Option(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Option(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Option& from); + Option( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Option&& from) noexcept : Option(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -355,39 +382,38 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // .google.protobuf.Any value = 2; bool has_value() const; void clear_value() ; const ::google::protobuf::Any& value() const; - PROTOBUF_NODISCARD ::google::protobuf::Any* release_value(); - ::google::protobuf::Any* mutable_value(); - void set_allocated_value(::google::protobuf::Any* value); - void unsafe_arena_set_allocated_value(::google::protobuf::Any* value); - ::google::protobuf::Any* unsafe_arena_release_value(); + [[nodiscard]] ::google::protobuf::Any* PROTOBUF_NULLABLE release_value(); + ::google::protobuf::Any* PROTOBUF_NONNULL mutable_value(); + void set_allocated_value(::google::protobuf::Any* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_value(::google::protobuf::Any* PROTOBUF_NULLABLE value); + ::google::protobuf::Any* PROTOBUF_NULLABLE unsafe_arena_release_value(); private: const ::google::protobuf::Any& _internal_value() const; - ::google::protobuf::Any* _internal_mutable_value(); + ::google::protobuf::Any* PROTOBUF_NONNULL _internal_mutable_value(); public: // @@protoc_insertion_point(class_scope:google.protobuf.Option) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 1, 2, 1, - 35, 2> + static const ::google::protobuf::internal::TcParseTable<1, 2, + 1, 35, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -397,22 +423,25 @@ class PROTOBUF_EXPORT Option final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Option& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Option& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::Any* value_; + ::google::protobuf::Any* PROTOBUF_NULLABLE value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Option_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message @@ -422,15 +451,14 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message ~Field() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Field* msg, std::destroying_delete_t) { + void operator delete(Field* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Field)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Field( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Field(::google::protobuf::internal::ConstantInitialized); inline Field(const Field& from) : Field(nullptr, from) {} inline Field(Field&& from) noexcept @@ -453,30 +481,27 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Field& default_instance() { - return *internal_default_instance(); - } - static inline const Field* internal_default_instance() { - return reinterpret_cast<const Field*>( + return *reinterpret_cast<const Field*>( &_Field_default_instance_); } static constexpr int kIndexInFileMessages = 1; friend void swap(Field& a, Field& b) { a.Swap(&b); } - inline void Swap(Field* other) { + inline void Swap(Field* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -484,7 +509,7 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Field* other) { + void UnsafeArenaSwap(Field* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -492,7 +517,7 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Field* New(::google::protobuf::Arena* arena = nullptr) const { + Field* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Field>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -501,9 +526,8 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message void MergeFrom(const Field& from) { Field::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -513,49 +537,51 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Field* other); + void InternalSwap(Field* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Field"; } protected: - explicit Field(::google::protobuf::Arena* arena); - Field(::google::protobuf::Arena* arena, const Field& from); - Field(::google::protobuf::Arena* arena, Field&& from) noexcept + explicit Field(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Field(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Field& from); + Field( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Field&& from) noexcept : Field(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using Kind = Field_Kind; @@ -584,14 +610,15 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message static constexpr Kind Kind_MIN = Field_Kind_Kind_MIN; static constexpr Kind Kind_MAX = Field_Kind_Kind_MAX; static constexpr int Kind_ARRAYSIZE = Field_Kind_Kind_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Kind_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Kind_descriptor() { return Field_Kind_descriptor(); } template <typename T> static inline const std::string& Kind_Name(T value) { return Field_Kind_Name(value); } - static inline bool Kind_Parse(absl::string_view name, Kind* value) { + static inline bool Kind_Parse( + absl::string_view name, Kind* PROTOBUF_NONNULL value) { return Field_Kind_Parse(name, value); } using Cardinality = Field_Cardinality; @@ -605,14 +632,15 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message static constexpr Cardinality Cardinality_MIN = Field_Cardinality_Cardinality_MIN; static constexpr Cardinality Cardinality_MAX = Field_Cardinality_Cardinality_MAX; static constexpr int Cardinality_ARRAYSIZE = Field_Cardinality_Cardinality_ARRAYSIZE; - static inline const ::google::protobuf::EnumDescriptor* Cardinality_descriptor() { + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Cardinality_descriptor() { return Field_Cardinality_descriptor(); } template <typename T> static inline const std::string& Cardinality_Name(T value) { return Field_Cardinality_Name(value); } - static inline bool Cardinality_Parse(absl::string_view name, Cardinality* value) { + static inline bool Cardinality_Parse( + absl::string_view name, Cardinality* PROTOBUF_NONNULL value) { return Field_Cardinality_Parse(name, value); } @@ -636,30 +664,29 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message public: void clear_options() ; - ::google::protobuf::Option* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* mutable_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL mutable_options(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* _internal_mutable_options(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL _internal_mutable_options(); public: const ::google::protobuf::Option& options(int index) const; - ::google::protobuf::Option* add_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL add_options(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& options() const; // string name = 4; void clear_name() ; const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // string type_url = 6; @@ -667,15 +694,14 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message const std::string& type_url() const; template <typename Arg_ = const std::string&, typename... Args_> void set_type_url(Arg_&& arg, Args_... args); - std::string* mutable_type_url(); - PROTOBUF_NODISCARD std::string* release_type_url(); - void set_allocated_type_url(std::string* value); + std::string* PROTOBUF_NONNULL mutable_type_url(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_type_url(); + void set_allocated_type_url(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_type_url() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url( - const std::string& value); - std::string* _internal_mutable_type_url(); + PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_type_url(); public: // string json_name = 10; @@ -683,15 +709,14 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message const std::string& json_name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_json_name(Arg_&& arg, Args_... args); - std::string* mutable_json_name(); - PROTOBUF_NODISCARD std::string* release_json_name(); - void set_allocated_json_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_json_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_json_name(); + void set_allocated_json_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_json_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_json_name( - const std::string& value); - std::string* _internal_mutable_json_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_json_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_json_name(); public: // string default_value = 11; @@ -699,15 +724,14 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message const std::string& default_value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_default_value(Arg_&& arg, Args_... args); - std::string* mutable_default_value(); - PROTOBUF_NODISCARD std::string* release_default_value(); - void set_allocated_default_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_default_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_default_value(); + void set_allocated_default_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_default_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_default_value( - const std::string& value); - std::string* _internal_mutable_default_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_default_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_default_value(); public: // .google.protobuf.Field.Kind kind = 1; @@ -764,9 +788,9 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 4, 10, 1, - 72, 2> + static const ::google::protobuf::internal::TcParseTable<4, 10, + 1, 72, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -776,13 +800,16 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Field& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Field& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr type_url_; @@ -793,12 +820,13 @@ class PROTOBUF_EXPORT Field final : public ::google::protobuf::Message ::int32_t number_; ::int32_t oneof_index_; bool packed_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Field_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message @@ -808,15 +836,14 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message ~EnumValue() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(EnumValue* msg, std::destroying_delete_t) { + void operator delete(EnumValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(EnumValue)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR EnumValue( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR EnumValue(::google::protobuf::internal::ConstantInitialized); inline EnumValue(const EnumValue& from) : EnumValue(nullptr, from) {} inline EnumValue(EnumValue&& from) noexcept @@ -839,30 +866,27 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const EnumValue& default_instance() { - return *internal_default_instance(); - } - static inline const EnumValue* internal_default_instance() { - return reinterpret_cast<const EnumValue*>( + return *reinterpret_cast<const EnumValue*>( &_EnumValue_default_instance_); } static constexpr int kIndexInFileMessages = 3; friend void swap(EnumValue& a, EnumValue& b) { a.Swap(&b); } - inline void Swap(EnumValue* other) { + inline void Swap(EnumValue* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -870,7 +894,7 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(EnumValue* other) { + void UnsafeArenaSwap(EnumValue* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -878,7 +902,7 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - EnumValue* New(::google::protobuf::Arena* arena = nullptr) const { + EnumValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<EnumValue>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -887,9 +911,8 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message void MergeFrom(const EnumValue& from) { EnumValue::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -899,49 +922,51 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(EnumValue* other); + void InternalSwap(EnumValue* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.EnumValue"; } protected: - explicit EnumValue(::google::protobuf::Arena* arena); - EnumValue(::google::protobuf::Arena* arena, const EnumValue& from); - EnumValue(::google::protobuf::Arena* arena, EnumValue&& from) noexcept + explicit EnumValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + EnumValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumValue& from); + EnumValue( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EnumValue&& from) noexcept : EnumValue(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -958,30 +983,29 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message public: void clear_options() ; - ::google::protobuf::Option* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* mutable_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL mutable_options(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* _internal_mutable_options(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL _internal_mutable_options(); public: const ::google::protobuf::Option& options(int index) const; - ::google::protobuf::Option* add_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL add_options(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& options() const; // string name = 1; void clear_name() ; const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // int32 number = 2; @@ -998,9 +1022,9 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 3, 1, - 38, 2> + static const ::google::protobuf::internal::TcParseTable<2, 3, + 1, 38, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1010,22 +1034,26 @@ class PROTOBUF_EXPORT EnumValue final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const EnumValue& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const EnumValue& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; + ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::int32_t number_; - ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull EnumValue_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message @@ -1035,15 +1063,14 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message ~Type() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Type* msg, std::destroying_delete_t) { + void operator delete(Type* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Type)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Type( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Type(::google::protobuf::internal::ConstantInitialized); inline Type(const Type& from) : Type(nullptr, from) {} inline Type(Type&& from) noexcept @@ -1066,30 +1093,27 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Type& default_instance() { - return *internal_default_instance(); - } - static inline const Type* internal_default_instance() { - return reinterpret_cast<const Type*>( + return *reinterpret_cast<const Type*>( &_Type_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(Type& a, Type& b) { a.Swap(&b); } - inline void Swap(Type* other) { + inline void Swap(Type* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1097,7 +1121,7 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Type* other) { + void UnsafeArenaSwap(Type* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1105,7 +1129,7 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Type* New(::google::protobuf::Arena* arena = nullptr) const { + Type* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Type>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1114,9 +1138,8 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message void MergeFrom(const Type& from) { Type::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1126,49 +1149,51 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Type* other); + void InternalSwap(Type* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Type"; } protected: - explicit Type(::google::protobuf::Arena* arena); - Type(::google::protobuf::Arena* arena, const Type& from); - Type(::google::protobuf::Arena* arena, Type&& from) noexcept + explicit Type(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Type(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Type& from); + Type( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Type&& from) noexcept : Type(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1189,15 +1214,15 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message public: void clear_fields() ; - ::google::protobuf::Field* mutable_fields(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* mutable_fields(); + ::google::protobuf::Field* PROTOBUF_NONNULL mutable_fields(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* PROTOBUF_NONNULL mutable_fields(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>& _internal_fields() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* _internal_mutable_fields(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* PROTOBUF_NONNULL _internal_mutable_fields(); public: const ::google::protobuf::Field& fields(int index) const; - ::google::protobuf::Field* add_fields(); + ::google::protobuf::Field* PROTOBUF_NONNULL add_fields(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>& fields() const; // repeated string oneofs = 3; int oneofs_size() const; @@ -1207,18 +1232,18 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message public: void clear_oneofs() ; const std::string& oneofs(int index) const; - std::string* mutable_oneofs(int index); + std::string* PROTOBUF_NONNULL mutable_oneofs(int index); template <typename Arg_ = const std::string&, typename... Args_> void set_oneofs(int index, Arg_&& value, Args_... args); - std::string* add_oneofs(); + std::string* PROTOBUF_NONNULL add_oneofs(); template <typename Arg_ = const std::string&, typename... Args_> void add_oneofs(Arg_&& value, Args_... args); const ::google::protobuf::RepeatedPtrField<std::string>& oneofs() const; - ::google::protobuf::RepeatedPtrField<std::string>* mutable_oneofs(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL mutable_oneofs(); private: const ::google::protobuf::RepeatedPtrField<std::string>& _internal_oneofs() const; - ::google::protobuf::RepeatedPtrField<std::string>* _internal_mutable_oneofs(); + ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL _internal_mutable_oneofs(); public: // repeated .google.protobuf.Option options = 4; @@ -1228,30 +1253,29 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message public: void clear_options() ; - ::google::protobuf::Option* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* mutable_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL mutable_options(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* _internal_mutable_options(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL _internal_mutable_options(); public: const ::google::protobuf::Option& options(int index) const; - ::google::protobuf::Option* add_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL add_options(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& options() const; // string name = 1; void clear_name() ; const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // string edition = 7; @@ -1259,30 +1283,29 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message const std::string& edition() const; template <typename Arg_ = const std::string&, typename... Args_> void set_edition(Arg_&& arg, Args_... args); - std::string* mutable_edition(); - PROTOBUF_NODISCARD std::string* release_edition(); - void set_allocated_edition(std::string* value); + std::string* PROTOBUF_NONNULL mutable_edition(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_edition(); + void set_allocated_edition(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_edition() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_edition( - const std::string& value); - std::string* _internal_mutable_edition(); + PROTOBUF_ALWAYS_INLINE void _internal_set_edition(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_edition(); public: // .google.protobuf.SourceContext source_context = 5; bool has_source_context() const; void clear_source_context() ; const ::google::protobuf::SourceContext& source_context() const; - PROTOBUF_NODISCARD ::google::protobuf::SourceContext* release_source_context(); - ::google::protobuf::SourceContext* mutable_source_context(); - void set_allocated_source_context(::google::protobuf::SourceContext* value); - void unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* value); - ::google::protobuf::SourceContext* unsafe_arena_release_source_context(); + [[nodiscard]] ::google::protobuf::SourceContext* PROTOBUF_NULLABLE release_source_context(); + ::google::protobuf::SourceContext* PROTOBUF_NONNULL mutable_source_context(); + void set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value); + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE unsafe_arena_release_source_context(); private: const ::google::protobuf::SourceContext& _internal_source_context() const; - ::google::protobuf::SourceContext* _internal_mutable_source_context(); + ::google::protobuf::SourceContext* PROTOBUF_NONNULL _internal_mutable_source_context(); public: // .google.protobuf.Syntax syntax = 6; @@ -1299,9 +1322,9 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 7, 3, - 46, 2> + static const ::google::protobuf::internal::TcParseTable<3, 7, + 3, 46, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1311,13 +1334,14 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Type& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Type& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field > fields_; @@ -1325,13 +1349,15 @@ class PROTOBUF_EXPORT Type final : public ::google::protobuf::Message ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr edition_; - ::google::protobuf::SourceContext* source_context_; + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE source_context_; int syntax_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Type_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message @@ -1341,15 +1367,14 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message ~Enum() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Enum* msg, std::destroying_delete_t) { + void operator delete(Enum* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Enum)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Enum( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Enum(::google::protobuf::internal::ConstantInitialized); inline Enum(const Enum& from) : Enum(nullptr, from) {} inline Enum(Enum&& from) noexcept @@ -1372,30 +1397,27 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Enum& default_instance() { - return *internal_default_instance(); - } - static inline const Enum* internal_default_instance() { - return reinterpret_cast<const Enum*>( + return *reinterpret_cast<const Enum*>( &_Enum_default_instance_); } static constexpr int kIndexInFileMessages = 2; friend void swap(Enum& a, Enum& b) { a.Swap(&b); } - inline void Swap(Enum* other) { + inline void Swap(Enum* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1403,7 +1425,7 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Enum* other) { + void UnsafeArenaSwap(Enum* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1411,7 +1433,7 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Enum* New(::google::protobuf::Arena* arena = nullptr) const { + Enum* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Enum>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1420,9 +1442,8 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message void MergeFrom(const Enum& from) { Enum::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1432,49 +1453,51 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Enum* other); + void InternalSwap(Enum* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Enum"; } protected: - explicit Enum(::google::protobuf::Arena* arena); - Enum(::google::protobuf::Arena* arena, const Enum& from); - Enum(::google::protobuf::Arena* arena, Enum&& from) noexcept + explicit Enum(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Enum(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Enum& from); + Enum( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Enum&& from) noexcept : Enum(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1494,15 +1517,15 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message public: void clear_enumvalue() ; - ::google::protobuf::EnumValue* mutable_enumvalue(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* mutable_enumvalue(); + ::google::protobuf::EnumValue* PROTOBUF_NONNULL mutable_enumvalue(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* PROTOBUF_NONNULL mutable_enumvalue(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>& _internal_enumvalue() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* _internal_mutable_enumvalue(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* PROTOBUF_NONNULL _internal_mutable_enumvalue(); public: const ::google::protobuf::EnumValue& enumvalue(int index) const; - ::google::protobuf::EnumValue* add_enumvalue(); + ::google::protobuf::EnumValue* PROTOBUF_NONNULL add_enumvalue(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>& enumvalue() const; // repeated .google.protobuf.Option options = 3; int options_size() const; @@ -1511,30 +1534,29 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message public: void clear_options() ; - ::google::protobuf::Option* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* mutable_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL mutable_options(); private: const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* _internal_mutable_options(); + ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL _internal_mutable_options(); public: const ::google::protobuf::Option& options(int index) const; - ::google::protobuf::Option* add_options(); + ::google::protobuf::Option* PROTOBUF_NONNULL add_options(); const ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>& options() const; // string name = 1; void clear_name() ; const std::string& name() const; template <typename Arg_ = const std::string&, typename... Args_> void set_name(Arg_&& arg, Args_... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* value); + std::string* PROTOBUF_NONNULL mutable_name(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_name(); + void set_allocated_name(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( - const std::string& value); - std::string* _internal_mutable_name(); + PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_name(); public: // string edition = 6; @@ -1542,30 +1564,29 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message const std::string& edition() const; template <typename Arg_ = const std::string&, typename... Args_> void set_edition(Arg_&& arg, Args_... args); - std::string* mutable_edition(); - PROTOBUF_NODISCARD std::string* release_edition(); - void set_allocated_edition(std::string* value); + std::string* PROTOBUF_NONNULL mutable_edition(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_edition(); + void set_allocated_edition(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_edition() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_edition( - const std::string& value); - std::string* _internal_mutable_edition(); + PROTOBUF_ALWAYS_INLINE void _internal_set_edition(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_edition(); public: // .google.protobuf.SourceContext source_context = 4; bool has_source_context() const; void clear_source_context() ; const ::google::protobuf::SourceContext& source_context() const; - PROTOBUF_NODISCARD ::google::protobuf::SourceContext* release_source_context(); - ::google::protobuf::SourceContext* mutable_source_context(); - void set_allocated_source_context(::google::protobuf::SourceContext* value); - void unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* value); - ::google::protobuf::SourceContext* unsafe_arena_release_source_context(); + [[nodiscard]] ::google::protobuf::SourceContext* PROTOBUF_NULLABLE release_source_context(); + ::google::protobuf::SourceContext* PROTOBUF_NONNULL mutable_source_context(); + void set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value); + void unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value); + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE unsafe_arena_release_source_context(); private: const ::google::protobuf::SourceContext& _internal_source_context() const; - ::google::protobuf::SourceContext* _internal_mutable_source_context(); + ::google::protobuf::SourceContext* PROTOBUF_NONNULL _internal_mutable_source_context(); public: // .google.protobuf.Syntax syntax = 5; @@ -1582,9 +1603,9 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 3, 6, 3, - 40, 2> + static const ::google::protobuf::internal::TcParseTable<3, 6, + 3, 40, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1594,20 +1615,21 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Enum& from_msg); + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Enum& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue > enumvalue_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr edition_; - ::google::protobuf::SourceContext* source_context_; + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE source_context_; int syntax_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -1615,6 +1637,8 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Enum_class_data_; + // =================================================================== @@ -1635,6 +1659,7 @@ class PROTOBUF_EXPORT Enum final : public ::google::protobuf::Message inline void Type::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Type::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1642,13 +1667,14 @@ inline const std::string& Type::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Type::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Type::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Type.name) } -inline std::string* Type::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Type::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Type.name) return _s; @@ -1659,19 +1685,34 @@ inline const std::string& Type::_internal_name() const { } inline void Type::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* Type::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL Type::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* Type::release_name() { +inline std::string* PROTOBUF_NULLABLE Type::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Type.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void Type::set_allocated_name(std::string* value) { +inline void Type::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -1690,12 +1731,12 @@ inline void Type::clear_fields() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.fields_.Clear(); } -inline ::google::protobuf::Field* Type::mutable_fields(int index) +inline ::google::protobuf::Field* PROTOBUF_NONNULL Type::mutable_fields(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Type.fields) return _internal_mutable_fields()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* Type::mutable_fields() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* PROTOBUF_NONNULL Type::mutable_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1706,7 +1747,8 @@ inline const ::google::protobuf::Field& Type::fields(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Type.fields) return _internal_fields().Get(index); } -inline ::google::protobuf::Field* Type::add_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Field* PROTOBUF_NONNULL Type::add_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Field* _add = _internal_mutable_fields()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Type.fields) @@ -1722,7 +1764,7 @@ Type::_internal_fields() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.fields_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Field>* PROTOBUF_NONNULL Type::_internal_mutable_fields() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.fields_; @@ -1739,7 +1781,8 @@ inline void Type::clear_oneofs() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.oneofs_.Clear(); } -inline std::string* Type::add_oneofs() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Type::add_oneofs() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); std::string* _s = _internal_mutable_oneofs()->Add(); // @@protoc_insertion_point(field_add_mutable:google.protobuf.Type.oneofs) @@ -1750,16 +1793,15 @@ inline const std::string& Type::oneofs(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs) return _internal_oneofs().Get(index); } -inline std::string* Type::mutable_oneofs(int index) +inline std::string* PROTOBUF_NONNULL Type::mutable_oneofs(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Type.oneofs) return _internal_mutable_oneofs()->Mutable(index); } template <typename Arg_, typename... Args_> inline void Type::set_oneofs(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString( - *_internal_mutable_oneofs()->Mutable(index), - std::forward<Arg_>(value), args... ); + ::google::protobuf::internal::AssignToString(*_internal_mutable_oneofs()->Mutable(index), std::forward<Arg_>(value), + args... ); // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs) } template <typename Arg_, typename... Args_> @@ -1770,12 +1812,12 @@ inline void Type::add_oneofs(Arg_&& value, Args_... args) { args... ); // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs) } -inline const ::google::protobuf::RepeatedPtrField<std::string>& -Type::oneofs() const ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline const ::google::protobuf::RepeatedPtrField<std::string>& Type::oneofs() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_list:google.protobuf.Type.oneofs) return _internal_oneofs(); } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL Type::mutable_oneofs() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.oneofs) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1786,7 +1828,7 @@ Type::_internal_oneofs() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.oneofs_; } -inline ::google::protobuf::RepeatedPtrField<std::string>* +inline ::google::protobuf::RepeatedPtrField<std::string>* PROTOBUF_NONNULL Type::_internal_mutable_oneofs() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.oneofs_; @@ -1803,12 +1845,12 @@ inline void Type::clear_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.options_.Clear(); } -inline ::google::protobuf::Option* Type::mutable_options(int index) +inline ::google::protobuf::Option* PROTOBUF_NONNULL Type::mutable_options(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Type.options) return _internal_mutable_options()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* Type::mutable_options() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Type::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1819,7 +1861,8 @@ inline const ::google::protobuf::Option& Type::options(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Type.options) return _internal_options().Get(index); } -inline ::google::protobuf::Option* Type::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Option* PROTOBUF_NONNULL Type::add_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Option* _add = _internal_mutable_options()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Type.options) @@ -1835,7 +1878,7 @@ Type::_internal_options() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.options_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Type::_internal_mutable_options() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.options_; @@ -1843,7 +1886,7 @@ Type::_internal_mutable_options() { // .google.protobuf.SourceContext source_context = 5; inline bool Type::has_source_context() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; PROTOBUF_ASSUME(!value || _impl_.source_context_ != nullptr); return value; } @@ -1856,23 +1899,24 @@ inline const ::google::protobuf::SourceContext& Type::source_context() const ABS // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) return _internal_source_context(); } -inline void Type::unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* value) { +inline void Type::unsafe_arena_set_allocated_source_context( + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.source_context_); } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.source_context) } -inline ::google::protobuf::SourceContext* Type::release_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NULLABLE Type::release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* released = _impl_.source_context_; _impl_.source_context_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -1888,16 +1932,16 @@ inline ::google::protobuf::SourceContext* Type::release_source_context() { } return released; } -inline ::google::protobuf::SourceContext* Type::unsafe_arena_release_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NULLABLE Type::unsafe_arena_release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; return temp; } -inline ::google::protobuf::SourceContext* Type::_internal_mutable_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NONNULL Type::_internal_mutable_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::SourceContext>(GetArena()); @@ -1905,13 +1949,14 @@ inline ::google::protobuf::SourceContext* Type::_internal_mutable_source_context } return _impl_.source_context_; } -inline ::google::protobuf::SourceContext* Type::mutable_source_context() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; +inline ::google::protobuf::SourceContext* PROTOBUF_NONNULL Type::mutable_source_context() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + _impl_._has_bits_[0] |= 0x00000004u; ::google::protobuf::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) return _msg; } -inline void Type::set_allocated_source_context(::google::protobuf::SourceContext* value) { +inline void Type::set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { @@ -1919,13 +1964,13 @@ inline void Type::set_allocated_source_context(::google::protobuf::SourceContext } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); @@ -1936,6 +1981,7 @@ inline void Type::set_allocated_source_context(::google::protobuf::SourceContext inline void Type::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000008u; } inline ::google::protobuf::Syntax Type::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Type.syntax) @@ -1943,6 +1989,7 @@ inline ::google::protobuf::Syntax Type::syntax() const { } inline void Type::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Type.syntax) } inline ::google::protobuf::Syntax Type::_internal_syntax() const { @@ -1958,6 +2005,7 @@ inline void Type::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Type::clear_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.edition_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Type::edition() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -1965,13 +2013,14 @@ inline const std::string& Type::edition() const return _internal_edition(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Type::set_edition(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Type::set_edition(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Type.edition) } -inline std::string* Type::mutable_edition() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Type::mutable_edition() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_edition(); // @@protoc_insertion_point(field_mutable:google.protobuf.Type.edition) return _s; @@ -1982,19 +2031,34 @@ inline const std::string& Type::_internal_edition() const { } inline void Type::_internal_set_edition(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(value, GetArena()); } -inline std::string* Type::_internal_mutable_edition() { +inline std::string* PROTOBUF_NONNULL Type::_internal_mutable_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.edition_.Mutable( GetArena()); } -inline std::string* Type::release_edition() { +inline std::string* PROTOBUF_NULLABLE Type::release_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Type.edition) - return _impl_.edition_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.edition_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.edition_.Set("", GetArena()); + } + return released; } -inline void Type::set_allocated_edition(std::string* value) { +inline void Type::set_allocated_edition(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.edition_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.edition_.IsDefault()) { _impl_.edition_.Set("", GetArena()); @@ -2010,6 +2074,7 @@ inline void Type::set_allocated_edition(std::string* value) { inline void Field::clear_kind() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.kind_ = 0; + _impl_._has_bits_[0] &= ~0x00000010u; } inline ::google::protobuf::Field_Kind Field::kind() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.kind) @@ -2017,6 +2082,7 @@ inline ::google::protobuf::Field_Kind Field::kind() const { } inline void Field::set_kind(::google::protobuf::Field_Kind value) { _internal_set_kind(value); + _impl_._has_bits_[0] |= 0x00000010u; // @@protoc_insertion_point(field_set:google.protobuf.Field.kind) } inline ::google::protobuf::Field_Kind Field::_internal_kind() const { @@ -2032,6 +2098,7 @@ inline void Field::_internal_set_kind(::google::protobuf::Field_Kind value) { inline void Field::clear_cardinality() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.cardinality_ = 0; + _impl_._has_bits_[0] &= ~0x00000020u; } inline ::google::protobuf::Field_Cardinality Field::cardinality() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality) @@ -2039,6 +2106,7 @@ inline ::google::protobuf::Field_Cardinality Field::cardinality() const { } inline void Field::set_cardinality(::google::protobuf::Field_Cardinality value) { _internal_set_cardinality(value); + _impl_._has_bits_[0] |= 0x00000020u; // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality) } inline ::google::protobuf::Field_Cardinality Field::_internal_cardinality() const { @@ -2054,6 +2122,7 @@ inline void Field::_internal_set_cardinality(::google::protobuf::Field_Cardinali inline void Field::clear_number() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.number_ = 0; + _impl_._has_bits_[0] &= ~0x00000040u; } inline ::int32_t Field::number() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.number) @@ -2061,6 +2130,7 @@ inline ::int32_t Field::number() const { } inline void Field::set_number(::int32_t value) { _internal_set_number(value); + _impl_._has_bits_[0] |= 0x00000040u; // @@protoc_insertion_point(field_set:google.protobuf.Field.number) } inline ::int32_t Field::_internal_number() const { @@ -2076,6 +2146,7 @@ inline void Field::_internal_set_number(::int32_t value) { inline void Field::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Field::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2083,13 +2154,14 @@ inline const std::string& Field::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Field::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Field::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.name) } -inline std::string* Field::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Field::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Field.name) return _s; @@ -2100,19 +2172,34 @@ inline const std::string& Field::_internal_name() const { } inline void Field::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* Field::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL Field::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* Field::release_name() { +inline std::string* PROTOBUF_NULLABLE Field::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void Field::set_allocated_name(std::string* value) { +inline void Field::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2124,6 +2211,7 @@ inline void Field::set_allocated_name(std::string* value) { inline void Field::clear_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.type_url_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Field::type_url() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2131,13 +2219,14 @@ inline const std::string& Field::type_url() const return _internal_type_url(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Field::set_type_url(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Field::set_type_url(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.type_url_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url) } -inline std::string* Field::mutable_type_url() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Field::mutable_type_url() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_type_url(); // @@protoc_insertion_point(field_mutable:google.protobuf.Field.type_url) return _s; @@ -2148,19 +2237,34 @@ inline const std::string& Field::_internal_type_url() const { } inline void Field::_internal_set_type_url(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.type_url_.Set(value, GetArena()); } -inline std::string* Field::_internal_mutable_type_url() { +inline std::string* PROTOBUF_NONNULL Field::_internal_mutable_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.type_url_.Mutable( GetArena()); } -inline std::string* Field::release_type_url() { +inline std::string* PROTOBUF_NULLABLE Field::release_type_url() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.type_url) - return _impl_.type_url_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.type_url_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.type_url_.Set("", GetArena()); + } + return released; } -inline void Field::set_allocated_type_url(std::string* value) { +inline void Field::set_allocated_type_url(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.type_url_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.type_url_.IsDefault()) { _impl_.type_url_.Set("", GetArena()); @@ -2172,6 +2276,7 @@ inline void Field::set_allocated_type_url(std::string* value) { inline void Field::clear_oneof_index() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.oneof_index_ = 0; + _impl_._has_bits_[0] &= ~0x00000080u; } inline ::int32_t Field::oneof_index() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index) @@ -2179,6 +2284,7 @@ inline ::int32_t Field::oneof_index() const { } inline void Field::set_oneof_index(::int32_t value) { _internal_set_oneof_index(value); + _impl_._has_bits_[0] |= 0x00000080u; // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index) } inline ::int32_t Field::_internal_oneof_index() const { @@ -2194,6 +2300,7 @@ inline void Field::_internal_set_oneof_index(::int32_t value) { inline void Field::clear_packed() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.packed_ = false; + _impl_._has_bits_[0] &= ~0x00000100u; } inline bool Field::packed() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.packed) @@ -2201,6 +2308,7 @@ inline bool Field::packed() const { } inline void Field::set_packed(bool value) { _internal_set_packed(value); + _impl_._has_bits_[0] |= 0x00000100u; // @@protoc_insertion_point(field_set:google.protobuf.Field.packed) } inline bool Field::_internal_packed() const { @@ -2223,12 +2331,12 @@ inline void Field::clear_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.options_.Clear(); } -inline ::google::protobuf::Option* Field::mutable_options(int index) +inline ::google::protobuf::Option* PROTOBUF_NONNULL Field::mutable_options(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Field.options) return _internal_mutable_options()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* Field::mutable_options() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Field::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2239,7 +2347,8 @@ inline const ::google::protobuf::Option& Field::options(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Field.options) return _internal_options().Get(index); } -inline ::google::protobuf::Option* Field::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Option* PROTOBUF_NONNULL Field::add_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Option* _add = _internal_mutable_options()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Field.options) @@ -2255,7 +2364,7 @@ Field::_internal_options() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.options_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Field::_internal_mutable_options() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.options_; @@ -2265,6 +2374,7 @@ Field::_internal_mutable_options() { inline void Field::clear_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.json_name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000004u; } inline const std::string& Field::json_name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2272,13 +2382,14 @@ inline const std::string& Field::json_name() const return _internal_json_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Field::set_json_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Field::set_json_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.json_name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.json_name) } -inline std::string* Field::mutable_json_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Field::mutable_json_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_json_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Field.json_name) return _s; @@ -2289,19 +2400,34 @@ inline const std::string& Field::_internal_json_name() const { } inline void Field::_internal_set_json_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; _impl_.json_name_.Set(value, GetArena()); } -inline std::string* Field::_internal_mutable_json_name() { +inline std::string* PROTOBUF_NONNULL Field::_internal_mutable_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000004u; return _impl_.json_name_.Mutable( GetArena()); } -inline std::string* Field::release_json_name() { +inline std::string* PROTOBUF_NULLABLE Field::release_json_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.json_name) - return _impl_.json_name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000004u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000004u; + auto* released = _impl_.json_name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.json_name_.Set("", GetArena()); + } + return released; } -inline void Field::set_allocated_json_name(std::string* value) { +inline void Field::set_allocated_json_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000004u; + } else { + _impl_._has_bits_[0] &= ~0x00000004u; + } _impl_.json_name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.json_name_.IsDefault()) { _impl_.json_name_.Set("", GetArena()); @@ -2313,6 +2439,7 @@ inline void Field::set_allocated_json_name(std::string* value) { inline void Field::clear_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.default_value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000008u; } inline const std::string& Field::default_value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2320,13 +2447,14 @@ inline const std::string& Field::default_value() const return _internal_default_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Field::set_default_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Field::set_default_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000008u; _impl_.default_value_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Field.default_value) } -inline std::string* Field::mutable_default_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Field::mutable_default_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_default_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Field.default_value) return _s; @@ -2337,19 +2465,34 @@ inline const std::string& Field::_internal_default_value() const { } inline void Field::_internal_set_default_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000008u; _impl_.default_value_.Set(value, GetArena()); } -inline std::string* Field::_internal_mutable_default_value() { +inline std::string* PROTOBUF_NONNULL Field::_internal_mutable_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000008u; return _impl_.default_value_.Mutable( GetArena()); } -inline std::string* Field::release_default_value() { +inline std::string* PROTOBUF_NULLABLE Field::release_default_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Field.default_value) - return _impl_.default_value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000008u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000008u; + auto* released = _impl_.default_value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.default_value_.Set("", GetArena()); + } + return released; } -inline void Field::set_allocated_default_value(std::string* value) { +inline void Field::set_allocated_default_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000008u; + } else { + _impl_._has_bits_[0] &= ~0x00000008u; + } _impl_.default_value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.default_value_.IsDefault()) { _impl_.default_value_.Set("", GetArena()); @@ -2365,6 +2508,7 @@ inline void Field::set_allocated_default_value(std::string* value) { inline void Enum::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Enum::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2372,13 +2516,14 @@ inline const std::string& Enum::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Enum::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Enum::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Enum.name) } -inline std::string* Enum::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Enum::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.name) return _s; @@ -2389,19 +2534,34 @@ inline const std::string& Enum::_internal_name() const { } inline void Enum::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* Enum::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL Enum::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* Enum::release_name() { +inline std::string* PROTOBUF_NULLABLE Enum::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Enum.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void Enum::set_allocated_name(std::string* value) { +inline void Enum::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2420,12 +2580,12 @@ inline void Enum::clear_enumvalue() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.enumvalue_.Clear(); } -inline ::google::protobuf::EnumValue* Enum::mutable_enumvalue(int index) +inline ::google::protobuf::EnumValue* PROTOBUF_NONNULL Enum::mutable_enumvalue(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.enumvalue) return _internal_mutable_enumvalue()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* Enum::mutable_enumvalue() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* PROTOBUF_NONNULL Enum::mutable_enumvalue() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2436,7 +2596,8 @@ inline const ::google::protobuf::EnumValue& Enum::enumvalue(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue) return _internal_enumvalue().Get(index); } -inline ::google::protobuf::EnumValue* Enum::add_enumvalue() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::EnumValue* PROTOBUF_NONNULL Enum::add_enumvalue() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::EnumValue* _add = _internal_mutable_enumvalue()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue) @@ -2452,7 +2613,7 @@ Enum::_internal_enumvalue() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.enumvalue_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::EnumValue>* PROTOBUF_NONNULL Enum::_internal_mutable_enumvalue() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.enumvalue_; @@ -2469,12 +2630,12 @@ inline void Enum::clear_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.options_.Clear(); } -inline ::google::protobuf::Option* Enum::mutable_options(int index) +inline ::google::protobuf::Option* PROTOBUF_NONNULL Enum::mutable_options(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.options) return _internal_mutable_options()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* Enum::mutable_options() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Enum::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2485,7 +2646,8 @@ inline const ::google::protobuf::Option& Enum::options(int index) const // @@protoc_insertion_point(field_get:google.protobuf.Enum.options) return _internal_options().Get(index); } -inline ::google::protobuf::Option* Enum::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Option* PROTOBUF_NONNULL Enum::add_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Option* _add = _internal_mutable_options()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.Enum.options) @@ -2501,7 +2663,7 @@ Enum::_internal_options() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.options_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL Enum::_internal_mutable_options() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.options_; @@ -2509,7 +2671,7 @@ Enum::_internal_mutable_options() { // .google.protobuf.SourceContext source_context = 4; inline bool Enum::has_source_context() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; PROTOBUF_ASSUME(!value || _impl_.source_context_ != nullptr); return value; } @@ -2522,23 +2684,24 @@ inline const ::google::protobuf::SourceContext& Enum::source_context() const ABS // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) return _internal_source_context(); } -inline void Enum::unsafe_arena_set_allocated_source_context(::google::protobuf::SourceContext* value) { +inline void Enum::unsafe_arena_set_allocated_source_context( + ::google::protobuf::SourceContext* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.source_context_); } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.source_context) } -inline ::google::protobuf::SourceContext* Enum::release_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NULLABLE Enum::release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* released = _impl_.source_context_; _impl_.source_context_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -2554,16 +2717,16 @@ inline ::google::protobuf::SourceContext* Enum::release_source_context() { } return released; } -inline ::google::protobuf::SourceContext* Enum::unsafe_arena_release_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NULLABLE Enum::unsafe_arena_release_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; ::google::protobuf::SourceContext* temp = _impl_.source_context_; _impl_.source_context_ = nullptr; return temp; } -inline ::google::protobuf::SourceContext* Enum::_internal_mutable_source_context() { +inline ::google::protobuf::SourceContext* PROTOBUF_NONNULL Enum::_internal_mutable_source_context() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.source_context_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::SourceContext>(GetArena()); @@ -2571,13 +2734,14 @@ inline ::google::protobuf::SourceContext* Enum::_internal_mutable_source_context } return _impl_.source_context_; } -inline ::google::protobuf::SourceContext* Enum::mutable_source_context() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; +inline ::google::protobuf::SourceContext* PROTOBUF_NONNULL Enum::mutable_source_context() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + _impl_._has_bits_[0] |= 0x00000004u; ::google::protobuf::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) return _msg; } -inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext* value) { +inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { @@ -2585,13 +2749,13 @@ inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000004u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000004u; } _impl_.source_context_ = reinterpret_cast<::google::protobuf::SourceContext*>(value); @@ -2602,6 +2766,7 @@ inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext inline void Enum::clear_syntax() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.syntax_ = 0; + _impl_._has_bits_[0] &= ~0x00000008u; } inline ::google::protobuf::Syntax Enum::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.syntax) @@ -2609,6 +2774,7 @@ inline ::google::protobuf::Syntax Enum::syntax() const { } inline void Enum::set_syntax(::google::protobuf::Syntax value) { _internal_set_syntax(value); + _impl_._has_bits_[0] |= 0x00000008u; // @@protoc_insertion_point(field_set:google.protobuf.Enum.syntax) } inline ::google::protobuf::Syntax Enum::_internal_syntax() const { @@ -2624,6 +2790,7 @@ inline void Enum::_internal_set_syntax(::google::protobuf::Syntax value) { inline void Enum::clear_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.edition_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000002u; } inline const std::string& Enum::edition() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2631,13 +2798,14 @@ inline const std::string& Enum::edition() const return _internal_edition(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Enum::set_edition(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Enum::set_edition(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Enum.edition) } -inline std::string* Enum::mutable_edition() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Enum::mutable_edition() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_edition(); // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.edition) return _s; @@ -2648,19 +2816,34 @@ inline const std::string& Enum::_internal_edition() const { } inline void Enum::_internal_set_edition(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; _impl_.edition_.Set(value, GetArena()); } -inline std::string* Enum::_internal_mutable_edition() { +inline std::string* PROTOBUF_NONNULL Enum::_internal_mutable_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000002u; return _impl_.edition_.Mutable( GetArena()); } -inline std::string* Enum::release_edition() { +inline std::string* PROTOBUF_NULLABLE Enum::release_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Enum.edition) - return _impl_.edition_.Release(); + if ((_impl_._has_bits_[0] & 0x00000002u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000002u; + auto* released = _impl_.edition_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.edition_.Set("", GetArena()); + } + return released; } -inline void Enum::set_allocated_edition(std::string* value) { +inline void Enum::set_allocated_edition(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } _impl_.edition_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.edition_.IsDefault()) { _impl_.edition_.Set("", GetArena()); @@ -2676,6 +2859,7 @@ inline void Enum::set_allocated_edition(std::string* value) { inline void EnumValue::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& EnumValue::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2683,13 +2867,14 @@ inline const std::string& EnumValue::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void EnumValue::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void EnumValue::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name) } -inline std::string* EnumValue::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL EnumValue::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.name) return _s; @@ -2700,19 +2885,34 @@ inline const std::string& EnumValue::_internal_name() const { } inline void EnumValue::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* EnumValue::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL EnumValue::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* EnumValue::release_name() { +inline std::string* PROTOBUF_NULLABLE EnumValue::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.EnumValue.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void EnumValue::set_allocated_name(std::string* value) { +inline void EnumValue::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2724,6 +2924,7 @@ inline void EnumValue::set_allocated_name(std::string* value) { inline void EnumValue::clear_number() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.number_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; } inline ::int32_t EnumValue::number() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number) @@ -2731,6 +2932,7 @@ inline ::int32_t EnumValue::number() const { } inline void EnumValue::set_number(::int32_t value) { _internal_set_number(value); + _impl_._has_bits_[0] |= 0x00000002u; // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number) } inline ::int32_t EnumValue::_internal_number() const { @@ -2753,12 +2955,12 @@ inline void EnumValue::clear_options() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.options_.Clear(); } -inline ::google::protobuf::Option* EnumValue::mutable_options(int index) +inline ::google::protobuf::Option* PROTOBUF_NONNULL EnumValue::mutable_options(int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.options) return _internal_mutable_options()->Mutable(index); } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* EnumValue::mutable_options() +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL EnumValue::mutable_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2769,7 +2971,8 @@ inline const ::google::protobuf::Option& EnumValue::options(int index) const // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options) return _internal_options().Get(index); } -inline ::google::protobuf::Option* EnumValue::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline ::google::protobuf::Option* PROTOBUF_NONNULL EnumValue::add_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { ::google::protobuf::internal::TSanWrite(&_impl_); ::google::protobuf::Option* _add = _internal_mutable_options()->Add(); // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options) @@ -2785,7 +2988,7 @@ EnumValue::_internal_options() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.options_; } -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* +inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Option>* PROTOBUF_NONNULL EnumValue::_internal_mutable_options() { ::google::protobuf::internal::TSanRead(&_impl_); return &_impl_.options_; @@ -2799,6 +3002,7 @@ EnumValue::_internal_mutable_options() { inline void Option::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& Option::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2806,13 +3010,14 @@ inline const std::string& Option::name() const return _internal_name(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void Option::set_name(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void Option::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.Option.name) } -inline std::string* Option::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL Option::mutable_name() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:google.protobuf.Option.name) return _s; @@ -2823,19 +3028,34 @@ inline const std::string& Option::_internal_name() const { } inline void Option::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.name_.Set(value, GetArena()); } -inline std::string* Option::_internal_mutable_name() { +inline std::string* PROTOBUF_NONNULL Option::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.name_.Mutable( GetArena()); } -inline std::string* Option::release_name() { +inline std::string* PROTOBUF_NULLABLE Option::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Option.name) - return _impl_.name_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.name_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.name_.Set("", GetArena()); + } + return released; } -inline void Option::set_allocated_name(std::string* value) { +inline void Option::set_allocated_name(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.name_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArena()); @@ -2845,7 +3065,7 @@ inline void Option::set_allocated_name(std::string* value) { // .google.protobuf.Any value = 2; inline bool Option::has_value() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; PROTOBUF_ASSUME(!value || _impl_.value_ != nullptr); return value; } @@ -2858,23 +3078,24 @@ inline const ::google::protobuf::Any& Option::value() const ABSL_ATTRIBUTE_LIFET // @@protoc_insertion_point(field_get:google.protobuf.Option.value) return _internal_value(); } -inline void Option::unsafe_arena_set_allocated_value(::google::protobuf::Any* value) { +inline void Option::unsafe_arena_set_allocated_value( + ::google::protobuf::Any* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); if (GetArena() == nullptr) { delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.value_); } _impl_.value_ = reinterpret_cast<::google::protobuf::Any*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000002u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.value) } -inline ::google::protobuf::Any* Option::release_value() { +inline ::google::protobuf::Any* PROTOBUF_NULLABLE Option::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; ::google::protobuf::Any* released = _impl_.value_; _impl_.value_ = nullptr; if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { @@ -2890,16 +3111,16 @@ inline ::google::protobuf::Any* Option::release_value() { } return released; } -inline ::google::protobuf::Any* Option::unsafe_arena_release_value() { +inline ::google::protobuf::Any* PROTOBUF_NULLABLE Option::unsafe_arena_release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.Option.value) - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; ::google::protobuf::Any* temp = _impl_.value_; _impl_.value_ = nullptr; return temp; } -inline ::google::protobuf::Any* Option::_internal_mutable_value() { +inline ::google::protobuf::Any* PROTOBUF_NONNULL Option::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.value_ == nullptr) { auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Any>(GetArena()); @@ -2907,13 +3128,14 @@ inline ::google::protobuf::Any* Option::_internal_mutable_value() { } return _impl_.value_; } -inline ::google::protobuf::Any* Option::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; +inline ::google::protobuf::Any* PROTOBUF_NONNULL Option::mutable_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::Any* _msg = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) return _msg; } -inline void Option::set_allocated_value(::google::protobuf::Any* value) { +inline void Option::set_allocated_value(::google::protobuf::Any* PROTOBUF_NULLABLE value) { ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); if (message_arena == nullptr) { @@ -2921,13 +3143,13 @@ inline void Option::set_allocated_value(::google::protobuf::Any* value) { } if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::MessageLite*>(value)->GetArena(); + ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000002u; } else { - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } _impl_.value_ = reinterpret_cast<::google::protobuf::Any*>(value); @@ -2949,19 +3171,19 @@ namespace protobuf { template <> struct is_proto_enum<::google::protobuf::Field_Kind> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::Field_Kind>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::Field_Kind>() { return ::google::protobuf::Field_Kind_descriptor(); } template <> struct is_proto_enum<::google::protobuf::Field_Cardinality> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::Field_Cardinality>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::Field_Cardinality>() { return ::google::protobuf::Field_Cardinality_descriptor(); } template <> struct is_proto_enum<::google::protobuf::Syntax> : std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor<::google::protobuf::Syntax>() { +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::Syntax>() { return ::google::protobuf::Syntax_descriptor(); } diff --git a/third_party/protobuf/src/google/protobuf/unittest.proto b/third_party/protobuf/src/google/protobuf/unittest.proto index a1734fc052269..c63ea58c45553 100644 --- a/third_party/protobuf/src/google/protobuf/unittest.proto +++ b/third_party/protobuf/src/google/protobuf/unittest.proto @@ -17,8 +17,8 @@ edition = "2023"; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -// In test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest; +// In test_util.h we do "using namespace unittest = proto2_unittest". +package proto2_unittest; import "google/protobuf/unittest_import.proto"; @@ -85,10 +85,10 @@ message TestAllTypes { NestedMessage optional_nested_message = 18; ForeignMessage optional_foreign_message = 19; - protobuf_unittest_import.ImportMessage optional_import_message = 20; + proto2_unittest_import.ImportMessage optional_import_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnum optional_foreign_enum = 22; - protobuf_unittest_import.ImportEnum optional_import_enum = 23; + proto2_unittest_import.ImportEnum optional_import_enum = 23; string optional_string_piece = 24 [ ctype = STRING_PIECE ]; @@ -99,7 +99,7 @@ message TestAllTypes { bytes optional_bytes_cord = 86 [ctype=CORD]; // Defined in unittest_import_public.proto - protobuf_unittest_import.PublicImportMessage optional_public_import_message = 26; + proto2_unittest_import.PublicImportMessage optional_public_import_message = 26; NestedMessage optional_lazy_message = 27 [ lazy = true ]; @@ -135,10 +135,10 @@ message TestAllTypes { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + repeated proto2_unittest_import.ImportMessage repeated_import_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnum repeated_foreign_enum = 52; - repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + repeated proto2_unittest_import.ImportEnum repeated_import_enum = 53; repeated string repeated_string_piece = 54 [ ctype = STRING_PIECE ]; @@ -220,7 +220,7 @@ message TestAllTypes { default = FOREIGN_BAR ]; - protobuf_unittest_import.ImportEnum default_import_enum = 83 [ + proto2_unittest_import.ImportEnum default_import_enum = 83 [ default = IMPORT_BAR ]; @@ -350,10 +350,10 @@ extend TestAllExtensions { TestAllTypes.NestedMessage optional_nested_message_extension = 18; ForeignMessage optional_foreign_message_extension = 19; - protobuf_unittest_import.ImportMessage optional_import_message_extension = 20; + proto2_unittest_import.ImportMessage optional_import_message_extension = 20; TestAllTypes.NestedEnum optional_nested_enum_extension = 21; ForeignEnum optional_foreign_enum_extension = 22; - protobuf_unittest_import.ImportEnum optional_import_enum_extension = 23; + proto2_unittest_import.ImportEnum optional_import_enum_extension = 23; string optional_string_piece_extension = 24 [ ctype = STRING_PIECE ]; @@ -363,7 +363,7 @@ extend TestAllExtensions { string optional_cord_extension = 25; bytes optional_bytes_cord_extension = 86; - protobuf_unittest_import.PublicImportMessage + proto2_unittest_import.PublicImportMessage optional_public_import_message_extension = 26; TestAllTypes.NestedMessage optional_lazy_message_extension = 27 [ lazy = true @@ -395,11 +395,11 @@ extend TestAllExtensions { repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; repeated ForeignMessage repeated_foreign_message_extension = 49; - repeated protobuf_unittest_import.ImportMessage + repeated proto2_unittest_import.ImportMessage repeated_import_message_extension = 50; repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; repeated ForeignEnum repeated_foreign_enum_extension = 52; - repeated protobuf_unittest_import.ImportEnum repeated_import_enum_extension = 53; + repeated proto2_unittest_import.ImportEnum repeated_import_enum_extension = 53; repeated string repeated_string_piece_extension = 54 [ ctype = STRING_PIECE ]; @@ -480,7 +480,7 @@ extend TestAllExtensions { default = FOREIGN_BAR ]; - protobuf_unittest_import.ImportEnum default_import_enum_extension = 83 [ + proto2_unittest_import.ImportEnum default_import_enum_extension = 83 [ default = IMPORT_BAR ]; @@ -500,6 +500,13 @@ extend TestAllExtensions { TestAllTypes.NestedMessage oneof_nested_message_extension = 112; string oneof_string_extension = 113; bytes oneof_bytes_extension = 114; + + string optional_utf8_string_extension = 115 [ + features.utf8_validation = VERIFY + ]; + repeated string repeated_utf8_string_extension = 116 [ + features.utf8_validation = VERIFY + ]; } message OptionalGroup_extension { @@ -897,7 +904,7 @@ message TestIsInitialized { // Test that groups have disjoint field numbers from their siblings and // parents. This is NOT possible in proto1; only google.protobuf. When attempting // to compile with proto1, this will emit an error; so we only include it -// in protobuf_unittest_proto. +// in proto2_unittest_proto. message TestDupFieldNumber {// NO_PROTO1 int32 a = 1; // NO_PROTO1 message Foo { // NO_PROTO1 @@ -1717,6 +1724,14 @@ message OpenEnumMessage { repeated ForeignEnum repeated_closed = 4; } +// Tests eager verification of a lazy message field. +message TestEagerlyVerifiedLazyMessage { + message LazyMessage { + bytes bytes_field = 1; + } + LazyMessage lazy_message = 1 [lazy = true]; +} + // Test that RPC services work. message FooRequest { } @@ -1788,8 +1803,8 @@ message TestHugeFieldNumbers { extensions 536860000 to 536869999 [ declaration = { number: 536860000 - full_name: ".protobuf_unittest.test_all_types" - type: ".protobuf_unittest.TestAllTypes" + full_name: ".proto2_unittest.test_all_types" + type: ".proto2_unittest.TestAllTypes" } ]; } @@ -1828,7 +1843,7 @@ message TestNestedGroupExtensionOuter { // [metadata = { // NOTE: can't write type there due to some clever build gen code at // http://google3/google/protobuf/BUILD;l=1247;rcl=411090862 - // type: "protobuf_unittest.TestNestedGroupExtensionInnerExtension", + // type: "proto2_unittest.TestNestedGroupExtensionInnerExtension", // name: "inner", // }] ; @@ -2439,6 +2454,10 @@ extend RedactedFields { ]; } +message TestString { + string optional_string = 1; +} + message TestCord { bytes optional_bytes_cord = 1 [ ctype = CORD diff --git a/third_party/protobuf/src/google/protobuf/unittest_custom_options.proto b/third_party/protobuf/src/google/protobuf/unittest_custom_options.proto index 7075012778c5f..3ebb8e36a4b22 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_custom_options.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_custom_options.proto @@ -27,7 +27,7 @@ import "google/protobuf/descriptor.proto"; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -package protobuf_unittest; +package proto2_unittest; // Some simple test custom options of various types. @@ -260,7 +260,7 @@ extend ComplexOptionType2 { } extend google.protobuf.MessageOptions { - optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756; + optional proto2_unittest.ComplexOptionType1 complex_opt1 = 7646756; optional ComplexOptionType2 complex_opt2 = 7636949; optional ComplexOptionType3 complex_opt3 = 7636463; optional group ComplexOpt6 = 7595468 { @@ -270,19 +270,19 @@ extend google.protobuf.MessageOptions { // Note that we try various different ways of naming the same extension. message VariousComplexOptions { - option (.protobuf_unittest.complex_opt1).foo = 42; - option (protobuf_unittest.complex_opt1).(.protobuf_unittest.mooo) = 324; - option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).moo = 876; - option (protobuf_unittest.complex_opt1).foo4 = 99; - option (protobuf_unittest.complex_opt1).foo4 = 88; + option (.proto2_unittest.complex_opt1).foo = 42; + option (proto2_unittest.complex_opt1).(.proto2_unittest.mooo) = 324; + option (.proto2_unittest.complex_opt1).(proto2_unittest.corge).moo = 876; + option (proto2_unittest.complex_opt1).foo4 = 99; + option (proto2_unittest.complex_opt1).foo4 = 88; option (complex_opt2).baz = 987; option (complex_opt2).(grault) = 654; option (complex_opt2).bar.foo = 743; option (complex_opt2).bar.(mooo) = 1999; - option (complex_opt2).bar.(protobuf_unittest.corge).moo = 2008; + option (complex_opt2).bar.(proto2_unittest.corge).moo = 2008; option (complex_opt2).(garply).foo = 741; - option (complex_opt2).(garply).(.protobuf_unittest.mooo) = 1998; - option (complex_opt2).(protobuf_unittest.garply).(corge).moo = 2121; + option (complex_opt2).(garply).(.proto2_unittest.mooo) = 1998; + option (complex_opt2).(proto2_unittest.garply).(corge).moo = 2121; option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971; option (complex_opt2).fred.waldo = 321; option (complex_opt2).barney = { @@ -291,7 +291,7 @@ message VariousComplexOptions { option (complex_opt2).barney = { waldo: 212 }; - option (protobuf_unittest.complex_opt3).moo = 9; + option (proto2_unittest.complex_opt3).moo = 9; option (complex_opt3).complexoptiontype5.plugh = 22; option (complexopt6).xyzzy = 24; } @@ -370,18 +370,18 @@ option (fileopt) = { // Include a google.protobuf.FileOptions and recursively extend it with // another fileopt. file { - [protobuf_unittest.fileopt] { s: 'FileExtensionAnnotation' } + [proto2_unittest.fileopt] { s: 'FileExtensionAnnotation' } } // A message set inside an option value mset { - [protobuf_unittest.AggregateMessageSetElement.message_set_extension] { + [proto2_unittest.AggregateMessageSetElement.message_set_extension] { s: 'EmbeddedMessageSetElement' } } any { - [type.googleapis.com/protobuf_unittest.AggregateMessageSetElement] { + [type.googleapis.com/proto2_unittest.AggregateMessageSetElement] { s: 'EmbeddedMessageSetElement' } } diff --git a/third_party/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto b/third_party/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto index f4f2f8944ddcd..ef9b567ee810c 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto @@ -13,7 +13,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/unittest_optimize_for.proto"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto b/third_party/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto index a8b6452a58096..5a1acd8eb471f 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto @@ -16,7 +16,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; option java_package = "com.google.protobuf"; // Avoid generating insanely long methods. diff --git a/third_party/protobuf/src/google/protobuf/unittest_extension_set.proto b/third_party/protobuf/src/google/protobuf/unittest_extension_set.proto index 0aa923c341411..1f67b5ba82a73 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_extension_set.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_extension_set.proto @@ -13,7 +13,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; option optimize_for = SPEED; option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_import.proto b/third_party/protobuf/src/google/protobuf/unittest_import.proto index 23fa9a8f310b2..41abd761d94e9 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_import.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_import.proto @@ -16,8 +16,8 @@ syntax = "proto2"; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. // In test_util.h we do -// "using namespace unittest_import = protobuf_unittest_import". -package protobuf_unittest_import; +// "using namespace unittest_import = proto2_unittest_import". +package proto2_unittest_import; option optimize_for = SPEED; option cc_enable_arenas = true; diff --git a/third_party/protobuf/src/google/protobuf/unittest_import_lite.proto b/third_party/protobuf/src/google/protobuf/unittest_import_lite.proto index 88cce299326d3..39e71214be5af 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_import_lite.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_import_lite.proto @@ -11,7 +11,7 @@ edition = "2023"; -package protobuf_unittest_import; +package proto2_unittest_import; import public "google/protobuf/unittest_import_public_lite.proto"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_import_public.proto b/third_party/protobuf/src/google/protobuf/unittest_import_public.proto index ff428143f72c3..34701fe3108d5 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_import_public.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_import_public.proto @@ -9,7 +9,7 @@ syntax = "proto2"; -package protobuf_unittest_import; +package proto2_unittest_import; option java_package = "com.google.protobuf.test"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_import_public_lite.proto b/third_party/protobuf/src/google/protobuf/unittest_import_public_lite.proto index 30172833d6481..1dd1ebd6177b5 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_import_public_lite.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_import_public_lite.proto @@ -9,7 +9,7 @@ edition = "2023"; -package protobuf_unittest_import; +package proto2_unittest_import; option optimize_for = LITE_RUNTIME; option java_package = "com.google.protobuf"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_large_oneof.proto b/third_party/protobuf/src/google/protobuf/unittest_large_oneof.proto new file mode 100644 index 0000000000000..cfc52c56895a1 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/unittest_large_oneof.proto @@ -0,0 +1,7010 @@ +edition = "2023"; + +package proto2_unittest; + +option java_multiple_files = true; + +message TestLargeOneofLargeFieldNumber { + oneof foo { + int32 int32_1 = 100001; + int32 int32_2 = 100002; + int32 int32_3 = 100003; + int32 int32_4 = 100004; + int32 int32_5 = 100005; + int32 int32_6 = 100006; + int32 int32_7 = 100007; + int32 int32_8 = 100008; + int32 int32_9 = 100009; + int32 int32_10 = 100010; + int32 int32_11 = 100011; + int32 int32_12 = 100012; + int32 int32_13 = 100013; + int32 int32_14 = 100014; + int32 int32_15 = 100015; + int32 int32_16 = 100016; + int32 int32_17 = 100017; + int32 int32_18 = 100018; + int32 int32_19 = 100019; + int32 int32_20 = 100020; + int32 int32_21 = 100021; + int32 int32_22 = 100022; + int32 int32_23 = 100023; + int32 int32_24 = 100024; + int32 int32_25 = 100025; + int32 int32_26 = 100026; + int32 int32_27 = 100027; + int32 int32_28 = 100028; + int32 int32_29 = 100029; + int32 int32_30 = 100030; + int32 int32_31 = 100031; + int32 int32_32 = 100032; + int32 int32_33 = 100033; + int32 int32_34 = 100034; + int32 int32_35 = 100035; + int32 int32_36 = 100036; + int32 int32_37 = 100037; + int32 int32_38 = 100038; + int32 int32_39 = 100039; + int32 int32_40 = 100040; + int32 int32_41 = 100041; + int32 int32_42 = 100042; + int32 int32_43 = 100043; + int32 int32_44 = 100044; + int32 int32_45 = 100045; + int32 int32_46 = 100046; + int32 int32_47 = 100047; + int32 int32_48 = 100048; + int32 int32_49 = 100049; + int32 int32_50 = 100050; + int32 int32_51 = 100051; + int32 int32_52 = 100052; + int32 int32_53 = 100053; + int32 int32_54 = 100054; + int32 int32_55 = 100055; + int32 int32_56 = 100056; + int32 int32_57 = 100057; + int32 int32_58 = 100058; + int32 int32_59 = 100059; + int32 int32_60 = 100060; + int32 int32_61 = 100061; + int32 int32_62 = 100062; + int32 int32_63 = 100063; + int32 int32_64 = 100064; + int32 int32_65 = 100065; + int32 int32_66 = 100066; + int32 int32_67 = 100067; + int32 int32_68 = 100068; + int32 int32_69 = 100069; + int32 int32_70 = 100070; + int32 int32_71 = 100071; + int32 int32_72 = 100072; + int32 int32_73 = 100073; + int32 int32_74 = 100074; + int32 int32_75 = 100075; + int32 int32_76 = 100076; + int32 int32_77 = 100077; + int32 int32_78 = 100078; + int32 int32_79 = 100079; + int32 int32_80 = 100080; + int32 int32_81 = 100081; + int32 int32_82 = 100082; + int32 int32_83 = 100083; + int32 int32_84 = 100084; + int32 int32_85 = 100085; + int32 int32_86 = 100086; + int32 int32_87 = 100087; + int32 int32_88 = 100088; + int32 int32_89 = 100089; + int32 int32_90 = 100090; + int32 int32_91 = 100091; + int32 int32_92 = 100092; + int32 int32_93 = 100093; + int32 int32_94 = 100094; + int32 int32_95 = 100095; + int32 int32_96 = 100096; + int32 int32_97 = 100097; + int32 int32_98 = 100098; + int32 int32_99 = 100099; + int32 int32_100 = 100100; + int32 int32_101 = 100101; + int32 int32_102 = 100102; + int32 int32_103 = 100103; + int32 int32_104 = 100104; + int32 int32_105 = 100105; + int32 int32_106 = 100106; + int32 int32_107 = 100107; + int32 int32_108 = 100108; + int32 int32_109 = 100109; + int32 int32_110 = 100110; + int32 int32_111 = 100111; + int32 int32_112 = 100112; + int32 int32_113 = 100113; + int32 int32_114 = 100114; + int32 int32_115 = 100115; + int32 int32_116 = 100116; + int32 int32_117 = 100117; + int32 int32_118 = 100118; + int32 int32_119 = 100119; + int32 int32_120 = 100120; + int32 int32_121 = 100121; + int32 int32_122 = 100122; + int32 int32_123 = 100123; + int32 int32_124 = 100124; + int32 int32_125 = 100125; + int32 int32_126 = 100126; + int32 int32_127 = 100127; + int32 int32_128 = 100128; + int32 int32_129 = 100129; + int32 int32_130 = 100130; + int32 int32_131 = 100131; + int32 int32_132 = 100132; + int32 int32_133 = 100133; + int32 int32_134 = 100134; + int32 int32_135 = 100135; + int32 int32_136 = 100136; + int32 int32_137 = 100137; + int32 int32_138 = 100138; + int32 int32_139 = 100139; + int32 int32_140 = 100140; + int32 int32_141 = 100141; + int32 int32_142 = 100142; + int32 int32_143 = 100143; + int32 int32_144 = 100144; + int32 int32_145 = 100145; + int32 int32_146 = 100146; + int32 int32_147 = 100147; + int32 int32_148 = 100148; + int32 int32_149 = 100149; + int32 int32_150 = 100150; + int32 int32_151 = 100151; + int32 int32_152 = 100152; + int32 int32_153 = 100153; + int32 int32_154 = 100154; + int32 int32_155 = 100155; + int32 int32_156 = 100156; + int32 int32_157 = 100157; + int32 int32_158 = 100158; + int32 int32_159 = 100159; + int32 int32_160 = 100160; + int32 int32_161 = 100161; + int32 int32_162 = 100162; + int32 int32_163 = 100163; + int32 int32_164 = 100164; + int32 int32_165 = 100165; + int32 int32_166 = 100166; + int32 int32_167 = 100167; + int32 int32_168 = 100168; + int32 int32_169 = 100169; + int32 int32_170 = 100170; + int32 int32_171 = 100171; + int32 int32_172 = 100172; + int32 int32_173 = 100173; + int32 int32_174 = 100174; + int32 int32_175 = 100175; + int32 int32_176 = 100176; + int32 int32_177 = 100177; + int32 int32_178 = 100178; + int32 int32_179 = 100179; + int32 int32_180 = 100180; + int32 int32_181 = 100181; + int32 int32_182 = 100182; + int32 int32_183 = 100183; + int32 int32_184 = 100184; + int32 int32_185 = 100185; + int32 int32_186 = 100186; + int32 int32_187 = 100187; + int32 int32_188 = 100188; + int32 int32_189 = 100189; + int32 int32_190 = 100190; + int32 int32_191 = 100191; + int32 int32_192 = 100192; + int32 int32_193 = 100193; + int32 int32_194 = 100194; + int32 int32_195 = 100195; + int32 int32_196 = 100196; + int32 int32_197 = 100197; + int32 int32_198 = 100198; + int32 int32_199 = 100199; + int32 int32_200 = 100200; + int32 int32_201 = 100201; + int32 int32_202 = 100202; + int32 int32_203 = 100203; + int32 int32_204 = 100204; + int32 int32_205 = 100205; + int32 int32_206 = 100206; + int32 int32_207 = 100207; + int32 int32_208 = 100208; + int32 int32_209 = 100209; + int32 int32_210 = 100210; + int32 int32_211 = 100211; + int32 int32_212 = 100212; + int32 int32_213 = 100213; + int32 int32_214 = 100214; + int32 int32_215 = 100215; + int32 int32_216 = 100216; + int32 int32_217 = 100217; + int32 int32_218 = 100218; + int32 int32_219 = 100219; + int32 int32_220 = 100220; + int32 int32_221 = 100221; + int32 int32_222 = 100222; + int32 int32_223 = 100223; + int32 int32_224 = 100224; + int32 int32_225 = 100225; + int32 int32_226 = 100226; + int32 int32_227 = 100227; + int32 int32_228 = 100228; + int32 int32_229 = 100229; + int32 int32_230 = 100230; + int32 int32_231 = 100231; + int32 int32_232 = 100232; + int32 int32_233 = 100233; + int32 int32_234 = 100234; + int32 int32_235 = 100235; + int32 int32_236 = 100236; + int32 int32_237 = 100237; + int32 int32_238 = 100238; + int32 int32_239 = 100239; + int32 int32_240 = 100240; + int32 int32_241 = 100241; + int32 int32_242 = 100242; + int32 int32_243 = 100243; + int32 int32_244 = 100244; + int32 int32_245 = 100245; + int32 int32_246 = 100246; + int32 int32_247 = 100247; + int32 int32_248 = 100248; + int32 int32_249 = 100249; + int32 int32_250 = 100250; + int32 int32_251 = 100251; + int32 int32_252 = 100252; + int32 int32_253 = 100253; + int32 int32_254 = 100254; + int32 int32_255 = 100255; + int32 int32_256 = 100256; + int32 int32_257 = 100257; + int32 int32_258 = 100258; + int32 int32_259 = 100259; + int32 int32_260 = 100260; + int32 int32_261 = 100261; + int32 int32_262 = 100262; + int32 int32_263 = 100263; + int32 int32_264 = 100264; + int32 int32_265 = 100265; + int32 int32_266 = 100266; + int32 int32_267 = 100267; + int32 int32_268 = 100268; + int32 int32_269 = 100269; + int32 int32_270 = 100270; + int32 int32_271 = 100271; + int32 int32_272 = 100272; + int32 int32_273 = 100273; + int32 int32_274 = 100274; + int32 int32_275 = 100275; + int32 int32_276 = 100276; + int32 int32_277 = 100277; + int32 int32_278 = 100278; + int32 int32_279 = 100279; + int32 int32_280 = 100280; + int32 int32_281 = 100281; + int32 int32_282 = 100282; + int32 int32_283 = 100283; + int32 int32_284 = 100284; + int32 int32_285 = 100285; + int32 int32_286 = 100286; + int32 int32_287 = 100287; + int32 int32_288 = 100288; + int32 int32_289 = 100289; + int32 int32_290 = 100290; + int32 int32_291 = 100291; + int32 int32_292 = 100292; + int32 int32_293 = 100293; + int32 int32_294 = 100294; + int32 int32_295 = 100295; + int32 int32_296 = 100296; + int32 int32_297 = 100297; + int32 int32_298 = 100298; + int32 int32_299 = 100299; + int32 int32_300 = 100300; + int32 int32_301 = 100301; + int32 int32_302 = 100302; + int32 int32_303 = 100303; + int32 int32_304 = 100304; + int32 int32_305 = 100305; + int32 int32_306 = 100306; + int32 int32_307 = 100307; + int32 int32_308 = 100308; + int32 int32_309 = 100309; + int32 int32_310 = 100310; + int32 int32_311 = 100311; + int32 int32_312 = 100312; + int32 int32_313 = 100313; + int32 int32_314 = 100314; + int32 int32_315 = 100315; + int32 int32_316 = 100316; + int32 int32_317 = 100317; + int32 int32_318 = 100318; + int32 int32_319 = 100319; + int32 int32_320 = 100320; + int32 int32_321 = 100321; + int32 int32_322 = 100322; + int32 int32_323 = 100323; + int32 int32_324 = 100324; + int32 int32_325 = 100325; + int32 int32_326 = 100326; + int32 int32_327 = 100327; + int32 int32_328 = 100328; + int32 int32_329 = 100329; + int32 int32_330 = 100330; + int32 int32_331 = 100331; + int32 int32_332 = 100332; + int32 int32_333 = 100333; + int32 int32_334 = 100334; + int32 int32_335 = 100335; + int32 int32_336 = 100336; + int32 int32_337 = 100337; + int32 int32_338 = 100338; + int32 int32_339 = 100339; + int32 int32_340 = 100340; + int32 int32_341 = 100341; + int32 int32_342 = 100342; + int32 int32_343 = 100343; + int32 int32_344 = 100344; + int32 int32_345 = 100345; + int32 int32_346 = 100346; + int32 int32_347 = 100347; + int32 int32_348 = 100348; + int32 int32_349 = 100349; + int32 int32_350 = 100350; + int32 int32_351 = 100351; + int32 int32_352 = 100352; + int32 int32_353 = 100353; + int32 int32_354 = 100354; + int32 int32_355 = 100355; + int32 int32_356 = 100356; + int32 int32_357 = 100357; + int32 int32_358 = 100358; + int32 int32_359 = 100359; + int32 int32_360 = 100360; + int32 int32_361 = 100361; + int32 int32_362 = 100362; + int32 int32_363 = 100363; + int32 int32_364 = 100364; + int32 int32_365 = 100365; + int32 int32_366 = 100366; + int32 int32_367 = 100367; + int32 int32_368 = 100368; + int32 int32_369 = 100369; + int32 int32_370 = 100370; + int32 int32_371 = 100371; + int32 int32_372 = 100372; + int32 int32_373 = 100373; + int32 int32_374 = 100374; + int32 int32_375 = 100375; + int32 int32_376 = 100376; + int32 int32_377 = 100377; + int32 int32_378 = 100378; + int32 int32_379 = 100379; + int32 int32_380 = 100380; + int32 int32_381 = 100381; + int32 int32_382 = 100382; + int32 int32_383 = 100383; + int32 int32_384 = 100384; + int32 int32_385 = 100385; + int32 int32_386 = 100386; + int32 int32_387 = 100387; + int32 int32_388 = 100388; + int32 int32_389 = 100389; + int32 int32_390 = 100390; + int32 int32_391 = 100391; + int32 int32_392 = 100392; + int32 int32_393 = 100393; + int32 int32_394 = 100394; + int32 int32_395 = 100395; + int32 int32_396 = 100396; + int32 int32_397 = 100397; + int32 int32_398 = 100398; + int32 int32_399 = 100399; + int32 int32_400 = 100400; + int32 int32_401 = 100401; + int32 int32_402 = 100402; + int32 int32_403 = 100403; + int32 int32_404 = 100404; + int32 int32_405 = 100405; + int32 int32_406 = 100406; + int32 int32_407 = 100407; + int32 int32_408 = 100408; + int32 int32_409 = 100409; + int32 int32_410 = 100410; + int32 int32_411 = 100411; + int32 int32_412 = 100412; + int32 int32_413 = 100413; + int32 int32_414 = 100414; + int32 int32_415 = 100415; + int32 int32_416 = 100416; + int32 int32_417 = 100417; + int32 int32_418 = 100418; + int32 int32_419 = 100419; + int32 int32_420 = 100420; + int32 int32_421 = 100421; + int32 int32_422 = 100422; + int32 int32_423 = 100423; + int32 int32_424 = 100424; + int32 int32_425 = 100425; + int32 int32_426 = 100426; + int32 int32_427 = 100427; + int32 int32_428 = 100428; + int32 int32_429 = 100429; + int32 int32_430 = 100430; + int32 int32_431 = 100431; + int32 int32_432 = 100432; + int32 int32_433 = 100433; + int32 int32_434 = 100434; + int32 int32_435 = 100435; + int32 int32_436 = 100436; + int32 int32_437 = 100437; + int32 int32_438 = 100438; + int32 int32_439 = 100439; + int32 int32_440 = 100440; + int32 int32_441 = 100441; + int32 int32_442 = 100442; + int32 int32_443 = 100443; + int32 int32_444 = 100444; + int32 int32_445 = 100445; + int32 int32_446 = 100446; + int32 int32_447 = 100447; + int32 int32_448 = 100448; + int32 int32_449 = 100449; + int32 int32_450 = 100450; + int32 int32_451 = 100451; + int32 int32_452 = 100452; + int32 int32_453 = 100453; + int32 int32_454 = 100454; + int32 int32_455 = 100455; + int32 int32_456 = 100456; + int32 int32_457 = 100457; + int32 int32_458 = 100458; + int32 int32_459 = 100459; + int32 int32_460 = 100460; + int32 int32_461 = 100461; + int32 int32_462 = 100462; + int32 int32_463 = 100463; + int32 int32_464 = 100464; + int32 int32_465 = 100465; + int32 int32_466 = 100466; + int32 int32_467 = 100467; + int32 int32_468 = 100468; + int32 int32_469 = 100469; + int32 int32_470 = 100470; + int32 int32_471 = 100471; + int32 int32_472 = 100472; + int32 int32_473 = 100473; + int32 int32_474 = 100474; + int32 int32_475 = 100475; + int32 int32_476 = 100476; + int32 int32_477 = 100477; + int32 int32_478 = 100478; + int32 int32_479 = 100479; + int32 int32_480 = 100480; + int32 int32_481 = 100481; + int32 int32_482 = 100482; + int32 int32_483 = 100483; + int32 int32_484 = 100484; + int32 int32_485 = 100485; + int32 int32_486 = 100486; + int32 int32_487 = 100487; + int32 int32_488 = 100488; + int32 int32_489 = 100489; + int32 int32_490 = 100490; + int32 int32_491 = 100491; + int32 int32_492 = 100492; + int32 int32_493 = 100493; + int32 int32_494 = 100494; + int32 int32_495 = 100495; + int32 int32_496 = 100496; + int32 int32_497 = 100497; + int32 int32_498 = 100498; + int32 int32_499 = 100499; + int32 int32_500 = 100500; + int32 int32_501 = 100501; + int32 int32_502 = 100502; + int32 int32_503 = 100503; + int32 int32_504 = 100504; + int32 int32_505 = 100505; + int32 int32_506 = 100506; + int32 int32_507 = 100507; + int32 int32_508 = 100508; + int32 int32_509 = 100509; + int32 int32_510 = 100510; + int32 int32_511 = 100511; + int32 int32_512 = 100512; + int32 int32_513 = 100513; + int32 int32_514 = 100514; + int32 int32_515 = 100515; + int32 int32_516 = 100516; + int32 int32_517 = 100517; + int32 int32_518 = 100518; + int32 int32_519 = 100519; + int32 int32_520 = 100520; + int32 int32_521 = 100521; + int32 int32_522 = 100522; + int32 int32_523 = 100523; + int32 int32_524 = 100524; + int32 int32_525 = 100525; + int32 int32_526 = 100526; + int32 int32_527 = 100527; + int32 int32_528 = 100528; + int32 int32_529 = 100529; + int32 int32_530 = 100530; + int32 int32_531 = 100531; + int32 int32_532 = 100532; + int32 int32_533 = 100533; + int32 int32_534 = 100534; + int32 int32_535 = 100535; + int32 int32_536 = 100536; + int32 int32_537 = 100537; + int32 int32_538 = 100538; + int32 int32_539 = 100539; + int32 int32_540 = 100540; + int32 int32_541 = 100541; + int32 int32_542 = 100542; + int32 int32_543 = 100543; + int32 int32_544 = 100544; + int32 int32_545 = 100545; + int32 int32_546 = 100546; + int32 int32_547 = 100547; + int32 int32_548 = 100548; + int32 int32_549 = 100549; + int32 int32_550 = 100550; + int32 int32_551 = 100551; + int32 int32_552 = 100552; + int32 int32_553 = 100553; + int32 int32_554 = 100554; + int32 int32_555 = 100555; + int32 int32_556 = 100556; + int32 int32_557 = 100557; + int32 int32_558 = 100558; + int32 int32_559 = 100559; + int32 int32_560 = 100560; + int32 int32_561 = 100561; + int32 int32_562 = 100562; + int32 int32_563 = 100563; + int32 int32_564 = 100564; + int32 int32_565 = 100565; + int32 int32_566 = 100566; + int32 int32_567 = 100567; + int32 int32_568 = 100568; + int32 int32_569 = 100569; + int32 int32_570 = 100570; + int32 int32_571 = 100571; + int32 int32_572 = 100572; + int32 int32_573 = 100573; + int32 int32_574 = 100574; + int32 int32_575 = 100575; + int32 int32_576 = 100576; + int32 int32_577 = 100577; + int32 int32_578 = 100578; + int32 int32_579 = 100579; + int32 int32_580 = 100580; + int32 int32_581 = 100581; + int32 int32_582 = 100582; + int32 int32_583 = 100583; + int32 int32_584 = 100584; + int32 int32_585 = 100585; + int32 int32_586 = 100586; + int32 int32_587 = 100587; + int32 int32_588 = 100588; + int32 int32_589 = 100589; + int32 int32_590 = 100590; + int32 int32_591 = 100591; + int32 int32_592 = 100592; + int32 int32_593 = 100593; + int32 int32_594 = 100594; + int32 int32_595 = 100595; + int32 int32_596 = 100596; + int32 int32_597 = 100597; + int32 int32_598 = 100598; + int32 int32_599 = 100599; + int32 int32_600 = 100600; + int32 int32_601 = 100601; + int32 int32_602 = 100602; + int32 int32_603 = 100603; + int32 int32_604 = 100604; + int32 int32_605 = 100605; + int32 int32_606 = 100606; + int32 int32_607 = 100607; + int32 int32_608 = 100608; + int32 int32_609 = 100609; + int32 int32_610 = 100610; + int32 int32_611 = 100611; + int32 int32_612 = 100612; + int32 int32_613 = 100613; + int32 int32_614 = 100614; + int32 int32_615 = 100615; + int32 int32_616 = 100616; + int32 int32_617 = 100617; + int32 int32_618 = 100618; + int32 int32_619 = 100619; + int32 int32_620 = 100620; + int32 int32_621 = 100621; + int32 int32_622 = 100622; + int32 int32_623 = 100623; + int32 int32_624 = 100624; + int32 int32_625 = 100625; + int32 int32_626 = 100626; + int32 int32_627 = 100627; + int32 int32_628 = 100628; + int32 int32_629 = 100629; + int32 int32_630 = 100630; + int32 int32_631 = 100631; + int32 int32_632 = 100632; + int32 int32_633 = 100633; + int32 int32_634 = 100634; + int32 int32_635 = 100635; + int32 int32_636 = 100636; + int32 int32_637 = 100637; + int32 int32_638 = 100638; + int32 int32_639 = 100639; + int32 int32_640 = 100640; + int32 int32_641 = 100641; + int32 int32_642 = 100642; + int32 int32_643 = 100643; + int32 int32_644 = 100644; + int32 int32_645 = 100645; + int32 int32_646 = 100646; + int32 int32_647 = 100647; + int32 int32_648 = 100648; + int32 int32_649 = 100649; + int32 int32_650 = 100650; + int32 int32_651 = 100651; + int32 int32_652 = 100652; + int32 int32_653 = 100653; + int32 int32_654 = 100654; + int32 int32_655 = 100655; + int32 int32_656 = 100656; + int32 int32_657 = 100657; + int32 int32_658 = 100658; + int32 int32_659 = 100659; + int32 int32_660 = 100660; + int32 int32_661 = 100661; + int32 int32_662 = 100662; + int32 int32_663 = 100663; + int32 int32_664 = 100664; + int32 int32_665 = 100665; + int32 int32_666 = 100666; + int32 int32_667 = 100667; + int32 int32_668 = 100668; + int32 int32_669 = 100669; + int32 int32_670 = 100670; + int32 int32_671 = 100671; + int32 int32_672 = 100672; + int32 int32_673 = 100673; + int32 int32_674 = 100674; + int32 int32_675 = 100675; + int32 int32_676 = 100676; + int32 int32_677 = 100677; + int32 int32_678 = 100678; + int32 int32_679 = 100679; + int32 int32_680 = 100680; + int32 int32_681 = 100681; + int32 int32_682 = 100682; + int32 int32_683 = 100683; + int32 int32_684 = 100684; + int32 int32_685 = 100685; + int32 int32_686 = 100686; + int32 int32_687 = 100687; + int32 int32_688 = 100688; + int32 int32_689 = 100689; + int32 int32_690 = 100690; + int32 int32_691 = 100691; + int32 int32_692 = 100692; + int32 int32_693 = 100693; + int32 int32_694 = 100694; + int32 int32_695 = 100695; + int32 int32_696 = 100696; + int32 int32_697 = 100697; + int32 int32_698 = 100698; + int32 int32_699 = 100699; + int32 int32_700 = 100700; + int32 int32_701 = 100701; + int32 int32_702 = 100702; + int32 int32_703 = 100703; + int32 int32_704 = 100704; + int32 int32_705 = 100705; + int32 int32_706 = 100706; + int32 int32_707 = 100707; + int32 int32_708 = 100708; + int32 int32_709 = 100709; + int32 int32_710 = 100710; + int32 int32_711 = 100711; + int32 int32_712 = 100712; + int32 int32_713 = 100713; + int32 int32_714 = 100714; + int32 int32_715 = 100715; + int32 int32_716 = 100716; + int32 int32_717 = 100717; + int32 int32_718 = 100718; + int32 int32_719 = 100719; + int32 int32_720 = 100720; + int32 int32_721 = 100721; + int32 int32_722 = 100722; + int32 int32_723 = 100723; + int32 int32_724 = 100724; + int32 int32_725 = 100725; + int32 int32_726 = 100726; + int32 int32_727 = 100727; + int32 int32_728 = 100728; + int32 int32_729 = 100729; + int32 int32_730 = 100730; + int32 int32_731 = 100731; + int32 int32_732 = 100732; + int32 int32_733 = 100733; + int32 int32_734 = 100734; + int32 int32_735 = 100735; + int32 int32_736 = 100736; + int32 int32_737 = 100737; + int32 int32_738 = 100738; + int32 int32_739 = 100739; + int32 int32_740 = 100740; + int32 int32_741 = 100741; + int32 int32_742 = 100742; + int32 int32_743 = 100743; + int32 int32_744 = 100744; + int32 int32_745 = 100745; + int32 int32_746 = 100746; + int32 int32_747 = 100747; + int32 int32_748 = 100748; + int32 int32_749 = 100749; + int32 int32_750 = 100750; + int32 int32_751 = 100751; + int32 int32_752 = 100752; + int32 int32_753 = 100753; + int32 int32_754 = 100754; + int32 int32_755 = 100755; + int32 int32_756 = 100756; + int32 int32_757 = 100757; + int32 int32_758 = 100758; + int32 int32_759 = 100759; + int32 int32_760 = 100760; + int32 int32_761 = 100761; + int32 int32_762 = 100762; + int32 int32_763 = 100763; + int32 int32_764 = 100764; + int32 int32_765 = 100765; + int32 int32_766 = 100766; + int32 int32_767 = 100767; + int32 int32_768 = 100768; + int32 int32_769 = 100769; + int32 int32_770 = 100770; + int32 int32_771 = 100771; + int32 int32_772 = 100772; + int32 int32_773 = 100773; + int32 int32_774 = 100774; + int32 int32_775 = 100775; + int32 int32_776 = 100776; + int32 int32_777 = 100777; + int32 int32_778 = 100778; + int32 int32_779 = 100779; + int32 int32_780 = 100780; + int32 int32_781 = 100781; + int32 int32_782 = 100782; + int32 int32_783 = 100783; + int32 int32_784 = 100784; + int32 int32_785 = 100785; + int32 int32_786 = 100786; + int32 int32_787 = 100787; + int32 int32_788 = 100788; + int32 int32_789 = 100789; + int32 int32_790 = 100790; + int32 int32_791 = 100791; + int32 int32_792 = 100792; + int32 int32_793 = 100793; + int32 int32_794 = 100794; + int32 int32_795 = 100795; + int32 int32_796 = 100796; + int32 int32_797 = 100797; + int32 int32_798 = 100798; + int32 int32_799 = 100799; + int32 int32_800 = 100800; + int32 int32_801 = 100801; + int32 int32_802 = 100802; + int32 int32_803 = 100803; + int32 int32_804 = 100804; + int32 int32_805 = 100805; + int32 int32_806 = 100806; + int32 int32_807 = 100807; + int32 int32_808 = 100808; + int32 int32_809 = 100809; + int32 int32_810 = 100810; + int32 int32_811 = 100811; + int32 int32_812 = 100812; + int32 int32_813 = 100813; + int32 int32_814 = 100814; + int32 int32_815 = 100815; + int32 int32_816 = 100816; + int32 int32_817 = 100817; + int32 int32_818 = 100818; + int32 int32_819 = 100819; + int32 int32_820 = 100820; + int32 int32_821 = 100821; + int32 int32_822 = 100822; + int32 int32_823 = 100823; + int32 int32_824 = 100824; + int32 int32_825 = 100825; + int32 int32_826 = 100826; + int32 int32_827 = 100827; + int32 int32_828 = 100828; + int32 int32_829 = 100829; + int32 int32_830 = 100830; + int32 int32_831 = 100831; + int32 int32_832 = 100832; + int32 int32_833 = 100833; + int32 int32_834 = 100834; + int32 int32_835 = 100835; + int32 int32_836 = 100836; + int32 int32_837 = 100837; + int32 int32_838 = 100838; + int32 int32_839 = 100839; + int32 int32_840 = 100840; + int32 int32_841 = 100841; + int32 int32_842 = 100842; + int32 int32_843 = 100843; + int32 int32_844 = 100844; + int32 int32_845 = 100845; + int32 int32_846 = 100846; + int32 int32_847 = 100847; + int32 int32_848 = 100848; + int32 int32_849 = 100849; + int32 int32_850 = 100850; + int32 int32_851 = 100851; + int32 int32_852 = 100852; + int32 int32_853 = 100853; + int32 int32_854 = 100854; + int32 int32_855 = 100855; + int32 int32_856 = 100856; + int32 int32_857 = 100857; + int32 int32_858 = 100858; + int32 int32_859 = 100859; + int32 int32_860 = 100860; + int32 int32_861 = 100861; + int32 int32_862 = 100862; + int32 int32_863 = 100863; + int32 int32_864 = 100864; + int32 int32_865 = 100865; + int32 int32_866 = 100866; + int32 int32_867 = 100867; + int32 int32_868 = 100868; + int32 int32_869 = 100869; + int32 int32_870 = 100870; + int32 int32_871 = 100871; + int32 int32_872 = 100872; + int32 int32_873 = 100873; + int32 int32_874 = 100874; + int32 int32_875 = 100875; + int32 int32_876 = 100876; + int32 int32_877 = 100877; + int32 int32_878 = 100878; + int32 int32_879 = 100879; + int32 int32_880 = 100880; + int32 int32_881 = 100881; + int32 int32_882 = 100882; + int32 int32_883 = 100883; + int32 int32_884 = 100884; + int32 int32_885 = 100885; + int32 int32_886 = 100886; + int32 int32_887 = 100887; + int32 int32_888 = 100888; + int32 int32_889 = 100889; + int32 int32_890 = 100890; + int32 int32_891 = 100891; + int32 int32_892 = 100892; + int32 int32_893 = 100893; + int32 int32_894 = 100894; + int32 int32_895 = 100895; + int32 int32_896 = 100896; + int32 int32_897 = 100897; + int32 int32_898 = 100898; + int32 int32_899 = 100899; + int32 int32_900 = 100900; + int32 int32_901 = 100901; + int32 int32_902 = 100902; + int32 int32_903 = 100903; + int32 int32_904 = 100904; + int32 int32_905 = 100905; + int32 int32_906 = 100906; + int32 int32_907 = 100907; + int32 int32_908 = 100908; + int32 int32_909 = 100909; + int32 int32_910 = 100910; + int32 int32_911 = 100911; + int32 int32_912 = 100912; + int32 int32_913 = 100913; + int32 int32_914 = 100914; + int32 int32_915 = 100915; + int32 int32_916 = 100916; + int32 int32_917 = 100917; + int32 int32_918 = 100918; + int32 int32_919 = 100919; + int32 int32_920 = 100920; + int32 int32_921 = 100921; + int32 int32_922 = 100922; + int32 int32_923 = 100923; + int32 int32_924 = 100924; + int32 int32_925 = 100925; + int32 int32_926 = 100926; + int32 int32_927 = 100927; + int32 int32_928 = 100928; + int32 int32_929 = 100929; + int32 int32_930 = 100930; + int32 int32_931 = 100931; + int32 int32_932 = 100932; + int32 int32_933 = 100933; + int32 int32_934 = 100934; + int32 int32_935 = 100935; + int32 int32_936 = 100936; + int32 int32_937 = 100937; + int32 int32_938 = 100938; + int32 int32_939 = 100939; + int32 int32_940 = 100940; + int32 int32_941 = 100941; + int32 int32_942 = 100942; + int32 int32_943 = 100943; + int32 int32_944 = 100944; + int32 int32_945 = 100945; + int32 int32_946 = 100946; + int32 int32_947 = 100947; + int32 int32_948 = 100948; + int32 int32_949 = 100949; + int32 int32_950 = 100950; + int32 int32_951 = 100951; + int32 int32_952 = 100952; + int32 int32_953 = 100953; + int32 int32_954 = 100954; + int32 int32_955 = 100955; + int32 int32_956 = 100956; + int32 int32_957 = 100957; + int32 int32_958 = 100958; + int32 int32_959 = 100959; + int32 int32_960 = 100960; + int32 int32_961 = 100961; + int32 int32_962 = 100962; + int32 int32_963 = 100963; + int32 int32_964 = 100964; + int32 int32_965 = 100965; + int32 int32_966 = 100966; + int32 int32_967 = 100967; + int32 int32_968 = 100968; + int32 int32_969 = 100969; + int32 int32_970 = 100970; + int32 int32_971 = 100971; + int32 int32_972 = 100972; + int32 int32_973 = 100973; + int32 int32_974 = 100974; + int32 int32_975 = 100975; + int32 int32_976 = 100976; + int32 int32_977 = 100977; + int32 int32_978 = 100978; + int32 int32_979 = 100979; + int32 int32_980 = 100980; + int32 int32_981 = 100981; + int32 int32_982 = 100982; + int32 int32_983 = 100983; + int32 int32_984 = 100984; + int32 int32_985 = 100985; + int32 int32_986 = 100986; + int32 int32_987 = 100987; + int32 int32_988 = 100988; + int32 int32_989 = 100989; + int32 int32_990 = 100990; + int32 int32_991 = 100991; + int32 int32_992 = 100992; + int32 int32_993 = 100993; + int32 int32_994 = 100994; + int32 int32_995 = 100995; + int32 int32_996 = 100996; + int32 int32_997 = 100997; + int32 int32_998 = 100998; + int32 int32_999 = 100999; + int32 int32_1000 = 101000; + int32 int32_1001 = 101001; + int32 int32_1002 = 101002; + int32 int32_1003 = 101003; + int32 int32_1004 = 101004; + int32 int32_1005 = 101005; + int32 int32_1006 = 101006; + int32 int32_1007 = 101007; + int32 int32_1008 = 101008; + int32 int32_1009 = 101009; + int32 int32_1010 = 101010; + int32 int32_1011 = 101011; + int32 int32_1012 = 101012; + int32 int32_1013 = 101013; + int32 int32_1014 = 101014; + int32 int32_1015 = 101015; + int32 int32_1016 = 101016; + int32 int32_1017 = 101017; + int32 int32_1018 = 101018; + int32 int32_1019 = 101019; + int32 int32_1020 = 101020; + int32 int32_1021 = 101021; + int32 int32_1022 = 101022; + int32 int32_1023 = 101023; + int32 int32_1024 = 101024; + int32 int32_1025 = 101025; + int32 int32_1026 = 101026; + int32 int32_1027 = 101027; + int32 int32_1028 = 101028; + int32 int32_1029 = 101029; + int32 int32_1030 = 101030; + int32 int32_1031 = 101031; + int32 int32_1032 = 101032; + int32 int32_1033 = 101033; + int32 int32_1034 = 101034; + int32 int32_1035 = 101035; + int32 int32_1036 = 101036; + int32 int32_1037 = 101037; + int32 int32_1038 = 101038; + int32 int32_1039 = 101039; + int32 int32_1040 = 101040; + int32 int32_1041 = 101041; + int32 int32_1042 = 101042; + int32 int32_1043 = 101043; + int32 int32_1044 = 101044; + int32 int32_1045 = 101045; + int32 int32_1046 = 101046; + int32 int32_1047 = 101047; + int32 int32_1048 = 101048; + int32 int32_1049 = 101049; + int32 int32_1050 = 101050; + int32 int32_1051 = 101051; + int32 int32_1052 = 101052; + int32 int32_1053 = 101053; + int32 int32_1054 = 101054; + int32 int32_1055 = 101055; + int32 int32_1056 = 101056; + int32 int32_1057 = 101057; + int32 int32_1058 = 101058; + int32 int32_1059 = 101059; + int32 int32_1060 = 101060; + int32 int32_1061 = 101061; + int32 int32_1062 = 101062; + int32 int32_1063 = 101063; + int32 int32_1064 = 101064; + int32 int32_1065 = 101065; + int32 int32_1066 = 101066; + int32 int32_1067 = 101067; + int32 int32_1068 = 101068; + int32 int32_1069 = 101069; + int32 int32_1070 = 101070; + int32 int32_1071 = 101071; + int32 int32_1072 = 101072; + int32 int32_1073 = 101073; + int32 int32_1074 = 101074; + int32 int32_1075 = 101075; + int32 int32_1076 = 101076; + int32 int32_1077 = 101077; + int32 int32_1078 = 101078; + int32 int32_1079 = 101079; + int32 int32_1080 = 101080; + int32 int32_1081 = 101081; + int32 int32_1082 = 101082; + int32 int32_1083 = 101083; + int32 int32_1084 = 101084; + int32 int32_1085 = 101085; + int32 int32_1086 = 101086; + int32 int32_1087 = 101087; + int32 int32_1088 = 101088; + int32 int32_1089 = 101089; + int32 int32_1090 = 101090; + int32 int32_1091 = 101091; + int32 int32_1092 = 101092; + int32 int32_1093 = 101093; + int32 int32_1094 = 101094; + int32 int32_1095 = 101095; + int32 int32_1096 = 101096; + int32 int32_1097 = 101097; + int32 int32_1098 = 101098; + int32 int32_1099 = 101099; + int32 int32_1100 = 101100; + int32 int32_1101 = 101101; + int32 int32_1102 = 101102; + int32 int32_1103 = 101103; + int32 int32_1104 = 101104; + int32 int32_1105 = 101105; + int32 int32_1106 = 101106; + int32 int32_1107 = 101107; + int32 int32_1108 = 101108; + int32 int32_1109 = 101109; + int32 int32_1110 = 101110; + int32 int32_1111 = 101111; + int32 int32_1112 = 101112; + int32 int32_1113 = 101113; + int32 int32_1114 = 101114; + int32 int32_1115 = 101115; + int32 int32_1116 = 101116; + int32 int32_1117 = 101117; + int32 int32_1118 = 101118; + int32 int32_1119 = 101119; + int32 int32_1120 = 101120; + int32 int32_1121 = 101121; + int32 int32_1122 = 101122; + int32 int32_1123 = 101123; + int32 int32_1124 = 101124; + int32 int32_1125 = 101125; + int32 int32_1126 = 101126; + int32 int32_1127 = 101127; + int32 int32_1128 = 101128; + int32 int32_1129 = 101129; + int32 int32_1130 = 101130; + int32 int32_1131 = 101131; + int32 int32_1132 = 101132; + int32 int32_1133 = 101133; + int32 int32_1134 = 101134; + int32 int32_1135 = 101135; + int32 int32_1136 = 101136; + int32 int32_1137 = 101137; + int32 int32_1138 = 101138; + int32 int32_1139 = 101139; + int32 int32_1140 = 101140; + int32 int32_1141 = 101141; + int32 int32_1142 = 101142; + int32 int32_1143 = 101143; + int32 int32_1144 = 101144; + int32 int32_1145 = 101145; + int32 int32_1146 = 101146; + int32 int32_1147 = 101147; + int32 int32_1148 = 101148; + int32 int32_1149 = 101149; + int32 int32_1150 = 101150; + int32 int32_1151 = 101151; + int32 int32_1152 = 101152; + int32 int32_1153 = 101153; + int32 int32_1154 = 101154; + int32 int32_1155 = 101155; + int32 int32_1156 = 101156; + int32 int32_1157 = 101157; + int32 int32_1158 = 101158; + int32 int32_1159 = 101159; + int32 int32_1160 = 101160; + int32 int32_1161 = 101161; + int32 int32_1162 = 101162; + int32 int32_1163 = 101163; + int32 int32_1164 = 101164; + int32 int32_1165 = 101165; + int32 int32_1166 = 101166; + int32 int32_1167 = 101167; + int32 int32_1168 = 101168; + int32 int32_1169 = 101169; + int32 int32_1170 = 101170; + int32 int32_1171 = 101171; + int32 int32_1172 = 101172; + int32 int32_1173 = 101173; + int32 int32_1174 = 101174; + int32 int32_1175 = 101175; + int32 int32_1176 = 101176; + int32 int32_1177 = 101177; + int32 int32_1178 = 101178; + int32 int32_1179 = 101179; + int32 int32_1180 = 101180; + int32 int32_1181 = 101181; + int32 int32_1182 = 101182; + int32 int32_1183 = 101183; + int32 int32_1184 = 101184; + int32 int32_1185 = 101185; + int32 int32_1186 = 101186; + int32 int32_1187 = 101187; + int32 int32_1188 = 101188; + int32 int32_1189 = 101189; + int32 int32_1190 = 101190; + int32 int32_1191 = 101191; + int32 int32_1192 = 101192; + int32 int32_1193 = 101193; + int32 int32_1194 = 101194; + int32 int32_1195 = 101195; + int32 int32_1196 = 101196; + int32 int32_1197 = 101197; + int32 int32_1198 = 101198; + int32 int32_1199 = 101199; + int32 int32_1200 = 101200; + int32 int32_1201 = 101201; + int32 int32_1202 = 101202; + int32 int32_1203 = 101203; + int32 int32_1204 = 101204; + int32 int32_1205 = 101205; + int32 int32_1206 = 101206; + int32 int32_1207 = 101207; + int32 int32_1208 = 101208; + int32 int32_1209 = 101209; + int32 int32_1210 = 101210; + int32 int32_1211 = 101211; + int32 int32_1212 = 101212; + int32 int32_1213 = 101213; + int32 int32_1214 = 101214; + int32 int32_1215 = 101215; + int32 int32_1216 = 101216; + int32 int32_1217 = 101217; + int32 int32_1218 = 101218; + int32 int32_1219 = 101219; + int32 int32_1220 = 101220; + int32 int32_1221 = 101221; + int32 int32_1222 = 101222; + int32 int32_1223 = 101223; + int32 int32_1224 = 101224; + int32 int32_1225 = 101225; + int32 int32_1226 = 101226; + int32 int32_1227 = 101227; + int32 int32_1228 = 101228; + int32 int32_1229 = 101229; + int32 int32_1230 = 101230; + int32 int32_1231 = 101231; + int32 int32_1232 = 101232; + int32 int32_1233 = 101233; + int32 int32_1234 = 101234; + int32 int32_1235 = 101235; + int32 int32_1236 = 101236; + int32 int32_1237 = 101237; + int32 int32_1238 = 101238; + int32 int32_1239 = 101239; + int32 int32_1240 = 101240; + int32 int32_1241 = 101241; + int32 int32_1242 = 101242; + int32 int32_1243 = 101243; + int32 int32_1244 = 101244; + int32 int32_1245 = 101245; + int32 int32_1246 = 101246; + int32 int32_1247 = 101247; + int32 int32_1248 = 101248; + int32 int32_1249 = 101249; + int32 int32_1250 = 101250; + int32 int32_1251 = 101251; + int32 int32_1252 = 101252; + int32 int32_1253 = 101253; + int32 int32_1254 = 101254; + int32 int32_1255 = 101255; + int32 int32_1256 = 101256; + int32 int32_1257 = 101257; + int32 int32_1258 = 101258; + int32 int32_1259 = 101259; + int32 int32_1260 = 101260; + int32 int32_1261 = 101261; + int32 int32_1262 = 101262; + int32 int32_1263 = 101263; + int32 int32_1264 = 101264; + int32 int32_1265 = 101265; + int32 int32_1266 = 101266; + int32 int32_1267 = 101267; + int32 int32_1268 = 101268; + int32 int32_1269 = 101269; + int32 int32_1270 = 101270; + int32 int32_1271 = 101271; + int32 int32_1272 = 101272; + int32 int32_1273 = 101273; + int32 int32_1274 = 101274; + int32 int32_1275 = 101275; + int32 int32_1276 = 101276; + int32 int32_1277 = 101277; + int32 int32_1278 = 101278; + int32 int32_1279 = 101279; + int32 int32_1280 = 101280; + int32 int32_1281 = 101281; + int32 int32_1282 = 101282; + int32 int32_1283 = 101283; + int32 int32_1284 = 101284; + int32 int32_1285 = 101285; + int32 int32_1286 = 101286; + int32 int32_1287 = 101287; + int32 int32_1288 = 101288; + int32 int32_1289 = 101289; + int32 int32_1290 = 101290; + int32 int32_1291 = 101291; + int32 int32_1292 = 101292; + int32 int32_1293 = 101293; + int32 int32_1294 = 101294; + int32 int32_1295 = 101295; + int32 int32_1296 = 101296; + int32 int32_1297 = 101297; + int32 int32_1298 = 101298; + int32 int32_1299 = 101299; + int32 int32_1300 = 101300; + int32 int32_1301 = 101301; + int32 int32_1302 = 101302; + int32 int32_1303 = 101303; + int32 int32_1304 = 101304; + int32 int32_1305 = 101305; + int32 int32_1306 = 101306; + int32 int32_1307 = 101307; + int32 int32_1308 = 101308; + int32 int32_1309 = 101309; + int32 int32_1310 = 101310; + int32 int32_1311 = 101311; + int32 int32_1312 = 101312; + int32 int32_1313 = 101313; + int32 int32_1314 = 101314; + int32 int32_1315 = 101315; + int32 int32_1316 = 101316; + int32 int32_1317 = 101317; + int32 int32_1318 = 101318; + int32 int32_1319 = 101319; + int32 int32_1320 = 101320; + int32 int32_1321 = 101321; + int32 int32_1322 = 101322; + int32 int32_1323 = 101323; + int32 int32_1324 = 101324; + int32 int32_1325 = 101325; + int32 int32_1326 = 101326; + int32 int32_1327 = 101327; + int32 int32_1328 = 101328; + int32 int32_1329 = 101329; + int32 int32_1330 = 101330; + int32 int32_1331 = 101331; + int32 int32_1332 = 101332; + int32 int32_1333 = 101333; + int32 int32_1334 = 101334; + int32 int32_1335 = 101335; + int32 int32_1336 = 101336; + int32 int32_1337 = 101337; + int32 int32_1338 = 101338; + int32 int32_1339 = 101339; + int32 int32_1340 = 101340; + int32 int32_1341 = 101341; + int32 int32_1342 = 101342; + int32 int32_1343 = 101343; + int32 int32_1344 = 101344; + int32 int32_1345 = 101345; + int32 int32_1346 = 101346; + int32 int32_1347 = 101347; + int32 int32_1348 = 101348; + int32 int32_1349 = 101349; + int32 int32_1350 = 101350; + int32 int32_1351 = 101351; + int32 int32_1352 = 101352; + int32 int32_1353 = 101353; + int32 int32_1354 = 101354; + int32 int32_1355 = 101355; + int32 int32_1356 = 101356; + int32 int32_1357 = 101357; + int32 int32_1358 = 101358; + int32 int32_1359 = 101359; + int32 int32_1360 = 101360; + int32 int32_1361 = 101361; + int32 int32_1362 = 101362; + int32 int32_1363 = 101363; + int32 int32_1364 = 101364; + int32 int32_1365 = 101365; + int32 int32_1366 = 101366; + int32 int32_1367 = 101367; + int32 int32_1368 = 101368; + int32 int32_1369 = 101369; + int32 int32_1370 = 101370; + int32 int32_1371 = 101371; + int32 int32_1372 = 101372; + int32 int32_1373 = 101373; + int32 int32_1374 = 101374; + int32 int32_1375 = 101375; + int32 int32_1376 = 101376; + int32 int32_1377 = 101377; + int32 int32_1378 = 101378; + int32 int32_1379 = 101379; + int32 int32_1380 = 101380; + int32 int32_1381 = 101381; + int32 int32_1382 = 101382; + int32 int32_1383 = 101383; + int32 int32_1384 = 101384; + int32 int32_1385 = 101385; + int32 int32_1386 = 101386; + int32 int32_1387 = 101387; + int32 int32_1388 = 101388; + int32 int32_1389 = 101389; + int32 int32_1390 = 101390; + int32 int32_1391 = 101391; + int32 int32_1392 = 101392; + int32 int32_1393 = 101393; + int32 int32_1394 = 101394; + int32 int32_1395 = 101395; + int32 int32_1396 = 101396; + int32 int32_1397 = 101397; + int32 int32_1398 = 101398; + int32 int32_1399 = 101399; + int32 int32_1400 = 101400; + int32 int32_1401 = 101401; + int32 int32_1402 = 101402; + int32 int32_1403 = 101403; + int32 int32_1404 = 101404; + int32 int32_1405 = 101405; + int32 int32_1406 = 101406; + int32 int32_1407 = 101407; + int32 int32_1408 = 101408; + int32 int32_1409 = 101409; + int32 int32_1410 = 101410; + int32 int32_1411 = 101411; + int32 int32_1412 = 101412; + int32 int32_1413 = 101413; + int32 int32_1414 = 101414; + int32 int32_1415 = 101415; + int32 int32_1416 = 101416; + int32 int32_1417 = 101417; + int32 int32_1418 = 101418; + int32 int32_1419 = 101419; + int32 int32_1420 = 101420; + int32 int32_1421 = 101421; + int32 int32_1422 = 101422; + int32 int32_1423 = 101423; + int32 int32_1424 = 101424; + int32 int32_1425 = 101425; + int32 int32_1426 = 101426; + int32 int32_1427 = 101427; + int32 int32_1428 = 101428; + int32 int32_1429 = 101429; + int32 int32_1430 = 101430; + int32 int32_1431 = 101431; + int32 int32_1432 = 101432; + int32 int32_1433 = 101433; + int32 int32_1434 = 101434; + int32 int32_1435 = 101435; + int32 int32_1436 = 101436; + int32 int32_1437 = 101437; + int32 int32_1438 = 101438; + int32 int32_1439 = 101439; + int32 int32_1440 = 101440; + int32 int32_1441 = 101441; + int32 int32_1442 = 101442; + int32 int32_1443 = 101443; + int32 int32_1444 = 101444; + int32 int32_1445 = 101445; + int32 int32_1446 = 101446; + int32 int32_1447 = 101447; + int32 int32_1448 = 101448; + int32 int32_1449 = 101449; + int32 int32_1450 = 101450; + int32 int32_1451 = 101451; + int32 int32_1452 = 101452; + int32 int32_1453 = 101453; + int32 int32_1454 = 101454; + int32 int32_1455 = 101455; + int32 int32_1456 = 101456; + int32 int32_1457 = 101457; + int32 int32_1458 = 101458; + int32 int32_1459 = 101459; + int32 int32_1460 = 101460; + int32 int32_1461 = 101461; + int32 int32_1462 = 101462; + int32 int32_1463 = 101463; + int32 int32_1464 = 101464; + int32 int32_1465 = 101465; + int32 int32_1466 = 101466; + int32 int32_1467 = 101467; + int32 int32_1468 = 101468; + int32 int32_1469 = 101469; + int32 int32_1470 = 101470; + int32 int32_1471 = 101471; + int32 int32_1472 = 101472; + int32 int32_1473 = 101473; + int32 int32_1474 = 101474; + int32 int32_1475 = 101475; + int32 int32_1476 = 101476; + int32 int32_1477 = 101477; + int32 int32_1478 = 101478; + int32 int32_1479 = 101479; + int32 int32_1480 = 101480; + int32 int32_1481 = 101481; + int32 int32_1482 = 101482; + int32 int32_1483 = 101483; + int32 int32_1484 = 101484; + int32 int32_1485 = 101485; + int32 int32_1486 = 101486; + int32 int32_1487 = 101487; + int32 int32_1488 = 101488; + int32 int32_1489 = 101489; + int32 int32_1490 = 101490; + int32 int32_1491 = 101491; + int32 int32_1492 = 101492; + int32 int32_1493 = 101493; + int32 int32_1494 = 101494; + int32 int32_1495 = 101495; + int32 int32_1496 = 101496; + int32 int32_1497 = 101497; + int32 int32_1498 = 101498; + int32 int32_1499 = 101499; + int32 int32_1500 = 101500; + int32 int32_1501 = 101501; + int32 int32_1502 = 101502; + int32 int32_1503 = 101503; + int32 int32_1504 = 101504; + int32 int32_1505 = 101505; + int32 int32_1506 = 101506; + int32 int32_1507 = 101507; + int32 int32_1508 = 101508; + int32 int32_1509 = 101509; + int32 int32_1510 = 101510; + int32 int32_1511 = 101511; + int32 int32_1512 = 101512; + int32 int32_1513 = 101513; + int32 int32_1514 = 101514; + int32 int32_1515 = 101515; + int32 int32_1516 = 101516; + int32 int32_1517 = 101517; + int32 int32_1518 = 101518; + int32 int32_1519 = 101519; + int32 int32_1520 = 101520; + int32 int32_1521 = 101521; + int32 int32_1522 = 101522; + int32 int32_1523 = 101523; + int32 int32_1524 = 101524; + int32 int32_1525 = 101525; + int32 int32_1526 = 101526; + int32 int32_1527 = 101527; + int32 int32_1528 = 101528; + int32 int32_1529 = 101529; + int32 int32_1530 = 101530; + int32 int32_1531 = 101531; + int32 int32_1532 = 101532; + int32 int32_1533 = 101533; + int32 int32_1534 = 101534; + int32 int32_1535 = 101535; + int32 int32_1536 = 101536; + int32 int32_1537 = 101537; + int32 int32_1538 = 101538; + int32 int32_1539 = 101539; + int32 int32_1540 = 101540; + int32 int32_1541 = 101541; + int32 int32_1542 = 101542; + int32 int32_1543 = 101543; + int32 int32_1544 = 101544; + int32 int32_1545 = 101545; + int32 int32_1546 = 101546; + int32 int32_1547 = 101547; + int32 int32_1548 = 101548; + int32 int32_1549 = 101549; + int32 int32_1550 = 101550; + int32 int32_1551 = 101551; + int32 int32_1552 = 101552; + int32 int32_1553 = 101553; + int32 int32_1554 = 101554; + int32 int32_1555 = 101555; + int32 int32_1556 = 101556; + int32 int32_1557 = 101557; + int32 int32_1558 = 101558; + int32 int32_1559 = 101559; + int32 int32_1560 = 101560; + int32 int32_1561 = 101561; + int32 int32_1562 = 101562; + int32 int32_1563 = 101563; + int32 int32_1564 = 101564; + int32 int32_1565 = 101565; + int32 int32_1566 = 101566; + int32 int32_1567 = 101567; + int32 int32_1568 = 101568; + int32 int32_1569 = 101569; + int32 int32_1570 = 101570; + int32 int32_1571 = 101571; + int32 int32_1572 = 101572; + int32 int32_1573 = 101573; + int32 int32_1574 = 101574; + int32 int32_1575 = 101575; + int32 int32_1576 = 101576; + int32 int32_1577 = 101577; + int32 int32_1578 = 101578; + int32 int32_1579 = 101579; + int32 int32_1580 = 101580; + int32 int32_1581 = 101581; + int32 int32_1582 = 101582; + int32 int32_1583 = 101583; + int32 int32_1584 = 101584; + int32 int32_1585 = 101585; + int32 int32_1586 = 101586; + int32 int32_1587 = 101587; + int32 int32_1588 = 101588; + int32 int32_1589 = 101589; + int32 int32_1590 = 101590; + int32 int32_1591 = 101591; + int32 int32_1592 = 101592; + int32 int32_1593 = 101593; + int32 int32_1594 = 101594; + int32 int32_1595 = 101595; + int32 int32_1596 = 101596; + int32 int32_1597 = 101597; + int32 int32_1598 = 101598; + int32 int32_1599 = 101599; + int32 int32_1600 = 101600; + int32 int32_1601 = 101601; + int32 int32_1602 = 101602; + int32 int32_1603 = 101603; + int32 int32_1604 = 101604; + int32 int32_1605 = 101605; + int32 int32_1606 = 101606; + int32 int32_1607 = 101607; + int32 int32_1608 = 101608; + int32 int32_1609 = 101609; + int32 int32_1610 = 101610; + int32 int32_1611 = 101611; + int32 int32_1612 = 101612; + int32 int32_1613 = 101613; + int32 int32_1614 = 101614; + int32 int32_1615 = 101615; + int32 int32_1616 = 101616; + int32 int32_1617 = 101617; + int32 int32_1618 = 101618; + int32 int32_1619 = 101619; + int32 int32_1620 = 101620; + int32 int32_1621 = 101621; + int32 int32_1622 = 101622; + int32 int32_1623 = 101623; + int32 int32_1624 = 101624; + int32 int32_1625 = 101625; + int32 int32_1626 = 101626; + int32 int32_1627 = 101627; + int32 int32_1628 = 101628; + int32 int32_1629 = 101629; + int32 int32_1630 = 101630; + int32 int32_1631 = 101631; + int32 int32_1632 = 101632; + int32 int32_1633 = 101633; + int32 int32_1634 = 101634; + int32 int32_1635 = 101635; + int32 int32_1636 = 101636; + int32 int32_1637 = 101637; + int32 int32_1638 = 101638; + int32 int32_1639 = 101639; + int32 int32_1640 = 101640; + int32 int32_1641 = 101641; + int32 int32_1642 = 101642; + int32 int32_1643 = 101643; + int32 int32_1644 = 101644; + int32 int32_1645 = 101645; + int32 int32_1646 = 101646; + int32 int32_1647 = 101647; + int32 int32_1648 = 101648; + int32 int32_1649 = 101649; + int32 int32_1650 = 101650; + int32 int32_1651 = 101651; + int32 int32_1652 = 101652; + int32 int32_1653 = 101653; + int32 int32_1654 = 101654; + int32 int32_1655 = 101655; + int32 int32_1656 = 101656; + int32 int32_1657 = 101657; + int32 int32_1658 = 101658; + int32 int32_1659 = 101659; + int32 int32_1660 = 101660; + int32 int32_1661 = 101661; + int32 int32_1662 = 101662; + int32 int32_1663 = 101663; + int32 int32_1664 = 101664; + int32 int32_1665 = 101665; + int32 int32_1666 = 101666; + int32 int32_1667 = 101667; + int32 int32_1668 = 101668; + int32 int32_1669 = 101669; + int32 int32_1670 = 101670; + int32 int32_1671 = 101671; + int32 int32_1672 = 101672; + int32 int32_1673 = 101673; + int32 int32_1674 = 101674; + int32 int32_1675 = 101675; + int32 int32_1676 = 101676; + int32 int32_1677 = 101677; + int32 int32_1678 = 101678; + int32 int32_1679 = 101679; + int32 int32_1680 = 101680; + int32 int32_1681 = 101681; + int32 int32_1682 = 101682; + int32 int32_1683 = 101683; + int32 int32_1684 = 101684; + int32 int32_1685 = 101685; + int32 int32_1686 = 101686; + int32 int32_1687 = 101687; + int32 int32_1688 = 101688; + int32 int32_1689 = 101689; + int32 int32_1690 = 101690; + int32 int32_1691 = 101691; + int32 int32_1692 = 101692; + int32 int32_1693 = 101693; + int32 int32_1694 = 101694; + int32 int32_1695 = 101695; + int32 int32_1696 = 101696; + int32 int32_1697 = 101697; + int32 int32_1698 = 101698; + int32 int32_1699 = 101699; + int32 int32_1700 = 101700; + int32 int32_1701 = 101701; + int32 int32_1702 = 101702; + int32 int32_1703 = 101703; + int32 int32_1704 = 101704; + int32 int32_1705 = 101705; + int32 int32_1706 = 101706; + int32 int32_1707 = 101707; + int32 int32_1708 = 101708; + int32 int32_1709 = 101709; + int32 int32_1710 = 101710; + int32 int32_1711 = 101711; + int32 int32_1712 = 101712; + int32 int32_1713 = 101713; + int32 int32_1714 = 101714; + int32 int32_1715 = 101715; + int32 int32_1716 = 101716; + int32 int32_1717 = 101717; + int32 int32_1718 = 101718; + int32 int32_1719 = 101719; + int32 int32_1720 = 101720; + int32 int32_1721 = 101721; + int32 int32_1722 = 101722; + int32 int32_1723 = 101723; + int32 int32_1724 = 101724; + int32 int32_1725 = 101725; + int32 int32_1726 = 101726; + int32 int32_1727 = 101727; + int32 int32_1728 = 101728; + int32 int32_1729 = 101729; + int32 int32_1730 = 101730; + int32 int32_1731 = 101731; + int32 int32_1732 = 101732; + int32 int32_1733 = 101733; + int32 int32_1734 = 101734; + int32 int32_1735 = 101735; + int32 int32_1736 = 101736; + int32 int32_1737 = 101737; + int32 int32_1738 = 101738; + int32 int32_1739 = 101739; + int32 int32_1740 = 101740; + int32 int32_1741 = 101741; + int32 int32_1742 = 101742; + int32 int32_1743 = 101743; + int32 int32_1744 = 101744; + int32 int32_1745 = 101745; + int32 int32_1746 = 101746; + int32 int32_1747 = 101747; + int32 int32_1748 = 101748; + int32 int32_1749 = 101749; + int32 int32_1750 = 101750; + int32 int32_1751 = 101751; + int32 int32_1752 = 101752; + int32 int32_1753 = 101753; + int32 int32_1754 = 101754; + int32 int32_1755 = 101755; + int32 int32_1756 = 101756; + int32 int32_1757 = 101757; + int32 int32_1758 = 101758; + int32 int32_1759 = 101759; + int32 int32_1760 = 101760; + int32 int32_1761 = 101761; + int32 int32_1762 = 101762; + int32 int32_1763 = 101763; + int32 int32_1764 = 101764; + int32 int32_1765 = 101765; + int32 int32_1766 = 101766; + int32 int32_1767 = 101767; + int32 int32_1768 = 101768; + int32 int32_1769 = 101769; + int32 int32_1770 = 101770; + int32 int32_1771 = 101771; + int32 int32_1772 = 101772; + int32 int32_1773 = 101773; + int32 int32_1774 = 101774; + int32 int32_1775 = 101775; + int32 int32_1776 = 101776; + int32 int32_1777 = 101777; + int32 int32_1778 = 101778; + int32 int32_1779 = 101779; + int32 int32_1780 = 101780; + int32 int32_1781 = 101781; + int32 int32_1782 = 101782; + int32 int32_1783 = 101783; + int32 int32_1784 = 101784; + int32 int32_1785 = 101785; + int32 int32_1786 = 101786; + int32 int32_1787 = 101787; + int32 int32_1788 = 101788; + int32 int32_1789 = 101789; + int32 int32_1790 = 101790; + int32 int32_1791 = 101791; + int32 int32_1792 = 101792; + int32 int32_1793 = 101793; + int32 int32_1794 = 101794; + int32 int32_1795 = 101795; + int32 int32_1796 = 101796; + int32 int32_1797 = 101797; + int32 int32_1798 = 101798; + int32 int32_1799 = 101799; + int32 int32_1800 = 101800; + int32 int32_1801 = 101801; + int32 int32_1802 = 101802; + int32 int32_1803 = 101803; + int32 int32_1804 = 101804; + int32 int32_1805 = 101805; + int32 int32_1806 = 101806; + int32 int32_1807 = 101807; + int32 int32_1808 = 101808; + int32 int32_1809 = 101809; + int32 int32_1810 = 101810; + int32 int32_1811 = 101811; + int32 int32_1812 = 101812; + int32 int32_1813 = 101813; + int32 int32_1814 = 101814; + int32 int32_1815 = 101815; + int32 int32_1816 = 101816; + int32 int32_1817 = 101817; + int32 int32_1818 = 101818; + int32 int32_1819 = 101819; + int32 int32_1820 = 101820; + int32 int32_1821 = 101821; + int32 int32_1822 = 101822; + int32 int32_1823 = 101823; + int32 int32_1824 = 101824; + int32 int32_1825 = 101825; + int32 int32_1826 = 101826; + int32 int32_1827 = 101827; + int32 int32_1828 = 101828; + int32 int32_1829 = 101829; + int32 int32_1830 = 101830; + int32 int32_1831 = 101831; + int32 int32_1832 = 101832; + int32 int32_1833 = 101833; + int32 int32_1834 = 101834; + int32 int32_1835 = 101835; + int32 int32_1836 = 101836; + int32 int32_1837 = 101837; + int32 int32_1838 = 101838; + int32 int32_1839 = 101839; + int32 int32_1840 = 101840; + int32 int32_1841 = 101841; + int32 int32_1842 = 101842; + int32 int32_1843 = 101843; + int32 int32_1844 = 101844; + int32 int32_1845 = 101845; + int32 int32_1846 = 101846; + int32 int32_1847 = 101847; + int32 int32_1848 = 101848; + int32 int32_1849 = 101849; + int32 int32_1850 = 101850; + int32 int32_1851 = 101851; + int32 int32_1852 = 101852; + int32 int32_1853 = 101853; + int32 int32_1854 = 101854; + int32 int32_1855 = 101855; + int32 int32_1856 = 101856; + int32 int32_1857 = 101857; + int32 int32_1858 = 101858; + int32 int32_1859 = 101859; + int32 int32_1860 = 101860; + int32 int32_1861 = 101861; + int32 int32_1862 = 101862; + int32 int32_1863 = 101863; + int32 int32_1864 = 101864; + int32 int32_1865 = 101865; + int32 int32_1866 = 101866; + int32 int32_1867 = 101867; + int32 int32_1868 = 101868; + int32 int32_1869 = 101869; + int32 int32_1870 = 101870; + int32 int32_1871 = 101871; + int32 int32_1872 = 101872; + int32 int32_1873 = 101873; + int32 int32_1874 = 101874; + int32 int32_1875 = 101875; + int32 int32_1876 = 101876; + int32 int32_1877 = 101877; + int32 int32_1878 = 101878; + int32 int32_1879 = 101879; + int32 int32_1880 = 101880; + int32 int32_1881 = 101881; + int32 int32_1882 = 101882; + int32 int32_1883 = 101883; + int32 int32_1884 = 101884; + int32 int32_1885 = 101885; + int32 int32_1886 = 101886; + int32 int32_1887 = 101887; + int32 int32_1888 = 101888; + int32 int32_1889 = 101889; + int32 int32_1890 = 101890; + int32 int32_1891 = 101891; + int32 int32_1892 = 101892; + int32 int32_1893 = 101893; + int32 int32_1894 = 101894; + int32 int32_1895 = 101895; + int32 int32_1896 = 101896; + int32 int32_1897 = 101897; + int32 int32_1898 = 101898; + int32 int32_1899 = 101899; + int32 int32_1900 = 101900; + int32 int32_1901 = 101901; + int32 int32_1902 = 101902; + int32 int32_1903 = 101903; + int32 int32_1904 = 101904; + int32 int32_1905 = 101905; + int32 int32_1906 = 101906; + int32 int32_1907 = 101907; + int32 int32_1908 = 101908; + int32 int32_1909 = 101909; + int32 int32_1910 = 101910; + int32 int32_1911 = 101911; + int32 int32_1912 = 101912; + int32 int32_1913 = 101913; + int32 int32_1914 = 101914; + int32 int32_1915 = 101915; + int32 int32_1916 = 101916; + int32 int32_1917 = 101917; + int32 int32_1918 = 101918; + int32 int32_1919 = 101919; + int32 int32_1920 = 101920; + int32 int32_1921 = 101921; + int32 int32_1922 = 101922; + int32 int32_1923 = 101923; + int32 int32_1924 = 101924; + int32 int32_1925 = 101925; + int32 int32_1926 = 101926; + int32 int32_1927 = 101927; + int32 int32_1928 = 101928; + int32 int32_1929 = 101929; + int32 int32_1930 = 101930; + int32 int32_1931 = 101931; + int32 int32_1932 = 101932; + int32 int32_1933 = 101933; + int32 int32_1934 = 101934; + int32 int32_1935 = 101935; + int32 int32_1936 = 101936; + int32 int32_1937 = 101937; + int32 int32_1938 = 101938; + int32 int32_1939 = 101939; + int32 int32_1940 = 101940; + int32 int32_1941 = 101941; + int32 int32_1942 = 101942; + int32 int32_1943 = 101943; + int32 int32_1944 = 101944; + int32 int32_1945 = 101945; + int32 int32_1946 = 101946; + int32 int32_1947 = 101947; + int32 int32_1948 = 101948; + int32 int32_1949 = 101949; + int32 int32_1950 = 101950; + int32 int32_1951 = 101951; + int32 int32_1952 = 101952; + int32 int32_1953 = 101953; + int32 int32_1954 = 101954; + int32 int32_1955 = 101955; + int32 int32_1956 = 101956; + int32 int32_1957 = 101957; + int32 int32_1958 = 101958; + int32 int32_1959 = 101959; + int32 int32_1960 = 101960; + int32 int32_1961 = 101961; + int32 int32_1962 = 101962; + int32 int32_1963 = 101963; + int32 int32_1964 = 101964; + int32 int32_1965 = 101965; + int32 int32_1966 = 101966; + int32 int32_1967 = 101967; + int32 int32_1968 = 101968; + int32 int32_1969 = 101969; + int32 int32_1970 = 101970; + int32 int32_1971 = 101971; + int32 int32_1972 = 101972; + int32 int32_1973 = 101973; + int32 int32_1974 = 101974; + int32 int32_1975 = 101975; + int32 int32_1976 = 101976; + int32 int32_1977 = 101977; + int32 int32_1978 = 101978; + int32 int32_1979 = 101979; + int32 int32_1980 = 101980; + int32 int32_1981 = 101981; + int32 int32_1982 = 101982; + int32 int32_1983 = 101983; + int32 int32_1984 = 101984; + int32 int32_1985 = 101985; + int32 int32_1986 = 101986; + int32 int32_1987 = 101987; + int32 int32_1988 = 101988; + int32 int32_1989 = 101989; + int32 int32_1990 = 101990; + int32 int32_1991 = 101991; + int32 int32_1992 = 101992; + int32 int32_1993 = 101993; + int32 int32_1994 = 101994; + int32 int32_1995 = 101995; + int32 int32_1996 = 101996; + int32 int32_1997 = 101997; + int32 int32_1998 = 101998; + int32 int32_1999 = 101999; + int32 int32_2000 = 102000; + int32 int32_2001 = 102001; + int32 int32_2002 = 102002; + int32 int32_2003 = 102003; + int32 int32_2004 = 102004; + int32 int32_2005 = 102005; + int32 int32_2006 = 102006; + int32 int32_2007 = 102007; + int32 int32_2008 = 102008; + int32 int32_2009 = 102009; + int32 int32_2010 = 102010; + int32 int32_2011 = 102011; + int32 int32_2012 = 102012; + int32 int32_2013 = 102013; + int32 int32_2014 = 102014; + int32 int32_2015 = 102015; + int32 int32_2016 = 102016; + int32 int32_2017 = 102017; + int32 int32_2018 = 102018; + int32 int32_2019 = 102019; + int32 int32_2020 = 102020; + int32 int32_2021 = 102021; + int32 int32_2022 = 102022; + int32 int32_2023 = 102023; + int32 int32_2024 = 102024; + int32 int32_2025 = 102025; + int32 int32_2026 = 102026; + int32 int32_2027 = 102027; + int32 int32_2028 = 102028; + int32 int32_2029 = 102029; + int32 int32_2030 = 102030; + int32 int32_2031 = 102031; + int32 int32_2032 = 102032; + int32 int32_2033 = 102033; + int32 int32_2034 = 102034; + int32 int32_2035 = 102035; + int32 int32_2036 = 102036; + int32 int32_2037 = 102037; + int32 int32_2038 = 102038; + int32 int32_2039 = 102039; + int32 int32_2040 = 102040; + int32 int32_2041 = 102041; + int32 int32_2042 = 102042; + int32 int32_2043 = 102043; + int32 int32_2044 = 102044; + int32 int32_2045 = 102045; + int32 int32_2046 = 102046; + int32 int32_2047 = 102047; + int32 int32_2048 = 102048; + int32 int32_2049 = 102049; + int32 int32_2050 = 102050; + int32 int32_2051 = 102051; + int32 int32_2052 = 102052; + int32 int32_2053 = 102053; + int32 int32_2054 = 102054; + int32 int32_2055 = 102055; + int32 int32_2056 = 102056; + int32 int32_2057 = 102057; + int32 int32_2058 = 102058; + int32 int32_2059 = 102059; + int32 int32_2060 = 102060; + int32 int32_2061 = 102061; + int32 int32_2062 = 102062; + int32 int32_2063 = 102063; + int32 int32_2064 = 102064; + int32 int32_2065 = 102065; + int32 int32_2066 = 102066; + int32 int32_2067 = 102067; + int32 int32_2068 = 102068; + int32 int32_2069 = 102069; + int32 int32_2070 = 102070; + int32 int32_2071 = 102071; + int32 int32_2072 = 102072; + int32 int32_2073 = 102073; + int32 int32_2074 = 102074; + int32 int32_2075 = 102075; + int32 int32_2076 = 102076; + int32 int32_2077 = 102077; + int32 int32_2078 = 102078; + int32 int32_2079 = 102079; + int32 int32_2080 = 102080; + int32 int32_2081 = 102081; + int32 int32_2082 = 102082; + int32 int32_2083 = 102083; + int32 int32_2084 = 102084; + int32 int32_2085 = 102085; + int32 int32_2086 = 102086; + int32 int32_2087 = 102087; + int32 int32_2088 = 102088; + int32 int32_2089 = 102089; + int32 int32_2090 = 102090; + int32 int32_2091 = 102091; + int32 int32_2092 = 102092; + int32 int32_2093 = 102093; + int32 int32_2094 = 102094; + int32 int32_2095 = 102095; + int32 int32_2096 = 102096; + int32 int32_2097 = 102097; + int32 int32_2098 = 102098; + int32 int32_2099 = 102099; + int32 int32_2100 = 102100; + int32 int32_2101 = 102101; + int32 int32_2102 = 102102; + int32 int32_2103 = 102103; + int32 int32_2104 = 102104; + int32 int32_2105 = 102105; + int32 int32_2106 = 102106; + int32 int32_2107 = 102107; + int32 int32_2108 = 102108; + int32 int32_2109 = 102109; + int32 int32_2110 = 102110; + int32 int32_2111 = 102111; + int32 int32_2112 = 102112; + int32 int32_2113 = 102113; + int32 int32_2114 = 102114; + int32 int32_2115 = 102115; + int32 int32_2116 = 102116; + int32 int32_2117 = 102117; + int32 int32_2118 = 102118; + int32 int32_2119 = 102119; + int32 int32_2120 = 102120; + int32 int32_2121 = 102121; + int32 int32_2122 = 102122; + int32 int32_2123 = 102123; + int32 int32_2124 = 102124; + int32 int32_2125 = 102125; + int32 int32_2126 = 102126; + int32 int32_2127 = 102127; + int32 int32_2128 = 102128; + int32 int32_2129 = 102129; + int32 int32_2130 = 102130; + int32 int32_2131 = 102131; + int32 int32_2132 = 102132; + int32 int32_2133 = 102133; + int32 int32_2134 = 102134; + int32 int32_2135 = 102135; + int32 int32_2136 = 102136; + int32 int32_2137 = 102137; + int32 int32_2138 = 102138; + int32 int32_2139 = 102139; + int32 int32_2140 = 102140; + int32 int32_2141 = 102141; + int32 int32_2142 = 102142; + int32 int32_2143 = 102143; + int32 int32_2144 = 102144; + int32 int32_2145 = 102145; + int32 int32_2146 = 102146; + int32 int32_2147 = 102147; + int32 int32_2148 = 102148; + int32 int32_2149 = 102149; + int32 int32_2150 = 102150; + int32 int32_2151 = 102151; + int32 int32_2152 = 102152; + int32 int32_2153 = 102153; + int32 int32_2154 = 102154; + int32 int32_2155 = 102155; + int32 int32_2156 = 102156; + int32 int32_2157 = 102157; + int32 int32_2158 = 102158; + int32 int32_2159 = 102159; + int32 int32_2160 = 102160; + int32 int32_2161 = 102161; + int32 int32_2162 = 102162; + int32 int32_2163 = 102163; + int32 int32_2164 = 102164; + int32 int32_2165 = 102165; + int32 int32_2166 = 102166; + int32 int32_2167 = 102167; + int32 int32_2168 = 102168; + int32 int32_2169 = 102169; + int32 int32_2170 = 102170; + int32 int32_2171 = 102171; + int32 int32_2172 = 102172; + int32 int32_2173 = 102173; + int32 int32_2174 = 102174; + int32 int32_2175 = 102175; + int32 int32_2176 = 102176; + int32 int32_2177 = 102177; + int32 int32_2178 = 102178; + int32 int32_2179 = 102179; + int32 int32_2180 = 102180; + int32 int32_2181 = 102181; + int32 int32_2182 = 102182; + int32 int32_2183 = 102183; + int32 int32_2184 = 102184; + int32 int32_2185 = 102185; + int32 int32_2186 = 102186; + int32 int32_2187 = 102187; + int32 int32_2188 = 102188; + int32 int32_2189 = 102189; + int32 int32_2190 = 102190; + int32 int32_2191 = 102191; + int32 int32_2192 = 102192; + int32 int32_2193 = 102193; + int32 int32_2194 = 102194; + int32 int32_2195 = 102195; + int32 int32_2196 = 102196; + int32 int32_2197 = 102197; + int32 int32_2198 = 102198; + int32 int32_2199 = 102199; + int32 int32_2200 = 102200; + int32 int32_2201 = 102201; + int32 int32_2202 = 102202; + int32 int32_2203 = 102203; + int32 int32_2204 = 102204; + int32 int32_2205 = 102205; + int32 int32_2206 = 102206; + int32 int32_2207 = 102207; + int32 int32_2208 = 102208; + int32 int32_2209 = 102209; + int32 int32_2210 = 102210; + int32 int32_2211 = 102211; + int32 int32_2212 = 102212; + int32 int32_2213 = 102213; + int32 int32_2214 = 102214; + int32 int32_2215 = 102215; + int32 int32_2216 = 102216; + int32 int32_2217 = 102217; + int32 int32_2218 = 102218; + int32 int32_2219 = 102219; + int32 int32_2220 = 102220; + int32 int32_2221 = 102221; + int32 int32_2222 = 102222; + int32 int32_2223 = 102223; + int32 int32_2224 = 102224; + int32 int32_2225 = 102225; + int32 int32_2226 = 102226; + int32 int32_2227 = 102227; + int32 int32_2228 = 102228; + int32 int32_2229 = 102229; + int32 int32_2230 = 102230; + int32 int32_2231 = 102231; + int32 int32_2232 = 102232; + int32 int32_2233 = 102233; + int32 int32_2234 = 102234; + int32 int32_2235 = 102235; + int32 int32_2236 = 102236; + int32 int32_2237 = 102237; + int32 int32_2238 = 102238; + int32 int32_2239 = 102239; + int32 int32_2240 = 102240; + int32 int32_2241 = 102241; + int32 int32_2242 = 102242; + int32 int32_2243 = 102243; + int32 int32_2244 = 102244; + int32 int32_2245 = 102245; + int32 int32_2246 = 102246; + int32 int32_2247 = 102247; + int32 int32_2248 = 102248; + int32 int32_2249 = 102249; + int32 int32_2250 = 102250; + int32 int32_2251 = 102251; + int32 int32_2252 = 102252; + int32 int32_2253 = 102253; + int32 int32_2254 = 102254; + int32 int32_2255 = 102255; + int32 int32_2256 = 102256; + int32 int32_2257 = 102257; + int32 int32_2258 = 102258; + int32 int32_2259 = 102259; + int32 int32_2260 = 102260; + int32 int32_2261 = 102261; + int32 int32_2262 = 102262; + int32 int32_2263 = 102263; + int32 int32_2264 = 102264; + int32 int32_2265 = 102265; + int32 int32_2266 = 102266; + int32 int32_2267 = 102267; + int32 int32_2268 = 102268; + int32 int32_2269 = 102269; + int32 int32_2270 = 102270; + int32 int32_2271 = 102271; + int32 int32_2272 = 102272; + int32 int32_2273 = 102273; + int32 int32_2274 = 102274; + int32 int32_2275 = 102275; + int32 int32_2276 = 102276; + int32 int32_2277 = 102277; + int32 int32_2278 = 102278; + int32 int32_2279 = 102279; + int32 int32_2280 = 102280; + int32 int32_2281 = 102281; + int32 int32_2282 = 102282; + int32 int32_2283 = 102283; + int32 int32_2284 = 102284; + int32 int32_2285 = 102285; + int32 int32_2286 = 102286; + int32 int32_2287 = 102287; + int32 int32_2288 = 102288; + int32 int32_2289 = 102289; + int32 int32_2290 = 102290; + int32 int32_2291 = 102291; + int32 int32_2292 = 102292; + int32 int32_2293 = 102293; + int32 int32_2294 = 102294; + int32 int32_2295 = 102295; + int32 int32_2296 = 102296; + int32 int32_2297 = 102297; + int32 int32_2298 = 102298; + int32 int32_2299 = 102299; + int32 int32_2300 = 102300; + int32 int32_2301 = 102301; + int32 int32_2302 = 102302; + int32 int32_2303 = 102303; + int32 int32_2304 = 102304; + int32 int32_2305 = 102305; + int32 int32_2306 = 102306; + int32 int32_2307 = 102307; + int32 int32_2308 = 102308; + int32 int32_2309 = 102309; + int32 int32_2310 = 102310; + int32 int32_2311 = 102311; + int32 int32_2312 = 102312; + int32 int32_2313 = 102313; + int32 int32_2314 = 102314; + int32 int32_2315 = 102315; + int32 int32_2316 = 102316; + int32 int32_2317 = 102317; + int32 int32_2318 = 102318; + int32 int32_2319 = 102319; + int32 int32_2320 = 102320; + int32 int32_2321 = 102321; + int32 int32_2322 = 102322; + int32 int32_2323 = 102323; + int32 int32_2324 = 102324; + int32 int32_2325 = 102325; + int32 int32_2326 = 102326; + int32 int32_2327 = 102327; + int32 int32_2328 = 102328; + int32 int32_2329 = 102329; + int32 int32_2330 = 102330; + int32 int32_2331 = 102331; + int32 int32_2332 = 102332; + int32 int32_2333 = 102333; + int32 int32_2334 = 102334; + int32 int32_2335 = 102335; + int32 int32_2336 = 102336; + int32 int32_2337 = 102337; + int32 int32_2338 = 102338; + int32 int32_2339 = 102339; + int32 int32_2340 = 102340; + int32 int32_2341 = 102341; + int32 int32_2342 = 102342; + int32 int32_2343 = 102343; + int32 int32_2344 = 102344; + int32 int32_2345 = 102345; + int32 int32_2346 = 102346; + int32 int32_2347 = 102347; + int32 int32_2348 = 102348; + int32 int32_2349 = 102349; + int32 int32_2350 = 102350; + int32 int32_2351 = 102351; + int32 int32_2352 = 102352; + int32 int32_2353 = 102353; + int32 int32_2354 = 102354; + int32 int32_2355 = 102355; + int32 int32_2356 = 102356; + int32 int32_2357 = 102357; + int32 int32_2358 = 102358; + int32 int32_2359 = 102359; + int32 int32_2360 = 102360; + int32 int32_2361 = 102361; + int32 int32_2362 = 102362; + int32 int32_2363 = 102363; + int32 int32_2364 = 102364; + int32 int32_2365 = 102365; + int32 int32_2366 = 102366; + int32 int32_2367 = 102367; + int32 int32_2368 = 102368; + int32 int32_2369 = 102369; + int32 int32_2370 = 102370; + int32 int32_2371 = 102371; + int32 int32_2372 = 102372; + int32 int32_2373 = 102373; + int32 int32_2374 = 102374; + int32 int32_2375 = 102375; + int32 int32_2376 = 102376; + int32 int32_2377 = 102377; + int32 int32_2378 = 102378; + int32 int32_2379 = 102379; + int32 int32_2380 = 102380; + int32 int32_2381 = 102381; + int32 int32_2382 = 102382; + int32 int32_2383 = 102383; + int32 int32_2384 = 102384; + int32 int32_2385 = 102385; + int32 int32_2386 = 102386; + int32 int32_2387 = 102387; + int32 int32_2388 = 102388; + int32 int32_2389 = 102389; + int32 int32_2390 = 102390; + int32 int32_2391 = 102391; + int32 int32_2392 = 102392; + int32 int32_2393 = 102393; + int32 int32_2394 = 102394; + int32 int32_2395 = 102395; + int32 int32_2396 = 102396; + int32 int32_2397 = 102397; + int32 int32_2398 = 102398; + int32 int32_2399 = 102399; + int32 int32_2400 = 102400; + int32 int32_2401 = 102401; + int32 int32_2402 = 102402; + int32 int32_2403 = 102403; + int32 int32_2404 = 102404; + int32 int32_2405 = 102405; + int32 int32_2406 = 102406; + int32 int32_2407 = 102407; + int32 int32_2408 = 102408; + int32 int32_2409 = 102409; + int32 int32_2410 = 102410; + int32 int32_2411 = 102411; + int32 int32_2412 = 102412; + int32 int32_2413 = 102413; + int32 int32_2414 = 102414; + int32 int32_2415 = 102415; + int32 int32_2416 = 102416; + int32 int32_2417 = 102417; + int32 int32_2418 = 102418; + int32 int32_2419 = 102419; + int32 int32_2420 = 102420; + int32 int32_2421 = 102421; + int32 int32_2422 = 102422; + int32 int32_2423 = 102423; + int32 int32_2424 = 102424; + int32 int32_2425 = 102425; + int32 int32_2426 = 102426; + int32 int32_2427 = 102427; + int32 int32_2428 = 102428; + int32 int32_2429 = 102429; + int32 int32_2430 = 102430; + int32 int32_2431 = 102431; + int32 int32_2432 = 102432; + int32 int32_2433 = 102433; + int32 int32_2434 = 102434; + int32 int32_2435 = 102435; + int32 int32_2436 = 102436; + int32 int32_2437 = 102437; + int32 int32_2438 = 102438; + int32 int32_2439 = 102439; + int32 int32_2440 = 102440; + int32 int32_2441 = 102441; + int32 int32_2442 = 102442; + int32 int32_2443 = 102443; + int32 int32_2444 = 102444; + int32 int32_2445 = 102445; + int32 int32_2446 = 102446; + int32 int32_2447 = 102447; + int32 int32_2448 = 102448; + int32 int32_2449 = 102449; + int32 int32_2450 = 102450; + int32 int32_2451 = 102451; + int32 int32_2452 = 102452; + int32 int32_2453 = 102453; + int32 int32_2454 = 102454; + int32 int32_2455 = 102455; + int32 int32_2456 = 102456; + int32 int32_2457 = 102457; + int32 int32_2458 = 102458; + int32 int32_2459 = 102459; + int32 int32_2460 = 102460; + int32 int32_2461 = 102461; + int32 int32_2462 = 102462; + int32 int32_2463 = 102463; + int32 int32_2464 = 102464; + int32 int32_2465 = 102465; + int32 int32_2466 = 102466; + int32 int32_2467 = 102467; + int32 int32_2468 = 102468; + int32 int32_2469 = 102469; + int32 int32_2470 = 102470; + int32 int32_2471 = 102471; + int32 int32_2472 = 102472; + int32 int32_2473 = 102473; + int32 int32_2474 = 102474; + int32 int32_2475 = 102475; + int32 int32_2476 = 102476; + int32 int32_2477 = 102477; + int32 int32_2478 = 102478; + int32 int32_2479 = 102479; + int32 int32_2480 = 102480; + int32 int32_2481 = 102481; + int32 int32_2482 = 102482; + int32 int32_2483 = 102483; + int32 int32_2484 = 102484; + int32 int32_2485 = 102485; + int32 int32_2486 = 102486; + int32 int32_2487 = 102487; + int32 int32_2488 = 102488; + int32 int32_2489 = 102489; + int32 int32_2490 = 102490; + int32 int32_2491 = 102491; + int32 int32_2492 = 102492; + int32 int32_2493 = 102493; + int32 int32_2494 = 102494; + int32 int32_2495 = 102495; + int32 int32_2496 = 102496; + int32 int32_2497 = 102497; + int32 int32_2498 = 102498; + int32 int32_2499 = 102499; + int32 int32_2500 = 102500; + int32 int32_2501 = 102501; + int32 int32_2502 = 102502; + int32 int32_2503 = 102503; + int32 int32_2504 = 102504; + int32 int32_2505 = 102505; + int32 int32_2506 = 102506; + int32 int32_2507 = 102507; + int32 int32_2508 = 102508; + int32 int32_2509 = 102509; + int32 int32_2510 = 102510; + int32 int32_2511 = 102511; + int32 int32_2512 = 102512; + int32 int32_2513 = 102513; + int32 int32_2514 = 102514; + int32 int32_2515 = 102515; + int32 int32_2516 = 102516; + int32 int32_2517 = 102517; + int32 int32_2518 = 102518; + int32 int32_2519 = 102519; + int32 int32_2520 = 102520; + int32 int32_2521 = 102521; + int32 int32_2522 = 102522; + int32 int32_2523 = 102523; + int32 int32_2524 = 102524; + int32 int32_2525 = 102525; + int32 int32_2526 = 102526; + int32 int32_2527 = 102527; + int32 int32_2528 = 102528; + int32 int32_2529 = 102529; + int32 int32_2530 = 102530; + int32 int32_2531 = 102531; + int32 int32_2532 = 102532; + int32 int32_2533 = 102533; + int32 int32_2534 = 102534; + int32 int32_2535 = 102535; + int32 int32_2536 = 102536; + int32 int32_2537 = 102537; + int32 int32_2538 = 102538; + int32 int32_2539 = 102539; + int32 int32_2540 = 102540; + int32 int32_2541 = 102541; + int32 int32_2542 = 102542; + int32 int32_2543 = 102543; + int32 int32_2544 = 102544; + int32 int32_2545 = 102545; + int32 int32_2546 = 102546; + int32 int32_2547 = 102547; + int32 int32_2548 = 102548; + int32 int32_2549 = 102549; + int32 int32_2550 = 102550; + int32 int32_2551 = 102551; + int32 int32_2552 = 102552; + int32 int32_2553 = 102553; + int32 int32_2554 = 102554; + int32 int32_2555 = 102555; + int32 int32_2556 = 102556; + int32 int32_2557 = 102557; + int32 int32_2558 = 102558; + int32 int32_2559 = 102559; + int32 int32_2560 = 102560; + int32 int32_2561 = 102561; + int32 int32_2562 = 102562; + int32 int32_2563 = 102563; + int32 int32_2564 = 102564; + int32 int32_2565 = 102565; + int32 int32_2566 = 102566; + int32 int32_2567 = 102567; + int32 int32_2568 = 102568; + int32 int32_2569 = 102569; + int32 int32_2570 = 102570; + int32 int32_2571 = 102571; + int32 int32_2572 = 102572; + int32 int32_2573 = 102573; + int32 int32_2574 = 102574; + int32 int32_2575 = 102575; + int32 int32_2576 = 102576; + int32 int32_2577 = 102577; + int32 int32_2578 = 102578; + int32 int32_2579 = 102579; + int32 int32_2580 = 102580; + int32 int32_2581 = 102581; + int32 int32_2582 = 102582; + int32 int32_2583 = 102583; + int32 int32_2584 = 102584; + int32 int32_2585 = 102585; + int32 int32_2586 = 102586; + int32 int32_2587 = 102587; + int32 int32_2588 = 102588; + int32 int32_2589 = 102589; + int32 int32_2590 = 102590; + int32 int32_2591 = 102591; + int32 int32_2592 = 102592; + int32 int32_2593 = 102593; + int32 int32_2594 = 102594; + int32 int32_2595 = 102595; + int32 int32_2596 = 102596; + int32 int32_2597 = 102597; + int32 int32_2598 = 102598; + int32 int32_2599 = 102599; + int32 int32_2600 = 102600; + int32 int32_2601 = 102601; + int32 int32_2602 = 102602; + int32 int32_2603 = 102603; + int32 int32_2604 = 102604; + int32 int32_2605 = 102605; + int32 int32_2606 = 102606; + int32 int32_2607 = 102607; + int32 int32_2608 = 102608; + int32 int32_2609 = 102609; + int32 int32_2610 = 102610; + int32 int32_2611 = 102611; + int32 int32_2612 = 102612; + int32 int32_2613 = 102613; + int32 int32_2614 = 102614; + int32 int32_2615 = 102615; + int32 int32_2616 = 102616; + int32 int32_2617 = 102617; + int32 int32_2618 = 102618; + int32 int32_2619 = 102619; + int32 int32_2620 = 102620; + int32 int32_2621 = 102621; + int32 int32_2622 = 102622; + int32 int32_2623 = 102623; + int32 int32_2624 = 102624; + int32 int32_2625 = 102625; + int32 int32_2626 = 102626; + int32 int32_2627 = 102627; + int32 int32_2628 = 102628; + int32 int32_2629 = 102629; + int32 int32_2630 = 102630; + int32 int32_2631 = 102631; + int32 int32_2632 = 102632; + int32 int32_2633 = 102633; + int32 int32_2634 = 102634; + int32 int32_2635 = 102635; + int32 int32_2636 = 102636; + int32 int32_2637 = 102637; + int32 int32_2638 = 102638; + int32 int32_2639 = 102639; + int32 int32_2640 = 102640; + int32 int32_2641 = 102641; + int32 int32_2642 = 102642; + int32 int32_2643 = 102643; + int32 int32_2644 = 102644; + int32 int32_2645 = 102645; + int32 int32_2646 = 102646; + int32 int32_2647 = 102647; + int32 int32_2648 = 102648; + int32 int32_2649 = 102649; + int32 int32_2650 = 102650; + int32 int32_2651 = 102651; + int32 int32_2652 = 102652; + int32 int32_2653 = 102653; + int32 int32_2654 = 102654; + int32 int32_2655 = 102655; + int32 int32_2656 = 102656; + int32 int32_2657 = 102657; + int32 int32_2658 = 102658; + int32 int32_2659 = 102659; + int32 int32_2660 = 102660; + int32 int32_2661 = 102661; + int32 int32_2662 = 102662; + int32 int32_2663 = 102663; + int32 int32_2664 = 102664; + int32 int32_2665 = 102665; + int32 int32_2666 = 102666; + int32 int32_2667 = 102667; + int32 int32_2668 = 102668; + int32 int32_2669 = 102669; + int32 int32_2670 = 102670; + int32 int32_2671 = 102671; + int32 int32_2672 = 102672; + int32 int32_2673 = 102673; + int32 int32_2674 = 102674; + int32 int32_2675 = 102675; + int32 int32_2676 = 102676; + int32 int32_2677 = 102677; + int32 int32_2678 = 102678; + int32 int32_2679 = 102679; + int32 int32_2680 = 102680; + int32 int32_2681 = 102681; + int32 int32_2682 = 102682; + int32 int32_2683 = 102683; + int32 int32_2684 = 102684; + int32 int32_2685 = 102685; + int32 int32_2686 = 102686; + int32 int32_2687 = 102687; + int32 int32_2688 = 102688; + int32 int32_2689 = 102689; + int32 int32_2690 = 102690; + int32 int32_2691 = 102691; + int32 int32_2692 = 102692; + int32 int32_2693 = 102693; + int32 int32_2694 = 102694; + int32 int32_2695 = 102695; + int32 int32_2696 = 102696; + int32 int32_2697 = 102697; + int32 int32_2698 = 102698; + int32 int32_2699 = 102699; + int32 int32_2700 = 102700; + int32 int32_2701 = 102701; + int32 int32_2702 = 102702; + int32 int32_2703 = 102703; + int32 int32_2704 = 102704; + int32 int32_2705 = 102705; + int32 int32_2706 = 102706; + int32 int32_2707 = 102707; + int32 int32_2708 = 102708; + int32 int32_2709 = 102709; + int32 int32_2710 = 102710; + int32 int32_2711 = 102711; + int32 int32_2712 = 102712; + int32 int32_2713 = 102713; + int32 int32_2714 = 102714; + int32 int32_2715 = 102715; + int32 int32_2716 = 102716; + int32 int32_2717 = 102717; + int32 int32_2718 = 102718; + int32 int32_2719 = 102719; + int32 int32_2720 = 102720; + int32 int32_2721 = 102721; + int32 int32_2722 = 102722; + int32 int32_2723 = 102723; + int32 int32_2724 = 102724; + int32 int32_2725 = 102725; + int32 int32_2726 = 102726; + int32 int32_2727 = 102727; + int32 int32_2728 = 102728; + int32 int32_2729 = 102729; + int32 int32_2730 = 102730; + int32 int32_2731 = 102731; + int32 int32_2732 = 102732; + int32 int32_2733 = 102733; + int32 int32_2734 = 102734; + int32 int32_2735 = 102735; + int32 int32_2736 = 102736; + int32 int32_2737 = 102737; + int32 int32_2738 = 102738; + int32 int32_2739 = 102739; + int32 int32_2740 = 102740; + int32 int32_2741 = 102741; + int32 int32_2742 = 102742; + int32 int32_2743 = 102743; + int32 int32_2744 = 102744; + int32 int32_2745 = 102745; + int32 int32_2746 = 102746; + int32 int32_2747 = 102747; + int32 int32_2748 = 102748; + int32 int32_2749 = 102749; + int32 int32_2750 = 102750; + int32 int32_2751 = 102751; + int32 int32_2752 = 102752; + int32 int32_2753 = 102753; + int32 int32_2754 = 102754; + int32 int32_2755 = 102755; + int32 int32_2756 = 102756; + int32 int32_2757 = 102757; + int32 int32_2758 = 102758; + int32 int32_2759 = 102759; + int32 int32_2760 = 102760; + int32 int32_2761 = 102761; + int32 int32_2762 = 102762; + int32 int32_2763 = 102763; + int32 int32_2764 = 102764; + int32 int32_2765 = 102765; + int32 int32_2766 = 102766; + int32 int32_2767 = 102767; + int32 int32_2768 = 102768; + int32 int32_2769 = 102769; + int32 int32_2770 = 102770; + int32 int32_2771 = 102771; + int32 int32_2772 = 102772; + int32 int32_2773 = 102773; + int32 int32_2774 = 102774; + int32 int32_2775 = 102775; + int32 int32_2776 = 102776; + int32 int32_2777 = 102777; + int32 int32_2778 = 102778; + int32 int32_2779 = 102779; + int32 int32_2780 = 102780; + int32 int32_2781 = 102781; + int32 int32_2782 = 102782; + int32 int32_2783 = 102783; + int32 int32_2784 = 102784; + int32 int32_2785 = 102785; + int32 int32_2786 = 102786; + int32 int32_2787 = 102787; + int32 int32_2788 = 102788; + int32 int32_2789 = 102789; + int32 int32_2790 = 102790; + int32 int32_2791 = 102791; + int32 int32_2792 = 102792; + int32 int32_2793 = 102793; + int32 int32_2794 = 102794; + int32 int32_2795 = 102795; + int32 int32_2796 = 102796; + int32 int32_2797 = 102797; + int32 int32_2798 = 102798; + int32 int32_2799 = 102799; + int32 int32_2800 = 102800; + int32 int32_2801 = 102801; + int32 int32_2802 = 102802; + int32 int32_2803 = 102803; + int32 int32_2804 = 102804; + int32 int32_2805 = 102805; + int32 int32_2806 = 102806; + int32 int32_2807 = 102807; + int32 int32_2808 = 102808; + int32 int32_2809 = 102809; + int32 int32_2810 = 102810; + int32 int32_2811 = 102811; + int32 int32_2812 = 102812; + int32 int32_2813 = 102813; + int32 int32_2814 = 102814; + int32 int32_2815 = 102815; + int32 int32_2816 = 102816; + int32 int32_2817 = 102817; + int32 int32_2818 = 102818; + int32 int32_2819 = 102819; + int32 int32_2820 = 102820; + int32 int32_2821 = 102821; + int32 int32_2822 = 102822; + int32 int32_2823 = 102823; + int32 int32_2824 = 102824; + int32 int32_2825 = 102825; + int32 int32_2826 = 102826; + int32 int32_2827 = 102827; + int32 int32_2828 = 102828; + int32 int32_2829 = 102829; + int32 int32_2830 = 102830; + int32 int32_2831 = 102831; + int32 int32_2832 = 102832; + int32 int32_2833 = 102833; + int32 int32_2834 = 102834; + int32 int32_2835 = 102835; + int32 int32_2836 = 102836; + int32 int32_2837 = 102837; + int32 int32_2838 = 102838; + int32 int32_2839 = 102839; + int32 int32_2840 = 102840; + int32 int32_2841 = 102841; + int32 int32_2842 = 102842; + int32 int32_2843 = 102843; + int32 int32_2844 = 102844; + int32 int32_2845 = 102845; + int32 int32_2846 = 102846; + int32 int32_2847 = 102847; + int32 int32_2848 = 102848; + int32 int32_2849 = 102849; + int32 int32_2850 = 102850; + int32 int32_2851 = 102851; + int32 int32_2852 = 102852; + int32 int32_2853 = 102853; + int32 int32_2854 = 102854; + int32 int32_2855 = 102855; + int32 int32_2856 = 102856; + int32 int32_2857 = 102857; + int32 int32_2858 = 102858; + int32 int32_2859 = 102859; + int32 int32_2860 = 102860; + int32 int32_2861 = 102861; + int32 int32_2862 = 102862; + int32 int32_2863 = 102863; + int32 int32_2864 = 102864; + int32 int32_2865 = 102865; + int32 int32_2866 = 102866; + int32 int32_2867 = 102867; + int32 int32_2868 = 102868; + int32 int32_2869 = 102869; + int32 int32_2870 = 102870; + int32 int32_2871 = 102871; + int32 int32_2872 = 102872; + int32 int32_2873 = 102873; + int32 int32_2874 = 102874; + int32 int32_2875 = 102875; + int32 int32_2876 = 102876; + int32 int32_2877 = 102877; + int32 int32_2878 = 102878; + int32 int32_2879 = 102879; + int32 int32_2880 = 102880; + int32 int32_2881 = 102881; + int32 int32_2882 = 102882; + int32 int32_2883 = 102883; + int32 int32_2884 = 102884; + int32 int32_2885 = 102885; + int32 int32_2886 = 102886; + int32 int32_2887 = 102887; + int32 int32_2888 = 102888; + int32 int32_2889 = 102889; + int32 int32_2890 = 102890; + int32 int32_2891 = 102891; + int32 int32_2892 = 102892; + int32 int32_2893 = 102893; + int32 int32_2894 = 102894; + int32 int32_2895 = 102895; + int32 int32_2896 = 102896; + int32 int32_2897 = 102897; + int32 int32_2898 = 102898; + int32 int32_2899 = 102899; + int32 int32_2900 = 102900; + int32 int32_2901 = 102901; + int32 int32_2902 = 102902; + int32 int32_2903 = 102903; + int32 int32_2904 = 102904; + int32 int32_2905 = 102905; + int32 int32_2906 = 102906; + int32 int32_2907 = 102907; + int32 int32_2908 = 102908; + int32 int32_2909 = 102909; + int32 int32_2910 = 102910; + int32 int32_2911 = 102911; + int32 int32_2912 = 102912; + int32 int32_2913 = 102913; + int32 int32_2914 = 102914; + int32 int32_2915 = 102915; + int32 int32_2916 = 102916; + int32 int32_2917 = 102917; + int32 int32_2918 = 102918; + int32 int32_2919 = 102919; + int32 int32_2920 = 102920; + int32 int32_2921 = 102921; + int32 int32_2922 = 102922; + int32 int32_2923 = 102923; + int32 int32_2924 = 102924; + int32 int32_2925 = 102925; + int32 int32_2926 = 102926; + int32 int32_2927 = 102927; + int32 int32_2928 = 102928; + int32 int32_2929 = 102929; + int32 int32_2930 = 102930; + int32 int32_2931 = 102931; + int32 int32_2932 = 102932; + int32 int32_2933 = 102933; + int32 int32_2934 = 102934; + int32 int32_2935 = 102935; + int32 int32_2936 = 102936; + int32 int32_2937 = 102937; + int32 int32_2938 = 102938; + int32 int32_2939 = 102939; + int32 int32_2940 = 102940; + int32 int32_2941 = 102941; + int32 int32_2942 = 102942; + int32 int32_2943 = 102943; + int32 int32_2944 = 102944; + int32 int32_2945 = 102945; + int32 int32_2946 = 102946; + int32 int32_2947 = 102947; + int32 int32_2948 = 102948; + int32 int32_2949 = 102949; + int32 int32_2950 = 102950; + int32 int32_2951 = 102951; + int32 int32_2952 = 102952; + int32 int32_2953 = 102953; + int32 int32_2954 = 102954; + int32 int32_2955 = 102955; + int32 int32_2956 = 102956; + int32 int32_2957 = 102957; + int32 int32_2958 = 102958; + int32 int32_2959 = 102959; + int32 int32_2960 = 102960; + int32 int32_2961 = 102961; + int32 int32_2962 = 102962; + int32 int32_2963 = 102963; + int32 int32_2964 = 102964; + int32 int32_2965 = 102965; + int32 int32_2966 = 102966; + int32 int32_2967 = 102967; + int32 int32_2968 = 102968; + int32 int32_2969 = 102969; + int32 int32_2970 = 102970; + int32 int32_2971 = 102971; + int32 int32_2972 = 102972; + int32 int32_2973 = 102973; + int32 int32_2974 = 102974; + int32 int32_2975 = 102975; + int32 int32_2976 = 102976; + int32 int32_2977 = 102977; + int32 int32_2978 = 102978; + int32 int32_2979 = 102979; + int32 int32_2980 = 102980; + int32 int32_2981 = 102981; + int32 int32_2982 = 102982; + int32 int32_2983 = 102983; + int32 int32_2984 = 102984; + int32 int32_2985 = 102985; + int32 int32_2986 = 102986; + int32 int32_2987 = 102987; + int32 int32_2988 = 102988; + int32 int32_2989 = 102989; + int32 int32_2990 = 102990; + int32 int32_2991 = 102991; + int32 int32_2992 = 102992; + int32 int32_2993 = 102993; + int32 int32_2994 = 102994; + int32 int32_2995 = 102995; + int32 int32_2996 = 102996; + int32 int32_2997 = 102997; + int32 int32_2998 = 102998; + int32 int32_2999 = 102999; + int32 int32_3000 = 103000; + int32 int32_3001 = 103001; + int32 int32_3002 = 103002; + int32 int32_3003 = 103003; + int32 int32_3004 = 103004; + int32 int32_3005 = 103005; + int32 int32_3006 = 103006; + int32 int32_3007 = 103007; + int32 int32_3008 = 103008; + int32 int32_3009 = 103009; + int32 int32_3010 = 103010; + int32 int32_3011 = 103011; + int32 int32_3012 = 103012; + int32 int32_3013 = 103013; + int32 int32_3014 = 103014; + int32 int32_3015 = 103015; + int32 int32_3016 = 103016; + int32 int32_3017 = 103017; + int32 int32_3018 = 103018; + int32 int32_3019 = 103019; + int32 int32_3020 = 103020; + int32 int32_3021 = 103021; + int32 int32_3022 = 103022; + int32 int32_3023 = 103023; + int32 int32_3024 = 103024; + int32 int32_3025 = 103025; + int32 int32_3026 = 103026; + int32 int32_3027 = 103027; + int32 int32_3028 = 103028; + int32 int32_3029 = 103029; + int32 int32_3030 = 103030; + int32 int32_3031 = 103031; + int32 int32_3032 = 103032; + int32 int32_3033 = 103033; + int32 int32_3034 = 103034; + int32 int32_3035 = 103035; + int32 int32_3036 = 103036; + int32 int32_3037 = 103037; + int32 int32_3038 = 103038; + int32 int32_3039 = 103039; + int32 int32_3040 = 103040; + int32 int32_3041 = 103041; + int32 int32_3042 = 103042; + int32 int32_3043 = 103043; + int32 int32_3044 = 103044; + int32 int32_3045 = 103045; + int32 int32_3046 = 103046; + int32 int32_3047 = 103047; + int32 int32_3048 = 103048; + int32 int32_3049 = 103049; + int32 int32_3050 = 103050; + int32 int32_3051 = 103051; + int32 int32_3052 = 103052; + int32 int32_3053 = 103053; + int32 int32_3054 = 103054; + int32 int32_3055 = 103055; + int32 int32_3056 = 103056; + int32 int32_3057 = 103057; + int32 int32_3058 = 103058; + int32 int32_3059 = 103059; + int32 int32_3060 = 103060; + int32 int32_3061 = 103061; + int32 int32_3062 = 103062; + int32 int32_3063 = 103063; + int32 int32_3064 = 103064; + int32 int32_3065 = 103065; + int32 int32_3066 = 103066; + int32 int32_3067 = 103067; + int32 int32_3068 = 103068; + int32 int32_3069 = 103069; + int32 int32_3070 = 103070; + int32 int32_3071 = 103071; + int32 int32_3072 = 103072; + int32 int32_3073 = 103073; + int32 int32_3074 = 103074; + int32 int32_3075 = 103075; + int32 int32_3076 = 103076; + int32 int32_3077 = 103077; + int32 int32_3078 = 103078; + int32 int32_3079 = 103079; + int32 int32_3080 = 103080; + int32 int32_3081 = 103081; + int32 int32_3082 = 103082; + int32 int32_3083 = 103083; + int32 int32_3084 = 103084; + int32 int32_3085 = 103085; + int32 int32_3086 = 103086; + int32 int32_3087 = 103087; + int32 int32_3088 = 103088; + int32 int32_3089 = 103089; + int32 int32_3090 = 103090; + int32 int32_3091 = 103091; + int32 int32_3092 = 103092; + int32 int32_3093 = 103093; + int32 int32_3094 = 103094; + int32 int32_3095 = 103095; + int32 int32_3096 = 103096; + int32 int32_3097 = 103097; + int32 int32_3098 = 103098; + int32 int32_3099 = 103099; + int32 int32_3100 = 103100; + int32 int32_3101 = 103101; + int32 int32_3102 = 103102; + int32 int32_3103 = 103103; + int32 int32_3104 = 103104; + int32 int32_3105 = 103105; + int32 int32_3106 = 103106; + int32 int32_3107 = 103107; + int32 int32_3108 = 103108; + int32 int32_3109 = 103109; + int32 int32_3110 = 103110; + int32 int32_3111 = 103111; + int32 int32_3112 = 103112; + int32 int32_3113 = 103113; + int32 int32_3114 = 103114; + int32 int32_3115 = 103115; + int32 int32_3116 = 103116; + int32 int32_3117 = 103117; + int32 int32_3118 = 103118; + int32 int32_3119 = 103119; + int32 int32_3120 = 103120; + int32 int32_3121 = 103121; + int32 int32_3122 = 103122; + int32 int32_3123 = 103123; + int32 int32_3124 = 103124; + int32 int32_3125 = 103125; + int32 int32_3126 = 103126; + int32 int32_3127 = 103127; + int32 int32_3128 = 103128; + int32 int32_3129 = 103129; + int32 int32_3130 = 103130; + int32 int32_3131 = 103131; + int32 int32_3132 = 103132; + int32 int32_3133 = 103133; + int32 int32_3134 = 103134; + int32 int32_3135 = 103135; + int32 int32_3136 = 103136; + int32 int32_3137 = 103137; + int32 int32_3138 = 103138; + int32 int32_3139 = 103139; + int32 int32_3140 = 103140; + int32 int32_3141 = 103141; + int32 int32_3142 = 103142; + int32 int32_3143 = 103143; + int32 int32_3144 = 103144; + int32 int32_3145 = 103145; + int32 int32_3146 = 103146; + int32 int32_3147 = 103147; + int32 int32_3148 = 103148; + int32 int32_3149 = 103149; + int32 int32_3150 = 103150; + int32 int32_3151 = 103151; + int32 int32_3152 = 103152; + int32 int32_3153 = 103153; + int32 int32_3154 = 103154; + int32 int32_3155 = 103155; + int32 int32_3156 = 103156; + int32 int32_3157 = 103157; + int32 int32_3158 = 103158; + int32 int32_3159 = 103159; + int32 int32_3160 = 103160; + int32 int32_3161 = 103161; + int32 int32_3162 = 103162; + int32 int32_3163 = 103163; + int32 int32_3164 = 103164; + int32 int32_3165 = 103165; + int32 int32_3166 = 103166; + int32 int32_3167 = 103167; + int32 int32_3168 = 103168; + int32 int32_3169 = 103169; + int32 int32_3170 = 103170; + int32 int32_3171 = 103171; + int32 int32_3172 = 103172; + int32 int32_3173 = 103173; + int32 int32_3174 = 103174; + int32 int32_3175 = 103175; + int32 int32_3176 = 103176; + int32 int32_3177 = 103177; + int32 int32_3178 = 103178; + int32 int32_3179 = 103179; + int32 int32_3180 = 103180; + int32 int32_3181 = 103181; + int32 int32_3182 = 103182; + int32 int32_3183 = 103183; + int32 int32_3184 = 103184; + int32 int32_3185 = 103185; + int32 int32_3186 = 103186; + int32 int32_3187 = 103187; + int32 int32_3188 = 103188; + int32 int32_3189 = 103189; + int32 int32_3190 = 103190; + int32 int32_3191 = 103191; + int32 int32_3192 = 103192; + int32 int32_3193 = 103193; + int32 int32_3194 = 103194; + int32 int32_3195 = 103195; + int32 int32_3196 = 103196; + int32 int32_3197 = 103197; + int32 int32_3198 = 103198; + int32 int32_3199 = 103199; + int32 int32_3200 = 103200; + int32 int32_3201 = 103201; + int32 int32_3202 = 103202; + int32 int32_3203 = 103203; + int32 int32_3204 = 103204; + int32 int32_3205 = 103205; + int32 int32_3206 = 103206; + int32 int32_3207 = 103207; + int32 int32_3208 = 103208; + int32 int32_3209 = 103209; + int32 int32_3210 = 103210; + int32 int32_3211 = 103211; + int32 int32_3212 = 103212; + int32 int32_3213 = 103213; + int32 int32_3214 = 103214; + int32 int32_3215 = 103215; + int32 int32_3216 = 103216; + int32 int32_3217 = 103217; + int32 int32_3218 = 103218; + int32 int32_3219 = 103219; + int32 int32_3220 = 103220; + int32 int32_3221 = 103221; + int32 int32_3222 = 103222; + int32 int32_3223 = 103223; + int32 int32_3224 = 103224; + int32 int32_3225 = 103225; + int32 int32_3226 = 103226; + int32 int32_3227 = 103227; + int32 int32_3228 = 103228; + int32 int32_3229 = 103229; + int32 int32_3230 = 103230; + int32 int32_3231 = 103231; + int32 int32_3232 = 103232; + int32 int32_3233 = 103233; + int32 int32_3234 = 103234; + int32 int32_3235 = 103235; + int32 int32_3236 = 103236; + int32 int32_3237 = 103237; + int32 int32_3238 = 103238; + int32 int32_3239 = 103239; + int32 int32_3240 = 103240; + int32 int32_3241 = 103241; + int32 int32_3242 = 103242; + int32 int32_3243 = 103243; + int32 int32_3244 = 103244; + int32 int32_3245 = 103245; + int32 int32_3246 = 103246; + int32 int32_3247 = 103247; + int32 int32_3248 = 103248; + int32 int32_3249 = 103249; + int32 int32_3250 = 103250; + int32 int32_3251 = 103251; + int32 int32_3252 = 103252; + int32 int32_3253 = 103253; + int32 int32_3254 = 103254; + int32 int32_3255 = 103255; + int32 int32_3256 = 103256; + int32 int32_3257 = 103257; + int32 int32_3258 = 103258; + int32 int32_3259 = 103259; + int32 int32_3260 = 103260; + int32 int32_3261 = 103261; + int32 int32_3262 = 103262; + int32 int32_3263 = 103263; + int32 int32_3264 = 103264; + int32 int32_3265 = 103265; + int32 int32_3266 = 103266; + int32 int32_3267 = 103267; + int32 int32_3268 = 103268; + int32 int32_3269 = 103269; + int32 int32_3270 = 103270; + int32 int32_3271 = 103271; + int32 int32_3272 = 103272; + int32 int32_3273 = 103273; + int32 int32_3274 = 103274; + int32 int32_3275 = 103275; + int32 int32_3276 = 103276; + int32 int32_3277 = 103277; + int32 int32_3278 = 103278; + int32 int32_3279 = 103279; + int32 int32_3280 = 103280; + int32 int32_3281 = 103281; + int32 int32_3282 = 103282; + int32 int32_3283 = 103283; + int32 int32_3284 = 103284; + int32 int32_3285 = 103285; + int32 int32_3286 = 103286; + int32 int32_3287 = 103287; + int32 int32_3288 = 103288; + int32 int32_3289 = 103289; + int32 int32_3290 = 103290; + int32 int32_3291 = 103291; + int32 int32_3292 = 103292; + int32 int32_3293 = 103293; + int32 int32_3294 = 103294; + int32 int32_3295 = 103295; + int32 int32_3296 = 103296; + int32 int32_3297 = 103297; + int32 int32_3298 = 103298; + int32 int32_3299 = 103299; + int32 int32_3300 = 103300; + int32 int32_3301 = 103301; + int32 int32_3302 = 103302; + int32 int32_3303 = 103303; + int32 int32_3304 = 103304; + int32 int32_3305 = 103305; + int32 int32_3306 = 103306; + int32 int32_3307 = 103307; + int32 int32_3308 = 103308; + int32 int32_3309 = 103309; + int32 int32_3310 = 103310; + int32 int32_3311 = 103311; + int32 int32_3312 = 103312; + int32 int32_3313 = 103313; + int32 int32_3314 = 103314; + int32 int32_3315 = 103315; + int32 int32_3316 = 103316; + int32 int32_3317 = 103317; + int32 int32_3318 = 103318; + int32 int32_3319 = 103319; + int32 int32_3320 = 103320; + int32 int32_3321 = 103321; + int32 int32_3322 = 103322; + int32 int32_3323 = 103323; + int32 int32_3324 = 103324; + int32 int32_3325 = 103325; + int32 int32_3326 = 103326; + int32 int32_3327 = 103327; + int32 int32_3328 = 103328; + int32 int32_3329 = 103329; + int32 int32_3330 = 103330; + int32 int32_3331 = 103331; + int32 int32_3332 = 103332; + int32 int32_3333 = 103333; + int32 int32_3334 = 103334; + int32 int32_3335 = 103335; + int32 int32_3336 = 103336; + int32 int32_3337 = 103337; + int32 int32_3338 = 103338; + int32 int32_3339 = 103339; + int32 int32_3340 = 103340; + int32 int32_3341 = 103341; + int32 int32_3342 = 103342; + int32 int32_3343 = 103343; + int32 int32_3344 = 103344; + int32 int32_3345 = 103345; + int32 int32_3346 = 103346; + int32 int32_3347 = 103347; + int32 int32_3348 = 103348; + int32 int32_3349 = 103349; + int32 int32_3350 = 103350; + int32 int32_3351 = 103351; + int32 int32_3352 = 103352; + int32 int32_3353 = 103353; + int32 int32_3354 = 103354; + int32 int32_3355 = 103355; + int32 int32_3356 = 103356; + int32 int32_3357 = 103357; + int32 int32_3358 = 103358; + int32 int32_3359 = 103359; + int32 int32_3360 = 103360; + int32 int32_3361 = 103361; + int32 int32_3362 = 103362; + int32 int32_3363 = 103363; + int32 int32_3364 = 103364; + int32 int32_3365 = 103365; + int32 int32_3366 = 103366; + int32 int32_3367 = 103367; + int32 int32_3368 = 103368; + int32 int32_3369 = 103369; + int32 int32_3370 = 103370; + int32 int32_3371 = 103371; + int32 int32_3372 = 103372; + int32 int32_3373 = 103373; + int32 int32_3374 = 103374; + int32 int32_3375 = 103375; + int32 int32_3376 = 103376; + int32 int32_3377 = 103377; + int32 int32_3378 = 103378; + int32 int32_3379 = 103379; + int32 int32_3380 = 103380; + int32 int32_3381 = 103381; + int32 int32_3382 = 103382; + int32 int32_3383 = 103383; + int32 int32_3384 = 103384; + int32 int32_3385 = 103385; + int32 int32_3386 = 103386; + int32 int32_3387 = 103387; + int32 int32_3388 = 103388; + int32 int32_3389 = 103389; + int32 int32_3390 = 103390; + int32 int32_3391 = 103391; + int32 int32_3392 = 103392; + int32 int32_3393 = 103393; + int32 int32_3394 = 103394; + int32 int32_3395 = 103395; + int32 int32_3396 = 103396; + int32 int32_3397 = 103397; + int32 int32_3398 = 103398; + int32 int32_3399 = 103399; + int32 int32_3400 = 103400; + int32 int32_3401 = 103401; + int32 int32_3402 = 103402; + int32 int32_3403 = 103403; + int32 int32_3404 = 103404; + int32 int32_3405 = 103405; + int32 int32_3406 = 103406; + int32 int32_3407 = 103407; + int32 int32_3408 = 103408; + int32 int32_3409 = 103409; + int32 int32_3410 = 103410; + int32 int32_3411 = 103411; + int32 int32_3412 = 103412; + int32 int32_3413 = 103413; + int32 int32_3414 = 103414; + int32 int32_3415 = 103415; + int32 int32_3416 = 103416; + int32 int32_3417 = 103417; + int32 int32_3418 = 103418; + int32 int32_3419 = 103419; + int32 int32_3420 = 103420; + int32 int32_3421 = 103421; + int32 int32_3422 = 103422; + int32 int32_3423 = 103423; + int32 int32_3424 = 103424; + int32 int32_3425 = 103425; + int32 int32_3426 = 103426; + int32 int32_3427 = 103427; + int32 int32_3428 = 103428; + int32 int32_3429 = 103429; + int32 int32_3430 = 103430; + int32 int32_3431 = 103431; + int32 int32_3432 = 103432; + int32 int32_3433 = 103433; + int32 int32_3434 = 103434; + int32 int32_3435 = 103435; + int32 int32_3436 = 103436; + int32 int32_3437 = 103437; + int32 int32_3438 = 103438; + int32 int32_3439 = 103439; + int32 int32_3440 = 103440; + int32 int32_3441 = 103441; + int32 int32_3442 = 103442; + int32 int32_3443 = 103443; + int32 int32_3444 = 103444; + int32 int32_3445 = 103445; + int32 int32_3446 = 103446; + int32 int32_3447 = 103447; + int32 int32_3448 = 103448; + int32 int32_3449 = 103449; + int32 int32_3450 = 103450; + int32 int32_3451 = 103451; + int32 int32_3452 = 103452; + int32 int32_3453 = 103453; + int32 int32_3454 = 103454; + int32 int32_3455 = 103455; + int32 int32_3456 = 103456; + int32 int32_3457 = 103457; + int32 int32_3458 = 103458; + int32 int32_3459 = 103459; + int32 int32_3460 = 103460; + int32 int32_3461 = 103461; + int32 int32_3462 = 103462; + int32 int32_3463 = 103463; + int32 int32_3464 = 103464; + int32 int32_3465 = 103465; + int32 int32_3466 = 103466; + int32 int32_3467 = 103467; + int32 int32_3468 = 103468; + int32 int32_3469 = 103469; + int32 int32_3470 = 103470; + int32 int32_3471 = 103471; + int32 int32_3472 = 103472; + int32 int32_3473 = 103473; + int32 int32_3474 = 103474; + int32 int32_3475 = 103475; + int32 int32_3476 = 103476; + int32 int32_3477 = 103477; + int32 int32_3478 = 103478; + int32 int32_3479 = 103479; + int32 int32_3480 = 103480; + int32 int32_3481 = 103481; + int32 int32_3482 = 103482; + int32 int32_3483 = 103483; + int32 int32_3484 = 103484; + int32 int32_3485 = 103485; + int32 int32_3486 = 103486; + int32 int32_3487 = 103487; + int32 int32_3488 = 103488; + int32 int32_3489 = 103489; + int32 int32_3490 = 103490; + int32 int32_3491 = 103491; + int32 int32_3492 = 103492; + int32 int32_3493 = 103493; + int32 int32_3494 = 103494; + int32 int32_3495 = 103495; + int32 int32_3496 = 103496; + int32 int32_3497 = 103497; + int32 int32_3498 = 103498; + int32 int32_3499 = 103499; + int32 int32_3500 = 103500; + int32 int32_3501 = 103501; + int32 int32_3502 = 103502; + int32 int32_3503 = 103503; + int32 int32_3504 = 103504; + int32 int32_3505 = 103505; + int32 int32_3506 = 103506; + int32 int32_3507 = 103507; + int32 int32_3508 = 103508; + int32 int32_3509 = 103509; + int32 int32_3510 = 103510; + int32 int32_3511 = 103511; + int32 int32_3512 = 103512; + int32 int32_3513 = 103513; + int32 int32_3514 = 103514; + int32 int32_3515 = 103515; + int32 int32_3516 = 103516; + int32 int32_3517 = 103517; + int32 int32_3518 = 103518; + int32 int32_3519 = 103519; + int32 int32_3520 = 103520; + int32 int32_3521 = 103521; + int32 int32_3522 = 103522; + int32 int32_3523 = 103523; + int32 int32_3524 = 103524; + int32 int32_3525 = 103525; + int32 int32_3526 = 103526; + int32 int32_3527 = 103527; + int32 int32_3528 = 103528; + int32 int32_3529 = 103529; + int32 int32_3530 = 103530; + int32 int32_3531 = 103531; + int32 int32_3532 = 103532; + int32 int32_3533 = 103533; + int32 int32_3534 = 103534; + int32 int32_3535 = 103535; + int32 int32_3536 = 103536; + int32 int32_3537 = 103537; + int32 int32_3538 = 103538; + int32 int32_3539 = 103539; + int32 int32_3540 = 103540; + int32 int32_3541 = 103541; + int32 int32_3542 = 103542; + int32 int32_3543 = 103543; + int32 int32_3544 = 103544; + int32 int32_3545 = 103545; + int32 int32_3546 = 103546; + int32 int32_3547 = 103547; + int32 int32_3548 = 103548; + int32 int32_3549 = 103549; + int32 int32_3550 = 103550; + int32 int32_3551 = 103551; + int32 int32_3552 = 103552; + int32 int32_3553 = 103553; + int32 int32_3554 = 103554; + int32 int32_3555 = 103555; + int32 int32_3556 = 103556; + int32 int32_3557 = 103557; + int32 int32_3558 = 103558; + int32 int32_3559 = 103559; + int32 int32_3560 = 103560; + int32 int32_3561 = 103561; + int32 int32_3562 = 103562; + int32 int32_3563 = 103563; + int32 int32_3564 = 103564; + int32 int32_3565 = 103565; + int32 int32_3566 = 103566; + int32 int32_3567 = 103567; + int32 int32_3568 = 103568; + int32 int32_3569 = 103569; + int32 int32_3570 = 103570; + int32 int32_3571 = 103571; + int32 int32_3572 = 103572; + int32 int32_3573 = 103573; + int32 int32_3574 = 103574; + int32 int32_3575 = 103575; + int32 int32_3576 = 103576; + int32 int32_3577 = 103577; + int32 int32_3578 = 103578; + int32 int32_3579 = 103579; + int32 int32_3580 = 103580; + int32 int32_3581 = 103581; + int32 int32_3582 = 103582; + int32 int32_3583 = 103583; + int32 int32_3584 = 103584; + int32 int32_3585 = 103585; + int32 int32_3586 = 103586; + int32 int32_3587 = 103587; + int32 int32_3588 = 103588; + int32 int32_3589 = 103589; + int32 int32_3590 = 103590; + int32 int32_3591 = 103591; + int32 int32_3592 = 103592; + int32 int32_3593 = 103593; + int32 int32_3594 = 103594; + int32 int32_3595 = 103595; + int32 int32_3596 = 103596; + int32 int32_3597 = 103597; + int32 int32_3598 = 103598; + int32 int32_3599 = 103599; + int32 int32_3600 = 103600; + int32 int32_3601 = 103601; + int32 int32_3602 = 103602; + int32 int32_3603 = 103603; + int32 int32_3604 = 103604; + int32 int32_3605 = 103605; + int32 int32_3606 = 103606; + int32 int32_3607 = 103607; + int32 int32_3608 = 103608; + int32 int32_3609 = 103609; + int32 int32_3610 = 103610; + int32 int32_3611 = 103611; + int32 int32_3612 = 103612; + int32 int32_3613 = 103613; + int32 int32_3614 = 103614; + int32 int32_3615 = 103615; + int32 int32_3616 = 103616; + int32 int32_3617 = 103617; + int32 int32_3618 = 103618; + int32 int32_3619 = 103619; + int32 int32_3620 = 103620; + int32 int32_3621 = 103621; + int32 int32_3622 = 103622; + int32 int32_3623 = 103623; + int32 int32_3624 = 103624; + int32 int32_3625 = 103625; + int32 int32_3626 = 103626; + int32 int32_3627 = 103627; + int32 int32_3628 = 103628; + int32 int32_3629 = 103629; + int32 int32_3630 = 103630; + int32 int32_3631 = 103631; + int32 int32_3632 = 103632; + int32 int32_3633 = 103633; + int32 int32_3634 = 103634; + int32 int32_3635 = 103635; + int32 int32_3636 = 103636; + int32 int32_3637 = 103637; + int32 int32_3638 = 103638; + int32 int32_3639 = 103639; + int32 int32_3640 = 103640; + int32 int32_3641 = 103641; + int32 int32_3642 = 103642; + int32 int32_3643 = 103643; + int32 int32_3644 = 103644; + int32 int32_3645 = 103645; + int32 int32_3646 = 103646; + int32 int32_3647 = 103647; + int32 int32_3648 = 103648; + int32 int32_3649 = 103649; + int32 int32_3650 = 103650; + int32 int32_3651 = 103651; + int32 int32_3652 = 103652; + int32 int32_3653 = 103653; + int32 int32_3654 = 103654; + int32 int32_3655 = 103655; + int32 int32_3656 = 103656; + int32 int32_3657 = 103657; + int32 int32_3658 = 103658; + int32 int32_3659 = 103659; + int32 int32_3660 = 103660; + int32 int32_3661 = 103661; + int32 int32_3662 = 103662; + int32 int32_3663 = 103663; + int32 int32_3664 = 103664; + int32 int32_3665 = 103665; + int32 int32_3666 = 103666; + int32 int32_3667 = 103667; + int32 int32_3668 = 103668; + int32 int32_3669 = 103669; + int32 int32_3670 = 103670; + int32 int32_3671 = 103671; + int32 int32_3672 = 103672; + int32 int32_3673 = 103673; + int32 int32_3674 = 103674; + int32 int32_3675 = 103675; + int32 int32_3676 = 103676; + int32 int32_3677 = 103677; + int32 int32_3678 = 103678; + int32 int32_3679 = 103679; + int32 int32_3680 = 103680; + int32 int32_3681 = 103681; + int32 int32_3682 = 103682; + int32 int32_3683 = 103683; + int32 int32_3684 = 103684; + int32 int32_3685 = 103685; + int32 int32_3686 = 103686; + int32 int32_3687 = 103687; + int32 int32_3688 = 103688; + int32 int32_3689 = 103689; + int32 int32_3690 = 103690; + int32 int32_3691 = 103691; + int32 int32_3692 = 103692; + int32 int32_3693 = 103693; + int32 int32_3694 = 103694; + int32 int32_3695 = 103695; + int32 int32_3696 = 103696; + int32 int32_3697 = 103697; + int32 int32_3698 = 103698; + int32 int32_3699 = 103699; + int32 int32_3700 = 103700; + int32 int32_3701 = 103701; + int32 int32_3702 = 103702; + int32 int32_3703 = 103703; + int32 int32_3704 = 103704; + int32 int32_3705 = 103705; + int32 int32_3706 = 103706; + int32 int32_3707 = 103707; + int32 int32_3708 = 103708; + int32 int32_3709 = 103709; + int32 int32_3710 = 103710; + int32 int32_3711 = 103711; + int32 int32_3712 = 103712; + int32 int32_3713 = 103713; + int32 int32_3714 = 103714; + int32 int32_3715 = 103715; + int32 int32_3716 = 103716; + int32 int32_3717 = 103717; + int32 int32_3718 = 103718; + int32 int32_3719 = 103719; + int32 int32_3720 = 103720; + int32 int32_3721 = 103721; + int32 int32_3722 = 103722; + int32 int32_3723 = 103723; + int32 int32_3724 = 103724; + int32 int32_3725 = 103725; + int32 int32_3726 = 103726; + int32 int32_3727 = 103727; + int32 int32_3728 = 103728; + int32 int32_3729 = 103729; + int32 int32_3730 = 103730; + int32 int32_3731 = 103731; + int32 int32_3732 = 103732; + int32 int32_3733 = 103733; + int32 int32_3734 = 103734; + int32 int32_3735 = 103735; + int32 int32_3736 = 103736; + int32 int32_3737 = 103737; + int32 int32_3738 = 103738; + int32 int32_3739 = 103739; + int32 int32_3740 = 103740; + int32 int32_3741 = 103741; + int32 int32_3742 = 103742; + int32 int32_3743 = 103743; + int32 int32_3744 = 103744; + int32 int32_3745 = 103745; + int32 int32_3746 = 103746; + int32 int32_3747 = 103747; + int32 int32_3748 = 103748; + int32 int32_3749 = 103749; + int32 int32_3750 = 103750; + int32 int32_3751 = 103751; + int32 int32_3752 = 103752; + int32 int32_3753 = 103753; + int32 int32_3754 = 103754; + int32 int32_3755 = 103755; + int32 int32_3756 = 103756; + int32 int32_3757 = 103757; + int32 int32_3758 = 103758; + int32 int32_3759 = 103759; + int32 int32_3760 = 103760; + int32 int32_3761 = 103761; + int32 int32_3762 = 103762; + int32 int32_3763 = 103763; + int32 int32_3764 = 103764; + int32 int32_3765 = 103765; + int32 int32_3766 = 103766; + int32 int32_3767 = 103767; + int32 int32_3768 = 103768; + int32 int32_3769 = 103769; + int32 int32_3770 = 103770; + int32 int32_3771 = 103771; + int32 int32_3772 = 103772; + int32 int32_3773 = 103773; + int32 int32_3774 = 103774; + int32 int32_3775 = 103775; + int32 int32_3776 = 103776; + int32 int32_3777 = 103777; + int32 int32_3778 = 103778; + int32 int32_3779 = 103779; + int32 int32_3780 = 103780; + int32 int32_3781 = 103781; + int32 int32_3782 = 103782; + int32 int32_3783 = 103783; + int32 int32_3784 = 103784; + int32 int32_3785 = 103785; + int32 int32_3786 = 103786; + int32 int32_3787 = 103787; + int32 int32_3788 = 103788; + int32 int32_3789 = 103789; + int32 int32_3790 = 103790; + int32 int32_3791 = 103791; + int32 int32_3792 = 103792; + int32 int32_3793 = 103793; + int32 int32_3794 = 103794; + int32 int32_3795 = 103795; + int32 int32_3796 = 103796; + int32 int32_3797 = 103797; + int32 int32_3798 = 103798; + int32 int32_3799 = 103799; + int32 int32_3800 = 103800; + int32 int32_3801 = 103801; + int32 int32_3802 = 103802; + int32 int32_3803 = 103803; + int32 int32_3804 = 103804; + int32 int32_3805 = 103805; + int32 int32_3806 = 103806; + int32 int32_3807 = 103807; + int32 int32_3808 = 103808; + int32 int32_3809 = 103809; + int32 int32_3810 = 103810; + int32 int32_3811 = 103811; + int32 int32_3812 = 103812; + int32 int32_3813 = 103813; + int32 int32_3814 = 103814; + int32 int32_3815 = 103815; + int32 int32_3816 = 103816; + int32 int32_3817 = 103817; + int32 int32_3818 = 103818; + int32 int32_3819 = 103819; + int32 int32_3820 = 103820; + int32 int32_3821 = 103821; + int32 int32_3822 = 103822; + int32 int32_3823 = 103823; + int32 int32_3824 = 103824; + int32 int32_3825 = 103825; + int32 int32_3826 = 103826; + int32 int32_3827 = 103827; + int32 int32_3828 = 103828; + int32 int32_3829 = 103829; + int32 int32_3830 = 103830; + int32 int32_3831 = 103831; + int32 int32_3832 = 103832; + int32 int32_3833 = 103833; + int32 int32_3834 = 103834; + int32 int32_3835 = 103835; + int32 int32_3836 = 103836; + int32 int32_3837 = 103837; + int32 int32_3838 = 103838; + int32 int32_3839 = 103839; + int32 int32_3840 = 103840; + int32 int32_3841 = 103841; + int32 int32_3842 = 103842; + int32 int32_3843 = 103843; + int32 int32_3844 = 103844; + int32 int32_3845 = 103845; + int32 int32_3846 = 103846; + int32 int32_3847 = 103847; + int32 int32_3848 = 103848; + int32 int32_3849 = 103849; + int32 int32_3850 = 103850; + int32 int32_3851 = 103851; + int32 int32_3852 = 103852; + int32 int32_3853 = 103853; + int32 int32_3854 = 103854; + int32 int32_3855 = 103855; + int32 int32_3856 = 103856; + int32 int32_3857 = 103857; + int32 int32_3858 = 103858; + int32 int32_3859 = 103859; + int32 int32_3860 = 103860; + int32 int32_3861 = 103861; + int32 int32_3862 = 103862; + int32 int32_3863 = 103863; + int32 int32_3864 = 103864; + int32 int32_3865 = 103865; + int32 int32_3866 = 103866; + int32 int32_3867 = 103867; + int32 int32_3868 = 103868; + int32 int32_3869 = 103869; + int32 int32_3870 = 103870; + int32 int32_3871 = 103871; + int32 int32_3872 = 103872; + int32 int32_3873 = 103873; + int32 int32_3874 = 103874; + int32 int32_3875 = 103875; + int32 int32_3876 = 103876; + int32 int32_3877 = 103877; + int32 int32_3878 = 103878; + int32 int32_3879 = 103879; + int32 int32_3880 = 103880; + int32 int32_3881 = 103881; + int32 int32_3882 = 103882; + int32 int32_3883 = 103883; + int32 int32_3884 = 103884; + int32 int32_3885 = 103885; + int32 int32_3886 = 103886; + int32 int32_3887 = 103887; + int32 int32_3888 = 103888; + int32 int32_3889 = 103889; + int32 int32_3890 = 103890; + int32 int32_3891 = 103891; + int32 int32_3892 = 103892; + int32 int32_3893 = 103893; + int32 int32_3894 = 103894; + int32 int32_3895 = 103895; + int32 int32_3896 = 103896; + int32 int32_3897 = 103897; + int32 int32_3898 = 103898; + int32 int32_3899 = 103899; + int32 int32_3900 = 103900; + int32 int32_3901 = 103901; + int32 int32_3902 = 103902; + int32 int32_3903 = 103903; + int32 int32_3904 = 103904; + int32 int32_3905 = 103905; + int32 int32_3906 = 103906; + int32 int32_3907 = 103907; + int32 int32_3908 = 103908; + int32 int32_3909 = 103909; + int32 int32_3910 = 103910; + int32 int32_3911 = 103911; + int32 int32_3912 = 103912; + int32 int32_3913 = 103913; + int32 int32_3914 = 103914; + int32 int32_3915 = 103915; + int32 int32_3916 = 103916; + int32 int32_3917 = 103917; + int32 int32_3918 = 103918; + int32 int32_3919 = 103919; + int32 int32_3920 = 103920; + int32 int32_3921 = 103921; + int32 int32_3922 = 103922; + int32 int32_3923 = 103923; + int32 int32_3924 = 103924; + int32 int32_3925 = 103925; + int32 int32_3926 = 103926; + int32 int32_3927 = 103927; + int32 int32_3928 = 103928; + int32 int32_3929 = 103929; + int32 int32_3930 = 103930; + int32 int32_3931 = 103931; + int32 int32_3932 = 103932; + int32 int32_3933 = 103933; + int32 int32_3934 = 103934; + int32 int32_3935 = 103935; + int32 int32_3936 = 103936; + int32 int32_3937 = 103937; + int32 int32_3938 = 103938; + int32 int32_3939 = 103939; + int32 int32_3940 = 103940; + int32 int32_3941 = 103941; + int32 int32_3942 = 103942; + int32 int32_3943 = 103943; + int32 int32_3944 = 103944; + int32 int32_3945 = 103945; + int32 int32_3946 = 103946; + int32 int32_3947 = 103947; + int32 int32_3948 = 103948; + int32 int32_3949 = 103949; + int32 int32_3950 = 103950; + int32 int32_3951 = 103951; + int32 int32_3952 = 103952; + int32 int32_3953 = 103953; + int32 int32_3954 = 103954; + int32 int32_3955 = 103955; + int32 int32_3956 = 103956; + int32 int32_3957 = 103957; + int32 int32_3958 = 103958; + int32 int32_3959 = 103959; + int32 int32_3960 = 103960; + int32 int32_3961 = 103961; + int32 int32_3962 = 103962; + int32 int32_3963 = 103963; + int32 int32_3964 = 103964; + int32 int32_3965 = 103965; + int32 int32_3966 = 103966; + int32 int32_3967 = 103967; + int32 int32_3968 = 103968; + int32 int32_3969 = 103969; + int32 int32_3970 = 103970; + int32 int32_3971 = 103971; + int32 int32_3972 = 103972; + int32 int32_3973 = 103973; + int32 int32_3974 = 103974; + int32 int32_3975 = 103975; + int32 int32_3976 = 103976; + int32 int32_3977 = 103977; + int32 int32_3978 = 103978; + int32 int32_3979 = 103979; + int32 int32_3980 = 103980; + int32 int32_3981 = 103981; + int32 int32_3982 = 103982; + int32 int32_3983 = 103983; + int32 int32_3984 = 103984; + int32 int32_3985 = 103985; + int32 int32_3986 = 103986; + int32 int32_3987 = 103987; + int32 int32_3988 = 103988; + int32 int32_3989 = 103989; + int32 int32_3990 = 103990; + int32 int32_3991 = 103991; + int32 int32_3992 = 103992; + int32 int32_3993 = 103993; + int32 int32_3994 = 103994; + int32 int32_3995 = 103995; + int32 int32_3996 = 103996; + int32 int32_3997 = 103997; + int32 int32_3998 = 103998; + int32 int32_3999 = 103999; + int32 int32_4000 = 104000; + int32 int32_4001 = 104001; + int32 int32_4002 = 104002; + int32 int32_4003 = 104003; + int32 int32_4004 = 104004; + int32 int32_4005 = 104005; + int32 int32_4006 = 104006; + int32 int32_4007 = 104007; + int32 int32_4008 = 104008; + int32 int32_4009 = 104009; + int32 int32_4010 = 104010; + int32 int32_4011 = 104011; + int32 int32_4012 = 104012; + int32 int32_4013 = 104013; + int32 int32_4014 = 104014; + int32 int32_4015 = 104015; + int32 int32_4016 = 104016; + int32 int32_4017 = 104017; + int32 int32_4018 = 104018; + int32 int32_4019 = 104019; + int32 int32_4020 = 104020; + int32 int32_4021 = 104021; + int32 int32_4022 = 104022; + int32 int32_4023 = 104023; + int32 int32_4024 = 104024; + int32 int32_4025 = 104025; + int32 int32_4026 = 104026; + int32 int32_4027 = 104027; + int32 int32_4028 = 104028; + int32 int32_4029 = 104029; + int32 int32_4030 = 104030; + int32 int32_4031 = 104031; + int32 int32_4032 = 104032; + int32 int32_4033 = 104033; + int32 int32_4034 = 104034; + int32 int32_4035 = 104035; + int32 int32_4036 = 104036; + int32 int32_4037 = 104037; + int32 int32_4038 = 104038; + int32 int32_4039 = 104039; + int32 int32_4040 = 104040; + int32 int32_4041 = 104041; + int32 int32_4042 = 104042; + int32 int32_4043 = 104043; + int32 int32_4044 = 104044; + int32 int32_4045 = 104045; + int32 int32_4046 = 104046; + int32 int32_4047 = 104047; + int32 int32_4048 = 104048; + int32 int32_4049 = 104049; + int32 int32_4050 = 104050; + int32 int32_4051 = 104051; + int32 int32_4052 = 104052; + int32 int32_4053 = 104053; + int32 int32_4054 = 104054; + int32 int32_4055 = 104055; + int32 int32_4056 = 104056; + int32 int32_4057 = 104057; + int32 int32_4058 = 104058; + int32 int32_4059 = 104059; + int32 int32_4060 = 104060; + int32 int32_4061 = 104061; + int32 int32_4062 = 104062; + int32 int32_4063 = 104063; + int32 int32_4064 = 104064; + int32 int32_4065 = 104065; + int32 int32_4066 = 104066; + int32 int32_4067 = 104067; + int32 int32_4068 = 104068; + int32 int32_4069 = 104069; + int32 int32_4070 = 104070; + int32 int32_4071 = 104071; + int32 int32_4072 = 104072; + int32 int32_4073 = 104073; + int32 int32_4074 = 104074; + int32 int32_4075 = 104075; + int32 int32_4076 = 104076; + int32 int32_4077 = 104077; + int32 int32_4078 = 104078; + int32 int32_4079 = 104079; + int32 int32_4080 = 104080; + int32 int32_4081 = 104081; + int32 int32_4082 = 104082; + int32 int32_4083 = 104083; + int32 int32_4084 = 104084; + int32 int32_4085 = 104085; + int32 int32_4086 = 104086; + int32 int32_4087 = 104087; + int32 int32_4088 = 104088; + int32 int32_4089 = 104089; + int32 int32_4090 = 104090; + int32 int32_4091 = 104091; + int32 int32_4092 = 104092; + int32 int32_4093 = 104093; + int32 int32_4094 = 104094; + int32 int32_4095 = 104095; + int32 int32_4096 = 104096; + int32 int32_4097 = 104097; + int32 int32_4098 = 104098; + int32 int32_4099 = 104099; + int32 int32_4100 = 104100; + int32 int32_4101 = 104101; + int32 int32_4102 = 104102; + int32 int32_4103 = 104103; + int32 int32_4104 = 104104; + int32 int32_4105 = 104105; + int32 int32_4106 = 104106; + int32 int32_4107 = 104107; + int32 int32_4108 = 104108; + int32 int32_4109 = 104109; + int32 int32_4110 = 104110; + int32 int32_4111 = 104111; + int32 int32_4112 = 104112; + int32 int32_4113 = 104113; + int32 int32_4114 = 104114; + int32 int32_4115 = 104115; + int32 int32_4116 = 104116; + int32 int32_4117 = 104117; + int32 int32_4118 = 104118; + int32 int32_4119 = 104119; + int32 int32_4120 = 104120; + int32 int32_4121 = 104121; + int32 int32_4122 = 104122; + int32 int32_4123 = 104123; + int32 int32_4124 = 104124; + int32 int32_4125 = 104125; + int32 int32_4126 = 104126; + int32 int32_4127 = 104127; + int32 int32_4128 = 104128; + int32 int32_4129 = 104129; + int32 int32_4130 = 104130; + int32 int32_4131 = 104131; + int32 int32_4132 = 104132; + int32 int32_4133 = 104133; + int32 int32_4134 = 104134; + int32 int32_4135 = 104135; + int32 int32_4136 = 104136; + int32 int32_4137 = 104137; + int32 int32_4138 = 104138; + int32 int32_4139 = 104139; + int32 int32_4140 = 104140; + int32 int32_4141 = 104141; + int32 int32_4142 = 104142; + int32 int32_4143 = 104143; + int32 int32_4144 = 104144; + int32 int32_4145 = 104145; + int32 int32_4146 = 104146; + int32 int32_4147 = 104147; + int32 int32_4148 = 104148; + int32 int32_4149 = 104149; + int32 int32_4150 = 104150; + int32 int32_4151 = 104151; + int32 int32_4152 = 104152; + int32 int32_4153 = 104153; + int32 int32_4154 = 104154; + int32 int32_4155 = 104155; + int32 int32_4156 = 104156; + int32 int32_4157 = 104157; + int32 int32_4158 = 104158; + int32 int32_4159 = 104159; + int32 int32_4160 = 104160; + int32 int32_4161 = 104161; + int32 int32_4162 = 104162; + int32 int32_4163 = 104163; + int32 int32_4164 = 104164; + int32 int32_4165 = 104165; + int32 int32_4166 = 104166; + int32 int32_4167 = 104167; + int32 int32_4168 = 104168; + int32 int32_4169 = 104169; + int32 int32_4170 = 104170; + int32 int32_4171 = 104171; + int32 int32_4172 = 104172; + int32 int32_4173 = 104173; + int32 int32_4174 = 104174; + int32 int32_4175 = 104175; + int32 int32_4176 = 104176; + int32 int32_4177 = 104177; + int32 int32_4178 = 104178; + int32 int32_4179 = 104179; + int32 int32_4180 = 104180; + int32 int32_4181 = 104181; + int32 int32_4182 = 104182; + int32 int32_4183 = 104183; + int32 int32_4184 = 104184; + int32 int32_4185 = 104185; + int32 int32_4186 = 104186; + int32 int32_4187 = 104187; + int32 int32_4188 = 104188; + int32 int32_4189 = 104189; + int32 int32_4190 = 104190; + int32 int32_4191 = 104191; + int32 int32_4192 = 104192; + int32 int32_4193 = 104193; + int32 int32_4194 = 104194; + int32 int32_4195 = 104195; + int32 int32_4196 = 104196; + int32 int32_4197 = 104197; + int32 int32_4198 = 104198; + int32 int32_4199 = 104199; + int32 int32_4200 = 104200; + int32 int32_4201 = 104201; + int32 int32_4202 = 104202; + int32 int32_4203 = 104203; + int32 int32_4204 = 104204; + int32 int32_4205 = 104205; + int32 int32_4206 = 104206; + int32 int32_4207 = 104207; + int32 int32_4208 = 104208; + int32 int32_4209 = 104209; + int32 int32_4210 = 104210; + int32 int32_4211 = 104211; + int32 int32_4212 = 104212; + int32 int32_4213 = 104213; + int32 int32_4214 = 104214; + int32 int32_4215 = 104215; + int32 int32_4216 = 104216; + int32 int32_4217 = 104217; + int32 int32_4218 = 104218; + int32 int32_4219 = 104219; + int32 int32_4220 = 104220; + int32 int32_4221 = 104221; + int32 int32_4222 = 104222; + int32 int32_4223 = 104223; + int32 int32_4224 = 104224; + int32 int32_4225 = 104225; + int32 int32_4226 = 104226; + int32 int32_4227 = 104227; + int32 int32_4228 = 104228; + int32 int32_4229 = 104229; + int32 int32_4230 = 104230; + int32 int32_4231 = 104231; + int32 int32_4232 = 104232; + int32 int32_4233 = 104233; + int32 int32_4234 = 104234; + int32 int32_4235 = 104235; + int32 int32_4236 = 104236; + int32 int32_4237 = 104237; + int32 int32_4238 = 104238; + int32 int32_4239 = 104239; + int32 int32_4240 = 104240; + int32 int32_4241 = 104241; + int32 int32_4242 = 104242; + int32 int32_4243 = 104243; + int32 int32_4244 = 104244; + int32 int32_4245 = 104245; + int32 int32_4246 = 104246; + int32 int32_4247 = 104247; + int32 int32_4248 = 104248; + int32 int32_4249 = 104249; + int32 int32_4250 = 104250; + int32 int32_4251 = 104251; + int32 int32_4252 = 104252; + int32 int32_4253 = 104253; + int32 int32_4254 = 104254; + int32 int32_4255 = 104255; + int32 int32_4256 = 104256; + int32 int32_4257 = 104257; + int32 int32_4258 = 104258; + int32 int32_4259 = 104259; + int32 int32_4260 = 104260; + int32 int32_4261 = 104261; + int32 int32_4262 = 104262; + int32 int32_4263 = 104263; + int32 int32_4264 = 104264; + int32 int32_4265 = 104265; + int32 int32_4266 = 104266; + int32 int32_4267 = 104267; + int32 int32_4268 = 104268; + int32 int32_4269 = 104269; + int32 int32_4270 = 104270; + int32 int32_4271 = 104271; + int32 int32_4272 = 104272; + int32 int32_4273 = 104273; + int32 int32_4274 = 104274; + int32 int32_4275 = 104275; + int32 int32_4276 = 104276; + int32 int32_4277 = 104277; + int32 int32_4278 = 104278; + int32 int32_4279 = 104279; + int32 int32_4280 = 104280; + int32 int32_4281 = 104281; + int32 int32_4282 = 104282; + int32 int32_4283 = 104283; + int32 int32_4284 = 104284; + int32 int32_4285 = 104285; + int32 int32_4286 = 104286; + int32 int32_4287 = 104287; + int32 int32_4288 = 104288; + int32 int32_4289 = 104289; + int32 int32_4290 = 104290; + int32 int32_4291 = 104291; + int32 int32_4292 = 104292; + int32 int32_4293 = 104293; + int32 int32_4294 = 104294; + int32 int32_4295 = 104295; + int32 int32_4296 = 104296; + int32 int32_4297 = 104297; + int32 int32_4298 = 104298; + int32 int32_4299 = 104299; + int32 int32_4300 = 104300; + int32 int32_4301 = 104301; + int32 int32_4302 = 104302; + int32 int32_4303 = 104303; + int32 int32_4304 = 104304; + int32 int32_4305 = 104305; + int32 int32_4306 = 104306; + int32 int32_4307 = 104307; + int32 int32_4308 = 104308; + int32 int32_4309 = 104309; + int32 int32_4310 = 104310; + int32 int32_4311 = 104311; + int32 int32_4312 = 104312; + int32 int32_4313 = 104313; + int32 int32_4314 = 104314; + int32 int32_4315 = 104315; + int32 int32_4316 = 104316; + int32 int32_4317 = 104317; + int32 int32_4318 = 104318; + int32 int32_4319 = 104319; + int32 int32_4320 = 104320; + int32 int32_4321 = 104321; + int32 int32_4322 = 104322; + int32 int32_4323 = 104323; + int32 int32_4324 = 104324; + int32 int32_4325 = 104325; + int32 int32_4326 = 104326; + int32 int32_4327 = 104327; + int32 int32_4328 = 104328; + int32 int32_4329 = 104329; + int32 int32_4330 = 104330; + int32 int32_4331 = 104331; + int32 int32_4332 = 104332; + int32 int32_4333 = 104333; + int32 int32_4334 = 104334; + int32 int32_4335 = 104335; + int32 int32_4336 = 104336; + int32 int32_4337 = 104337; + int32 int32_4338 = 104338; + int32 int32_4339 = 104339; + int32 int32_4340 = 104340; + int32 int32_4341 = 104341; + int32 int32_4342 = 104342; + int32 int32_4343 = 104343; + int32 int32_4344 = 104344; + int32 int32_4345 = 104345; + int32 int32_4346 = 104346; + int32 int32_4347 = 104347; + int32 int32_4348 = 104348; + int32 int32_4349 = 104349; + int32 int32_4350 = 104350; + int32 int32_4351 = 104351; + int32 int32_4352 = 104352; + int32 int32_4353 = 104353; + int32 int32_4354 = 104354; + int32 int32_4355 = 104355; + int32 int32_4356 = 104356; + int32 int32_4357 = 104357; + int32 int32_4358 = 104358; + int32 int32_4359 = 104359; + int32 int32_4360 = 104360; + int32 int32_4361 = 104361; + int32 int32_4362 = 104362; + int32 int32_4363 = 104363; + int32 int32_4364 = 104364; + int32 int32_4365 = 104365; + int32 int32_4366 = 104366; + int32 int32_4367 = 104367; + int32 int32_4368 = 104368; + int32 int32_4369 = 104369; + int32 int32_4370 = 104370; + int32 int32_4371 = 104371; + int32 int32_4372 = 104372; + int32 int32_4373 = 104373; + int32 int32_4374 = 104374; + int32 int32_4375 = 104375; + int32 int32_4376 = 104376; + int32 int32_4377 = 104377; + int32 int32_4378 = 104378; + int32 int32_4379 = 104379; + int32 int32_4380 = 104380; + int32 int32_4381 = 104381; + int32 int32_4382 = 104382; + int32 int32_4383 = 104383; + int32 int32_4384 = 104384; + int32 int32_4385 = 104385; + int32 int32_4386 = 104386; + int32 int32_4387 = 104387; + int32 int32_4388 = 104388; + int32 int32_4389 = 104389; + int32 int32_4390 = 104390; + int32 int32_4391 = 104391; + int32 int32_4392 = 104392; + int32 int32_4393 = 104393; + int32 int32_4394 = 104394; + int32 int32_4395 = 104395; + int32 int32_4396 = 104396; + int32 int32_4397 = 104397; + int32 int32_4398 = 104398; + int32 int32_4399 = 104399; + int32 int32_4400 = 104400; + int32 int32_4401 = 104401; + int32 int32_4402 = 104402; + int32 int32_4403 = 104403; + int32 int32_4404 = 104404; + int32 int32_4405 = 104405; + int32 int32_4406 = 104406; + int32 int32_4407 = 104407; + int32 int32_4408 = 104408; + int32 int32_4409 = 104409; + int32 int32_4410 = 104410; + int32 int32_4411 = 104411; + int32 int32_4412 = 104412; + int32 int32_4413 = 104413; + int32 int32_4414 = 104414; + int32 int32_4415 = 104415; + int32 int32_4416 = 104416; + int32 int32_4417 = 104417; + int32 int32_4418 = 104418; + int32 int32_4419 = 104419; + int32 int32_4420 = 104420; + int32 int32_4421 = 104421; + int32 int32_4422 = 104422; + int32 int32_4423 = 104423; + int32 int32_4424 = 104424; + int32 int32_4425 = 104425; + int32 int32_4426 = 104426; + int32 int32_4427 = 104427; + int32 int32_4428 = 104428; + int32 int32_4429 = 104429; + int32 int32_4430 = 104430; + int32 int32_4431 = 104431; + int32 int32_4432 = 104432; + int32 int32_4433 = 104433; + int32 int32_4434 = 104434; + int32 int32_4435 = 104435; + int32 int32_4436 = 104436; + int32 int32_4437 = 104437; + int32 int32_4438 = 104438; + int32 int32_4439 = 104439; + int32 int32_4440 = 104440; + int32 int32_4441 = 104441; + int32 int32_4442 = 104442; + int32 int32_4443 = 104443; + int32 int32_4444 = 104444; + int32 int32_4445 = 104445; + int32 int32_4446 = 104446; + int32 int32_4447 = 104447; + int32 int32_4448 = 104448; + int32 int32_4449 = 104449; + int32 int32_4450 = 104450; + int32 int32_4451 = 104451; + int32 int32_4452 = 104452; + int32 int32_4453 = 104453; + int32 int32_4454 = 104454; + int32 int32_4455 = 104455; + int32 int32_4456 = 104456; + int32 int32_4457 = 104457; + int32 int32_4458 = 104458; + int32 int32_4459 = 104459; + int32 int32_4460 = 104460; + int32 int32_4461 = 104461; + int32 int32_4462 = 104462; + int32 int32_4463 = 104463; + int32 int32_4464 = 104464; + int32 int32_4465 = 104465; + int32 int32_4466 = 104466; + int32 int32_4467 = 104467; + int32 int32_4468 = 104468; + int32 int32_4469 = 104469; + int32 int32_4470 = 104470; + int32 int32_4471 = 104471; + int32 int32_4472 = 104472; + int32 int32_4473 = 104473; + int32 int32_4474 = 104474; + int32 int32_4475 = 104475; + int32 int32_4476 = 104476; + int32 int32_4477 = 104477; + int32 int32_4478 = 104478; + int32 int32_4479 = 104479; + int32 int32_4480 = 104480; + int32 int32_4481 = 104481; + int32 int32_4482 = 104482; + int32 int32_4483 = 104483; + int32 int32_4484 = 104484; + int32 int32_4485 = 104485; + int32 int32_4486 = 104486; + int32 int32_4487 = 104487; + int32 int32_4488 = 104488; + int32 int32_4489 = 104489; + int32 int32_4490 = 104490; + int32 int32_4491 = 104491; + int32 int32_4492 = 104492; + int32 int32_4493 = 104493; + int32 int32_4494 = 104494; + int32 int32_4495 = 104495; + int32 int32_4496 = 104496; + int32 int32_4497 = 104497; + int32 int32_4498 = 104498; + int32 int32_4499 = 104499; + int32 int32_4500 = 104500; + int32 int32_4501 = 104501; + int32 int32_4502 = 104502; + int32 int32_4503 = 104503; + int32 int32_4504 = 104504; + int32 int32_4505 = 104505; + int32 int32_4506 = 104506; + int32 int32_4507 = 104507; + int32 int32_4508 = 104508; + int32 int32_4509 = 104509; + int32 int32_4510 = 104510; + int32 int32_4511 = 104511; + int32 int32_4512 = 104512; + int32 int32_4513 = 104513; + int32 int32_4514 = 104514; + int32 int32_4515 = 104515; + int32 int32_4516 = 104516; + int32 int32_4517 = 104517; + int32 int32_4518 = 104518; + int32 int32_4519 = 104519; + int32 int32_4520 = 104520; + int32 int32_4521 = 104521; + int32 int32_4522 = 104522; + int32 int32_4523 = 104523; + int32 int32_4524 = 104524; + int32 int32_4525 = 104525; + int32 int32_4526 = 104526; + int32 int32_4527 = 104527; + int32 int32_4528 = 104528; + int32 int32_4529 = 104529; + int32 int32_4530 = 104530; + int32 int32_4531 = 104531; + int32 int32_4532 = 104532; + int32 int32_4533 = 104533; + int32 int32_4534 = 104534; + int32 int32_4535 = 104535; + int32 int32_4536 = 104536; + int32 int32_4537 = 104537; + int32 int32_4538 = 104538; + int32 int32_4539 = 104539; + int32 int32_4540 = 104540; + int32 int32_4541 = 104541; + int32 int32_4542 = 104542; + int32 int32_4543 = 104543; + int32 int32_4544 = 104544; + int32 int32_4545 = 104545; + int32 int32_4546 = 104546; + int32 int32_4547 = 104547; + int32 int32_4548 = 104548; + int32 int32_4549 = 104549; + int32 int32_4550 = 104550; + int32 int32_4551 = 104551; + int32 int32_4552 = 104552; + int32 int32_4553 = 104553; + int32 int32_4554 = 104554; + int32 int32_4555 = 104555; + int32 int32_4556 = 104556; + int32 int32_4557 = 104557; + int32 int32_4558 = 104558; + int32 int32_4559 = 104559; + int32 int32_4560 = 104560; + int32 int32_4561 = 104561; + int32 int32_4562 = 104562; + int32 int32_4563 = 104563; + int32 int32_4564 = 104564; + int32 int32_4565 = 104565; + int32 int32_4566 = 104566; + int32 int32_4567 = 104567; + int32 int32_4568 = 104568; + int32 int32_4569 = 104569; + int32 int32_4570 = 104570; + int32 int32_4571 = 104571; + int32 int32_4572 = 104572; + int32 int32_4573 = 104573; + int32 int32_4574 = 104574; + int32 int32_4575 = 104575; + int32 int32_4576 = 104576; + int32 int32_4577 = 104577; + int32 int32_4578 = 104578; + int32 int32_4579 = 104579; + int32 int32_4580 = 104580; + int32 int32_4581 = 104581; + int32 int32_4582 = 104582; + int32 int32_4583 = 104583; + int32 int32_4584 = 104584; + int32 int32_4585 = 104585; + int32 int32_4586 = 104586; + int32 int32_4587 = 104587; + int32 int32_4588 = 104588; + int32 int32_4589 = 104589; + int32 int32_4590 = 104590; + int32 int32_4591 = 104591; + int32 int32_4592 = 104592; + int32 int32_4593 = 104593; + int32 int32_4594 = 104594; + int32 int32_4595 = 104595; + int32 int32_4596 = 104596; + int32 int32_4597 = 104597; + int32 int32_4598 = 104598; + int32 int32_4599 = 104599; + int32 int32_4600 = 104600; + int32 int32_4601 = 104601; + int32 int32_4602 = 104602; + int32 int32_4603 = 104603; + int32 int32_4604 = 104604; + int32 int32_4605 = 104605; + int32 int32_4606 = 104606; + int32 int32_4607 = 104607; + int32 int32_4608 = 104608; + int32 int32_4609 = 104609; + int32 int32_4610 = 104610; + int32 int32_4611 = 104611; + int32 int32_4612 = 104612; + int32 int32_4613 = 104613; + int32 int32_4614 = 104614; + int32 int32_4615 = 104615; + int32 int32_4616 = 104616; + int32 int32_4617 = 104617; + int32 int32_4618 = 104618; + int32 int32_4619 = 104619; + int32 int32_4620 = 104620; + int32 int32_4621 = 104621; + int32 int32_4622 = 104622; + int32 int32_4623 = 104623; + int32 int32_4624 = 104624; + int32 int32_4625 = 104625; + int32 int32_4626 = 104626; + int32 int32_4627 = 104627; + int32 int32_4628 = 104628; + int32 int32_4629 = 104629; + int32 int32_4630 = 104630; + int32 int32_4631 = 104631; + int32 int32_4632 = 104632; + int32 int32_4633 = 104633; + int32 int32_4634 = 104634; + int32 int32_4635 = 104635; + int32 int32_4636 = 104636; + int32 int32_4637 = 104637; + int32 int32_4638 = 104638; + int32 int32_4639 = 104639; + int32 int32_4640 = 104640; + int32 int32_4641 = 104641; + int32 int32_4642 = 104642; + int32 int32_4643 = 104643; + int32 int32_4644 = 104644; + int32 int32_4645 = 104645; + int32 int32_4646 = 104646; + int32 int32_4647 = 104647; + int32 int32_4648 = 104648; + int32 int32_4649 = 104649; + int32 int32_4650 = 104650; + int32 int32_4651 = 104651; + int32 int32_4652 = 104652; + int32 int32_4653 = 104653; + int32 int32_4654 = 104654; + int32 int32_4655 = 104655; + int32 int32_4656 = 104656; + int32 int32_4657 = 104657; + int32 int32_4658 = 104658; + int32 int32_4659 = 104659; + int32 int32_4660 = 104660; + int32 int32_4661 = 104661; + int32 int32_4662 = 104662; + int32 int32_4663 = 104663; + int32 int32_4664 = 104664; + int32 int32_4665 = 104665; + int32 int32_4666 = 104666; + int32 int32_4667 = 104667; + int32 int32_4668 = 104668; + int32 int32_4669 = 104669; + int32 int32_4670 = 104670; + int32 int32_4671 = 104671; + int32 int32_4672 = 104672; + int32 int32_4673 = 104673; + int32 int32_4674 = 104674; + int32 int32_4675 = 104675; + int32 int32_4676 = 104676; + int32 int32_4677 = 104677; + int32 int32_4678 = 104678; + int32 int32_4679 = 104679; + int32 int32_4680 = 104680; + int32 int32_4681 = 104681; + int32 int32_4682 = 104682; + int32 int32_4683 = 104683; + int32 int32_4684 = 104684; + int32 int32_4685 = 104685; + int32 int32_4686 = 104686; + int32 int32_4687 = 104687; + int32 int32_4688 = 104688; + int32 int32_4689 = 104689; + int32 int32_4690 = 104690; + int32 int32_4691 = 104691; + int32 int32_4692 = 104692; + int32 int32_4693 = 104693; + int32 int32_4694 = 104694; + int32 int32_4695 = 104695; + int32 int32_4696 = 104696; + int32 int32_4697 = 104697; + int32 int32_4698 = 104698; + int32 int32_4699 = 104699; + int32 int32_4700 = 104700; + int32 int32_4701 = 104701; + int32 int32_4702 = 104702; + int32 int32_4703 = 104703; + int32 int32_4704 = 104704; + int32 int32_4705 = 104705; + int32 int32_4706 = 104706; + int32 int32_4707 = 104707; + int32 int32_4708 = 104708; + int32 int32_4709 = 104709; + int32 int32_4710 = 104710; + int32 int32_4711 = 104711; + int32 int32_4712 = 104712; + int32 int32_4713 = 104713; + int32 int32_4714 = 104714; + int32 int32_4715 = 104715; + int32 int32_4716 = 104716; + int32 int32_4717 = 104717; + int32 int32_4718 = 104718; + int32 int32_4719 = 104719; + int32 int32_4720 = 104720; + int32 int32_4721 = 104721; + int32 int32_4722 = 104722; + int32 int32_4723 = 104723; + int32 int32_4724 = 104724; + int32 int32_4725 = 104725; + int32 int32_4726 = 104726; + int32 int32_4727 = 104727; + int32 int32_4728 = 104728; + int32 int32_4729 = 104729; + int32 int32_4730 = 104730; + int32 int32_4731 = 104731; + int32 int32_4732 = 104732; + int32 int32_4733 = 104733; + int32 int32_4734 = 104734; + int32 int32_4735 = 104735; + int32 int32_4736 = 104736; + int32 int32_4737 = 104737; + int32 int32_4738 = 104738; + int32 int32_4739 = 104739; + int32 int32_4740 = 104740; + int32 int32_4741 = 104741; + int32 int32_4742 = 104742; + int32 int32_4743 = 104743; + int32 int32_4744 = 104744; + int32 int32_4745 = 104745; + int32 int32_4746 = 104746; + int32 int32_4747 = 104747; + int32 int32_4748 = 104748; + int32 int32_4749 = 104749; + int32 int32_4750 = 104750; + int32 int32_4751 = 104751; + int32 int32_4752 = 104752; + int32 int32_4753 = 104753; + int32 int32_4754 = 104754; + int32 int32_4755 = 104755; + int32 int32_4756 = 104756; + int32 int32_4757 = 104757; + int32 int32_4758 = 104758; + int32 int32_4759 = 104759; + int32 int32_4760 = 104760; + int32 int32_4761 = 104761; + int32 int32_4762 = 104762; + int32 int32_4763 = 104763; + int32 int32_4764 = 104764; + int32 int32_4765 = 104765; + int32 int32_4766 = 104766; + int32 int32_4767 = 104767; + int32 int32_4768 = 104768; + int32 int32_4769 = 104769; + int32 int32_4770 = 104770; + int32 int32_4771 = 104771; + int32 int32_4772 = 104772; + int32 int32_4773 = 104773; + int32 int32_4774 = 104774; + int32 int32_4775 = 104775; + int32 int32_4776 = 104776; + int32 int32_4777 = 104777; + int32 int32_4778 = 104778; + int32 int32_4779 = 104779; + int32 int32_4780 = 104780; + int32 int32_4781 = 104781; + int32 int32_4782 = 104782; + int32 int32_4783 = 104783; + int32 int32_4784 = 104784; + int32 int32_4785 = 104785; + int32 int32_4786 = 104786; + int32 int32_4787 = 104787; + int32 int32_4788 = 104788; + int32 int32_4789 = 104789; + int32 int32_4790 = 104790; + int32 int32_4791 = 104791; + int32 int32_4792 = 104792; + int32 int32_4793 = 104793; + int32 int32_4794 = 104794; + int32 int32_4795 = 104795; + int32 int32_4796 = 104796; + int32 int32_4797 = 104797; + int32 int32_4798 = 104798; + int32 int32_4799 = 104799; + int32 int32_4800 = 104800; + int32 int32_4801 = 104801; + int32 int32_4802 = 104802; + int32 int32_4803 = 104803; + int32 int32_4804 = 104804; + int32 int32_4805 = 104805; + int32 int32_4806 = 104806; + int32 int32_4807 = 104807; + int32 int32_4808 = 104808; + int32 int32_4809 = 104809; + int32 int32_4810 = 104810; + int32 int32_4811 = 104811; + int32 int32_4812 = 104812; + int32 int32_4813 = 104813; + int32 int32_4814 = 104814; + int32 int32_4815 = 104815; + int32 int32_4816 = 104816; + int32 int32_4817 = 104817; + int32 int32_4818 = 104818; + int32 int32_4819 = 104819; + int32 int32_4820 = 104820; + int32 int32_4821 = 104821; + int32 int32_4822 = 104822; + int32 int32_4823 = 104823; + int32 int32_4824 = 104824; + int32 int32_4825 = 104825; + int32 int32_4826 = 104826; + int32 int32_4827 = 104827; + int32 int32_4828 = 104828; + int32 int32_4829 = 104829; + int32 int32_4830 = 104830; + int32 int32_4831 = 104831; + int32 int32_4832 = 104832; + int32 int32_4833 = 104833; + int32 int32_4834 = 104834; + int32 int32_4835 = 104835; + int32 int32_4836 = 104836; + int32 int32_4837 = 104837; + int32 int32_4838 = 104838; + int32 int32_4839 = 104839; + int32 int32_4840 = 104840; + int32 int32_4841 = 104841; + int32 int32_4842 = 104842; + int32 int32_4843 = 104843; + int32 int32_4844 = 104844; + int32 int32_4845 = 104845; + int32 int32_4846 = 104846; + int32 int32_4847 = 104847; + int32 int32_4848 = 104848; + int32 int32_4849 = 104849; + int32 int32_4850 = 104850; + int32 int32_4851 = 104851; + int32 int32_4852 = 104852; + int32 int32_4853 = 104853; + int32 int32_4854 = 104854; + int32 int32_4855 = 104855; + int32 int32_4856 = 104856; + int32 int32_4857 = 104857; + int32 int32_4858 = 104858; + int32 int32_4859 = 104859; + int32 int32_4860 = 104860; + int32 int32_4861 = 104861; + int32 int32_4862 = 104862; + int32 int32_4863 = 104863; + int32 int32_4864 = 104864; + int32 int32_4865 = 104865; + int32 int32_4866 = 104866; + int32 int32_4867 = 104867; + int32 int32_4868 = 104868; + int32 int32_4869 = 104869; + int32 int32_4870 = 104870; + int32 int32_4871 = 104871; + int32 int32_4872 = 104872; + int32 int32_4873 = 104873; + int32 int32_4874 = 104874; + int32 int32_4875 = 104875; + int32 int32_4876 = 104876; + int32 int32_4877 = 104877; + int32 int32_4878 = 104878; + int32 int32_4879 = 104879; + int32 int32_4880 = 104880; + int32 int32_4881 = 104881; + int32 int32_4882 = 104882; + int32 int32_4883 = 104883; + int32 int32_4884 = 104884; + int32 int32_4885 = 104885; + int32 int32_4886 = 104886; + int32 int32_4887 = 104887; + int32 int32_4888 = 104888; + int32 int32_4889 = 104889; + int32 int32_4890 = 104890; + int32 int32_4891 = 104891; + int32 int32_4892 = 104892; + int32 int32_4893 = 104893; + int32 int32_4894 = 104894; + int32 int32_4895 = 104895; + int32 int32_4896 = 104896; + int32 int32_4897 = 104897; + int32 int32_4898 = 104898; + int32 int32_4899 = 104899; + int32 int32_4900 = 104900; + int32 int32_4901 = 104901; + int32 int32_4902 = 104902; + int32 int32_4903 = 104903; + int32 int32_4904 = 104904; + int32 int32_4905 = 104905; + int32 int32_4906 = 104906; + int32 int32_4907 = 104907; + int32 int32_4908 = 104908; + int32 int32_4909 = 104909; + int32 int32_4910 = 104910; + int32 int32_4911 = 104911; + int32 int32_4912 = 104912; + int32 int32_4913 = 104913; + int32 int32_4914 = 104914; + int32 int32_4915 = 104915; + int32 int32_4916 = 104916; + int32 int32_4917 = 104917; + int32 int32_4918 = 104918; + int32 int32_4919 = 104919; + int32 int32_4920 = 104920; + int32 int32_4921 = 104921; + int32 int32_4922 = 104922; + int32 int32_4923 = 104923; + int32 int32_4924 = 104924; + int32 int32_4925 = 104925; + int32 int32_4926 = 104926; + int32 int32_4927 = 104927; + int32 int32_4928 = 104928; + int32 int32_4929 = 104929; + int32 int32_4930 = 104930; + int32 int32_4931 = 104931; + int32 int32_4932 = 104932; + int32 int32_4933 = 104933; + int32 int32_4934 = 104934; + int32 int32_4935 = 104935; + int32 int32_4936 = 104936; + int32 int32_4937 = 104937; + int32 int32_4938 = 104938; + int32 int32_4939 = 104939; + int32 int32_4940 = 104940; + int32 int32_4941 = 104941; + int32 int32_4942 = 104942; + int32 int32_4943 = 104943; + int32 int32_4944 = 104944; + int32 int32_4945 = 104945; + int32 int32_4946 = 104946; + int32 int32_4947 = 104947; + int32 int32_4948 = 104948; + int32 int32_4949 = 104949; + int32 int32_4950 = 104950; + int32 int32_4951 = 104951; + int32 int32_4952 = 104952; + int32 int32_4953 = 104953; + int32 int32_4954 = 104954; + int32 int32_4955 = 104955; + int32 int32_4956 = 104956; + int32 int32_4957 = 104957; + int32 int32_4958 = 104958; + int32 int32_4959 = 104959; + int32 int32_4960 = 104960; + int32 int32_4961 = 104961; + int32 int32_4962 = 104962; + int32 int32_4963 = 104963; + int32 int32_4964 = 104964; + int32 int32_4965 = 104965; + int32 int32_4966 = 104966; + int32 int32_4967 = 104967; + int32 int32_4968 = 104968; + int32 int32_4969 = 104969; + int32 int32_4970 = 104970; + int32 int32_4971 = 104971; + int32 int32_4972 = 104972; + int32 int32_4973 = 104973; + int32 int32_4974 = 104974; + int32 int32_4975 = 104975; + int32 int32_4976 = 104976; + int32 int32_4977 = 104977; + int32 int32_4978 = 104978; + int32 int32_4979 = 104979; + int32 int32_4980 = 104980; + int32 int32_4981 = 104981; + int32 int32_4982 = 104982; + int32 int32_4983 = 104983; + int32 int32_4984 = 104984; + int32 int32_4985 = 104985; + int32 int32_4986 = 104986; + int32 int32_4987 = 104987; + int32 int32_4988 = 104988; + int32 int32_4989 = 104989; + int32 int32_4990 = 104990; + int32 int32_4991 = 104991; + int32 int32_4992 = 104992; + int32 int32_4993 = 104993; + int32 int32_4994 = 104994; + int32 int32_4995 = 104995; + int32 int32_4996 = 104996; + int32 int32_4997 = 104997; + int32 int32_4998 = 104998; + int32 int32_4999 = 104999; + int32 int32_5000 = 105000; + int32 int32_5001 = 105001; + int32 int32_5002 = 105002; + int32 int32_5003 = 105003; + int32 int32_5004 = 105004; + int32 int32_5005 = 105005; + int32 int32_5006 = 105006; + int32 int32_5007 = 105007; + int32 int32_5008 = 105008; + int32 int32_5009 = 105009; + int32 int32_5010 = 105010; + int32 int32_5011 = 105011; + int32 int32_5012 = 105012; + int32 int32_5013 = 105013; + int32 int32_5014 = 105014; + int32 int32_5015 = 105015; + int32 int32_5016 = 105016; + int32 int32_5017 = 105017; + int32 int32_5018 = 105018; + int32 int32_5019 = 105019; + int32 int32_5020 = 105020; + int32 int32_5021 = 105021; + int32 int32_5022 = 105022; + int32 int32_5023 = 105023; + int32 int32_5024 = 105024; + int32 int32_5025 = 105025; + int32 int32_5026 = 105026; + int32 int32_5027 = 105027; + int32 int32_5028 = 105028; + int32 int32_5029 = 105029; + int32 int32_5030 = 105030; + int32 int32_5031 = 105031; + int32 int32_5032 = 105032; + int32 int32_5033 = 105033; + int32 int32_5034 = 105034; + int32 int32_5035 = 105035; + int32 int32_5036 = 105036; + int32 int32_5037 = 105037; + int32 int32_5038 = 105038; + int32 int32_5039 = 105039; + int32 int32_5040 = 105040; + int32 int32_5041 = 105041; + int32 int32_5042 = 105042; + int32 int32_5043 = 105043; + int32 int32_5044 = 105044; + int32 int32_5045 = 105045; + int32 int32_5046 = 105046; + int32 int32_5047 = 105047; + int32 int32_5048 = 105048; + int32 int32_5049 = 105049; + int32 int32_5050 = 105050; + int32 int32_5051 = 105051; + int32 int32_5052 = 105052; + int32 int32_5053 = 105053; + int32 int32_5054 = 105054; + int32 int32_5055 = 105055; + int32 int32_5056 = 105056; + int32 int32_5057 = 105057; + int32 int32_5058 = 105058; + int32 int32_5059 = 105059; + int32 int32_5060 = 105060; + int32 int32_5061 = 105061; + int32 int32_5062 = 105062; + int32 int32_5063 = 105063; + int32 int32_5064 = 105064; + int32 int32_5065 = 105065; + int32 int32_5066 = 105066; + int32 int32_5067 = 105067; + int32 int32_5068 = 105068; + int32 int32_5069 = 105069; + int32 int32_5070 = 105070; + int32 int32_5071 = 105071; + int32 int32_5072 = 105072; + int32 int32_5073 = 105073; + int32 int32_5074 = 105074; + int32 int32_5075 = 105075; + int32 int32_5076 = 105076; + int32 int32_5077 = 105077; + int32 int32_5078 = 105078; + int32 int32_5079 = 105079; + int32 int32_5080 = 105080; + int32 int32_5081 = 105081; + int32 int32_5082 = 105082; + int32 int32_5083 = 105083; + int32 int32_5084 = 105084; + int32 int32_5085 = 105085; + int32 int32_5086 = 105086; + int32 int32_5087 = 105087; + int32 int32_5088 = 105088; + int32 int32_5089 = 105089; + int32 int32_5090 = 105090; + int32 int32_5091 = 105091; + int32 int32_5092 = 105092; + int32 int32_5093 = 105093; + int32 int32_5094 = 105094; + int32 int32_5095 = 105095; + int32 int32_5096 = 105096; + int32 int32_5097 = 105097; + int32 int32_5098 = 105098; + int32 int32_5099 = 105099; + int32 int32_5100 = 105100; + int32 int32_5101 = 105101; + int32 int32_5102 = 105102; + int32 int32_5103 = 105103; + int32 int32_5104 = 105104; + int32 int32_5105 = 105105; + int32 int32_5106 = 105106; + int32 int32_5107 = 105107; + int32 int32_5108 = 105108; + int32 int32_5109 = 105109; + int32 int32_5110 = 105110; + int32 int32_5111 = 105111; + int32 int32_5112 = 105112; + int32 int32_5113 = 105113; + int32 int32_5114 = 105114; + int32 int32_5115 = 105115; + int32 int32_5116 = 105116; + int32 int32_5117 = 105117; + int32 int32_5118 = 105118; + int32 int32_5119 = 105119; + int32 int32_5120 = 105120; + int32 int32_5121 = 105121; + int32 int32_5122 = 105122; + int32 int32_5123 = 105123; + int32 int32_5124 = 105124; + int32 int32_5125 = 105125; + int32 int32_5126 = 105126; + int32 int32_5127 = 105127; + int32 int32_5128 = 105128; + int32 int32_5129 = 105129; + int32 int32_5130 = 105130; + int32 int32_5131 = 105131; + int32 int32_5132 = 105132; + int32 int32_5133 = 105133; + int32 int32_5134 = 105134; + int32 int32_5135 = 105135; + int32 int32_5136 = 105136; + int32 int32_5137 = 105137; + int32 int32_5138 = 105138; + int32 int32_5139 = 105139; + int32 int32_5140 = 105140; + int32 int32_5141 = 105141; + int32 int32_5142 = 105142; + int32 int32_5143 = 105143; + int32 int32_5144 = 105144; + int32 int32_5145 = 105145; + int32 int32_5146 = 105146; + int32 int32_5147 = 105147; + int32 int32_5148 = 105148; + int32 int32_5149 = 105149; + int32 int32_5150 = 105150; + int32 int32_5151 = 105151; + int32 int32_5152 = 105152; + int32 int32_5153 = 105153; + int32 int32_5154 = 105154; + int32 int32_5155 = 105155; + int32 int32_5156 = 105156; + int32 int32_5157 = 105157; + int32 int32_5158 = 105158; + int32 int32_5159 = 105159; + int32 int32_5160 = 105160; + int32 int32_5161 = 105161; + int32 int32_5162 = 105162; + int32 int32_5163 = 105163; + int32 int32_5164 = 105164; + int32 int32_5165 = 105165; + int32 int32_5166 = 105166; + int32 int32_5167 = 105167; + int32 int32_5168 = 105168; + int32 int32_5169 = 105169; + int32 int32_5170 = 105170; + int32 int32_5171 = 105171; + int32 int32_5172 = 105172; + int32 int32_5173 = 105173; + int32 int32_5174 = 105174; + int32 int32_5175 = 105175; + int32 int32_5176 = 105176; + int32 int32_5177 = 105177; + int32 int32_5178 = 105178; + int32 int32_5179 = 105179; + int32 int32_5180 = 105180; + int32 int32_5181 = 105181; + int32 int32_5182 = 105182; + int32 int32_5183 = 105183; + int32 int32_5184 = 105184; + int32 int32_5185 = 105185; + int32 int32_5186 = 105186; + int32 int32_5187 = 105187; + int32 int32_5188 = 105188; + int32 int32_5189 = 105189; + int32 int32_5190 = 105190; + int32 int32_5191 = 105191; + int32 int32_5192 = 105192; + int32 int32_5193 = 105193; + int32 int32_5194 = 105194; + int32 int32_5195 = 105195; + int32 int32_5196 = 105196; + int32 int32_5197 = 105197; + int32 int32_5198 = 105198; + int32 int32_5199 = 105199; + int32 int32_5200 = 105200; + int32 int32_5201 = 105201; + int32 int32_5202 = 105202; + int32 int32_5203 = 105203; + int32 int32_5204 = 105204; + int32 int32_5205 = 105205; + int32 int32_5206 = 105206; + int32 int32_5207 = 105207; + int32 int32_5208 = 105208; + int32 int32_5209 = 105209; + int32 int32_5210 = 105210; + int32 int32_5211 = 105211; + int32 int32_5212 = 105212; + int32 int32_5213 = 105213; + int32 int32_5214 = 105214; + int32 int32_5215 = 105215; + int32 int32_5216 = 105216; + int32 int32_5217 = 105217; + int32 int32_5218 = 105218; + int32 int32_5219 = 105219; + int32 int32_5220 = 105220; + int32 int32_5221 = 105221; + int32 int32_5222 = 105222; + int32 int32_5223 = 105223; + int32 int32_5224 = 105224; + int32 int32_5225 = 105225; + int32 int32_5226 = 105226; + int32 int32_5227 = 105227; + int32 int32_5228 = 105228; + int32 int32_5229 = 105229; + int32 int32_5230 = 105230; + int32 int32_5231 = 105231; + int32 int32_5232 = 105232; + int32 int32_5233 = 105233; + int32 int32_5234 = 105234; + int32 int32_5235 = 105235; + int32 int32_5236 = 105236; + int32 int32_5237 = 105237; + int32 int32_5238 = 105238; + int32 int32_5239 = 105239; + int32 int32_5240 = 105240; + int32 int32_5241 = 105241; + int32 int32_5242 = 105242; + int32 int32_5243 = 105243; + int32 int32_5244 = 105244; + int32 int32_5245 = 105245; + int32 int32_5246 = 105246; + int32 int32_5247 = 105247; + int32 int32_5248 = 105248; + int32 int32_5249 = 105249; + int32 int32_5250 = 105250; + int32 int32_5251 = 105251; + int32 int32_5252 = 105252; + int32 int32_5253 = 105253; + int32 int32_5254 = 105254; + int32 int32_5255 = 105255; + int32 int32_5256 = 105256; + int32 int32_5257 = 105257; + int32 int32_5258 = 105258; + int32 int32_5259 = 105259; + int32 int32_5260 = 105260; + int32 int32_5261 = 105261; + int32 int32_5262 = 105262; + int32 int32_5263 = 105263; + int32 int32_5264 = 105264; + int32 int32_5265 = 105265; + int32 int32_5266 = 105266; + int32 int32_5267 = 105267; + int32 int32_5268 = 105268; + int32 int32_5269 = 105269; + int32 int32_5270 = 105270; + int32 int32_5271 = 105271; + int32 int32_5272 = 105272; + int32 int32_5273 = 105273; + int32 int32_5274 = 105274; + int32 int32_5275 = 105275; + int32 int32_5276 = 105276; + int32 int32_5277 = 105277; + int32 int32_5278 = 105278; + int32 int32_5279 = 105279; + int32 int32_5280 = 105280; + int32 int32_5281 = 105281; + int32 int32_5282 = 105282; + int32 int32_5283 = 105283; + int32 int32_5284 = 105284; + int32 int32_5285 = 105285; + int32 int32_5286 = 105286; + int32 int32_5287 = 105287; + int32 int32_5288 = 105288; + int32 int32_5289 = 105289; + int32 int32_5290 = 105290; + int32 int32_5291 = 105291; + int32 int32_5292 = 105292; + int32 int32_5293 = 105293; + int32 int32_5294 = 105294; + int32 int32_5295 = 105295; + int32 int32_5296 = 105296; + int32 int32_5297 = 105297; + int32 int32_5298 = 105298; + int32 int32_5299 = 105299; + int32 int32_5300 = 105300; + int32 int32_5301 = 105301; + int32 int32_5302 = 105302; + int32 int32_5303 = 105303; + int32 int32_5304 = 105304; + int32 int32_5305 = 105305; + int32 int32_5306 = 105306; + int32 int32_5307 = 105307; + int32 int32_5308 = 105308; + int32 int32_5309 = 105309; + int32 int32_5310 = 105310; + int32 int32_5311 = 105311; + int32 int32_5312 = 105312; + int32 int32_5313 = 105313; + int32 int32_5314 = 105314; + int32 int32_5315 = 105315; + int32 int32_5316 = 105316; + int32 int32_5317 = 105317; + int32 int32_5318 = 105318; + int32 int32_5319 = 105319; + int32 int32_5320 = 105320; + int32 int32_5321 = 105321; + int32 int32_5322 = 105322; + int32 int32_5323 = 105323; + int32 int32_5324 = 105324; + int32 int32_5325 = 105325; + int32 int32_5326 = 105326; + int32 int32_5327 = 105327; + int32 int32_5328 = 105328; + int32 int32_5329 = 105329; + int32 int32_5330 = 105330; + int32 int32_5331 = 105331; + int32 int32_5332 = 105332; + int32 int32_5333 = 105333; + int32 int32_5334 = 105334; + int32 int32_5335 = 105335; + int32 int32_5336 = 105336; + int32 int32_5337 = 105337; + int32 int32_5338 = 105338; + int32 int32_5339 = 105339; + int32 int32_5340 = 105340; + int32 int32_5341 = 105341; + int32 int32_5342 = 105342; + int32 int32_5343 = 105343; + int32 int32_5344 = 105344; + int32 int32_5345 = 105345; + int32 int32_5346 = 105346; + int32 int32_5347 = 105347; + int32 int32_5348 = 105348; + int32 int32_5349 = 105349; + int32 int32_5350 = 105350; + int32 int32_5351 = 105351; + int32 int32_5352 = 105352; + int32 int32_5353 = 105353; + int32 int32_5354 = 105354; + int32 int32_5355 = 105355; + int32 int32_5356 = 105356; + int32 int32_5357 = 105357; + int32 int32_5358 = 105358; + int32 int32_5359 = 105359; + int32 int32_5360 = 105360; + int32 int32_5361 = 105361; + int32 int32_5362 = 105362; + int32 int32_5363 = 105363; + int32 int32_5364 = 105364; + int32 int32_5365 = 105365; + int32 int32_5366 = 105366; + int32 int32_5367 = 105367; + int32 int32_5368 = 105368; + int32 int32_5369 = 105369; + int32 int32_5370 = 105370; + int32 int32_5371 = 105371; + int32 int32_5372 = 105372; + int32 int32_5373 = 105373; + int32 int32_5374 = 105374; + int32 int32_5375 = 105375; + int32 int32_5376 = 105376; + int32 int32_5377 = 105377; + int32 int32_5378 = 105378; + int32 int32_5379 = 105379; + int32 int32_5380 = 105380; + int32 int32_5381 = 105381; + int32 int32_5382 = 105382; + int32 int32_5383 = 105383; + int32 int32_5384 = 105384; + int32 int32_5385 = 105385; + int32 int32_5386 = 105386; + int32 int32_5387 = 105387; + int32 int32_5388 = 105388; + int32 int32_5389 = 105389; + int32 int32_5390 = 105390; + int32 int32_5391 = 105391; + int32 int32_5392 = 105392; + int32 int32_5393 = 105393; + int32 int32_5394 = 105394; + int32 int32_5395 = 105395; + int32 int32_5396 = 105396; + int32 int32_5397 = 105397; + int32 int32_5398 = 105398; + int32 int32_5399 = 105399; + int32 int32_5400 = 105400; + int32 int32_5401 = 105401; + int32 int32_5402 = 105402; + int32 int32_5403 = 105403; + int32 int32_5404 = 105404; + int32 int32_5405 = 105405; + int32 int32_5406 = 105406; + int32 int32_5407 = 105407; + int32 int32_5408 = 105408; + int32 int32_5409 = 105409; + int32 int32_5410 = 105410; + int32 int32_5411 = 105411; + int32 int32_5412 = 105412; + int32 int32_5413 = 105413; + int32 int32_5414 = 105414; + int32 int32_5415 = 105415; + int32 int32_5416 = 105416; + int32 int32_5417 = 105417; + int32 int32_5418 = 105418; + int32 int32_5419 = 105419; + int32 int32_5420 = 105420; + int32 int32_5421 = 105421; + int32 int32_5422 = 105422; + int32 int32_5423 = 105423; + int32 int32_5424 = 105424; + int32 int32_5425 = 105425; + int32 int32_5426 = 105426; + int32 int32_5427 = 105427; + int32 int32_5428 = 105428; + int32 int32_5429 = 105429; + int32 int32_5430 = 105430; + int32 int32_5431 = 105431; + int32 int32_5432 = 105432; + int32 int32_5433 = 105433; + int32 int32_5434 = 105434; + int32 int32_5435 = 105435; + int32 int32_5436 = 105436; + int32 int32_5437 = 105437; + int32 int32_5438 = 105438; + int32 int32_5439 = 105439; + int32 int32_5440 = 105440; + int32 int32_5441 = 105441; + int32 int32_5442 = 105442; + int32 int32_5443 = 105443; + int32 int32_5444 = 105444; + int32 int32_5445 = 105445; + int32 int32_5446 = 105446; + int32 int32_5447 = 105447; + int32 int32_5448 = 105448; + int32 int32_5449 = 105449; + int32 int32_5450 = 105450; + int32 int32_5451 = 105451; + int32 int32_5452 = 105452; + int32 int32_5453 = 105453; + int32 int32_5454 = 105454; + int32 int32_5455 = 105455; + int32 int32_5456 = 105456; + int32 int32_5457 = 105457; + int32 int32_5458 = 105458; + int32 int32_5459 = 105459; + int32 int32_5460 = 105460; + int32 int32_5461 = 105461; + int32 int32_5462 = 105462; + int32 int32_5463 = 105463; + int32 int32_5464 = 105464; + int32 int32_5465 = 105465; + int32 int32_5466 = 105466; + int32 int32_5467 = 105467; + int32 int32_5468 = 105468; + int32 int32_5469 = 105469; + int32 int32_5470 = 105470; + int32 int32_5471 = 105471; + int32 int32_5472 = 105472; + int32 int32_5473 = 105473; + int32 int32_5474 = 105474; + int32 int32_5475 = 105475; + int32 int32_5476 = 105476; + int32 int32_5477 = 105477; + int32 int32_5478 = 105478; + int32 int32_5479 = 105479; + int32 int32_5480 = 105480; + int32 int32_5481 = 105481; + int32 int32_5482 = 105482; + int32 int32_5483 = 105483; + int32 int32_5484 = 105484; + int32 int32_5485 = 105485; + int32 int32_5486 = 105486; + int32 int32_5487 = 105487; + int32 int32_5488 = 105488; + int32 int32_5489 = 105489; + int32 int32_5490 = 105490; + int32 int32_5491 = 105491; + int32 int32_5492 = 105492; + int32 int32_5493 = 105493; + int32 int32_5494 = 105494; + int32 int32_5495 = 105495; + int32 int32_5496 = 105496; + int32 int32_5497 = 105497; + int32 int32_5498 = 105498; + int32 int32_5499 = 105499; + int32 int32_5500 = 105500; + int32 int32_5501 = 105501; + int32 int32_5502 = 105502; + int32 int32_5503 = 105503; + int32 int32_5504 = 105504; + int32 int32_5505 = 105505; + int32 int32_5506 = 105506; + int32 int32_5507 = 105507; + int32 int32_5508 = 105508; + int32 int32_5509 = 105509; + int32 int32_5510 = 105510; + int32 int32_5511 = 105511; + int32 int32_5512 = 105512; + int32 int32_5513 = 105513; + int32 int32_5514 = 105514; + int32 int32_5515 = 105515; + int32 int32_5516 = 105516; + int32 int32_5517 = 105517; + int32 int32_5518 = 105518; + int32 int32_5519 = 105519; + int32 int32_5520 = 105520; + int32 int32_5521 = 105521; + int32 int32_5522 = 105522; + int32 int32_5523 = 105523; + int32 int32_5524 = 105524; + int32 int32_5525 = 105525; + int32 int32_5526 = 105526; + int32 int32_5527 = 105527; + int32 int32_5528 = 105528; + int32 int32_5529 = 105529; + int32 int32_5530 = 105530; + int32 int32_5531 = 105531; + int32 int32_5532 = 105532; + int32 int32_5533 = 105533; + int32 int32_5534 = 105534; + int32 int32_5535 = 105535; + int32 int32_5536 = 105536; + int32 int32_5537 = 105537; + int32 int32_5538 = 105538; + int32 int32_5539 = 105539; + int32 int32_5540 = 105540; + int32 int32_5541 = 105541; + int32 int32_5542 = 105542; + int32 int32_5543 = 105543; + int32 int32_5544 = 105544; + int32 int32_5545 = 105545; + int32 int32_5546 = 105546; + int32 int32_5547 = 105547; + int32 int32_5548 = 105548; + int32 int32_5549 = 105549; + int32 int32_5550 = 105550; + int32 int32_5551 = 105551; + int32 int32_5552 = 105552; + int32 int32_5553 = 105553; + int32 int32_5554 = 105554; + int32 int32_5555 = 105555; + int32 int32_5556 = 105556; + int32 int32_5557 = 105557; + int32 int32_5558 = 105558; + int32 int32_5559 = 105559; + int32 int32_5560 = 105560; + int32 int32_5561 = 105561; + int32 int32_5562 = 105562; + int32 int32_5563 = 105563; + int32 int32_5564 = 105564; + int32 int32_5565 = 105565; + int32 int32_5566 = 105566; + int32 int32_5567 = 105567; + int32 int32_5568 = 105568; + int32 int32_5569 = 105569; + int32 int32_5570 = 105570; + int32 int32_5571 = 105571; + int32 int32_5572 = 105572; + int32 int32_5573 = 105573; + int32 int32_5574 = 105574; + int32 int32_5575 = 105575; + int32 int32_5576 = 105576; + int32 int32_5577 = 105577; + int32 int32_5578 = 105578; + int32 int32_5579 = 105579; + int32 int32_5580 = 105580; + int32 int32_5581 = 105581; + int32 int32_5582 = 105582; + int32 int32_5583 = 105583; + int32 int32_5584 = 105584; + int32 int32_5585 = 105585; + int32 int32_5586 = 105586; + int32 int32_5587 = 105587; + int32 int32_5588 = 105588; + int32 int32_5589 = 105589; + int32 int32_5590 = 105590; + int32 int32_5591 = 105591; + int32 int32_5592 = 105592; + int32 int32_5593 = 105593; + int32 int32_5594 = 105594; + int32 int32_5595 = 105595; + int32 int32_5596 = 105596; + int32 int32_5597 = 105597; + int32 int32_5598 = 105598; + int32 int32_5599 = 105599; + int32 int32_5600 = 105600; + int32 int32_5601 = 105601; + int32 int32_5602 = 105602; + int32 int32_5603 = 105603; + int32 int32_5604 = 105604; + int32 int32_5605 = 105605; + int32 int32_5606 = 105606; + int32 int32_5607 = 105607; + int32 int32_5608 = 105608; + int32 int32_5609 = 105609; + int32 int32_5610 = 105610; + int32 int32_5611 = 105611; + int32 int32_5612 = 105612; + int32 int32_5613 = 105613; + int32 int32_5614 = 105614; + int32 int32_5615 = 105615; + int32 int32_5616 = 105616; + int32 int32_5617 = 105617; + int32 int32_5618 = 105618; + int32 int32_5619 = 105619; + int32 int32_5620 = 105620; + int32 int32_5621 = 105621; + int32 int32_5622 = 105622; + int32 int32_5623 = 105623; + int32 int32_5624 = 105624; + int32 int32_5625 = 105625; + int32 int32_5626 = 105626; + int32 int32_5627 = 105627; + int32 int32_5628 = 105628; + int32 int32_5629 = 105629; + int32 int32_5630 = 105630; + int32 int32_5631 = 105631; + int32 int32_5632 = 105632; + int32 int32_5633 = 105633; + int32 int32_5634 = 105634; + int32 int32_5635 = 105635; + int32 int32_5636 = 105636; + int32 int32_5637 = 105637; + int32 int32_5638 = 105638; + int32 int32_5639 = 105639; + int32 int32_5640 = 105640; + int32 int32_5641 = 105641; + int32 int32_5642 = 105642; + int32 int32_5643 = 105643; + int32 int32_5644 = 105644; + int32 int32_5645 = 105645; + int32 int32_5646 = 105646; + int32 int32_5647 = 105647; + int32 int32_5648 = 105648; + int32 int32_5649 = 105649; + int32 int32_5650 = 105650; + int32 int32_5651 = 105651; + int32 int32_5652 = 105652; + int32 int32_5653 = 105653; + int32 int32_5654 = 105654; + int32 int32_5655 = 105655; + int32 int32_5656 = 105656; + int32 int32_5657 = 105657; + int32 int32_5658 = 105658; + int32 int32_5659 = 105659; + int32 int32_5660 = 105660; + int32 int32_5661 = 105661; + int32 int32_5662 = 105662; + int32 int32_5663 = 105663; + int32 int32_5664 = 105664; + int32 int32_5665 = 105665; + int32 int32_5666 = 105666; + int32 int32_5667 = 105667; + int32 int32_5668 = 105668; + int32 int32_5669 = 105669; + int32 int32_5670 = 105670; + int32 int32_5671 = 105671; + int32 int32_5672 = 105672; + int32 int32_5673 = 105673; + int32 int32_5674 = 105674; + int32 int32_5675 = 105675; + int32 int32_5676 = 105676; + int32 int32_5677 = 105677; + int32 int32_5678 = 105678; + int32 int32_5679 = 105679; + int32 int32_5680 = 105680; + int32 int32_5681 = 105681; + int32 int32_5682 = 105682; + int32 int32_5683 = 105683; + int32 int32_5684 = 105684; + int32 int32_5685 = 105685; + int32 int32_5686 = 105686; + int32 int32_5687 = 105687; + int32 int32_5688 = 105688; + int32 int32_5689 = 105689; + int32 int32_5690 = 105690; + int32 int32_5691 = 105691; + int32 int32_5692 = 105692; + int32 int32_5693 = 105693; + int32 int32_5694 = 105694; + int32 int32_5695 = 105695; + int32 int32_5696 = 105696; + int32 int32_5697 = 105697; + int32 int32_5698 = 105698; + int32 int32_5699 = 105699; + int32 int32_5700 = 105700; + int32 int32_5701 = 105701; + int32 int32_5702 = 105702; + int32 int32_5703 = 105703; + int32 int32_5704 = 105704; + int32 int32_5705 = 105705; + int32 int32_5706 = 105706; + int32 int32_5707 = 105707; + int32 int32_5708 = 105708; + int32 int32_5709 = 105709; + int32 int32_5710 = 105710; + int32 int32_5711 = 105711; + int32 int32_5712 = 105712; + int32 int32_5713 = 105713; + int32 int32_5714 = 105714; + int32 int32_5715 = 105715; + int32 int32_5716 = 105716; + int32 int32_5717 = 105717; + int32 int32_5718 = 105718; + int32 int32_5719 = 105719; + int32 int32_5720 = 105720; + int32 int32_5721 = 105721; + int32 int32_5722 = 105722; + int32 int32_5723 = 105723; + int32 int32_5724 = 105724; + int32 int32_5725 = 105725; + int32 int32_5726 = 105726; + int32 int32_5727 = 105727; + int32 int32_5728 = 105728; + int32 int32_5729 = 105729; + int32 int32_5730 = 105730; + int32 int32_5731 = 105731; + int32 int32_5732 = 105732; + int32 int32_5733 = 105733; + int32 int32_5734 = 105734; + int32 int32_5735 = 105735; + int32 int32_5736 = 105736; + int32 int32_5737 = 105737; + int32 int32_5738 = 105738; + int32 int32_5739 = 105739; + int32 int32_5740 = 105740; + int32 int32_5741 = 105741; + int32 int32_5742 = 105742; + int32 int32_5743 = 105743; + int32 int32_5744 = 105744; + int32 int32_5745 = 105745; + int32 int32_5746 = 105746; + int32 int32_5747 = 105747; + int32 int32_5748 = 105748; + int32 int32_5749 = 105749; + int32 int32_5750 = 105750; + int32 int32_5751 = 105751; + int32 int32_5752 = 105752; + int32 int32_5753 = 105753; + int32 int32_5754 = 105754; + int32 int32_5755 = 105755; + int32 int32_5756 = 105756; + int32 int32_5757 = 105757; + int32 int32_5758 = 105758; + int32 int32_5759 = 105759; + int32 int32_5760 = 105760; + int32 int32_5761 = 105761; + int32 int32_5762 = 105762; + int32 int32_5763 = 105763; + int32 int32_5764 = 105764; + int32 int32_5765 = 105765; + int32 int32_5766 = 105766; + int32 int32_5767 = 105767; + int32 int32_5768 = 105768; + int32 int32_5769 = 105769; + int32 int32_5770 = 105770; + int32 int32_5771 = 105771; + int32 int32_5772 = 105772; + int32 int32_5773 = 105773; + int32 int32_5774 = 105774; + int32 int32_5775 = 105775; + int32 int32_5776 = 105776; + int32 int32_5777 = 105777; + int32 int32_5778 = 105778; + int32 int32_5779 = 105779; + int32 int32_5780 = 105780; + int32 int32_5781 = 105781; + int32 int32_5782 = 105782; + int32 int32_5783 = 105783; + int32 int32_5784 = 105784; + int32 int32_5785 = 105785; + int32 int32_5786 = 105786; + int32 int32_5787 = 105787; + int32 int32_5788 = 105788; + int32 int32_5789 = 105789; + int32 int32_5790 = 105790; + int32 int32_5791 = 105791; + int32 int32_5792 = 105792; + int32 int32_5793 = 105793; + int32 int32_5794 = 105794; + int32 int32_5795 = 105795; + int32 int32_5796 = 105796; + int32 int32_5797 = 105797; + int32 int32_5798 = 105798; + int32 int32_5799 = 105799; + int32 int32_5800 = 105800; + int32 int32_5801 = 105801; + int32 int32_5802 = 105802; + int32 int32_5803 = 105803; + int32 int32_5804 = 105804; + int32 int32_5805 = 105805; + int32 int32_5806 = 105806; + int32 int32_5807 = 105807; + int32 int32_5808 = 105808; + int32 int32_5809 = 105809; + int32 int32_5810 = 105810; + int32 int32_5811 = 105811; + int32 int32_5812 = 105812; + int32 int32_5813 = 105813; + int32 int32_5814 = 105814; + int32 int32_5815 = 105815; + int32 int32_5816 = 105816; + int32 int32_5817 = 105817; + int32 int32_5818 = 105818; + int32 int32_5819 = 105819; + int32 int32_5820 = 105820; + int32 int32_5821 = 105821; + int32 int32_5822 = 105822; + int32 int32_5823 = 105823; + int32 int32_5824 = 105824; + int32 int32_5825 = 105825; + int32 int32_5826 = 105826; + int32 int32_5827 = 105827; + int32 int32_5828 = 105828; + int32 int32_5829 = 105829; + int32 int32_5830 = 105830; + int32 int32_5831 = 105831; + int32 int32_5832 = 105832; + int32 int32_5833 = 105833; + int32 int32_5834 = 105834; + int32 int32_5835 = 105835; + int32 int32_5836 = 105836; + int32 int32_5837 = 105837; + int32 int32_5838 = 105838; + int32 int32_5839 = 105839; + int32 int32_5840 = 105840; + int32 int32_5841 = 105841; + int32 int32_5842 = 105842; + int32 int32_5843 = 105843; + int32 int32_5844 = 105844; + int32 int32_5845 = 105845; + int32 int32_5846 = 105846; + int32 int32_5847 = 105847; + int32 int32_5848 = 105848; + int32 int32_5849 = 105849; + int32 int32_5850 = 105850; + int32 int32_5851 = 105851; + int32 int32_5852 = 105852; + int32 int32_5853 = 105853; + int32 int32_5854 = 105854; + int32 int32_5855 = 105855; + int32 int32_5856 = 105856; + int32 int32_5857 = 105857; + int32 int32_5858 = 105858; + int32 int32_5859 = 105859; + int32 int32_5860 = 105860; + int32 int32_5861 = 105861; + int32 int32_5862 = 105862; + int32 int32_5863 = 105863; + int32 int32_5864 = 105864; + int32 int32_5865 = 105865; + int32 int32_5866 = 105866; + int32 int32_5867 = 105867; + int32 int32_5868 = 105868; + int32 int32_5869 = 105869; + int32 int32_5870 = 105870; + int32 int32_5871 = 105871; + int32 int32_5872 = 105872; + int32 int32_5873 = 105873; + int32 int32_5874 = 105874; + int32 int32_5875 = 105875; + int32 int32_5876 = 105876; + int32 int32_5877 = 105877; + int32 int32_5878 = 105878; + int32 int32_5879 = 105879; + int32 int32_5880 = 105880; + int32 int32_5881 = 105881; + int32 int32_5882 = 105882; + int32 int32_5883 = 105883; + int32 int32_5884 = 105884; + int32 int32_5885 = 105885; + int32 int32_5886 = 105886; + int32 int32_5887 = 105887; + int32 int32_5888 = 105888; + int32 int32_5889 = 105889; + int32 int32_5890 = 105890; + int32 int32_5891 = 105891; + int32 int32_5892 = 105892; + int32 int32_5893 = 105893; + int32 int32_5894 = 105894; + int32 int32_5895 = 105895; + int32 int32_5896 = 105896; + int32 int32_5897 = 105897; + int32 int32_5898 = 105898; + int32 int32_5899 = 105899; + int32 int32_5900 = 105900; + int32 int32_5901 = 105901; + int32 int32_5902 = 105902; + int32 int32_5903 = 105903; + int32 int32_5904 = 105904; + int32 int32_5905 = 105905; + int32 int32_5906 = 105906; + int32 int32_5907 = 105907; + int32 int32_5908 = 105908; + int32 int32_5909 = 105909; + int32 int32_5910 = 105910; + int32 int32_5911 = 105911; + int32 int32_5912 = 105912; + int32 int32_5913 = 105913; + int32 int32_5914 = 105914; + int32 int32_5915 = 105915; + int32 int32_5916 = 105916; + int32 int32_5917 = 105917; + int32 int32_5918 = 105918; + int32 int32_5919 = 105919; + int32 int32_5920 = 105920; + int32 int32_5921 = 105921; + int32 int32_5922 = 105922; + int32 int32_5923 = 105923; + int32 int32_5924 = 105924; + int32 int32_5925 = 105925; + int32 int32_5926 = 105926; + int32 int32_5927 = 105927; + int32 int32_5928 = 105928; + int32 int32_5929 = 105929; + int32 int32_5930 = 105930; + int32 int32_5931 = 105931; + int32 int32_5932 = 105932; + int32 int32_5933 = 105933; + int32 int32_5934 = 105934; + int32 int32_5935 = 105935; + int32 int32_5936 = 105936; + int32 int32_5937 = 105937; + int32 int32_5938 = 105938; + int32 int32_5939 = 105939; + int32 int32_5940 = 105940; + int32 int32_5941 = 105941; + int32 int32_5942 = 105942; + int32 int32_5943 = 105943; + int32 int32_5944 = 105944; + int32 int32_5945 = 105945; + int32 int32_5946 = 105946; + int32 int32_5947 = 105947; + int32 int32_5948 = 105948; + int32 int32_5949 = 105949; + int32 int32_5950 = 105950; + int32 int32_5951 = 105951; + int32 int32_5952 = 105952; + int32 int32_5953 = 105953; + int32 int32_5954 = 105954; + int32 int32_5955 = 105955; + int32 int32_5956 = 105956; + int32 int32_5957 = 105957; + int32 int32_5958 = 105958; + int32 int32_5959 = 105959; + int32 int32_5960 = 105960; + int32 int32_5961 = 105961; + int32 int32_5962 = 105962; + int32 int32_5963 = 105963; + int32 int32_5964 = 105964; + int32 int32_5965 = 105965; + int32 int32_5966 = 105966; + int32 int32_5967 = 105967; + int32 int32_5968 = 105968; + int32 int32_5969 = 105969; + int32 int32_5970 = 105970; + int32 int32_5971 = 105971; + int32 int32_5972 = 105972; + int32 int32_5973 = 105973; + int32 int32_5974 = 105974; + int32 int32_5975 = 105975; + int32 int32_5976 = 105976; + int32 int32_5977 = 105977; + int32 int32_5978 = 105978; + int32 int32_5979 = 105979; + int32 int32_5980 = 105980; + int32 int32_5981 = 105981; + int32 int32_5982 = 105982; + int32 int32_5983 = 105983; + int32 int32_5984 = 105984; + int32 int32_5985 = 105985; + int32 int32_5986 = 105986; + int32 int32_5987 = 105987; + int32 int32_5988 = 105988; + int32 int32_5989 = 105989; + int32 int32_5990 = 105990; + int32 int32_5991 = 105991; + int32 int32_5992 = 105992; + int32 int32_5993 = 105993; + int32 int32_5994 = 105994; + int32 int32_5995 = 105995; + int32 int32_5996 = 105996; + int32 int32_5997 = 105997; + int32 int32_5998 = 105998; + int32 int32_5999 = 105999; + int32 int32_6000 = 106000; + int32 int32_6001 = 106001; + int32 int32_6002 = 106002; + int32 int32_6003 = 106003; + int32 int32_6004 = 106004; + int32 int32_6005 = 106005; + int32 int32_6006 = 106006; + int32 int32_6007 = 106007; + int32 int32_6008 = 106008; + int32 int32_6009 = 106009; + int32 int32_6010 = 106010; + int32 int32_6011 = 106011; + int32 int32_6012 = 106012; + int32 int32_6013 = 106013; + int32 int32_6014 = 106014; + int32 int32_6015 = 106015; + int32 int32_6016 = 106016; + int32 int32_6017 = 106017; + int32 int32_6018 = 106018; + int32 int32_6019 = 106019; + int32 int32_6020 = 106020; + int32 int32_6021 = 106021; + int32 int32_6022 = 106022; + int32 int32_6023 = 106023; + int32 int32_6024 = 106024; + int32 int32_6025 = 106025; + int32 int32_6026 = 106026; + int32 int32_6027 = 106027; + int32 int32_6028 = 106028; + int32 int32_6029 = 106029; + int32 int32_6030 = 106030; + int32 int32_6031 = 106031; + int32 int32_6032 = 106032; + int32 int32_6033 = 106033; + int32 int32_6034 = 106034; + int32 int32_6035 = 106035; + int32 int32_6036 = 106036; + int32 int32_6037 = 106037; + int32 int32_6038 = 106038; + int32 int32_6039 = 106039; + int32 int32_6040 = 106040; + int32 int32_6041 = 106041; + int32 int32_6042 = 106042; + int32 int32_6043 = 106043; + int32 int32_6044 = 106044; + int32 int32_6045 = 106045; + int32 int32_6046 = 106046; + int32 int32_6047 = 106047; + int32 int32_6048 = 106048; + int32 int32_6049 = 106049; + int32 int32_6050 = 106050; + int32 int32_6051 = 106051; + int32 int32_6052 = 106052; + int32 int32_6053 = 106053; + int32 int32_6054 = 106054; + int32 int32_6055 = 106055; + int32 int32_6056 = 106056; + int32 int32_6057 = 106057; + int32 int32_6058 = 106058; + int32 int32_6059 = 106059; + int32 int32_6060 = 106060; + int32 int32_6061 = 106061; + int32 int32_6062 = 106062; + int32 int32_6063 = 106063; + int32 int32_6064 = 106064; + int32 int32_6065 = 106065; + int32 int32_6066 = 106066; + int32 int32_6067 = 106067; + int32 int32_6068 = 106068; + int32 int32_6069 = 106069; + int32 int32_6070 = 106070; + int32 int32_6071 = 106071; + int32 int32_6072 = 106072; + int32 int32_6073 = 106073; + int32 int32_6074 = 106074; + int32 int32_6075 = 106075; + int32 int32_6076 = 106076; + int32 int32_6077 = 106077; + int32 int32_6078 = 106078; + int32 int32_6079 = 106079; + int32 int32_6080 = 106080; + int32 int32_6081 = 106081; + int32 int32_6082 = 106082; + int32 int32_6083 = 106083; + int32 int32_6084 = 106084; + int32 int32_6085 = 106085; + int32 int32_6086 = 106086; + int32 int32_6087 = 106087; + int32 int32_6088 = 106088; + int32 int32_6089 = 106089; + int32 int32_6090 = 106090; + int32 int32_6091 = 106091; + int32 int32_6092 = 106092; + int32 int32_6093 = 106093; + int32 int32_6094 = 106094; + int32 int32_6095 = 106095; + int32 int32_6096 = 106096; + int32 int32_6097 = 106097; + int32 int32_6098 = 106098; + int32 int32_6099 = 106099; + int32 int32_6100 = 106100; + int32 int32_6101 = 106101; + int32 int32_6102 = 106102; + int32 int32_6103 = 106103; + int32 int32_6104 = 106104; + int32 int32_6105 = 106105; + int32 int32_6106 = 106106; + int32 int32_6107 = 106107; + int32 int32_6108 = 106108; + int32 int32_6109 = 106109; + int32 int32_6110 = 106110; + int32 int32_6111 = 106111; + int32 int32_6112 = 106112; + int32 int32_6113 = 106113; + int32 int32_6114 = 106114; + int32 int32_6115 = 106115; + int32 int32_6116 = 106116; + int32 int32_6117 = 106117; + int32 int32_6118 = 106118; + int32 int32_6119 = 106119; + int32 int32_6120 = 106120; + int32 int32_6121 = 106121; + int32 int32_6122 = 106122; + int32 int32_6123 = 106123; + int32 int32_6124 = 106124; + int32 int32_6125 = 106125; + int32 int32_6126 = 106126; + int32 int32_6127 = 106127; + int32 int32_6128 = 106128; + int32 int32_6129 = 106129; + int32 int32_6130 = 106130; + int32 int32_6131 = 106131; + int32 int32_6132 = 106132; + int32 int32_6133 = 106133; + int32 int32_6134 = 106134; + int32 int32_6135 = 106135; + int32 int32_6136 = 106136; + int32 int32_6137 = 106137; + int32 int32_6138 = 106138; + int32 int32_6139 = 106139; + int32 int32_6140 = 106140; + int32 int32_6141 = 106141; + int32 int32_6142 = 106142; + int32 int32_6143 = 106143; + int32 int32_6144 = 106144; + int32 int32_6145 = 106145; + int32 int32_6146 = 106146; + int32 int32_6147 = 106147; + int32 int32_6148 = 106148; + int32 int32_6149 = 106149; + int32 int32_6150 = 106150; + int32 int32_6151 = 106151; + int32 int32_6152 = 106152; + int32 int32_6153 = 106153; + int32 int32_6154 = 106154; + int32 int32_6155 = 106155; + int32 int32_6156 = 106156; + int32 int32_6157 = 106157; + int32 int32_6158 = 106158; + int32 int32_6159 = 106159; + int32 int32_6160 = 106160; + int32 int32_6161 = 106161; + int32 int32_6162 = 106162; + int32 int32_6163 = 106163; + int32 int32_6164 = 106164; + int32 int32_6165 = 106165; + int32 int32_6166 = 106166; + int32 int32_6167 = 106167; + int32 int32_6168 = 106168; + int32 int32_6169 = 106169; + int32 int32_6170 = 106170; + int32 int32_6171 = 106171; + int32 int32_6172 = 106172; + int32 int32_6173 = 106173; + int32 int32_6174 = 106174; + int32 int32_6175 = 106175; + int32 int32_6176 = 106176; + int32 int32_6177 = 106177; + int32 int32_6178 = 106178; + int32 int32_6179 = 106179; + int32 int32_6180 = 106180; + int32 int32_6181 = 106181; + int32 int32_6182 = 106182; + int32 int32_6183 = 106183; + int32 int32_6184 = 106184; + int32 int32_6185 = 106185; + int32 int32_6186 = 106186; + int32 int32_6187 = 106187; + int32 int32_6188 = 106188; + int32 int32_6189 = 106189; + int32 int32_6190 = 106190; + int32 int32_6191 = 106191; + int32 int32_6192 = 106192; + int32 int32_6193 = 106193; + int32 int32_6194 = 106194; + int32 int32_6195 = 106195; + int32 int32_6196 = 106196; + int32 int32_6197 = 106197; + int32 int32_6198 = 106198; + int32 int32_6199 = 106199; + int32 int32_6200 = 106200; + int32 int32_6201 = 106201; + int32 int32_6202 = 106202; + int32 int32_6203 = 106203; + int32 int32_6204 = 106204; + int32 int32_6205 = 106205; + int32 int32_6206 = 106206; + int32 int32_6207 = 106207; + int32 int32_6208 = 106208; + int32 int32_6209 = 106209; + int32 int32_6210 = 106210; + int32 int32_6211 = 106211; + int32 int32_6212 = 106212; + int32 int32_6213 = 106213; + int32 int32_6214 = 106214; + int32 int32_6215 = 106215; + int32 int32_6216 = 106216; + int32 int32_6217 = 106217; + int32 int32_6218 = 106218; + int32 int32_6219 = 106219; + int32 int32_6220 = 106220; + int32 int32_6221 = 106221; + int32 int32_6222 = 106222; + int32 int32_6223 = 106223; + int32 int32_6224 = 106224; + int32 int32_6225 = 106225; + int32 int32_6226 = 106226; + int32 int32_6227 = 106227; + int32 int32_6228 = 106228; + int32 int32_6229 = 106229; + int32 int32_6230 = 106230; + int32 int32_6231 = 106231; + int32 int32_6232 = 106232; + int32 int32_6233 = 106233; + int32 int32_6234 = 106234; + int32 int32_6235 = 106235; + int32 int32_6236 = 106236; + int32 int32_6237 = 106237; + int32 int32_6238 = 106238; + int32 int32_6239 = 106239; + int32 int32_6240 = 106240; + int32 int32_6241 = 106241; + int32 int32_6242 = 106242; + int32 int32_6243 = 106243; + int32 int32_6244 = 106244; + int32 int32_6245 = 106245; + int32 int32_6246 = 106246; + int32 int32_6247 = 106247; + int32 int32_6248 = 106248; + int32 int32_6249 = 106249; + int32 int32_6250 = 106250; + int32 int32_6251 = 106251; + int32 int32_6252 = 106252; + int32 int32_6253 = 106253; + int32 int32_6254 = 106254; + int32 int32_6255 = 106255; + int32 int32_6256 = 106256; + int32 int32_6257 = 106257; + int32 int32_6258 = 106258; + int32 int32_6259 = 106259; + int32 int32_6260 = 106260; + int32 int32_6261 = 106261; + int32 int32_6262 = 106262; + int32 int32_6263 = 106263; + int32 int32_6264 = 106264; + int32 int32_6265 = 106265; + int32 int32_6266 = 106266; + int32 int32_6267 = 106267; + int32 int32_6268 = 106268; + int32 int32_6269 = 106269; + int32 int32_6270 = 106270; + int32 int32_6271 = 106271; + int32 int32_6272 = 106272; + int32 int32_6273 = 106273; + int32 int32_6274 = 106274; + int32 int32_6275 = 106275; + int32 int32_6276 = 106276; + int32 int32_6277 = 106277; + int32 int32_6278 = 106278; + int32 int32_6279 = 106279; + int32 int32_6280 = 106280; + int32 int32_6281 = 106281; + int32 int32_6282 = 106282; + int32 int32_6283 = 106283; + int32 int32_6284 = 106284; + int32 int32_6285 = 106285; + int32 int32_6286 = 106286; + int32 int32_6287 = 106287; + int32 int32_6288 = 106288; + int32 int32_6289 = 106289; + int32 int32_6290 = 106290; + int32 int32_6291 = 106291; + int32 int32_6292 = 106292; + int32 int32_6293 = 106293; + int32 int32_6294 = 106294; + int32 int32_6295 = 106295; + int32 int32_6296 = 106296; + int32 int32_6297 = 106297; + int32 int32_6298 = 106298; + int32 int32_6299 = 106299; + int32 int32_6300 = 106300; + int32 int32_6301 = 106301; + int32 int32_6302 = 106302; + int32 int32_6303 = 106303; + int32 int32_6304 = 106304; + int32 int32_6305 = 106305; + int32 int32_6306 = 106306; + int32 int32_6307 = 106307; + int32 int32_6308 = 106308; + int32 int32_6309 = 106309; + int32 int32_6310 = 106310; + int32 int32_6311 = 106311; + int32 int32_6312 = 106312; + int32 int32_6313 = 106313; + int32 int32_6314 = 106314; + int32 int32_6315 = 106315; + int32 int32_6316 = 106316; + int32 int32_6317 = 106317; + int32 int32_6318 = 106318; + int32 int32_6319 = 106319; + int32 int32_6320 = 106320; + int32 int32_6321 = 106321; + int32 int32_6322 = 106322; + int32 int32_6323 = 106323; + int32 int32_6324 = 106324; + int32 int32_6325 = 106325; + int32 int32_6326 = 106326; + int32 int32_6327 = 106327; + int32 int32_6328 = 106328; + int32 int32_6329 = 106329; + int32 int32_6330 = 106330; + int32 int32_6331 = 106331; + int32 int32_6332 = 106332; + int32 int32_6333 = 106333; + int32 int32_6334 = 106334; + int32 int32_6335 = 106335; + int32 int32_6336 = 106336; + int32 int32_6337 = 106337; + int32 int32_6338 = 106338; + int32 int32_6339 = 106339; + int32 int32_6340 = 106340; + int32 int32_6341 = 106341; + int32 int32_6342 = 106342; + int32 int32_6343 = 106343; + int32 int32_6344 = 106344; + int32 int32_6345 = 106345; + int32 int32_6346 = 106346; + int32 int32_6347 = 106347; + int32 int32_6348 = 106348; + int32 int32_6349 = 106349; + int32 int32_6350 = 106350; + int32 int32_6351 = 106351; + int32 int32_6352 = 106352; + int32 int32_6353 = 106353; + int32 int32_6354 = 106354; + int32 int32_6355 = 106355; + int32 int32_6356 = 106356; + int32 int32_6357 = 106357; + int32 int32_6358 = 106358; + int32 int32_6359 = 106359; + int32 int32_6360 = 106360; + int32 int32_6361 = 106361; + int32 int32_6362 = 106362; + int32 int32_6363 = 106363; + int32 int32_6364 = 106364; + int32 int32_6365 = 106365; + int32 int32_6366 = 106366; + int32 int32_6367 = 106367; + int32 int32_6368 = 106368; + int32 int32_6369 = 106369; + int32 int32_6370 = 106370; + int32 int32_6371 = 106371; + int32 int32_6372 = 106372; + int32 int32_6373 = 106373; + int32 int32_6374 = 106374; + int32 int32_6375 = 106375; + int32 int32_6376 = 106376; + int32 int32_6377 = 106377; + int32 int32_6378 = 106378; + int32 int32_6379 = 106379; + int32 int32_6380 = 106380; + int32 int32_6381 = 106381; + int32 int32_6382 = 106382; + int32 int32_6383 = 106383; + int32 int32_6384 = 106384; + int32 int32_6385 = 106385; + int32 int32_6386 = 106386; + int32 int32_6387 = 106387; + int32 int32_6388 = 106388; + int32 int32_6389 = 106389; + int32 int32_6390 = 106390; + int32 int32_6391 = 106391; + int32 int32_6392 = 106392; + int32 int32_6393 = 106393; + int32 int32_6394 = 106394; + int32 int32_6395 = 106395; + int32 int32_6396 = 106396; + int32 int32_6397 = 106397; + int32 int32_6398 = 106398; + int32 int32_6399 = 106399; + int32 int32_6400 = 106400; + int32 int32_6401 = 106401; + int32 int32_6402 = 106402; + int32 int32_6403 = 106403; + int32 int32_6404 = 106404; + int32 int32_6405 = 106405; + int32 int32_6406 = 106406; + int32 int32_6407 = 106407; + int32 int32_6408 = 106408; + int32 int32_6409 = 106409; + int32 int32_6410 = 106410; + int32 int32_6411 = 106411; + int32 int32_6412 = 106412; + int32 int32_6413 = 106413; + int32 int32_6414 = 106414; + int32 int32_6415 = 106415; + int32 int32_6416 = 106416; + int32 int32_6417 = 106417; + int32 int32_6418 = 106418; + int32 int32_6419 = 106419; + int32 int32_6420 = 106420; + int32 int32_6421 = 106421; + int32 int32_6422 = 106422; + int32 int32_6423 = 106423; + int32 int32_6424 = 106424; + int32 int32_6425 = 106425; + int32 int32_6426 = 106426; + int32 int32_6427 = 106427; + int32 int32_6428 = 106428; + int32 int32_6429 = 106429; + int32 int32_6430 = 106430; + int32 int32_6431 = 106431; + int32 int32_6432 = 106432; + int32 int32_6433 = 106433; + int32 int32_6434 = 106434; + int32 int32_6435 = 106435; + int32 int32_6436 = 106436; + int32 int32_6437 = 106437; + int32 int32_6438 = 106438; + int32 int32_6439 = 106439; + int32 int32_6440 = 106440; + int32 int32_6441 = 106441; + int32 int32_6442 = 106442; + int32 int32_6443 = 106443; + int32 int32_6444 = 106444; + int32 int32_6445 = 106445; + int32 int32_6446 = 106446; + int32 int32_6447 = 106447; + int32 int32_6448 = 106448; + int32 int32_6449 = 106449; + int32 int32_6450 = 106450; + int32 int32_6451 = 106451; + int32 int32_6452 = 106452; + int32 int32_6453 = 106453; + int32 int32_6454 = 106454; + int32 int32_6455 = 106455; + int32 int32_6456 = 106456; + int32 int32_6457 = 106457; + int32 int32_6458 = 106458; + int32 int32_6459 = 106459; + int32 int32_6460 = 106460; + int32 int32_6461 = 106461; + int32 int32_6462 = 106462; + int32 int32_6463 = 106463; + int32 int32_6464 = 106464; + int32 int32_6465 = 106465; + int32 int32_6466 = 106466; + int32 int32_6467 = 106467; + int32 int32_6468 = 106468; + int32 int32_6469 = 106469; + int32 int32_6470 = 106470; + int32 int32_6471 = 106471; + int32 int32_6472 = 106472; + int32 int32_6473 = 106473; + int32 int32_6474 = 106474; + int32 int32_6475 = 106475; + int32 int32_6476 = 106476; + int32 int32_6477 = 106477; + int32 int32_6478 = 106478; + int32 int32_6479 = 106479; + int32 int32_6480 = 106480; + int32 int32_6481 = 106481; + int32 int32_6482 = 106482; + int32 int32_6483 = 106483; + int32 int32_6484 = 106484; + int32 int32_6485 = 106485; + int32 int32_6486 = 106486; + int32 int32_6487 = 106487; + int32 int32_6488 = 106488; + int32 int32_6489 = 106489; + int32 int32_6490 = 106490; + int32 int32_6491 = 106491; + int32 int32_6492 = 106492; + int32 int32_6493 = 106493; + int32 int32_6494 = 106494; + int32 int32_6495 = 106495; + int32 int32_6496 = 106496; + int32 int32_6497 = 106497; + int32 int32_6498 = 106498; + int32 int32_6499 = 106499; + int32 int32_6500 = 106500; + int32 int32_6501 = 106501; + int32 int32_6502 = 106502; + int32 int32_6503 = 106503; + int32 int32_6504 = 106504; + int32 int32_6505 = 106505; + int32 int32_6506 = 106506; + int32 int32_6507 = 106507; + int32 int32_6508 = 106508; + int32 int32_6509 = 106509; + int32 int32_6510 = 106510; + int32 int32_6511 = 106511; + int32 int32_6512 = 106512; + int32 int32_6513 = 106513; + int32 int32_6514 = 106514; + int32 int32_6515 = 106515; + int32 int32_6516 = 106516; + int32 int32_6517 = 106517; + int32 int32_6518 = 106518; + int32 int32_6519 = 106519; + int32 int32_6520 = 106520; + int32 int32_6521 = 106521; + int32 int32_6522 = 106522; + int32 int32_6523 = 106523; + int32 int32_6524 = 106524; + int32 int32_6525 = 106525; + int32 int32_6526 = 106526; + int32 int32_6527 = 106527; + int32 int32_6528 = 106528; + int32 int32_6529 = 106529; + int32 int32_6530 = 106530; + int32 int32_6531 = 106531; + int32 int32_6532 = 106532; + int32 int32_6533 = 106533; + int32 int32_6534 = 106534; + int32 int32_6535 = 106535; + int32 int32_6536 = 106536; + int32 int32_6537 = 106537; + int32 int32_6538 = 106538; + int32 int32_6539 = 106539; + int32 int32_6540 = 106540; + int32 int32_6541 = 106541; + int32 int32_6542 = 106542; + int32 int32_6543 = 106543; + int32 int32_6544 = 106544; + int32 int32_6545 = 106545; + int32 int32_6546 = 106546; + int32 int32_6547 = 106547; + int32 int32_6548 = 106548; + int32 int32_6549 = 106549; + int32 int32_6550 = 106550; + int32 int32_6551 = 106551; + int32 int32_6552 = 106552; + int32 int32_6553 = 106553; + int32 int32_6554 = 106554; + int32 int32_6555 = 106555; + int32 int32_6556 = 106556; + int32 int32_6557 = 106557; + int32 int32_6558 = 106558; + int32 int32_6559 = 106559; + int32 int32_6560 = 106560; + int32 int32_6561 = 106561; + int32 int32_6562 = 106562; + int32 int32_6563 = 106563; + int32 int32_6564 = 106564; + int32 int32_6565 = 106565; + int32 int32_6566 = 106566; + int32 int32_6567 = 106567; + int32 int32_6568 = 106568; + int32 int32_6569 = 106569; + int32 int32_6570 = 106570; + int32 int32_6571 = 106571; + int32 int32_6572 = 106572; + int32 int32_6573 = 106573; + int32 int32_6574 = 106574; + int32 int32_6575 = 106575; + int32 int32_6576 = 106576; + int32 int32_6577 = 106577; + int32 int32_6578 = 106578; + int32 int32_6579 = 106579; + int32 int32_6580 = 106580; + int32 int32_6581 = 106581; + int32 int32_6582 = 106582; + int32 int32_6583 = 106583; + int32 int32_6584 = 106584; + int32 int32_6585 = 106585; + int32 int32_6586 = 106586; + int32 int32_6587 = 106587; + int32 int32_6588 = 106588; + int32 int32_6589 = 106589; + int32 int32_6590 = 106590; + int32 int32_6591 = 106591; + int32 int32_6592 = 106592; + int32 int32_6593 = 106593; + int32 int32_6594 = 106594; + int32 int32_6595 = 106595; + int32 int32_6596 = 106596; + int32 int32_6597 = 106597; + int32 int32_6598 = 106598; + int32 int32_6599 = 106599; + int32 int32_6600 = 106600; + int32 int32_6601 = 106601; + int32 int32_6602 = 106602; + int32 int32_6603 = 106603; + int32 int32_6604 = 106604; + int32 int32_6605 = 106605; + int32 int32_6606 = 106606; + int32 int32_6607 = 106607; + int32 int32_6608 = 106608; + int32 int32_6609 = 106609; + int32 int32_6610 = 106610; + int32 int32_6611 = 106611; + int32 int32_6612 = 106612; + int32 int32_6613 = 106613; + int32 int32_6614 = 106614; + int32 int32_6615 = 106615; + int32 int32_6616 = 106616; + int32 int32_6617 = 106617; + int32 int32_6618 = 106618; + int32 int32_6619 = 106619; + int32 int32_6620 = 106620; + int32 int32_6621 = 106621; + int32 int32_6622 = 106622; + int32 int32_6623 = 106623; + int32 int32_6624 = 106624; + int32 int32_6625 = 106625; + int32 int32_6626 = 106626; + int32 int32_6627 = 106627; + int32 int32_6628 = 106628; + int32 int32_6629 = 106629; + int32 int32_6630 = 106630; + int32 int32_6631 = 106631; + int32 int32_6632 = 106632; + int32 int32_6633 = 106633; + int32 int32_6634 = 106634; + int32 int32_6635 = 106635; + int32 int32_6636 = 106636; + int32 int32_6637 = 106637; + int32 int32_6638 = 106638; + int32 int32_6639 = 106639; + int32 int32_6640 = 106640; + int32 int32_6641 = 106641; + int32 int32_6642 = 106642; + int32 int32_6643 = 106643; + int32 int32_6644 = 106644; + int32 int32_6645 = 106645; + int32 int32_6646 = 106646; + int32 int32_6647 = 106647; + int32 int32_6648 = 106648; + int32 int32_6649 = 106649; + int32 int32_6650 = 106650; + int32 int32_6651 = 106651; + int32 int32_6652 = 106652; + int32 int32_6653 = 106653; + int32 int32_6654 = 106654; + int32 int32_6655 = 106655; + int32 int32_6656 = 106656; + int32 int32_6657 = 106657; + int32 int32_6658 = 106658; + int32 int32_6659 = 106659; + int32 int32_6660 = 106660; + int32 int32_6661 = 106661; + int32 int32_6662 = 106662; + int32 int32_6663 = 106663; + int32 int32_6664 = 106664; + int32 int32_6665 = 106665; + int32 int32_6666 = 106666; + int32 int32_6667 = 106667; + int32 int32_6668 = 106668; + int32 int32_6669 = 106669; + int32 int32_6670 = 106670; + int32 int32_6671 = 106671; + int32 int32_6672 = 106672; + int32 int32_6673 = 106673; + int32 int32_6674 = 106674; + int32 int32_6675 = 106675; + int32 int32_6676 = 106676; + int32 int32_6677 = 106677; + int32 int32_6678 = 106678; + int32 int32_6679 = 106679; + int32 int32_6680 = 106680; + int32 int32_6681 = 106681; + int32 int32_6682 = 106682; + int32 int32_6683 = 106683; + int32 int32_6684 = 106684; + int32 int32_6685 = 106685; + int32 int32_6686 = 106686; + int32 int32_6687 = 106687; + int32 int32_6688 = 106688; + int32 int32_6689 = 106689; + int32 int32_6690 = 106690; + int32 int32_6691 = 106691; + int32 int32_6692 = 106692; + int32 int32_6693 = 106693; + int32 int32_6694 = 106694; + int32 int32_6695 = 106695; + int32 int32_6696 = 106696; + int32 int32_6697 = 106697; + int32 int32_6698 = 106698; + int32 int32_6699 = 106699; + int32 int32_6700 = 106700; + int32 int32_6701 = 106701; + int32 int32_6702 = 106702; + int32 int32_6703 = 106703; + int32 int32_6704 = 106704; + int32 int32_6705 = 106705; + int32 int32_6706 = 106706; + int32 int32_6707 = 106707; + int32 int32_6708 = 106708; + int32 int32_6709 = 106709; + int32 int32_6710 = 106710; + int32 int32_6711 = 106711; + int32 int32_6712 = 106712; + int32 int32_6713 = 106713; + int32 int32_6714 = 106714; + int32 int32_6715 = 106715; + int32 int32_6716 = 106716; + int32 int32_6717 = 106717; + int32 int32_6718 = 106718; + int32 int32_6719 = 106719; + int32 int32_6720 = 106720; + int32 int32_6721 = 106721; + int32 int32_6722 = 106722; + int32 int32_6723 = 106723; + int32 int32_6724 = 106724; + int32 int32_6725 = 106725; + int32 int32_6726 = 106726; + int32 int32_6727 = 106727; + int32 int32_6728 = 106728; + int32 int32_6729 = 106729; + int32 int32_6730 = 106730; + int32 int32_6731 = 106731; + int32 int32_6732 = 106732; + int32 int32_6733 = 106733; + int32 int32_6734 = 106734; + int32 int32_6735 = 106735; + int32 int32_6736 = 106736; + int32 int32_6737 = 106737; + int32 int32_6738 = 106738; + int32 int32_6739 = 106739; + int32 int32_6740 = 106740; + int32 int32_6741 = 106741; + int32 int32_6742 = 106742; + int32 int32_6743 = 106743; + int32 int32_6744 = 106744; + int32 int32_6745 = 106745; + int32 int32_6746 = 106746; + int32 int32_6747 = 106747; + int32 int32_6748 = 106748; + int32 int32_6749 = 106749; + int32 int32_6750 = 106750; + int32 int32_6751 = 106751; + int32 int32_6752 = 106752; + int32 int32_6753 = 106753; + int32 int32_6754 = 106754; + int32 int32_6755 = 106755; + int32 int32_6756 = 106756; + int32 int32_6757 = 106757; + int32 int32_6758 = 106758; + int32 int32_6759 = 106759; + int32 int32_6760 = 106760; + int32 int32_6761 = 106761; + int32 int32_6762 = 106762; + int32 int32_6763 = 106763; + int32 int32_6764 = 106764; + int32 int32_6765 = 106765; + int32 int32_6766 = 106766; + int32 int32_6767 = 106767; + int32 int32_6768 = 106768; + int32 int32_6769 = 106769; + int32 int32_6770 = 106770; + int32 int32_6771 = 106771; + int32 int32_6772 = 106772; + int32 int32_6773 = 106773; + int32 int32_6774 = 106774; + int32 int32_6775 = 106775; + int32 int32_6776 = 106776; + int32 int32_6777 = 106777; + int32 int32_6778 = 106778; + int32 int32_6779 = 106779; + int32 int32_6780 = 106780; + int32 int32_6781 = 106781; + int32 int32_6782 = 106782; + int32 int32_6783 = 106783; + int32 int32_6784 = 106784; + int32 int32_6785 = 106785; + int32 int32_6786 = 106786; + int32 int32_6787 = 106787; + int32 int32_6788 = 106788; + int32 int32_6789 = 106789; + int32 int32_6790 = 106790; + int32 int32_6791 = 106791; + int32 int32_6792 = 106792; + int32 int32_6793 = 106793; + int32 int32_6794 = 106794; + int32 int32_6795 = 106795; + int32 int32_6796 = 106796; + int32 int32_6797 = 106797; + int32 int32_6798 = 106798; + int32 int32_6799 = 106799; + int32 int32_6800 = 106800; + int32 int32_6801 = 106801; + int32 int32_6802 = 106802; + int32 int32_6803 = 106803; + int32 int32_6804 = 106804; + int32 int32_6805 = 106805; + int32 int32_6806 = 106806; + int32 int32_6807 = 106807; + int32 int32_6808 = 106808; + int32 int32_6809 = 106809; + int32 int32_6810 = 106810; + int32 int32_6811 = 106811; + int32 int32_6812 = 106812; + int32 int32_6813 = 106813; + int32 int32_6814 = 106814; + int32 int32_6815 = 106815; + int32 int32_6816 = 106816; + int32 int32_6817 = 106817; + int32 int32_6818 = 106818; + int32 int32_6819 = 106819; + int32 int32_6820 = 106820; + int32 int32_6821 = 106821; + int32 int32_6822 = 106822; + int32 int32_6823 = 106823; + int32 int32_6824 = 106824; + int32 int32_6825 = 106825; + int32 int32_6826 = 106826; + int32 int32_6827 = 106827; + int32 int32_6828 = 106828; + int32 int32_6829 = 106829; + int32 int32_6830 = 106830; + int32 int32_6831 = 106831; + int32 int32_6832 = 106832; + int32 int32_6833 = 106833; + int32 int32_6834 = 106834; + int32 int32_6835 = 106835; + int32 int32_6836 = 106836; + int32 int32_6837 = 106837; + int32 int32_6838 = 106838; + int32 int32_6839 = 106839; + int32 int32_6840 = 106840; + int32 int32_6841 = 106841; + int32 int32_6842 = 106842; + int32 int32_6843 = 106843; + int32 int32_6844 = 106844; + int32 int32_6845 = 106845; + int32 int32_6846 = 106846; + int32 int32_6847 = 106847; + int32 int32_6848 = 106848; + int32 int32_6849 = 106849; + int32 int32_6850 = 106850; + int32 int32_6851 = 106851; + int32 int32_6852 = 106852; + int32 int32_6853 = 106853; + int32 int32_6854 = 106854; + int32 int32_6855 = 106855; + int32 int32_6856 = 106856; + int32 int32_6857 = 106857; + int32 int32_6858 = 106858; + int32 int32_6859 = 106859; + int32 int32_6860 = 106860; + int32 int32_6861 = 106861; + int32 int32_6862 = 106862; + int32 int32_6863 = 106863; + int32 int32_6864 = 106864; + int32 int32_6865 = 106865; + int32 int32_6866 = 106866; + int32 int32_6867 = 106867; + int32 int32_6868 = 106868; + int32 int32_6869 = 106869; + int32 int32_6870 = 106870; + int32 int32_6871 = 106871; + int32 int32_6872 = 106872; + int32 int32_6873 = 106873; + int32 int32_6874 = 106874; + int32 int32_6875 = 106875; + int32 int32_6876 = 106876; + int32 int32_6877 = 106877; + int32 int32_6878 = 106878; + int32 int32_6879 = 106879; + int32 int32_6880 = 106880; + int32 int32_6881 = 106881; + int32 int32_6882 = 106882; + int32 int32_6883 = 106883; + int32 int32_6884 = 106884; + int32 int32_6885 = 106885; + int32 int32_6886 = 106886; + int32 int32_6887 = 106887; + int32 int32_6888 = 106888; + int32 int32_6889 = 106889; + int32 int32_6890 = 106890; + int32 int32_6891 = 106891; + int32 int32_6892 = 106892; + int32 int32_6893 = 106893; + int32 int32_6894 = 106894; + int32 int32_6895 = 106895; + int32 int32_6896 = 106896; + int32 int32_6897 = 106897; + int32 int32_6898 = 106898; + int32 int32_6899 = 106899; + int32 int32_6900 = 106900; + int32 int32_6901 = 106901; + int32 int32_6902 = 106902; + int32 int32_6903 = 106903; + int32 int32_6904 = 106904; + int32 int32_6905 = 106905; + int32 int32_6906 = 106906; + int32 int32_6907 = 106907; + int32 int32_6908 = 106908; + int32 int32_6909 = 106909; + int32 int32_6910 = 106910; + int32 int32_6911 = 106911; + int32 int32_6912 = 106912; + int32 int32_6913 = 106913; + int32 int32_6914 = 106914; + int32 int32_6915 = 106915; + int32 int32_6916 = 106916; + int32 int32_6917 = 106917; + int32 int32_6918 = 106918; + int32 int32_6919 = 106919; + int32 int32_6920 = 106920; + int32 int32_6921 = 106921; + int32 int32_6922 = 106922; + int32 int32_6923 = 106923; + int32 int32_6924 = 106924; + int32 int32_6925 = 106925; + int32 int32_6926 = 106926; + int32 int32_6927 = 106927; + int32 int32_6928 = 106928; + int32 int32_6929 = 106929; + int32 int32_6930 = 106930; + int32 int32_6931 = 106931; + int32 int32_6932 = 106932; + int32 int32_6933 = 106933; + int32 int32_6934 = 106934; + int32 int32_6935 = 106935; + int32 int32_6936 = 106936; + int32 int32_6937 = 106937; + int32 int32_6938 = 106938; + int32 int32_6939 = 106939; + int32 int32_6940 = 106940; + int32 int32_6941 = 106941; + int32 int32_6942 = 106942; + int32 int32_6943 = 106943; + int32 int32_6944 = 106944; + int32 int32_6945 = 106945; + int32 int32_6946 = 106946; + int32 int32_6947 = 106947; + int32 int32_6948 = 106948; + int32 int32_6949 = 106949; + int32 int32_6950 = 106950; + int32 int32_6951 = 106951; + int32 int32_6952 = 106952; + int32 int32_6953 = 106953; + int32 int32_6954 = 106954; + int32 int32_6955 = 106955; + int32 int32_6956 = 106956; + int32 int32_6957 = 106957; + int32 int32_6958 = 106958; + int32 int32_6959 = 106959; + int32 int32_6960 = 106960; + int32 int32_6961 = 106961; + int32 int32_6962 = 106962; + int32 int32_6963 = 106963; + int32 int32_6964 = 106964; + int32 int32_6965 = 106965; + int32 int32_6966 = 106966; + int32 int32_6967 = 106967; + int32 int32_6968 = 106968; + int32 int32_6969 = 106969; + int32 int32_6970 = 106970; + int32 int32_6971 = 106971; + int32 int32_6972 = 106972; + int32 int32_6973 = 106973; + int32 int32_6974 = 106974; + int32 int32_6975 = 106975; + int32 int32_6976 = 106976; + int32 int32_6977 = 106977; + int32 int32_6978 = 106978; + int32 int32_6979 = 106979; + int32 int32_6980 = 106980; + int32 int32_6981 = 106981; + int32 int32_6982 = 106982; + int32 int32_6983 = 106983; + int32 int32_6984 = 106984; + int32 int32_6985 = 106985; + int32 int32_6986 = 106986; + int32 int32_6987 = 106987; + int32 int32_6988 = 106988; + int32 int32_6989 = 106989; + int32 int32_6990 = 106990; + int32 int32_6991 = 106991; + int32 int32_6992 = 106992; + int32 int32_6993 = 106993; + int32 int32_6994 = 106994; + int32 int32_6995 = 106995; + int32 int32_6996 = 106996; + int32 int32_6997 = 106997; + int32 int32_6998 = 106998; + int32 int32_6999 = 106999; + int32 int32_7000 = 107000; + } +} diff --git a/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies.proto b/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies.proto index 5df67c775d08d..204389b686b71 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies.proto @@ -24,8 +24,8 @@ option cc_enable_arenas = true; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -// In test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest.lazy_imports; +// In test_util.h we do "using namespace unittest = proto2_unittest". +package proto2_unittest.lazy_imports; // Protos optimized for SPEED use a strict superset of the generated code // of equivalent ones optimized for CODE_SIZE, so we should optimize all our diff --git a/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto b/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto index 3b055dc66c490..7de13531c1d23 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto @@ -25,8 +25,8 @@ option cc_enable_arenas = true; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -// In test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest.lazy_imports; +// In test_util.h we do "using namespace unittest = proto2_unittest". +package proto2_unittest.lazy_imports; // Protos optimized for SPEED use a strict superset of the generated code // of equivalent ones optimized for CODE_SIZE, so we should optimize all our diff --git a/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_enum.proto b/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_enum.proto index 851abc426791d..4bbe318b3601d 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_enum.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_enum.proto @@ -25,8 +25,8 @@ option cc_enable_arenas = true; // We don't put this in a package within proto2 because we need to make sure // that the generated code doesn't depend on being in the proto2 namespace. -// In test_util.h we do "using namespace unittest = protobuf_unittest". -package protobuf_unittest.lazy_imports; +// In test_util.h we do "using namespace unittest = proto2_unittest". +package proto2_unittest.lazy_imports; // Protos optimized for SPEED use a strict superset of the generated code // of equivalent ones optimized for CODE_SIZE, so we should optimize all our diff --git a/third_party/protobuf/src/google/protobuf/unittest_lite.proto b/third_party/protobuf/src/google/protobuf/unittest_lite.proto index 0a6c0456c3321..1ea260cec4b65 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_lite.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_lite.proto @@ -11,7 +11,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/unittest_import_lite.proto"; @@ -65,17 +65,17 @@ message TestAllTypesLite { NestedMessage optional_nested_message = 18; ForeignMessageLite optional_foreign_message = 19; - protobuf_unittest_import.ImportMessageLite optional_import_message = 20; + proto2_unittest_import.ImportMessageLite optional_import_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnumLite optional_foreign_enum = 22; - protobuf_unittest_import.ImportEnumLite optional_import_enum = 23; + proto2_unittest_import.ImportEnumLite optional_import_enum = 23; string optional_string_piece = 24 [ctype = STRING_PIECE]; string optional_cord = 25 [ctype = CORD]; bytes optional_bytes_cord = 86 [ctype = CORD]; // Defined in unittest_import_public.proto - protobuf_unittest_import.PublicImportMessageLite + proto2_unittest_import.PublicImportMessageLite optional_public_import_message = 26; NestedMessage optional_lazy_message = 27 [lazy = true]; @@ -107,11 +107,11 @@ message TestAllTypesLite { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessageLite repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessageLite repeated_import_message = + repeated proto2_unittest_import.ImportMessageLite repeated_import_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnumLite repeated_foreign_enum = 52; - repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53; + repeated proto2_unittest_import.ImportEnumLite repeated_import_enum = 53; repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; repeated string repeated_cord = 55 [ctype = CORD]; @@ -153,7 +153,7 @@ message TestAllTypesLite { ForeignEnumLite default_foreign_enum = 82 [default = FOREIGN_LITE_BAR]; - protobuf_unittest_import.ImportEnumLite default_import_enum = 83 + proto2_unittest_import.ImportEnumLite default_import_enum = 83 [default = IMPORT_LITE_BAR]; string default_string_piece = 84 [ctype = STRING_PIECE, default = "abc"]; @@ -251,11 +251,11 @@ extend TestAllExtensionsLite { TestAllTypesLite.NestedMessage optional_nested_message_extension_lite = 18; ForeignMessageLite optional_foreign_message_extension_lite = 19; - protobuf_unittest_import.ImportMessageLite + proto2_unittest_import.ImportMessageLite optional_import_message_extension_lite = 20; TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21; ForeignEnumLite optional_foreign_enum_extension_lite = 22; - protobuf_unittest_import.ImportEnumLite optional_import_enum_extension_lite = + proto2_unittest_import.ImportEnumLite optional_import_enum_extension_lite = 23; string optional_string_piece_extension_lite = 24 [ctype = STRING_PIECE]; @@ -263,7 +263,7 @@ extend TestAllExtensionsLite { // ctype=CORD option back after it is supported. string optional_cord_extension_lite = 25; bytes optional_bytes_cord_extension_lite = 86; - protobuf_unittest_import.PublicImportMessageLite + proto2_unittest_import.PublicImportMessageLite optional_public_import_message_extension_lite = 26; TestAllTypesLite.NestedMessage optional_lazy_message_extension_lite = 27 [lazy = true]; @@ -294,11 +294,11 @@ extend TestAllExtensionsLite { repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite = 48; repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49; - repeated protobuf_unittest_import.ImportMessageLite + repeated proto2_unittest_import.ImportMessageLite repeated_import_message_extension_lite = 50; repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51; repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52; - repeated protobuf_unittest_import.ImportEnumLite + repeated proto2_unittest_import.ImportEnumLite repeated_import_enum_extension_lite = 53; repeated string repeated_string_piece_extension_lite = 54 [ctype = STRING_PIECE]; @@ -346,7 +346,7 @@ extend TestAllExtensionsLite { ForeignEnumLite default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR]; - protobuf_unittest_import.ImportEnumLite default_import_enum_extension_lite = 83 + proto2_unittest_import.ImportEnumLite default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR]; string default_string_piece_extension_lite = 84 @@ -554,8 +554,8 @@ message TestHugeFieldNumbersLite { extensions 536860000 to 536869999 [declaration = { number: 536860000 - full_name: ".protobuf_unittest.test_all_types_lite" - type: ".protobuf_unittest.TestAllTypesLite" + full_name: ".proto2_unittest.test_all_types_lite" + type: ".proto2_unittest.TestAllTypesLite" }]; } diff --git a/third_party/protobuf/src/google/protobuf/unittest_lite_edition_2024.proto b/third_party/protobuf/src/google/protobuf/unittest_lite_edition_2024.proto index b56f7d026a2b1..6cdaf7d7987fe 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_lite_edition_2024.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_lite_edition_2024.proto @@ -1,6 +1,6 @@ edition = "2024"; -package protobuf_unittest; +package proto2_unittest; option optimize_for = LITE_RUNTIME; diff --git a/third_party/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto b/third_party/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto index 681e6a87a2208..9399896d1c2d3 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto @@ -11,7 +11,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/unittest.proto"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_mset.proto b/third_party/protobuf/src/google/protobuf/unittest_mset.proto index 8c7a7b15e24bb..94b47127f3dd2 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_mset.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_mset.proto @@ -16,7 +16,7 @@ syntax = "proto2"; import "google/protobuf/unittest_mset_wire_format.proto"; -package protobuf_unittest; +package proto2_unittest; option cc_enable_arenas = true; option optimize_for = SPEED; diff --git a/third_party/protobuf/src/google/protobuf/unittest_mset_wire_format.proto b/third_party/protobuf/src/google/protobuf/unittest_mset_wire_format.proto index 548e248e9b8ff..6242b80314892 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_mset_wire_format.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_mset_wire_format.proto @@ -28,8 +28,8 @@ message TestMessageSet { extensions 530000000 to max [declaration = { number: 1952731290, - full_name: ".protobuf_unittest_v1api.TestMessageSetExtension3.message_set_extension", - type: ".protobuf_unittest_v1api.TestMessageSetExtension3" + full_name: ".proto2_unittest_v1api.TestMessageSetExtension3.message_set_extension", + type: ".proto2_unittest_v1api.TestMessageSetExtension3" }]; } diff --git a/third_party/protobuf/src/google/protobuf/unittest_no_field_presence.proto b/third_party/protobuf/src/google/protobuf/unittest_no_field_presence.proto index cb25084c63b17..6ec49937eca99 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_no_field_presence.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_no_field_presence.proto @@ -51,13 +51,13 @@ message TestAllTypes { NestedMessage optional_nested_message = 18; ForeignMessage optional_foreign_message = 19; - protobuf_unittest.TestAllTypes optional_proto2_message = 20; + proto2_unittest.TestAllTypes optional_proto2_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnum optional_foreign_enum = 22; // N.B.: proto2-enum-type fields not allowed, because their default values // might not be zero. - // optional protobuf_unittest.ForeignEnum optional_proto2_enum = + // optional proto2_unittest.ForeignEnum optional_proto2_enum = // 23; string optional_string_piece = 24 [ctype = STRING_PIECE]; @@ -84,7 +84,7 @@ message TestAllTypes { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest.TestAllTypes repeated_proto2_message = 50; + repeated proto2_unittest.TestAllTypes repeated_proto2_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnum repeated_foreign_enum = 52; @@ -110,7 +110,7 @@ message TestAllMapTypes { } message TestProto2Required { - protobuf_unittest.TestRequired proto2 = 1; + proto2_unittest.TestRequired proto2 = 1; } // Define these after TestAllTypes to make sure the compiler can handle diff --git a/third_party/protobuf/src/google/protobuf/unittest_no_generic_services.proto b/third_party/protobuf/src/google/protobuf/unittest_no_generic_services.proto index af3ecb57805e3..3b1ab626c4fd7 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_no_generic_services.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_no_generic_services.proto @@ -9,7 +9,7 @@ syntax = "proto2"; -package protobuf_unittest.no_generic_services_test; +package proto2_unittest.no_generic_services_test; // *_generic_services are false by default. diff --git a/third_party/protobuf/src/google/protobuf/unittest_optimize_for.proto b/third_party/protobuf/src/google/protobuf/unittest_optimize_for.proto index c5e170724d0d8..147fa4eb8e63f 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_optimize_for.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_optimize_for.proto @@ -13,7 +13,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/unittest.proto"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_proto3.proto b/third_party/protobuf/src/google/protobuf/unittest_proto3.proto index d88521afea5ba..48674bd4cd8ad 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_proto3.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_proto3.proto @@ -55,7 +55,7 @@ message TestAllTypes { optional NestedMessage optional_nested_message = 18; ForeignMessage optional_foreign_message = 19; - protobuf_unittest_import.ImportMessage optional_import_message = 20; + proto2_unittest_import.ImportMessage optional_import_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnum optional_foreign_enum = 22; @@ -63,18 +63,18 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; + // optional proto2_unittest_import.ImportEnum optional_import_enum = 23; string optional_string_piece = 24 [ctype = STRING_PIECE]; string optional_cord = 25 [ctype = CORD]; // Defined in unittest_import_public.proto - protobuf_unittest_import.PublicImportMessage optional_public_import_message = + proto2_unittest_import.PublicImportMessage optional_public_import_message = 26; NestedMessage optional_lazy_message = 27 [lazy = true]; NestedMessage optional_unverified_lazy_message = 28 [unverified_lazy = true]; - protobuf_unittest_import.ImportMessage optional_lazy_import_message = 115 + proto2_unittest_import.ImportMessage optional_lazy_import_message = 115 [lazy = true]; // Repeated @@ -101,7 +101,7 @@ message TestAllTypes { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + repeated proto2_unittest_import.ImportMessage repeated_import_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnum repeated_foreign_enum = 52; @@ -109,7 +109,7 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // repeated proto2_unittest_import.ImportEnum repeated_import_enum = 53; repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; repeated string repeated_cord = 55 [ctype = CORD]; diff --git a/third_party/protobuf/src/google/protobuf/unittest_proto3_arena.proto b/third_party/protobuf/src/google/protobuf/unittest_proto3_arena.proto index ea801cef647e7..1d8a59e3883ea 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_proto3_arena.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_proto3_arena.proto @@ -55,7 +55,7 @@ message TestAllTypes { NestedMessage optional_nested_message = 18; ForeignMessage optional_foreign_message = 19; - protobuf_unittest_import.ImportMessage optional_import_message = 20; + proto2_unittest_import.ImportMessage optional_import_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnum optional_foreign_enum = 22; @@ -63,19 +63,19 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; + // optional proto2_unittest_import.ImportEnum optional_import_enum = 23; string optional_string_piece = 24 [ctype=STRING_PIECE]; string optional_cord = 25 [ctype=CORD]; bytes optional_bytes_cord = 86 [ctype=CORD]; // Defined in unittest_import_public.proto - protobuf_unittest_import.PublicImportMessage + proto2_unittest_import.PublicImportMessage optional_public_import_message = 26; NestedMessage optional_lazy_message = 27 [lazy=true]; NestedMessage optional_unverified_lazy_message = 28 [unverified_lazy=true]; - protobuf_unittest_import.ImportMessage optional_lazy_import_message = 115 + proto2_unittest_import.ImportMessage optional_lazy_import_message = 115 [lazy = true]; // Repeated @@ -119,7 +119,7 @@ message TestAllTypes { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + repeated proto2_unittest_import.ImportMessage repeated_import_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnum repeated_foreign_enum = 52; @@ -127,7 +127,7 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // repeated proto2_unittest_import.ImportEnum repeated_import_enum = 53; repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; repeated string repeated_cord = 55 [ctype=CORD]; diff --git a/third_party/protobuf/src/google/protobuf/unittest_proto3_arena_lite.proto b/third_party/protobuf/src/google/protobuf/unittest_proto3_arena_lite.proto index 9c73675675a52..5e38550bbbe81 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_proto3_arena_lite.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_proto3_arena_lite.proto @@ -56,7 +56,7 @@ message TestAllTypes { NestedMessage optional_nested_message = 18; ForeignMessage optional_foreign_message = 19; - protobuf_unittest_import.ImportMessage optional_import_message = 20; + proto2_unittest_import.ImportMessage optional_import_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnum optional_foreign_enum = 22; @@ -64,13 +64,13 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; + // optional proto2_unittest_import.ImportEnum optional_import_enum = 23; string optional_string_piece = 24 [ctype = STRING_PIECE]; string optional_cord = 25 [ctype = CORD]; // Defined in unittest_import_public.proto - protobuf_unittest_import.PublicImportMessage optional_public_import_message = + proto2_unittest_import.PublicImportMessage optional_public_import_message = 26; NestedMessage optional_lazy_message = 27 [lazy = true]; @@ -99,7 +99,7 @@ message TestAllTypes { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + repeated proto2_unittest_import.ImportMessage repeated_import_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnum repeated_foreign_enum = 52; @@ -107,12 +107,12 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // repeated proto2_unittest_import.ImportEnum repeated_import_enum = 53; repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; repeated string repeated_cord = 55 [ctype = CORD]; - repeated NestedMessage repeated_lazy_message = 57 ; + repeated NestedMessage repeated_lazy_message = 57; oneof oneof_field { uint32 oneof_uint32 = 111; diff --git a/third_party/protobuf/src/google/protobuf/unittest_proto3_lite.proto b/third_party/protobuf/src/google/protobuf/unittest_proto3_lite.proto index ffc6681baf62e..dee3401749bec 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_proto3_lite.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_proto3_lite.proto @@ -55,7 +55,7 @@ message TestAllTypes { NestedMessage optional_nested_message = 18; ForeignMessage optional_foreign_message = 19; - protobuf_unittest_import.ImportMessage optional_import_message = 20; + proto2_unittest_import.ImportMessage optional_import_message = 20; NestedEnum optional_nested_enum = 21; ForeignEnum optional_foreign_enum = 22; @@ -63,13 +63,13 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; + // optional proto2_unittest_import.ImportEnum optional_import_enum = 23; string optional_string_piece = 24 [ctype = STRING_PIECE]; string optional_cord = 25 [ctype = CORD]; // Defined in unittest_import_public.proto - protobuf_unittest_import.PublicImportMessage optional_public_import_message = + proto2_unittest_import.PublicImportMessage optional_public_import_message = 26; NestedMessage optional_lazy_message = 27 [lazy = true]; @@ -98,7 +98,7 @@ message TestAllTypes { repeated NestedMessage repeated_nested_message = 48; repeated ForeignMessage repeated_foreign_message = 49; - repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + repeated proto2_unittest_import.ImportMessage repeated_import_message = 50; repeated NestedEnum repeated_nested_enum = 51; repeated ForeignEnum repeated_foreign_enum = 52; @@ -106,12 +106,12 @@ message TestAllTypes { // Omitted (compared to unittest.proto) because proto2 enums are not allowed // inside proto2 messages. // - // repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // repeated proto2_unittest_import.ImportEnum repeated_import_enum = 53; repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; repeated string repeated_cord = 55 [ctype = CORD]; - repeated NestedMessage repeated_lazy_message = 57 ; + repeated NestedMessage repeated_lazy_message = 57; oneof oneof_field { uint32 oneof_uint32 = 111; diff --git a/third_party/protobuf/src/google/protobuf/unittest_proto3_optional.proto b/third_party/protobuf/src/google/protobuf/unittest_proto3_optional.proto index 1169847f9c4fe..1354212b13ef3 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_proto3_optional.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_proto3_optional.proto @@ -7,7 +7,7 @@ syntax = "proto3"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/descriptor.proto"; @@ -68,8 +68,8 @@ message TestProto3OptionalMessage { } message Proto3OptionalExtensions { - option (protobuf_unittest.Proto3OptionalExtensions.ext_no_optional) = 8; - option (protobuf_unittest.Proto3OptionalExtensions.ext_with_optional) = 16; + option (proto2_unittest.Proto3OptionalExtensions.ext_no_optional) = 8; + option (proto2_unittest.Proto3OptionalExtensions.ext_with_optional) = 16; extend google.protobuf.MessageOptions { int32 ext_no_optional = 355886728; diff --git a/third_party/protobuf/src/google/protobuf/unittest_redaction.proto b/third_party/protobuf/src/google/protobuf/unittest_redaction.proto new file mode 100644 index 0000000000000..ce2729eac36e2 --- /dev/null +++ b/third_party/protobuf/src/google/protobuf/unittest_redaction.proto @@ -0,0 +1,72 @@ +// Test proto for redaction +edition = "2023"; + +package proto2_unittest; + +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protos"; +option java_outer_classname = "RedactionProto"; +option features.repeated_field_encoding = EXPANDED; +option features.utf8_validation = NONE; + +extend .google.protobuf.FieldOptions { + MetaAnnotatedEnum meta_annotated_enum = 535801413; + repeated MetaAnnotatedEnum repeated_meta_annotated_enum = 535801414; + TestNestedMessageEnum test_nested_message_enum = 535801415; +} + +message TestRedactedNestMessage { + string foo = 1; +} + +message TestRepeatedRedactedNestMessage { + string bar = 1; +} + +message TestMessageEnum { + repeated MetaAnnotatedEnum redactable_enum = 1; +} + +message TestNestedMessageEnum { + repeated MetaAnnotatedEnum direct_enum = 1; + TestMessageEnum nested_enum = 2; + string redacted_string = 3 [debug_redact = true]; +} + +message TestRedactedMessage { + string text_field = 1 [deprecated = true]; + string meta_annotated = 8 [(meta_annotated_enum) = TEST_REDACTABLE]; + string repeated_meta_annotated = 9 [ + (proto2_unittest.repeated_meta_annotated_enum) = TEST_NO_REDACT, + (proto2_unittest.repeated_meta_annotated_enum) = TEST_REDACTABLE + ]; + string unredacted_repeated_annotations = 10 [ + (proto2_unittest.repeated_meta_annotated_enum) = TEST_NO_REDACT, + (proto2_unittest.repeated_meta_annotated_enum) = TEST_NO_REDACT_AGAIN + ]; + string unreported_non_meta_debug_redact_field = 17 [debug_redact = true]; + google.protobuf.Any any_field = 18 [debug_redact = true]; + string redactable_false = 19 [(meta_annotated_enum) = TEST_REDACTABLE_FALSE]; + string test_direct_message_enum = 22 + [(proto2_unittest.test_nested_message_enum) = { + direct_enum: [ TEST_NO_REDACT, TEST_REDACTABLE ] + }]; + string test_nested_message_enum = 23 + [(proto2_unittest.test_nested_message_enum) = { + nested_enum { redactable_enum: [ TEST_NO_REDACT, TEST_REDACTABLE ] } + }]; + string test_redacted_message_enum = 24 + [(proto2_unittest.test_nested_message_enum) = { + redacted_string: "redacted_but_doesnt_redact" + }]; +} + +enum MetaAnnotatedEnum { + TEST_NULL = 0; + TEST_REDACTABLE = 1 [debug_redact = true]; + TEST_NO_REDACT = 2; + TEST_NO_REDACT_AGAIN = 3; + TEST_REDACTABLE_FALSE = 4 [debug_redact = false]; +} diff --git a/third_party/protobuf/src/google/protobuf/unittest_retention.proto b/third_party/protobuf/src/google/protobuf/unittest_retention.proto index 9998363833081..6c31846a20359 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_retention.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_retention.proto @@ -7,7 +7,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/descriptor.proto"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_string_type.proto b/third_party/protobuf/src/google/protobuf/unittest_string_type.proto index 611588f191854..713234d5ca225 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_string_type.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_string_type.proto @@ -7,7 +7,7 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/cpp_features.proto"; diff --git a/third_party/protobuf/src/google/protobuf/unittest_string_view.proto b/third_party/protobuf/src/google/protobuf/unittest_string_view.proto index f2e8531e8661d..d294196e3c4c0 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_string_view.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_string_view.proto @@ -1,6 +1,6 @@ edition = "2023"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/cpp_features.proto"; @@ -8,10 +8,11 @@ option java_multiple_files = true; option optimize_for = SPEED; option features.(pb.cpp).string_type = VIEW; -// NEXT_TAG = 5; +// NEXT_TAG = 6; message TestStringView { string singular_string = 1; bytes singular_bytes = 2; + string implicit_presence = 5 [features.field_presence = IMPLICIT]; repeated string repeated_string = 3; repeated bytes repeated_bytes = 4; diff --git a/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto b/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto index 05f25d6ad9ecb..36eff35a14d1c 100644 --- a/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto +++ b/third_party/protobuf/src/google/protobuf/unittest_well_known_types.proto @@ -7,11 +7,7 @@ syntax = "proto3"; -package protobuf_unittest; - -option csharp_namespace = "Google.Protobuf.TestProtos"; -option java_multiple_files = true; -option java_package = "com.google.protobuf.test"; +package proto2_unittest; import "google/protobuf/any.proto"; import "google/protobuf/api.proto"; @@ -24,6 +20,10 @@ import "google/protobuf/timestamp.proto"; import "google/protobuf/type.proto"; import "google/protobuf/wrappers.proto"; +option csharp_namespace = "Google.Protobuf.TestProtos"; +option java_multiple_files = true; +option java_package = "com.google.protobuf.test"; + // Test that we can include all well-known types. // Each wrapper type is included separately, as languages // map handle different wrappers in different ways. @@ -100,22 +100,22 @@ message OneofWellKnownTypes { // need to worry about the value part of the map being the // well-known types, as messages can't be map keys. message MapWellKnownTypes { - map<int32,google.protobuf.Any> any_field = 1; - map<int32,google.protobuf.Api> api_field = 2; - map<int32,google.protobuf.Duration> duration_field = 3; - map<int32,google.protobuf.Empty> empty_field = 4; - map<int32,google.protobuf.FieldMask> field_mask_field = 5; - map<int32,google.protobuf.SourceContext> source_context_field = 6; - map<int32,google.protobuf.Struct> struct_field = 7; - map<int32,google.protobuf.Timestamp> timestamp_field = 8; - map<int32,google.protobuf.Type> type_field = 9; - map<int32,google.protobuf.DoubleValue> double_field = 10; - map<int32,google.protobuf.FloatValue> float_field = 11; - map<int32,google.protobuf.Int64Value> int64_field = 12; - map<int32,google.protobuf.UInt64Value> uint64_field = 13; - map<int32,google.protobuf.Int32Value> int32_field = 14; - map<int32,google.protobuf.UInt32Value> uint32_field = 15; - map<int32,google.protobuf.BoolValue> bool_field = 16; - map<int32,google.protobuf.StringValue> string_field = 17; - map<int32,google.protobuf.BytesValue> bytes_field = 18; + map<int32, google.protobuf.Any> any_field = 1; + map<int32, google.protobuf.Api> api_field = 2; + map<int32, google.protobuf.Duration> duration_field = 3; + map<int32, google.protobuf.Empty> empty_field = 4; + map<int32, google.protobuf.FieldMask> field_mask_field = 5; + map<int32, google.protobuf.SourceContext> source_context_field = 6; + map<int32, google.protobuf.Struct> struct_field = 7; + map<int32, google.protobuf.Timestamp> timestamp_field = 8; + map<int32, google.protobuf.Type> type_field = 9; + map<int32, google.protobuf.DoubleValue> double_field = 10; + map<int32, google.protobuf.FloatValue> float_field = 11; + map<int32, google.protobuf.Int64Value> int64_field = 12; + map<int32, google.protobuf.UInt64Value> uint64_field = 13; + map<int32, google.protobuf.Int32Value> int32_field = 14; + map<int32, google.protobuf.UInt32Value> uint32_field = 15; + map<int32, google.protobuf.BoolValue> bool_field = 16; + map<int32, google.protobuf.StringValue> string_field = 17; + map<int32, google.protobuf.BytesValue> bytes_field = 18; } diff --git a/third_party/protobuf/src/google/protobuf/unknown_field_set.cc b/third_party/protobuf/src/google/protobuf/unknown_field_set.cc index 05c0c93a47bb2..9c2123182c899 100644 --- a/third_party/protobuf/src/google/protobuf/unknown_field_set.cc +++ b/third_party/protobuf/src/google/protobuf/unknown_field_set.cc @@ -11,6 +11,7 @@ #include "google/protobuf/unknown_field_set.h" +#include <cstdint> #include <cstring> #include <string> #include <utility> @@ -22,11 +23,10 @@ #include "google/protobuf/generated_message_tctable_impl.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream.h" -#include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" +#include "google/protobuf/message_lite.h" #include "google/protobuf/parse_context.h" #include "google/protobuf/wire_format.h" -#include "google/protobuf/wire_format_lite.h" // Must be included last. #include "google/protobuf/port_def.inc" @@ -86,7 +86,7 @@ size_t UnknownFieldSet::SpaceUsedExcludingSelfLong() const { *field.data_.string_value); break; case UnknownField::TYPE_GROUP: - total_size += field.data_.group_->SpaceUsedLong(); + total_size += field.data_.group->SpaceUsedLong(); break; default: break; @@ -103,21 +103,21 @@ void UnknownFieldSet::AddVarint(int number, uint64_t value) { auto& field = *fields_.Add(); field.number_ = number; field.SetType(UnknownField::TYPE_VARINT); - field.data_.varint_ = value; + field.data_.varint = value; } void UnknownFieldSet::AddFixed32(int number, uint32_t value) { auto& field = *fields_.Add(); field.number_ = number; field.SetType(UnknownField::TYPE_FIXED32); - field.data_.fixed32_ = value; + field.data_.fixed32 = value; } void UnknownFieldSet::AddFixed64(int number, uint64_t value) { auto& field = *fields_.Add(); field.number_ = number; field.SetType(UnknownField::TYPE_FIXED64); - field.data_.fixed64_ = value; + field.data_.fixed64 = value; } void UnknownFieldSet::AddLengthDelimited(int number, const absl::Cord& value) { @@ -146,8 +146,8 @@ UnknownFieldSet* UnknownFieldSet::AddGroup(int number) { auto& field = *fields_.Add(); field.number_ = number; field.SetType(UnknownField::TYPE_GROUP); - field.data_.group_ = Arena::Create<UnknownFieldSet>(arena()); - return field.data_.group_; + field.data_.group = Arena::Create<UnknownFieldSet>(arena()); + return field.data_.group; } void UnknownFieldSet::AddField(const UnknownField& field) { @@ -165,8 +165,8 @@ void UnknownFieldSet::DeleteSubrange(int start, int num) { } void UnknownFieldSet::DeleteByNumber(int number) { - size_t left = 0; // The number of fields left after deletion. - for (size_t i = 0; i < fields_.size(); ++i) { + int left = 0; // The number of fields left after deletion. + for (int i = 0; i < fields_.size(); ++i) { UnknownField* field = &(fields_)[i]; if (field->number() == number) { if (arena() == nullptr) { @@ -242,7 +242,7 @@ void UnknownField::Delete() { delete data_.string_value; break; case UnknownField::TYPE_GROUP: - delete data_.group_; + delete data_.group; break; default: break; @@ -258,8 +258,8 @@ UnknownField UnknownField::DeepCopy(Arena* arena) const { break; case UnknownField::TYPE_GROUP: { UnknownFieldSet* group = Arena::Create<UnknownFieldSet>(arena); - group->MergeFrom(*data_.group_); - copy.data_.group_ = group; + group->MergeFrom(*data_.group); + copy.data_.group = group; break; } default: diff --git a/third_party/protobuf/src/google/protobuf/unknown_field_set.h b/third_party/protobuf/src/google/protobuf/unknown_field_set.h index aeac15f44e259..771f075103304 100644 --- a/third_party/protobuf/src/google/protobuf/unknown_field_set.h +++ b/third_party/protobuf/src/google/protobuf/unknown_field_set.h @@ -17,14 +17,17 @@ #include <assert.h> -#include <atomic> +#include <cstddef> +#include <cstdint> #include <string> +#include <type_traits> +#include <utility> -#include "google/protobuf/stubs/common.h" #include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena.h" +#include "google/protobuf/internal_visibility.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "google/protobuf/message_lite.h" @@ -118,11 +121,11 @@ class PROTOBUF_EXPORT UnknownField { uint32_t number_; uint32_t type_; union { - uint64_t varint_; - uint32_t fixed32_; - uint64_t fixed64_; + uint64_t varint; + uint32_t fixed32; + uint64_t fixed64; std::string* string_value; - UnknownFieldSet* group_; + UnknownFieldSet* group; } data_; }; @@ -268,8 +271,8 @@ class PROTOBUF_EXPORT UnknownFieldSet { void SwapSlow(UnknownFieldSet* other); template <typename MessageType, - typename std::enable_if< - std::is_base_of<Message, MessageType>::value, int>::type = 0> + typename std::enable_if_t< + std::is_base_of<Message, MessageType>::value, int> = 0> bool InternalMergeFromMessage(const MessageType& message) { MergeFrom(message.GetReflection()->GetUnknownFields(message)); return true; @@ -364,15 +367,15 @@ inline UnknownField::Type UnknownField::type() const { inline uint64_t UnknownField::varint() const { assert(type() == TYPE_VARINT); - return data_.varint_; + return data_.varint; } inline uint32_t UnknownField::fixed32() const { assert(type() == TYPE_FIXED32); - return data_.fixed32_; + return data_.fixed32; } inline uint64_t UnknownField::fixed64() const { assert(type() == TYPE_FIXED64); - return data_.fixed64_; + return data_.fixed64; } inline internal::UFSStringView UnknownField::length_delimited() const { assert(type() == TYPE_LENGTH_DELIMITED); @@ -380,20 +383,20 @@ inline internal::UFSStringView UnknownField::length_delimited() const { } inline const UnknownFieldSet& UnknownField::group() const { assert(type() == TYPE_GROUP); - return *data_.group_; + return *data_.group; } inline void UnknownField::set_varint(uint64_t value) { assert(type() == TYPE_VARINT); - data_.varint_ = value; + data_.varint = value; } inline void UnknownField::set_fixed32(uint32_t value) { assert(type() == TYPE_FIXED32); - data_.fixed32_ = value; + data_.fixed32 = value; } inline void UnknownField::set_fixed64(uint64_t value) { assert(type() == TYPE_FIXED64); - data_.fixed64_ = value; + data_.fixed64 = value; } inline void UnknownField::set_length_delimited(const absl::string_view value) { assert(type() == TYPE_LENGTH_DELIMITED); @@ -416,7 +419,7 @@ inline std::string* UnknownField::mutable_length_delimited() { #endif // PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE inline UnknownFieldSet* UnknownField::mutable_group() { assert(type() == TYPE_GROUP); - return data_.group_; + return data_.group; } template <typename MessageType> bool UnknownFieldSet::MergeFromMessage(const MessageType& message) { diff --git a/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc b/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc index 9b356c517281e..62d47e2876565 100644 --- a/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc @@ -837,7 +837,7 @@ TEST_F(UnknownFieldSetTest, SerializeToCord_TestPackedTypes) { ASSERT_TRUE(field_set.SerializeToCord(&cord)); unittest::TestPackedTypes message; - ASSERT_TRUE(message.ParseFromCord(cord)); + ASSERT_TRUE(message.ParseFromString(cord)); EXPECT_THAT(message.packed_int32(), ElementsAre(-1, -2, -3, -4)); EXPECT_THAT(message.packed_uint64(), ElementsAre(5, 6, 7)); } diff --git a/third_party/protobuf/src/google/protobuf/unredacted_debug_format_for_test_test.cc b/third_party/protobuf/src/google/protobuf/unredacted_debug_format_for_test_test.cc index ceff5ba05801c..bc636cb906fa8 100644 --- a/third_party/protobuf/src/google/protobuf/unredacted_debug_format_for_test_test.cc +++ b/third_party/protobuf/src/google/protobuf/unredacted_debug_format_for_test_test.cc @@ -13,9 +13,9 @@ using ::google::protobuf::util::UnredactedUtf8DebugFormatForTest; using ::testing::StrEq; TEST(UnredactedDebugFormatAPITest, MessageUnredactedDebugFormat) { - protobuf_unittest::RedactedFields proto; - protobuf_unittest::TestNestedMessageRedaction redacted_nested_proto; - protobuf_unittest::TestNestedMessageRedaction unredacted_nested_proto; + proto2_unittest::RedactedFields proto; + proto2_unittest::TestNestedMessageRedaction redacted_nested_proto; + proto2_unittest::TestNestedMessageRedaction unredacted_nested_proto; redacted_nested_proto.set_optional_unredacted_nested_string( "\350\260\267\346\255\214"); unredacted_nested_proto.set_optional_unredacted_nested_string( @@ -33,9 +33,9 @@ TEST(UnredactedDebugFormatAPITest, MessageUnredactedDebugFormat) { } TEST(UnredactedDebugFormatAPITest, MessageUnredactedShortDebugFormat) { - protobuf_unittest::RedactedFields proto; - protobuf_unittest::TestNestedMessageRedaction redacted_nested_proto; - protobuf_unittest::TestNestedMessageRedaction unredacted_nested_proto; + proto2_unittest::RedactedFields proto; + proto2_unittest::TestNestedMessageRedaction redacted_nested_proto; + proto2_unittest::TestNestedMessageRedaction unredacted_nested_proto; redacted_nested_proto.set_optional_unredacted_nested_string("hello"); unredacted_nested_proto.set_optional_unredacted_nested_string("world"); *proto.mutable_optional_redacted_message() = redacted_nested_proto; @@ -49,9 +49,9 @@ TEST(UnredactedDebugFormatAPITest, MessageUnredactedShortDebugFormat) { } TEST(UnredactedDebugFormatAPITest, MessageUnredactedUtf8DebugFormat) { - protobuf_unittest::RedactedFields proto; - protobuf_unittest::TestNestedMessageRedaction redacted_nested_proto; - protobuf_unittest::TestNestedMessageRedaction unredacted_nested_proto; + proto2_unittest::RedactedFields proto; + proto2_unittest::TestNestedMessageRedaction redacted_nested_proto; + proto2_unittest::TestNestedMessageRedaction unredacted_nested_proto; redacted_nested_proto.set_optional_unredacted_nested_string( "\350\260\267\346\255\214"); unredacted_nested_proto.set_optional_unredacted_nested_string( @@ -69,18 +69,18 @@ TEST(UnredactedDebugFormatAPITest, MessageUnredactedUtf8DebugFormat) { } TEST(UnredactedDebugFormatAPITest, LiteUnredactedDebugFormat) { - protobuf_unittest::TestAllTypesLite message; + proto2_unittest::TestAllTypesLite message; EXPECT_EQ(UnredactedDebugFormatForTest(message), message.DebugString()); } TEST(UnredactedDebugFormatAPITest, LiteUnredactedShortDebugFormat) { - protobuf_unittest::TestAllTypesLite message; + proto2_unittest::TestAllTypesLite message; EXPECT_EQ(UnredactedShortDebugFormatForTest(message), message.ShortDebugString()); } TEST(UnredactedDebugFormatAPITest, LiteUnredactedUtf8DebugFormat) { - protobuf_unittest::TestAllTypesLite message; + proto2_unittest::TestAllTypesLite message; EXPECT_EQ(UnredactedUtf8DebugFormatForTest(message), message.Utf8DebugString()); } diff --git a/third_party/protobuf/src/google/protobuf/util/BUILD.bazel b/third_party/protobuf/src/google/protobuf/util/BUILD.bazel index 5522789089190..f6c16b6ce63e4 100644 --- a/third_party/protobuf/src/google/protobuf/util/BUILD.bazel +++ b/third_party/protobuf/src/google/protobuf/util/BUILD.bazel @@ -32,8 +32,8 @@ cc_test( "//src/google/protobuf:test_util", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -55,14 +55,14 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/io:printer", "//src/google/protobuf/stubs", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:fixed_array", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/container:fixed_array", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", ], ) @@ -76,8 +76,8 @@ cc_test( "//src/google/protobuf:cc_test_protos", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -101,12 +101,12 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_absl//absl/functional:bind_front", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/functional:bind_front", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -122,12 +122,12 @@ cc_library( "//src/google/protobuf:field_mask_cc_proto", "//src/google/protobuf:port", "//src/google/protobuf/stubs", - "@com_google_absl//absl/container:btree", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/log:die_if_null", - "@com_google_absl//absl/memory", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:btree", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/log:die_if_null", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", ], ) @@ -144,8 +144,8 @@ cc_test( "//src/google/protobuf/stubs", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -173,11 +173,11 @@ cc_library( "//src/google/protobuf:port", "//src/google/protobuf:timestamp_cc_proto", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/numeric:int128", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/time", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/numeric:int128", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/time", ], ) @@ -191,8 +191,8 @@ cc_test( "//src/google/protobuf:timestamp_cc_proto", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -217,9 +217,9 @@ cc_library( "//src/google/protobuf/io", "//src/google/protobuf/io:tokenizer", "//src/google/protobuf/stubs", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", ], ) @@ -236,13 +236,16 @@ cc_test( "//src/google/protobuf:any_cc_proto", "//src/google/protobuf:cc_test_protos", "//src/google/protobuf:descriptor_legacy", + "//src/google/protobuf:test_textproto", "//src/google/protobuf:test_util", "//src/google/protobuf:type_cc_proto", "//src/google/protobuf:wrappers_cc_proto", "//src/google/protobuf/testing", "//src/google/protobuf/testing:file", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/src/google/protobuf/util/delimited_message_util_test.cc b/third_party/protobuf/src/google/protobuf/util/delimited_message_util_test.cc index 04785c19e7205..fc391d1b9d3df 100644 --- a/third_party/protobuf/src/google/protobuf/util/delimited_message_util_test.cc +++ b/third_party/protobuf/src/google/protobuf/util/delimited_message_util_test.cc @@ -25,11 +25,11 @@ TEST(DelimitedMessageUtilTest, DelimitedMessages) { std::stringstream stream; { - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; TestUtil::SetAllFields(&message1); EXPECT_TRUE(SerializeDelimitedToOstream(message1, &stream)); - protobuf_unittest::TestPackedTypes message2; + proto2_unittest::TestPackedTypes message2; TestUtil::SetPackedFields(&message2); EXPECT_TRUE(SerializeDelimitedToOstream(message2, &stream)); } @@ -38,14 +38,14 @@ TEST(DelimitedMessageUtilTest, DelimitedMessages) { bool clean_eof; io::IstreamInputStream zstream(&stream); - protobuf_unittest::TestAllTypes message1; + proto2_unittest::TestAllTypes message1; clean_eof = true; EXPECT_TRUE(ParseDelimitedFromZeroCopyStream(&message1, &zstream, &clean_eof)); EXPECT_FALSE(clean_eof); TestUtil::ExpectAllFieldsSet(message1); - protobuf_unittest::TestPackedTypes message2; + proto2_unittest::TestPackedTypes message2; clean_eof = true; EXPECT_TRUE(ParseDelimitedFromZeroCopyStream(&message2, &zstream, &clean_eof)); @@ -64,7 +64,7 @@ TEST(DelimitedMessageUtilTest, FailsAtEndOfStream) { std::stringstream partial_stream; { - protobuf_unittest::ForeignMessage message; + proto2_unittest::ForeignMessage message; message.set_c(42); message.set_d(24); EXPECT_TRUE(SerializeDelimitedToOstream(message, &full_stream)); @@ -80,7 +80,7 @@ TEST(DelimitedMessageUtilTest, FailsAtEndOfStream) { bool clean_eof; io::IstreamInputStream zstream(&partial_stream); - protobuf_unittest::ForeignMessage message; + proto2_unittest::ForeignMessage message; clean_eof = true; EXPECT_FALSE(ParseDelimitedFromZeroCopyStream(&message, &zstream, &clean_eof)); diff --git a/third_party/protobuf/src/google/protobuf/util/field_comparator.h b/third_party/protobuf/src/google/protobuf/util/field_comparator.h index f1aeb55471bd4..5a74a2d6a2f2e 100644 --- a/third_party/protobuf/src/google/protobuf/util/field_comparator.h +++ b/third_party/protobuf/src/google/protobuf/util/field_comparator.h @@ -16,6 +16,7 @@ #include "google/protobuf/stubs/common.h" #include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" #include "google/protobuf/port.h" // Must be included last. @@ -192,7 +193,7 @@ class PROTOBUF_EXPORT SimpleFieldComparator : public FieldComparator { } bool CompareString(const FieldDescriptor& /* unused */, - const std::string& value_1, const std::string& value_2) { + absl::string_view value_1, absl::string_view value_2) { return value_1 == value_2; } diff --git a/third_party/protobuf/src/google/protobuf/util/field_comparator_test.cc b/third_party/protobuf/src/google/protobuf/util/field_comparator_test.cc index f98950747f5cb..f97032d911f46 100644 --- a/third_party/protobuf/src/google/protobuf/util/field_comparator_test.cc +++ b/third_party/protobuf/src/google/protobuf/util/field_comparator_test.cc @@ -20,7 +20,7 @@ namespace protobuf { namespace util { namespace { -using protobuf_unittest::TestAllTypes; +using proto2_unittest::TestAllTypes; class DefaultFieldComparatorTest : public ::testing::Test { protected: diff --git a/third_party/protobuf/src/google/protobuf/util/field_mask_util_test.cc b/third_party/protobuf/src/google/protobuf/util/field_mask_util_test.cc index 7aa7d63f37ee5..677f4d91f7b85 100644 --- a/third_party/protobuf/src/google/protobuf/util/field_mask_util_test.cc +++ b/third_party/protobuf/src/google/protobuf/util/field_mask_util_test.cc @@ -91,10 +91,10 @@ TEST_F(SnakeCaseCamelCaseTest, RoundTripTest) { } using google::protobuf::FieldMask; -using protobuf_unittest::NestedTestAllTypes; -using protobuf_unittest::TestAllTypes; -using protobuf_unittest::TestRequired; -using protobuf_unittest::TestRequiredMessage; +using proto2_unittest::NestedTestAllTypes; +using proto2_unittest::TestAllTypes; +using proto2_unittest::TestRequired; +using proto2_unittest::TestRequiredMessage; TEST(FieldMaskUtilTest, StringFormat) { FieldMask mask; diff --git a/third_party/protobuf/src/google/protobuf/util/json_format.proto b/third_party/protobuf/src/google/protobuf/util/json_format.proto index dfaa3422c4f4a..f07c3183b4261 100644 --- a/third_party/protobuf/src/google/protobuf/util/json_format.proto +++ b/third_party/protobuf/src/google/protobuf/util/json_format.proto @@ -13,7 +13,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; message TestFlagsAndStrings { required int32 A = 1; diff --git a/third_party/protobuf/src/google/protobuf/util/json_format_proto3.proto b/third_party/protobuf/src/google/protobuf/util/json_format_proto3.proto index dee5e0412f09e..d7a28ccae9e3f 100644 --- a/third_party/protobuf/src/google/protobuf/util/json_format_proto3.proto +++ b/third_party/protobuf/src/google/protobuf/util/json_format_proto3.proto @@ -184,10 +184,13 @@ message TestEvilJson { int32 quotes = 3 [json_name = "unbalanced\"quotes"]; int32 script_and_quotes = 4 [json_name = "\"<script>alert('hello!);</script>"]; + int32 empty_string = 5 [json_name = ""]; + int32 backslash = 6 [json_name = "\\"]; + int32 low_codepoint = 7 [json_name = "\1"]; } message TestExtensions { - .protobuf_unittest.TestAllExtensions extensions = 1; + .proto2_unittest.TestAllExtensions extensions = 1; } message TestEnumValue { diff --git a/third_party/protobuf/src/google/protobuf/util/json_util.h b/third_party/protobuf/src/google/protobuf/util/json_util.h index 2b412c8555cdd..bb47d1ec5d8dc 100644 --- a/third_party/protobuf/src/google/protobuf/util/json_util.h +++ b/third_party/protobuf/src/google/protobuf/util/json_util.h @@ -19,9 +19,6 @@ namespace util { using JsonParseOptions = ::google::protobuf::json::ParseOptions; using JsonPrintOptions = ::google::protobuf::json::PrintOptions; -using JsonOptions ABSL_DEPRECATED("use JsonPrintOptions instead") = - JsonPrintOptions; - using ::google::protobuf::json::BinaryToJsonStream; using ::google::protobuf::json::BinaryToJsonString; diff --git a/third_party/protobuf/src/google/protobuf/util/message_differencer.cc b/third_party/protobuf/src/google/protobuf/util/message_differencer.cc index 62c5c2e6cd636..b017cba391f6b 100644 --- a/third_party/protobuf/src/google/protobuf/util/message_differencer.cc +++ b/third_party/protobuf/src/google/protobuf/util/message_differencer.cc @@ -20,12 +20,10 @@ #include <utility> #include "google/protobuf/descriptor.pb.h" -#include "absl/container/fixed_array.h" #include "absl/container/flat_hash_map.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/escaping.h" -#include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "google/protobuf/descriptor.h" @@ -823,6 +821,12 @@ static PROTOBUF_NOINLINE MessageDifferencer::SpecificField& PushSpecificField( return fields->back(); } +void MessageDifferencer::ForceCompareField(const FieldDescriptor* field) { + if (force_compare_no_presence_fields_.contains(field)) { + force_compare_failure_triggering_fields_.emplace(field->full_name()); + } +} + bool MessageDifferencer::CompareWithFieldsInternal( const Message& message1, const Message& message2, int unpacked_any, const std::vector<const FieldDescriptor*>& message1_fields, @@ -897,8 +901,8 @@ bool MessageDifferencer::CompareWithFieldsInternal( } else if (FieldBefore(field2, field1)) { const bool ignore_field = IsIgnored(message1, message2, field2, *parent_fields); - if (!ignore_field && force_compare_no_presence_fields_.contains(field2)) { - force_compare_failure_triggering_fields_.emplace(field2->full_name()); + if (!ignore_field) { + ForceCompareField(field2); } // Field 2 is not in the field list for message 1. @@ -989,9 +993,7 @@ bool MessageDifferencer::CompareWithFieldsInternal( fieldDifferent = !CompareFieldValueUsingParentFields( message1, message2, unpacked_any, field1, -1, -1, parent_fields); - if (force_compare_no_presence_fields_.contains(field1)) { - force_compare_failure_triggering_fields_.emplace(field1->full_name()); - } + ForceCompareField(field1); if (reporter_ != nullptr) { SpecificField& specific_field = PushSpecificField(parent_fields); @@ -2111,7 +2113,7 @@ MessageDifferencer::StreamReporter::~StreamReporter() { void MessageDifferencer::StreamReporter::PrintPath( const std::vector<SpecificField>& field_path, bool left_side) { for (size_t i = 0; i < field_path.size(); ++i) { - SpecificField specific_field = field_path[i]; + const SpecificField& specific_field = field_path[i]; if (specific_field.field != nullptr && specific_field.field->name() == "value") { diff --git a/third_party/protobuf/src/google/protobuf/util/message_differencer.h b/third_party/protobuf/src/google/protobuf/util/message_differencer.h index 1cfd600e44028..a17bdd664e900 100644 --- a/third_party/protobuf/src/google/protobuf/util/message_differencer.h +++ b/third_party/protobuf/src/google/protobuf/util/message_differencer.h @@ -739,7 +739,6 @@ class PROTOBUF_EXPORT MessageDifferencer { bool report_modified_aggregates_; const Message* message1_; const Message* message2_; - MessageDifferencer::UnpackAnyField unpack_any_field_; }; private: @@ -933,6 +932,10 @@ class PROTOBUF_EXPORT MessageDifferencer { const Reflection& reflection1, const FieldDescriptor* field2) const; + // We move this code out of line to reduce stack cost of the caller. + // The map lookups and string copies are costly in stack space. + PROTOBUF_NOINLINE void ForceCompareField(const FieldDescriptor* field); + Reporter* reporter_; DefaultFieldComparator default_field_comparator_; MessageFieldComparison message_field_comparison_; diff --git a/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.cc b/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.cc index f9f179f467c51..2ab3fe100d90c 100644 --- a/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.cc @@ -138,10 +138,10 @@ TEST(MessageDifferencerTest, RepeatedFieldInequalityTest) { TEST(MessageDifferencerTest, RepeatedFieldSetOptimizationTest) { util::MessageDifferencer differencer; - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item1 = msg1.add_item(); - protobuf_unittest::TestDiffMessage::Item* item2 = msg2.add_item(); + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage::Item* item1 = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item2 = msg2.add_item(); differencer.TreatAsSet(item1->GetDescriptor()->FindFieldByName("ra")); differencer.TreatAsSet(item2->GetDescriptor()->FindFieldByName("ra")); for (int i = 0; i < 1000; i++) { @@ -1486,8 +1486,8 @@ TEST(MessageDifferencerTest, } TEST(MessageDifferencerTest, RepeatedFieldTreatmentChangeListToSet) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; msg1.add_rv(1); msg1.add_rv(2); @@ -1496,16 +1496,16 @@ TEST(MessageDifferencerTest, RepeatedFieldTreatmentChangeListToSet) { util::MessageDifferencer differencer; differencer.TreatAsList( - protobuf_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); + proto2_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); differencer.TreatAsSet( - protobuf_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); + proto2_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); EXPECT_TRUE(differencer.Compare(msg1, msg2)); } TEST(MessageDifferencerTest, RepeatedFieldTreatmentChangeSetToList) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; msg1.add_rv(1); msg1.add_rv(2); @@ -1514,17 +1514,17 @@ TEST(MessageDifferencerTest, RepeatedFieldTreatmentChangeSetToList) { util::MessageDifferencer differencer; differencer.TreatAsSet( - protobuf_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); + proto2_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); differencer.TreatAsList( - protobuf_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); + proto2_unittest::TestDiffMessage::descriptor()->FindFieldByName("rv")); EXPECT_FALSE(differencer.Compare(msg1, msg2)); } TEST(MessageDifferencerTest, RepeatedFieldSmartListTest) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; msg1.add_rv(1); msg1.add_rv(2); @@ -1596,10 +1596,10 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartListTest) { TEST(MessageDifferencerTest, RepeatedFieldSmartSetTest) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestField elem1_1, elem2_1, elem3_1; - protobuf_unittest::TestField elem1_2, elem2_2, elem3_2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestField elem1_1, elem2_1, elem3_1; + proto2_unittest::TestField elem1_2, elem2_2, elem3_2; // Only one field is different for each pair of elements elem1_1.set_a(1); @@ -1644,9 +1644,9 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSetTest) { TEST(MessageDifferencerTest, RepeatedFieldSmartSetTest_IdenticalElements) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestField elem; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestField elem; elem.set_a(1); elem.set_b(1); @@ -1665,10 +1665,10 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSetTest_IdenticalElements) { TEST(MessageDifferencerTest, RepeatedFieldSmartSetTest_PreviouslyMatch) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestField elem1_1, elem1_2; - protobuf_unittest::TestField elem2_1, elem2_2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestField elem1_1, elem1_2; + proto2_unittest::TestField elem2_1, elem2_2; elem1_1.set_a(1); elem1_1.set_b(1); @@ -1703,10 +1703,10 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSetTest_PreviouslyMatch) { TEST(MessageDifferencerTest, RepeatedFieldSmartSet_MultipleMatches) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestField elem1_1, elem2_1, elem3_1; - protobuf_unittest::TestField elem2_2, elem3_2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestField elem1_1, elem2_1, elem3_1; + proto2_unittest::TestField elem2_2, elem3_2; // Only one field is different for each pair of elements elem1_1.set_a(1); @@ -1747,9 +1747,9 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSet_MultipleMatches) { } TEST(MessageDifferencerTest, RepeatedFieldSmartSet_MultipleMatchesNoReporter) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestField elem1, elem2, elem3, elem4; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestField elem1, elem2, elem3, elem4; elem1.set_a(1); elem2.set_a(2); elem3.set_a(3); @@ -1770,8 +1770,8 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSet_MultipleMatchesNoReporter) { TEST(MessageDifferencerTest, RepeatedFieldSmartSet_NonMessageTypeTest) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; // Create 3 elements, but in different order. msg1.add_rw("b"); @@ -1795,10 +1795,10 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSet_NonMessageTypeTest) { TEST(MessageDifferencerTest, RepeatedFieldSetTest_SetOfSet) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->add_ra(1); item->add_ra(2); item->add_ra(3); @@ -1836,13 +1836,13 @@ TEST(MessageDifferencerTest, RepeatedFieldSetTest_SetOfSet) { TEST(MessageDifferencerTest, RepeatedFieldSetTest_Combination) { // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; // Treat "item" as Map, with key = "a" // Treat "item.ra" also as Set // Treat "rv" as Set // Treat "rw" as List - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->set_a(3); item->add_ra(1); item->add_ra(2); @@ -1934,13 +1934,13 @@ class CountingComparator : public util::SimpleFieldComparator { TEST(MessageDifferencerTest, RepeatedFieldSet_RecursivePerformance) { constexpr int kDepth = 20; - protobuf_unittest::TestField left; - protobuf_unittest::TestField* p = &left; + proto2_unittest::TestField left; + proto2_unittest::TestField* p = &left; for (int i = 0; i < kDepth; ++i) { p = p->add_rm(); } - protobuf_unittest::TestField right = left; + proto2_unittest::TestField right = left; util::MessageDifferencer differencer; differencer.set_repeated_field_comparison( util::MessageDifferencer::RepeatedFieldComparison::AS_SET); @@ -1956,13 +1956,13 @@ TEST(MessageDifferencerTest, RepeatedFieldSet_RecursivePerformance) { TEST(MessageDifferencerTest, RepeatedFieldSmartSet_RecursivePerformance) { constexpr int kDepth = 20; - protobuf_unittest::TestField left; - protobuf_unittest::TestField* p = &left; + proto2_unittest::TestField left; + proto2_unittest::TestField* p = &left; for (int i = 0; i < kDepth; ++i) { p = p->add_rm(); } - protobuf_unittest::TestField right = left; + proto2_unittest::TestField right = left; util::MessageDifferencer differencer; differencer.set_repeated_field_comparison( util::MessageDifferencer::RepeatedFieldComparison::AS_SMART_SET); @@ -1978,13 +1978,13 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartSet_RecursivePerformance) { TEST(MessageDifferencerTest, RepeatedFieldSmartList_RecursivePerformance) { constexpr int kDepth = 20; - protobuf_unittest::TestField left; - protobuf_unittest::TestField* p = &left; + proto2_unittest::TestField left; + proto2_unittest::TestField* p = &left; for (int i = 0; i < kDepth; ++i) { p = p->add_rm(); } - protobuf_unittest::TestField right = left; + proto2_unittest::TestField right = left; util::MessageDifferencer differencer; differencer.set_repeated_field_comparison( util::MessageDifferencer::RepeatedFieldComparison::AS_SMART_LIST); @@ -1998,15 +1998,15 @@ TEST(MessageDifferencerTest, RepeatedFieldSmartList_RecursivePerformance) { } TEST(MessageDifferencerTest, RepeatedFieldMapTest_Partial) { - protobuf_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg1; // message msg1 { // item { a: 1; b: "11" } // } - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->set_a(1); item->set_b("11"); - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg2; // message msg2 { // item { a: 2; b: "22" } // item { a: 1; b: "11" } @@ -2027,7 +2027,7 @@ TEST(MessageDifferencerTest, RepeatedFieldMapTest_Partial) { } TEST(MessageDifferencerTest, RepeatedFieldSetTest_Duplicates) { - protobuf_unittest::TestDiffMessage a, b, c; + proto2_unittest::TestDiffMessage a, b, c; // message a: { // rv: 0 // rv: 1 @@ -2062,7 +2062,7 @@ TEST(MessageDifferencerTest, RepeatedFieldSetTest_Duplicates) { } TEST(MessageDifferencerTest, RepeatedFieldSetTest_PartialSimple) { - protobuf_unittest::TestDiffMessage a, b, c; + proto2_unittest::TestDiffMessage a, b, c; // message a: { // rm { c: 1 } // rm { c: 0 } @@ -2089,7 +2089,7 @@ TEST(MessageDifferencerTest, RepeatedFieldSetTest_PartialSimple) { } TEST(MessageDifferencerTest, RepeatedFieldSetTest_Partial) { - protobuf_unittest::TestDiffMessage msg1, msg2; + proto2_unittest::TestDiffMessage msg1, msg2; // message msg1: { // rm { a: 1 } // rm { b: 2 } @@ -2103,7 +2103,7 @@ TEST(MessageDifferencerTest, RepeatedFieldSetTest_Partial) { // rm { b: 2; c: 3 } // rm { b: 2 } // } - protobuf_unittest::TestField* field = msg2.add_rm(); + proto2_unittest::TestField* field = msg2.add_rm(); field->set_a(1); field->set_c(3); field = msg2.add_rm(); @@ -2119,11 +2119,11 @@ TEST(MessageDifferencerTest, RepeatedFieldSetTest_Partial) { } TEST(MessageDifferencerTest, RepeatedFieldMapTest_MultipleFieldsAsKey) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; // Treat "item" as Map, with key = ("a", "ra") // Treat "item.ra" as Set - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); // key => value: (1, {2, 3}) => "a" item->set_a(1); item->add_ra(2); @@ -2196,11 +2196,11 @@ TEST(MessageDifferencerTest, RepeatedFieldMapTest_MultipleFieldsAsKey) { } TEST(MessageDifferencerTest, RepeatedFieldMapTest_MultipleFieldPathsAsKey) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; // Treat "item" as Map, with key = ("m.a", "m.rc") // Treat "item.m.rc" as Set - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); // key => value: (1, {2, 3}) => "a" item->mutable_m()->set_a(1); item->mutable_m()->add_rc(2); @@ -2279,10 +2279,10 @@ TEST(MessageDifferencerTest, RepeatedFieldMapTest_MultipleFieldPathsAsKey) { } TEST(MessageDifferencerTest, RepeatedFieldMapTest_IgnoredKeyFields) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; // Treat "item" as Map, with key = ("a", "ra") - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->set_a(1); item->add_ra(2); item->set_b("hello"); @@ -2336,9 +2336,9 @@ TEST(MessageDifferencerTest, PrintMapKeysTest) { // one cannot assume which deleted field log will be printed first). // Test currently just has a single record per operation to address this. // This should only be a limitation for EXPECT_EQ evaluation. - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->mutable_mp()->insert({{"key_a", 1}, {"key_b", 2}, {"key_c", 3}}); item = msg2.add_item(); item->mutable_mp()->insert({{"key_a", 1}, {"key_b", 3}, {"key_d", 4}}); @@ -2389,8 +2389,8 @@ class TestIgnorer : public util::MessageDifferencer::IgnoreCriteria { }; TEST(MessageDifferencerTest, TreatRepeatedFieldAsSetWithIgnoredFields) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; TextFormat::MergeFromString("rm { a: 11\n b: 12 }", &msg1); TextFormat::MergeFromString("rm { a: 11\n b: 13 }", &msg2); util::MessageDifferencer differ; @@ -2400,8 +2400,8 @@ TEST(MessageDifferencerTest, TreatRepeatedFieldAsSetWithIgnoredFields) { } TEST(MessageDifferencerTest, TreatRepeatedFieldAsMapWithIgnoredKeyFields) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; TextFormat::MergeFromString("rm { a: 11\n m { a: 12\n b: 13\n } }", &msg1); TextFormat::MergeFromString("rm { a: 11\n m { a: 12\n b: 14\n } }", &msg2); util::MessageDifferencer differ; @@ -2437,11 +2437,11 @@ class ValueProductMapKeyComparator }; TEST(MessageDifferencerTest, RepeatedFieldMapTest_CustomMapKeyComparator) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; // Treat "item" as Map, using custom key comparator to determine if two // elements have the same key. - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->add_ra(6); item->add_ra(35); item->set_b("hello"); @@ -2486,11 +2486,11 @@ class OffsetByOneMapKeyComparator }; TEST(MessageDifferencerTest, RepeatedFieldMapTest_CustomIndexMapKeyComparator) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; // Treat "item" as Map, using custom key comparator to determine if two // elements have the same key. - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->set_b("one"); item = msg2.add_item(); item->set_b("zero"); @@ -2512,8 +2512,8 @@ TEST(MessageDifferencerTest, RepeatedFieldMapTest_CustomIndexMapKeyComparator) { } TEST(MessageDifferencerTest, RepeatedFieldSetTest_Subset) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; msg1.add_rv(3); msg1.add_rv(8); @@ -2542,8 +2542,8 @@ TEST(MessageDifferencerTest, RepeatedFieldSetTest_Subset) { } TEST(MessageDifferencerTest, IgnoreField_Single) { - protobuf_unittest::TestField msg1; - protobuf_unittest::TestField msg2; + proto2_unittest::TestField msg1; + proto2_unittest::TestField msg2; msg1.set_c(3); msg1.add_rc(1); @@ -2558,8 +2558,8 @@ TEST(MessageDifferencerTest, IgnoreField_Single) { } TEST(MessageDifferencerTest, IgnoreField_Repeated) { - protobuf_unittest::TestField msg1; - protobuf_unittest::TestField msg2; + proto2_unittest::TestField msg1; + proto2_unittest::TestField msg2; msg1.set_c(3); msg1.add_rc(1); @@ -2576,10 +2576,10 @@ TEST(MessageDifferencerTest, IgnoreField_Repeated) { } TEST(MessageDifferencerTest, IgnoreField_Message) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestField* field; + proto2_unittest::TestField* field; field = msg1.add_rm(); field->set_c(3); @@ -2594,10 +2594,10 @@ TEST(MessageDifferencerTest, IgnoreField_Message) { } TEST(MessageDifferencerTest, IgnoreField_Group) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item; + proto2_unittest::TestDiffMessage::Item* item; item = msg1.add_item(); item->set_a(3); @@ -2612,8 +2612,8 @@ TEST(MessageDifferencerTest, IgnoreField_Group) { } TEST(MessageDifferencerTest, IgnoreField_Missing) { - protobuf_unittest::TestField msg1; - protobuf_unittest::TestField msg2; + proto2_unittest::TestField msg1; + proto2_unittest::TestField msg2; msg1.set_c(3); msg1.add_rc(1); @@ -2628,8 +2628,8 @@ TEST(MessageDifferencerTest, IgnoreField_Missing) { } TEST(MessageDifferencerTest, IgnoreField_Multiple) { - protobuf_unittest::TestField msg1; - protobuf_unittest::TestField msg2; + proto2_unittest::TestField msg1; + proto2_unittest::TestField msg2; msg1.set_c(3); msg1.add_rc(1); @@ -2664,10 +2664,10 @@ TEST(MessageDifferencerTest, IgnoreField_Multiple) { } TEST(MessageDifferencerTest, IgnoreField_NestedMessage) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestField* field; + proto2_unittest::TestField* field; field = msg1.add_rm(); field->set_c(3); @@ -2684,10 +2684,10 @@ TEST(MessageDifferencerTest, IgnoreField_NestedMessage) { } TEST(MessageDifferencerTest, IgnoreField_NestedGroup) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item; + proto2_unittest::TestDiffMessage::Item* item; item = msg1.add_item(); item->set_a(3); @@ -2704,10 +2704,10 @@ TEST(MessageDifferencerTest, IgnoreField_NestedGroup) { } TEST(MessageDifferencerTest, IgnoreField_InsideSet) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item; + proto2_unittest::TestDiffMessage::Item* item; item = msg1.add_item(); item->set_a(1); @@ -2740,10 +2740,10 @@ TEST(MessageDifferencerTest, IgnoreField_InsideSet) { } TEST(MessageDifferencerTest, IgnoreField_InsideMap) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item; + proto2_unittest::TestDiffMessage::Item* item; item = msg1.add_item(); item->set_a(1); @@ -2777,10 +2777,10 @@ TEST(MessageDifferencerTest, IgnoreField_InsideMap) { } TEST(MessageDifferencerTest, IgnoreField_DoesNotIgnoreKey) { - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item; + proto2_unittest::TestDiffMessage::Item* item; item = msg1.add_item(); item->set_a(1); @@ -2803,8 +2803,8 @@ TEST(MessageDifferencerTest, IgnoreField_DoesNotIgnoreKey) { } TEST(MessageDifferencerTest, IgnoreField_TrumpsCompareWithFields) { - protobuf_unittest::TestField msg1; - protobuf_unittest::TestField msg2; + proto2_unittest::TestField msg1; + proto2_unittest::TestField msg2; msg1.set_c(3); msg1.add_rc(1); @@ -2832,8 +2832,8 @@ TEST(MessageDifferencerTest, IgnoreField_TrumpsCompareWithFields) { } TEST(MessageDifferencerTest, IgnoreField_SetReportIgnoresFalse) { - protobuf_unittest::TestField msg1; - protobuf_unittest::TestField msg2; + proto2_unittest::TestField msg1; + proto2_unittest::TestField msg2; msg1.set_a(1); msg1.set_b(2); @@ -2900,9 +2900,9 @@ class ParentSavingFieldComparator : public util::FieldComparator { // Tests if MessageDifferencer sends the parent fields in the FieldContext // parameter. TEST(MessageDifferencerTest, FieldContextParentFieldsTest) { - protobuf_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg1; msg1.add_rm()->set_c(1); - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg2; msg2.add_rm()->set_c(1); ParentSavingFieldComparator field_comparator; @@ -3141,24 +3141,24 @@ TEST_F(ComparisonTest, RepeatedSetOptionTest) { TEST_F(ComparisonTest, RepeatedSetOptionTest_Ex) { repeated_field_as_set(); - proto1ex_.ClearExtension(protobuf_unittest::repeated_nested_message_extension); - proto2ex_.ClearExtension(protobuf_unittest::repeated_nested_message_extension); - proto2ex_.AddExtension(protobuf_unittest::repeated_nested_message_extension) + proto1ex_.ClearExtension(proto2_unittest::repeated_nested_message_extension); + proto2ex_.ClearExtension(proto2_unittest::repeated_nested_message_extension); + proto2ex_.AddExtension(proto2_unittest::repeated_nested_message_extension) ->set_bb(909); - proto2ex_.AddExtension(protobuf_unittest::repeated_nested_message_extension) + proto2ex_.AddExtension(proto2_unittest::repeated_nested_message_extension) ->set_bb(907); - proto1ex_.AddExtension(protobuf_unittest::repeated_nested_message_extension) + proto1ex_.AddExtension(proto2_unittest::repeated_nested_message_extension) ->set_bb(904); - proto1ex_.AddExtension(protobuf_unittest::repeated_nested_message_extension) + proto1ex_.AddExtension(proto2_unittest::repeated_nested_message_extension) ->set_bb(907); - proto1ex_.AddExtension(protobuf_unittest::repeated_nested_message_extension) + proto1ex_.AddExtension(proto2_unittest::repeated_nested_message_extension) ->set_bb(909); EXPECT_EQ( - "moved: (protobuf_unittest.repeated_nested_message_extension)[2] ->" - " (protobuf_unittest.repeated_nested_message_extension)[0] :" + "moved: (proto2_unittest.repeated_nested_message_extension)[2] ->" + " (proto2_unittest.repeated_nested_message_extension)[0] :" " { bb: 909 }\n" - "deleted: (protobuf_unittest.repeated_nested_message_extension)[0]:" + "deleted: (proto2_unittest.repeated_nested_message_extension)[0]:" " { bb: 904 }\n", RunEx()); } @@ -3189,9 +3189,9 @@ TEST_F(ComparisonTest, RepeatedMapFieldTest_MessageKey) { // Use m as key, but use b as value. field_as_map("item", "m"); - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); // The following code creates one deletion, one addition and two moved fields // on the messages. @@ -3233,10 +3233,10 @@ TEST_F(ComparisonTest, RepeatedMapFieldTest_MessageKey) { TEST_F(ComparisonTest, RepeatedFieldSetTest_SetOfSet) { repeated_field_as_set(); // Create the testing protos - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->add_ra(1); item->add_ra(2); item->add_ra(3); @@ -3283,9 +3283,9 @@ TEST_F(ComparisonTest, RepeatedMapFieldTest_RepeatedKey) { repeated_field_as_set(); field_as_map("item", "rb"); - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->add_rb("a"); item->add_rb("b"); item->set_b("first"); @@ -3310,10 +3310,10 @@ TEST_F(ComparisonTest, RepeatedMapFieldTest_RepeatedKey) { TEST_F(ComparisonTest, RepeatedMapFieldTest_RepeatedMessageKey) { field_as_map("item", "rm"); - protobuf_unittest::TestDiffMessage msg1; - protobuf_unittest::TestDiffMessage msg2; - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); - protobuf_unittest::TestField* key = item->add_rm(); + proto2_unittest::TestDiffMessage msg1; + proto2_unittest::TestDiffMessage msg2; + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestField* key = item->add_rm(); key->set_c(2); key->add_rc(10); key->add_rc(10); @@ -3518,7 +3518,7 @@ TEST_F(ComparisonTest, AddDelete_FieldOrderingTest) { EXPECT_EQ( "deleted: my_int: 1\n" - "added: (protobuf_unittest.my_extension_string): \"bar\"\n", + "added: (proto2_unittest.my_extension_string): \"bar\"\n", RunOrder()); } @@ -3718,8 +3718,8 @@ TEST_F(ComparisonTest, ExtensionTest) { proto2ex_.SetExtension(unittest::optional_int64_extension, 403); EXPECT_EQ( - "modified: (protobuf_unittest.optional_int32_extension): 401 -> 402\n" - "added: (protobuf_unittest.optional_int64_extension): 403\n", + "modified: (proto2_unittest.optional_int32_extension): 401 -> 402\n" + "added: (proto2_unittest.optional_int64_extension): 403\n", RunEx()); } @@ -3895,8 +3895,8 @@ TEST_F(ComparisonTest, MapEntryPartialEmptyKeyTest) { TEST_F(ComparisonTest, MapEntryMissingEmptyFieldIsOkTest) { TextFormat::Parser parser; - protobuf_unittest::TestMap msg1; - protobuf_unittest::TestMap msg2; + proto2_unittest::TestMap msg1; + proto2_unittest::TestMap msg2; ASSERT_TRUE(parser.ParseFromString( "map_string_foreign_message { key: 'key1' value {}}", &msg1)); @@ -3927,8 +3927,8 @@ class LengthMapKeyComparator TEST_F(ComparisonTest, MapEntryCustomMapKeyComparator) { TextFormat::Parser parser; - protobuf_unittest::TestMap msg1; - protobuf_unittest::TestMap msg2; + proto2_unittest::TestMap msg1; + proto2_unittest::TestMap msg2; ASSERT_TRUE(parser.ParseFromString( "map_string_foreign_message { key: 'key1' value { c: 1 }}", &msg1)); @@ -3989,7 +3989,7 @@ class MatchingTest : public testing::Test { }; TEST_F(MatchingTest, StreamReporterMatching) { - protobuf_unittest::TestField msg1, msg2; + proto2_unittest::TestField msg1, msg2; msg1.set_c(72); msg2.set_c(72); msg1.add_rc(13); @@ -4009,7 +4009,7 @@ TEST_F(MatchingTest, StreamReporterMatching) { } TEST_F(MatchingTest, DontReportMatchedWhenIgnoring) { - protobuf_unittest::TestField msg1, msg2; + proto2_unittest::TestField msg1, msg2; msg1.set_c(72); msg2.set_c(72); msg1.add_rc(13); @@ -4032,8 +4032,8 @@ TEST_F(MatchingTest, DontReportMatchedWhenIgnoring) { } TEST_F(MatchingTest, ReportMatchedForMovedFields) { - protobuf_unittest::TestDiffMessage msg1, msg2; - protobuf_unittest::TestDiffMessage::Item* item = msg1.add_item(); + proto2_unittest::TestDiffMessage msg1, msg2; + proto2_unittest::TestDiffMessage::Item* item = msg1.add_item(); item->set_a(53); item->set_b("hello"); item = msg2.add_item(); @@ -4059,9 +4059,9 @@ TEST_F(MatchingTest, ReportMatchedForMovedFields) { TEST_F(MatchingTest, MatchesAppearInPostTraversalOrderForMovedFields) { - protobuf_unittest::TestDiffMessage msg1, msg2; - protobuf_unittest::TestDiffMessage::Item* item; - protobuf_unittest::TestField* field; + proto2_unittest::TestDiffMessage msg1, msg2; + proto2_unittest::TestDiffMessage::Item* item; + proto2_unittest::TestField* field; const FieldDescriptor* desc; const FieldDescriptor* nested_desc; @@ -4129,9 +4129,9 @@ TEST_F(MatchingTest, MatchesAppearInPostTraversalOrderForMovedFields) { } TEST_F(MatchingTest, MatchAndModifiedInterleaveProperly) { - protobuf_unittest::TestDiffMessage msg1, msg2; - protobuf_unittest::TestDiffMessage::Item* item; - protobuf_unittest::TestField* field; + proto2_unittest::TestDiffMessage msg1, msg2; + proto2_unittest::TestDiffMessage::Item* item; + proto2_unittest::TestField* field; const FieldDescriptor* desc; const FieldDescriptor* nested_key; @@ -4216,9 +4216,9 @@ TEST_F(MatchingTest, MatchAndModifiedInterleaveProperly) { } TEST_F(MatchingTest, MatchingWorksWithExtensions) { - protobuf_unittest::TestAllExtensions msg1, msg2; - protobuf_unittest::TestAllTypes::NestedMessage* nested; - using protobuf_unittest::repeated_nested_message_extension; + proto2_unittest::TestAllExtensions msg1, msg2; + proto2_unittest::TestAllTypes::NestedMessage* nested; + using proto2_unittest::repeated_nested_message_extension; const FileDescriptor* descriptor; const FieldDescriptor* desc; @@ -4245,30 +4245,30 @@ TEST_F(MatchingTest, MatchingWorksWithExtensions) { nested->set_bb(7); EXPECT_EQ( - "matched: (protobuf_unittest.repeated_nested_message_extension)[0].bb ->" - " (protobuf_unittest.repeated_nested_message_extension)[2].bb : 7\n" - "moved: (protobuf_unittest.repeated_nested_message_extension)[0] ->" - " (protobuf_unittest.repeated_nested_message_extension)[2] :" + "matched: (proto2_unittest.repeated_nested_message_extension)[0].bb ->" + " (proto2_unittest.repeated_nested_message_extension)[2].bb : 7\n" + "moved: (proto2_unittest.repeated_nested_message_extension)[0] ->" + " (proto2_unittest.repeated_nested_message_extension)[2] :" " { bb: 7 }\n" - "matched: (protobuf_unittest.repeated_nested_message_extension)[1].bb :" + "matched: (proto2_unittest.repeated_nested_message_extension)[1].bb :" " 13\n" - "matched: (protobuf_unittest.repeated_nested_message_extension)[1] :" + "matched: (proto2_unittest.repeated_nested_message_extension)[1] :" " { bb: 13 }\n" - "matched: (protobuf_unittest.repeated_nested_message_extension)[2].bb ->" - " (protobuf_unittest.repeated_nested_message_extension)[0].bb :" + "matched: (proto2_unittest.repeated_nested_message_extension)[2].bb ->" + " (proto2_unittest.repeated_nested_message_extension)[0].bb :" " 11\n" - "moved: (protobuf_unittest.repeated_nested_message_extension)[2] ->" - " (protobuf_unittest.repeated_nested_message_extension)[0] :" + "moved: (proto2_unittest.repeated_nested_message_extension)[2] ->" + " (proto2_unittest.repeated_nested_message_extension)[0] :" " { bb: 11 }\n", RunWithResult(&differencer, msg1, msg2, true)); } TEST(AnyTest, Simple) { - protobuf_unittest::TestField value1, value2; + proto2_unittest::TestField value1, value2; value1.set_a(20); value2.set_a(21); - protobuf_unittest::TestAny m1, m2; + proto2_unittest::TestAny m1, m2; m1.mutable_any_value()->PackFrom(value1); m2.mutable_any_value()->PackFrom(value2); util::MessageDifferencer message_differencer; @@ -4279,12 +4279,12 @@ TEST(AnyTest, Simple) { } TEST(AnyTest, DifferentTypes) { - protobuf_unittest::TestField value1; + proto2_unittest::TestField value1; value1.set_a(20); - protobuf_unittest::ForeignMessage value2; + proto2_unittest::ForeignMessage value2; value2.set_c(30); - protobuf_unittest::TestAny m1, m2; + proto2_unittest::TestAny m1, m2; m1.mutable_any_value()->PackFrom(value1); m2.mutable_any_value()->PackFrom(value2); util::MessageDifferencer message_differencer; @@ -4295,17 +4295,17 @@ TEST(AnyTest, DifferentTypes) { EXPECT_THAT( difference_string, testing::ContainsRegex( - R"(type_url: ".+/protobuf_unittest.TestField\" -> ".+/protobuf_unittest.ForeignMessage")")); + R"(type_url: ".+/proto2_unittest.TestField\" -> ".+/proto2_unittest.ForeignMessage")")); } TEST(Anytest, TreatAsSet) { - protobuf_unittest::TestField value1, value2; + proto2_unittest::TestField value1, value2; value1.set_a(20); value1.set_b(30); value2.set_a(20); value2.set_b(31); - protobuf_unittest::TestAny m1, m2; + proto2_unittest::TestAny m1, m2; m1.add_repeated_any_value()->PackFrom(value1); m1.add_repeated_any_value()->PackFrom(value2); m2.add_repeated_any_value()->PackFrom(value2); @@ -4317,13 +4317,13 @@ TEST(Anytest, TreatAsSet) { } TEST(Anytest, TreatAsSet_DifferentType) { - protobuf_unittest::TestField value1; + proto2_unittest::TestField value1; value1.set_a(20); value1.set_b(30); - protobuf_unittest::TestDiffMessage value2; + proto2_unittest::TestDiffMessage value2; value2.add_rv(40); - protobuf_unittest::TestAny m1, m2; + proto2_unittest::TestAny m1, m2; m1.add_repeated_any_value()->PackFrom(value1); m1.add_repeated_any_value()->PackFrom(value2); m2.add_repeated_any_value()->PackFrom(value2); diff --git a/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.proto b/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.proto index 702b3e35494c9..6103356f63efc 100644 --- a/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.proto +++ b/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.proto @@ -14,7 +14,7 @@ syntax = "proto2"; -package protobuf_unittest; +package proto2_unittest; import "google/protobuf/any.proto"; diff --git a/third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc b/third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc index 3efe45060d34e..d1e481a97273d 100644 --- a/third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc +++ b/third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc @@ -21,7 +21,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/strings/strip.h" -#include "google/protobuf/descriptor_legacy.h" #include "google/protobuf/io/strtod.h" #include "google/protobuf/util/type_resolver.h" @@ -217,7 +216,8 @@ std::string GetTypeUrl(absl::string_view url_prefix, const T& descriptor) { } void ConvertFieldDescriptor(absl::string_view url_prefix, - const FieldDescriptor& descriptor, Field* field) { + const FieldDescriptor& descriptor, + const FieldDescriptorProto& proto, Field* field) { field->set_kind(static_cast<Field::Kind>(descriptor.type())); switch (descriptor.label()) { case FieldDescriptor::LABEL_OPTIONAL: @@ -249,24 +249,28 @@ void ConvertFieldDescriptor(absl::string_view url_prefix, field->set_packed(true); } - ConvertFieldOptions(descriptor.options(), *field->mutable_options()); + ConvertFieldOptions(proto.options(), *field->mutable_options()); } -Syntax ConvertSyntax(Edition edition) { - switch (edition) { - case Edition::EDITION_PROTO2: - return Syntax::SYNTAX_PROTO2; - case Edition::EDITION_PROTO3: - return Syntax::SYNTAX_PROTO3; - default: - return Syntax::SYNTAX_EDITIONS; +Syntax ConvertSyntax(absl::string_view syntax) { + if (syntax == "proto2" || syntax.empty()) { + return Syntax::SYNTAX_PROTO2; } + if (syntax == "proto3") { + return Syntax::SYNTAX_PROTO3; + } + + return Syntax::SYNTAX_EDITIONS; } -void ConvertEnumDescriptor(const EnumDescriptor& descriptor, Enum* enum_type) { +void ConvertEnumDescriptor(const EnumDescriptor& descriptor, + const FileDescriptorProto& file, + const EnumDescriptorProto& proto, Enum* enum_type) { enum_type->Clear(); - enum_type->set_syntax( - ConvertSyntax(FileDescriptorLegacy(descriptor.file()).edition())); + enum_type->set_syntax(ConvertSyntax(file.syntax())); + if (enum_type->syntax() == Syntax::SYNTAX_EDITIONS) { + enum_type->set_edition(absl::StrCat(file.edition())); + } enum_type->set_name(descriptor.full_name()); enum_type->mutable_source_context()->set_file_name(descriptor.file()->name()); @@ -276,28 +280,32 @@ void ConvertEnumDescriptor(const EnumDescriptor& descriptor, Enum* enum_type) { value->set_name(value_descriptor.name()); value->set_number(value_descriptor.number()); - ConvertEnumValueOptions(value_descriptor.options(), + ConvertEnumValueOptions(proto.value(i).options(), *value->mutable_options()); } - ConvertEnumOptions(descriptor.options(), *enum_type->mutable_options()); + ConvertEnumOptions(proto.options(), *enum_type->mutable_options()); } void ConvertDescriptor(absl::string_view url_prefix, - const Descriptor& descriptor, Type* type) { + const Descriptor& descriptor, + const FileDescriptorProto& file, + const DescriptorProto& proto, Type* type) { type->Clear(); type->set_name(descriptor.full_name()); - type->set_syntax( - ConvertSyntax(FileDescriptorLegacy(descriptor.file()).edition())); + type->set_syntax(ConvertSyntax(file.syntax())); + if (type->syntax() == Syntax::SYNTAX_EDITIONS) { + type->set_edition(absl::StrCat(file.edition())); + } for (int i = 0; i < descriptor.field_count(); ++i) { - ConvertFieldDescriptor(url_prefix, *descriptor.field(i), + ConvertFieldDescriptor(url_prefix, *descriptor.field(i), proto.field(i), type->add_fields()); } for (int i = 0; i < descriptor.oneof_decl_count(); ++i) { type->add_oneofs(descriptor.oneof_decl(i)->name()); } type->mutable_source_context()->set_file_name(descriptor.file()->name()); - ConvertMessageOptions(descriptor.options(), *type->mutable_options()); + ConvertMessageOptions(proto.options(), *type->mutable_options()); } class DescriptorPoolTypeResolver : public TypeResolver { @@ -319,7 +327,7 @@ class DescriptorPoolTypeResolver : public TypeResolver { return absl::NotFoundError( absl::StrCat("Invalid type URL, unknown type: ", type_name)); } - ConvertDescriptor(url_prefix_, *descriptor, type); + *type = ConvertDescriptorToType(url_prefix_, *descriptor); return absl::Status(); } @@ -336,7 +344,7 @@ class DescriptorPoolTypeResolver : public TypeResolver { return absl::InvalidArgumentError( absl::StrCat("Invalid type URL, unknown type: ", type_name)); } - ConvertEnumDescriptor(*descriptor, enum_type); + *enum_type = ConvertDescriptorToType(*descriptor); return absl::Status(); } @@ -369,14 +377,21 @@ TypeResolver* NewTypeResolverForDescriptorPool(absl::string_view url_prefix, Type ConvertDescriptorToType(absl::string_view url_prefix, const Descriptor& descriptor) { Type type; - ConvertDescriptor(url_prefix, descriptor, &type); + FileDescriptorProto proto; + descriptor.file()->CopyHeadingTo(&proto); + descriptor.CopyTo(proto.add_message_type()); + ConvertDescriptor(url_prefix, descriptor, proto, proto.message_type(0), + &type); return type; } // Performs a direct conversion from an enum descriptor to a type proto. Enum ConvertDescriptorToType(const EnumDescriptor& descriptor) { Enum enum_type; - ConvertEnumDescriptor(descriptor, &enum_type); + FileDescriptorProto proto; + descriptor.file()->CopyHeadingTo(&proto); + descriptor.CopyTo(proto.add_enum_type()); + ConvertEnumDescriptor(descriptor, proto, proto.enum_type(0), &enum_type); return enum_type; } diff --git a/third_party/protobuf/src/google/protobuf/util/type_resolver_util_test.cc b/third_party/protobuf/src/google/protobuf/util/type_resolver_util_test.cc index 5417633e087f2..f3cb065986e4c 100644 --- a/third_party/protobuf/src/google/protobuf/util/type_resolver_util_test.cc +++ b/third_party/protobuf/src/google/protobuf/util/type_resolver_util_test.cc @@ -8,25 +8,25 @@ #include "google/protobuf/util/type_resolver_util.h" #include <cstdint> -#include <limits> #include <memory> #include <string> -#include <vector> #include "google/protobuf/any.pb.h" #include "google/protobuf/type.pb.h" #include "google/protobuf/wrappers.pb.h" #include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/util/type_resolver.h" -#include <gmock/gmock.h> #include <gtest/gtest.h> +#include "absl/log/absl_check.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "google/protobuf/descriptor.h" -#include "google/protobuf/descriptor_legacy.h" #include "google/protobuf/util/json_format_proto3.pb.h" #include "google/protobuf/map_unittest.pb.h" +#include "google/protobuf/test_textproto.h" #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_custom_options.pb.h" #include "google/protobuf/unittest_import.pb.h" +#include "google/protobuf/util/type_resolver.h" namespace google { namespace protobuf { @@ -136,8 +136,8 @@ bool HasUInt64Option(const RepeatedPtrField<Option>& options, return HasOption<UInt64Value>(options, name, value); } -std::string GetTypeUrl(std::string full_name) { - return kUrlPrefix + std::string("/") + full_name; +std::string GetTypeUrl(absl::string_view full_name) { + return absl::StrCat(kUrlPrefix, "/", full_name); } template <typename T> @@ -160,7 +160,7 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { Type type; ASSERT_TRUE(resolver_ ->ResolveMessageType( - GetTypeUrl<protobuf_unittest::TestAllTypes>(), &type) + GetTypeUrl<proto2_unittest::TestAllTypes>(), &type) .ok()); // Check all optional fields. EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_INT32, @@ -199,7 +199,7 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "optionalgroup", - GetTypeUrl<protobuf_unittest::TestAllTypes::OptionalGroup>())); + GetTypeUrl<proto2_unittest::TestAllTypes::OptionalGroup>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_MESSAGE, "optional_nested_message", 18)); @@ -208,9 +208,9 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "optional_nested_message", - GetTypeUrl<protobuf_unittest::TestAllTypes::NestedMessage>())); + GetTypeUrl<proto2_unittest::TestAllTypes::NestedMessage>())); EXPECT_TRUE(CheckFieldTypeUrl(type, "optional_foreign_message", - GetTypeUrl<protobuf_unittest::ForeignMessage>())); + GetTypeUrl<proto2_unittest::ForeignMessage>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_ENUM, "optional_nested_enum", 21)); @@ -219,9 +219,9 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { EXPECT_TRUE( CheckFieldTypeUrl(type, "optional_nested_enum", - GetTypeUrl("protobuf_unittest.TestAllTypes.NestedEnum"))); + GetTypeUrl("proto2_unittest.TestAllTypes.NestedEnum"))); EXPECT_TRUE(CheckFieldTypeUrl(type, "optional_foreign_enum", - GetTypeUrl("protobuf_unittest.ForeignEnum"))); + GetTypeUrl("proto2_unittest.ForeignEnum"))); // Check all repeated fields. EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_INT32, @@ -260,7 +260,7 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "repeatedgroup", - GetTypeUrl<protobuf_unittest::TestAllTypes::RepeatedGroup>())); + GetTypeUrl<proto2_unittest::TestAllTypes::RepeatedGroup>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_MESSAGE, "repeated_nested_message", 48)); @@ -269,9 +269,9 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "repeated_nested_message", - GetTypeUrl<protobuf_unittest::TestAllTypes::NestedMessage>())); + GetTypeUrl<proto2_unittest::TestAllTypes::NestedMessage>())); EXPECT_TRUE(CheckFieldTypeUrl(type, "repeated_foreign_message", - GetTypeUrl<protobuf_unittest::ForeignMessage>())); + GetTypeUrl<proto2_unittest::ForeignMessage>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_ENUM, "repeated_nested_enum", 51)); @@ -280,16 +280,16 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { EXPECT_TRUE( CheckFieldTypeUrl(type, "repeated_nested_enum", - GetTypeUrl("protobuf_unittest.TestAllTypes.NestedEnum"))); + GetTypeUrl("proto2_unittest.TestAllTypes.NestedEnum"))); EXPECT_TRUE(CheckFieldTypeUrl(type, "repeated_foreign_enum", - GetTypeUrl("protobuf_unittest.ForeignEnum"))); + GetTypeUrl("proto2_unittest.ForeignEnum"))); } TEST_F(DescriptorPoolTypeResolverTest, TestPackedField) { Type type; ASSERT_TRUE(resolver_ ->ResolveMessageType( - GetTypeUrl<protobuf_unittest::TestPackedTypes>(), &type) + GetTypeUrl<proto2_unittest::TestPackedTypes>(), &type) .ok()); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_INT32, "packed_int32", 90)); @@ -300,7 +300,7 @@ TEST_F(DescriptorPoolTypeResolverTest, TestOneof) { Type type; ASSERT_TRUE(resolver_ ->ResolveMessageType( - GetTypeUrl<protobuf_unittest::TestAllTypes>(), &type) + GetTypeUrl<proto2_unittest::TestAllTypes>(), &type) .ok()); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_UINT32, "oneof_uint32", 111)); @@ -320,18 +320,18 @@ TEST_F(DescriptorPoolTypeResolverTest, TestMap) { Type type; ASSERT_TRUE( resolver_ - ->ResolveMessageType(GetTypeUrl<protobuf_unittest::TestMap>(), &type) + ->ResolveMessageType(GetTypeUrl<proto2_unittest::TestMap>(), &type) .ok()); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_MESSAGE, "map_int32_int32", 1)); EXPECT_TRUE(CheckFieldTypeUrl( type, "map_int32_int32", - GetTypeUrl("protobuf_unittest.TestMap.MapInt32Int32Entry"))); + GetTypeUrl("proto2_unittest.TestMap.MapInt32Int32Entry"))); ASSERT_TRUE( resolver_ ->ResolveMessageType( - GetTypeUrl("protobuf_unittest.TestMap.MapInt32Int32Entry"), &type) + GetTypeUrl("proto2_unittest.TestMap.MapInt32Int32Entry"), &type) .ok()); EXPECT_TRUE(HasBoolOption(type.options(), "map_entry", true)); } @@ -341,11 +341,11 @@ TEST_F(DescriptorPoolTypeResolverTest, TestCustomMessageOptions) { ASSERT_TRUE( resolver_ ->ResolveMessageType( - GetTypeUrl<protobuf_unittest::TestMessageWithCustomOptions>(), + GetTypeUrl<proto2_unittest::TestMessageWithCustomOptions>(), &type) .ok()); EXPECT_TRUE( - HasInt32Option(type.options(), "protobuf_unittest.message_opt1", -56)); + HasInt32Option(type.options(), "proto2_unittest.message_opt1", -56)); } TEST_F(DescriptorPoolTypeResolverTest, TestCustomFieldOptions) { @@ -353,12 +353,12 @@ TEST_F(DescriptorPoolTypeResolverTest, TestCustomFieldOptions) { ASSERT_TRUE( resolver_ ->ResolveMessageType( - GetTypeUrl<protobuf_unittest::TestMessageWithCustomOptions>(), + GetTypeUrl<proto2_unittest::TestMessageWithCustomOptions>(), &type) .ok()); const Field* field = FindField(type, "field1"); ASSERT_TRUE(field != nullptr); - EXPECT_TRUE(HasUInt64Option(field->options(), "protobuf_unittest.field_opt1", + EXPECT_TRUE(HasUInt64Option(field->options(), "proto2_unittest.field_opt1", 8765432109)); } @@ -367,7 +367,7 @@ TEST_F(DescriptorPoolTypeResolverTest, TestEnum) { ASSERT_TRUE( resolver_ ->ResolveEnumType( - GetTypeUrl("protobuf_unittest.TestAllTypes.NestedEnum"), &type) + GetTypeUrl("proto2_unittest.TestAllTypes.NestedEnum"), &type) .ok()); EnumHasValue(type, "FOO", 1); EnumHasValue(type, "BAR", 2); @@ -380,11 +380,11 @@ TEST_F(DescriptorPoolTypeResolverTest, TestCustomEnumOptions) { ASSERT_TRUE( resolver_ ->ResolveEnumType( - GetTypeUrl("protobuf_unittest.TestMessageWithCustomOptions.AnEnum"), + GetTypeUrl("proto2_unittest.TestMessageWithCustomOptions.AnEnum"), &type) .ok()); ASSERT_TRUE( - HasInt32Option(type.options(), "protobuf_unittest.enum_opt1", -789)); + HasInt32Option(type.options(), "proto2_unittest.enum_opt1", -789)); } TEST_F(DescriptorPoolTypeResolverTest, TestCustomValueOptions) { @@ -392,20 +392,20 @@ TEST_F(DescriptorPoolTypeResolverTest, TestCustomValueOptions) { ASSERT_TRUE( resolver_ ->ResolveEnumType( - GetTypeUrl("protobuf_unittest.TestMessageWithCustomOptions.AnEnum"), + GetTypeUrl("proto2_unittest.TestMessageWithCustomOptions.AnEnum"), &type) .ok()); const EnumValue* value = FindEnumValue(type, "ANENUM_VAL2"); ASSERT_TRUE(value != nullptr); ASSERT_TRUE( - HasInt32Option(value->options(), "protobuf_unittest.enum_value_opt1", 123)); + HasInt32Option(value->options(), "proto2_unittest.enum_value_opt1", 123)); } TEST_F(DescriptorPoolTypeResolverTest, TestJsonName) { Type type; ASSERT_TRUE(resolver_ ->ResolveMessageType( - GetTypeUrl<protobuf_unittest::TestAllTypes>(), &type) + GetTypeUrl<proto2_unittest::TestAllTypes>(), &type) .ok()); EXPECT_EQ("optionalInt32", FindField(type, "optional_int32")->json_name()); @@ -421,18 +421,8 @@ class DescriptorPoolTypeResolverSyntaxTest : public testing::Test { DescriptorPoolTypeResolverSyntaxTest() : resolver_(NewTypeResolverForDescriptorPool(kUrlPrefix, &pool_)) {} - const FileDescriptor* BuildFile( - absl::string_view syntax, - absl::optional<Edition> edition = absl::nullopt) { - FileDescriptorProto proto; - proto.set_package("test"); - proto.set_name("foo"); - proto.set_syntax(syntax); - if (edition.has_value()) { - proto.set_edition(*edition); - } - DescriptorProto* message = proto.add_message_type(); - message->set_name("MyMessage"); + const FileDescriptor* BuildFile(absl::string_view file_contents) { + FileDescriptorProto proto = ParseTextOrDie(file_contents); const FileDescriptor* file = pool_.BuildFile(proto); ABSL_CHECK(file != nullptr); return file; @@ -443,8 +433,12 @@ class DescriptorPoolTypeResolverSyntaxTest : public testing::Test { }; TEST_F(DescriptorPoolTypeResolverSyntaxTest, SyntaxProto2) { - const FileDescriptor* file = BuildFile("proto2"); - ASSERT_EQ(FileDescriptorLegacy(file).edition(), Edition::EDITION_PROTO2); + BuildFile(R"pb( + package: "test" + name: "foo" + syntax: "proto2" + message_type { name: "MyMessage" } + )pb"); Type type; ASSERT_TRUE( @@ -454,8 +448,12 @@ TEST_F(DescriptorPoolTypeResolverSyntaxTest, SyntaxProto2) { } TEST_F(DescriptorPoolTypeResolverSyntaxTest, SyntaxProto3) { - const FileDescriptor* file = BuildFile("proto3"); - ASSERT_EQ(FileDescriptorLegacy(file).edition(), Edition::EDITION_PROTO3); + BuildFile(R"pb( + package: "test" + name: "foo" + syntax: "proto3" + message_type { name: "MyMessage" } + )pb"); Type type; ASSERT_TRUE( @@ -464,10 +462,98 @@ TEST_F(DescriptorPoolTypeResolverSyntaxTest, SyntaxProto3) { EXPECT_EQ(type.edition(), ""); } +TEST_F(DescriptorPoolTypeResolverSyntaxTest, SyntaxEditions) { + BuildFile(R"pb( + package: "test" + name: "foo" + syntax: "editions" + edition: EDITION_2023 + message_type { name: "MyMessage" } + )pb"); + + Type type; + ASSERT_TRUE( + resolver_->ResolveMessageType(GetTypeUrl("test.MyMessage"), &type).ok()); + EXPECT_EQ(type.syntax(), Syntax::SYNTAX_EDITIONS); + EXPECT_EQ(type.edition(), "2023"); +} + +TEST_F(DescriptorPoolTypeResolverSyntaxTest, EditionsFieldFeatures) { + BuildFile(R"pb( + package: "test" + name: "foo" + syntax: "editions" + edition: EDITION_2023 + message_type { + name: "MyMessage" + field { + name: "field" + number: 1 + type: TYPE_BYTES + options { + features { + [pb.cpp] { string_type: CORD } + } + } + } + } + )pb"); + + Type type; + ASSERT_TRUE( + resolver_->ResolveMessageType(GetTypeUrl("test.MyMessage"), &type).ok()); + ASSERT_EQ(type.fields_size(), 1); + EXPECT_THAT(type.fields(0), EqualsProto(R"pb( + kind: TYPE_BYTES + cardinality: CARDINALITY_OPTIONAL + number: 1 + name: "field" + options { + name: "features" + value { + [type.googleapis.com/google.protobuf.FeatureSet] { + [pb.cpp] { string_type: CORD } + } + } + } + json_name: "field" + )pb")); +} + +TEST_F(DescriptorPoolTypeResolverSyntaxTest, EditionsEnumFeatures) { + BuildFile(R"pb( + package: "test" + name: "foo" + syntax: "editions" + edition: EDITION_2023 + enum_type { + name: "MyEnum" + value: { name: "FOO" number: 1 } + options { features { enum_type: CLOSED } } + } + )pb"); + + Enum enm; + ASSERT_TRUE(resolver_->ResolveEnumType(GetTypeUrl("test.MyEnum"), &enm).ok()); + EXPECT_THAT( + enm, EqualsProto(R"pb( + name: "test.MyEnum" + enumvalue { name: "FOO" number: 1 } + options { + name: "features" + value { + [type.googleapis.com/google.protobuf.FeatureSet] { enum_type: CLOSED } + } + } + source_context { file_name: "foo" } + syntax: SYNTAX_EDITIONS + edition: "2023" + )pb")); +} TEST(ConvertDescriptorToTypeTest, TestAllTypes) { Type type = ConvertDescriptorToType( - kUrlPrefix, *protobuf_unittest::TestAllTypes::GetDescriptor()); + kUrlPrefix, *proto2_unittest::TestAllTypes::GetDescriptor()); // Check all optional fields. EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_INT32, @@ -506,7 +592,7 @@ TEST(ConvertDescriptorToTypeTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "optionalgroup", - GetTypeUrl<protobuf_unittest::TestAllTypes::OptionalGroup>())); + GetTypeUrl<proto2_unittest::TestAllTypes::OptionalGroup>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_MESSAGE, "optional_nested_message", 18)); @@ -515,9 +601,9 @@ TEST(ConvertDescriptorToTypeTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "optional_nested_message", - GetTypeUrl<protobuf_unittest::TestAllTypes::NestedMessage>())); + GetTypeUrl<proto2_unittest::TestAllTypes::NestedMessage>())); EXPECT_TRUE(CheckFieldTypeUrl(type, "optional_foreign_message", - GetTypeUrl<protobuf_unittest::ForeignMessage>())); + GetTypeUrl<proto2_unittest::ForeignMessage>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_ENUM, "optional_nested_enum", 21)); @@ -526,9 +612,9 @@ TEST(ConvertDescriptorToTypeTest, TestAllTypes) { EXPECT_TRUE( CheckFieldTypeUrl(type, "optional_nested_enum", - GetTypeUrl("protobuf_unittest.TestAllTypes.NestedEnum"))); + GetTypeUrl("proto2_unittest.TestAllTypes.NestedEnum"))); EXPECT_TRUE(CheckFieldTypeUrl(type, "optional_foreign_enum", - GetTypeUrl("protobuf_unittest.ForeignEnum"))); + GetTypeUrl("proto2_unittest.ForeignEnum"))); // Check all repeated fields. EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_INT32, @@ -567,7 +653,7 @@ TEST(ConvertDescriptorToTypeTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "repeatedgroup", - GetTypeUrl<protobuf_unittest::TestAllTypes::RepeatedGroup>())); + GetTypeUrl<proto2_unittest::TestAllTypes::RepeatedGroup>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_MESSAGE, "repeated_nested_message", 48)); @@ -576,9 +662,9 @@ TEST(ConvertDescriptorToTypeTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "repeated_nested_message", - GetTypeUrl<protobuf_unittest::TestAllTypes::NestedMessage>())); + GetTypeUrl<proto2_unittest::TestAllTypes::NestedMessage>())); EXPECT_TRUE(CheckFieldTypeUrl(type, "repeated_foreign_message", - GetTypeUrl<protobuf_unittest::ForeignMessage>())); + GetTypeUrl<proto2_unittest::ForeignMessage>())); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_ENUM, "repeated_nested_enum", 51)); @@ -587,14 +673,14 @@ TEST(ConvertDescriptorToTypeTest, TestAllTypes) { EXPECT_TRUE( CheckFieldTypeUrl(type, "repeated_nested_enum", - GetTypeUrl("protobuf_unittest.TestAllTypes.NestedEnum"))); + GetTypeUrl("proto2_unittest.TestAllTypes.NestedEnum"))); EXPECT_TRUE(CheckFieldTypeUrl(type, "repeated_foreign_enum", - GetTypeUrl("protobuf_unittest.ForeignEnum"))); + GetTypeUrl("proto2_unittest.ForeignEnum"))); } TEST(ConvertDescriptorToTypeTest, ConvertDescriptorToTypePacked) { Type type = ConvertDescriptorToType( - kUrlPrefix, *protobuf_unittest::TestPackedTypes::GetDescriptor()); + kUrlPrefix, *proto2_unittest::TestPackedTypes::GetDescriptor()); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_INT32, "packed_int32", 90)); EXPECT_TRUE(IsPacked(type, "packed_int32")); @@ -602,7 +688,7 @@ TEST(ConvertDescriptorToTypeTest, ConvertDescriptorToTypePacked) { TEST(ConvertDescriptorToTypeTest, TestOneof) { Type type = ConvertDescriptorToType( - kUrlPrefix, *protobuf_unittest::TestAllTypes::GetDescriptor()); + kUrlPrefix, *proto2_unittest::TestAllTypes::GetDescriptor()); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_UINT32, "oneof_uint32", 111)); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_MESSAGE, @@ -619,29 +705,29 @@ TEST(ConvertDescriptorToTypeTest, TestOneof) { TEST(ConvertDescriptorToTypeTest, TestMap) { Type type = ConvertDescriptorToType( - kUrlPrefix, *protobuf_unittest::TestMap::GetDescriptor()); + kUrlPrefix, *proto2_unittest::TestMap::GetDescriptor()); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_MESSAGE, "map_int32_int32", 1)); EXPECT_TRUE(CheckFieldTypeUrl( type, "map_int32_int32", - GetTypeUrl("protobuf_unittest.TestMap.MapInt32Int32Entry"))); + GetTypeUrl("proto2_unittest.TestMap.MapInt32Int32Entry"))); } TEST(ConvertDescriptorToTypeTest, TestCustomOptions) { Type type = ConvertDescriptorToType( kUrlPrefix, - *protobuf_unittest::TestMessageWithCustomOptions::GetDescriptor()); + *proto2_unittest::TestMessageWithCustomOptions::GetDescriptor()); EXPECT_TRUE( - HasInt32Option(type.options(), "protobuf_unittest.message_opt1", -56)); + HasInt32Option(type.options(), "proto2_unittest.message_opt1", -56)); const Field* field = FindField(type, "field1"); ASSERT_TRUE(field != nullptr); - EXPECT_TRUE(HasUInt64Option(field->options(), "protobuf_unittest.field_opt1", + EXPECT_TRUE(HasUInt64Option(field->options(), "proto2_unittest.field_opt1", 8765432109)); } TEST(ConvertDescriptorToTypeTest, TestJsonName) { Type type = ConvertDescriptorToType( - kUrlPrefix, *protobuf_unittest::TestAllTypes::GetDescriptor()); + kUrlPrefix, *proto2_unittest::TestAllTypes::GetDescriptor()); EXPECT_EQ("optionalInt32", FindField(type, "optional_int32")->json_name()); type = ConvertDescriptorToType(kUrlPrefix, @@ -651,7 +737,7 @@ TEST(ConvertDescriptorToTypeTest, TestJsonName) { TEST(ConvertDescriptorToTypeTest, TestEnum) { Enum type = ConvertDescriptorToType( - *protobuf_unittest::TestAllTypes::NestedEnum_descriptor()); + *proto2_unittest::TestAllTypes::NestedEnum_descriptor()); EnumHasValue(type, "FOO", 1); EnumHasValue(type, "BAR", 2); EnumHasValue(type, "BAZ", 3); @@ -660,13 +746,13 @@ TEST(ConvertDescriptorToTypeTest, TestEnum) { TEST(ConvertDescriptorToTypeTest, TestCustomEnumOptions) { Enum type = ConvertDescriptorToType( - *protobuf_unittest::TestMessageWithCustomOptions::AnEnum_descriptor()); + *proto2_unittest::TestMessageWithCustomOptions::AnEnum_descriptor()); ASSERT_TRUE( - HasInt32Option(type.options(), "protobuf_unittest.enum_opt1", -789)); + HasInt32Option(type.options(), "proto2_unittest.enum_opt1", -789)); const EnumValue* value = FindEnumValue(type, "ANENUM_VAL2"); ASSERT_TRUE(value != nullptr); ASSERT_TRUE( - HasInt32Option(value->options(), "protobuf_unittest.enum_value_opt1", 123)); + HasInt32Option(value->options(), "proto2_unittest.enum_value_opt1", 123)); } } // namespace diff --git a/third_party/protobuf/src/google/protobuf/varint_shuffle.h b/third_party/protobuf/src/google/protobuf/varint_shuffle.h index 1269dd7a69df6..e6c82787a3396 100644 --- a/third_party/protobuf/src/google/protobuf/varint_shuffle.h +++ b/third_party/protobuf/src/google/protobuf/varint_shuffle.h @@ -15,6 +15,7 @@ #include <utility> // Must be included last. +#include "absl/base/optimization.h" #include "google/protobuf/port_def.inc" namespace google { @@ -23,7 +24,7 @@ namespace internal { // Shifts "byte" left by n * 7 bits, filling vacated bits from `ones`. template <int n> -inline PROTOBUF_ALWAYS_INLINE int64_t VarintShlByte(int8_t byte, int64_t ones) { +PROTOBUF_ALWAYS_INLINE int64_t VarintShlByte(int8_t byte, int64_t ones) { return static_cast<int64_t>((static_cast<uint64_t>(byte) << n * 7) | (static_cast<uint64_t>(ones) >> (64 - n * 7))); } @@ -32,8 +33,8 @@ inline PROTOBUF_ALWAYS_INLINE int64_t VarintShlByte(int8_t byte, int64_t ones) { // bitwise ANDs the resulting value into the input/output `res` parameter. // Returns true if the result was not negative. template <int n> -inline PROTOBUF_ALWAYS_INLINE bool VarintShlAnd(int8_t byte, int64_t ones, - int64_t& res) { +PROTOBUF_ALWAYS_INLINE bool VarintShlAnd(int8_t byte, int64_t ones, + int64_t& res) { res &= VarintShlByte<n>(byte, ones); return res >= 0; } @@ -42,15 +43,14 @@ inline PROTOBUF_ALWAYS_INLINE bool VarintShlAnd(int8_t byte, int64_t ones, // puts the new value in the output only parameter `res`. // Returns true if the result was not negative. template <int n> -inline PROTOBUF_ALWAYS_INLINE bool VarintShl(int8_t byte, int64_t ones, - int64_t& res) { +PROTOBUF_ALWAYS_INLINE bool VarintShl(int8_t byte, int64_t ones, int64_t& res) { res = VarintShlByte<n>(byte, ones); return res >= 0; } template <typename VarintType, int limit = 10> -inline PROTOBUF_ALWAYS_INLINE const char* ShiftMixParseVarint(const char* p, - int64_t& res1) { +PROTOBUF_ALWAYS_INLINE const char* ShiftMixParseVarint(const char* p, + int64_t& res1) { using Signed = std::make_signed_t<VarintType>; constexpr bool kIs64BitVarint = std::is_same<Signed, int64_t>::value; constexpr bool kIs32BitVarint = std::is_same<Signed, int32_t>::value; @@ -79,47 +79,47 @@ inline PROTOBUF_ALWAYS_INLINE const char* ShiftMixParseVarint(const char* p, int64_t res2, res3; // accumulated result chunks res1 = next(); - if (PROTOBUF_PREDICT_TRUE(res1 >= 0)) return p; + if (ABSL_PREDICT_TRUE(res1 >= 0)) return p; if (limit <= 1) goto limit0; // Densify all ops with explicit FALSE predictions from here on, except that // we predict length = 5 as a common length for fields like timestamp. - if (PROTOBUF_PREDICT_FALSE(VarintShl<1>(next(), res1, res2))) goto done1; + if (ABSL_PREDICT_FALSE(VarintShl<1>(next(), res1, res2))) goto done1; if (limit <= 2) goto limit1; - if (PROTOBUF_PREDICT_FALSE(VarintShl<2>(next(), res1, res3))) goto done2; + if (ABSL_PREDICT_FALSE(VarintShl<2>(next(), res1, res3))) goto done2; if (limit <= 3) goto limit2; - if (PROTOBUF_PREDICT_FALSE(VarintShlAnd<3>(next(), res1, res2))) goto done2; + if (ABSL_PREDICT_FALSE(VarintShlAnd<3>(next(), res1, res2))) goto done2; if (limit <= 4) goto limit2; - if (PROTOBUF_PREDICT_TRUE(VarintShlAnd<4>(next(), res1, res3))) goto done2; + if (ABSL_PREDICT_TRUE(VarintShlAnd<4>(next(), res1, res3))) goto done2; if (limit <= 5) goto limit2; if (kIs64BitVarint) { - if (PROTOBUF_PREDICT_FALSE(VarintShlAnd<5>(next(), res1, res2))) goto done2; + if (ABSL_PREDICT_FALSE(VarintShlAnd<5>(next(), res1, res2))) goto done2; if (limit <= 6) goto limit2; - if (PROTOBUF_PREDICT_FALSE(VarintShlAnd<6>(next(), res1, res3))) goto done2; + if (ABSL_PREDICT_FALSE(VarintShlAnd<6>(next(), res1, res3))) goto done2; if (limit <= 7) goto limit2; - if (PROTOBUF_PREDICT_FALSE(VarintShlAnd<7>(next(), res1, res2))) goto done2; + if (ABSL_PREDICT_FALSE(VarintShlAnd<7>(next(), res1, res2))) goto done2; if (limit <= 8) goto limit2; - if (PROTOBUF_PREDICT_FALSE(VarintShlAnd<8>(next(), res1, res3))) goto done2; + if (ABSL_PREDICT_FALSE(VarintShlAnd<8>(next(), res1, res3))) goto done2; if (limit <= 9) goto limit2; } else { // An overlong int32 is expected to span the full 10 bytes - if (PROTOBUF_PREDICT_FALSE(!(next() & 0x80))) goto done2; + if (ABSL_PREDICT_FALSE(!(next() & 0x80))) goto done2; if (limit <= 6) goto limit2; - if (PROTOBUF_PREDICT_FALSE(!(next() & 0x80))) goto done2; + if (ABSL_PREDICT_FALSE(!(next() & 0x80))) goto done2; if (limit <= 7) goto limit2; - if (PROTOBUF_PREDICT_FALSE(!(next() & 0x80))) goto done2; + if (ABSL_PREDICT_FALSE(!(next() & 0x80))) goto done2; if (limit <= 8) goto limit2; - if (PROTOBUF_PREDICT_FALSE(!(next() & 0x80))) goto done2; + if (ABSL_PREDICT_FALSE(!(next() & 0x80))) goto done2; if (limit <= 9) goto limit2; } // 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. - if (PROTOBUF_PREDICT_TRUE(next() == 1)) goto done2; + if (ABSL_PREDICT_TRUE(next() == 1)) goto done2; - if (PROTOBUF_PREDICT_FALSE(last() & 0x80)) { + if (ABSL_PREDICT_FALSE(last() & 0x80)) { // If the continue bit is set, it is an unterminated varint. return nullptr; } diff --git a/third_party/protobuf/src/google/protobuf/well_known_types_unittest.cc b/third_party/protobuf/src/google/protobuf/well_known_types_unittest.cc index 0c2f199205e49..2ffe6c50e0952 100644 --- a/third_party/protobuf/src/google/protobuf/well_known_types_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/well_known_types_unittest.cc @@ -17,7 +17,7 @@ namespace { // This test only checks whether well-known types are included in protobuf // runtime library. The test passes if it compiles. TEST(WellKnownTypesTest, AllKnownTypesAreIncluded) { - protobuf_unittest::TestWellKnownTypes message; + proto2_unittest::TestWellKnownTypes message; EXPECT_EQ(0, message.any_field().ByteSize()); EXPECT_EQ(0, message.api_field().ByteSize()); EXPECT_EQ(0, message.duration_field().ByteSize()); diff --git a/third_party/protobuf/src/google/protobuf/wire_format.cc b/third_party/protobuf/src/google/protobuf/wire_format.cc index c215ac6ab057c..f7e656c0715c7 100644 --- a/third_party/protobuf/src/google/protobuf/wire_format.cc +++ b/third_party/protobuf/src/google/protobuf/wire_format.cc @@ -19,6 +19,7 @@ #include <vector> #include "absl/base/attributes.h" +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/cord.h" @@ -734,7 +735,7 @@ struct WireFormat::MessageSetParser { while (!ctx->Done(&ptr)) { uint32_t tag; ptr = ReadTag(ptr, &tag); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; if (tag == 0 || (tag & 7) == WireFormatLite::WIRETYPE_END_GROUP) { ctx->SetLastTag(tag); break; @@ -758,7 +759,7 @@ struct WireFormat::MessageSetParser { ptr = WireFormat::_InternalParseAndMergeField(msg, ptr, ctx, tag, reflection, field); } - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; } return ptr; } @@ -819,7 +820,7 @@ const char* WireFormat::_InternalParse(Message* msg, const char* ptr, while (!ctx->Done(&ptr)) { uint32_t tag; ptr = ReadTag(ptr, &tag); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; if (tag == 0 || (tag & 7) == WireFormatLite::WIRETYPE_END_GROUP) { ctx->SetLastTag(tag); break; @@ -840,7 +841,7 @@ const char* WireFormat::_InternalParse(Message* msg, const char* ptr, } ptr = _InternalParseAndMergeField(msg, ptr, ctx, tag, reflection, field); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; + if (ABSL_PREDICT_FALSE(ptr == nullptr)) return nullptr; } return ptr; } diff --git a/third_party/protobuf/src/google/protobuf/wire_format_lite.h b/third_party/protobuf/src/google/protobuf/wire_format_lite.h index 3894de83461b2..9d65054dbde8d 100644 --- a/third_party/protobuf/src/google/protobuf/wire_format_lite.h +++ b/third_party/protobuf/src/google/protobuf/wire_format_lite.h @@ -25,6 +25,7 @@ #include <utility> #include "absl/base/casts.h" +#include "absl/base/optimization.h" #include "absl/log/absl_check.h" #include "absl/strings/string_view.h" #include "google/protobuf/arenastring.h" diff --git a/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc b/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc index 835a8edfac47e..c4d5ed6542dd9 100644 --- a/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc +++ b/third_party/protobuf/src/google/protobuf/wire_format_unittest.cc @@ -22,9 +22,9 @@ #include "google/protobuf/wire_format_lite.h" #include <gtest/gtest.h> -#define UNITTEST ::protobuf_unittest -#define UNITTEST_IMPORT ::protobuf_unittest_import -#define UNITTEST_PACKAGE_NAME "protobuf_unittest" +#define UNITTEST ::proto2_unittest +#define UNITTEST_IMPORT ::proto2_unittest_import +#define UNITTEST_PACKAGE_NAME "proto2_unittest" #define PROTO2_WIREFORMAT_UNITTEST ::proto2_wireformat_unittest #define PROTO3_ARENA_UNITTEST ::proto3_arena_unittest diff --git a/third_party/protobuf/src/google/protobuf/wrappers.pb.cc b/third_party/protobuf/src/google/protobuf/wrappers.pb.cc index 74889cc2f6bdf..4a800eb50b88b 100644 --- a/third_party/protobuf/src/google/protobuf/wrappers.pb.cc +++ b/third_party/protobuf/src/google/protobuf/wrappers.pb.cc @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/wrappers.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #include "google/protobuf/wrappers.pb.h" @@ -29,13 +29,13 @@ namespace protobuf { inline constexpr UInt64Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{::uint64_t{0u}}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{::uint64_t{0u}} {} template <typename> PROTOBUF_CONSTEXPR UInt64Value::UInt64Value(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(UInt64Value_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -54,13 +54,13 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr UInt32Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0u}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0u} {} template <typename> PROTOBUF_CONSTEXPR UInt32Value::UInt32Value(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(UInt32Value_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -79,15 +79,15 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr StringValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_( + : _cached_size_{0}, + value_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template <typename> PROTOBUF_CONSTEXPR StringValue::StringValue(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(StringValue_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -106,13 +106,13 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Int64Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{::int64_t{0}}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{::int64_t{0}} {} template <typename> PROTOBUF_CONSTEXPR Int64Value::Int64Value(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Int64Value_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -131,13 +131,13 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr Int32Value::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0} {} template <typename> PROTOBUF_CONSTEXPR Int32Value::Int32Value(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(Int32Value_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -156,13 +156,13 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr FloatValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0} {} template <typename> PROTOBUF_CONSTEXPR FloatValue::FloatValue(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(FloatValue_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -181,13 +181,13 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr DoubleValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{0}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{0} {} template <typename> PROTOBUF_CONSTEXPR DoubleValue::DoubleValue(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(DoubleValue_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -206,15 +206,15 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr BytesValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_( + : _cached_size_{0}, + value_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - _cached_size_{0} {} + ::_pbi::ConstantInitialized()) {} template <typename> PROTOBUF_CONSTEXPR BytesValue::BytesValue(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(BytesValue_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -233,13 +233,13 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr BoolValue::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept - : value_{false}, - _cached_size_{0} {} + : _cached_size_{0}, + value_{false} {} template <typename> PROTOBUF_CONSTEXPR BoolValue::BoolValue(::_pbi::ConstantInitialized) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(_class_data_.base()), + : ::google::protobuf::Message(BoolValue_class_data_.base()), #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(), #endif // PROTOBUF_CUSTOM_VTABLE @@ -257,14 +257,14 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BoolValueDefaultTypeInternal _BoolValue_default_instance_; } // namespace protobuf } // namespace google -static constexpr const ::_pb::EnumDescriptor** +static constexpr const ::_pb::EnumDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_enum_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr; -static constexpr const ::_pb::ServiceDescriptor** +static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr; const ::uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::google::protobuf::DoubleValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::DoubleValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -273,7 +273,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::DoubleValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::FloatValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FloatValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -282,7 +283,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::FloatValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Int64Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Int64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -291,7 +293,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Int64Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt64Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -300,7 +303,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt64Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::Int32Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::Int32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -309,7 +313,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::Int32Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt32Value, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -318,7 +323,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::UInt32Value, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::BoolValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::BoolValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -327,7 +333,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::BoolValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::StringValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::StringValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -336,7 +343,8 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::StringValue, _impl_.value_), - ~0u, // no _has_bits_ + 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::BytesValue, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::BytesValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -345,21 +353,22 @@ const ::uint32_t ~0u, // no _split_ ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::google::protobuf::BytesValue, _impl_.value_), + 0, }; static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, -1, -1, sizeof(::google::protobuf::DoubleValue)}, - {9, -1, -1, sizeof(::google::protobuf::FloatValue)}, - {18, -1, -1, sizeof(::google::protobuf::Int64Value)}, - {27, -1, -1, sizeof(::google::protobuf::UInt64Value)}, - {36, -1, -1, sizeof(::google::protobuf::Int32Value)}, - {45, -1, -1, sizeof(::google::protobuf::UInt32Value)}, - {54, -1, -1, sizeof(::google::protobuf::BoolValue)}, - {63, -1, -1, sizeof(::google::protobuf::StringValue)}, - {72, -1, -1, sizeof(::google::protobuf::BytesValue)}, + {0, 9, -1, sizeof(::google::protobuf::DoubleValue)}, + {10, 19, -1, sizeof(::google::protobuf::FloatValue)}, + {20, 29, -1, sizeof(::google::protobuf::Int64Value)}, + {30, 39, -1, sizeof(::google::protobuf::UInt64Value)}, + {40, 49, -1, sizeof(::google::protobuf::Int32Value)}, + {50, 59, -1, sizeof(::google::protobuf::UInt32Value)}, + {60, 69, -1, sizeof(::google::protobuf::BoolValue)}, + {70, 79, -1, sizeof(::google::protobuf::StringValue)}, + {80, 89, -1, sizeof(::google::protobuf::BytesValue)}, }; -static const ::_pb::Message* const file_default_instances[] = { +static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_DoubleValue_default_instance_._instance, &::google::protobuf::_FloatValue_default_instance_._instance, &::google::protobuf::_Int64Value_default_instance_._instance, @@ -408,11 +417,15 @@ namespace protobuf { class DoubleValue::_Internal { public: + using HasBits = + decltype(std::declval<DoubleValue>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_._has_bits_); }; -DoubleValue::DoubleValue(::google::protobuf::Arena* arena) +DoubleValue::DoubleValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, DoubleValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -420,16 +433,22 @@ DoubleValue::DoubleValue(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.DoubleValue) } DoubleValue::DoubleValue( - ::google::protobuf::Arena* arena, const DoubleValue& from) - : DoubleValue(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DoubleValue& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, DoubleValue_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE DoubleValue::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE DoubleValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void DoubleValue::SharedCtor(::_pb::Arena* arena) { +inline void DoubleValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -444,45 +463,53 @@ inline void DoubleValue::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* DoubleValue::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL DoubleValue::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) DoubleValue(arena); } constexpr auto DoubleValue::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(DoubleValue), alignof(DoubleValue)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull DoubleValue::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_DoubleValue_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &DoubleValue::MergeImpl, - ::google::protobuf::Message::GetNewImpl<DoubleValue>(), +constexpr auto DoubleValue::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_DoubleValue_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &DoubleValue::MergeImpl, + ::google::protobuf::Message::GetNewImpl<DoubleValue>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &DoubleValue::SharedDtor, - ::google::protobuf::Message::GetClearImpl<DoubleValue>(), &DoubleValue::ByteSizeLong, - &DoubleValue::_InternalSerialize, + &DoubleValue::SharedDtor, + ::google::protobuf::Message::GetClearImpl<DoubleValue>(), &DoubleValue::ByteSizeLong, + &DoubleValue::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_._cached_size_), - false, - }, - &DoubleValue::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* DoubleValue::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_._cached_size_), + false, + }, + &DoubleValue::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + DoubleValue_class_data_ = + DoubleValue::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL DoubleValue::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&DoubleValue_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(DoubleValue_class_data_.tc_table); + return DoubleValue_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> DoubleValue::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +DoubleValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -491,7 +518,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> DoubleValue::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + DoubleValue_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -500,19 +527,18 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> DoubleValue::_table_ = { }, {{ // double value = 1; {::_pbi::TcParser::FastF64S1, - {9, 63, 0, PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_)}}, + {9, 0, 0, PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // double value = 1; - {PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kDouble)}, + {PROTOBUF_FIELD_OFFSET(DoubleValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kDouble)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void DoubleValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DoubleValue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -521,63 +547,69 @@ PROTOBUF_NOINLINE void DoubleValue::Clear() { (void) cached_has_bits; _impl_.value_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* DoubleValue::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const DoubleValue& this_ = static_cast<const DoubleValue&>(base); +::uint8_t* PROTOBUF_NONNULL DoubleValue::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const DoubleValue& this_ = static_cast<const DoubleValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* DoubleValue::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const DoubleValue& this_ = *this; +::uint8_t* PROTOBUF_NONNULL DoubleValue::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const DoubleValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DoubleValue) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DoubleValue) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // double value = 1; - if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 1, this_._internal_value(), target); - } + // double value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteDoubleToArray( + 1, this_._internal_value(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DoubleValue) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DoubleValue) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t DoubleValue::ByteSizeLong(const MessageLite& base) { - const DoubleValue& this_ = static_cast<const DoubleValue&>(base); +::size_t DoubleValue::ByteSizeLong(const MessageLite& base) { + const DoubleValue& this_ = static_cast<const DoubleValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t DoubleValue::ByteSizeLong() const { - const DoubleValue& this_ = *this; +::size_t DoubleValue::ByteSizeLong() const { + const DoubleValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DoubleValue) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DoubleValue) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // double value = 1; - if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { - total_size += 9; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // double value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint64_t>(this_._internal_value()) != 0) { + total_size += 9; + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void DoubleValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<DoubleValue*>(&to_msg); @@ -587,9 +619,13 @@ void DoubleValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (::absl::bit_cast<::uint64_t>(from._internal_value()) != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint64_t>(from._internal_value()) != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -601,10 +637,11 @@ void DoubleValue::CopyFrom(const DoubleValue& from) { } -void DoubleValue::InternalSwap(DoubleValue* PROTOBUF_RESTRICT other) { +void DoubleValue::InternalSwap(DoubleValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.value_, other->_impl_.value_); } ::google::protobuf::Metadata DoubleValue::GetMetadata() const { @@ -614,11 +651,15 @@ void DoubleValue::InternalSwap(DoubleValue* PROTOBUF_RESTRICT other) { class FloatValue::_Internal { public: + using HasBits = + decltype(std::declval<FloatValue>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(FloatValue, _impl_._has_bits_); }; -FloatValue::FloatValue(::google::protobuf::Arena* arena) +FloatValue::FloatValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, FloatValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -626,16 +667,22 @@ FloatValue::FloatValue(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.FloatValue) } FloatValue::FloatValue( - ::google::protobuf::Arena* arena, const FloatValue& from) - : FloatValue(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FloatValue& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, FloatValue_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE FloatValue::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE FloatValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void FloatValue::SharedCtor(::_pb::Arena* arena) { +inline void FloatValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -650,45 +697,53 @@ inline void FloatValue::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* FloatValue::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL FloatValue::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) FloatValue(arena); } constexpr auto FloatValue::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(FloatValue), alignof(FloatValue)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull FloatValue::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_FloatValue_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &FloatValue::MergeImpl, - ::google::protobuf::Message::GetNewImpl<FloatValue>(), +constexpr auto FloatValue::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_FloatValue_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &FloatValue::MergeImpl, + ::google::protobuf::Message::GetNewImpl<FloatValue>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &FloatValue::SharedDtor, - ::google::protobuf::Message::GetClearImpl<FloatValue>(), &FloatValue::ByteSizeLong, - &FloatValue::_InternalSerialize, + &FloatValue::SharedDtor, + ::google::protobuf::Message::GetClearImpl<FloatValue>(), &FloatValue::ByteSizeLong, + &FloatValue::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FloatValue, _impl_._cached_size_), - false, - }, - &FloatValue::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* FloatValue::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(FloatValue, _impl_._cached_size_), + false, + }, + &FloatValue::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + FloatValue_class_data_ = + FloatValue::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FloatValue::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&FloatValue_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(FloatValue_class_data_.tc_table); + return FloatValue_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> FloatValue::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +FloatValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(FloatValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -697,7 +752,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> FloatValue::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + FloatValue_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -706,19 +761,18 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> FloatValue::_table_ = { }, {{ // float value = 1; {::_pbi::TcParser::FastF32S1, - {13, 63, 0, PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_)}}, + {13, 0, 0, PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // float value = 1; - {PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, + {PROTOBUF_FIELD_OFFSET(FloatValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kFloat)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void FloatValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FloatValue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -727,63 +781,69 @@ PROTOBUF_NOINLINE void FloatValue::Clear() { (void) cached_has_bits; _impl_.value_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* FloatValue::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const FloatValue& this_ = static_cast<const FloatValue&>(base); +::uint8_t* PROTOBUF_NONNULL FloatValue::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const FloatValue& this_ = static_cast<const FloatValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* FloatValue::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const FloatValue& this_ = *this; +::uint8_t* PROTOBUF_NONNULL FloatValue::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const FloatValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FloatValue) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FloatValue) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // float value = 1; - if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 1, this_._internal_value(), target); - } + // float value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteFloatToArray( + 1, this_._internal_value(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FloatValue) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FloatValue) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t FloatValue::ByteSizeLong(const MessageLite& base) { - const FloatValue& this_ = static_cast<const FloatValue&>(base); +::size_t FloatValue::ByteSizeLong(const MessageLite& base) { + const FloatValue& this_ = static_cast<const FloatValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t FloatValue::ByteSizeLong() const { - const FloatValue& this_ = *this; +::size_t FloatValue::ByteSizeLong() const { + const FloatValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FloatValue) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FloatValue) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // float value = 1; - if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { - total_size += 5; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // float value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint32_t>(this_._internal_value()) != 0) { + total_size += 5; + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void FloatValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<FloatValue*>(&to_msg); @@ -793,9 +853,13 @@ void FloatValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (::absl::bit_cast<::uint32_t>(from._internal_value()) != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (::absl::bit_cast<::uint32_t>(from._internal_value()) != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -807,10 +871,11 @@ void FloatValue::CopyFrom(const FloatValue& from) { } -void FloatValue::InternalSwap(FloatValue* PROTOBUF_RESTRICT other) { +void FloatValue::InternalSwap(FloatValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.value_, other->_impl_.value_); } ::google::protobuf::Metadata FloatValue::GetMetadata() const { @@ -820,11 +885,15 @@ void FloatValue::InternalSwap(FloatValue* PROTOBUF_RESTRICT other) { class Int64Value::_Internal { public: + using HasBits = + decltype(std::declval<Int64Value>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Int64Value, _impl_._has_bits_); }; -Int64Value::Int64Value(::google::protobuf::Arena* arena) +Int64Value::Int64Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Int64Value_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -832,16 +901,22 @@ Int64Value::Int64Value(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.Int64Value) } Int64Value::Int64Value( - ::google::protobuf::Arena* arena, const Int64Value& from) - : Int64Value(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Int64Value& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, Int64Value_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE Int64Value::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Int64Value::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void Int64Value::SharedCtor(::_pb::Arena* arena) { +inline void Int64Value::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -856,45 +931,53 @@ inline void Int64Value::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Int64Value::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Int64Value::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Int64Value(arena); } constexpr auto Int64Value::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(Int64Value), alignof(Int64Value)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Int64Value::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Int64Value_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Int64Value::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Int64Value>(), +constexpr auto Int64Value::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Int64Value_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Int64Value::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Int64Value>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Int64Value::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Int64Value>(), &Int64Value::ByteSizeLong, - &Int64Value::_InternalSerialize, + &Int64Value::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Int64Value>(), &Int64Value::ByteSizeLong, + &Int64Value::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Int64Value, _impl_._cached_size_), - false, - }, - &Int64Value::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Int64Value::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Int64Value, _impl_._cached_size_), + false, + }, + &Int64Value::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Int64Value_class_data_ = + Int64Value::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Int64Value::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Int64Value_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Int64Value_class_data_.tc_table); + return Int64Value_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int64Value::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +Int64Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Int64Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -903,7 +986,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int64Value::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Int64Value_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -911,20 +994,19 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int64Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int64 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Int64Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Int64Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // int64 value = 1; - {PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt64)}, + {PROTOBUF_FIELD_OFFSET(Int64Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void Int64Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Int64Value) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -933,64 +1015,70 @@ PROTOBUF_NOINLINE void Int64Value::Clear() { (void) cached_has_bits; _impl_.value_ = ::int64_t{0}; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Int64Value::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Int64Value& this_ = static_cast<const Int64Value&>(base); +::uint8_t* PROTOBUF_NONNULL Int64Value::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Int64Value& this_ = static_cast<const Int64Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Int64Value::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Int64Value& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Int64Value::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Int64Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int64Value) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int64Value) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // int64 value = 1; - if (this_._internal_value() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt64ToArrayWithField<1>( - stream, this_._internal_value(), target); - } + // int64 value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<1>( + stream, this_._internal_value(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int64Value) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int64Value) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Int64Value::ByteSizeLong(const MessageLite& base) { - const Int64Value& this_ = static_cast<const Int64Value&>(base); +::size_t Int64Value::ByteSizeLong(const MessageLite& base) { + const Int64Value& this_ = static_cast<const Int64Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Int64Value::ByteSizeLong() const { - const Int64Value& this_ = *this; +::size_t Int64Value::ByteSizeLong() const { + const Int64Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int64Value) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int64Value) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // int64 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_value()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // int64 value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( + this_._internal_value()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Int64Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Int64Value*>(&to_msg); @@ -1000,9 +1088,13 @@ void Int64Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1014,10 +1106,11 @@ void Int64Value::CopyFrom(const Int64Value& from) { } -void Int64Value::InternalSwap(Int64Value* PROTOBUF_RESTRICT other) { +void Int64Value::InternalSwap(Int64Value* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.value_, other->_impl_.value_); } ::google::protobuf::Metadata Int64Value::GetMetadata() const { @@ -1027,11 +1120,15 @@ void Int64Value::InternalSwap(Int64Value* PROTOBUF_RESTRICT other) { class UInt64Value::_Internal { public: + using HasBits = + decltype(std::declval<UInt64Value>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_._has_bits_); }; -UInt64Value::UInt64Value(::google::protobuf::Arena* arena) +UInt64Value::UInt64Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, UInt64Value_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1039,16 +1136,22 @@ UInt64Value::UInt64Value(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.UInt64Value) } UInt64Value::UInt64Value( - ::google::protobuf::Arena* arena, const UInt64Value& from) - : UInt64Value(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UInt64Value& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, UInt64Value_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE UInt64Value::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE UInt64Value::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void UInt64Value::SharedCtor(::_pb::Arena* arena) { +inline void UInt64Value::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -1063,45 +1166,53 @@ inline void UInt64Value::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* UInt64Value::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL UInt64Value::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) UInt64Value(arena); } constexpr auto UInt64Value::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(UInt64Value), alignof(UInt64Value)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull UInt64Value::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_UInt64Value_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &UInt64Value::MergeImpl, - ::google::protobuf::Message::GetNewImpl<UInt64Value>(), +constexpr auto UInt64Value::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_UInt64Value_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &UInt64Value::MergeImpl, + ::google::protobuf::Message::GetNewImpl<UInt64Value>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &UInt64Value::SharedDtor, - ::google::protobuf::Message::GetClearImpl<UInt64Value>(), &UInt64Value::ByteSizeLong, - &UInt64Value::_InternalSerialize, + &UInt64Value::SharedDtor, + ::google::protobuf::Message::GetClearImpl<UInt64Value>(), &UInt64Value::ByteSizeLong, + &UInt64Value::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_._cached_size_), - false, - }, - &UInt64Value::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* UInt64Value::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_._cached_size_), + false, + }, + &UInt64Value::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + UInt64Value_class_data_ = + UInt64Value::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL UInt64Value::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&UInt64Value_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(UInt64Value_class_data_.tc_table); + return UInt64Value_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt64Value::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +UInt64Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1110,7 +1221,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt64Value::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + UInt64Value_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1118,20 +1229,19 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt64Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // uint64 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UInt64Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UInt64Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // uint64 value = 1; - {PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUInt64)}, + {PROTOBUF_FIELD_OFFSET(UInt64Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void UInt64Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UInt64Value) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1140,64 +1250,70 @@ PROTOBUF_NOINLINE void UInt64Value::Clear() { (void) cached_has_bits; _impl_.value_ = ::uint64_t{0u}; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* UInt64Value::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const UInt64Value& this_ = static_cast<const UInt64Value&>(base); +::uint8_t* PROTOBUF_NONNULL UInt64Value::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const UInt64Value& this_ = static_cast<const UInt64Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* UInt64Value::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const UInt64Value& this_ = *this; +::uint8_t* PROTOBUF_NONNULL UInt64Value::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const UInt64Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt64Value) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt64Value) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // uint64 value = 1; - if (this_._internal_value() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 1, this_._internal_value(), target); - } + // uint64 value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt64ToArray( + 1, this_._internal_value(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt64Value) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt64Value) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t UInt64Value::ByteSizeLong(const MessageLite& base) { - const UInt64Value& this_ = static_cast<const UInt64Value&>(base); +::size_t UInt64Value::ByteSizeLong(const MessageLite& base) { + const UInt64Value& this_ = static_cast<const UInt64Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t UInt64Value::ByteSizeLong() const { - const UInt64Value& this_ = *this; +::size_t UInt64Value::ByteSizeLong() const { + const UInt64Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt64Value) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt64Value) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // uint64 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_value()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // uint64 value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( + this_._internal_value()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void UInt64Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<UInt64Value*>(&to_msg); @@ -1207,9 +1323,13 @@ void UInt64Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1221,10 +1341,11 @@ void UInt64Value::CopyFrom(const UInt64Value& from) { } -void UInt64Value::InternalSwap(UInt64Value* PROTOBUF_RESTRICT other) { +void UInt64Value::InternalSwap(UInt64Value* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.value_, other->_impl_.value_); } ::google::protobuf::Metadata UInt64Value::GetMetadata() const { @@ -1234,11 +1355,15 @@ void UInt64Value::InternalSwap(UInt64Value* PROTOBUF_RESTRICT other) { class Int32Value::_Internal { public: + using HasBits = + decltype(std::declval<Int32Value>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(Int32Value, _impl_._has_bits_); }; -Int32Value::Int32Value(::google::protobuf::Arena* arena) +Int32Value::Int32Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, Int32Value_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1246,16 +1371,22 @@ Int32Value::Int32Value(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.Int32Value) } Int32Value::Int32Value( - ::google::protobuf::Arena* arena, const Int32Value& from) - : Int32Value(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Int32Value& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, Int32Value_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE Int32Value::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE Int32Value::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void Int32Value::SharedCtor(::_pb::Arena* arena) { +inline void Int32Value::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -1270,45 +1401,53 @@ inline void Int32Value::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* Int32Value::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL Int32Value::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) Int32Value(arena); } constexpr auto Int32Value::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(Int32Value), alignof(Int32Value)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull Int32Value::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_Int32Value_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Int32Value::MergeImpl, - ::google::protobuf::Message::GetNewImpl<Int32Value>(), +constexpr auto Int32Value::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_Int32Value_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &Int32Value::MergeImpl, + ::google::protobuf::Message::GetNewImpl<Int32Value>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &Int32Value::SharedDtor, - ::google::protobuf::Message::GetClearImpl<Int32Value>(), &Int32Value::ByteSizeLong, - &Int32Value::_InternalSerialize, + &Int32Value::SharedDtor, + ::google::protobuf::Message::GetClearImpl<Int32Value>(), &Int32Value::ByteSizeLong, + &Int32Value::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Int32Value, _impl_._cached_size_), - false, - }, - &Int32Value::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* Int32Value::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(Int32Value, _impl_._cached_size_), + false, + }, + &Int32Value::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + Int32Value_class_data_ = + Int32Value::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL Int32Value::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&Int32Value_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(Int32Value_class_data_.tc_table); + return Int32Value_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int32Value::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +Int32Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(Int32Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1317,7 +1456,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int32Value::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + Int32Value_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1325,20 +1464,19 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> Int32Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // int32 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Int32Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Int32Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // int32 value = 1; - {PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + {PROTOBUF_FIELD_OFFSET(Int32Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void Int32Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Int32Value) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1347,64 +1485,70 @@ PROTOBUF_NOINLINE void Int32Value::Clear() { (void) cached_has_bits; _impl_.value_ = 0; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* Int32Value::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const Int32Value& this_ = static_cast<const Int32Value&>(base); +::uint8_t* PROTOBUF_NONNULL Int32Value::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const Int32Value& this_ = static_cast<const Int32Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* Int32Value::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const Int32Value& this_ = *this; +::uint8_t* PROTOBUF_NONNULL Int32Value::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const Int32Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int32Value) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int32Value) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // int32 value = 1; - if (this_._internal_value() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this_._internal_value(), target); - } + // int32 value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( + stream, this_._internal_value(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int32Value) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int32Value) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t Int32Value::ByteSizeLong(const MessageLite& base) { - const Int32Value& this_ = static_cast<const Int32Value&>(base); +::size_t Int32Value::ByteSizeLong(const MessageLite& base) { + const Int32Value& this_ = static_cast<const Int32Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t Int32Value::ByteSizeLong() const { - const Int32Value& this_ = *this; +::size_t Int32Value::ByteSizeLong() const { + const Int32Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int32Value) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int32Value) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // int32 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_value()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // int32 value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this_._internal_value()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void Int32Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<Int32Value*>(&to_msg); @@ -1414,9 +1558,13 @@ void Int32Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1428,10 +1576,11 @@ void Int32Value::CopyFrom(const Int32Value& from) { } -void Int32Value::InternalSwap(Int32Value* PROTOBUF_RESTRICT other) { +void Int32Value::InternalSwap(Int32Value* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.value_, other->_impl_.value_); } ::google::protobuf::Metadata Int32Value::GetMetadata() const { @@ -1441,11 +1590,15 @@ void Int32Value::InternalSwap(Int32Value* PROTOBUF_RESTRICT other) { class UInt32Value::_Internal { public: + using HasBits = + decltype(std::declval<UInt32Value>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_._has_bits_); }; -UInt32Value::UInt32Value(::google::protobuf::Arena* arena) +UInt32Value::UInt32Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, UInt32Value_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1453,16 +1606,22 @@ UInt32Value::UInt32Value(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.UInt32Value) } UInt32Value::UInt32Value( - ::google::protobuf::Arena* arena, const UInt32Value& from) - : UInt32Value(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UInt32Value& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, UInt32Value_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE UInt32Value::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE UInt32Value::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void UInt32Value::SharedCtor(::_pb::Arena* arena) { +inline void UInt32Value::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -1477,45 +1636,53 @@ inline void UInt32Value::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* UInt32Value::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL UInt32Value::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) UInt32Value(arena); } constexpr auto UInt32Value::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(UInt32Value), alignof(UInt32Value)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull UInt32Value::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_UInt32Value_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &UInt32Value::MergeImpl, - ::google::protobuf::Message::GetNewImpl<UInt32Value>(), +constexpr auto UInt32Value::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_UInt32Value_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &UInt32Value::MergeImpl, + ::google::protobuf::Message::GetNewImpl<UInt32Value>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &UInt32Value::SharedDtor, - ::google::protobuf::Message::GetClearImpl<UInt32Value>(), &UInt32Value::ByteSizeLong, - &UInt32Value::_InternalSerialize, + &UInt32Value::SharedDtor, + ::google::protobuf::Message::GetClearImpl<UInt32Value>(), &UInt32Value::ByteSizeLong, + &UInt32Value::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_._cached_size_), - false, - }, - &UInt32Value::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* UInt32Value::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_._cached_size_), + false, + }, + &UInt32Value::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + UInt32Value_class_data_ = + UInt32Value::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL UInt32Value::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&UInt32Value_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(UInt32Value_class_data_.tc_table); + return UInt32Value_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt32Value::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +UInt32Value::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1524,7 +1691,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt32Value::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + UInt32Value_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1532,20 +1699,19 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> UInt32Value::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // uint32 value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(UInt32Value, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(UInt32Value, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // uint32 value = 1; - {PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUInt32)}, + {PROTOBUF_FIELD_OFFSET(UInt32Value, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUInt32)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void UInt32Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UInt32Value) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1554,64 +1720,70 @@ PROTOBUF_NOINLINE void UInt32Value::Clear() { (void) cached_has_bits; _impl_.value_ = 0u; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* UInt32Value::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const UInt32Value& this_ = static_cast<const UInt32Value&>(base); +::uint8_t* PROTOBUF_NONNULL UInt32Value::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const UInt32Value& this_ = static_cast<const UInt32Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* UInt32Value::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const UInt32Value& this_ = *this; +::uint8_t* PROTOBUF_NONNULL UInt32Value::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const UInt32Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt32Value) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt32Value) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // uint32 value = 1; - if (this_._internal_value() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 1, this_._internal_value(), target); - } + // uint32 value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray( + 1, this_._internal_value(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt32Value) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt32Value) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t UInt32Value::ByteSizeLong(const MessageLite& base) { - const UInt32Value& this_ = static_cast<const UInt32Value&>(base); +::size_t UInt32Value::ByteSizeLong(const MessageLite& base) { + const UInt32Value& this_ = static_cast<const UInt32Value&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t UInt32Value::ByteSizeLong() const { - const UInt32Value& this_ = *this; +::size_t UInt32Value::ByteSizeLong() const { + const UInt32Value& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt32Value) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt32Value) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // uint32 value = 1; - if (this_._internal_value() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( - this_._internal_value()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // uint32 value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( + this_._internal_value()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void UInt32Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<UInt32Value*>(&to_msg); @@ -1621,9 +1793,13 @@ void UInt32Value::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1635,10 +1811,11 @@ void UInt32Value::CopyFrom(const UInt32Value& from) { } -void UInt32Value::InternalSwap(UInt32Value* PROTOBUF_RESTRICT other) { +void UInt32Value::InternalSwap(UInt32Value* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.value_, other->_impl_.value_); } ::google::protobuf::Metadata UInt32Value::GetMetadata() const { @@ -1648,11 +1825,15 @@ void UInt32Value::InternalSwap(UInt32Value* PROTOBUF_RESTRICT other) { class BoolValue::_Internal { public: + using HasBits = + decltype(std::declval<BoolValue>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(BoolValue, _impl_._has_bits_); }; -BoolValue::BoolValue(::google::protobuf::Arena* arena) +BoolValue::BoolValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, BoolValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1660,16 +1841,22 @@ BoolValue::BoolValue(::google::protobuf::Arena* arena) // @@protoc_insertion_point(arena_constructor:google.protobuf.BoolValue) } BoolValue::BoolValue( - ::google::protobuf::Arena* arena, const BoolValue& from) - : BoolValue(arena) { - MergeFrom(from); + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const BoolValue& from) +#if defined(PROTOBUF_CUSTOM_VTABLE) + : ::google::protobuf::Message(arena, BoolValue_class_data_.base()), +#else // PROTOBUF_CUSTOM_VTABLE + : ::google::protobuf::Message(arena), +#endif // PROTOBUF_CUSTOM_VTABLE + _impl_(from._impl_) { + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); } -inline PROTOBUF_NDEBUG_INLINE BoolValue::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE BoolValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) : _cached_size_{0} {} -inline void BoolValue::SharedCtor(::_pb::Arena* arena) { +inline void BoolValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); _impl_.value_ = {}; } @@ -1684,45 +1871,53 @@ inline void BoolValue::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* BoolValue::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL BoolValue::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) BoolValue(arena); } constexpr auto BoolValue::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(BoolValue), alignof(BoolValue)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull BoolValue::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_BoolValue_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &BoolValue::MergeImpl, - ::google::protobuf::Message::GetNewImpl<BoolValue>(), +constexpr auto BoolValue::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_BoolValue_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &BoolValue::MergeImpl, + ::google::protobuf::Message::GetNewImpl<BoolValue>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &BoolValue::SharedDtor, - ::google::protobuf::Message::GetClearImpl<BoolValue>(), &BoolValue::ByteSizeLong, - &BoolValue::_InternalSerialize, + &BoolValue::SharedDtor, + ::google::protobuf::Message::GetClearImpl<BoolValue>(), &BoolValue::ByteSizeLong, + &BoolValue::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(BoolValue, _impl_._cached_size_), - false, - }, - &BoolValue::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* BoolValue::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(BoolValue, _impl_._cached_size_), + false, + }, + &BoolValue::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + BoolValue_class_data_ = + BoolValue::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL BoolValue::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&BoolValue_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(BoolValue_class_data_.tc_table); + return BoolValue_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BoolValue::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +BoolValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(BoolValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1731,7 +1926,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BoolValue::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + BoolValue_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1739,20 +1934,19 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BoolValue::_table_ = { #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // bool value = 1; - {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(BoolValue, _impl_.value_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_)}}, + {::_pbi::TcParser::SingularVarintNoZag1<bool, offsetof(BoolValue, _impl_.value_), 0>(), + {8, 0, 0, PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // bool value = 1; - {PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + {PROTOBUF_FIELD_OFFSET(BoolValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBool)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void BoolValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.BoolValue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1761,63 +1955,69 @@ PROTOBUF_NOINLINE void BoolValue::Clear() { (void) cached_has_bits; _impl_.value_ = false; + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* BoolValue::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const BoolValue& this_ = static_cast<const BoolValue&>(base); +::uint8_t* PROTOBUF_NONNULL BoolValue::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const BoolValue& this_ = static_cast<const BoolValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* BoolValue::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const BoolValue& this_ = *this; +::uint8_t* PROTOBUF_NONNULL BoolValue::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const BoolValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BoolValue) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BoolValue) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // bool value = 1; - if (this_._internal_value() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_value(), target); - } + // bool value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 1, this_._internal_value(), target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BoolValue) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BoolValue) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t BoolValue::ByteSizeLong(const MessageLite& base) { - const BoolValue& this_ = static_cast<const BoolValue&>(base); +::size_t BoolValue::ByteSizeLong(const MessageLite& base) { + const BoolValue& this_ = static_cast<const BoolValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t BoolValue::ByteSizeLong() const { - const BoolValue& this_ = *this; +::size_t BoolValue::ByteSizeLong() const { + const BoolValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BoolValue) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BoolValue) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // bool value = 1; - if (this_._internal_value() != 0) { - total_size += 2; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // bool value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (this_._internal_value() != 0) { + total_size += 2; + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void BoolValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<BoolValue*>(&to_msg); @@ -1827,9 +2027,13 @@ void BoolValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::googl ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_value() != 0) { - _this->_impl_.value_ = from._impl_.value_; + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (from._internal_value() != 0) { + _this->_impl_.value_ = from._impl_.value_; + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -1841,10 +2045,11 @@ void BoolValue::CopyFrom(const BoolValue& from) { } -void BoolValue::InternalSwap(BoolValue* PROTOBUF_RESTRICT other) { +void BoolValue::InternalSwap(BoolValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + swap(_impl_.value_, other->_impl_.value_); } ::google::protobuf::Metadata BoolValue::GetMetadata() const { @@ -1854,28 +2059,34 @@ void BoolValue::InternalSwap(BoolValue* PROTOBUF_RESTRICT other) { class StringValue::_Internal { public: + using HasBits = + decltype(std::declval<StringValue>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(StringValue, _impl_._has_bits_); }; -StringValue::StringValue(::google::protobuf::Arena* arena) +StringValue::StringValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, StringValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.StringValue) } -inline PROTOBUF_NDEBUG_INLINE StringValue::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::StringValue& from_msg) - : value_(arena, from.value_), - _cached_size_{0} {} +PROTOBUF_NDEBUG_INLINE StringValue::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::StringValue& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + value_(arena, from.value_) {} StringValue::StringValue( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const StringValue& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, StringValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -1887,13 +2098,13 @@ StringValue::StringValue( // @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue) } -inline PROTOBUF_NDEBUG_INLINE StringValue::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE StringValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : value_(arena), - _cached_size_{0} {} + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + value_(arena) {} -inline void StringValue::SharedCtor(::_pb::Arena* arena) { +inline void StringValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } StringValue::~StringValue() { @@ -1908,45 +2119,53 @@ inline void StringValue::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* StringValue::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL StringValue::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) StringValue(arena); } constexpr auto StringValue::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(StringValue), alignof(StringValue)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull StringValue::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_StringValue_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &StringValue::MergeImpl, - ::google::protobuf::Message::GetNewImpl<StringValue>(), +constexpr auto StringValue::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_StringValue_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &StringValue::MergeImpl, + ::google::protobuf::Message::GetNewImpl<StringValue>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &StringValue::SharedDtor, - ::google::protobuf::Message::GetClearImpl<StringValue>(), &StringValue::ByteSizeLong, - &StringValue::_InternalSerialize, + &StringValue::SharedDtor, + ::google::protobuf::Message::GetClearImpl<StringValue>(), &StringValue::ByteSizeLong, + &StringValue::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(StringValue, _impl_._cached_size_), - false, - }, - &StringValue::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* StringValue::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(StringValue, _impl_._cached_size_), + false, + }, + &StringValue::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + StringValue_class_data_ = + StringValue::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL StringValue::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&StringValue_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(StringValue_class_data_.tc_table); + return StringValue_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 41, 2> StringValue::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 41, 2> +StringValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(StringValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -1955,7 +2174,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 41, 2> StringValue::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + StringValue_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -1964,13 +2183,13 @@ const ::_pbi::TcParseTable<0, 1, 0, 41, 2> StringValue::_table_ = { }, {{ // string value = 1; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // string value = 1; - {PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(StringValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ @@ -1979,7 +2198,6 @@ const ::_pbi::TcParseTable<0, 1, 0, 41, 2> StringValue::_table_ = { "value" }}, }; - PROTOBUF_NOINLINE void StringValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.StringValue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -1987,66 +2205,75 @@ PROTOBUF_NOINLINE void StringValue::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.value_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.value_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* StringValue::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const StringValue& this_ = static_cast<const StringValue&>(base); +::uint8_t* PROTOBUF_NONNULL StringValue::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const StringValue& this_ = static_cast<const StringValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* StringValue::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const StringValue& this_ = *this; +::uint8_t* PROTOBUF_NONNULL StringValue::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const StringValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.StringValue) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.StringValue) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // string value = 1; - if (!this_._internal_value().empty()) { - const std::string& _s = this_._internal_value(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } + // string value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_value().empty()) { + const std::string& _s = this_._internal_value(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast<int>(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "google.protobuf.StringValue.value"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.StringValue) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.StringValue) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t StringValue::ByteSizeLong(const MessageLite& base) { - const StringValue& this_ = static_cast<const StringValue&>(base); +::size_t StringValue::ByteSizeLong(const MessageLite& base) { + const StringValue& this_ = static_cast<const StringValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t StringValue::ByteSizeLong() const { - const StringValue& this_ = *this; +::size_t StringValue::ByteSizeLong() const { + const StringValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.StringValue) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.StringValue) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // string value = 1; - if (!this_._internal_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_value()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // string value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this_._internal_value()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void StringValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<StringValue*>(&to_msg); @@ -2056,9 +2283,17 @@ void StringValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goo ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_value().empty()) { - _this->_internal_set_value(from._internal_value()); + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_value().empty()) { + _this->_internal_set_value(from._internal_value()); + } else { + if (_this->_impl_.value_.IsDefault()) { + _this->_internal_set_value(""); + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -2070,11 +2305,12 @@ void StringValue::CopyFrom(const StringValue& from) { } -void StringValue::InternalSwap(StringValue* PROTOBUF_RESTRICT other) { +void StringValue::InternalSwap(StringValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.value_, &other->_impl_.value_, arena); } @@ -2085,28 +2321,34 @@ void StringValue::InternalSwap(StringValue* PROTOBUF_RESTRICT other) { class BytesValue::_Internal { public: + using HasBits = + decltype(std::declval<BytesValue>()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(BytesValue, _impl_._has_bits_); }; -BytesValue::BytesValue(::google::protobuf::Arena* arena) +BytesValue::BytesValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, BytesValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE SharedCtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.BytesValue) } -inline PROTOBUF_NDEBUG_INLINE BytesValue::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::google::protobuf::BytesValue& from_msg) - : value_(arena, from.value_), - _cached_size_{0} {} +PROTOBUF_NDEBUG_INLINE BytesValue::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const ::google::protobuf::BytesValue& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + value_(arena, from.value_) {} BytesValue::BytesValue( - ::google::protobuf::Arena* arena, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const BytesValue& from) #if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, _class_data_.base()) { + : ::google::protobuf::Message(arena, BytesValue_class_data_.base()) { #else // PROTOBUF_CUSTOM_VTABLE : ::google::protobuf::Message(arena) { #endif // PROTOBUF_CUSTOM_VTABLE @@ -2118,13 +2360,13 @@ BytesValue::BytesValue( // @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue) } -inline PROTOBUF_NDEBUG_INLINE BytesValue::Impl_::Impl_( +PROTOBUF_NDEBUG_INLINE BytesValue::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena) - : value_(arena), - _cached_size_{0} {} + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) + : _cached_size_{0}, + value_(arena) {} -inline void BytesValue::SharedCtor(::_pb::Arena* arena) { +inline void BytesValue::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); } BytesValue::~BytesValue() { @@ -2139,45 +2381,53 @@ inline void BytesValue::SharedDtor(MessageLite& self) { this_._impl_.~Impl_(); } -inline void* BytesValue::PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena) { +inline void* PROTOBUF_NONNULL BytesValue::PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { return ::new (mem) BytesValue(arena); } constexpr auto BytesValue::InternalNewImpl_() { return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(BytesValue), alignof(BytesValue)); } -PROTOBUF_CONSTINIT -PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::google::protobuf::internal::ClassDataFull BytesValue::_class_data_ = { - ::google::protobuf::internal::ClassData{ - &_BytesValue_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &BytesValue::MergeImpl, - ::google::protobuf::Message::GetNewImpl<BytesValue>(), +constexpr auto BytesValue::InternalGenerateClassData_() { + return ::google::protobuf::internal::ClassDataFull{ + ::google::protobuf::internal::ClassData{ + &_BytesValue_default_instance_._instance, + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + &BytesValue::MergeImpl, + ::google::protobuf::Message::GetNewImpl<BytesValue>(), #if defined(PROTOBUF_CUSTOM_VTABLE) - &BytesValue::SharedDtor, - ::google::protobuf::Message::GetClearImpl<BytesValue>(), &BytesValue::ByteSizeLong, - &BytesValue::_InternalSerialize, + &BytesValue::SharedDtor, + ::google::protobuf::Message::GetClearImpl<BytesValue>(), &BytesValue::ByteSizeLong, + &BytesValue::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(BytesValue, _impl_._cached_size_), - false, - }, - &BytesValue::kDescriptorMethods, - &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, - nullptr, // tracker -}; -const ::google::protobuf::internal::ClassData* BytesValue::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(_class_data_.tc_table); - return _class_data_.base(); + PROTOBUF_FIELD_OFFSET(BytesValue, _impl_._cached_size_), + false, + }, + &BytesValue::kDescriptorMethods, + &descriptor_table_google_2fprotobuf_2fwrappers_2eproto, + nullptr, // tracker + }; +} + +PROTOBUF_CONSTINIT PROTOBUF_EXPORT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::internal::ClassDataFull + BytesValue_class_data_ = + BytesValue::InternalGenerateClassData_(); + +const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL BytesValue::GetClassData() const { + ::google::protobuf::internal::PrefetchToLocalCache(&BytesValue_class_data_); + ::google::protobuf::internal::PrefetchToLocalCache(BytesValue_class_data_.tc_table); + return BytesValue_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BytesValue::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> +BytesValue::_table_ = { { - 0, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(BytesValue, _impl_._has_bits_), 0, // no _extensions_ 1, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), @@ -2186,7 +2436,7 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BytesValue::_table_ = { 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - _class_data_.base(), + BytesValue_class_data_.base(), nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE @@ -2195,19 +2445,18 @@ const ::_pbi::TcParseTable<0, 1, 0, 0, 2> BytesValue::_table_ = { }, {{ // bytes value = 1; {::_pbi::TcParser::FastBS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_)}}, + {10, 0, 0, PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_)}}, }}, {{ 65535, 65535 }}, {{ // bytes value = 1; - {PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBytes | ::_fl::kRepAString)}, + {PROTOBUF_FIELD_OFFSET(BytesValue, _impl_.value_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, }}, // no aux_entries {{ }}, }; - PROTOBUF_NOINLINE void BytesValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.BytesValue) ::google::protobuf::internal::TSanWrite(&_impl_); @@ -2215,64 +2464,73 @@ PROTOBUF_NOINLINE void BytesValue::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.value_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + _impl_.value_.ClearNonDefaultToEmpty(); + } + _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } #if defined(PROTOBUF_CUSTOM_VTABLE) - ::uint8_t* BytesValue::_InternalSerialize( - const MessageLite& base, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) { - const BytesValue& this_ = static_cast<const BytesValue&>(base); +::uint8_t* PROTOBUF_NONNULL BytesValue::_InternalSerialize( + const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { + const BytesValue& this_ = static_cast<const BytesValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::uint8_t* BytesValue::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - const BytesValue& this_ = *this; +::uint8_t* PROTOBUF_NONNULL BytesValue::_InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { + const BytesValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BytesValue) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BytesValue) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // bytes value = 1; - if (!this_._internal_value().empty()) { - const std::string& _s = this_._internal_value(); - target = stream->WriteBytesMaybeAliased(1, _s, target); - } + // bytes value = 1; + if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!this_._internal_value().empty()) { + const std::string& _s = this_._internal_value(); + target = stream->WriteBytesMaybeAliased(1, _s, target); + } + } - if (PROTOBUF_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BytesValue) - return target; - } + if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BytesValue) + return target; +} #if defined(PROTOBUF_CUSTOM_VTABLE) - ::size_t BytesValue::ByteSizeLong(const MessageLite& base) { - const BytesValue& this_ = static_cast<const BytesValue&>(base); +::size_t BytesValue::ByteSizeLong(const MessageLite& base) { + const BytesValue& this_ = static_cast<const BytesValue&>(base); #else // PROTOBUF_CUSTOM_VTABLE - ::size_t BytesValue::ByteSizeLong() const { - const BytesValue& this_ = *this; +::size_t BytesValue::ByteSizeLong() const { + const BytesValue& this_ = *this; #endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BytesValue) - ::size_t total_size = 0; + // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BytesValue) + ::size_t total_size = 0; - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; - { - // bytes value = 1; - if (!this_._internal_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_value()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); - } + { + // bytes value = 1; + cached_has_bits = this_._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!this_._internal_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this_._internal_value()); + } + } + } + return this_.MaybeComputeUnknownFieldsSize(total_size, + &this_._impl_._cached_size_); +} void BytesValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast<BytesValue*>(&to_msg); @@ -2282,9 +2540,17 @@ void BytesValue::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_value().empty()) { - _this->_internal_set_value(from._internal_value()); + cached_has_bits = from._impl_._has_bits_[0]; + if ((cached_has_bits & 0x00000001u) != 0) { + if (!from._internal_value().empty()) { + _this->_internal_set_value(from._internal_value()); + } else { + if (_this->_impl_.value_.IsDefault()) { + _this->_internal_set_value(""); + } + } } + _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } @@ -2296,11 +2562,12 @@ void BytesValue::CopyFrom(const BytesValue& from) { } -void BytesValue::InternalSwap(BytesValue* PROTOBUF_RESTRICT other) { +void BytesValue::InternalSwap(BytesValue* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.value_, &other->_impl_.value_, arena); } @@ -2316,7 +2583,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fwrappers_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/third_party/protobuf/src/google/protobuf/wrappers.pb.h b/third_party/protobuf/src/google/protobuf/wrappers.pb.h index d66717918d78e..d7061d27c8c79 100644 --- a/third_party/protobuf/src/google/protobuf/wrappers.pb.h +++ b/third_party/protobuf/src/google/protobuf/wrappers.pb.h @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // NO CHECKED-IN PROTOBUF GENCODE // source: google/protobuf/wrappers.proto -// Protobuf C++ Version: 5.29.3 +// Protobuf C++ Version: 6.30.1 #ifndef google_2fprotobuf_2fwrappers_2eproto_2epb_2eh #define google_2fprotobuf_2fwrappers_2eproto_2epb_2eh @@ -12,7 +12,7 @@ #include <utility> #include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 5029003 +#if PROTOBUF_VERSION != 6030001 #error "Protobuf C++ gencode is built with an incompatible version of" #error "Protobuf C++ headers/runtime. See" #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" @@ -49,37 +49,47 @@ template <typename T> struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fwrappers_2eproto { static const ::uint32_t offsets[]; }; -PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable - descriptor_table_google_2fprotobuf_2fwrappers_2eproto; +extern "C" { +PROTOBUF_EXPORT extern const ::google::protobuf::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fwrappers_2eproto; +} // extern "C" namespace google { namespace protobuf { class BoolValue; struct BoolValueDefaultTypeInternal; PROTOBUF_EXPORT extern BoolValueDefaultTypeInternal _BoolValue_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull BoolValue_class_data_; class BytesValue; struct BytesValueDefaultTypeInternal; PROTOBUF_EXPORT extern BytesValueDefaultTypeInternal _BytesValue_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull BytesValue_class_data_; class DoubleValue; struct DoubleValueDefaultTypeInternal; PROTOBUF_EXPORT extern DoubleValueDefaultTypeInternal _DoubleValue_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DoubleValue_class_data_; class FloatValue; struct FloatValueDefaultTypeInternal; PROTOBUF_EXPORT extern FloatValueDefaultTypeInternal _FloatValue_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FloatValue_class_data_; class Int32Value; struct Int32ValueDefaultTypeInternal; PROTOBUF_EXPORT extern Int32ValueDefaultTypeInternal _Int32Value_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Int32Value_class_data_; class Int64Value; struct Int64ValueDefaultTypeInternal; PROTOBUF_EXPORT extern Int64ValueDefaultTypeInternal _Int64Value_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Int64Value_class_data_; class StringValue; struct StringValueDefaultTypeInternal; PROTOBUF_EXPORT extern StringValueDefaultTypeInternal _StringValue_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull StringValue_class_data_; class UInt32Value; struct UInt32ValueDefaultTypeInternal; PROTOBUF_EXPORT extern UInt32ValueDefaultTypeInternal _UInt32Value_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UInt32Value_class_data_; class UInt64Value; struct UInt64ValueDefaultTypeInternal; PROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_instance_; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UInt64Value_class_data_; } // namespace protobuf } // namespace google @@ -98,15 +108,14 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message ~UInt64Value() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(UInt64Value* msg, std::destroying_delete_t) { + void operator delete(UInt64Value* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(UInt64Value)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR UInt64Value( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR UInt64Value(::google::protobuf::internal::ConstantInitialized); inline UInt64Value(const UInt64Value& from) : UInt64Value(nullptr, from) {} inline UInt64Value(UInt64Value&& from) noexcept @@ -129,30 +138,27 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const UInt64Value& default_instance() { - return *internal_default_instance(); - } - static inline const UInt64Value* internal_default_instance() { - return reinterpret_cast<const UInt64Value*>( + return *reinterpret_cast<const UInt64Value*>( &_UInt64Value_default_instance_); } static constexpr int kIndexInFileMessages = 3; friend void swap(UInt64Value& a, UInt64Value& b) { a.Swap(&b); } - inline void Swap(UInt64Value* other) { + inline void Swap(UInt64Value* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -160,7 +166,7 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(UInt64Value* other) { + void UnsafeArenaSwap(UInt64Value* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -168,7 +174,7 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - UInt64Value* New(::google::protobuf::Arena* arena = nullptr) const { + UInt64Value* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<UInt64Value>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -177,9 +183,8 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message void MergeFrom(const UInt64Value& from) { UInt64Value::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -189,49 +194,51 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(UInt64Value* other); + void InternalSwap(UInt64Value* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.UInt64Value"; } protected: - explicit UInt64Value(::google::protobuf::Arena* arena); - UInt64Value(::google::protobuf::Arena* arena, const UInt64Value& from); - UInt64Value(::google::protobuf::Arena* arena, UInt64Value&& from) noexcept + explicit UInt64Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + UInt64Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UInt64Value& from); + UInt64Value( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, UInt64Value&& from) noexcept : UInt64Value(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -253,9 +260,9 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -265,20 +272,24 @@ class PROTOBUF_EXPORT UInt64Value final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const UInt64Value& from_msg); - ::uint64_t value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const UInt64Value& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::uint64_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UInt64Value_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message @@ -288,15 +299,14 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message ~UInt32Value() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(UInt32Value* msg, std::destroying_delete_t) { + void operator delete(UInt32Value* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(UInt32Value)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR UInt32Value( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR UInt32Value(::google::protobuf::internal::ConstantInitialized); inline UInt32Value(const UInt32Value& from) : UInt32Value(nullptr, from) {} inline UInt32Value(UInt32Value&& from) noexcept @@ -319,30 +329,27 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const UInt32Value& default_instance() { - return *internal_default_instance(); - } - static inline const UInt32Value* internal_default_instance() { - return reinterpret_cast<const UInt32Value*>( + return *reinterpret_cast<const UInt32Value*>( &_UInt32Value_default_instance_); } static constexpr int kIndexInFileMessages = 5; friend void swap(UInt32Value& a, UInt32Value& b) { a.Swap(&b); } - inline void Swap(UInt32Value* other) { + inline void Swap(UInt32Value* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -350,7 +357,7 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(UInt32Value* other) { + void UnsafeArenaSwap(UInt32Value* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -358,7 +365,7 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - UInt32Value* New(::google::protobuf::Arena* arena = nullptr) const { + UInt32Value* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<UInt32Value>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -367,9 +374,8 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message void MergeFrom(const UInt32Value& from) { UInt32Value::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -379,49 +385,51 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(UInt32Value* other); + void InternalSwap(UInt32Value* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.UInt32Value"; } protected: - explicit UInt32Value(::google::protobuf::Arena* arena); - UInt32Value(::google::protobuf::Arena* arena, const UInt32Value& from); - UInt32Value(::google::protobuf::Arena* arena, UInt32Value&& from) noexcept + explicit UInt32Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + UInt32Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UInt32Value& from); + UInt32Value( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, UInt32Value&& from) noexcept : UInt32Value(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -443,9 +451,9 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -455,20 +463,24 @@ class PROTOBUF_EXPORT UInt32Value final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const UInt32Value& from_msg); - ::uint32_t value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const UInt32Value& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::uint32_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull UInt32Value_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message @@ -478,15 +490,14 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message ~StringValue() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(StringValue* msg, std::destroying_delete_t) { + void operator delete(StringValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(StringValue)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR StringValue( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR StringValue(::google::protobuf::internal::ConstantInitialized); inline StringValue(const StringValue& from) : StringValue(nullptr, from) {} inline StringValue(StringValue&& from) noexcept @@ -509,30 +520,27 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const StringValue& default_instance() { - return *internal_default_instance(); - } - static inline const StringValue* internal_default_instance() { - return reinterpret_cast<const StringValue*>( + return *reinterpret_cast<const StringValue*>( &_StringValue_default_instance_); } static constexpr int kIndexInFileMessages = 7; friend void swap(StringValue& a, StringValue& b) { a.Swap(&b); } - inline void Swap(StringValue* other) { + inline void Swap(StringValue* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -540,7 +548,7 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(StringValue* other) { + void UnsafeArenaSwap(StringValue* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -548,7 +556,7 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - StringValue* New(::google::protobuf::Arena* arena = nullptr) const { + StringValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<StringValue>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -557,9 +565,8 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message void MergeFrom(const StringValue& from) { StringValue::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -569,49 +576,51 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(StringValue* other); + void InternalSwap(StringValue* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.StringValue"; } protected: - explicit StringValue(::google::protobuf::Arena* arena); - StringValue(::google::protobuf::Arena* arena, const StringValue& from); - StringValue(::google::protobuf::Arena* arena, StringValue&& from) noexcept + explicit StringValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + StringValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const StringValue& from); + StringValue( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, StringValue&& from) noexcept : StringValue(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -624,24 +633,23 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message const std::string& value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_value(Arg_&& arg, Args_... args); - std::string* mutable_value(); - PROTOBUF_NODISCARD std::string* release_value(); - void set_allocated_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_value(); + void set_allocated_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_value( - const std::string& value); - std::string* _internal_mutable_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_value(); public: // @@protoc_insertion_point(class_scope:google.protobuf.StringValue) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 41, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 41, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -651,20 +659,24 @@ class PROTOBUF_EXPORT StringValue final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const StringValue& from_msg); - ::google::protobuf::internal::ArenaStringPtr value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const StringValue& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull StringValue_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message @@ -674,15 +686,14 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message ~Int64Value() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Int64Value* msg, std::destroying_delete_t) { + void operator delete(Int64Value* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Int64Value)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Int64Value( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Int64Value(::google::protobuf::internal::ConstantInitialized); inline Int64Value(const Int64Value& from) : Int64Value(nullptr, from) {} inline Int64Value(Int64Value&& from) noexcept @@ -705,30 +716,27 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Int64Value& default_instance() { - return *internal_default_instance(); - } - static inline const Int64Value* internal_default_instance() { - return reinterpret_cast<const Int64Value*>( + return *reinterpret_cast<const Int64Value*>( &_Int64Value_default_instance_); } static constexpr int kIndexInFileMessages = 2; friend void swap(Int64Value& a, Int64Value& b) { a.Swap(&b); } - inline void Swap(Int64Value* other) { + inline void Swap(Int64Value* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -736,7 +744,7 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Int64Value* other) { + void UnsafeArenaSwap(Int64Value* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -744,7 +752,7 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Int64Value* New(::google::protobuf::Arena* arena = nullptr) const { + Int64Value* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Int64Value>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -753,9 +761,8 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message void MergeFrom(const Int64Value& from) { Int64Value::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -765,49 +772,51 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Int64Value* other); + void InternalSwap(Int64Value* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Int64Value"; } protected: - explicit Int64Value(::google::protobuf::Arena* arena); - Int64Value(::google::protobuf::Arena* arena, const Int64Value& from); - Int64Value(::google::protobuf::Arena* arena, Int64Value&& from) noexcept + explicit Int64Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Int64Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Int64Value& from); + Int64Value( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Int64Value&& from) noexcept : Int64Value(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -829,9 +838,9 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -841,20 +850,24 @@ class PROTOBUF_EXPORT Int64Value final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Int64Value& from_msg); - ::int64_t value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Int64Value& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::int64_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Int64Value_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message @@ -864,15 +877,14 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message ~Int32Value() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Int32Value* msg, std::destroying_delete_t) { + void operator delete(Int32Value* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(Int32Value)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR Int32Value( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR Int32Value(::google::protobuf::internal::ConstantInitialized); inline Int32Value(const Int32Value& from) : Int32Value(nullptr, from) {} inline Int32Value(Int32Value&& from) noexcept @@ -895,30 +907,27 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const Int32Value& default_instance() { - return *internal_default_instance(); - } - static inline const Int32Value* internal_default_instance() { - return reinterpret_cast<const Int32Value*>( + return *reinterpret_cast<const Int32Value*>( &_Int32Value_default_instance_); } static constexpr int kIndexInFileMessages = 4; friend void swap(Int32Value& a, Int32Value& b) { a.Swap(&b); } - inline void Swap(Int32Value* other) { + inline void Swap(Int32Value* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -926,7 +935,7 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(Int32Value* other) { + void UnsafeArenaSwap(Int32Value* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -934,7 +943,7 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Int32Value* New(::google::protobuf::Arena* arena = nullptr) const { + Int32Value* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<Int32Value>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -943,9 +952,8 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message void MergeFrom(const Int32Value& from) { Int32Value::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -955,49 +963,51 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(Int32Value* other); + void InternalSwap(Int32Value* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.Int32Value"; } protected: - explicit Int32Value(::google::protobuf::Arena* arena); - Int32Value(::google::protobuf::Arena* arena, const Int32Value& from); - Int32Value(::google::protobuf::Arena* arena, Int32Value&& from) noexcept + explicit Int32Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + Int32Value(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Int32Value& from); + Int32Value( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Int32Value&& from) noexcept : Int32Value(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1019,9 +1029,9 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1031,20 +1041,24 @@ class PROTOBUF_EXPORT Int32Value final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const Int32Value& from_msg); - ::int32_t value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const Int32Value& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::int32_t value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull Int32Value_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message @@ -1054,15 +1068,14 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message ~FloatValue() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FloatValue* msg, std::destroying_delete_t) { + void operator delete(FloatValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(FloatValue)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR FloatValue( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR FloatValue(::google::protobuf::internal::ConstantInitialized); inline FloatValue(const FloatValue& from) : FloatValue(nullptr, from) {} inline FloatValue(FloatValue&& from) noexcept @@ -1085,30 +1098,27 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const FloatValue& default_instance() { - return *internal_default_instance(); - } - static inline const FloatValue* internal_default_instance() { - return reinterpret_cast<const FloatValue*>( + return *reinterpret_cast<const FloatValue*>( &_FloatValue_default_instance_); } static constexpr int kIndexInFileMessages = 1; friend void swap(FloatValue& a, FloatValue& b) { a.Swap(&b); } - inline void Swap(FloatValue* other) { + inline void Swap(FloatValue* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1116,7 +1126,7 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(FloatValue* other) { + void UnsafeArenaSwap(FloatValue* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1124,7 +1134,7 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FloatValue* New(::google::protobuf::Arena* arena = nullptr) const { + FloatValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<FloatValue>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1133,9 +1143,8 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message void MergeFrom(const FloatValue& from) { FloatValue::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1145,49 +1154,51 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(FloatValue* other); + void InternalSwap(FloatValue* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.FloatValue"; } protected: - explicit FloatValue(::google::protobuf::Arena* arena); - FloatValue(::google::protobuf::Arena* arena, const FloatValue& from); - FloatValue(::google::protobuf::Arena* arena, FloatValue&& from) noexcept + explicit FloatValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + FloatValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FloatValue& from); + FloatValue( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FloatValue&& from) noexcept : FloatValue(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1209,9 +1220,9 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1221,20 +1232,24 @@ class PROTOBUF_EXPORT FloatValue final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const FloatValue& from_msg); - float value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const FloatValue& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + float value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull FloatValue_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message @@ -1244,15 +1259,14 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message ~DoubleValue() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(DoubleValue* msg, std::destroying_delete_t) { + void operator delete(DoubleValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(DoubleValue)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR DoubleValue( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR DoubleValue(::google::protobuf::internal::ConstantInitialized); inline DoubleValue(const DoubleValue& from) : DoubleValue(nullptr, from) {} inline DoubleValue(DoubleValue&& from) noexcept @@ -1275,30 +1289,27 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const DoubleValue& default_instance() { - return *internal_default_instance(); - } - static inline const DoubleValue* internal_default_instance() { - return reinterpret_cast<const DoubleValue*>( + return *reinterpret_cast<const DoubleValue*>( &_DoubleValue_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(DoubleValue& a, DoubleValue& b) { a.Swap(&b); } - inline void Swap(DoubleValue* other) { + inline void Swap(DoubleValue* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1306,7 +1317,7 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(DoubleValue* other) { + void UnsafeArenaSwap(DoubleValue* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1314,7 +1325,7 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - DoubleValue* New(::google::protobuf::Arena* arena = nullptr) const { + DoubleValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<DoubleValue>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1323,9 +1334,8 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message void MergeFrom(const DoubleValue& from) { DoubleValue::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1335,49 +1345,51 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(DoubleValue* other); + void InternalSwap(DoubleValue* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.DoubleValue"; } protected: - explicit DoubleValue(::google::protobuf::Arena* arena); - DoubleValue(::google::protobuf::Arena* arena, const DoubleValue& from); - DoubleValue(::google::protobuf::Arena* arena, DoubleValue&& from) noexcept + explicit DoubleValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + DoubleValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DoubleValue& from); + DoubleValue( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, DoubleValue&& from) noexcept : DoubleValue(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1399,9 +1411,9 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1411,20 +1423,24 @@ class PROTOBUF_EXPORT DoubleValue final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const DoubleValue& from_msg); - double value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const DoubleValue& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + double value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull DoubleValue_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message @@ -1434,15 +1450,14 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message ~BytesValue() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(BytesValue* msg, std::destroying_delete_t) { + void operator delete(BytesValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(BytesValue)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR BytesValue( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR BytesValue(::google::protobuf::internal::ConstantInitialized); inline BytesValue(const BytesValue& from) : BytesValue(nullptr, from) {} inline BytesValue(BytesValue&& from) noexcept @@ -1465,30 +1480,27 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const BytesValue& default_instance() { - return *internal_default_instance(); - } - static inline const BytesValue* internal_default_instance() { - return reinterpret_cast<const BytesValue*>( + return *reinterpret_cast<const BytesValue*>( &_BytesValue_default_instance_); } static constexpr int kIndexInFileMessages = 8; friend void swap(BytesValue& a, BytesValue& b) { a.Swap(&b); } - inline void Swap(BytesValue* other) { + inline void Swap(BytesValue* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1496,7 +1508,7 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(BytesValue* other) { + void UnsafeArenaSwap(BytesValue* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1504,7 +1516,7 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - BytesValue* New(::google::protobuf::Arena* arena = nullptr) const { + BytesValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<BytesValue>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1513,9 +1525,8 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message void MergeFrom(const BytesValue& from) { BytesValue::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1525,49 +1536,51 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(BytesValue* other); + void InternalSwap(BytesValue* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.BytesValue"; } protected: - explicit BytesValue(::google::protobuf::Arena* arena); - BytesValue(::google::protobuf::Arena* arena, const BytesValue& from); - BytesValue(::google::protobuf::Arena* arena, BytesValue&& from) noexcept + explicit BytesValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + BytesValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const BytesValue& from); + BytesValue( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, BytesValue&& from) noexcept : BytesValue(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1580,24 +1593,23 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message const std::string& value() const; template <typename Arg_ = const std::string&, typename... Args_> void set_value(Arg_&& arg, Args_... args); - std::string* mutable_value(); - PROTOBUF_NODISCARD std::string* release_value(); - void set_allocated_value(std::string* value); + std::string* PROTOBUF_NONNULL mutable_value(); + [[nodiscard]] std::string* PROTOBUF_NULLABLE release_value(); + void set_allocated_value(std::string* PROTOBUF_NULLABLE value); private: const std::string& _internal_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_value( - const std::string& value); - std::string* _internal_mutable_value(); + PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value); + std::string* PROTOBUF_NONNULL _internal_mutable_value(); public: // @@protoc_insertion_point(class_scope:google.protobuf.BytesValue) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1607,20 +1619,24 @@ class PROTOBUF_EXPORT BytesValue final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const BytesValue& from_msg); - ::google::protobuf::internal::ArenaStringPtr value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const BytesValue& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::internal::ArenaStringPtr value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; + +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull BytesValue_class_data_; // ------------------------------------------------------------------- class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message @@ -1630,15 +1646,14 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message ~BoolValue() PROTOBUF_FINAL; #if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(BoolValue* msg, std::destroying_delete_t) { + void operator delete(BoolValue* PROTOBUF_NONNULL msg, std::destroying_delete_t) { SharedDtor(*msg); ::google::protobuf::internal::SizedDelete(msg, sizeof(BoolValue)); } #endif template <typename = void> - explicit PROTOBUF_CONSTEXPR BoolValue( - ::google::protobuf::internal::ConstantInitialized); + explicit PROTOBUF_CONSTEXPR BoolValue(::google::protobuf::internal::ConstantInitialized); inline BoolValue(const BoolValue& from) : BoolValue(nullptr, from) {} inline BoolValue(BoolValue&& from) noexcept @@ -1661,30 +1676,27 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); } - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); } - static const ::google::protobuf::Descriptor* descriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { return GetDescriptor(); } - static const ::google::protobuf::Descriptor* GetDescriptor() { + static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { return default_instance().GetMetadata().descriptor; } - static const ::google::protobuf::Reflection* GetReflection() { + static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { return default_instance().GetMetadata().reflection; } static const BoolValue& default_instance() { - return *internal_default_instance(); - } - static inline const BoolValue* internal_default_instance() { - return reinterpret_cast<const BoolValue*>( + return *reinterpret_cast<const BoolValue*>( &_BoolValue_default_instance_); } static constexpr int kIndexInFileMessages = 6; friend void swap(BoolValue& a, BoolValue& b) { a.Swap(&b); } - inline void Swap(BoolValue* other) { + inline void Swap(BoolValue* PROTOBUF_NONNULL other) { if (other == this) return; if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { InternalSwap(other); @@ -1692,7 +1704,7 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(BoolValue* other) { + void UnsafeArenaSwap(BoolValue* PROTOBUF_NONNULL other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1700,7 +1712,7 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - BoolValue* New(::google::protobuf::Arena* arena = nullptr) const { + BoolValue* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct<BoolValue>(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1709,9 +1721,8 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message void MergeFrom(const BoolValue& from) { BoolValue::MergeImpl(*this, from); } private: - static void MergeImpl( - ::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); + static void MergeImpl(::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); public: bool IsInitialized() const { @@ -1721,49 +1732,51 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message #if defined(PROTOBUF_CUSTOM_VTABLE) private: static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* _InternalSerialize( - const MessageLite& msg, ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream); + static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); public: ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { return _InternalSerialize(*this, target, stream); } #else // PROTOBUF_CUSTOM_VTABLE ::size_t ByteSizeLong() const final; - ::uint8_t* _InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( + ::uint8_t* PROTOBUF_NONNULL target, + ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; #endif // PROTOBUF_CUSTOM_VTABLE int GetCachedSize() const { return _impl_._cached_size_.Get(); } private: - void SharedCtor(::google::protobuf::Arena* arena); + void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static void SharedDtor(MessageLite& self); - void InternalSwap(BoolValue* other); + void InternalSwap(BoolValue* PROTOBUF_NONNULL other); private: template <typename T> - friend ::absl::string_view( - ::google::protobuf::internal::GetAnyMessageName)(); + friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); static ::absl::string_view FullMessageName() { return "google.protobuf.BoolValue"; } protected: - explicit BoolValue(::google::protobuf::Arena* arena); - BoolValue(::google::protobuf::Arena* arena, const BoolValue& from); - BoolValue(::google::protobuf::Arena* arena, BoolValue&& from) noexcept + explicit BoolValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + BoolValue(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const BoolValue& from); + BoolValue( + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, BoolValue&& from) noexcept : BoolValue(arena) { *this = ::std::move(from); } - const ::google::protobuf::internal::ClassData* GetClassData() const PROTOBUF_FINAL; - static void* PlacementNew_(const void*, void* mem, - ::google::protobuf::Arena* arena); + const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; + static void* PROTOBUF_NONNULL PlacementNew_( + const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); static constexpr auto InternalNewImpl_(); - static const ::google::protobuf::internal::ClassDataFull _class_data_; public: + static constexpr auto InternalGenerateClassData_(); + ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -1785,9 +1798,9 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + static const ::google::protobuf::internal::TcParseTable<0, 1, + 0, 0, + 2> _table_; friend class ::google::protobuf::MessageLite; @@ -1797,21 +1810,25 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; struct Impl_ { - inline explicit constexpr Impl_( - ::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena); - inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* arena, const Impl_& from, - const BoolValue& from_msg); - bool value_; + inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); + inline explicit Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, + const BoolValue& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; ::google::protobuf::internal::CachedSize _cached_size_; + bool value_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; +PROTOBUF_EXPORT extern const ::google::protobuf::internal::ClassDataFull BoolValue_class_data_; + // =================================================================== @@ -1832,6 +1849,7 @@ class PROTOBUF_EXPORT BoolValue final : public ::google::protobuf::Message inline void DoubleValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0; + _impl_._has_bits_[0] &= ~0x00000001u; } inline double DoubleValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.DoubleValue.value) @@ -1839,6 +1857,7 @@ inline double DoubleValue::value() const { } inline void DoubleValue::set_value(double value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.DoubleValue.value) } inline double DoubleValue::_internal_value() const { @@ -1858,6 +1877,7 @@ inline void DoubleValue::_internal_set_value(double value) { inline void FloatValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0; + _impl_._has_bits_[0] &= ~0x00000001u; } inline float FloatValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.FloatValue.value) @@ -1865,6 +1885,7 @@ inline float FloatValue::value() const { } inline void FloatValue::set_value(float value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.FloatValue.value) } inline float FloatValue::_internal_value() const { @@ -1884,6 +1905,7 @@ inline void FloatValue::_internal_set_value(float value) { inline void Int64Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = ::int64_t{0}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int64_t Int64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value) @@ -1891,6 +1913,7 @@ inline ::int64_t Int64Value::value() const { } inline void Int64Value::set_value(::int64_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value) } inline ::int64_t Int64Value::_internal_value() const { @@ -1910,6 +1933,7 @@ inline void Int64Value::_internal_set_value(::int64_t value) { inline void UInt64Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = ::uint64_t{0u}; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::uint64_t UInt64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value) @@ -1917,6 +1941,7 @@ inline ::uint64_t UInt64Value::value() const { } inline void UInt64Value::set_value(::uint64_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value) } inline ::uint64_t UInt64Value::_internal_value() const { @@ -1936,6 +1961,7 @@ inline void UInt64Value::_internal_set_value(::uint64_t value) { inline void Int32Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::int32_t Int32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value) @@ -1943,6 +1969,7 @@ inline ::int32_t Int32Value::value() const { } inline void Int32Value::set_value(::int32_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value) } inline ::int32_t Int32Value::_internal_value() const { @@ -1962,6 +1989,7 @@ inline void Int32Value::_internal_set_value(::int32_t value) { inline void UInt32Value::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = 0u; + _impl_._has_bits_[0] &= ~0x00000001u; } inline ::uint32_t UInt32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value) @@ -1969,6 +1997,7 @@ inline ::uint32_t UInt32Value::value() const { } inline void UInt32Value::set_value(::uint32_t value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value) } inline ::uint32_t UInt32Value::_internal_value() const { @@ -1988,6 +2017,7 @@ inline void UInt32Value::_internal_set_value(::uint32_t value) { inline void BoolValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_ = false; + _impl_._has_bits_[0] &= ~0x00000001u; } inline bool BoolValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.BoolValue.value) @@ -1995,6 +2025,7 @@ inline bool BoolValue::value() const { } inline void BoolValue::set_value(bool value) { _internal_set_value(value); + _impl_._has_bits_[0] |= 0x00000001u; // @@protoc_insertion_point(field_set:google.protobuf.BoolValue.value) } inline bool BoolValue::_internal_value() const { @@ -2014,6 +2045,7 @@ inline void BoolValue::_internal_set_value(bool value) { inline void StringValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& StringValue::value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2021,13 +2053,14 @@ inline const std::string& StringValue::value() const return _internal_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void StringValue::set_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void StringValue::set_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value) } -inline std::string* StringValue::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL StringValue::mutable_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.StringValue.value) return _s; @@ -2038,19 +2071,34 @@ inline const std::string& StringValue::_internal_value() const { } inline void StringValue::_internal_set_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(value, GetArena()); } -inline std::string* StringValue::_internal_mutable_value() { +inline std::string* PROTOBUF_NONNULL StringValue::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.value_.Mutable( GetArena()); } -inline std::string* StringValue::release_value() { +inline std::string* PROTOBUF_NULLABLE StringValue::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.StringValue.value) - return _impl_.value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.value_.Set("", GetArena()); + } + return released; } -inline void StringValue::set_allocated_value(std::string* value) { +inline void StringValue::set_allocated_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.value_.IsDefault()) { _impl_.value_.Set("", GetArena()); @@ -2066,6 +2114,7 @@ inline void StringValue::set_allocated_value(std::string* value) { inline void BytesValue::clear_value() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.value_.ClearToEmpty(); + _impl_._has_bits_[0] &= ~0x00000001u; } inline const std::string& BytesValue::value() const ABSL_ATTRIBUTE_LIFETIME_BOUND { @@ -2073,13 +2122,14 @@ inline const std::string& BytesValue::value() const return _internal_value(); } template <typename Arg_, typename... Args_> -inline PROTOBUF_ALWAYS_INLINE void BytesValue::set_value(Arg_&& arg, - Args_... args) { +PROTOBUF_ALWAYS_INLINE void BytesValue::set_value(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.SetBytes(static_cast<Arg_&&>(arg), args..., GetArena()); // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value) } -inline std::string* BytesValue::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* PROTOBUF_NONNULL BytesValue::mutable_value() + ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.BytesValue.value) return _s; @@ -2090,19 +2140,34 @@ inline const std::string& BytesValue::_internal_value() const { } inline void BytesValue::_internal_set_value(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; _impl_.value_.Set(value, GetArena()); } -inline std::string* BytesValue::_internal_mutable_value() { +inline std::string* PROTOBUF_NONNULL BytesValue::_internal_mutable_value() { ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_._has_bits_[0] |= 0x00000001u; return _impl_.value_.Mutable( GetArena()); } -inline std::string* BytesValue::release_value() { +inline std::string* PROTOBUF_NULLABLE BytesValue::release_value() { ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.BytesValue.value) - return _impl_.value_.Release(); + if ((_impl_._has_bits_[0] & 0x00000001u) == 0) { + return nullptr; + } + _impl_._has_bits_[0] &= ~0x00000001u; + auto* released = _impl_.value_.Release(); + if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { + _impl_.value_.Set("", GetArena()); + } + return released; } -inline void BytesValue::set_allocated_value(std::string* value) { +inline void BytesValue::set_allocated_value(std::string* PROTOBUF_NULLABLE value) { ::google::protobuf::internal::TSanWrite(&_impl_); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } _impl_.value_.SetAllocated(value, GetArena()); if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.value_.IsDefault()) { _impl_.value_.Set("", GetArena()); diff --git a/third_party/protobuf/src/google/protobuf/wrappers.proto b/third_party/protobuf/src/google/protobuf/wrappers.proto index 1959fa55a4e7f..e583e7c40be93 100644 --- a/third_party/protobuf/src/google/protobuf/wrappers.proto +++ b/third_party/protobuf/src/google/protobuf/wrappers.proto @@ -28,10 +28,17 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Wrappers for primitive (non-message) types. These types are useful -// for embedding primitives in the `google.protobuf.Any` type and for places -// where we need to distinguish between the absence of a primitive -// typed field and its default value. +// Wrappers for primitive (non-message) types. These types were needed +// for legacy reasons and are not recommended for use in new APIs. +// +// Historically these wrappers were useful to have presence on proto3 primitive +// fields, but proto3 syntax has been updated to support the `optional` keyword. +// Using that keyword is now the strongly preferred way to add presence to +// proto3 primitive fields. +// +// A secondary usecase was to embed primitives in the `google.protobuf.Any` +// type: it is now recommended that you embed your value in your own wrapper +// message which can be specifically documented. // // These wrappers have no meaningful use within repeated fields as they lack // the ability to detect presence on individual elements. @@ -53,6 +60,9 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // Wrapper message for `double`. // // The JSON representation for `DoubleValue` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message DoubleValue { // The double value. double value = 1; @@ -61,6 +71,9 @@ message DoubleValue { // Wrapper message for `float`. // // The JSON representation for `FloatValue` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message FloatValue { // The float value. float value = 1; @@ -69,6 +82,9 @@ message FloatValue { // Wrapper message for `int64`. // // The JSON representation for `Int64Value` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message Int64Value { // The int64 value. int64 value = 1; @@ -77,6 +93,9 @@ message Int64Value { // Wrapper message for `uint64`. // // The JSON representation for `UInt64Value` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message UInt64Value { // The uint64 value. uint64 value = 1; @@ -85,6 +104,9 @@ message UInt64Value { // Wrapper message for `int32`. // // The JSON representation for `Int32Value` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message Int32Value { // The int32 value. int32 value = 1; @@ -93,6 +115,9 @@ message Int32Value { // Wrapper message for `uint32`. // // The JSON representation for `UInt32Value` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message UInt32Value { // The uint32 value. uint32 value = 1; @@ -101,6 +126,9 @@ message UInt32Value { // Wrapper message for `bool`. // // The JSON representation for `BoolValue` is JSON `true` and `false`. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message BoolValue { // The bool value. bool value = 1; @@ -109,6 +137,9 @@ message BoolValue { // Wrapper message for `string`. // // The JSON representation for `StringValue` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message StringValue { // The string value. string value = 1; @@ -117,6 +148,9 @@ message StringValue { // Wrapper message for `bytes`. // // The JSON representation for `BytesValue` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message BytesValue { // The bytes value. bytes value = 1; diff --git a/third_party/protobuf/third_party/BUILD.bazel b/third_party/protobuf/third_party/BUILD.bazel index 35da5c30f83f9..f70d91de5651c 100644 --- a/third_party/protobuf/third_party/BUILD.bazel +++ b/third_party/protobuf/third_party/BUILD.bazel @@ -1,5 +1,6 @@ exports_files([ "BUILD.bazel", + "jsoncpp.BUILD", "rules_fuzzing.patch", "zlib.BUILD", ]) diff --git a/third_party/protobuf/third_party/utf8_range/BUILD.bazel b/third_party/protobuf/third_party/utf8_range/BUILD.bazel index 90b1088c4c5dc..5ed28a11a4a82 100644 --- a/third_party/protobuf/third_party/utf8_range/BUILD.bazel +++ b/third_party/protobuf/third_party/utf8_range/BUILD.bazel @@ -35,6 +35,8 @@ filegroup( srcs = [ "utf8_range.c", "utf8_range.h", + "utf8_range_neon.inc", + "utf8_range_sse.inc", ], visibility = ["//:__subpackages__"], ) @@ -44,7 +46,11 @@ cc_library( srcs = [ "utf8_range.c", ], - hdrs = ["utf8_range.h"], + hdrs = [ + "utf8_range.h", + "utf8_range_neon.inc", + "utf8_range_sse.inc", + ], strip_include_prefix = "/third_party/utf8_range", ) @@ -55,7 +61,7 @@ cc_library( strip_include_prefix = "/third_party/utf8_range", deps = [ ":utf8_range", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -68,8 +74,8 @@ cc_test( deps = [ ":utf8_range", ":utf8_validity", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/third_party/utf8_range/CMakeLists.txt b/third_party/protobuf/third_party/utf8_range/CMakeLists.txt index 4276b972908fb..67d2094cdaa77 100644 --- a/third_party/protobuf/third_party/utf8_range/CMakeLists.txt +++ b/third_party/protobuf/third_party/utf8_range/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.16) project (utf8_range C CXX) # option() honor variables @@ -19,6 +19,15 @@ add_library (utf8_range # A heavier-weight C++ wrapper that supports Abseil. add_library (utf8_validity utf8_validity.cc utf8_range.c) +set_target_properties(utf8_range PROPERTIES + VERSION ${protobuf_VERSION} + OUTPUT_NAME ${LIB_PREFIX}utf8_range +) +set_target_properties(utf8_validity PROPERTIES + VERSION ${protobuf_VERSION} + OUTPUT_NAME ${LIB_PREFIX}utf8_validity +) + # Load Abseil dependency. if (NOT TARGET absl::strings) if (NOT ABSL_ROOT_DIR) diff --git a/third_party/protobuf/third_party/utf8_range/utf8_range.c b/third_party/protobuf/third_party/utf8_range/utf8_range.c index 9564b07e03335..6b8c6b657cf01 100644 --- a/third_party/protobuf/third_party/utf8_range/utf8_range.c +++ b/third_party/protobuf/third_party/utf8_range/utf8_range.c @@ -21,12 +21,6 @@ #include <stdint.h> #include <string.h> -#ifdef __SSE4_1__ -#include <emmintrin.h> -#include <smmintrin.h> -#include <tmmintrin.h> -#endif - #if defined(__GNUC__) #define FORCE_INLINE_ATTR __attribute__((always_inline)) #elif defined(_MSC_VER) @@ -143,7 +137,7 @@ static size_t utf8_range_ValidateUTF8Naive(const char* data, const char* end, return err_pos + (1 - return_position); } -#ifdef __SSE4_1__ +#if defined(__SSE4_1__) || (defined(__ARM_NEON) && defined(__ARM_64BIT_STATE)) /* Returns the number of bytes needed to skip backwards to get to the first byte of codepoint. */ @@ -175,286 +169,32 @@ static inline const char* utf8_range_SkipAscii(const char* data, return data; } +#if defined(__SSE4_1__) +#include "utf8_range_sse.inc" +#elif defined(__ARM_NEON) && defined(__ARM_64BIT_STATE) +#include "utf8_range_neon.inc" +#endif + static FORCE_INLINE_ATTR inline size_t utf8_range_Validate( const char* data, size_t len, int return_position) { if (len == 0) return 1 - return_position; + // Save buffer start address for later use + const char* const data_original = data; const char* const end = data + len; data = utf8_range_SkipAscii(data, end); /* SIMD algorithm always outperforms the naive version for any data of length >=16. */ if (end - data < 16) { - return (return_position ? (data - (end - len)) : 0) + + return (return_position ? (data - data_original) : 0) + utf8_range_ValidateUTF8Naive(data, end, return_position); } -#ifndef __SSE4_1__ - return (return_position ? (data - (end - len)) : 0) + - utf8_range_ValidateUTF8Naive(data, end, return_position); +#if defined(__SSE4_1__) || (defined(__ARM_NEON) && defined(__ARM_64BIT_STATE)) + return utf8_range_ValidateUTF8Simd( + data_original, data, end, return_position); #else - /* This code checks that utf-8 ranges are structurally valid 16 bytes at once - * using superscalar instructions. - * The mapping between ranges of codepoint and their corresponding utf-8 - * sequences is below. - */ - - /* - * U+0000...U+007F 00...7F - * U+0080...U+07FF C2...DF 80...BF - * U+0800...U+0FFF E0 A0...BF 80...BF - * U+1000...U+CFFF E1...EC 80...BF 80...BF - * U+D000...U+D7FF ED 80...9F 80...BF - * U+E000...U+FFFF EE...EF 80...BF 80...BF - * U+10000...U+3FFFF F0 90...BF 80...BF 80...BF - * U+40000...U+FFFFF F1...F3 80...BF 80...BF 80...BF - * U+100000...U+10FFFF F4 80...8F 80...BF 80...BF - */ - - /* First we compute the type for each byte, as given by the table below. - * This type will be used as an index later on. - */ - - /* - * Index Min Max Byte Type - * 0 00 7F Single byte sequence - * 1,2,3 80 BF Second, third and fourth byte for many of the sequences. - * 4 A0 BF Second byte after E0 - * 5 80 9F Second byte after ED - * 6 90 BF Second byte after F0 - * 7 80 8F Second byte after F4 - * 8 C2 F4 First non ASCII byte - * 9..15 7F 80 Invalid byte - */ - - /* After the first step we compute the index for all bytes, then we permute - the bytes according to their indices to check the ranges from the range - table. - * The range for a given type can be found in the range_min_table and - range_max_table, the range for type/index X is in range_min_table[X] ... - range_max_table[X]. - */ - - /* Algorithm: - * Put index zero to all bytes. - * Find all non ASCII characters, give them index 8. - * For each tail byte in a codepoint sequence, give it an index corresponding - to the 1 based index from the end. - * If the first byte of the codepoint is in the [C0...DF] range, we write - index 1 in the following byte. - * If the first byte of the codepoint is in the range [E0...EF], we write - indices 2 and 1 in the next two bytes. - * If the first byte of the codepoint is in the range [F0...FF] we write - indices 3,2,1 into the next three bytes. - * For finding the number of bytes we need to look at high nibbles (4 bits) - and do the lookup from the table, it can be done with shift by 4 + shuffle - instructions. We call it `first_len`. - * Then we shift first_len by 8 bits to get the indices of the 2nd bytes. - * Saturating sub 1 and shift by 8 bits to get the indices of the 3rd bytes. - * Again to get the indices of the 4th bytes. - * Take OR of all that 4 values and check within range. - */ - /* For example: - * input C3 80 68 E2 80 20 A6 F0 A0 80 AC 20 F0 93 80 80 - * first_len 1 0 0 2 0 0 0 3 0 0 0 0 3 0 0 0 - * 1st byte 8 0 0 8 0 0 0 8 0 0 0 0 8 0 0 0 - * 2nd byte 0 1 0 0 2 0 0 0 3 0 0 0 0 3 0 0 // Shift + sub - * 3rd byte 0 0 0 0 0 1 0 0 0 2 0 0 0 0 2 0 // Shift + sub - * 4th byte 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 // Shift + sub - * Index 8 1 0 8 2 1 0 8 3 2 1 0 8 3 2 1 // OR of results - */ - - /* Checking for errors: - * Error checking is done by looking up the high nibble (4 bits) of each byte - against an error checking table. - * Because the lookup value for the second byte depends of the value of the - first byte in codepoint, we use saturated operations to adjust the index. - * Specifically we need to add 2 for E0, 3 for ED, 3 for F0 and 4 for F4 to - match the correct index. - * If we subtract from all bytes EF then EO -> 241, ED -> 254, F0 -> 1, - F4 -> 5 - * Do saturating sub 240, then E0 -> 1, ED -> 14 and we can do lookup to - match the adjustment - * Add saturating 112, then F0 -> 113, F4 -> 117, all that were > 16 will - be more 128 and lookup in ef_fe_table will return 0 but for F0 - and F4 it will be 4 and 5 accordingly - */ - /* - * Then just check the appropriate ranges with greater/smaller equal - instructions. Check tail with a naive algorithm. - * To save from previous 16 byte checks we just align previous_first_len to - get correct continuations of the codepoints. - */ - - /* - * Map high nibble of "First Byte" to legal character length minus 1 - * 0x00 ~ 0xBF --> 0 - * 0xC0 ~ 0xDF --> 1 - * 0xE0 ~ 0xEF --> 2 - * 0xF0 ~ 0xFF --> 3 - */ - const __m128i first_len_table = - _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3); - - /* Map "First Byte" to 8-th item of range table (0xC2 ~ 0xF4) */ - const __m128i first_range_table = - _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8); - - /* - * Range table, map range index to min and max values - */ - const __m128i range_min_table = - _mm_setr_epi8(0x00, 0x80, 0x80, 0x80, 0xA0, 0x80, 0x90, 0x80, 0xC2, 0x7F, - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F); - - const __m128i range_max_table = - _mm_setr_epi8(0x7F, 0xBF, 0xBF, 0xBF, 0xBF, 0x9F, 0xBF, 0x8F, 0xF4, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80); - - /* - * Tables for fast handling of four special First Bytes(E0,ED,F0,F4), after - * which the Second Byte are not 80~BF. It contains "range index adjustment". - * +------------+---------------+------------------+----------------+ - * | First Byte | original range| range adjustment | adjusted range | - * +------------+---------------+------------------+----------------+ - * | E0 | 2 | 2 | 4 | - * +------------+---------------+------------------+----------------+ - * | ED | 2 | 3 | 5 | - * +------------+---------------+------------------+----------------+ - * | F0 | 3 | 3 | 6 | - * +------------+---------------+------------------+----------------+ - * | F4 | 4 | 4 | 8 | - * +------------+---------------+------------------+----------------+ - */ - - /* df_ee_table[1] -> E0, df_ee_table[14] -> ED as ED - E0 = 13 */ - // The values represent the adjustment in the Range Index table for a correct - // index. - const __m128i df_ee_table = - _mm_setr_epi8(0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0); - - /* ef_fe_table[1] -> F0, ef_fe_table[5] -> F4, F4 - F0 = 4 */ - // The values represent the adjustment in the Range Index table for a correct - // index. - const __m128i ef_fe_table = - _mm_setr_epi8(0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - - __m128i prev_input = _mm_set1_epi8(0); - __m128i prev_first_len = _mm_set1_epi8(0); - __m128i error = _mm_set1_epi8(0); - while (end - data >= 16) { - const __m128i input = - _mm_loadu_si128((const __m128i*)(data)); - - /* high_nibbles = input >> 4 */ - const __m128i high_nibbles = - _mm_and_si128(_mm_srli_epi16(input, 4), _mm_set1_epi8(0x0F)); - - /* first_len = legal character length minus 1 */ - /* 0 for 00~7F, 1 for C0~DF, 2 for E0~EF, 3 for F0~FF */ - /* first_len = first_len_table[high_nibbles] */ - __m128i first_len = _mm_shuffle_epi8(first_len_table, high_nibbles); - - /* First Byte: set range index to 8 for bytes within 0xC0 ~ 0xFF */ - /* range = first_range_table[high_nibbles] */ - __m128i range = _mm_shuffle_epi8(first_range_table, high_nibbles); - - /* Second Byte: set range index to first_len */ - /* 0 for 00~7F, 1 for C0~DF, 2 for E0~EF, 3 for F0~FF */ - /* range |= (first_len, prev_first_len) << 1 byte */ - range = _mm_or_si128(range, _mm_alignr_epi8(first_len, prev_first_len, 15)); - - /* Third Byte: set range index to saturate_sub(first_len, 1) */ - /* 0 for 00~7F, 0 for C0~DF, 1 for E0~EF, 2 for F0~FF */ - __m128i tmp1; - __m128i tmp2; - /* tmp1 = saturate_sub(first_len, 1) */ - tmp1 = _mm_subs_epu8(first_len, _mm_set1_epi8(1)); - /* tmp2 = saturate_sub(prev_first_len, 1) */ - tmp2 = _mm_subs_epu8(prev_first_len, _mm_set1_epi8(1)); - /* range |= (tmp1, tmp2) << 2 bytes */ - range = _mm_or_si128(range, _mm_alignr_epi8(tmp1, tmp2, 14)); - - /* Fourth Byte: set range index to saturate_sub(first_len, 2) */ - /* 0 for 00~7F, 0 for C0~DF, 0 for E0~EF, 1 for F0~FF */ - /* tmp1 = saturate_sub(first_len, 2) */ - tmp1 = _mm_subs_epu8(first_len, _mm_set1_epi8(2)); - /* tmp2 = saturate_sub(prev_first_len, 2) */ - tmp2 = _mm_subs_epu8(prev_first_len, _mm_set1_epi8(2)); - /* range |= (tmp1, tmp2) << 3 bytes */ - range = _mm_or_si128(range, _mm_alignr_epi8(tmp1, tmp2, 13)); - - /* - * Now we have below range indices calculated - * Correct cases: - * - 8 for C0~FF - * - 3 for 1st byte after F0~FF - * - 2 for 1st byte after E0~EF or 2nd byte after F0~FF - * - 1 for 1st byte after C0~DF or 2nd byte after E0~EF or - * 3rd byte after F0~FF - * - 0 for others - * Error cases: - * >9 for non ascii First Byte overlapping - * E.g., F1 80 C2 90 --> 8 3 10 2, where 10 indicates error - */ - - /* Adjust Second Byte range for special First Bytes(E0,ED,F0,F4) */ - /* Overlaps lead to index 9~15, which are illegal in range table */ - __m128i shift1; - __m128i pos; - __m128i range2; - /* shift1 = (input, prev_input) << 1 byte */ - shift1 = _mm_alignr_epi8(input, prev_input, 15); - pos = _mm_sub_epi8(shift1, _mm_set1_epi8(0xEF)); - /* - * shift1: | EF F0 ... FE | FF 00 ... ... DE | DF E0 ... EE | - * pos: | 0 1 15 | 16 17 239| 240 241 255| - * pos-240: | 0 0 0 | 0 0 0 | 0 1 15 | - * pos+112: | 112 113 127| >= 128 | >= 128 | - */ - tmp1 = _mm_subs_epu8(pos, _mm_set1_epi8(-16)); - range2 = _mm_shuffle_epi8(df_ee_table, tmp1); - tmp2 = _mm_adds_epu8(pos, _mm_set1_epi8(112)); - range2 = _mm_add_epi8(range2, _mm_shuffle_epi8(ef_fe_table, tmp2)); - - range = _mm_add_epi8(range, range2); - - /* Load min and max values per calculated range index */ - __m128i min_range = _mm_shuffle_epi8(range_min_table, range); - __m128i max_range = _mm_shuffle_epi8(range_max_table, range); - - /* Check value range */ - if (return_position) { - error = _mm_cmplt_epi8(input, min_range); - error = _mm_or_si128(error, _mm_cmpgt_epi8(input, max_range)); - /* 5% performance drop from this conditional branch */ - if (!_mm_testz_si128(error, error)) { - break; - } - } else { - error = _mm_or_si128(error, _mm_cmplt_epi8(input, min_range)); - error = _mm_or_si128(error, _mm_cmpgt_epi8(input, max_range)); - } - - prev_input = input; - prev_first_len = first_len; - - data += 16; - } - /* If we got to the end, we don't need to skip any bytes backwards */ - if (return_position && (data - (end - len)) == 0) { - return utf8_range_ValidateUTF8Naive(data, end, return_position); - } - /* Find previous codepoint (not 80~BF) */ - data -= utf8_range_CodepointSkipBackwards(_mm_extract_epi32(prev_input, 3)); - if (return_position) { - return (data - (end - len)) + - utf8_range_ValidateUTF8Naive(data, end, return_position); - } - /* Test if there was any error */ - if (!_mm_testz_si128(error, error)) { - return 0; - } - /* Check the tail */ - return utf8_range_ValidateUTF8Naive(data, end, return_position); + return (return_position ? (data - data_original) : 0) + + utf8_range_ValidateUTF8Naive(data, end, return_position); #endif } diff --git a/third_party/protobuf/third_party/utf8_range/utf8_range_neon.inc b/third_party/protobuf/third_party/utf8_range/utf8_range_neon.inc new file mode 100644 index 0000000000000..37e820b8d97dc --- /dev/null +++ b/third_party/protobuf/third_party/utf8_range/utf8_range_neon.inc @@ -0,0 +1,117 @@ +#include <arm_neon.h> + +/* This code is almost the same as SSE implementation, please reference + * utf8-range-sse.inc for detailed explanation. + * The only difference is the range adjustment step. NEON code is more + * straightforward. + */ + +static FORCE_INLINE_ATTR inline size_t utf8_range_ValidateUTF8Simd( + const char* data_original, const char* data, const char* end, + int return_position) { + const uint8x16_t first_len_tbl = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, + }; + const uint8x16_t first_range_tbl = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, + }; + const uint8x16_t range_min_tbl = { + 0x00, 0x80, 0x80, 0x80, 0xA0, 0x80, 0x90, 0x80, + 0xC2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + }; + const uint8x16_t range_max_tbl = { + 0x7F, 0xBF, 0xBF, 0xBF, 0xBF, 0x9F, 0xBF, 0x8F, + 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + /* Range adjustment in NEON uint8x16x2 table. Note that lanes are interleaved + * in register. The table below is plotted vertically to ease understanding. + * The 1st column is for E0~EF, 2nd column for F0~FF. + */ + // clang-format off + const uint8_t range_adjust_tbl_data[] = { + /* index -> 0~15 16~31 <- index */ + /* E0 -> */ 2, 3, /* <- F0 */ + 0, 0, + 0, 0, + 0, 0, + 0, 4, /* <- F4 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + /* ED -> */ 3, 0, + 0, 0, + 0, 0, + }; + // clang-format on + const uint8x16x2_t range_adjust_tbl = vld2q_u8(range_adjust_tbl_data); + + const uint8x16_t const_1 = vdupq_n_u8(1); + const uint8x16_t const_2 = vdupq_n_u8(2); + const uint8x16_t const_e0 = vdupq_n_u8(0xE0); + + uint8x16_t prev_input = vdupq_n_u8(0); + uint8x16_t prev_first_len = vdupq_n_u8(0); + uint8x16_t error = vdupq_n_u8(0); + + while (end - data >= 16) { + const uint8x16_t input = vld1q_u8((const uint8_t*)data); + + const uint8x16_t high_nibbles = vshrq_n_u8(input, 4); + + const uint8x16_t first_len = vqtbl1q_u8(first_len_tbl, high_nibbles); + + uint8x16_t range = vqtbl1q_u8(first_range_tbl, high_nibbles); + + range = vorrq_u8(range, vextq_u8(prev_first_len, first_len, 15)); + + uint8x16_t shift2 = vextq_u8(prev_first_len, first_len, 14); + shift2 = vqsubq_u8(shift2, const_1); + range = vorrq_u8(range, shift2); + + uint8x16_t shift3 = vextq_u8(prev_first_len, first_len, 13); + shift3 = vqsubq_u8(shift3, const_2); + range = vorrq_u8(range, shift3); + + uint8x16_t shift1 = vextq_u8(prev_input, input, 15); + shift1 = vsubq_u8(shift1, const_e0); + range = vaddq_u8(range, vqtbl2q_u8(range_adjust_tbl, shift1)); + + const uint8x16_t min_range = vqtbl1q_u8(range_min_tbl, range); + const uint8x16_t max_range = vqtbl1q_u8(range_max_tbl, range); + + if (return_position) { + error = vcltq_u8(input, min_range); + error = vorrq_u8(error, vcgtq_u8(input, max_range)); + if (vmaxvq_u32(vreinterpretq_u32_u8(error))) { + break; + } + } else { + error = vorrq_u8(error, vcltq_u8(input, min_range)); + error = vorrq_u8(error, vcgtq_u8(input, max_range)); + } + + prev_input = input; + prev_first_len = first_len; + + data += 16; + } + + if (return_position && data == data_original) { + return utf8_range_ValidateUTF8Naive(data, end, return_position); + } + const int32_t prev = vgetq_lane_s32(vreinterpretq_s32_u8(prev_input), 3); + data -= utf8_range_CodepointSkipBackwards(prev); + if (return_position) { + return (data - data_original) + + utf8_range_ValidateUTF8Naive(data, end, return_position); + } + if (vmaxvq_u32(vreinterpretq_u32_u8(error))) { + return 0; + } + return utf8_range_ValidateUTF8Naive(data, end, return_position); +} diff --git a/third_party/protobuf/third_party/utf8_range/utf8_range_sse.inc b/third_party/protobuf/third_party/utf8_range/utf8_range_sse.inc new file mode 100644 index 0000000000000..be6984c9ef03a --- /dev/null +++ b/third_party/protobuf/third_party/utf8_range/utf8_range_sse.inc @@ -0,0 +1,272 @@ +#include <emmintrin.h> +#include <smmintrin.h> +#include <tmmintrin.h> + +static FORCE_INLINE_ATTR inline size_t utf8_range_ValidateUTF8Simd( + const char* data_original, const char* data, const char* end, + int return_position) { + /* This code checks that utf-8 ranges are structurally valid 16 bytes at once + * using superscalar instructions. + * The mapping between ranges of codepoint and their corresponding utf-8 + * sequences is below. + */ + + /* + * U+0000...U+007F 00...7F + * U+0080...U+07FF C2...DF 80...BF + * U+0800...U+0FFF E0 A0...BF 80...BF + * U+1000...U+CFFF E1...EC 80...BF 80...BF + * U+D000...U+D7FF ED 80...9F 80...BF + * U+E000...U+FFFF EE...EF 80...BF 80...BF + * U+10000...U+3FFFF F0 90...BF 80...BF 80...BF + * U+40000...U+FFFFF F1...F3 80...BF 80...BF 80...BF + * U+100000...U+10FFFF F4 80...8F 80...BF 80...BF + */ + + /* First we compute the type for each byte, as given by the table below. + * This type will be used as an index later on. + */ + + /* + * Index Min Max Byte Type + * 0 00 7F Single byte sequence + * 1,2,3 80 BF Second, third and fourth byte for many of the sequences. + * 4 A0 BF Second byte after E0 + * 5 80 9F Second byte after ED + * 6 90 BF Second byte after F0 + * 7 80 8F Second byte after F4 + * 8 C2 F4 First non ASCII byte + * 9..15 7F 80 Invalid byte + */ + + /* After the first step we compute the index for all bytes, then we permute + the bytes according to their indices to check the ranges from the range + table. + * The range for a given type can be found in the range_min_table and + range_max_table, the range for type/index X is in range_min_table[X] ... + range_max_table[X]. + */ + + /* Algorithm: + * Put index zero to all bytes. + * Find all non ASCII characters, give them index 8. + * For each tail byte in a codepoint sequence, give it an index corresponding + to the 1 based index from the end. + * If the first byte of the codepoint is in the [C0...DF] range, we write + index 1 in the following byte. + * If the first byte of the codepoint is in the range [E0...EF], we write + indices 2 and 1 in the next two bytes. + * If the first byte of the codepoint is in the range [F0...FF] we write + indices 3,2,1 into the next three bytes. + * For finding the number of bytes we need to look at high nibbles (4 bits) + and do the lookup from the table, it can be done with shift by 4 + shuffle + instructions. We call it `first_len`. + * Then we shift first_len by 8 bits to get the indices of the 2nd bytes. + * Saturating sub 1 and shift by 8 bits to get the indices of the 3rd bytes. + * Again to get the indices of the 4th bytes. + * Take OR of all that 4 values and check within range. + */ + /* For example: + * input C3 80 68 E2 80 20 A6 F0 A0 80 AC 20 F0 93 80 80 + * first_len 1 0 0 2 0 0 0 3 0 0 0 0 3 0 0 0 + * 1st byte 8 0 0 8 0 0 0 8 0 0 0 0 8 0 0 0 + * 2nd byte 0 1 0 0 2 0 0 0 3 0 0 0 0 3 0 0 // Shift + sub + * 3rd byte 0 0 0 0 0 1 0 0 0 2 0 0 0 0 2 0 // Shift + sub + * 4th byte 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 // Shift + sub + * Index 8 1 0 8 2 1 0 8 3 2 1 0 8 3 2 1 // OR of results + */ + + /* Checking for errors: + * Error checking is done by looking up the high nibble (4 bits) of each byte + against an error checking table. + * Because the lookup value for the second byte depends of the value of the + first byte in codepoint, we use saturated operations to adjust the index. + * Specifically we need to add 2 for E0, 3 for ED, 3 for F0 and 4 for F4 to + match the correct index. + * If we subtract from all bytes EF then EO -> 241, ED -> 254, F0 -> 1, + F4 -> 5 + * Do saturating sub 240, then E0 -> 1, ED -> 14 and we can do lookup to + match the adjustment + * Add saturating 112, then F0 -> 113, F4 -> 117, all that were > 16 will + be more 128 and lookup in ef_fe_table will return 0 but for F0 + and F4 it will be 4 and 5 accordingly + */ + /* + * Then just check the appropriate ranges with greater/smaller equal + instructions. Check tail with a naive algorithm. + * To save from previous 16 byte checks we just align previous_first_len to + get correct continuations of the codepoints. + */ + + /* + * Map high nibble of "First Byte" to legal character length minus 1 + * 0x00 ~ 0xBF --> 0 + * 0xC0 ~ 0xDF --> 1 + * 0xE0 ~ 0xEF --> 2 + * 0xF0 ~ 0xFF --> 3 + */ + const __m128i first_len_table = + _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3); + + /* Map "First Byte" to 8-th item of range table (0xC2 ~ 0xF4) */ + const __m128i first_range_table = + _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8); + + /* + * Range table, map range index to min and max values + */ + const __m128i range_min_table = + _mm_setr_epi8(0x00, 0x80, 0x80, 0x80, 0xA0, 0x80, 0x90, 0x80, 0xC2, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F); + + const __m128i range_max_table = + _mm_setr_epi8(0x7F, 0xBF, 0xBF, 0xBF, 0xBF, 0x9F, 0xBF, 0x8F, 0xF4, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80); + + /* + * Tables for fast handling of four special First Bytes(E0,ED,F0,F4), after + * which the Second Byte are not 80~BF. It contains "range index adjustment". + * +------------+---------------+------------------+----------------+ + * | First Byte | original range| range adjustment | adjusted range | + * +------------+---------------+------------------+----------------+ + * | E0 | 2 | 2 | 4 | + * +------------+---------------+------------------+----------------+ + * | ED | 2 | 3 | 5 | + * +------------+---------------+------------------+----------------+ + * | F0 | 3 | 3 | 6 | + * +------------+---------------+------------------+----------------+ + * | F4 | 4 | 4 | 8 | + * +------------+---------------+------------------+----------------+ + */ + + /* df_ee_table[1] -> E0, df_ee_table[14] -> ED as ED - E0 = 13 */ + // The values represent the adjustment in the Range Index table for a correct + // index. + const __m128i df_ee_table = + _mm_setr_epi8(0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0); + + /* ef_fe_table[1] -> F0, ef_fe_table[5] -> F4, F4 - F0 = 4 */ + // The values represent the adjustment in the Range Index table for a correct + // index. + const __m128i ef_fe_table = + _mm_setr_epi8(0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + __m128i prev_input = _mm_set1_epi8(0); + __m128i prev_first_len = _mm_set1_epi8(0); + __m128i error = _mm_set1_epi8(0); + + while (end - data >= 16) { + const __m128i input = _mm_loadu_si128((const __m128i*)(data)); + + /* high_nibbles = input >> 4 */ + const __m128i high_nibbles = + _mm_and_si128(_mm_srli_epi16(input, 4), _mm_set1_epi8(0x0F)); + + /* first_len = legal character length minus 1 */ + /* 0 for 00~7F, 1 for C0~DF, 2 for E0~EF, 3 for F0~FF */ + /* first_len = first_len_table[high_nibbles] */ + __m128i first_len = _mm_shuffle_epi8(first_len_table, high_nibbles); + + /* First Byte: set range index to 8 for bytes within 0xC0 ~ 0xFF */ + /* range = first_range_table[high_nibbles] */ + __m128i range = _mm_shuffle_epi8(first_range_table, high_nibbles); + + /* Second Byte: set range index to first_len */ + /* 0 for 00~7F, 1 for C0~DF, 2 for E0~EF, 3 for F0~FF */ + /* range |= (first_len, prev_first_len) << 1 byte */ + range = _mm_or_si128(range, _mm_alignr_epi8(first_len, prev_first_len, 15)); + + /* Third Byte: set range index to saturate_sub(first_len, 1) */ + /* 0 for 00~7F, 0 for C0~DF, 1 for E0~EF, 2 for F0~FF */ + __m128i tmp1; + __m128i tmp2; + /* tmp1 = saturate_sub(first_len, 1) */ + tmp1 = _mm_subs_epu8(first_len, _mm_set1_epi8(1)); + /* tmp2 = saturate_sub(prev_first_len, 1) */ + tmp2 = _mm_subs_epu8(prev_first_len, _mm_set1_epi8(1)); + /* range |= (tmp1, tmp2) << 2 bytes */ + range = _mm_or_si128(range, _mm_alignr_epi8(tmp1, tmp2, 14)); + + /* Fourth Byte: set range index to saturate_sub(first_len, 2) */ + /* 0 for 00~7F, 0 for C0~DF, 0 for E0~EF, 1 for F0~FF */ + /* tmp1 = saturate_sub(first_len, 2) */ + tmp1 = _mm_subs_epu8(first_len, _mm_set1_epi8(2)); + /* tmp2 = saturate_sub(prev_first_len, 2) */ + tmp2 = _mm_subs_epu8(prev_first_len, _mm_set1_epi8(2)); + /* range |= (tmp1, tmp2) << 3 bytes */ + range = _mm_or_si128(range, _mm_alignr_epi8(tmp1, tmp2, 13)); + + /* + * Now we have below range indices calculated + * Correct cases: + * - 8 for C0~FF + * - 3 for 1st byte after F0~FF + * - 2 for 1st byte after E0~EF or 2nd byte after F0~FF + * - 1 for 1st byte after C0~DF or 2nd byte after E0~EF or + * 3rd byte after F0~FF + * - 0 for others + * Error cases: + * >9 for non ascii First Byte overlapping + * E.g., F1 80 C2 90 --> 8 3 10 2, where 10 indicates error + */ + + /* Adjust Second Byte range for special First Bytes(E0,ED,F0,F4) */ + /* Overlaps lead to index 9~15, which are illegal in range table */ + __m128i shift1; + __m128i pos; + __m128i range2; + /* shift1 = (input, prev_input) << 1 byte */ + shift1 = _mm_alignr_epi8(input, prev_input, 15); + pos = _mm_sub_epi8(shift1, _mm_set1_epi8(0xEF)); + /* + * shift1: | EF F0 ... FE | FF 00 ... ... DE | DF E0 ... EE | + * pos: | 0 1 15 | 16 17 239| 240 241 255| + * pos-240: | 0 0 0 | 0 0 0 | 0 1 15 | + * pos+112: | 112 113 127| >= 128 | >= 128 | + */ + tmp1 = _mm_subs_epu8(pos, _mm_set1_epi8(-16)); + range2 = _mm_shuffle_epi8(df_ee_table, tmp1); + tmp2 = _mm_adds_epu8(pos, _mm_set1_epi8(112)); + range2 = _mm_add_epi8(range2, _mm_shuffle_epi8(ef_fe_table, tmp2)); + + range = _mm_add_epi8(range, range2); + + /* Load min and max values per calculated range index */ + __m128i min_range = _mm_shuffle_epi8(range_min_table, range); + __m128i max_range = _mm_shuffle_epi8(range_max_table, range); + + /* Check value range */ + if (return_position) { + error = _mm_cmplt_epi8(input, min_range); + error = _mm_or_si128(error, _mm_cmpgt_epi8(input, max_range)); + /* 5% performance drop from this conditional branch */ + if (!_mm_testz_si128(error, error)) { + break; + } + } else { + error = _mm_or_si128(error, _mm_cmplt_epi8(input, min_range)); + error = _mm_or_si128(error, _mm_cmpgt_epi8(input, max_range)); + } + + prev_input = input; + prev_first_len = first_len; + + data += 16; + } + /* If we got to the end, we don't need to skip any bytes backwards */ + if (return_position && data == data_original) { + return utf8_range_ValidateUTF8Naive(data, end, return_position); + } + /* Find previous codepoint (not 80~BF) */ + data -= utf8_range_CodepointSkipBackwards(_mm_extract_epi32(prev_input, 3)); + if (return_position) { + return (data - data_original) + + utf8_range_ValidateUTF8Naive(data, end, return_position); + } + /* Test if there was any error */ + if (!_mm_testz_si128(error, error)) { + return 0; + } + /* Check the tail */ + return utf8_range_ValidateUTF8Naive(data, end, return_position); +} diff --git a/third_party/protobuf/toolchain/BUILD.bazel b/third_party/protobuf/toolchain/BUILD.bazel index add1324c2db49..524fa14390501 100644 --- a/third_party/protobuf/toolchain/BUILD.bazel +++ b/third_party/protobuf/toolchain/BUILD.bazel @@ -108,7 +108,7 @@ cc_toolchain_config( linker_path = "/usr/tools", sysroot = "/usr/tools/xcode_14_0/macosx", target_cpu = "aarch64", - target_full_name = "aarch64-apple-macosx10.15", + target_full_name = "aarch64-apple-macosx11.0", ) cc_toolchain_config( @@ -125,7 +125,7 @@ cc_toolchain_config( linker_path = "/usr/tools", sysroot = "/usr/tools/xcode_14_0/macosx", target_cpu = "x86_64", - target_full_name = "x86_64-apple-macosx10.15", + target_full_name = "x86_64-apple-macosx11.0", ) cc_toolchain_config( diff --git a/third_party/protobuf/toolchain/toolchains.bazelrc b/third_party/protobuf/toolchain/toolchains.bazelrc index 30784b9bea9df..d0858f48f232a 100644 --- a/third_party/protobuf/toolchain/toolchains.bazelrc +++ b/third_party/protobuf/toolchain/toolchains.bazelrc @@ -1,6 +1,7 @@ build:cross_config --crosstool_top=//toolchain:clang_suite build:cross_config --//toolchain:release=true build:cross_config --host_crosstool_top=@bazel_tools//tools/cpp:toolchain +build:cross_config --incompatible_enable_cc_toolchain_resolution=false build:linux-aarch_64 --config=cross_config --cpu=linux-aarch_64 build:linux-aarch64 --config=cross_config --cpu=linux-aarch_64 @@ -10,7 +11,7 @@ build:linux-s390_64 --config=cross_config --cpu=linux-s390_64 build:linux-x86_32 --config=cross_config --cpu=linux-x86_32 build:linux-i386 --config=cross_config --cpu=linux-x86_32 build:linux-x86_64 --config=cross_config --cpu=linux-x86_64 -build:osx-aarch_64 --config=cross_config --action_env=MACOSX_DEPLOYMENT_TARGET=10.9 --cpu=osx-aarch_64 -build:osx-x86_64 --config=cross_config --action_env=MACOSX_DEPLOYMENT_TARGET=10.9 --cpu=osx-x86_64 +build:osx-aarch_64 --config=cross_config --action_env=MACOSX_DEPLOYMENT_TARGET=11.0 --cpu=osx-aarch_64 +build:osx-x86_64 --config=cross_config --action_env=MACOSX_DEPLOYMENT_TARGET=11.0 --cpu=osx-x86_64 build:win32 --config=cross_config --cpu=win32 build:win64 --config=cross_config --cpu=win64 diff --git a/third_party/protobuf/upb/BUILD b/third_party/protobuf/upb/BUILD index b282b6eeb2d05..025bc1baf0246 100644 --- a/third_party/protobuf/upb/BUILD +++ b/third_party/protobuf/upb/BUILD @@ -352,6 +352,7 @@ upb_amalgamation( "//upb/mini_table:internal", "//upb/reflection:descriptor_upb_proto", "//upb/reflection:internal", + "//upb/util:def_to_proto", ], prefix = "ruby-", strip_import_prefix = ["src"], diff --git a/third_party/protobuf/upb/base/BUILD b/third_party/protobuf/upb/base/BUILD index 47b44a031d402..198131a6a5fbb 100644 --- a/third_party/protobuf/upb/base/BUILD +++ b/third_party/protobuf/upb/base/BUILD @@ -39,6 +39,16 @@ cc_library( deps = ["//upb:port"], ) +cc_test( + name = "string_view_test", + srcs = ["string_view_test.cc"], + deps = [ + ":base", + "@googletest//:gtest", + "@googletest//:gtest_main", + ], +) + filegroup( name = "source_files", srcs = glob( diff --git a/third_party/protobuf/upb/base/internal/log2.h b/third_party/protobuf/upb/base/internal/log2.h index 486e3b0e35970..04736da84d89e 100644 --- a/third_party/protobuf/upb/base/internal/log2.h +++ b/third_party/protobuf/upb/base/internal/log2.h @@ -27,7 +27,9 @@ UPB_INLINE int upb_Log2Ceiling(int x) { #endif } -UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } +UPB_INLINE int upb_RoundUpToPowerOfTwo(int x) { + return 1 << upb_Log2Ceiling(x); +} #ifdef __cplusplus } /* extern "C" */ diff --git a/third_party/protobuf/upb/base/string_view.h b/third_party/protobuf/upb/base/string_view.h index e4d79e680bc06..072f21722f3c7 100644 --- a/third_party/protobuf/upb/base/string_view.h +++ b/third_party/protobuf/upb/base/string_view.h @@ -45,6 +45,16 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) { return (a.size == b.size) && (!a.size || !memcmp(a.data, b.data, a.size)); } +// Compares StringViews following strcmp rules. +// Please note this comparison is neither unicode nor locale aware. +UPB_INLINE int upb_StringView_Compare(upb_StringView a, upb_StringView b) { + int result = memcmp(a.data, b.data, UPB_MIN(a.size, b.size)); + if (result == 0) { + return a.size - b.size; + } + return result; +} + // LINT.ThenChange( // GoogleInternalName1, // //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string, diff --git a/third_party/protobuf/upb/base/string_view_test.cc b/third_party/protobuf/upb/base/string_view_test.cc new file mode 100644 index 0000000000000..9b82903f3fff1 --- /dev/null +++ b/third_party/protobuf/upb/base/string_view_test.cc @@ -0,0 +1,69 @@ +#include "upb/base/string_view.h" + +#include <string> + +#include <gtest/gtest.h> + +namespace { + +TEST(upb_StringView, Compare_Eq) { + std::string s1("12345"); + std::string s2("12345"); + + upb_StringView h1 = upb_StringView_FromDataAndSize(s1.data(), s1.size()); + upb_StringView h2 = upb_StringView_FromDataAndSize(s2.data(), s2.size()); + + ASSERT_EQ(upb_StringView_Compare(h1, h2), 0); +} + +TEST(upb_StringView, Compare_Eq_Shorter) { + std::string s1("1234"); // s1 is shorter. + std::string s2("12345"); + + upb_StringView h1 = upb_StringView_FromDataAndSize(s1.data(), s1.size()); + upb_StringView h2 = upb_StringView_FromDataAndSize(s2.data(), s2.size()); + + ASSERT_LT(upb_StringView_Compare(h1, h2), 0); +} + +TEST(upb_StringView, Compare_Eq_Longer) { + std::string s1("123456"); // s1 is longer. + std::string s2("12345"); + + upb_StringView h1 = upb_StringView_FromDataAndSize(s1.data(), s1.size()); + upb_StringView h2 = upb_StringView_FromDataAndSize(s2.data(), s2.size()); + + ASSERT_GT(upb_StringView_Compare(h1, h2), 0); +} + +TEST(upb_StringView, Compare_Less) { + std::string s1("12245"); // 2 < 3 + std::string s2("12345"); + + upb_StringView h1 = upb_StringView_FromDataAndSize(s1.data(), s1.size()); + upb_StringView h2 = upb_StringView_FromDataAndSize(s2.data(), s2.size()); + + ASSERT_LT(upb_StringView_Compare(h1, h2), 0); +} + +TEST(upb_StringView, Compare_Greater) { + std::string s1("12445"); // 4 > 3 + std::string s2("12345"); + + upb_StringView h1 = upb_StringView_FromDataAndSize(s1.data(), s1.size()); + upb_StringView h2 = upb_StringView_FromDataAndSize(s2.data(), s2.size()); + + ASSERT_GT(upb_StringView_Compare(h1, h2), 0); +} + +TEST(upb_StringView, Compare_Greater_Shorter) { + std::string s1("1244"); // s1 is shorter but 4 > 3. + std::string s2("12345"); + + upb_StringView h1 = upb_StringView_FromDataAndSize(s1.data(), s1.size()); + upb_StringView h2 = upb_StringView_FromDataAndSize(s2.data(), s2.size()); + + ASSERT_GT(upb_StringView_Compare(h1, h2), 0); +} + +} // namespace diff --git a/third_party/protobuf/upb/bazel/BUILD b/third_party/protobuf/upb/bazel/BUILD index f83de7b75ae58..bedc0c1aa9207 100644 --- a/third_party/protobuf/upb/bazel/BUILD +++ b/third_party/protobuf/upb/bazel/BUILD @@ -8,10 +8,6 @@ load("@bazel_skylib//lib:selects.bzl", "selects") load("@rules_python//python:defs.bzl", "py_binary") -package(default_applicable_licenses = ["//:license"]) - -licenses(["notice"]) - py_binary( name = "amalgamate", srcs = ["amalgamate.py"], diff --git a/third_party/protobuf/upb/bazel/build_defs.bzl b/third_party/protobuf/upb/bazel/build_defs.bzl index 23ad43fe4d519..4a860d368e59d 100644 --- a/third_party/protobuf/upb/bazel/build_defs.bzl +++ b/third_party/protobuf/upb/bazel/build_defs.bzl @@ -8,7 +8,10 @@ """Internal rules for building upb.""" _DEFAULT_CPPOPTS = [] -_DEFAULT_COPTS = [] +_DEFAULT_COPTS = [ + # this is a compile error in C++ clang and GNU C, but not clang C by default + "-Werror=incompatible-pointer-types", +] _DEFAULT_CPPOPTS.extend([ "-Wextra", diff --git a/third_party/protobuf/upb/cmake/BUILD.bazel b/third_party/protobuf/upb/cmake/BUILD.bazel index 81338ed3273f4..348c557c94d81 100644 --- a/third_party/protobuf/upb/cmake/BUILD.bazel +++ b/third_party/protobuf/upb/cmake/BUILD.bazel @@ -6,10 +6,6 @@ # https://developers.google.com/open-source/licenses/bsd load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") -load( - "//upb/bazel:build_defs.bzl", - "make_shell_script", -) load( ":build_defs.bzl", "staleness_test", @@ -28,22 +24,6 @@ py_library( visibility = ["//visibility:public"], ) -py_binary( - name = "make_cmakelists", - srcs = ["make_cmakelists.py"], -) - -genrule( - name = "gen_cmakelists", - srcs = [ - "//upb:BUILD", - ], - outs = ["generated-in/CMakeLists.txt"], - cmd = "$(location :make_cmakelists) " + - "$(location //upb:BUILD) $@", - tools = [":make_cmakelists"], -) - genrule( name = "copy_protos", srcs = [ @@ -61,7 +41,6 @@ genrule( staleness_test( name = "test_generated_files", outs = [ - "CMakeLists.txt", "google/protobuf/descriptor.upb.h", "google/protobuf/descriptor.upb_minitable.c", "google/protobuf/descriptor.upb_minitable.h", @@ -70,49 +49,10 @@ staleness_test( tags = ["manual"], ) -# Test the CMake build ######################################################### - -make_shell_script( - name = "gen_run_cmake_build", - out = "run_cmake_build.sh", - contents = "set -ex\n" + - "cd $(dirname $1) && cp -r . .. && cd ../..\n" + - "mkdir build && cd build && cmake ../cmake && make -j8 && make test", -) - -sh_test( - name = "cmake_build", - srcs = ["run_cmake_build.sh"], - args = ["$(location :gen_cmakelists)"], - data = [ - ":copy_protos", - ":gen_cmakelists", - "//third_party/utf8_range:utf8_range_srcs", - "//upb:source_files", - "//upb/base:source_files", - "//upb/hash:source_files", - "//upb/lex:source_files", - "//upb/mem:source_files", - "//upb/message:source_files", - "//upb/mini_descriptor:source_files", - "//upb/mini_table:source_files", - "//upb/port:source_files", - "//upb/reflection:source_files", - "//upb/text:source_files", - "//upb/wire:source_files", - ], - target_compatible_with = select({ - "@platforms//os:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), - deps = ["@bazel_tools//tools/bash/runfiles"], -) - pkg_files( name = "upb_cmake_dist", srcs = [ ":copy_protos", - ":gen_cmakelists", "//third_party/utf8_range:utf8_range_srcs", "//upb:source_files", "//upb/base:source_files", diff --git a/third_party/protobuf/upb/cmake/CMakeLists.txt b/third_party/protobuf/upb/cmake/CMakeLists.txt deleted file mode 100644 index 2649958d8b9a4..0000000000000 --- a/third_party/protobuf/upb/cmake/CMakeLists.txt +++ /dev/null @@ -1,96 +0,0 @@ -# This file was generated from BUILD using tools/make_cmakelists.py. - -cmake_minimum_required(VERSION 3.10...3.24) - -project(upb) -set(CMAKE_C_STANDARD 99) - -# Prevent CMake from setting -rdynamic on Linux (!!). -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set default build type. -if(NOT CMAKE_BUILD_TYPE) - message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") - set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING - "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." - FORCE) -endif() - -# When using Ninja, compiler output won't be colorized without this. -include(CheckCXXCompilerFlag) -CHECK_CXX_COMPILER_FLAG(-fdiagnostics-color=always SUPPORTS_COLOR_ALWAYS) -if(SUPPORTS_COLOR_ALWAYS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") -endif() - -# Implement ASAN/UBSAN options -if(UPB_ENABLE_ASAN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") -endif() - -if(UPB_ENABLE_UBSAN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") -endif() - -if(NOT TARGET utf8_range) - if(EXISTS ../../third_party/utf8_range) - # utf8_range is already installed - include_directories(../../third_party/utf8_range) - else() - include(FetchContent) - FetchContent_Declare( - utf8_range - GIT_REPOSITORY "https://github.com/protocolbuffers/utf8_range.git" - GIT_TAG "d863bc33e15cba6d873c878dcca9e6fe52b2f8cb" - ) - FetchContent_GetProperties(utf8_range) - if(NOT utf8_range_POPULATED) - FetchContent_Populate(utf8_range) - include_directories(${utf8_range_SOURCE_DIR}) - endif() - endif() -endif() - -if(APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup -flat_namespace") -elseif(UNIX) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id") -endif() - -enable_testing() - - -add_library(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE - -) -target_include_directories(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../cmake> - $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> -) -target_link_libraries(generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE - base - mem - message - mini_descriptor - mini_table - wire - /upb/message:internal) - -add_library(generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE - -) -target_include_directories(generated_cpp_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me INTERFACE - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../cmake> - $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> -) - - diff --git a/third_party/protobuf/upb/cmake/README.md b/third_party/protobuf/upb/cmake/README.md deleted file mode 100644 index 7204207fd5f9e..0000000000000 --- a/third_party/protobuf/upb/cmake/README.md +++ /dev/null @@ -1,23 +0,0 @@ - -# upb CMake build (EXPERIMENTAL) - -upb's CMake support is experimental. The core library builds successfully -under CMake, and this is verified by the Bazel tests in this directory. -However there is no support for building the upb compiler or for generating -.upb.c/upb.h files. This means upb's CMake support is incomplete at best, -unless your application is intended to be purely reflective. - -If you find this CMake setup useful in its current state, please consider -filing an issue so we know. If you have suggestions for how it could be -more useful (and particularly if you can contribute some code for it) -please feel free to file an issue for that too. Do keep in mind that upb -does not currently provide any ABI stability, so we want to avoid providing -a shared library. - -The CMakeLists.txt is generated from the Bazel BUILD files using the Python -scripts in this directory. We want to avoid having two separate sources of -truth that both need to be updated when a file is added or removed. - -This directory also contains some generated files that would be created -on the fly during a Bazel build. These are automatically kept in sync by -the Bazel test `//cmake:test_generated_files`. diff --git a/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb.h b/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb.h index 736f42fe5a9d1..141417f5aa3ed 100644 --- a/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb.h +++ b/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb.h @@ -75,6 +75,12 @@ typedef enum { google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 } google_protobuf_ExtensionRangeOptions_VerificationState; +typedef enum { + google_protobuf_FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + google_protobuf_FeatureSet_STYLE2024 = 1, + google_protobuf_FeatureSet_STYLE_LEGACY = 2 +} google_protobuf_FeatureSet_EnforceNamingStyle; + typedef enum { google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, google_protobuf_FeatureSet_OPEN = 1, @@ -364,11 +370,11 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_pro return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -379,7 +385,7 @@ UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -387,7 +393,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_ return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -396,11 +402,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_up return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -412,7 +418,7 @@ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDes } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -421,7 +427,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_up return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -431,11 +437,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_ return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -447,7 +453,7 @@ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_Fil } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -456,7 +462,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -466,11 +472,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -482,7 +488,7 @@ UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_ } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -491,7 +497,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_arr return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -501,11 +507,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_a return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -517,7 +523,7 @@ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_Fi } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -526,7 +532,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -536,45 +542,45 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_FileOptions* default_val = NULL; const google_protobuf_FileOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_SourceCodeInfo* default_val = NULL; const google_protobuf_SourceCodeInfo* ret; - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -585,7 +591,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -593,7 +599,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependen return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -602,11 +608,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mut return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -617,7 +623,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(co } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -625,7 +631,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -634,19 +640,19 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutab return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { @@ -675,7 +681,7 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_ upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -686,12 +692,12 @@ UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependenc } } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -703,7 +709,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protob return true; } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -715,12 +721,12 @@ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto } } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -735,7 +741,7 @@ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescripto return sub; } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -747,12 +753,12 @@ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorP } } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -767,7 +773,7 @@ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescr return sub; } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -779,12 +785,12 @@ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescript } } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -799,7 +805,7 @@ UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDe return sub; } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -811,12 +817,12 @@ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptor } } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -831,7 +837,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -844,7 +850,7 @@ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorPro return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -857,7 +863,7 @@ UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptor return sub; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -868,12 +874,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependenc } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -885,7 +891,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google return true; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -896,12 +902,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency( } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -913,7 +919,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p return true; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) { @@ -1999,67 +2005,67 @@ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(con return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } @@ -2068,19 +2074,19 @@ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(goo upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -2121,35 +2127,35 @@ UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_ return ptr; } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { @@ -2201,52 +2207,52 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) { const google_protobuf_FieldOptions* default_val = NULL; const google_protobuf_FieldOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) { @@ -2266,44 +2272,44 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { @@ -2319,15 +2325,15 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_Fi upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -2344,11 +2350,11 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -3100,51 +3106,51 @@ UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google return ptr; } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { @@ -3165,48 +3171,48 @@ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_p return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { @@ -3223,11 +3229,11 @@ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescripto return sub; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -3300,35 +3306,35 @@ UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) { int32_t default_val = 1; int32_t ret; - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) { @@ -3348,115 +3354,115 @@ UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) { bool default_val = true; bool ret; - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) { @@ -3633,11 +3639,11 @@ UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -3645,31 +3651,31 @@ UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileO upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -4018,67 +4024,67 @@ UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf return ptr; } UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { @@ -4098,75 +4104,75 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_Fi return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -4177,7 +4183,7 @@ UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -4185,7 +4191,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(cons return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -4194,11 +4200,11 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(go return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4210,7 +4216,7 @@ UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -4219,7 +4225,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -4229,45 +4235,45 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { const google_protobuf_FeatureSet* default_val = NULL; const google_protobuf_FeatureSet* ret; - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_feature_support(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_feature_support(const google_protobuf_FieldOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_feature_support(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4279,7 +4285,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Fie } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -4288,7 +4294,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_u return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -4299,19 +4305,19 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable } UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { @@ -4319,23 +4325,23 @@ UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOpt upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -4346,12 +4352,12 @@ UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf } } UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -4363,7 +4369,7 @@ UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOp return true; } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4375,12 +4381,12 @@ UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOp } } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -4395,7 +4401,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_F return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -4408,7 +4414,7 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutab return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_feature_support(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -4421,7 +4427,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_F return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4433,12 +4439,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -5049,44 +5055,44 @@ UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_feature_support(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_EnumValueOptions_feature_support(const google_protobuf_EnumValueOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_feature_support(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5098,7 +5104,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Enu } } UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5107,7 +5113,7 @@ UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_opti return arr; } UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5135,11 +5141,11 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_m return sub; } UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_EnumValueOptions_set_feature_support(google_protobuf_EnumValueOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -5152,7 +5158,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_E return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5164,12 +5170,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOption } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -5551,11 +5557,11 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_p return ptr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5567,7 +5573,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_pro } } UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5576,7 +5582,7 @@ UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array( return arr; } UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5586,104 +5592,104 @@ UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_arra return arr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) { uint64_t default_val = (uint64_t)0ull; uint64_t ret; - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) { int64_t default_val = (int64_t)0ll; int64_t ret; - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) { double default_val = 0; double ret; - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5695,12 +5701,12 @@ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_Uninte } } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -5715,27 +5721,27 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_ return sub; } UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -5949,6 +5955,22 @@ UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } +UPB_INLINE void google_protobuf_FeatureSet_clear_enforce_naming_style(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); +} +UPB_INLINE int32_t google_protobuf_FeatureSet_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, + &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); +} UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; @@ -5974,6 +5996,10 @@ UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_Featu const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } +UPB_INLINE void google_protobuf_FeatureSet_set_enforce_naming_style(google_protobuf_FeatureSet *msg, int32_t value) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_SetBaseField((upb_Message *)msg, &field, &value); +} /* google.protobuf.FeatureSetDefaults */ @@ -6380,11 +6406,11 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const goog return ptr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6395,7 +6421,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6403,7 +6429,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6412,11 +6438,11 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6427,7 +6453,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6435,7 +6461,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6444,35 +6470,35 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) { @@ -6509,7 +6535,7 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_ } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6520,12 +6546,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6537,7 +6563,7 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf return true; } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6548,12 +6574,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6565,11 +6591,11 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf return true; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { @@ -6743,11 +6769,11 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const return ptr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6758,7 +6784,7 @@ UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(cons } } UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6766,7 +6792,7 @@ UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_u return arr; } UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6775,19 +6801,19 @@ UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable return arr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) { @@ -6840,7 +6866,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6851,12 +6877,12 @@ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(go } } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6868,7 +6894,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro return true; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { diff --git a/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.c b/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.c index f641f657d63f4..cdd579f9819fc 100644 --- a/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.c +++ b/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.c @@ -49,16 +49,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileDescriptorProto__subms static const upb_MiniTableField google_protobuf_FileDescriptorProto__fields[13] = { {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; @@ -73,15 +73,15 @@ const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init = { {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x003000003f00001a, &upb_prs_1bt}, - {0x003800003f000022, &upb_prm_1bt_max128b}, - {0x004000003f01002a, &upb_prm_1bt_max128b}, - {0x004800003f020032, &upb_prm_1bt_max64b}, - {0x005000003f03003a, &upb_prm_1bt_max128b}, + {0x004000003f00001a, &upb_prs_1bt}, + {0x004800003f000022, &upb_prm_1bt_max128b}, + {0x005000003f01002a, &upb_prm_1bt_max128b}, + {0x005800003f020032, &upb_prm_1bt_max64b}, + {0x006000003f03003a, &upb_prm_1bt_max128b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x006800003f000050, &upb_prv4_1bt}, - {0x007000003f000058, &upb_prv4_1bt}, + {0x007800003f000050, &upb_prv4_1bt}, + {0x008000003f000058, &upb_prv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -237,16 +237,16 @@ const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init = { const upb_MiniTable* google__protobuf__ExtensionRangeOptions_msg_init_ptr = &google__protobuf__ExtensionRangeOptions_msg_init; static const upb_MiniTableField google_protobuf_ExtensionRangeOptions_Declaration__fields[5] = { {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init = { NULL, &google_protobuf_ExtensionRangeOptions_Declaration__fields[0], - UPB_SIZE(40, 56), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(32, 48), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.ExtensionRangeOptions.Declaration", #endif @@ -260,23 +260,23 @@ static const upb_MiniTableSubInternal google_protobuf_FieldDescriptorProto__subm }; static const upb_MiniTableField google_protobuf_FieldDescriptorProto__fields[11] = { - {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init = { &google_protobuf_FieldDescriptorProto__submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], - UPB_SIZE(80, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(72, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldDescriptorProto", #endif @@ -403,18 +403,18 @@ static const upb_MiniTableSubInternal google_protobuf_MethodDescriptorProto__sub }; static const upb_MiniTableField google_protobuf_MethodDescriptorProto__fields[6] = { - {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init = { &google_protobuf_MethodDescriptorProto__submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], - UPB_SIZE(48, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(40, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.MethodDescriptorProto", #endif @@ -430,16 +430,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileOptions__submsgs[3] = static const upb_MiniTableField google_protobuf_FileOptions__fields[21] = { {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, @@ -566,26 +566,26 @@ static const upb_MiniTableSubInternal google_protobuf_FieldOptions__submsgs[8] = }; static const upb_MiniTableField google_protobuf_FieldOptions__fields[14] = { - {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldOptions_msg_init = { &google_protobuf_FieldOptions__submsgs[0], &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(56, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(48, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldOptions", #endif @@ -788,15 +788,15 @@ static const upb_MiniTableSubInternal google_protobuf_EnumValueOptions__submsgs[ static const upb_MiniTableField google_protobuf_EnumValueOptions__fields[5] = { {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__EnumValueOptions_msg_init = { &google_protobuf_EnumValueOptions__submsgs[0], &google_protobuf_EnumValueOptions__fields[0], - UPB_SIZE(32, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(24, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.EnumValueOptions", #endif @@ -954,13 +954,13 @@ static const upb_MiniTableSubInternal google_protobuf_UninterpretedOption__subms }; static const upb_MiniTableField google_protobuf_UninterpretedOption__fields[7] = { - {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { @@ -973,7 +973,7 @@ const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f000012, &upb_prm_1bt_max64b}, + {0x004000003f000012, &upb_prm_1bt_max64b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, }) }; @@ -994,28 +994,30 @@ const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init = { }; const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init_ptr = &google__protobuf__UninterpretedOption__NamePart_msg_init; -static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[6] = { +static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[7] = { {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__FieldPresence_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnumType_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__RepeatedFieldEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__Utf8Validation_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__MessageEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__JsonFormat_enum_init}, + {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init}, }; -static const upb_MiniTableField google_protobuf_FeatureSet__fields[6] = { +static const upb_MiniTableField google_protobuf_FeatureSet__fields[7] = { {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FeatureSet_msg_init = { &google_protobuf_FeatureSet__submsgs[0], &google_protobuf_FeatureSet__fields[0], - 40, 6, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(255), 0, + 40, 7, kUpb_ExtMode_Extendable, 7, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FeatureSet", #endif @@ -1093,10 +1095,10 @@ const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init = { const upb_MiniTable* google__protobuf__SourceCodeInfo_msg_init_ptr = &google__protobuf__SourceCodeInfo_msg_init; static const upb_MiniTableField google_protobuf_SourceCodeInfo_Location__fields[5] = { - {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; @@ -1109,8 +1111,8 @@ const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f00000a, &upb_ppv4_1bt}, - {0x001800003f000012, &upb_ppv4_1bt}, + {0x003000003f00000a, &upb_ppv4_1bt}, + {0x003800003f000012, &upb_ppv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -1147,8 +1149,8 @@ static const upb_MiniTableSubInternal google_protobuf_GeneratedCodeInfo_Annotati }; static const upb_MiniTableField google_protobuf_GeneratedCodeInfo_Annotation__fields[5] = { - {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, @@ -1163,7 +1165,7 @@ const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001800003f00000a, &upb_ppv4_1bt}, + {0x002800003f00000a, &upb_ppv4_1bt}, }) }; @@ -1195,6 +1197,15 @@ const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationSta }, }; +const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init = { + 64, + 0, + { + 0x7, + 0x0, + }, +}; + const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init = { 64, 0, @@ -1366,9 +1377,10 @@ static const upb_MiniTable *messages_layout[33] = { &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, }; -static const upb_MiniTableEnum *enums_layout[17] = { +static const upb_MiniTableEnum *enums_layout[18] = { &google__protobuf__Edition_enum_init, &google__protobuf__ExtensionRangeOptions__VerificationState_enum_init, + &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init, &google__protobuf__FeatureSet__EnumType_enum_init, &google__protobuf__FeatureSet__FieldPresence_enum_init, &google__protobuf__FeatureSet__JsonFormat_enum_init, @@ -1391,7 +1403,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = { enums_layout, NULL, 33, - 17, + 18, 0, }; diff --git a/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.h b/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.h index 1dea594faf25a..a891a69038998 100644 --- a/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.h +++ b/third_party/protobuf/upb/cmake/google/protobuf/descriptor.upb_minitable.h @@ -87,6 +87,7 @@ extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_ extern const upb_MiniTableEnum google__protobuf__Edition_enum_init; extern const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationState_enum_init; +extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__FieldPresence_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__JsonFormat_enum_init; diff --git a/third_party/protobuf/upb/cmake/make_cmakelists.py b/third_party/protobuf/upb/cmake/make_cmakelists.py deleted file mode 100755 index 8135c6f205097..0000000000000 --- a/third_party/protobuf/upb/cmake/make_cmakelists.py +++ /dev/null @@ -1,346 +0,0 @@ -#!/usr/bin/python -# -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC 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. - -"""A tool to convert BUILD -> CMakeLists.txt. - -This tool is very upb-specific at the moment, and should not be seen as a -generic Bazel -> CMake converter. -""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import sys -import textwrap -import os - -def StripFirstChar(deps): - return [dep[1:] for dep in deps] - -def IsSourceFile(name): - return name.endswith(".c") or name.endswith(".cc") - - -ADD_LIBRARY_FORMAT = """ -add_library(%(name)s %(type)s - %(sources)s -) -target_include_directories(%(name)s %(keyword)s - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../cmake> - $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> -) -""" - - -class BuildFileFunctions(object): - def __init__(self, converter): - self.converter = converter - - def _add_deps(self, kwargs, keyword=""): - if "deps" not in kwargs: - return - self.converter.toplevel += "target_link_libraries(%s%s\n %s)\n" % ( - kwargs["name"], - keyword, - "\n ".join(StripFirstChar(kwargs["deps"])) - ) - - def load(self, *args): - pass - - def cc_library(self, **kwargs): - if kwargs["name"].endswith("amalgamation"): - return - if kwargs["name"] == "upbc_generator": - return - if kwargs["name"] == "lupb": - return - if "testonly" in kwargs: - return - files = kwargs.get("srcs", []) + kwargs.get("hdrs", []) - found_files = [] - pregenerated_files = [ - "CMakeLists.txt", "descriptor.upb.h", "descriptor.upb.c" - ] - for file in files: - if os.path.basename(file) in pregenerated_files: - found_files.append("../cmake/" + file) - else: - found_files.append("../" + file) - - if list(filter(IsSourceFile, files)): - # Has sources, make this a normal library. - self.converter.toplevel += ADD_LIBRARY_FORMAT % { - "name": kwargs["name"], - "type": "", - "keyword": "PUBLIC", - "sources": "\n ".join(found_files), - } - self._add_deps(kwargs) - else: - # Header-only library, have to do a couple things differently. - # For some info, see: - # http://mariobadr.com/creating-a-header-only-library-with-cmake.html - self.converter.toplevel += ADD_LIBRARY_FORMAT % { - "name": kwargs["name"], - "type": "INTERFACE", - "keyword": "INTERFACE", - "sources": "", - } - self._add_deps(kwargs, " INTERFACE") - - def cc_binary(self, **kwargs): - pass - - def cc_test(self, **kwargs): - # Disable this until we properly support upb_proto_library(). - # self.converter.toplevel += "add_executable(%s\n %s)\n" % ( - # kwargs["name"], - # "\n ".join(kwargs["srcs"]) - # ) - # self.converter.toplevel += "add_test(NAME %s COMMAND %s)\n" % ( - # kwargs["name"], - # kwargs["name"], - # ) - - # if "data" in kwargs: - # for data_dep in kwargs["data"]: - # self.converter.toplevel += textwrap.dedent("""\ - # add_custom_command( - # TARGET %s POST_BUILD - # COMMAND ${CMAKE_COMMAND} -E copy - # ${CMAKE_SOURCE_DIR}/%s - # ${CMAKE_CURRENT_BINARY_DIR}/%s)\n""" % ( - # kwargs["name"], data_dep, data_dep - # )) - - # self._add_deps(kwargs) - pass - - def cc_fuzz_test(self, **kwargs): - pass - - def pkg_files(self, **kwargs): - pass - - def py_library(self, **kwargs): - pass - - def py_binary(self, **kwargs): - pass - - def lua_proto_library(self, **kwargs): - pass - - def sh_test(self, **kwargs): - pass - - def make_shell_script(self, **kwargs): - pass - - def exports_files(self, files, **kwargs): - pass - - def proto_library(self, **kwargs): - pass - - def cc_proto_library(self, **kwargs): - pass - - def staleness_test(self, **kwargs): - pass - - def upb_amalgamation(self, **kwargs): - pass - - def upb_proto_library(self, **kwargs): - pass - - def upb_minitable_proto_library(self, **kwargs): - pass - - def upb_proto_library_copts(self, **kwargs): - pass - - def upb_proto_reflection_library(self, **kwargs): - pass - - def upb_proto_srcs(self, **kwargs): - pass - - def genrule(self, **kwargs): - pass - - def config_setting(self, **kwargs): - pass - - def upb_fasttable_enabled(self, **kwargs): - pass - - def select(self, arg_dict): - return [] - - def glob(self, *args, **kwargs): - return [] - - def licenses(self, *args): - pass - - def filegroup(self, **kwargs): - pass - - def map_dep(self, arg): - return arg - - def package_group(self, **kwargs): - pass - - def bool_flag(self, **kwargs): - pass - - def bootstrap_upb_proto_library(self, **kwargs): - pass - - def bootstrap_cc_library(self, **kwargs): - pass - - def alias(self, **kwargs): - pass - - def package(self, **kwargs): - pass - -class Converter(object): - def __init__(self): - self.toplevel = "" - self.if_lua = "" - - def convert(self): - return self.template % { - "toplevel": converter.toplevel, - } - - template = textwrap.dedent("""\ - # This file was generated from BUILD using tools/make_cmakelists.py. - - cmake_minimum_required(VERSION 3.10...3.24) - - project(upb) - set(CMAKE_C_STANDARD 99) - - # Prevent CMake from setting -rdynamic on Linux (!!). - SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") - SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - - # Set default build type. - if(NOT CMAKE_BUILD_TYPE) - message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") - set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING - "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." - FORCE) - endif() - - # When using Ninja, compiler output won't be colorized without this. - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(-fdiagnostics-color=always SUPPORTS_COLOR_ALWAYS) - if(SUPPORTS_COLOR_ALWAYS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") - endif() - - # Implement ASAN/UBSAN options - if(UPB_ENABLE_ASAN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") - endif() - - if(UPB_ENABLE_UBSAN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") - endif() - - if(NOT TARGET utf8_range) - if(EXISTS ../../third_party/utf8_range) - # utf8_range is already installed - include_directories(../../third_party/utf8_range) - else() - include(FetchContent) - FetchContent_Declare( - utf8_range - GIT_REPOSITORY "https://github.com/protocolbuffers/utf8_range.git" - GIT_TAG "d863bc33e15cba6d873c878dcca9e6fe52b2f8cb" - ) - FetchContent_GetProperties(utf8_range) - if(NOT utf8_range_POPULATED) - FetchContent_Populate(utf8_range) - include_directories(${utf8_range_SOURCE_DIR}) - endif() - endif() - endif() - - if(APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup -flat_namespace") - elseif(UNIX) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id") - endif() - - enable_testing() - - %(toplevel)s - - """) - -data = {} -converter = Converter() - -def GetDict(obj): - ret = {} - ret["UPB_DEFAULT_COPTS"] = [] # HACK - ret["UPB_DEFAULT_CPPOPTS"] = [] # HACK - for k in dir(obj): - if not k.startswith("_"): - ret[k] = getattr(obj, k); - return ret - -globs = GetDict(converter) - -# We take the BUILD path as a command-line argument to ensure that we can find -# it regardless of how exactly Bazel was invoked. -exec(open(sys.argv[1]).read(), GetDict(BuildFileFunctions(converter))) # BUILD - -with open(sys.argv[2], "w") as f: - f.write(converter.convert()) diff --git a/third_party/protobuf/upb/cmake/push_auto_update.sh b/third_party/protobuf/upb/cmake/push_auto_update.sh deleted file mode 100755 index 6b7dba00ad4d3..0000000000000 --- a/third_party/protobuf/upb/cmake/push_auto_update.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -# Protocol Buffers - Google's data interchange format -# Copyright 2023 Google LLC. 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 LLC nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This script updates checked-in generated files (currently CMakeLists.txt, -# descriptor.upb.h, and descriptor.upb.c), commits the resulting change, and -# pushes it. This does not do anything useful when run manually, but should be -# run by our GitHub action instead. - -set -ex - -# Exit early if the previous commit was made by the bot. This reduces the risk -# of a bug causing an infinite loop of auto-generated commits. -if (git log -1 --pretty=format:'%an' | grep -q "Protobuf Team Bot"); then - echo "Previous commit was authored by bot" - exit 0 -fi - -cd $(dirname -- "$0")/.. -bazel test //cmake:test_generated_files || bazel-bin/cmake/test_generated_files --fix - -# Try to determine the most recent pull request number. -title=$(git log -1 --pretty='%s') -pr_from_merge=$(echo "$title" | sed -n 's/^Merge pull request #\([0-9]\+\).*/\1/p') -pr_from_squash=$(echo "$title" | sed -n 's/^.*(#\([0-9]\+\))$/\1/p') - -pr_number="" -if [ ! -z "$pr_from_merge" ]; then - pr_number="$pr_from_merge" -elif [ ! -z "$pr_from_squash" ]; then - pr_number="$pr_from_squash" -fi - -if [ ! -z "$pr_number" ]; then - commit_message="Auto-generate CMake file lists after PR #$pr_number" -else - # If we are unable to determine the pull request number, we fall back on this - # default commit message. Typically this should not occur, but could happen - # if a pull request was merged via a rebase. - commit_message="Auto-generate CMake file lists" -fi - -git add -A -git diff --staged --quiet || git commit -am "$commit_message" -git push diff --git a/third_party/protobuf/upb/cmake/staleness_test_lib.py b/third_party/protobuf/upb/cmake/staleness_test_lib.py index d9b78a6eb7ebe..3b32405b35847 100644 --- a/third_party/protobuf/upb/cmake/staleness_test_lib.py +++ b/third_party/protobuf/upb/cmake/staleness_test_lib.py @@ -121,7 +121,7 @@ def _GetMissingAndStaleFiles(file_pairs): missing_files.append(pair) continue - with open(pair.generated) as g, open(pair.target) as t: + with open(pair.generated, 'rb') as g, open(pair.target, 'rb') as t: if g.read() != t.read(): stale_files.append(pair) diff --git a/third_party/protobuf/upb/conformance/conformance_upb_failures.txt b/third_party/protobuf/upb/conformance/conformance_upb_failures.txt index e69de29bb2d1d..67e6a5f1526ab 100644 --- a/third_party/protobuf/upb/conformance/conformance_upb_failures.txt +++ b/third_party/protobuf/upb/conformance/conformance_upb_failures.txt @@ -0,0 +1,2 @@ +Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output. +Required.*.JsonInput.AnyWithNoType.* # Failed to parse input or produce output. \ No newline at end of file diff --git a/third_party/protobuf/upb/hash/BUILD b/third_party/protobuf/upb/hash/BUILD index b7313d3979bff..39ae661516a34 100644 --- a/third_party/protobuf/upb/hash/BUILD +++ b/third_party/protobuf/upb/hash/BUILD @@ -36,9 +36,9 @@ cc_test( ":hash", "//upb:mem", "//upb:port", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_map", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/hash/common.c b/third_party/protobuf/upb/hash/common.c index f8bb7fc00a3cc..ef90baafa5685 100644 --- a/third_party/protobuf/upb/hash/common.c +++ b/third_party/protobuf/upb/hash/common.c @@ -402,8 +402,12 @@ uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed) { return Wyhash(p, n, seed, kWyhashSalt); } +// Returns a seed for upb's hash function. For now this is just a hard-coded +// constant, but we are going to randomize it soon. +static uint64_t _upb_Seed(void) { return 0x69835f69597ec1cc; } + static uint32_t _upb_Hash_NoSeed(const char* p, size_t n) { - return _upb_Hash(p, n, 0); + return _upb_Hash(p, n, _upb_Seed()); } static uint32_t strhash(upb_tabkey key) { diff --git a/third_party/protobuf/upb/io/BUILD b/third_party/protobuf/upb/io/BUILD index 700eb046d01fe..d0f6c9afcfe24 100644 --- a/third_party/protobuf/upb/io/BUILD +++ b/third_party/protobuf/upb/io/BUILD @@ -63,8 +63,8 @@ cc_test( deps = [ ":string", "//upb:mem", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -80,10 +80,10 @@ cc_test( "//upb:mem", "//upb:port", "//upb/lex", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -98,7 +98,7 @@ cc_test( ":zero_copy_stream", "//upb:base", "//upb:mem", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/json/BUILD b/third_party/protobuf/upb/json/BUILD index 18f5c0a0033f0..8184f8a2f30aa 100644 --- a/third_party/protobuf/upb/json/BUILD +++ b/third_party/protobuf/upb/json/BUILD @@ -1,5 +1,6 @@ # TODO: describe this package. +load("//bazel:proto_library.bzl", "proto_library") load( "//bazel:upb_proto_library.bzl", "upb_c_proto_library", @@ -44,8 +45,8 @@ cc_test( "//upb:base", "//upb:mem", "//upb:reflection", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -60,8 +61,8 @@ cc_test( "//upb:base", "//upb:mem", "//upb:reflection", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/json/decode.c b/third_party/protobuf/upb/json/decode.c index c14374550bdaf..0f25c4bf1e27e 100644 --- a/third_party/protobuf/upb/json/decode.c +++ b/third_party/protobuf/upb/json/decode.c @@ -674,7 +674,7 @@ static int64_t jsondec_strtoint64(jsondec* d, upb_StringView str) { static void jsondec_checkempty(jsondec* d, upb_StringView str, const upb_FieldDef* f) { if (str.size != 0) return; - d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics; + d->result = kUpb_JsonDecodeResult_Error; upb_Status_SetErrorFormat(d->status, "Empty string is not a valid number (field: %s). " "This will be an error in a future version.", @@ -782,7 +782,7 @@ static upb_MessageValue jsondec_double(jsondec* d, const upb_FieldDef* f) { char* end; val.double_val = strtod(str.data, &end); if (end != str.data + str.size) { - d->result = kUpb_JsonDecodeResult_OkWithEmptyStringNumerics; + d->result = kUpb_JsonDecodeResult_Error; upb_Status_SetErrorFormat( d->status, "Non-number characters in quoted number (field: %s). " diff --git a/third_party/protobuf/upb/json/decode.h b/third_party/protobuf/upb/json/decode.h index ffb05dc80b755..30ba2a8645682 100644 --- a/third_party/protobuf/upb/json/decode.h +++ b/third_party/protobuf/upb/json/decode.h @@ -26,7 +26,6 @@ enum { upb_JsonDecode_IgnoreUnknown = 1 }; enum { kUpb_JsonDecodeResult_Ok = 0, - kUpb_JsonDecodeResult_OkWithEmptyStringNumerics = 1, kUpb_JsonDecodeResult_Error = 2, }; diff --git a/third_party/protobuf/upb/lex/BUILD b/third_party/protobuf/upb/lex/BUILD index 91c4d11a65dc5..0ae91b27c602e 100644 --- a/third_party/protobuf/upb/lex/BUILD +++ b/third_party/protobuf/upb/lex/BUILD @@ -33,9 +33,9 @@ cc_test( srcs = ["atoi_test.cc"], deps = [ ":lex", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -44,8 +44,8 @@ cc_test( srcs = ["round_trip_test.cc"], deps = [ ":lex", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/mem/BUILD b/third_party/protobuf/upb/mem/BUILD index 9fe9092f88592..30941c0e337d8 100644 --- a/third_party/protobuf/upb/mem/BUILD +++ b/third_party/protobuf/upb/mem/BUILD @@ -46,12 +46,15 @@ cc_test( deps = [ ":mem", "//upb:port", - "@com_google_absl//absl/random", - "@com_google_absl//absl/random:distributions", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/time", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/cleanup", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/time", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/mem/alloc.h b/third_party/protobuf/upb/mem/alloc.h index 441731d2d8b59..aa01fa99a7b2b 100644 --- a/third_party/protobuf/upb/mem/alloc.h +++ b/third_party/protobuf/upb/mem/alloc.h @@ -50,6 +50,11 @@ UPB_INLINE void upb_free(upb_alloc* alloc, void* ptr) { alloc->func(alloc, ptr, 0, 0); } +UPB_INLINE void upb_free_sized(upb_alloc* alloc, void* ptr, size_t size) { + UPB_ASSERT(alloc); + alloc->func(alloc, ptr, size, 0); +} + // The global allocator used by upb. Uses the standard malloc()/free(). extern upb_alloc upb_alloc_global; diff --git a/third_party/protobuf/upb/mem/arena.c b/third_party/protobuf/upb/mem/arena.c index 435a1e10939d7..8a8ced6e5b0c1 100644 --- a/third_party/protobuf/upb/mem/arena.c +++ b/third_party/protobuf/upb/mem/arena.c @@ -21,14 +21,15 @@ // Must be last. #include "upb/port/def.inc" -static UPB_ATOMIC(size_t) max_block_size = 32 << 10; +static UPB_ATOMIC(size_t) g_max_block_size = UPB_DEFAULT_MAX_BLOCK_SIZE; -void upb_Arena_SetMaxBlockSize(size_t max) { max_block_size = max; } +void upb_Arena_SetMaxBlockSize(size_t max) { + upb_Atomic_Store(&g_max_block_size, max, memory_order_relaxed); +} typedef struct upb_MemBlock { - // Atomic only for the benefit of SpaceAllocated(). - UPB_ATOMIC(struct upb_MemBlock*) next; - uint32_t size; + struct upb_MemBlock* next; + size_t size; // Data follows. } upb_MemBlock; @@ -37,6 +38,10 @@ typedef struct upb_ArenaInternal { // block. uintptr_t block_alloc; + // The cleanup for the allocator. This is called after all the blocks are + // freed in an arena. + upb_AllocCleanupFunc* upb_alloc_cleanup; + // When multiple arenas are fused together, each arena points to a parent // arena (root points to itself). The root tracks how many live arenas // reference it. @@ -50,15 +55,19 @@ typedef struct upb_ArenaInternal { // == NULL at end of list. UPB_ATOMIC(struct upb_ArenaInternal*) next; - // The last element of the linked list. This is present only as an - // optimization, so that we do not have to iterate over all members for every - // fuse. Only significant for an arena root. In other cases it is ignored. - // == self when no other list members. - UPB_ATOMIC(struct upb_ArenaInternal*) tail; + // If the low bit is set, is a pointer to the tail of the list (populated for + // roots, set to self for roots with no fused arenas). If the low bit is not + // set, is a pointer to the previous node in the list, such that + // a->previous_or_tail->next == a. + UPB_ATOMIC(uintptr_t) previous_or_tail; - // Linked list of blocks to free/cleanup. Atomic only for the benefit of - // upb_Arena_SpaceAllocated(). - UPB_ATOMIC(upb_MemBlock*) blocks; + // Linked list of blocks to free/cleanup. + upb_MemBlock* blocks; + + // Total space allocated in blocks, atomic only for SpaceAllocated + UPB_ATOMIC(uintptr_t) space_allocated; + + UPB_TSAN_PUBLISHED_MEMBER } upb_ArenaInternal; // All public + private state for an arena. @@ -73,7 +82,7 @@ typedef struct { } upb_ArenaRoot; static const size_t kUpb_MemblockReserve = - UPB_ALIGN_UP(sizeof(upb_MemBlock), UPB_MALLOC_ALIGN); + UPB_ALIGN_MALLOC(sizeof(upb_MemBlock)); // Extracts the (upb_ArenaInternal*) from a (upb_Arena*) static upb_ArenaInternal* upb_Arena_Internal(const upb_Arena* a) { @@ -111,6 +120,38 @@ static uintptr_t _upb_Arena_TaggedFromPointer(upb_ArenaInternal* ai) { return parent_or_count; } +static bool _upb_Arena_IsTaggedTail(uintptr_t previous_or_tail) { + return (previous_or_tail & 1) == 1; +} + +static bool _upb_Arena_IsTaggedPrevious(uintptr_t previous_or_tail) { + return (previous_or_tail & 1) == 0; +} + +static upb_ArenaInternal* _upb_Arena_TailFromTagged( + uintptr_t previous_or_tail) { + UPB_ASSERT(_upb_Arena_IsTaggedTail(previous_or_tail)); + return (upb_ArenaInternal*)(previous_or_tail ^ 1); +} + +static uintptr_t _upb_Arena_TaggedFromTail(upb_ArenaInternal* tail) { + uintptr_t previous_or_tail = (uintptr_t)tail | 1; + UPB_ASSERT(_upb_Arena_IsTaggedTail(previous_or_tail)); + return previous_or_tail; +} + +static upb_ArenaInternal* _upb_Arena_PreviousFromTagged( + uintptr_t previous_or_tail) { + UPB_ASSERT(_upb_Arena_IsTaggedPrevious(previous_or_tail)); + return (upb_ArenaInternal*)previous_or_tail; +} + +static uintptr_t _upb_Arena_TaggedFromPrevious(upb_ArenaInternal* ai) { + uintptr_t previous = (uintptr_t)ai; + UPB_ASSERT(_upb_Arena_IsTaggedPrevious(previous)); + return previous; +} + static upb_alloc* _upb_ArenaInternal_BlockAlloc(upb_ArenaInternal* ai) { return (upb_alloc*)(ai->block_alloc & ~0x1); } @@ -157,56 +198,79 @@ void upb_Arena_LogFree(const upb_Arena* arena) { } #endif // UPB_TRACING_ENABLED -static upb_ArenaRoot _upb_Arena_FindRoot(upb_Arena* a) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - while (_upb_Arena_IsTaggedPointer(poc)) { +// If the param a is already the root, provides no memory order of refcount. +// If it has a parent, then acquire memory order is provided for both the root +// and the refcount. Thread safe. +static upb_ArenaRoot _upb_Arena_FindRoot(upb_ArenaInternal* ai) { + uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_relaxed); + if (_upb_Arena_IsTaggedRefcount(poc)) { + // Fast, relaxed path - arenas that have never been fused to a parent only + // need relaxed memory order, since they're returning themselves and the + // refcount. + return (upb_ArenaRoot){.root = ai, .tagged_count = poc}; + } + // Slow path needs acquire order; reloading is cheaper than a fence on ARM + // (LDA vs DMB ISH). Even though this is a reread, we know it must be a tagged + // pointer because if this Arena isn't a root, it can't ever become one. + poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); + do { upb_ArenaInternal* next = _upb_Arena_PointerFromTagged(poc); + UPB_TSAN_CHECK_PUBLISHED(next); UPB_ASSERT(ai != next); - uintptr_t next_poc = - upb_Atomic_Load(&next->parent_or_count, memory_order_acquire); + poc = upb_Atomic_Load(&next->parent_or_count, memory_order_acquire); - if (_upb_Arena_IsTaggedPointer(next_poc)) { + if (_upb_Arena_IsTaggedPointer(poc)) { // To keep complexity down, we lazily collapse levels of the tree. This // keeps it flat in the final case, but doesn't cost much incrementally. // // Path splitting keeps time complexity down, see: // https://en.wikipedia.org/wiki/Disjoint-set_data_structure - // - // We can safely use a relaxed atomic here because all threads doing this - // will converge on the same value and we don't need memory orderings to - // be visible. - // - // This is true because: - // - If no fuses occur, this will eventually become the root. - // - If fuses are actively occurring, the root may change, but the - // invariant is that `parent_or_count` merely points to *a* parent. - // - // In other words, it is moving towards "the" root, and that root may move - // further away over time, but the path towards that root will continue to - // be valid and the creation of the path carries all the memory orderings - // required. - UPB_ASSERT(ai != _upb_Arena_PointerFromTagged(next_poc)); - upb_Atomic_Store(&ai->parent_or_count, next_poc, memory_order_relaxed); + UPB_ASSERT(ai != _upb_Arena_PointerFromTagged(poc)); + upb_Atomic_Store(&ai->parent_or_count, poc, memory_order_release); } ai = next; - poc = next_poc; - } + } while (_upb_Arena_IsTaggedPointer(poc)); return (upb_ArenaRoot){.root = ai, .tagged_count = poc}; } -size_t upb_Arena_SpaceAllocated(upb_Arena* arena, size_t* fused_count) { - upb_ArenaInternal* ai = _upb_Arena_FindRoot(arena).root; - size_t memsize = 0; +uintptr_t upb_Arena_SpaceAllocated(const upb_Arena* arena, + size_t* fused_count) { + upb_ArenaInternal* ai = upb_Arena_Internal(arena); + uintptr_t memsize = 0; size_t local_fused_count = 0; - + // Our root would get updated by any racing fuses before our target arena + // became reachable from the root via the linked list; in order to preserve + // monotonic output (any arena counted by a previous invocation is counted by + // this one), we instead iterate forwards and backwards so that we only see + // the results of completed fuses. + uintptr_t previous_or_tail = + upb_Atomic_Load(&ai->previous_or_tail, memory_order_acquire); + while (_upb_Arena_IsTaggedPrevious(previous_or_tail)) { + upb_ArenaInternal* previous = + _upb_Arena_PreviousFromTagged(previous_or_tail); + UPB_ASSERT(previous != ai); + UPB_TSAN_CHECK_PUBLISHED(previous); + // Unfortunate macro behavior; prior to C11 when using nonstandard atomics + // this returns a void* and can't be used with += without an intermediate + // conversion to an integer. + // Relaxed is safe - no subsequent reads depend this one + uintptr_t allocated = + upb_Atomic_Load(&previous->space_allocated, memory_order_relaxed); + memsize += allocated; + previous_or_tail = + upb_Atomic_Load(&previous->previous_or_tail, memory_order_acquire); + local_fused_count++; + } while (ai != NULL) { - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_relaxed); - while (block != NULL) { - memsize += sizeof(upb_MemBlock) + block->size; - block = upb_Atomic_Load(&block->next, memory_order_relaxed); - } - ai = upb_Atomic_Load(&ai->next, memory_order_relaxed); + UPB_TSAN_CHECK_PUBLISHED(ai); + // Unfortunate macro behavior; prior to C11 when using nonstandard atomics + // this returns a void* and can't be used with += without an intermediate + // conversion to an integer. + // Relaxed is safe - no subsequent reads depend this one + uintptr_t allocated = + upb_Atomic_Load(&ai->space_allocated, memory_order_relaxed); + memsize += allocated; + ai = upb_Atomic_Load(&ai->next, memory_order_acquire); local_fused_count++; } @@ -214,44 +278,24 @@ size_t upb_Arena_SpaceAllocated(upb_Arena* arena, size_t* fused_count) { return memsize; } -bool UPB_PRIVATE(_upb_Arena_Contains)(const upb_Arena* a, void* ptr) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - UPB_ASSERT(ai); - - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_relaxed); - while (block) { - uintptr_t beg = (uintptr_t)block; - uintptr_t end = beg + block->size; - if ((uintptr_t)ptr >= beg && (uintptr_t)ptr < end) return true; - block = upb_Atomic_Load(&block->next, memory_order_relaxed); - } - - return false; +uint32_t upb_Arena_DebugRefCount(const upb_Arena* a) { + uintptr_t tagged = _upb_Arena_FindRoot(upb_Arena_Internal(a)).tagged_count; + return (uint32_t)_upb_Arena_RefCountFromTagged(tagged); } -uint32_t upb_Arena_DebugRefCount(upb_Arena* a) { - upb_ArenaInternal* ai = upb_Arena_Internal(a); - // These loads could probably be relaxed, but given that this is debug-only, - // it's not worth introducing a new variant for it. - uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - while (_upb_Arena_IsTaggedPointer(poc)) { - ai = _upb_Arena_PointerFromTagged(poc); - poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); - } - return _upb_Arena_RefCountFromTagged(poc); -} - -static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t size) { +static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t offset, + size_t block_size) { upb_ArenaInternal* ai = upb_Arena_Internal(a); upb_MemBlock* block = ptr; + block->size = block_size; // Insert into linked list. - block->size = (uint32_t)size; - upb_Atomic_Init(&block->next, ai->blocks); - upb_Atomic_Store(&ai->blocks, block, memory_order_release); + block->next = ai->blocks; + ai->blocks = block; - a->UPB_PRIVATE(ptr) = UPB_PTR_AT(block, kUpb_MemblockReserve, char); - a->UPB_PRIVATE(end) = UPB_PTR_AT(block, size, char); + UPB_ASSERT(offset >= kUpb_MemblockReserve); + a->UPB_PRIVATE(ptr) = UPB_PTR_AT(block, offset, char); + a->UPB_PRIVATE(end) = UPB_PTR_AT(block, block_size, char); UPB_POISON_MEMORY_REGION(a->UPB_PRIVATE(ptr), a->UPB_PRIVATE(end) - a->UPB_PRIVATE(ptr)); @@ -260,21 +304,37 @@ static void _upb_Arena_AddBlock(upb_Arena* a, void* ptr, size_t size) { static bool _upb_Arena_AllocBlock(upb_Arena* a, size_t size) { upb_ArenaInternal* ai = upb_Arena_Internal(a); if (!ai->block_alloc) return false; - upb_MemBlock* last_block = upb_Atomic_Load(&ai->blocks, memory_order_acquire); - size_t last_size = last_block != NULL ? last_block->size : 128; + size_t last_size = 128; + upb_MemBlock* last_block = ai->blocks; + if (last_block) { + last_size = a->UPB_PRIVATE(end) - (char*)last_block; + } + + // Relaxed order is safe here as we don't need any ordering with the setter. + size_t max_block_size = + upb_Atomic_Load(&g_max_block_size, memory_order_relaxed); // Don't naturally grow beyond the max block size. size_t clamped_size = UPB_MIN(last_size * 2, max_block_size); // We may need to exceed the max block size if the user requested a large // allocation. - size_t block_size = UPB_MAX(size, clamped_size) + kUpb_MemblockReserve; + size_t block_size = UPB_MAX(kUpb_MemblockReserve + size, clamped_size); upb_MemBlock* block = upb_malloc(_upb_ArenaInternal_BlockAlloc(ai), block_size); if (!block) return false; - _upb_Arena_AddBlock(a, block, block_size); + _upb_Arena_AddBlock(a, block, kUpb_MemblockReserve, block_size); + // Atomic add not required here, as threads won't race allocating blocks, plus + // atomic fetch-add is slower than load/add/store on arm devices compiled + // targetting pre-v8.1. Relaxed order is safe as nothing depends on order of + // size allocated. + + uintptr_t old_space_allocated = + upb_Atomic_Load(&ai->space_allocated, memory_order_relaxed); + upb_Atomic_Store(&ai->space_allocated, old_space_allocated + block_size, + memory_order_relaxed); UPB_ASSERT(UPB_PRIVATE(_upb_ArenaHas)(a) >= size); return true; } @@ -284,28 +344,33 @@ void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(upb_Arena* a, size_t size) { return upb_Arena_Malloc(a, size - UPB_ASAN_GUARD_SIZE); } -static upb_Arena* _upb_Arena_InitSlow(upb_alloc* alloc) { +static upb_Arena* _upb_Arena_InitSlow(upb_alloc* alloc, size_t first_size) { const size_t first_block_overhead = - sizeof(upb_ArenaState) + kUpb_MemblockReserve; + UPB_ALIGN_MALLOC(kUpb_MemblockReserve + sizeof(upb_ArenaState)); upb_ArenaState* a; // We need to malloc the initial block. char* mem; - size_t n = first_block_overhead + 256; - if (!alloc || !(mem = upb_malloc(alloc, n))) { + size_t block_size = + first_block_overhead + + UPB_MAX(256, UPB_ALIGN_MALLOC(first_size) + UPB_ASAN_GUARD_SIZE); + if (!alloc || !(mem = upb_malloc(alloc, block_size))) { return NULL; } - a = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), upb_ArenaState); - n -= sizeof(upb_ArenaState); + a = UPB_PTR_AT(mem, kUpb_MemblockReserve, upb_ArenaState); a->body.block_alloc = _upb_Arena_MakeBlockAlloc(alloc, 0); upb_Atomic_Init(&a->body.parent_or_count, _upb_Arena_TaggedFromRefcount(1)); upb_Atomic_Init(&a->body.next, NULL); - upb_Atomic_Init(&a->body.tail, &a->body); - upb_Atomic_Init(&a->body.blocks, NULL); + upb_Atomic_Init(&a->body.previous_or_tail, + _upb_Arena_TaggedFromTail(&a->body)); + upb_Atomic_Init(&a->body.space_allocated, block_size); + a->body.blocks = NULL; + a->body.upb_alloc_cleanup = NULL; + UPB_TSAN_INIT_PUBLISHED(&a->body); - _upb_Arena_AddBlock(&a->head, mem, n); + _upb_Arena_AddBlock(&a->head, mem, first_block_overhead, block_size); return &a->head; } @@ -314,38 +379,34 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) { UPB_ASSERT(sizeof(void*) * UPB_ARENA_SIZE_HACK >= sizeof(upb_ArenaState)); upb_ArenaState* a; - if (n) { + if (mem) { /* Align initial pointer up so that we return properly-aligned pointers. */ - void* aligned = (void*)UPB_ALIGN_UP((uintptr_t)mem, UPB_MALLOC_ALIGN); + void* aligned = (void*)UPB_ALIGN_MALLOC((uintptr_t)mem); size_t delta = (uintptr_t)aligned - (uintptr_t)mem; n = delta <= n ? n - delta : 0; mem = aligned; } - - /* Round block size down to alignof(*a) since we will allocate the arena - * itself at the end. */ - n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_ArenaState)); - - if (UPB_UNLIKELY(n < sizeof(upb_ArenaState))) { + if (UPB_UNLIKELY(n < sizeof(upb_ArenaState) || !mem)) { + upb_Arena* ret = _upb_Arena_InitSlow(alloc, mem ? 0 : n); #ifdef UPB_TRACING_ENABLED - upb_Arena* ret = _upb_Arena_InitSlow(alloc); upb_Arena_LogInit(ret, n); - return ret; -#else - return _upb_Arena_InitSlow(alloc); #endif + return ret; } - a = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), upb_ArenaState); + a = mem; upb_Atomic_Init(&a->body.parent_or_count, _upb_Arena_TaggedFromRefcount(1)); upb_Atomic_Init(&a->body.next, NULL); - upb_Atomic_Init(&a->body.tail, &a->body); - upb_Atomic_Init(&a->body.blocks, NULL); - + upb_Atomic_Init(&a->body.previous_or_tail, + _upb_Arena_TaggedFromTail(&a->body)); + upb_Atomic_Init(&a->body.space_allocated, 0); + a->body.blocks = NULL; + a->body.upb_alloc_cleanup = NULL; a->body.block_alloc = _upb_Arena_MakeBlockAlloc(alloc, 1); - a->head.UPB_PRIVATE(ptr) = mem; - a->head.UPB_PRIVATE(end) = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), char); + a->head.UPB_PRIVATE(ptr) = (void*)UPB_ALIGN_MALLOC((uintptr_t)(a + 1)); + a->head.UPB_PRIVATE(end) = UPB_PTR_AT(mem, n, char); + UPB_TSAN_INIT_PUBLISHED(&a->body); #ifdef UPB_TRACING_ENABLED upb_Arena_LogInit(&a->head, n); #endif @@ -355,28 +416,40 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) { static void _upb_Arena_DoFree(upb_ArenaInternal* ai) { UPB_ASSERT(_upb_Arena_RefCountFromTagged(ai->parent_or_count) == 1); while (ai != NULL) { + UPB_TSAN_CHECK_PUBLISHED(ai); // Load first since arena itself is likely from one of its blocks. upb_ArenaInternal* next_arena = (upb_ArenaInternal*)upb_Atomic_Load(&ai->next, memory_order_acquire); + // Freeing may have memory barriers that confuse tsan, so assert immdiately + // after load here + if (next_arena) { + UPB_TSAN_CHECK_PUBLISHED(next_arena); + } upb_alloc* block_alloc = _upb_ArenaInternal_BlockAlloc(ai); - upb_MemBlock* block = upb_Atomic_Load(&ai->blocks, memory_order_acquire); + upb_MemBlock* block = ai->blocks; + upb_AllocCleanupFunc* alloc_cleanup = *ai->upb_alloc_cleanup; while (block != NULL) { // Load first since we are deleting block. - upb_MemBlock* next_block = - upb_Atomic_Load(&block->next, memory_order_acquire); - upb_free(block_alloc, block); + upb_MemBlock* next_block = block->next; + upb_free_sized(block_alloc, block, block->size); block = next_block; } + if (alloc_cleanup != NULL) { + alloc_cleanup(block_alloc); + } ai = next_arena; } } void upb_Arena_Free(upb_Arena* a) { upb_ArenaInternal* ai = upb_Arena_Internal(a); + // Cannot be replaced with _upb_Arena_FindRoot, as that provides only a + // relaxed read of the refcount if ai is already the root. uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); retry: while (_upb_Arena_IsTaggedPointer(poc)) { ai = _upb_Arena_PointerFromTagged(poc); + UPB_TSAN_CHECK_PUBLISHED(ai); poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire); } @@ -406,32 +479,70 @@ retry: static void _upb_Arena_DoFuseArenaLists(upb_ArenaInternal* const parent, upb_ArenaInternal* child) { - upb_ArenaInternal* parent_tail = - upb_Atomic_Load(&parent->tail, memory_order_relaxed); - - do { + UPB_TSAN_CHECK_PUBLISHED(parent); + uintptr_t parent_previous_or_tail = + upb_Atomic_Load(&parent->previous_or_tail, memory_order_acquire); + upb_ArenaInternal* parent_tail = parent; + if (_upb_Arena_IsTaggedTail(parent_previous_or_tail)) { // Our tail might be stale, but it will always converge to the true tail. + parent_tail = _upb_Arena_TailFromTagged(parent_previous_or_tail); + } + + // Link parent to child going forwards + while (true) { + UPB_TSAN_CHECK_PUBLISHED(parent_tail); upb_ArenaInternal* parent_tail_next = - upb_Atomic_Load(&parent_tail->next, memory_order_relaxed); + upb_Atomic_Load(&parent_tail->next, memory_order_acquire); while (parent_tail_next != NULL) { parent_tail = parent_tail_next; + UPB_TSAN_CHECK_PUBLISHED(parent_tail); parent_tail_next = - upb_Atomic_Load(&parent_tail->next, memory_order_relaxed); + upb_Atomic_Load(&parent_tail->next, memory_order_acquire); } + if (upb_Atomic_CompareExchangeWeak(&parent_tail->next, &parent_tail_next, + child, memory_order_release, + memory_order_acquire)) { + break; + } + if (parent_tail_next != NULL) { + parent_tail = parent_tail_next; + } + } - upb_ArenaInternal* displaced = - upb_Atomic_Exchange(&parent_tail->next, child, memory_order_relaxed); - parent_tail = upb_Atomic_Load(&child->tail, memory_order_relaxed); + // Update parent's tail (may be stale). + uintptr_t child_previous_or_tail = + upb_Atomic_Load(&child->previous_or_tail, memory_order_acquire); + upb_ArenaInternal* new_parent_tail = + _upb_Arena_TailFromTagged(child_previous_or_tail); + UPB_TSAN_CHECK_PUBLISHED(new_parent_tail); - // If we displaced something that got installed racily, we can simply - // reinstall it on our new tail. - child = displaced; - } while (child != NULL); + // If another thread fused with us, don't overwrite their previous pointer + // with our tail. Relaxed order is fine here as we only inspect the tag bit + parent_previous_or_tail = + upb_Atomic_Load(&parent->previous_or_tail, memory_order_relaxed); + if (_upb_Arena_IsTaggedTail(parent_previous_or_tail)) { + upb_Atomic_CompareExchangeStrong( + &parent->previous_or_tail, &parent_previous_or_tail, + _upb_Arena_TaggedFromTail(new_parent_tail), memory_order_release, + memory_order_relaxed); + } - upb_Atomic_Store(&parent->tail, parent_tail, memory_order_relaxed); + // Link child to parent going backwards, for SpaceAllocated + upb_Atomic_Store(&child->previous_or_tail, + _upb_Arena_TaggedFromPrevious(parent_tail), + memory_order_release); } -static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, +void upb_Arena_SetAllocCleanup(upb_Arena* a, upb_AllocCleanupFunc* func) { + UPB_TSAN_CHECK_READ(a->UPB_ONLYBITS(ptr)); + upb_ArenaInternal* ai = upb_Arena_Internal(a); + UPB_ASSERT(ai->upb_alloc_cleanup == NULL); + ai->upb_alloc_cleanup = func; +} + +// Thread safe. +static upb_ArenaInternal* _upb_Arena_DoFuse(upb_ArenaInternal** ai1, + upb_ArenaInternal** ai2, uintptr_t* ref_delta) { // `parent_or_count` has two distinct modes // - parent pointer mode @@ -440,11 +551,14 @@ static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, // In parent pointer mode, it may change what pointer it refers to in the // tree, but it will always approach a root. Any operation that walks the // tree to the root may collapse levels of the tree concurrently. - upb_ArenaRoot r1 = _upb_Arena_FindRoot(a1); - upb_ArenaRoot r2 = _upb_Arena_FindRoot(a2); + upb_ArenaRoot r1 = _upb_Arena_FindRoot(*ai1); + upb_ArenaRoot r2 = _upb_Arena_FindRoot(*ai2); if (r1.root == r2.root) return r1.root; // Already fused. + *ai1 = r1.root; + *ai2 = r2.root; + // Avoid cycles by always fusing into the root with the lower address. if ((uintptr_t)r1.root > (uintptr_t)r2.root) { upb_ArenaRoot tmp = r1; @@ -490,20 +604,33 @@ static upb_ArenaInternal* _upb_Arena_DoFuse(upb_Arena* a1, upb_Arena* a2, return r1.root; } +// Thread safe. static bool _upb_Arena_FixupRefs(upb_ArenaInternal* new_root, uintptr_t ref_delta) { if (ref_delta == 0) return true; // No fixup required. + // Relaxed order is safe here as if the value is a pointer, we don't deref it + // or publish it anywhere else. The refcount does provide memory order + // between allocations on arenas and the eventual free and thus normally + // requires acquire/release; but in this case any edges provided by the refs + // we are cleaning up were already provided by the fuse operation itself. It's + // not valid for a decrement that could cause the overall fused arena to reach + // a zero refcount to race with this function, as that could result in a + // use-after-free anyway. uintptr_t poc = upb_Atomic_Load(&new_root->parent_or_count, memory_order_relaxed); if (_upb_Arena_IsTaggedPointer(poc)) return false; uintptr_t with_refs = poc - ref_delta; UPB_ASSERT(!_upb_Arena_IsTaggedPointer(with_refs)); + // Relaxed order on success is safe here, for the same reasons as the relaxed + // read above. Relaxed order is safe on failure because the updated value is + // stored in a local variable which goes immediately out of scope; the retry + // loop will reread what it needs with proper memory order. return upb_Atomic_CompareExchangeStrong(&new_root->parent_or_count, &poc, with_refs, memory_order_relaxed, memory_order_relaxed); } -bool upb_Arena_Fuse(upb_Arena* a1, upb_Arena* a2) { +bool upb_Arena_Fuse(const upb_Arena* a1, const upb_Arena* a2) { if (a1 == a2) return true; // trivial fuse #ifdef UPB_TRACING_ENABLED @@ -523,25 +650,46 @@ bool upb_Arena_Fuse(upb_Arena* a1, upb_Arena* a2) { // The number of refs we ultimately need to transfer to the new root. uintptr_t ref_delta = 0; while (true) { - upb_ArenaInternal* new_root = _upb_Arena_DoFuse(a1, a2, &ref_delta); + upb_ArenaInternal* new_root = _upb_Arena_DoFuse(&ai1, &ai2, &ref_delta); if (new_root != NULL && _upb_Arena_FixupRefs(new_root, ref_delta)) { return true; } } } -bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner) { +bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b) { + if (a == b) return true; // trivial fuse + upb_ArenaInternal* ra = _upb_Arena_FindRoot(upb_Arena_Internal(a)).root; + upb_ArenaInternal* rb = upb_Arena_Internal(b); + while (true) { + rb = _upb_Arena_FindRoot(rb).root; + if (ra == rb) return true; + upb_ArenaInternal* tmp = _upb_Arena_FindRoot(ra).root; + if (ra == tmp) return false; + // a's root changed since we last checked. Retry. + ra = tmp; + } +} + +bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner) { upb_ArenaInternal* ai = upb_Arena_Internal(a); if (_upb_ArenaInternal_HasInitialBlock(ai)) return false; upb_ArenaRoot r; + r.root = ai; retry: - r = _upb_Arena_FindRoot(a); + r = _upb_Arena_FindRoot(r.root); if (upb_Atomic_CompareExchangeWeak( &r.root->parent_or_count, &r.tagged_count, _upb_Arena_TaggedFromRefcount( _upb_Arena_RefCountFromTagged(r.tagged_count) + 1), - memory_order_release, memory_order_acquire)) { + // Relaxed order is safe on success, incrementing the refcount + // need not perform any synchronization with the eventual free of the + // arena - that's provided by decrements. + memory_order_relaxed, + // Relaxed order is safe on failure as r.tagged_count is immediately + // overwritten by retrying the find root operation. + memory_order_relaxed)) { // We incremented it successfully, so we are done. return true; } @@ -549,7 +697,15 @@ retry: goto retry; } -void upb_Arena_DecRefFor(upb_Arena* a, const void* owner) { upb_Arena_Free(a); } +void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner) { + upb_Arena_Free((upb_Arena*)a); +} + +upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a) { + UPB_TSAN_CHECK_READ(a->UPB_ONLYBITS(ptr)); + upb_ArenaInternal* ai = upb_Arena_Internal(a); + return _upb_ArenaInternal_BlockAlloc(ai); +} void UPB_PRIVATE(_upb_Arena_SwapIn)(upb_Arena* des, const upb_Arena* src) { upb_ArenaInternal* desi = upb_Arena_Internal(des); @@ -557,8 +713,7 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(upb_Arena* des, const upb_Arena* src) { *des = *src; desi->block_alloc = srci->block_alloc; - upb_MemBlock* blocks = upb_Atomic_Load(&srci->blocks, memory_order_relaxed); - upb_Atomic_Init(&desi->blocks, blocks); + desi->blocks = srci->blocks; } void UPB_PRIVATE(_upb_Arena_SwapOut)(upb_Arena* des, const upb_Arena* src) { @@ -566,6 +721,5 @@ void UPB_PRIVATE(_upb_Arena_SwapOut)(upb_Arena* des, const upb_Arena* src) { upb_ArenaInternal* srci = upb_Arena_Internal(src); *des = *src; - upb_MemBlock* blocks = upb_Atomic_Load(&srci->blocks, memory_order_relaxed); - upb_Atomic_Store(&desi->blocks, blocks, memory_order_relaxed); + desi->blocks = srci->blocks; } diff --git a/third_party/protobuf/upb/mem/arena.h b/third_party/protobuf/upb/mem/arena.h index 2ad4f5d2fa5a0..121b223040266 100644 --- a/third_party/protobuf/upb/mem/arena.h +++ b/third_party/protobuf/upb/mem/arena.h @@ -11,7 +11,8 @@ * to be freed. However the Arena does allow users to register cleanup * functions that will run when the arena is destroyed. * - * A upb_Arena is *not* thread-safe. + * A upb_Arena is *not* thread-safe, although some functions related to its + * managing its lifetime are, and are documented as such. * * You could write a thread-safe arena allocator that satisfies the * upb_alloc interface, but it would not be as efficient for the @@ -31,33 +32,67 @@ typedef struct upb_Arena upb_Arena; +typedef void upb_AllocCleanupFunc(upb_alloc* alloc); + #ifdef __cplusplus extern "C" { #endif -// Creates an arena from the given initial block (if any -- n may be 0). -// Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this -// is a fixed-size arena and cannot grow. +// Creates an arena from the given initial block (if any -- mem may be NULL). If +// an initial block is specified, the arena's lifetime cannot be extended by +// |upb_Arena_IncRefFor| or |upb_Arena_Fuse|. Additional blocks will be +// allocated from |alloc|. If |alloc| is NULL, this is a fixed-size arena and +// cannot grow. If an initial block is specified, |n| is its length; if there is +// no initial block, |n| is a hint of the size that should be allocated for the +// first block of the arena, such that `upb_Arena_Malloc(hint)` will not require +// another call to |alloc|. UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc); UPB_API void upb_Arena_Free(upb_Arena* a); -UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b); +// Sets the cleanup function for the upb_alloc used by the arena. Only one +// cleanup function can be set, which will be called after all blocks are +// freed. +UPB_API void upb_Arena_SetAllocCleanup(upb_Arena* a, + upb_AllocCleanupFunc* func); -bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner); -void upb_Arena_DecRefFor(upb_Arena* a, const void* owner); +// Fuses the lifetime of two arenas, such that no arenas that have been +// transitively fused together will be freed until all of them have reached a +// zero refcount. This operation is safe to use concurrently from multiple +// threads. +UPB_API bool upb_Arena_Fuse(const upb_Arena* a, const upb_Arena* b); -size_t upb_Arena_SpaceAllocated(upb_Arena* a, size_t* fused_count); -uint32_t upb_Arena_DebugRefCount(upb_Arena* a); +// This operation is safe to use concurrently from multiple threads. +UPB_API bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b); + +// Returns the upb_alloc used by the arena. +UPB_API upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a); + +// This operation is safe to use concurrently from multiple threads. +bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner); +// This operation is safe to use concurrently from multiple threads. +void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner); + +// This operation is safe to use concurrently from multiple threads. +uintptr_t upb_Arena_SpaceAllocated(const upb_Arena* a, size_t* fused_count); +// This operation is safe to use concurrently from multiple threads. +uint32_t upb_Arena_DebugRefCount(const upb_Arena* a); UPB_API_INLINE upb_Arena* upb_Arena_New(void) { return upb_Arena_Init(NULL, 0, &upb_alloc_global); } +UPB_API_INLINE upb_Arena* upb_Arena_NewSized(size_t size_hint) { + return upb_Arena_Init(NULL, size_hint, &upb_alloc_global); +} + UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size); UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, size_t size); +static const size_t UPB_PRIVATE(kUpbDefaultMaxBlockSize) = + UPB_DEFAULT_MAX_BLOCK_SIZE; + // Sets the maximum block size for all arenas. This is a global configuration // setting that will affect all existing and future arenas. If // upb_Arena_Malloc() is called with a size larger than this, we will exceed @@ -65,6 +100,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize, // // This API is meant for experimentation only. It will likely be removed in // the future. +// This operation is safe to use concurrently from multiple threads. void upb_Arena_SetMaxBlockSize(size_t max); // Shrinks the last alloc from arena. diff --git a/third_party/protobuf/upb/mem/arena.hpp b/third_party/protobuf/upb/mem/arena.hpp index 420adfa463c30..2ac0731ec6a03 100644 --- a/third_party/protobuf/upb/mem/arena.hpp +++ b/third_party/protobuf/upb/mem/arena.hpp @@ -8,8 +8,10 @@ #ifndef UPB_MEM_ARENA_HPP_ #define UPB_MEM_ARENA_HPP_ +#include "upb/mem/alloc.h" #ifdef __cplusplus +#include <cstddef> #include <memory> #include "upb/mem/arena.h" @@ -23,6 +25,8 @@ class Arena { Arena(char* initial_block, size_t size) : ptr_(upb_Arena_Init(initial_block, size, &upb_alloc_global), upb_Arena_Free) {} + explicit Arena(size_t size) + : ptr_(upb_Arena_NewSized(size), upb_Arena_Free) {} upb_Arena* ptr() const { return ptr_.get(); } @@ -35,26 +39,6 @@ class Arena { protected: std::unique_ptr<upb_Arena, decltype(&upb_Arena_Free)> ptr_; }; - -// InlinedArena seeds the arenas with a predefined amount of memory. No heap -// memory will be allocated until the initial block is exceeded. -template <int N> -class InlinedArena : public Arena { - public: - InlinedArena() : Arena(initial_block_, N) {} - ~InlinedArena() { - // Explicitly destroy the arena now so that it does not outlive - // initial_block_. - ptr_.reset(); - } - - private: - InlinedArena(const InlinedArena&) = delete; - InlinedArena& operator=(const InlinedArena&) = delete; - - char initial_block_[N]; -}; - } // namespace upb #endif // __cplusplus diff --git a/third_party/protobuf/upb/mem/arena_test.cc b/third_party/protobuf/upb/mem/arena_test.cc index 2f0647ff27f7f..752ff5f6d7de8 100644 --- a/third_party/protobuf/upb/mem/arena_test.cc +++ b/third_party/protobuf/upb/mem/arena_test.cc @@ -9,24 +9,270 @@ #include <stddef.h> +#include <algorithm> #include <array> -#include <atomic> +#include <cstddef> +#include <cstdint> +#include <cstdlib> +#include <memory> #include <thread> +#include <type_traits> #include <vector> +#include <gmock/gmock.h> #include <gtest/gtest.h> +#include "absl/base/thread_annotations.h" +#include "absl/cleanup/cleanup.h" +#include "absl/container/flat_hash_map.h" #include "absl/random/distributions.h" #include "absl/random/random.h" +#include "absl/synchronization/mutex.h" #include "absl/synchronization/notification.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "upb/mem/alloc.h" +#include "upb/mem/arena.hpp" // Must be last. #include "upb/port/def.inc" namespace { +struct CustomAlloc { + upb_alloc alloc; + int counter; + bool ran_cleanup; +}; + +void* CustomAllocFunc(upb_alloc* alloc, void* ptr, size_t oldsize, + size_t size) { + CustomAlloc* custom_alloc = reinterpret_cast<CustomAlloc*>(alloc); + if (size == 0) { + custom_alloc->counter--; + } else { + custom_alloc->counter++; + } + return upb_alloc_global.func(alloc, ptr, oldsize, size); +} + +void CustomAllocCleanup(upb_alloc* alloc) { + CustomAlloc* custom_alloc = reinterpret_cast<CustomAlloc*>(alloc); + EXPECT_THAT(custom_alloc->counter, 0); + custom_alloc->ran_cleanup = true; +} + +TEST(ArenaTest, ArenaWithAllocCleanup) { + CustomAlloc alloc = {{&CustomAllocFunc}, 0, false}; + upb_Arena* arena = + upb_Arena_Init(nullptr, 0, reinterpret_cast<upb_alloc*>(&alloc)); + EXPECT_EQ(alloc.counter, 1); + upb_Arena_SetAllocCleanup(arena, CustomAllocCleanup); + upb_Arena_Free(arena); + EXPECT_TRUE(alloc.ran_cleanup); +} + +struct SizeTracker { + upb_alloc alloc; + upb_alloc* delegate_alloc; + absl::flat_hash_map<void*, size_t>* sizes; +}; + +static_assert(std::is_standard_layout<SizeTracker>()); + +static void* size_checking_allocfunc(upb_alloc* alloc, void* ptr, + size_t oldsize, size_t size) { + SizeTracker* size_alloc = reinterpret_cast<SizeTracker*>(alloc); + void* result = size_alloc->delegate_alloc->func(alloc, ptr, oldsize, size); + if (ptr != nullptr) { + UPB_ASSERT(size_alloc->sizes->at(ptr) == oldsize); + size_alloc->sizes->erase(ptr); + } + if (result != nullptr) { + size_alloc->sizes->emplace(result, size); + } + return result; +} + +TEST(ArenaTest, SizedFree) { + absl::flat_hash_map<void*, size_t> sizes; + SizeTracker alloc; + alloc.alloc.func = size_checking_allocfunc; + alloc.delegate_alloc = &upb_alloc_global; + alloc.sizes = &sizes; + + upb_Arena* arena = upb_Arena_Init(nullptr, 0, &alloc.alloc); + (void)upb_Arena_Malloc(arena, 500); + void* to_resize = upb_Arena_Malloc(arena, 2000); + void* resized = upb_Arena_Realloc(arena, to_resize, 2000, 4000); + upb_Arena_ShrinkLast(arena, resized, 4000, 1); + EXPECT_GT(sizes.size(), 0); + upb_Arena_Free(arena); + EXPECT_EQ(sizes.size(), 0); +} + +TEST(ArenaTest, SizeHint) { + absl::flat_hash_map<void*, size_t> sizes; + SizeTracker alloc; + alloc.alloc.func = size_checking_allocfunc; + alloc.delegate_alloc = &upb_alloc_global; + alloc.sizes = &sizes; + + upb_Arena* arena = upb_Arena_Init(nullptr, 2459, &alloc.alloc); + EXPECT_EQ(sizes.size(), 1); + EXPECT_NE(upb_Arena_Malloc(arena, 2459), nullptr); + EXPECT_EQ(sizes.size(), 1); + EXPECT_NE(upb_Arena_Malloc(arena, 500), nullptr); + EXPECT_EQ(sizes.size(), 2); + upb_Arena_Free(arena); + EXPECT_EQ(sizes.size(), 0); +} + +class OverheadTest { + public: + OverheadTest(const OverheadTest&) = delete; + OverheadTest& operator=(const OverheadTest&) = delete; + + explicit OverheadTest(size_t first = 0, size_t max_block_size = 0) { + if (max_block_size) { + upb_Arena_SetMaxBlockSize(max_block_size); + } + alloc_.alloc.func = size_checking_allocfunc; + alloc_.delegate_alloc = &upb_alloc_global; + alloc_.sizes = &sizes_; + arena_ = upb_Arena_Init(nullptr, first, &alloc_.alloc); + arena_alloced_ = 0; + arena_alloc_count_ = 0; + } + + void Alloc(size_t size) { + upb_Arena_Malloc(arena_, size); + arena_alloced_ += size; + arena_alloc_count_++; + } + + uintptr_t SpaceAllocated() { + return upb_Arena_SpaceAllocated(arena_, nullptr); + } + + double WastePct() { + uintptr_t backing_alloced = upb_Arena_SpaceAllocated(arena_, nullptr); + double waste = backing_alloced - arena_alloced_; + return waste / backing_alloced; + } + + double AmortizedAlloc() { + return ((double)sizes_.size()) / arena_alloc_count_; + } + + ~OverheadTest() { + upb_Arena_Free(arena_); + upb_Arena_SetMaxBlockSize(UPB_PRIVATE(kUpbDefaultMaxBlockSize)); + } + upb_Arena* arena_; + + protected: + absl::flat_hash_map<void*, size_t> sizes_; + SizeTracker alloc_; + uintptr_t arena_alloced_; + uintptr_t arena_alloc_count_; +}; + +TEST(OverheadTest, SingleMassiveBlockThenLittle) { + OverheadTest test; + // Little blocks + for (int i = 0; i < 4; i++) { + test.Alloc(32); + } + // Big block! + test.Alloc(16000); + for (int i = 0; i < 50; i++) { + test.Alloc(64); + } + if (!UPB_ASAN) { +#ifdef __ANDROID__ + EXPECT_NEAR(test.WastePct(), 0.21, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 0.05, 0.025); +#else + EXPECT_NEAR(test.WastePct(), 0.6, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 0.05, 0.025); +#endif + } +} + +TEST(OverheadTest, Overhead_AlternatingSmallLargeBlocks) { + OverheadTest test(512, 4096); + for (int i = 0; i < 100; i++) { + test.Alloc(5000); + test.Alloc(64); + } + if (!UPB_ASAN) { + EXPECT_NEAR(test.WastePct(), 0.45, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 1, 0.025); + } +} + +TEST(OverheadTest, PartialMaxBlocks) { + OverheadTest test(512, 4096); + for (int i = 0; i < 10; i++) { + test.Alloc(2096 + i); + } + if (!UPB_ASAN) { + EXPECT_NEAR(test.WastePct(), 0.47, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 1.1, 0.25); + } +} + +TEST(OverheadTest, SmallBlocksLargerThanInitial) { + OverheadTest test; + size_t initial_block_size = upb_Arena_SpaceAllocated(test.arena_, nullptr); + for (int i = 0; i < 10; i++) { + test.Alloc(initial_block_size * 2 + 1); + } + if (!UPB_ASAN && sizeof(void*) == 8) { + EXPECT_NEAR(test.WastePct(), 0.37, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 0.5, 0.025); + } +} + +TEST(OverheadTest, SmallBlocksLargerThanInitial_many) { + OverheadTest test; + size_t initial_block_size = upb_Arena_SpaceAllocated(test.arena_, nullptr); + for (int i = 0; i < 100; i++) { + test.Alloc(initial_block_size * 2 + 1); + } + if (!UPB_ASAN) { +#ifdef __ANDROID__ + EXPECT_NEAR(test.WastePct(), 0.09, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 0.12, 0.025); +#else + EXPECT_NEAR(test.WastePct(), 0.14, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 0.08, 0.025); +#endif + } + for (int i = 0; i < 900; i++) { + test.Alloc(initial_block_size * 2 + 1); + } + if (!UPB_ASAN) { +#ifdef __ANDROID__ + EXPECT_NEAR(test.WastePct(), 0.05, 0.03); + EXPECT_NEAR(test.AmortizedAlloc(), 0.08, 0.025); +#else + EXPECT_NEAR(test.WastePct(), 0.03, 0.025); + EXPECT_NEAR(test.AmortizedAlloc(), 0.05, 0.025); +#endif + } +} + +TEST(OverheadTest, DefaultMaxBlockSize) { + OverheadTest test; + // Perform 600 1k allocations (600k total) and ensure that the amount of + // memory allocated does not exceed 700k. + for (int i = 0; i < 600; ++i) { + test.Alloc(1024); + } + EXPECT_LE(test.SpaceAllocated(), 700 * 1024); +} + TEST(ArenaTest, ArenaFuse) { upb_Arena* arena1 = upb_Arena_New(); upb_Arena* arena2 = upb_Arena_New(); @@ -37,12 +283,6 @@ TEST(ArenaTest, ArenaFuse) { upb_Arena_Free(arena2); } -// Do-nothing allocator for testing. -extern "C" void* TestAllocFunc(upb_alloc* alloc, void* ptr, size_t oldsize, - size_t size) { - return upb_alloc_global.func(alloc, ptr, oldsize, size); -} - TEST(ArenaTest, FuseWithInitialBlock) { char buf1[1024]; char buf2[1024]; @@ -66,45 +306,27 @@ TEST(ArenaTest, FuseWithInitialBlock) { class Environment { public: - ~Environment() { - for (auto& atom : arenas_) { - auto* a = atom.load(std::memory_order_relaxed); - if (a != nullptr) upb_Arena_Free(a); - } - } - - void RandomNewFree(absl::BitGen& gen) { - auto* old = SwapRandomly(gen, upb_Arena_New()); - if (old != nullptr) upb_Arena_Free(old); + void RandomNewFree(absl::BitGen& gen, size_t min_index = 0) { + auto a = std::make_shared<const upb::Arena>(); + SwapRandomArena(gen, a, min_index); } void RandomIncRefCount(absl::BitGen& gen) { - auto* a = SwapRandomly(gen, nullptr); - if (a != nullptr) { - upb_Arena_IncRefFor(a, nullptr); - upb_Arena_DecRefFor(a, nullptr); - upb_Arena_Free(a); - } + std::shared_ptr<const upb::Arena> a = RandomNonNullArena(gen); + upb_Arena_IncRefFor(a->ptr(), nullptr); + upb_Arena_DecRefFor(a->ptr(), nullptr); } void RandomFuse(absl::BitGen& gen) { - std::array<upb_Arena*, 2> old; - for (auto& o : old) { - o = SwapRandomly(gen, nullptr); - if (o == nullptr) o = upb_Arena_New(); - } - - EXPECT_TRUE(upb_Arena_Fuse(old[0], old[1])); - for (auto& o : old) { - o = SwapRandomly(gen, o); - if (o != nullptr) upb_Arena_Free(o); - } + std::shared_ptr<const upb::Arena> a = RandomNonNullArena(gen); + std::shared_ptr<const upb::Arena> b = RandomNonNullArena(gen); + EXPECT_TRUE(upb_Arena_Fuse(a->ptr(), b->ptr())); } - void RandomPoke(absl::BitGen& gen) { + void RandomPoke(absl::BitGen& gen, size_t min_index = 0) { switch (absl::Uniform(gen, 0, 2)) { case 0: - RandomNewFree(gen); + RandomNewFree(gen, min_index); break; case 1: RandomFuse(gen); @@ -114,13 +336,39 @@ class Environment { } } - private: - upb_Arena* SwapRandomly(absl::BitGen& gen, upb_Arena* a) { - return arenas_[absl::Uniform<size_t>(gen, 0, arenas_.size())].exchange( - a, std::memory_order_acq_rel); + std::shared_ptr<const upb::Arena> IndexedNonNullArena(size_t index) { + absl::MutexLock lock(&mutex_); + std::shared_ptr<const upb::Arena>& ret = arenas_[index]; + if (!ret) ret = std::make_shared<const upb::Arena>(); + return ret; } - std::array<std::atomic<upb_Arena*>, 100> arenas_ = {}; + private: + size_t RandomIndex(absl::BitGen& gen, size_t min_index = 0) { + return absl::Uniform<size_t>(gen, min_index, + std::tuple_size<ArenaArray>::value); + } + + // Swaps a random arena from the set with the given arena. + void SwapRandomArena(absl::BitGen& gen, std::shared_ptr<const upb::Arena>& a, + size_t min_index) { + size_t i = RandomIndex(gen, min_index); + absl::MutexLock lock(&mutex_); + arenas_[i].swap(a); + } + + // Returns a random arena from the set, ensuring that the returned arena is + // non-null. + // + // Note that the returned arena is shared and may be accessed concurrently + // by other threads. + std::shared_ptr<const upb::Arena> RandomNonNullArena(absl::BitGen& gen) { + return IndexedNonNullArena(RandomIndex(gen)); + } + + using ArenaArray = std::array<std::shared_ptr<const upb::Arena>, 100>; + ArenaArray arenas_ ABSL_GUARDED_BY(mutex_); + absl::Mutex mutex_; }; TEST(ArenaTest, FuzzSingleThreaded) { @@ -133,44 +381,6 @@ TEST(ArenaTest, FuzzSingleThreaded) { } } -TEST(ArenaTest, Contains) { - upb_Arena* arena1 = upb_Arena_New(); - upb_Arena* arena2 = upb_Arena_New(); - void* ptr1a = upb_Arena_Malloc(arena1, 8); - void* ptr2a = upb_Arena_Malloc(arena2, 8); - - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr1a)); - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr2a)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr2a)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr1a)); - - void* ptr1b = upb_Arena_Malloc(arena1, 1000000); - void* ptr2b = upb_Arena_Malloc(arena2, 1000000); - - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr1a)); - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr1b)); - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr2a)); - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr2b)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr2a)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr2b)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr1a)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr1b)); - - upb_Arena_Fuse(arena1, arena2); - - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr1a)); - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr1b)); - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr2a)); - EXPECT_TRUE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr2b)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr2a)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena1, ptr2b)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr1a)); - EXPECT_FALSE(UPB_PRIVATE(_upb_Arena_Contains)(arena2, ptr1b)); - - upb_Arena_Free(arena1); - upb_Arena_Free(arena2); -} - TEST(ArenaTest, LargeAlloc) { // Tests an allocation larger than the max block size. upb_Arena* arena = upb_Arena_New(); @@ -197,7 +407,7 @@ TEST(ArenaTest, MaxBlockSize) { upb_Arena_Free(arena); } -#ifdef UPB_USE_C11_ATOMICS +#ifndef UPB_SUPPRESS_MISSING_ATOMICS TEST(ArenaTest, FuzzFuseFreeRace) { Environment env; @@ -245,6 +455,168 @@ TEST(ArenaTest, FuzzFuseFuseRace) { for (auto& t : threads) t.join(); } +static void* checking_global_allocfunc(upb_alloc* alloc, void* ptr, + size_t oldsize, size_t size) { + int header_size = std::max(alignof(max_align_t), sizeof(int)); + if (ptr) { + ptr = UPB_PTR_AT(ptr, -header_size, void); + UPB_ASSERT(*reinterpret_cast<int*>(ptr) == 0x5AFE); + } + if (size == 0) { + free(ptr); + return nullptr; + } + void* ret; + if (oldsize == 0) { + ret = malloc(size + header_size); + } else { + ret = realloc(ptr, size + header_size); + } + if (ret) { + *reinterpret_cast<int*>(ret) = 0x5AFE; + return UPB_PTR_AT(ret, header_size, void); + } + return ret; +} + +TEST(ArenaTest, FuzzFuseFreeAllocatorRace) { + upb_Arena_SetMaxBlockSize(128); + upb_alloc_func* old = upb_alloc_global.func; + upb_alloc_global.func = checking_global_allocfunc; + absl::Cleanup reset_max_block_size = [old] { + upb_Arena_SetMaxBlockSize(UPB_PRIVATE(kUpbDefaultMaxBlockSize)); + upb_alloc_global.func = old; + }; + absl::Notification done; + std::vector<std::thread> threads; + size_t thread_count = 10; + std::vector<std::array<upb_Arena*, 11>> arenas; + for (size_t i = 0; i < 10000; ++i) { + std::array<upb_Arena*, 11> arr; + arr[0] = upb_Arena_New(); + for (size_t j = 1; j < thread_count + 1; ++j) { + arr[j] = upb_Arena_New(); + upb_Arena_Fuse(arr[j - 1], arr[j]); + } + arenas.push_back(arr); + } + for (size_t i = 0; i < thread_count; ++i) { + size_t tid = i; + threads.emplace_back([&, tid]() { + size_t arenaCtr = 0; + while (!done.HasBeenNotified() && arenaCtr < arenas.size()) { + upb_Arena* read = arenas[arenaCtr++][tid]; + (void)upb_Arena_Malloc(read, 128); + (void)upb_Arena_Malloc(read, 128); + upb_Arena_Free(read); + } + while (arenaCtr < arenas.size()) { + upb_Arena_Free(arenas[arenaCtr++][tid]); + } + }); + } + auto end = absl::Now() + absl::Seconds(2); + size_t arenaCtr = 0; + while (absl::Now() < end && arenaCtr < arenas.size()) { + upb_Arena* read = arenas[arenaCtr++][thread_count]; + (void)upb_Arena_Malloc(read, 128); + (void)upb_Arena_Malloc(read, 128); + upb_Arena_Free(read); + } + done.Notify(); + while (arenaCtr < arenas.size()) { + upb_Arena_Free(arenas[arenaCtr++][thread_count]); + } + for (auto& t : threads) t.join(); +} + +TEST(ArenaTest, FuzzFuseSpaceAllocatedRace) { + upb_Arena_SetMaxBlockSize(128); + absl::Cleanup reset_max_block_size = [] { + upb_Arena_SetMaxBlockSize(UPB_PRIVATE(kUpbDefaultMaxBlockSize)); + }; + absl::Notification done; + std::vector<std::thread> threads; + std::vector<upb_Arena*> arenas; + size_t thread_count = 10; + size_t fuses_per_thread = 1000; + size_t root_arenas_limit = 250; + for (size_t i = 0; i < root_arenas_limit; ++i) { + arenas.push_back(upb_Arena_New()); + for (size_t j = 0; j < thread_count; ++j) { + upb_Arena_IncRefFor(arenas[i], nullptr); + } + } + for (size_t i = 0; i < thread_count; ++i) { + threads.emplace_back([&]() { + size_t arenaCtr = 0; + while (!done.HasBeenNotified() && arenaCtr < arenas.size()) { + upb_Arena* read = arenas[arenaCtr++]; + for (size_t j = 0; j < fuses_per_thread; ++j) { + upb_Arena* fuse = upb_Arena_New(); + upb_Arena_Fuse(read, fuse); + upb_Arena_Free(read); + read = fuse; + } + upb_Arena_Free(read); + } + while (arenaCtr < arenas.size()) { + upb_Arena_Free(arenas[arenaCtr++]); + } + }); + } + + auto end = absl::Now() + absl::Seconds(2); + size_t arenaCtr = 0; + uintptr_t total_allocated = 0; + while (absl::Now() < end && arenaCtr < arenas.size()) { + upb_Arena* read = arenas[arenaCtr++]; + size_t count; + size_t allocated; + do { + allocated = upb_Arena_SpaceAllocated(read, &count); + } while (count < fuses_per_thread * thread_count); + upb_Arena_Free(read); + total_allocated += allocated; + } + done.Notify(); + for (auto& t : threads) t.join(); + while (arenaCtr < arenas.size()) { + upb_Arena_Free(arenas[arenaCtr++]); + } + ASSERT_GT(total_allocated, arenaCtr); +} + +TEST(ArenaTest, FuzzAllocSpaceAllocatedRace) { + upb_Arena_SetMaxBlockSize(128); + absl::Cleanup reset_max_block_size = [] { + upb_Arena_SetMaxBlockSize(UPB_PRIVATE(kUpbDefaultMaxBlockSize)); + }; + upb_Arena* arena = upb_Arena_New(); + absl::Notification done; + std::vector<std::thread> threads; + for (int i = 0; i < 1; ++i) { + threads.emplace_back([&]() { + while (!done.HasBeenNotified()) { + size_t count; + upb_Arena_SpaceAllocated(arena, &count); + } + }); + } + + auto end = absl::Now() + absl::Seconds(2); + uintptr_t total = 0; + while (absl::Now() < end && total < 10000000) { + if (upb_Arena_Malloc(arena, 128) == nullptr) { + break; + } + total += 128; + } + done.Notify(); + for (auto& t : threads) t.join(); + upb_Arena_Free(arena); +} + TEST(ArenaTest, ArenaIncRef) { upb_Arena* arena1 = upb_Arena_New(); EXPECT_EQ(upb_Arena_DebugRefCount(arena1), 1); @@ -285,6 +657,36 @@ TEST(ArenaTest, IncRefCountShouldFailForInitialBlock) { EXPECT_FALSE(upb_Arena_IncRefFor(arena, nullptr)); } +TEST(ArenaTest, FuzzFuseIsFusedRace) { + Environment env; + + // Create two arenas and fuse them. + std::shared_ptr<const upb::Arena> a = env.IndexedNonNullArena(0); + std::shared_ptr<const upb::Arena> b = env.IndexedNonNullArena(1); + upb_Arena_Fuse(a->ptr(), b->ptr()); + EXPECT_TRUE(upb_Arena_IsFused(a->ptr(), b->ptr())); + + absl::Notification done; + std::vector<std::thread> threads; + for (int i = 0; i < 10; ++i) { + threads.emplace_back([&]() { + absl::BitGen gen; + while (!done.HasBeenNotified()) { + env.RandomPoke(gen, 2); + } + }); + } + + absl::BitGen gen; + auto end = absl::Now() + absl::Seconds(2); + while (absl::Now() < end) { + // Verify that the two arenas are still fused. + EXPECT_TRUE(upb_Arena_IsFused(a->ptr(), b->ptr())); + } + done.Notify(); + for (auto& t : threads) t.join(); +} + #endif } // namespace diff --git a/third_party/protobuf/upb/mem/internal/arena.h b/third_party/protobuf/upb/mem/internal/arena.h index 9a6469edc16f6..e8b5afa0bc1d8 100644 --- a/third_party/protobuf/upb/mem/internal/arena.h +++ b/third_party/protobuf/upb/mem/internal/arena.h @@ -20,7 +20,7 @@ // // We need this because the decoder inlines a upb_Arena for performance but // the full struct is not visible outside of arena.c. Yes, I know, it's awful. -#define UPB_ARENA_SIZE_HACK 7 +#define UPB_ARENA_SIZE_HACK (9 + UPB_TSAN_PUBLISH) // LINT.IfChange(upb_Arena) @@ -40,16 +40,12 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(struct upb_Arena* des, void UPB_PRIVATE(_upb_Arena_SwapOut)(struct upb_Arena* des, const struct upb_Arena* src); -// Returns whether |ptr| was allocated directly by |a| (so care must be used -// with fused arenas). -UPB_API bool UPB_ONLYBITS(_upb_Arena_Contains)(const struct upb_Arena* a, - void* ptr); - UPB_INLINE size_t UPB_PRIVATE(_upb_ArenaHas)(const struct upb_Arena* a) { return (size_t)(a->UPB_ONLYBITS(end) - a->UPB_ONLYBITS(ptr)); } UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(struct upb_Arena * a, size_t size); size = UPB_ALIGN_MALLOC(size); @@ -71,6 +67,7 @@ UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) { UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr, size_t oldsize, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); oldsize = UPB_ALIGN_MALLOC(oldsize); size = UPB_ALIGN_MALLOC(size); bool is_most_recent_alloc = @@ -97,6 +94,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr, UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr, size_t oldsize, size_t size) { + UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr)); oldsize = UPB_ALIGN_MALLOC(oldsize); size = UPB_ALIGN_MALLOC(size); // Must be the last alloc. diff --git a/third_party/protobuf/upb/message/BUILD b/third_party/protobuf/upb/message/BUILD index 9724a5b6917dc..e715238454b56 100644 --- a/third_party/protobuf/upb/message/BUILD +++ b/third_party/protobuf/upb/message/BUILD @@ -5,6 +5,7 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("//bazel:proto_library.bzl", "proto_library") load( "//bazel:upb_minitable_proto_library.bzl", "upb_minitable_proto_library", @@ -56,7 +57,6 @@ cc_library( cc_library( name = "internal", srcs = [ - "internal/compare_unknown.c", "internal/extension.c", "internal/message.c", "value.h", @@ -64,7 +64,6 @@ cc_library( hdrs = [ "internal/accessors.h", "internal/array.h", - "internal/compare_unknown.h", "internal/extension.h", "internal/map.h", "internal/map_sorter.h", @@ -76,11 +75,9 @@ cc_library( deps = [ ":types", "//upb:base", - "//upb:eps_copy_input_stream", "//upb:mem", "//upb:mini_table", "//upb:port", - "//upb:wire_reader", "//upb/base:internal", "//upb/hash", "//upb/mini_table:internal", @@ -109,9 +106,11 @@ cc_library( name = "compare", srcs = [ "compare.c", + "internal/compare_unknown.c", ], hdrs = [ "compare.h", + "internal/compare_unknown.h", ], copts = UPB_DEFAULT_COPTS, visibility = ["//visibility:public"], @@ -120,8 +119,11 @@ cc_library( ":iterator", ":message", "//upb:base", + "//upb:eps_copy_input_stream", + "//upb:mem", "//upb:mini_table", "//upb:port", + "//upb:wire_reader", "//upb/mini_table:internal", ], ) @@ -189,8 +191,8 @@ cc_test( "//upb/test:test_messages_proto2_upb_minitable", "//upb/test:test_messages_proto2_upb_proto", "//upb/test:test_upb_proto", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -252,7 +254,7 @@ cc_test( srcs = ["accessors_test.cc"], deps = [ ":message", - "//:protobuf", + "//src/google/protobuf", "//upb:base", "//upb:mem", "//upb:mini_descriptor", @@ -265,9 +267,9 @@ cc_test( "//upb/test:test_messages_proto3_upb_minitable", "//upb/test:test_messages_proto3_upb_proto", "//upb/test:test_upb_proto", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_set", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -278,8 +280,8 @@ cc_test( ":message", "//upb:base", "//upb:mem", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -287,13 +289,19 @@ cc_test( name = "compare_unknown_test", srcs = ["internal/compare_unknown_test.cc"], deps = [ + ":compare", ":internal", + ":message", + "//upb:base", + "//upb:mem", "//upb:port", + "//upb:wire", "//upb:wire_reader", "//upb/base:internal", - "@com_google_absl//absl/types:variant", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "//upb/test:test_messages_proto2_upb_proto", + "@abseil-cpp//absl/types:variant", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -304,7 +312,7 @@ cc_test( ":copy", ":internal", ":message", - "//:protobuf", + "//src/google/protobuf", "//upb:base", "//upb:mem", "//upb:mini_table", @@ -313,9 +321,9 @@ cc_test( "//upb/test:test_messages_proto2_upb_minitable", "//upb/test:test_messages_proto2_upb_proto", "//upb/test:test_upb_proto", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_set", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -326,8 +334,8 @@ cc_test( ":message", "//upb:base", "//upb:mem", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -339,7 +347,7 @@ cc_test( ":internal", ":message", ":promote", - "//:protobuf", + "//src/google/protobuf", "//upb:base", "//upb:mem", "//upb:mini_descriptor", @@ -350,9 +358,9 @@ cc_test( "//upb/test:test_messages_proto3_upb_proto", "//upb/test:test_proto_upb_minitable", "//upb/test:test_upb_proto", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_set", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -368,15 +376,20 @@ cc_test( ":message_test_upb_proto", ":message_test_upb_proto_reflection", "//upb:base", + "//upb:eps_copy_input_stream", "//upb:json", "//upb:mem", + "//upb:message_compare", "//upb:mini_table", "//upb:reflection", "//upb:wire", + "//upb:wire_reader", "//upb/test:fuzz_util", "//upb/test:test_messages_proto3_upb_proto", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "//upb/text:debug", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -427,8 +440,8 @@ cc_test( "//upb:base", "//upb:mem", "//upb:wire", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/message/accessors.h b/third_party/protobuf/upb/message/accessors.h index 613f634af3663..0387fa03a47f8 100644 --- a/third_party/protobuf/upb/message/accessors.h +++ b/third_party/protobuf/upb/message/accessors.h @@ -168,6 +168,47 @@ UPB_API_INLINE void upb_Message_SetBaseFieldUInt64(struct upb_Message* msg, const upb_MiniTableField* f, uint64_t value); +// Extension Getters /////////////////////////////////////////////////////////// +UPB_API_INLINE bool upb_Message_GetExtensionBool( + const upb_Message* msg, const upb_MiniTableExtension* f, bool default_val); + +UPB_API_INLINE double upb_Message_GetExtensionDouble( + const upb_Message* msg, const upb_MiniTableExtension* f, + double default_val); + +UPB_API_INLINE float upb_Message_GetExtensionFloat( + const upb_Message* msg, const upb_MiniTableExtension* f, float default_val); + +UPB_API_INLINE int32_t upb_Message_GetExtensionInt32( + const upb_Message* msg, const upb_MiniTableExtension* f, + int32_t default_val); + +UPB_API_INLINE int64_t upb_Message_GetExtensionInt64( + const upb_Message* msg, const upb_MiniTableExtension* f, + int64_t default_val); + +UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32( + const upb_Message* msg, const upb_MiniTableExtension* f, + uint32_t default_val); + +UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64( + const upb_Message* msg, const upb_MiniTableExtension* f, + uint64_t default_val); + +UPB_API_INLINE upb_StringView upb_Message_GetExtensionString( + const upb_Message* msg, const upb_MiniTableExtension* f, + upb_StringView default_val); + +UPB_API_INLINE upb_Message* upb_Message_GetExtensionMessage( + const upb_Message* msg, const upb_MiniTableExtension* f, + struct upb_Message* default_val); + +UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray( + const upb_Message* msg, const upb_MiniTableExtension* f); + +UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray( + upb_Message* msg, const upb_MiniTableExtension* f); + // Extension Setters /////////////////////////////////////////////////////////// UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg, diff --git a/third_party/protobuf/upb/message/compare.c b/third_party/protobuf/upb/message/compare.c index 70ad026bc49d3..5266e0c830cdf 100644 --- a/third_party/protobuf/upb/message/compare.c +++ b/third_party/protobuf/upb/message/compare.c @@ -8,6 +8,7 @@ #include "upb/message/compare.h" #include <stddef.h> +#include <stdint.h> #include "upb/base/descriptor_constants.h" #include "upb/message/accessors.h" @@ -132,20 +133,18 @@ static bool _upb_Message_ExtensionsAreEqual(const upb_Message* msg1, const upb_Message* msg2, const upb_MiniTable* m, int options) { - // Must have identical extension counts. - if (upb_Message_ExtensionCount(msg1) != upb_Message_ExtensionCount(msg2)) { - return false; - } - const upb_MiniTableExtension* e; upb_MessageValue val1; // Iterate over all extensions for msg1, and search msg2 for each extension. - size_t iter1 = kUpb_Extension_Begin; - while (UPB_PRIVATE(_upb_Message_NextExtension)(msg1, m, &e, &val1, &iter1)) { + size_t count1 = 0; + size_t iter1 = kUpb_Message_ExtensionBegin; + while (upb_Message_NextExtension(msg1, &e, &val1, &iter1)) { const upb_Extension* ext2 = UPB_PRIVATE(_upb_Message_Getext)(msg2, e); if (!ext2) return false; + count1++; + const upb_MessageValue val2 = ext2->data; const upb_MiniTableField* f = &e->UPB_PRIVATE(field); const upb_MiniTable* subm = upb_MiniTableField_IsSubMessage(f) @@ -169,6 +168,11 @@ static bool _upb_Message_ExtensionsAreEqual(const upb_Message* msg1, } if (!eq) return false; } + + // Must have identical extension counts (this catches the case where msg2 + // has extensions that msg1 doesn't). + if (count1 != upb_Message_ExtensionCount(msg2)) return false; + return true; } @@ -181,12 +185,7 @@ bool upb_Message_IsEqual(const upb_Message* msg1, const upb_Message* msg2, if (!(options & kUpb_CompareOption_IncludeUnknownFields)) return true; - // Check the unknown fields. - size_t usize1, usize2; - const char* uf1 = upb_Message_GetUnknown(msg1, &usize1); - const char* uf2 = upb_Message_GetUnknown(msg2, &usize2); - // The wire encoder enforces a maximum depth of 100 so we match that here. - return UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - uf1, usize1, uf2, usize2, 100) == kUpb_UnknownCompareResult_Equal; + return UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(msg1, msg2, 100) == + kUpb_UnknownCompareResult_Equal; } diff --git a/third_party/protobuf/upb/message/compat.c b/third_party/protobuf/upb/message/compat.c index ffe758a86f766..0d7988778a35e 100644 --- a/third_party/protobuf/upb/message/compat.c +++ b/third_party/protobuf/upb/message/compat.c @@ -10,30 +10,27 @@ #include <stddef.h> #include <stdint.h> -#include "upb/message/internal/extension.h" #include "upb/message/message.h" +#include "upb/message/value.h" #include "upb/mini_table/extension.h" // Must be last. #include "upb/port/def.inc" -const upb_MiniTableExtension* upb_Message_ExtensionByIndex( - const upb_Message* msg, size_t index) { - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - - UPB_ASSERT(index < count); - return ext[index].ext; +bool upb_Message_NextExtensionReverse(const upb_Message* msg, + const upb_MiniTableExtension** result, + uintptr_t* iter) { + upb_MessageValue val; + return UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, result, &val, + iter); } const upb_MiniTableExtension* upb_Message_FindExtensionByNumber( const upb_Message* msg, uint32_t field_number) { - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - - for (; count--; ext++) { - const upb_MiniTableExtension* e = ext->ext; - if (upb_MiniTableExtension_Number(e) == field_number) return e; + uintptr_t iter = kUpb_Message_ExtensionBegin; + const upb_MiniTableExtension* result; + while (upb_Message_NextExtensionReverse(msg, &result, &iter)) { + if (upb_MiniTableExtension_Number(result) == field_number) return result; } return NULL; } diff --git a/third_party/protobuf/upb/message/compat.h b/third_party/protobuf/upb/message/compat.h index c14484f74b837..7600ffa1cb9fa 100644 --- a/third_party/protobuf/upb/message/compat.h +++ b/third_party/protobuf/upb/message/compat.h @@ -25,9 +25,10 @@ extern "C" { #endif -const upb_MiniTableExtension* upb_Message_ExtensionByIndex( - const upb_Message* msg, size_t index); - +// Same as upb_Message_NextExtension but iterates in reverse wire order +bool upb_Message_NextExtensionReverse(const upb_Message* msg, + const upb_MiniTableExtension** result, + uintptr_t* iter); // Returns the minitable with the given field number, or NULL on failure. const upb_MiniTableExtension* upb_Message_FindExtensionByNumber( const upb_Message* msg, uint32_t field_number); diff --git a/third_party/protobuf/upb/message/copy.c b/third_party/protobuf/upb/message/copy.c index 67e1b5b5030d0..8f1af7991de88 100644 --- a/third_party/protobuf/upb/message/copy.c +++ b/third_party/protobuf/upb/message/copy.c @@ -8,6 +8,7 @@ #include "upb/message/copy.h" #include <stdbool.h> +#include <stdint.h> #include <string.h> #include "upb/base/descriptor_constants.h" @@ -19,6 +20,7 @@ #include "upb/message/internal/array.h" #include "upb/message/internal/extension.h" #include "upb/message/internal/map.h" +#include "upb/message/internal/message.h" #include "upb/message/map.h" #include "upb/message/message.h" #include "upb/message/tagged_ptr.h" @@ -150,7 +152,7 @@ upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type, for (size_t i = 0; i < size; ++i) { upb_MessageValue val = upb_Array_Get(array, i); if (!upb_Clone_MessageValue(&val, value_type, sub, arena)) { - return false; + return NULL; } upb_Array_Set(cloned_array, i, val); } @@ -254,41 +256,44 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src, } } // Clone extensions. - size_t ext_count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(src, &ext_count); - for (size_t i = 0; i < ext_count; ++i) { - const upb_Extension* msg_ext = &ext[i]; - const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field); - upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( - dst, msg_ext->ext, arena); - if (!dst_ext) return NULL; - if (upb_MiniTableField_IsScalar(field)) { - if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) { + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(src); + if (!in) return dst; + + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + // Clone extension + const upb_Extension* msg_ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field); + upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( + dst, msg_ext->ext, arena); + if (!dst_ext) return NULL; + if (upb_MiniTableField_IsScalar(field)) { + if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) { + return NULL; + } + } else { + upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val; + UPB_ASSERT(msg_array); + upb_Array* cloned_array = upb_Array_DeepClone( + msg_array, upb_MiniTableField_CType(field), + upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena); + if (!cloned_array) { + return NULL; + } + dst_ext->data.array_val = cloned_array; + } + } else if (upb_TaggedAuxPtr_IsUnknown(tagged_ptr)) { + // Clone unknown + upb_StringView* unknown = upb_TaggedAuxPtr_UnknownData(tagged_ptr); + // Make a copy into destination arena. + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, unknown->data, + unknown->size, arena, false)) { return NULL; } - } else { - upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val; - UPB_ASSERT(msg_array); - upb_Array* cloned_array = upb_Array_DeepClone( - msg_array, upb_MiniTableField_CType(field), - upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena); - if (!cloned_array) { - return NULL; - } - dst_ext->data.array_val = cloned_array; } } - // Clone unknowns. - size_t unknown_size = 0; - const char* ptr = upb_Message_GetUnknown(src, &unknown_size); - if (unknown_size != 0) { - UPB_ASSERT(ptr); - // Make a copy into destination arena. - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, ptr, unknown_size, arena)) { - return NULL; - } - } return dst; } diff --git a/third_party/protobuf/upb/message/copy_test.cc b/third_party/protobuf/upb/message/copy_test.cc index 1bdb3a309928c..9031704acde99 100644 --- a/third_party/protobuf/upb/message/copy_test.cc +++ b/third_party/protobuf/upb/message/copy_test.cc @@ -191,55 +191,49 @@ TEST(GeneratedCode, DeepCloneMessageMapField) { protobuf_test_messages_proto2_TestAllTypesProto2_NestedMessage_set_a(nested, 0); upb_Arena_Free(source_arena); - size_t iter = kUpb_Map_Begin; - // Test map<int32, int32>. - const protobuf_test_messages_proto2_TestAllTypesProto2_MapInt32DoubleEntry* - int32_double_entry = - protobuf_test_messages_proto2_TestAllTypesProto2_map_int32_double_next( - clone, &iter); - ASSERT_NE(int32_double_entry, nullptr); - EXPECT_EQ( - protobuf_test_messages_proto2_TestAllTypesProto2_MapInt32DoubleEntry_key( - int32_double_entry), - 12); - EXPECT_EQ( - protobuf_test_messages_proto2_TestAllTypesProto2_MapInt32DoubleEntry_value( - int32_double_entry), - 1200.5); + // Test map<int32, double>. + { + int32_t key; + double value; + size_t iter = kUpb_Map_Begin; + + ASSERT_TRUE( + protobuf_test_messages_proto2_TestAllTypesProto2_map_int32_double_next( + clone, &key, &value, &iter)); + EXPECT_EQ(key, 12); + EXPECT_EQ(value, 1200.5); + } + // Test map<string, string>. - iter = kUpb_Map_Begin; - const protobuf_test_messages_proto2_TestAllTypesProto2_MapStringStringEntry* - string_string_entry = - protobuf_test_messages_proto2_TestAllTypesProto2_map_string_string_next( - clone, &iter); - ASSERT_NE(string_string_entry, nullptr); - EXPECT_TRUE(upb_StringView_IsEqual( - protobuf_test_messages_proto2_TestAllTypesProto2_MapStringStringEntry_key( - string_string_entry), - upb_StringView_FromString("key1"))); - EXPECT_TRUE(upb_StringView_IsEqual( - protobuf_test_messages_proto2_TestAllTypesProto2_MapStringStringEntry_value( - string_string_entry), - upb_StringView_FromString("value1"))); + { + upb_StringView key; + upb_StringView value; + size_t iter = kUpb_Map_Begin; + + ASSERT_TRUE( + protobuf_test_messages_proto2_TestAllTypesProto2_map_string_string_next( + clone, &key, &value, &iter)); + EXPECT_TRUE(upb_StringView_IsEqual(key, upb_StringView_FromString("key1"))); + EXPECT_TRUE( + upb_StringView_IsEqual(value, upb_StringView_FromString("value1"))); + } + // Test map<string, NestedMessage>. - iter = kUpb_Map_Begin; - const protobuf_test_messages_proto2_TestAllTypesProto2_MapStringNestedMessageEntry* - nested_message_entry = - protobuf_test_messages_proto2_TestAllTypesProto2_map_string_nested_message_next( - clone, &iter); - ASSERT_NE(nested_message_entry, nullptr); - EXPECT_TRUE(upb_StringView_IsEqual( - protobuf_test_messages_proto2_TestAllTypesProto2_MapStringNestedMessageEntry_key( - nested_message_entry), - upb_StringView_FromString("nestedkey1"))); - const protobuf_test_messages_proto2_TestAllTypesProto2_NestedMessage* - cloned_nested = - protobuf_test_messages_proto2_TestAllTypesProto2_MapStringNestedMessageEntry_value( - nested_message_entry); - ASSERT_NE(cloned_nested, nullptr); - EXPECT_EQ(protobuf_test_messages_proto2_TestAllTypesProto2_NestedMessage_a( - cloned_nested), - kTestNestedInt32); + { + upb_StringView key; + const protobuf_test_messages_proto2_TestAllTypesProto2_NestedMessage* value; + size_t iter = kUpb_Map_Begin; + ASSERT_TRUE( + protobuf_test_messages_proto2_TestAllTypesProto2_map_string_nested_message_next( + clone, &key, &value, &iter)); + EXPECT_TRUE( + upb_StringView_IsEqual(key, upb_StringView_FromString("nestedkey1"))); + ASSERT_NE(value, nullptr); + EXPECT_EQ( + protobuf_test_messages_proto2_TestAllTypesProto2_NestedMessage_a(value), + kTestNestedInt32); + } + upb_Arena_Free(arena); } @@ -314,7 +308,7 @@ TEST(GeneratedCode, DeepCloneMessageWithUnknowns) { std::string unknown_data(data, len); // Add unknown data. UPB_PRIVATE(_upb_Message_AddUnknown) - (UPB_UPCAST(msg), data, len, source_arena); + (UPB_UPCAST(msg), data, len, source_arena, false); // Create clone. upb_Arena* clone_arena = upb_Arena_New(); protobuf_test_messages_proto2_TestAllTypesProto2* clone = @@ -326,12 +320,13 @@ TEST(GeneratedCode, DeepCloneMessageWithUnknowns) { upb_Arena_Free(unknown_arena); upb_Arena_Free(encode_arena); // Read unknown data from clone and verify. - size_t cloned_length; - const char* cloned_unknown_data = - upb_Message_GetUnknown(UPB_UPCAST(clone), &cloned_length); - EXPECT_EQ(cloned_length, len); - EXPECT_EQ(memcmp(cloned_unknown_data, unknown_data.c_str(), cloned_length), - 0); + std::string cloned_unknown_data; + upb_StringView unknown; + uintptr_t iter = kUpb_Message_UnknownBegin; + while (upb_Message_NextUnknown(UPB_UPCAST(clone), &unknown, &iter)) { + cloned_unknown_data.append(unknown.data, unknown.size); + } + EXPECT_EQ(unknown_data, cloned_unknown_data); upb_Arena_Free(clone_arena); } diff --git a/third_party/protobuf/upb/message/internal/accessors.h b/third_party/protobuf/upb/message/internal/accessors.h index aae0fdc0a8b2d..78e0fabdd79b9 100644 --- a/third_party/protobuf/upb/message/internal/accessors.h +++ b/third_party/protobuf/upb/message/internal/accessors.h @@ -163,7 +163,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)( } } -UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( +UPB_INLINE_IF_NOT_GCC void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( const upb_MiniTableField* f, void* to, const void* from) { switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) { case kUpb_FieldRep_1Byte: @@ -183,7 +183,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)( UPB_UNREACHABLE(); } -UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)( +UPB_INLINE_IF_NOT_GCC bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)( const upb_MiniTableField* f, const void* a, const void* b) { switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) { case kUpb_FieldRep_1Byte: @@ -856,9 +856,7 @@ UPB_API_INLINE void upb_Message_Clear(struct upb_Message* msg, memset(msg, 0, m->UPB_PRIVATE(size)); if (in) { // Reset the internal buffer to empty. - in->unknown_end = sizeof(upb_Message_Internal); - in->ext_begin = in->size; - UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); + in->size = 0; } } @@ -882,11 +880,15 @@ UPB_API_INLINE void upb_Message_ClearExtension( UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) return; - const upb_Extension* base = UPB_PTR_AT(in, in->ext_begin, upb_Extension); - upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e); - if (ext) { - *ext = *base; - in->ext_begin += sizeof(upb_Extension); + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + if (ext->ext == e) { + in->aux_data[i] = upb_TaggedAuxPtr_Null(); + return; + } + } } } @@ -916,6 +918,133 @@ UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized( return upb_Array_MutableDataPtr(arr); } +UPB_API_INLINE bool upb_Message_GetExtensionBool( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + bool default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Bool); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_1Byte); + bool ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE double upb_Message_GetExtensionDouble( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + double default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Double); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + double ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE float upb_Message_GetExtensionFloat( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + float default_val) { + float ret; + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Float); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE int32_t upb_Message_GetExtensionInt32( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + int32_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int32 || + upb_MiniTableExtension_CType(e) == kUpb_CType_Enum); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + int32_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE int64_t upb_Message_GetExtensionInt64( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + int64_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int64); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + int64_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + uint32_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt32); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_4Byte); + uint32_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + uint64_t default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt64); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_8Byte); + uint64_t ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE upb_StringView upb_Message_GetExtensionString( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + upb_StringView default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_String || + upb_MiniTableExtension_CType(e) == kUpb_CType_Bytes); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + kUpb_FieldRep_StringView); + upb_StringView ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE struct upb_Message* upb_Message_GetExtensionMessage( + const struct upb_Message* msg, const upb_MiniTableExtension* e, + struct upb_Message* default_val) { + UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Message); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) == + UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); + struct upb_Message* ret; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +// Repeated +UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray( + const struct upb_Message* msg, const upb_MiniTableExtension* e) { + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) == + kUpb_FieldRep_NativePointer); + UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field))); + UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0); + upb_Array* ret; + const upb_Array* default_val = NULL; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + +UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray( + struct upb_Message* msg, const upb_MiniTableExtension* e) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) == + kUpb_FieldRep_NativePointer); + UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field))); + UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0); + upb_Array* ret; + upb_Array* default_val = NULL; + _upb_Message_GetExtensionField(msg, e, &default_val, &ret); + return ret; +} + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/third_party/protobuf/upb/message/internal/compare_unknown.c b/third_party/protobuf/upb/message/internal/compare_unknown.c index a7a60f2ef2971..b2d51fa76748b 100644 --- a/third_party/protobuf/upb/message/internal/compare_unknown.c +++ b/third_party/protobuf/upb/message/internal/compare_unknown.c @@ -7,10 +7,12 @@ #include "upb/message/internal/compare_unknown.h" +#include <stdint.h> #include <stdlib.h> #include "upb/base/string_view.h" #include "upb/mem/alloc.h" +#include "upb/message/message.h" #include "upb/wire/eps_copy_input_stream.h" #include "upb/wire/reader.h" #include "upb/wire/types.h" @@ -47,6 +49,14 @@ typedef struct { jmp_buf err; } upb_UnknownField_Context; +typedef struct { + upb_UnknownField* arr_base; + upb_UnknownField* arr_ptr; + upb_UnknownField* arr_end; + uint32_t last_tag; + bool sorted; +} upb_UnknownFields_Builder; + UPB_NORETURN static void upb_UnknownFields_OutOfMemory( upb_UnknownField_Context* ctx) { ctx->status = kUpb_UnknownCompareResult_OutOfMemory; @@ -118,14 +128,19 @@ static void upb_UnknownFields_Sort(upb_UnknownField_Context* ctx, upb_UnknownFields_SortRecursive(fields->fields, 0, fields->size, ctx->tmp); } -static upb_UnknownFields* upb_UnknownFields_DoBuild( - upb_UnknownField_Context* ctx, const char** buf) { - upb_UnknownField* arr_base = NULL; - upb_UnknownField* arr_ptr = NULL; - upb_UnknownField* arr_end = NULL; +static upb_UnknownFields* upb_UnknownFields_BuildFromBuffer( + upb_UnknownField_Context* ctx, const char** buf); + +// Combines two unknown fields into one. +static void upb_CombineUnknownFields(upb_UnknownField_Context* ctx, + upb_UnknownFields_Builder* builder, + const char** buf) { + upb_UnknownField* arr_base = builder->arr_base; + upb_UnknownField* arr_ptr = builder->arr_ptr; + upb_UnknownField* arr_end = builder->arr_end; const char* ptr = *buf; - uint32_t last_tag = 0; - bool sorted = true; + uint32_t last_tag = builder->last_tag; + bool sorted = builder->sorted; while (!upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr)) { uint32_t tag; ptr = upb_WireReader_ReadTag(ptr, &tag); @@ -167,34 +182,71 @@ static upb_UnknownFields* upb_UnknownFields_DoBuild( ctx->status = kUpb_UnknownCompareResult_MaxDepthExceeded; UPB_LONGJMP(ctx->err, 1); } - field->data.group = upb_UnknownFields_DoBuild(ctx, &ptr); + field->data.group = upb_UnknownFields_BuildFromBuffer(ctx, &ptr); ctx->depth++; break; default: UPB_UNREACHABLE(); } } - *buf = ptr; + builder->arr_base = arr_base; + builder->arr_ptr = arr_ptr; + builder->arr_end = arr_end; + builder->sorted = sorted; + builder->last_tag = last_tag; +} + +static upb_UnknownFields* upb_UnknownFields_DoBuild( + upb_UnknownField_Context* ctx, upb_UnknownFields_Builder* builder) { upb_UnknownFields* ret = upb_Arena_Malloc(ctx->arena, sizeof(*ret)); if (!ret) upb_UnknownFields_OutOfMemory(ctx); - ret->fields = arr_base; - ret->size = arr_ptr - arr_base; - ret->capacity = arr_end - arr_base; - if (!sorted) { + ret->fields = builder->arr_base; + ret->size = builder->arr_ptr - builder->arr_base; + ret->capacity = builder->arr_end - builder->arr_base; + if (!builder->sorted) { upb_UnknownFields_Sort(ctx, ret); } return ret; } // Builds a upb_UnknownFields data structure from the binary data in buf. +static upb_UnknownFields* upb_UnknownFields_BuildFromBuffer( + upb_UnknownField_Context* ctx, const char** buf) { + upb_UnknownFields_Builder builder = { + .arr_base = NULL, + .arr_ptr = NULL, + .arr_end = NULL, + .sorted = true, + .last_tag = 0, + }; + const char* ptr = *buf; + upb_CombineUnknownFields(ctx, &builder, &ptr); + upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &builder); + *buf = ptr; + return fields; +} + +// Builds a upb_UnknownFields data structure from the unknown fields of a +// upb_Message. static upb_UnknownFields* upb_UnknownFields_Build(upb_UnknownField_Context* ctx, - const char* ptr, - size_t size) { - upb_EpsCopyInputStream_Init(&ctx->stream, &ptr, size, true); - upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &ptr); - UPB_ASSERT(upb_EpsCopyInputStream_IsDone(&ctx->stream, &ptr) && - !upb_EpsCopyInputStream_IsError(&ctx->stream)); + const upb_Message* msg) { + upb_UnknownFields_Builder builder = { + .arr_base = NULL, + .arr_ptr = NULL, + .arr_end = NULL, + .sorted = true, + .last_tag = 0, + }; + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView view; + while (upb_Message_NextUnknown(msg, &view, &iter)) { + upb_EpsCopyInputStream_Init(&ctx->stream, &view.data, view.size, true); + upb_CombineUnknownFields(ctx, &builder, &view.data); + UPB_ASSERT(upb_EpsCopyInputStream_IsDone(&ctx->stream, &view.data) && + !upb_EpsCopyInputStream_IsError(&ctx->stream)); + } + upb_UnknownFields* fields = upb_UnknownFields_DoBuild(ctx, &builder); return fields; } @@ -235,13 +287,13 @@ static bool upb_UnknownFields_IsEqual(const upb_UnknownFields* uf1, } static upb_UnknownCompareResult upb_UnknownField_DoCompare( - upb_UnknownField_Context* ctx, const char* buf1, size_t size1, - const char* buf2, size_t size2) { + upb_UnknownField_Context* ctx, const upb_Message* msg1, + const upb_Message* msg2) { upb_UnknownCompareResult ret; // First build both unknown fields into a sorted data structure (similar // to the UnknownFieldSet in C++). - upb_UnknownFields* uf1 = upb_UnknownFields_Build(ctx, buf1, size1); - upb_UnknownFields* uf2 = upb_UnknownFields_Build(ctx, buf2, size2); + upb_UnknownFields* uf1 = upb_UnknownFields_Build(ctx, msg1); + upb_UnknownFields* uf2 = upb_UnknownFields_Build(ctx, msg2); // Now perform the equality check on the sorted structures. if (upb_UnknownFields_IsEqual(uf1, uf2)) { @@ -253,11 +305,11 @@ static upb_UnknownCompareResult upb_UnknownField_DoCompare( } static upb_UnknownCompareResult upb_UnknownField_Compare( - upb_UnknownField_Context* const ctx, const char* const buf1, - const size_t size1, const char* const buf2, const size_t size2) { + upb_UnknownField_Context* const ctx, const upb_Message* msg1, + const upb_Message* msg2) { upb_UnknownCompareResult ret; if (UPB_SETJMP(ctx->err) == 0) { - ret = upb_UnknownField_DoCompare(ctx, buf1, size1, buf2, size2); + ret = upb_UnknownField_DoCompare(ctx, msg1, msg2); } else { ret = ctx->status; UPB_ASSERT(ret != kUpb_UnknownCompareResult_Equal); @@ -269,11 +321,11 @@ static upb_UnknownCompareResult upb_UnknownField_Compare( } upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - const char* buf1, size_t size1, const char* buf2, size_t size2, - int max_depth) { - if (size1 == 0 && size2 == 0) return kUpb_UnknownCompareResult_Equal; - if (size1 == 0 || size2 == 0) return kUpb_UnknownCompareResult_NotEqual; - if (memcmp(buf1, buf2, size1) == 0) return kUpb_UnknownCompareResult_Equal; + const upb_Message* msg1, const upb_Message* msg2, int max_depth) { + bool msg1_empty = !upb_Message_HasUnknown(msg1); + bool msg2_empty = !upb_Message_HasUnknown(msg2); + if (msg1_empty && msg2_empty) return kUpb_UnknownCompareResult_Equal; + if (msg1_empty || msg2_empty) return kUpb_UnknownCompareResult_NotEqual; upb_UnknownField_Context ctx = { .arena = upb_Arena_New(), @@ -285,5 +337,5 @@ upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( if (!ctx.arena) return kUpb_UnknownCompareResult_OutOfMemory; - return upb_UnknownField_Compare(&ctx, buf1, size1, buf2, size2); + return upb_UnknownField_Compare(&ctx, msg1, msg2); } diff --git a/third_party/protobuf/upb/message/internal/compare_unknown.h b/third_party/protobuf/upb/message/internal/compare_unknown.h index ba6755406409e..ad655f7537e4b 100644 --- a/third_party/protobuf/upb/message/internal/compare_unknown.h +++ b/third_party/protobuf/upb/message/internal/compare_unknown.h @@ -11,6 +11,7 @@ #include <stddef.h> // Must be last. +#include "upb/message/message.h" #include "upb/port/def.inc" #ifdef __cplusplus @@ -37,8 +38,7 @@ typedef enum { } upb_UnknownCompareResult; upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - const char* buf1, size_t size1, const char* buf2, size_t size2, - int max_depth); + const upb_Message* msg1, const upb_Message* msg2, int max_depth); #ifdef __cplusplus } /* extern "C" */ diff --git a/third_party/protobuf/upb/message/internal/compare_unknown_test.cc b/third_party/protobuf/upb/message/internal/compare_unknown_test.cc index 03cd2d006f46e..2d8c32cfa4a5d 100644 --- a/third_party/protobuf/upb/message/internal/compare_unknown_test.cc +++ b/third_party/protobuf/upb/message/internal/compare_unknown_test.cc @@ -15,7 +15,10 @@ #include <gtest/gtest.h> #include "absl/types/variant.h" +#include "google/protobuf/test_messages_proto2.upb.h" #include "upb/base/internal/endian.h" +#include "upb/base/upcast.h" +#include "upb/mem/arena.hpp" #include "upb/wire/types.h" // Must be last. @@ -103,10 +106,21 @@ std::string ToBinaryPayload(const UnknownFields& fields) { upb_UnknownCompareResult CompareUnknownWithMaxDepth(UnknownFields uf1, UnknownFields uf2, int max_depth) { + upb::Arena arena1; + upb::Arena arena2; + protobuf_test_messages_proto2_TestAllTypesProto2* msg1 = + protobuf_test_messages_proto2_TestAllTypesProto2_new(arena1.ptr()); + protobuf_test_messages_proto2_TestAllTypesProto2* msg2 = + protobuf_test_messages_proto2_TestAllTypesProto2_new(arena2.ptr()); + // Add the unknown fields to the messages. std::string buf1 = ToBinaryPayload(uf1); std::string buf2 = ToBinaryPayload(uf2); + UPB_PRIVATE(_upb_Message_AddUnknown)(UPB_UPCAST(msg1), buf1.data(), + buf1.size(), arena1.ptr(), false); + UPB_PRIVATE(_upb_Message_AddUnknown)(UPB_UPCAST(msg2), buf2.data(), + buf2.size(), arena2.ptr(), false); return UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)( - buf1.data(), buf1.size(), buf2.data(), buf2.size(), max_depth); + UPB_UPCAST(msg1), UPB_UPCAST(msg2), max_depth); } upb_UnknownCompareResult CompareUnknown(UnknownFields uf1, UnknownFields uf2) { diff --git a/third_party/protobuf/upb/message/internal/extension.c b/third_party/protobuf/upb/message/internal/extension.c index f55253d495f1e..e4f866b67ee65 100644 --- a/third_party/protobuf/upb/message/internal/extension.c +++ b/third_party/protobuf/upb/message/internal/extension.c @@ -7,6 +7,7 @@ #include "upb/message/internal/extension.h" +#include <stdint.h> #include <string.h> #include "upb/mem/arena.h" @@ -20,44 +21,46 @@ const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( const struct upb_Message* msg, const upb_MiniTableExtension* e) { - size_t n; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &n); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return NULL; - // For now we use linear search exclusively to find extensions. - // If this becomes an issue due to messages with lots of extensions, - // we can introduce a table of some sort. - for (size_t i = 0; i < n; i++) { - if (ext[i].ext == e) { - return &ext[i]; + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + if (ext->ext == e) { + return ext; + } } } return NULL; } -const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)( - const struct upb_Message* msg, size_t* count) { - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - *count = (in->size - in->ext_begin) / sizeof(upb_Extension); - return UPB_PTR_AT(in, in->ext_begin, void); - } else { - *count = 0; - return NULL; - } -} - upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( struct upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* a) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e); if (ext) return ext; - if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(upb_Extension), a)) - return NULL; + + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, a)) return NULL; upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - in->ext_begin -= sizeof(upb_Extension); - ext = UPB_PTR_AT(in, in->ext_begin, void); + ext = upb_Arena_Malloc(a, sizeof(upb_Extension)); + if (!ext) return NULL; memset(ext, 0, sizeof(upb_Extension)); ext->ext = e; + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeExtension(ext); return ext; } + +void upb_Message_ReplaceUnknownWithExtension(struct upb_Message* msg, + uintptr_t iter, + const upb_Extension* ext) { + UPB_ASSERT(iter != 0); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + UPB_ASSERT(in); + size_t index = iter - 1; + upb_TaggedAuxPtr tagged_ptr = in->aux_data[index]; + UPB_ASSERT(upb_TaggedAuxPtr_IsUnknown(tagged_ptr)); + in->aux_data[index] = upb_TaggedAuxPtr_MakeExtension(ext); +} \ No newline at end of file diff --git a/third_party/protobuf/upb/message/internal/extension.h b/third_party/protobuf/upb/message/internal/extension.h index 13f5b77d2f9eb..f6e346d19918f 100644 --- a/third_party/protobuf/upb/message/internal/extension.h +++ b/third_party/protobuf/upb/message/internal/extension.h @@ -11,8 +11,12 @@ #include <stddef.h> #include "upb/mem/arena.h" +#include "upb/message/internal/array.h" +#include "upb/message/internal/map.h" +#include "upb/message/internal/types.h" #include "upb/message/value.h" #include "upb/mini_table/extension.h" +#include "upb/mini_table/internal/field.h" // Must be last. #include "upb/port/def.inc" @@ -41,16 +45,28 @@ upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)( struct upb_Message* msg, const upb_MiniTableExtension* ext, upb_Arena* arena); -// Returns an array of extensions for this message. -// Note: the array is ordered in reverse relative to the order of creation. -const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)( - const struct upb_Message* msg, size_t* count); - // Returns an extension for a message with a given mini table, // or NULL if no extension exists with this mini table. const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)( const struct upb_Message* msg, const upb_MiniTableExtension* ext); +UPB_INLINE bool UPB_PRIVATE(_upb_Extension_IsEmpty)(const upb_Extension* ext) { + switch ( + UPB_PRIVATE(_upb_MiniTableField_Mode)(&ext->ext->UPB_PRIVATE(field))) { + case kUpb_FieldMode_Scalar: + return false; + case kUpb_FieldMode_Array: + return upb_Array_Size(ext->data.array_val) == 0; + case kUpb_FieldMode_Map: + return _upb_Map_Size(ext->data.map_val) == 0; + } + UPB_UNREACHABLE(); +} + +// Replaces the unknown field at iter with the provided extension. +void upb_Message_ReplaceUnknownWithExtension(struct upb_Message* msg, + uintptr_t iter, + const upb_Extension* ext); #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/third_party/protobuf/upb/message/internal/iterator.c b/third_party/protobuf/upb/message/internal/iterator.c index 82f2b378b91ac..b3ad76cab5071 100644 --- a/third_party/protobuf/upb/message/internal/iterator.c +++ b/third_party/protobuf/upb/message/internal/iterator.c @@ -12,10 +12,8 @@ #include "upb/message/accessors.h" #include "upb/message/array.h" #include "upb/message/internal/accessors.h" -#include "upb/message/internal/extension.h" #include "upb/message/map.h" #include "upb/message/message.h" -#include "upb/mini_table/extension.h" #include "upb/mini_table/field.h" #include "upb/mini_table/message.h" @@ -58,21 +56,3 @@ bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg, return false; } - -bool UPB_PRIVATE(_upb_Message_NextExtension)( - const upb_Message* msg, const upb_MiniTable* m, - const upb_MiniTableExtension** out_e, upb_MessageValue* out_v, - size_t* iter) { - size_t count; - const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - size_t i = *iter; - - if (++i < count) { - *out_e = exts[i].ext; - *out_v = exts[i].data; - *iter = i; - return true; - } - - return false; -} \ No newline at end of file diff --git a/third_party/protobuf/upb/message/internal/iterator.h b/third_party/protobuf/upb/message/internal/iterator.h index ad080db70da90..484762dec8f51 100644 --- a/third_party/protobuf/upb/message/internal/iterator.h +++ b/third_party/protobuf/upb/message/internal/iterator.h @@ -9,10 +9,10 @@ #define THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_ #include <stddef.h> +#include <stdint.h> #include "upb/message/message.h" #include "upb/message/value.h" -#include "upb/mini_table/extension.h" #include "upb/mini_table/field.h" #include "upb/mini_table/message.h" @@ -20,16 +20,10 @@ #include "upb/port/def.inc" #define kUpb_BaseField_Begin ((size_t)-1) -#define kUpb_Extension_Begin ((size_t)-1) - bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg, const upb_MiniTable* m, const upb_MiniTableField** out_f, upb_MessageValue* out_v, - size_t* iter); + uintptr_t* iter); -bool UPB_PRIVATE(_upb_Message_NextExtension)( - const upb_Message* msg, const upb_MiniTable* m, - const upb_MiniTableExtension** out_e, upb_MessageValue* out_v, - size_t* iter); #endif // THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_ diff --git a/third_party/protobuf/upb/message/internal/map.h b/third_party/protobuf/upb/message/internal/map.h index e21b61850a1de..8b8827fee32bf 100644 --- a/third_party/protobuf/upb/message/internal/map.h +++ b/third_party/protobuf/upb/message/internal/map.h @@ -95,14 +95,13 @@ UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) { } } -UPB_INLINE void* _upb_map_next(const struct upb_Map* map, size_t* iter) { +UPB_INLINE bool _upb_map_next(const struct upb_Map* map, size_t* iter) { upb_strtable_iter it; it.t = &map->table; it.index = *iter; upb_strtable_next(&it); *iter = it.index; - if (upb_strtable_done(&it)) return NULL; - return (void*)str_tabent(&it); + return !upb_strtable_done(&it); } UPB_INLINE void _upb_Map_Clear(struct upb_Map* map) { diff --git a/third_party/protobuf/upb/message/internal/map_sorter.h b/third_party/protobuf/upb/message/internal/map_sorter.h index 33474d18b8106..4044a55781067 100644 --- a/third_party/protobuf/upb/message/internal/map_sorter.h +++ b/third_party/protobuf/upb/message/internal/map_sorter.h @@ -18,6 +18,7 @@ #include "upb/message/internal/extension.h" #include "upb/message/internal/map.h" #include "upb/message/internal/map_entry.h" +#include "upb/message/internal/message.h" // Must be last. #include "upb/port/def.inc" @@ -80,8 +81,8 @@ UPB_INLINE void _upb_mapsorter_popmap(_upb_mapsorter* s, bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, const struct upb_Map* map, _upb_sortedmap* sorted); -bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, - size_t count, _upb_sortedmap* sorted); +bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Message_Internal* in, + _upb_sortedmap* sorted); #ifdef __cplusplus } /* extern "C" */ diff --git a/third_party/protobuf/upb/message/internal/message.c b/third_party/protobuf/upb/message/internal/message.c index 5f321c7bb220f..9269570713898 100644 --- a/third_party/protobuf/upb/message/internal/message.c +++ b/third_party/protobuf/upb/message/internal/message.c @@ -8,6 +8,8 @@ #include "upb/message/internal/message.h" #include <math.h> +#include <stddef.h> +#include <stdint.h> #include <string.h> #include "upb/base/internal/log2.h" @@ -17,49 +19,66 @@ // Must be last. #include "upb/port/def.inc" -const float kUpb_FltInfinity = (float)(1.0 / 0.0); -const double kUpb_Infinity = 1.0 / 0.0; -const double kUpb_NaN = 0.0 / 0.0; +// The latest win32 SDKs have an invalid definition of NAN. +// https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907 +// +// Unfortunately, the `0.0 / 0.0` workaround doesn't work in Clang under C23, so +// try __builtin_nan first, if that exists. +#ifdef _WIN32 +#ifdef __has_builtin +#if __has_builtin(__builtin_nan) +#define UPB_NAN __builtin_nan("0") +#endif +#if __has_builtin(__builtin_inf) +#define UPB_INFINITY __builtin_inf() +#endif +#endif +#ifndef UPB_NAN +#define UPB_NAN 0.0 / 0.0 +#endif +#ifndef UPB_INFINITY +#define UPB_INFINITY 1.0 / 0.0 +#endif +#else +// For !_WIN32, assume math.h works. +#define UPB_NAN NAN +#define UPB_INFINITY INFINITY +#endif -bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, - upb_Arena* a) { +const float kUpb_FltInfinity = UPB_INFINITY; +const double kUpb_Infinity = UPB_INFINITY; +const double kUpb_NaN = UPB_NAN; + +static size_t _upb_Message_SizeOfInternal(uint32_t count) { + return UPB_SIZEOF_FLEX(upb_Message_Internal, aux_data, count); +} + +bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, + upb_Arena* a) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); - const size_t overhead = sizeof(upb_Message_Internal); - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) { // No internal data, allocate from scratch. - size_t size = UPB_MAX(128, upb_Log2CeilingSize(need + overhead)); - in = upb_Arena_Malloc(a, size); + uint32_t capacity = 4; + in = upb_Arena_Malloc(a, _upb_Message_SizeOfInternal(capacity)); if (!in) return false; - - in->size = size; - in->unknown_end = overhead; - in->ext_begin = size; + in->size = 0; + in->capacity = capacity; UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); - } else if (in->ext_begin - in->unknown_end < need) { + } else if (in->capacity == in->size) { // Internal data is too small, reallocate. - size_t new_size = upb_Log2CeilingSize(in->size + need); - size_t ext_bytes = in->size - in->ext_begin; - size_t new_ext_begin = new_size - ext_bytes; - in = upb_Arena_Realloc(a, in, in->size, new_size); + uint32_t new_capacity = upb_RoundUpToPowerOfTwo(in->size + 1); + in = upb_Arena_Realloc(a, in, _upb_Message_SizeOfInternal(in->capacity), + _upb_Message_SizeOfInternal(new_capacity)); if (!in) return false; - - if (ext_bytes) { - // Need to move extension data to the end. - char* ptr = (char*)in; - memmove(ptr + new_ext_begin, ptr + in->ext_begin, ext_bytes); - } - in->ext_begin = new_ext_begin; - in->size = new_size; + in->capacity = new_capacity; UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); } - - UPB_ASSERT(in->ext_begin - in->unknown_end >= need); + UPB_ASSERT(in->capacity - in->size >= 1); return true; } -#if UPB_TRACING_ENABLED +#ifdef UPB_TRACING_ENABLED static void (*_message_trace_handler)(const upb_MiniTable*, const upb_Arena*); void upb_Message_LogNewMessage(const upb_MiniTable* m, const upb_Arena* arena) { diff --git a/third_party/protobuf/upb/message/internal/message.h b/third_party/protobuf/upb/message/internal/message.h index b371bbe0c8563..678530b172221 100644 --- a/third_party/protobuf/upb/message/internal/message.h +++ b/third_party/protobuf/upb/message/internal/message.h @@ -15,11 +15,15 @@ #ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_ #define UPB_MESSAGE_INTERNAL_MESSAGE_H_ +#include <stdint.h> #include <stdlib.h> #include <string.h> +#include "upb/base/string_view.h" #include "upb/mem/arena.h" #include "upb/message/internal/extension.h" +#include "upb/message/internal/types.h" +#include "upb/mini_table/extension.h" #include "upb/mini_table/message.h" // Must be last. @@ -36,27 +40,58 @@ extern const double kUpb_NaN; // Internal members of a upb_Message that track unknown fields and/or // extensions. We can change this without breaking binary compatibility. -typedef struct upb_Message_Internal { - // Total size of this structure, including the data that follows. - // Must be aligned to 8, which is alignof(upb_Extension) - uint32_t size; +typedef struct upb_TaggedAuxPtr { + uintptr_t ptr; +} upb_TaggedAuxPtr; - /* Offsets relative to the beginning of this structure. - * - * Unknown data grows forward from the beginning to unknown_end. - * Extension data grows backward from size to ext_begin. - * When the two meet, we're out of data and have to realloc. - * - * If we imagine that the final member of this struct is: - * char data[size - overhead]; // overhead = sizeof(upb_Message_Internal) - * - * Then we have: - * unknown data: data[0 .. (unknown_end - overhead)] - * extensions data: data[(ext_begin - overhead) .. (size - overhead)] */ - uint32_t unknown_end; - uint32_t ext_begin; - // Data follows, as if there were an array: - // char data[size - sizeof(upb_Message_Internal)]; +UPB_INLINE bool upb_TaggedAuxPtr_IsNull(upb_TaggedAuxPtr ptr) { + return ptr.ptr == 0; +} + +UPB_INLINE bool upb_TaggedAuxPtr_IsExtension(upb_TaggedAuxPtr ptr) { + return ptr.ptr & 1; +} + +UPB_INLINE bool upb_TaggedAuxPtr_IsUnknown(upb_TaggedAuxPtr ptr) { + return (ptr.ptr != 0) && ((ptr.ptr & 1) == 0); +} + +UPB_INLINE upb_Extension* upb_TaggedAuxPtr_Extension(upb_TaggedAuxPtr ptr) { + UPB_ASSERT(upb_TaggedAuxPtr_IsExtension(ptr)); + return (upb_Extension*)(ptr.ptr & ~1ULL); +} + +UPB_INLINE upb_StringView* upb_TaggedAuxPtr_UnknownData(upb_TaggedAuxPtr ptr) { + UPB_ASSERT(!upb_TaggedAuxPtr_IsExtension(ptr)); + return (upb_StringView*)(ptr.ptr); +} + +UPB_INLINE upb_TaggedAuxPtr upb_TaggedAuxPtr_Null(void) { + upb_TaggedAuxPtr ptr; + ptr.ptr = 0; + return ptr; +} + +UPB_INLINE upb_TaggedAuxPtr +upb_TaggedAuxPtr_MakeExtension(const upb_Extension* e) { + upb_TaggedAuxPtr ptr; + ptr.ptr = (uintptr_t)e | 1; + return ptr; +} + +UPB_INLINE upb_TaggedAuxPtr +upb_TaggedAuxPtr_MakeUnknownData(const upb_StringView* sv) { + upb_TaggedAuxPtr ptr; + ptr.ptr = (uintptr_t)sv; + return ptr; +} + +typedef struct upb_Message_Internal { + // Total number of entries set in aux_data + uint32_t size; + uint32_t capacity; + // Tagged pointers to upb_StringView or upb_Extension + upb_TaggedAuxPtr aux_data[]; } upb_Message_Internal; #ifdef UPB_TRACING_ENABLED @@ -83,14 +118,109 @@ UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m, // Discards the unknown fields for this message only. void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg); -// Adds unknown data (serialized protobuf data) to the given message. -// The data is copied into the message instance. +// Adds unknown data (serialized protobuf data) to the given message. The data +// must represent one or more complete and well formed proto fields. +// If alias is set, will keep a view to the provided data; otherwise a copy is +// made. bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg, const char* data, size_t len, - upb_Arena* arena); + upb_Arena* arena, bool alias); -bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, - upb_Arena* arena); +// Adds unknown data (serialized protobuf data) to the given message. +// The data is copied into the message instance. Data when concatenated together +// must represent one or more complete and well formed proto fields, but the +// individual spans may point only to partial fields. +bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg, + upb_Arena* arena, + upb_StringView data[], size_t count); + +// Ensures at least one slot is available in the aux_data of this message. +// Returns false if a reallocation is needed to satisfy the request, and fails. +bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, + upb_Arena* arena); + +#define kUpb_Message_UnknownBegin 0 +#define kUpb_Message_ExtensionBegin 0 + +UPB_INLINE bool upb_Message_NextUnknown(const struct upb_Message* msg, + upb_StringView* data, uintptr_t* iter) { + const upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + size_t i = *iter; + if (in) { + while (i < in->size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i++]; + if (upb_TaggedAuxPtr_IsUnknown(tagged_ptr)) { + *data = *upb_TaggedAuxPtr_UnknownData(tagged_ptr); + *iter = i; + return true; + } + } + } + data->size = 0; + data->data = NULL; + *iter = i; + return false; +} + +UPB_INLINE bool upb_Message_HasUnknown(const struct upb_Message* msg) { + upb_StringView data; + uintptr_t iter = kUpb_Message_UnknownBegin; + return upb_Message_NextUnknown(msg, &data, &iter); +} + +UPB_INLINE bool upb_Message_NextExtension(const struct upb_Message* msg, + const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, + uintptr_t* iter) { + const upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + uintptr_t i = *iter; + if (in) { + while (i < in->size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i++]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + + // Empty repeated fields or maps semantically don't exist. + if (UPB_PRIVATE(_upb_Extension_IsEmpty)(ext)) continue; + + *out_e = ext->ext; + *out_v = ext->data; + *iter = i; + return true; + } + } + } + *iter = i; + + return false; +} + +UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( + const struct upb_Message* msg, const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, uintptr_t* iter) { + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return false; + uintptr_t i = *iter; + uint32_t size = in->size; + while (i < size) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[size - 1 - i]; + i++; + if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + continue; + } + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + + // Empty repeated fields or maps semantically don't exist. + if (UPB_PRIVATE(_upb_Extension_IsEmpty)(ext)) continue; + + *out_e = ext->ext; + *out_v = ext->data; + *iter = i; + return true; + } + *iter = i; + return false; +} #ifdef __cplusplus } /* extern "C" */ diff --git a/third_party/protobuf/upb/message/map_sorter.c b/third_party/protobuf/upb/message/map_sorter.c index f0a486548e985..b0f1ab7f01bf3 100644 --- a/third_party/protobuf/upb/message/map_sorter.c +++ b/third_party/protobuf/upb/message/map_sorter.c @@ -8,14 +8,18 @@ #include "upb/message/internal/map_sorter.h" #include <stdint.h> +#include <stdlib.h> #include <string.h> #include "upb/base/descriptor_constants.h" #include "upb/base/internal/log2.h" #include "upb/base/string_view.h" +#include "upb/hash/common.h" #include "upb/mem/alloc.h" +#include "upb/message/internal/extension.h" +#include "upb/message/internal/map.h" +#include "upb/message/internal/message.h" #include "upb/message/map.h" -#include "upb/message/message.h" #include "upb/mini_table/extension.h" // Must be last. @@ -100,7 +104,7 @@ static bool _upb_mapsorter_resize(_upb_mapsorter* s, _upb_sortedmap* sorted, if (sorted->end > s->cap) { const int oldsize = s->cap * sizeof(*s->entries); - s->cap = upb_Log2CeilingSize(sorted->end); + s->cap = upb_RoundUpToPowerOfTwo(sorted->end); const int newsize = s->cap * sizeof(*s->entries); s->entries = upb_grealloc(s->entries, oldsize, newsize); if (!s->entries) return false; @@ -144,14 +148,22 @@ static int _upb_mapsorter_cmpext(const void* _a, const void* _b) { return a_num < b_num ? -1 : 1; } -bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Extension* exts, - size_t count, _upb_sortedmap* sorted) { - if (!_upb_mapsorter_resize(s, sorted, count)) return false; - - for (size_t i = 0; i < count; i++) { - s->entries[sorted->start + i] = &exts[i]; +bool _upb_mapsorter_pushexts(_upb_mapsorter* s, const upb_Message_Internal* in, + _upb_sortedmap* sorted) { + size_t count = 0; + for (size_t i = 0; i < in->size; i++) { + count += upb_TaggedAuxPtr_IsExtension(in->aux_data[i]); + } + if (!_upb_mapsorter_resize(s, sorted, count)) return false; + if (count == 0) return true; + const upb_Extension** entry = + (const upb_Extension**)&s->entries[sorted->start]; + for (size_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + *entry++ = upb_TaggedAuxPtr_Extension(tagged_ptr); + } } - qsort(&s->entries[sorted->start], count, sizeof(*s->entries), _upb_mapsorter_cmpext); return true; diff --git a/third_party/protobuf/upb/message/message.c b/third_party/protobuf/upb/message/message.c index 5bb14e759196a..43c257bc09409 100644 --- a/third_party/protobuf/upb/message/message.c +++ b/third_party/protobuf/upb/message/message.c @@ -7,10 +7,12 @@ #include "upb/message/message.h" +#include <stdarg.h> #include <stddef.h> #include <stdint.h> #include <string.h> +#include "upb/base/string_view.h" #include "upb/mem/arena.h" #include "upb/message/accessors.h" #include "upb/message/array.h" @@ -28,64 +30,109 @@ // Must be last. #include "upb/port/def.inc" -static const size_t message_overhead = sizeof(upb_Message_Internal); - upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* a) { return _upb_Message_New(m, a); } bool UPB_PRIVATE(_upb_Message_AddUnknown)(upb_Message* msg, const char* data, - size_t len, upb_Arena* arena) { + size_t len, upb_Arena* arena, + bool alias) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); - if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, len, arena)) return false; + // TODO: b/376969853 - Add debug check that the unknown field is an overall + // valid proto field + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, arena)) { + return false; + } + upb_StringView* view; + if (alias) { + view = upb_Arena_Malloc(arena, sizeof(upb_StringView)); + if (!view) return false; + view->data = data; + } else { + view = upb_Arena_Malloc(arena, sizeof(upb_StringView) + len); + if (!view) return false; + char* copy = UPB_PTR_AT(view, sizeof(upb_StringView), char); + memcpy(copy, data, len); + view->data = copy; + } + view->size = len; upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - memcpy(UPB_PTR_AT(in, in->unknown_end, char), data, len); - in->unknown_end += len; + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeUnknownData(view); + return true; +} + +bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg, + upb_Arena* arena, + upb_StringView data[], + size_t count) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSERT(count > 0); + size_t total_len = 0; + for (size_t i = 0; i < count; i++) { + total_len += data[i].size; + } + if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, arena)) return false; + + upb_StringView* view = + upb_Arena_Malloc(arena, sizeof(upb_StringView) + total_len); + if (!view) return false; + char* copy = UPB_PTR_AT(view, sizeof(upb_StringView), char); + view->data = copy; + view->size = total_len; + for (size_t i = 0; i < count; i++) { + memcpy(copy, data[i].data, data[i].size); + copy += data[i].size; + } + // TODO: b/376969853 - Add debug check that the unknown field is an overall + // valid proto field + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeUnknownData(view); return true; } void _upb_Message_DiscardUnknown_shallow(upb_Message* msg) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - in->unknown_end = message_overhead; + if (!in) return; + uint32_t size = 0; + for (uint32_t i = 0; i < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + in->aux_data[size++] = tagged_ptr; + } } + in->size = size; } -const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len) { - upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - if (in) { - *len = in->unknown_end - message_overhead; - return (char*)(in + 1); - } else { - *len = 0; - return NULL; - } -} - -void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len) { +bool upb_Message_DeleteUnknown(upb_Message* msg, upb_StringView* data, + uintptr_t* iter) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); + UPB_ASSERT(*iter != kUpb_Message_UnknownBegin); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); - const char* internal_unknown_end = UPB_PTR_AT(in, in->unknown_end, char); - + UPB_ASSERT(in); + UPB_ASSERT(*iter <= in->size); #ifndef NDEBUG - size_t full_unknown_size; - const char* full_unknown = upb_Message_GetUnknown(msg, &full_unknown_size); - UPB_ASSERT((uintptr_t)data >= (uintptr_t)full_unknown); - UPB_ASSERT((uintptr_t)data < (uintptr_t)(full_unknown + full_unknown_size)); - UPB_ASSERT((uintptr_t)(data + len) > (uintptr_t)data); - UPB_ASSERT((uintptr_t)(data + len) <= (uintptr_t)internal_unknown_end); + upb_TaggedAuxPtr unknown_ptr = in->aux_data[*iter - 1]; + UPB_ASSERT(upb_TaggedAuxPtr_IsUnknown(unknown_ptr)); + upb_StringView* unknown = upb_TaggedAuxPtr_UnknownData(unknown_ptr); + UPB_ASSERT(unknown->data == data->data); + UPB_ASSERT(unknown->size == data->size); #endif + in->aux_data[*iter - 1] = upb_TaggedAuxPtr_Null(); - if ((data + len) != internal_unknown_end) { - memmove((char*)data, data + len, internal_unknown_end - data - len); - } - in->unknown_end -= len; + return upb_Message_NextUnknown(msg, data, iter); } size_t upb_Message_ExtensionCount(const upb_Message* msg) { - size_t count; - UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return 0; + const upb_MiniTableExtension* ext; + upb_MessageValue val; + uintptr_t iter = kUpb_Message_ExtensionBegin; + size_t count = 0; + while (upb_Message_NextExtension(msg, &ext, &val, &iter)) { + count++; + } return count; } @@ -126,16 +173,21 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) { } // Extensions. - size_t ext_count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &ext_count); - - for (size_t i = 0; i < ext_count; i++) { - const upb_MiniTableExtension* e = ext[i].ext; + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + // TODO: b/376969853 - use iterator API + uint32_t size = in ? in->size : 0; + for (size_t i = 0; i < size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; + if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + continue; + } + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + const upb_MiniTableExtension* e = ext->ext; const upb_MiniTableField* f = &e->UPB_PRIVATE(field); const upb_MiniTable* m2 = upb_MiniTableExtension_GetSubMessage(e); upb_MessageValue val; - memcpy(&val, &ext[i].data, sizeof(upb_MessageValue)); + memcpy(&val, &(ext->data), sizeof(upb_MessageValue)); switch (UPB_PRIVATE(_upb_MiniTableField_Mode)(f)) { case kUpb_FieldMode_Array: { diff --git a/third_party/protobuf/upb/message/message.h b/third_party/protobuf/upb/message/message.h index 50388fcb4364f..f50cadb631f2c 100644 --- a/third_party/protobuf/upb/message/message.h +++ b/third_party/protobuf/upb/message/message.h @@ -13,10 +13,15 @@ #define UPB_MESSAGE_MESSAGE_H_ #include <stddef.h> +#include <stdint.h> +#include "upb/base/string_view.h" #include "upb/mem/arena.h" +#include "upb/message/array.h" +#include "upb/message/internal/extension.h" #include "upb/message/internal/message.h" #include "upb/message/internal/types.h" +#include "upb/mini_table/extension.h" #include "upb/mini_table/message.h" // Must be last. @@ -31,15 +36,66 @@ extern "C" { // Creates a new message with the given mini_table on the given arena. UPB_API upb_Message* upb_Message_New(const upb_MiniTable* m, upb_Arena* arena); +// +// Unknown data may be stored non-contiguously. Each segment stores a block of +// unknown fields. To iterate over segments: +// +// uintptr_t iter = kUpb_Message_UnknownBegin; +// upb_StringView data; +// while (upb_Message_NextUnknown(msg, &data, &iter)) { +// // Use data +// } +// Iterates in the order unknown fields were parsed. + +#define kUpb_Message_UnknownBegin 0 +#define kUpb_Message_ExtensionBegin 0 + +UPB_INLINE bool upb_Message_NextUnknown(const upb_Message* msg, + upb_StringView* data, uintptr_t* iter); + +UPB_INLINE bool upb_Message_HasUnknown(const upb_Message* msg); + // Returns a reference to the message's unknown data. const char* upb_Message_GetUnknown(const upb_Message* msg, size_t* len); -// Removes partial unknown data from message. -void upb_Message_DeleteUnknown(upb_Message* msg, const char* data, size_t len); +// Removes a segment of unknown data from the message, advancing to the next +// segment. Returns false if the removed segment was at the end of the last +// chunk. +// +// This must be done while iterating: +// +// uintptr_t iter = kUpb_Message_UnknownBegin; +// upb_StringView data; +// // Iterate chunks +// while (upb_Message_NextUnknown(msg, &data, &iter)) { +// // Iterate within a chunk, deleting ranges +// while (ShouldDeleteSubSegment(&data)) { +// // Data now points to the region to be deleted +// if (!upb_Message_DeleteUnknown(msg, &data, &iter)) return; +// // If DeleteUnknown returned true, then data now points to the +// // remaining unknown fields after the region that was just deleted. +// } +// } +// +// The range given in `data` must be contained inside the most recently +// returned region. +bool upb_Message_DeleteUnknown(upb_Message* msg, upb_StringView* data, + uintptr_t* iter); // Returns the number of extensions present in this message. size_t upb_Message_ExtensionCount(const upb_Message* msg); +// Iterates extensions in wire order +UPB_INLINE bool upb_Message_NextExtension(const upb_Message* msg, + const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, + uintptr_t* iter); + +// Iterates extensions in reverse wire order +UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( + const struct upb_Message* msg, const upb_MiniTableExtension** out_e, + upb_MessageValue* out_v, uintptr_t* iter); + // Mark a message and all of its descendents as frozen/immutable. UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m); diff --git a/third_party/protobuf/upb/message/promote.c b/third_party/protobuf/upb/message/promote.c index 566049245a30d..2ed22a23dba09 100644 --- a/third_party/protobuf/upb/message/promote.c +++ b/third_party/protobuf/upb/message/promote.c @@ -12,6 +12,7 @@ #include <string.h> #include "upb/base/descriptor_constants.h" +#include "upb/base/string_view.h" #include "upb/mem/arena.h" #include "upb/message/accessors.h" #include "upb/message/array.h" @@ -82,8 +83,6 @@ upb_GetExtension_Status upb_Message_GetOrPromoteExtension( if (result.status != kUpb_FindUnknown_Ok) { return kUpb_GetExtension_NotPresent; } - size_t len; - size_t ofs = result.ptr - upb_Message_GetUnknown(msg, &len); // Decode and promote from unknown. const upb_MiniTable* extension_table = upb_MiniTableExtension_GetSubMessage(ext_table); @@ -102,15 +101,14 @@ upb_GetExtension_Status upb_Message_GetOrPromoteExtension( } upb_Message* extension_msg = parse_result.message; // Add to extensions. - upb_Extension* ext = - UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(msg, ext_table, arena); + upb_Extension* ext = upb_Arena_Malloc(arena, sizeof(upb_Extension)); if (!ext) { return kUpb_GetExtension_OutOfMemory; } + ext->ext = ext_table; ext->data.msg_val = extension_msg; + upb_Message_ReplaceUnknownWithExtension(msg, result.iter, ext); value->msg_val = extension_msg; - const char* delete_ptr = upb_Message_GetUnknown(msg, &len) + ofs; - upb_Message_DeleteUnknown(msg, delete_ptr, result.len); return kUpb_GetExtension_Ok; } @@ -122,35 +120,37 @@ upb_FindUnknownRet upb_Message_FindUnknown(const upb_Message* msg, uint32_t field_number, int depth_limit) { depth_limit = depth_limit ? depth_limit : 100; - - size_t size; upb_FindUnknownRet ret; + ret.iter = kUpb_Message_UnknownBegin; + upb_StringView data; + while (upb_Message_NextUnknown(msg, &data, &ret.iter)) { + upb_EpsCopyInputStream stream; + const char* ptr = data.data; + upb_EpsCopyInputStream_Init(&stream, &ptr, data.size, true); - const char* ptr = upb_Message_GetUnknown(msg, &size); - upb_EpsCopyInputStream stream; - upb_EpsCopyInputStream_Init(&stream, &ptr, size, true); + while (!upb_EpsCopyInputStream_IsDone(&stream, &ptr)) { + uint32_t tag; + const char* unknown_begin = ptr; + ptr = upb_WireReader_ReadTag(ptr, &tag); + if (!ptr) return upb_FindUnknownRet_ParseError(); + if (field_number == upb_WireReader_GetFieldNumber(tag)) { + ret.status = kUpb_FindUnknown_Ok; + ret.ptr = upb_EpsCopyInputStream_GetAliasedPtr(&stream, unknown_begin); + ptr = _upb_WireReader_SkipValue(ptr, tag, depth_limit, &stream); + // Because we know that the input is a flat buffer, it is safe to + // perform pointer arithmetic on aliased pointers. + ret.len = upb_EpsCopyInputStream_GetAliasedPtr(&stream, ptr) - ret.ptr; + return ret; + } - while (!upb_EpsCopyInputStream_IsDone(&stream, &ptr)) { - uint32_t tag; - const char* unknown_begin = ptr; - ptr = upb_WireReader_ReadTag(ptr, &tag); - if (!ptr) return upb_FindUnknownRet_ParseError(); - if (field_number == upb_WireReader_GetFieldNumber(tag)) { - ret.status = kUpb_FindUnknown_Ok; - ret.ptr = upb_EpsCopyInputStream_GetAliasedPtr(&stream, unknown_begin); ptr = _upb_WireReader_SkipValue(ptr, tag, depth_limit, &stream); - // Because we know that the input is a flat buffer, it is safe to perform - // pointer arithmetic on aliased pointers. - ret.len = upb_EpsCopyInputStream_GetAliasedPtr(&stream, ptr) - ret.ptr; - return ret; + if (!ptr) return upb_FindUnknownRet_ParseError(); } - - ptr = _upb_WireReader_SkipValue(ptr, tag, depth_limit, &stream); - if (!ptr) return upb_FindUnknownRet_ParseError(); } ret.status = kUpb_FindUnknown_NotPresent; ret.ptr = NULL; ret.len = 0; + ret.iter = kUpb_Message_UnknownBegin; return ret; } @@ -160,16 +160,20 @@ static upb_DecodeStatus upb_Message_PromoteOne(upb_TaggedMessagePtr* tagged, upb_Arena* arena) { upb_Message* empty = UPB_PRIVATE(_upb_TaggedMessagePtr_GetEmptyMessage)(*tagged); - size_t unknown_size; - const char* unknown_data = upb_Message_GetUnknown(empty, &unknown_size); upb_Message* promoted = upb_Message_New(mini_table, arena); if (!promoted) return kUpb_DecodeStatus_OutOfMemory; - upb_DecodeStatus status = upb_Decode(unknown_data, unknown_size, promoted, - mini_table, NULL, decode_options, arena); - if (status == kUpb_DecodeStatus_Ok) { - *tagged = UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(promoted, false); + upb_StringView unknown_data; + uintptr_t iter = kUpb_Message_UnknownBegin; + while (upb_Message_NextUnknown(empty, &unknown_data, &iter)) { + upb_DecodeStatus status = + upb_Decode(unknown_data.data, unknown_data.size, promoted, mini_table, + NULL, decode_options, arena); + if (status != kUpb_DecodeStatus_Ok) { + return status; + } } - return status; + *tagged = UPB_PRIVATE(_upb_TaggedMessagePtr_Pack)(promoted, false); + return kUpb_DecodeStatus_Ok; } upb_DecodeStatus upb_Message_PromoteMessage(upb_Message* parent, @@ -263,7 +267,9 @@ upb_UnknownToMessageRet upb_MiniTable_PromoteUnknownToMessage( decode_options, arena); if (ret.status == kUpb_UnknownToMessage_Ok) { message = ret.message; - upb_Message_DeleteUnknown(msg, unknown_data, unknown_size); + upb_StringView del = + upb_StringView_FromDataAndSize(unknown_data, unknown_size); + upb_Message_DeleteUnknown(msg, &del, &(unknown.iter)); } } break; case kUpb_FindUnknown_ParseError: @@ -319,7 +325,9 @@ upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMessageArray( if (!upb_Array_Append(repeated_messages, value, arena)) { return kUpb_UnknownToMessage_OutOfMemory; } - upb_Message_DeleteUnknown(msg, unknown.ptr, unknown.len); + upb_StringView del = + upb_StringView_FromDataAndSize(unknown.ptr, unknown.len); + upb_Message_DeleteUnknown(msg, &del, &unknown.iter); } else { return ret.status; } @@ -355,7 +363,9 @@ upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMap( bool insert_success = upb_Message_SetMapEntry(map, mini_table, field, map_entry_message, arena); if (!insert_success) return kUpb_UnknownToMessage_OutOfMemory; - upb_Message_DeleteUnknown(msg, unknown.ptr, unknown.len); + upb_StringView del = + upb_StringView_FromDataAndSize(unknown.ptr, unknown.len); + upb_Message_DeleteUnknown(msg, &del, &unknown.iter); } return kUpb_UnknownToMessage_Ok; } diff --git a/third_party/protobuf/upb/message/promote.h b/third_party/protobuf/upb/message/promote.h index 6c780c9d6c7ea..9e8fbe202c847 100644 --- a/third_party/protobuf/upb/message/promote.h +++ b/third_party/protobuf/upb/message/promote.h @@ -53,6 +53,7 @@ typedef struct { const char* ptr; // Size of unknown field data. size_t len; + uintptr_t iter; } upb_FindUnknownRet; // Finds first occurrence of unknown data by tag id in message. diff --git a/third_party/protobuf/upb/message/promote_test.cc b/third_party/protobuf/upb/message/promote_test.cc index 19ca17d61de5a..a6aab32179714 100644 --- a/third_party/protobuf/upb/message/promote_test.cc +++ b/third_party/protobuf/upb/message/promote_test.cc @@ -48,6 +48,16 @@ namespace { +size_t GetUnknownLength(const upb_Message* msg) { + size_t len = 0; + upb_StringView data; + uintptr_t iter = kUpb_Message_UnknownBegin; + while (upb_Message_NextUnknown(msg, &data, &iter)) { + len += data.size; + } + return len; +} + TEST(GeneratedCode, FindUnknown) { upb_Arena* arena = upb_Arena_New(); upb_test_ModelWithExtensions* msg = upb_test_ModelWithExtensions_new(arena); @@ -182,8 +192,7 @@ TEST(GeneratedCode, Extensions) { arena); // Get unknown extension bytes before promotion. - size_t start_len; - upb_Message_GetUnknown(UPB_UPCAST(base_msg), &start_len); + size_t start_len = GetUnknownLength(UPB_UPCAST(base_msg)); EXPECT_GT(start_len, 0); EXPECT_EQ(0, upb_Message_ExtensionCount(UPB_UPCAST(base_msg))); @@ -236,8 +245,7 @@ TEST(GeneratedCode, Extensions) { EXPECT_EQ(kUpb_GetExtension_Ok, promote_status); EXPECT_EQ(9, upb_test_ModelExtension2_i(ext2)); - size_t end_len; - upb_Message_GetUnknown(UPB_UPCAST(base_msg), &end_len); + size_t end_len = GetUnknownLength(UPB_UPCAST(base_msg)); EXPECT_LT(end_len, start_len); EXPECT_EQ(6, upb_Message_ExtensionCount(UPB_UPCAST(base_msg))); diff --git a/third_party/protobuf/upb/message/test.cc b/third_party/protobuf/upb/message/test.cc index 446da19dfa622..c18835005a2aa 100644 --- a/third_party/protobuf/upb/message/test.cc +++ b/third_party/protobuf/upb/message/test.cc @@ -7,12 +7,15 @@ #include <cstddef> #include <cstdint> +#include <optional> #include <string> #include <string_view> +#include <utility> #include <vector> #include <gmock/gmock.h> #include <gtest/gtest.h> +#include "absl/strings/escaping.h" #include "google/protobuf/test_messages_proto3.upb.h" #include "upb/base/status.hpp" #include "upb/base/string_view.h" @@ -22,6 +25,7 @@ #include "upb/mem/arena.h" #include "upb/mem/arena.hpp" #include "upb/message/array.h" +#include "upb/message/compare.h" #include "upb/message/map.h" #include "upb/message/message.h" #include "upb/message/test.upb.h" @@ -35,8 +39,11 @@ #include "upb/reflection/def.hpp" #include "upb/reflection/message.h" #include "upb/test/fuzz_util.h" +#include "upb/text/debug_string.h" #include "upb/wire/decode.h" #include "upb/wire/encode.h" +#include "upb/wire/eps_copy_input_stream.h" +#include "upb/wire/types.h" void VerifyMessage(const upb_test_TestExtensions* ext_msg) { EXPECT_TRUE(upb_test_TestExtensions_has_optional_int32_ext(ext_msg)); @@ -112,6 +119,98 @@ TEST(MessageTest, Extensions) { VerifyMessage(ext_msg4); } +TEST(MessageTest, ExtensionsDeterministic) { + upb::Arena arena; + upb_test_TestExtensions* ext_msg = upb_test_TestExtensions_new(arena.ptr()); + + EXPECT_FALSE(upb_test_TestExtensions_has_optional_int32_ext(ext_msg)); + // EXPECT_FALSE(upb_test_TestExtensions_Nested_has_optional_int32_ext(ext_msg)); + EXPECT_FALSE(upb_test_has_optional_msg_ext(ext_msg)); + + upb::DefPool defpool; + upb::MessageDefPtr m(upb_test_TestExtensions_getmsgdef(defpool.ptr())); + EXPECT_TRUE(m.ptr() != nullptr); + + std::string json = R"json( + { + "[upb_test.TestExtensions.optional_int32_ext]": 123, + "[upb_test.TestExtensions.Nested.repeated_int32_ext]": [], + "[upb_test.optional_msg_ext]": {"optional_int32": 456} + } + )json"; + upb::Status status; + EXPECT_TRUE(upb_JsonDecode(json.data(), json.size(), UPB_UPCAST(ext_msg), + m.ptr(), defpool.ptr(), 0, arena.ptr(), + status.ptr())) + << status.error_message(); + + VerifyMessage(ext_msg); + + size_t size; + char* serialized = + upb_test_TestExtensions_serialize(ext_msg, arena.ptr(), &size); + ASSERT_TRUE(serialized != nullptr); + ASSERT_GE(size, 0); + + size_t deterministic_size; + char* deterministic_serialized = upb_test_TestExtensions_serialize_ex( + ext_msg, kUpb_EncodeOption_Deterministic, arena.ptr(), + &deterministic_size); + ASSERT_TRUE(deterministic_serialized != nullptr); + ASSERT_EQ(deterministic_size, size); +} + +TEST(MessageTest, ExtensionsEmpty) { + upb::Arena arena; + + upb::DefPool defpool; + upb::MessageDefPtr m(upb_test_TestExtensions_getmsgdef(defpool.ptr())); + EXPECT_TRUE(m.ptr() != nullptr); + + for (int options : {0, int{kUpb_EncodeOption_Deterministic}}) { + std::string json_with_empty = R"json( + { + "[upb_test.TestExtensions.optional_int32_ext]": 123, + "[upb_test.TestExtensions.Nested.repeated_int32_ext]": [] + } + )json"; + upb::Status status_empty; + upb_test_TestExtensions* ext_msg_with_empty = + upb_test_TestExtensions_new(arena.ptr()); + EXPECT_TRUE(upb_JsonDecode(json_with_empty.data(), json_with_empty.size(), + UPB_UPCAST(ext_msg_with_empty), m.ptr(), + defpool.ptr(), 0, arena.ptr(), + status_empty.ptr())) + << status_empty.error_message(); + + std::string json = R"json( + { + "[upb_test.TestExtensions.optional_int32_ext]": 123 + } + )json"; + upb::Status status; + upb_test_TestExtensions* ext_msg = upb_test_TestExtensions_new(arena.ptr()); + EXPECT_TRUE(upb_JsonDecode(json.data(), json.size(), UPB_UPCAST(ext_msg), + m.ptr(), defpool.ptr(), 0, arena.ptr(), + status.ptr())) + << status.error_message(); + + size_t size_with_empty; + char* serialized = upb_test_TestExtensions_serialize_ex( + ext_msg_with_empty, options, arena.ptr(), &size_with_empty); + ASSERT_TRUE(serialized != nullptr); + ASSERT_GE(size_with_empty, 0); + + size_t size; + serialized = upb_test_TestExtensions_serialize_ex(ext_msg, options, + arena.ptr(), &size); + ASSERT_TRUE(serialized != nullptr); + // Presence or absence of an empty extension should not affect the + // serialized output. + ASSERT_EQ(size_with_empty, size); + } +} + void VerifyMessageSet(const upb_test_TestMessageSet* mset_msg) { ASSERT_TRUE(mset_msg != nullptr); bool has = upb_test_MessageSetMember_has_message_set_extension(mset_msg); @@ -501,6 +600,7 @@ TEST(MessageTest, MapField) { // parse into second instance upb_test_TestMapFieldExtra* test_msg_extra2 = upb_test_TestMapFieldExtra_parse(serialized, size, arena.ptr()); + ASSERT_NE(nullptr, test_msg_extra2); ASSERT_TRUE( upb_test_TestMapFieldExtra_map_field_get(test_msg_extra2, 0, nullptr)); } diff --git a/third_party/protobuf/upb/message/value.h b/third_party/protobuf/upb/message/value.h index bb1dbbdcbd5c7..04a6a55c78dd3 100644 --- a/third_party/protobuf/upb/message/value.h +++ b/third_party/protobuf/upb/message/value.h @@ -15,6 +15,7 @@ #include <string.h> #include "upb/base/string_view.h" +#include "upb/message/internal/types.h" // Must be last. #include "upb/port/def.inc" @@ -41,6 +42,14 @@ typedef union { // documentation in kUpb_DecodeOption_ExperimentalAllowUnlinked for more // information. uintptr_t tagged_msg_val; // upb_TaggedMessagePtr + + // For an extension field, we are essentially treating ext->data (a + // upb_MessageValue) as if it were a message with one field that lives at + // offset 0. This works because upb_MessageValue is precisely one value that + // can hold any type of data. Recall that an extension can be of any type + // (scalar, repeated, or message). For a message extension, that will be a + // single upb_Message* at offset 0 of the upb_MessageValue. + struct upb_Message UPB_PRIVATE(ext_msg_val); } upb_MessageValue; UPB_API_INLINE upb_MessageValue upb_MessageValue_Zero(void) { diff --git a/third_party/protobuf/upb/mini_descriptor/BUILD b/third_party/protobuf/upb/mini_descriptor/BUILD index a5dbd7ad0f871..6dee2803ecbf7 100644 --- a/third_party/protobuf/upb/mini_descriptor/BUILD +++ b/third_party/protobuf/upb/mini_descriptor/BUILD @@ -62,7 +62,7 @@ cc_test( deps = [ ":internal", ":mini_descriptor", - "//:protobuf", + "//src/google/protobuf", "//upb:base", "//upb:mem", "//upb:message", @@ -70,9 +70,9 @@ cc_test( "//upb:port", "//upb:wire", "//upb/message:internal", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/container:flat_hash_set", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/mini_descriptor/build_enum.c b/third_party/protobuf/upb/mini_descriptor/build_enum.c index 485fee28dafaf..e368ffee89383 100644 --- a/third_party/protobuf/upb/mini_descriptor/build_enum.c +++ b/third_party/protobuf/upb/mini_descriptor/build_enum.c @@ -31,7 +31,7 @@ typedef struct { } upb_MdEnumDecoder; static size_t upb_MiniTableEnum_Size(size_t count) { - return sizeof(upb_MiniTableEnum) + count * sizeof(uint32_t); + return UPB_SIZEOF_FLEX(upb_MiniTableEnum, UPB_PRIVATE(data), count); } static upb_MiniTableEnum* _upb_MiniTable_AddEnumDataMember(upb_MdEnumDecoder* d, diff --git a/third_party/protobuf/upb/mini_descriptor/decode.c b/third_party/protobuf/upb/mini_descriptor/decode.c index 1094fc0435b21..f00cf2afc4c71 100644 --- a/third_party/protobuf/upb/mini_descriptor/decode.c +++ b/third_party/protobuf/upb/mini_descriptor/decode.c @@ -13,12 +13,11 @@ #include <stdlib.h> #include "upb/base/descriptor_constants.h" -#include "upb/base/internal/log2.h" #include "upb/base/status.h" #include "upb/base/string_view.h" +#include "upb/mem/alloc.h" #include "upb/mem/arena.h" #include "upb/message/internal/map_entry.h" -#include "upb/message/internal/types.h" #include "upb/mini_descriptor/internal/base92.h" #include "upb/mini_descriptor/internal/decoder.h" #include "upb/mini_descriptor/internal/modifiers.h" @@ -40,39 +39,36 @@ // 64 is the first hasbit that we currently use. #define kUpb_Reserved_Hasbits (kUpb_Reserved_Hasbytes * 8) -// Note: we sort by this number when calculating layout order. -typedef enum { - kUpb_LayoutItemType_OneofCase, // Oneof case. - kUpb_LayoutItemType_OneofField, // Oneof field data. - kUpb_LayoutItemType_Field, // Non-oneof field data. +#define kUpb_OneOfLayoutItem_IndexSentinel ((uint16_t)-1) - kUpb_LayoutItemType_Max = kUpb_LayoutItemType_Field, -} upb_LayoutItemType; - -#define kUpb_LayoutItem_IndexSentinel ((uint16_t) - 1) +// Stores the field number of the present value of the oneof +#define kUpb_OneOf_CaseFieldRep (kUpb_FieldRep_4Byte) typedef struct { - // Index of the corresponding field. When this is a oneof field, the field's - // offset will be the index of the next field in a linked list. + // Index of the corresponding field. The field's offset will be the index of + // the next field in a linked list. uint16_t field_index; - uint16_t offset; - upb_FieldRep rep; - upb_LayoutItemType type; -} upb_LayoutItem; + // This enum is stored in bytes to avoid trailing padding while preserving + // two-byte alignment. + uint8_t /* upb_FieldRep*/ rep; +} upb_OneOfLayoutItem; typedef struct { - upb_LayoutItem* data; + upb_OneOfLayoutItem* data; size_t size; - size_t capacity; -} upb_LayoutItemVector; + size_t buf_capacity_bytes; +} upb_OneOfLayoutItemVector; typedef struct { upb_MdDecoder base; upb_MiniTable* table; upb_MiniTableField* fields; upb_MiniTablePlatform platform; - upb_LayoutItemVector vec; + upb_OneOfLayoutItemVector oneofs; upb_Arena* arena; + // Initially tracks the count of each field rep type; then, during assignment, + // tracks the base offset for the next processed field of the given rep. + uint16_t rep_counts_offsets[kUpb_FieldRep_Max + 1]; } upb_MtDecoder; // In each field's offset, we temporarily store a presence classifier: @@ -258,30 +254,24 @@ static void upb_MtDecoder_ModifyField(upb_MtDecoder* d, } } -static void upb_MtDecoder_PushItem(upb_MtDecoder* d, upb_LayoutItem item) { - if (d->vec.size == d->vec.capacity) { - size_t new_cap = UPB_MAX(8, d->vec.size * 2); - d->vec.data = realloc(d->vec.data, new_cap * sizeof(*d->vec.data)); - upb_MdDecoder_CheckOutOfMemory(&d->base, d->vec.data); - d->vec.capacity = new_cap; - } - d->vec.data[d->vec.size++] = item; -} - -static void upb_MtDecoder_PushOneof(upb_MtDecoder* d, upb_LayoutItem item) { - if (item.field_index == kUpb_LayoutItem_IndexSentinel) { +static void upb_MtDecoder_PushOneof(upb_MtDecoder* d, + upb_OneOfLayoutItem item) { + if (item.field_index == kUpb_OneOfLayoutItem_IndexSentinel) { upb_MdDecoder_ErrorJmp(&d->base, "Empty oneof"); } + if ((d->oneofs.size + 1) * sizeof(*d->oneofs.data) > + d->oneofs.buf_capacity_bytes) { + size_t new_cap = UPB_MAX(8, d->oneofs.size * 2) * sizeof(*d->oneofs.data); + d->oneofs.data = + upb_grealloc(d->oneofs.data, d->oneofs.buf_capacity_bytes, new_cap); + upb_MdDecoder_CheckOutOfMemory(&d->base, d->oneofs.data); + d->oneofs.buf_capacity_bytes = new_cap; + } item.field_index -= kOneofBase; - // Push oneof data. - item.type = kUpb_LayoutItemType_OneofField; - upb_MtDecoder_PushItem(d, item); - - // Push oneof case. - item.rep = kUpb_FieldRep_4Byte; // Field Number. - item.type = kUpb_LayoutItemType_OneofCase; - upb_MtDecoder_PushItem(d, item); + d->rep_counts_offsets[kUpb_OneOf_CaseFieldRep]++; + d->rep_counts_offsets[item.rep]++; + d->oneofs.data[d->oneofs.size++] = item; } static size_t upb_MtDecoder_SizeOfRep(upb_FieldRep rep, @@ -327,7 +317,7 @@ static size_t upb_MtDecoder_AlignOfRep(upb_FieldRep rep, static const char* upb_MtDecoder_DecodeOneofField(upb_MtDecoder* d, const char* ptr, char first_ch, - upb_LayoutItem* item) { + upb_OneOfLayoutItem* item) { uint32_t field_num; ptr = upb_MdDecoder_DecodeBase92Varint( &d->base, ptr, first_ch, kUpb_EncodedValue_MinOneofField, @@ -363,8 +353,8 @@ static const char* upb_MtDecoder_DecodeOneofField(upb_MtDecoder* d, static const char* upb_MtDecoder_DecodeOneofs(upb_MtDecoder* d, const char* ptr) { - upb_LayoutItem item = {.rep = 0, - .field_index = kUpb_LayoutItem_IndexSentinel}; + upb_OneOfLayoutItem item = { + .rep = 0, .field_index = kUpb_OneOfLayoutItem_IndexSentinel}; while (ptr < d->base.end) { char ch = *ptr++; if (ch == kUpb_EncodedValue_FieldSeparator) { @@ -372,7 +362,8 @@ static const char* upb_MtDecoder_DecodeOneofs(upb_MtDecoder* d, } else if (ch == kUpb_EncodedValue_OneofSeparator) { // End of oneof. upb_MtDecoder_PushOneof(d, item); - item.field_index = kUpb_LayoutItem_IndexSentinel; // Move to next oneof. + item.field_index = + kUpb_OneOfLayoutItem_IndexSentinel; // Move to next oneof. } else { ptr = upb_MtDecoder_DecodeOneofField(d, ptr, ch, &item); } @@ -511,45 +502,42 @@ static void upb_MtDecoder_ParseMessage(upb_MtDecoder* d, const char* data, upb_MtDecoder_AllocateSubs(d, sub_counts); } -static int upb_MtDecoder_CompareFields(const void* _a, const void* _b) { - const upb_LayoutItem* a = _a; - const upb_LayoutItem* b = _b; - // Currently we just sort by: - // 1. rep (smallest fields first) - // 2. type (oneof cases first) - // 2. field_index (smallest numbers first) - // The main goal of this is to reduce space lost to padding. - // Later we may have more subtle reasons to prefer a different ordering. - const int rep_bits = upb_Log2Ceiling(kUpb_FieldRep_Max); - const int type_bits = upb_Log2Ceiling(kUpb_LayoutItemType_Max); - const int idx_bits = (sizeof(a->field_index) * 8); - UPB_ASSERT(idx_bits + rep_bits + type_bits < 32); -#define UPB_COMBINE(rep, ty, idx) (((rep << type_bits) | ty) << idx_bits) | idx - uint32_t a_packed = UPB_COMBINE(a->rep, a->type, a->field_index); - uint32_t b_packed = UPB_COMBINE(b->rep, b->type, b->field_index); - UPB_ASSERT(a_packed != b_packed); -#undef UPB_COMBINE - return a_packed < b_packed ? -1 : 1; -} - -static bool upb_MtDecoder_SortLayoutItems(upb_MtDecoder* d) { - // Add items for all non-oneof fields (oneofs were already added). +static void upb_MtDecoder_CalculateAlignments(upb_MtDecoder* d) { + // Add alignment counts for non-oneof fields (oneofs were added already) int n = d->table->UPB_PRIVATE(field_count); for (int i = 0; i < n; i++) { upb_MiniTableField* f = &d->fields[i]; if (f->UPB_PRIVATE(offset) >= kOneofBase) continue; - upb_LayoutItem item = {.field_index = i, - .rep = f->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift, - .type = kUpb_LayoutItemType_Field}; - upb_MtDecoder_PushItem(d, item); + d->rep_counts_offsets[f->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift]++; } - if (d->vec.size) { - qsort(d->vec.data, d->vec.size, sizeof(*d->vec.data), - upb_MtDecoder_CompareFields); + // Reserve properly aligned space for each type of field representation + // present in this message. When we iterate over the fields, they will obtain + // their offset from within the region matching their alignment requirements. + size_t base = d->table->UPB_PRIVATE(size); + // Start with the lowest alignment requirement, going up, because: + // 1. If there are presence bits, we won't be aligned to start, but adding + // some lower-alignment fields may get us closer without wasting space to + // padding. + // 2. The allocator enforces 8 byte alignment, so moving intermediate padding + // to trailing padding doesn't save us anything. + for (upb_FieldRep rep = kUpb_FieldRep_1Byte; rep <= kUpb_FieldRep_Max; + rep++) { + uint16_t count = d->rep_counts_offsets[rep]; + if (count) { + base = UPB_ALIGN_UP(base, upb_MtDecoder_AlignOfRep(rep, d->platform)); + // This entry now tracks the base offset for this field representation + // type, instead of the count + d->rep_counts_offsets[rep] = base; + base += upb_MtDecoder_SizeOfRep(rep, d->platform) * count; + } } - - return true; + static const size_t max = UINT16_MAX; + if (base > max) { + upb_MdDecoder_ErrorJmp( + &d->base, "Message size exceeded maximum size of %zu bytes", max); + } + d->table->UPB_PRIVATE(size) = (uint16_t)base; } static size_t upb_MiniTable_DivideRoundUp(size_t n, size_t d) { @@ -592,57 +580,33 @@ static void upb_MtDecoder_AssignHasbits(upb_MtDecoder* d) { static size_t upb_MtDecoder_Place(upb_MtDecoder* d, upb_FieldRep rep) { size_t size = upb_MtDecoder_SizeOfRep(rep, d->platform); - size_t align = upb_MtDecoder_AlignOfRep(rep, d->platform); - size_t ret = UPB_ALIGN_UP(d->table->UPB_PRIVATE(size), align); - static const size_t max = UINT16_MAX; - size_t new_size = ret + size; - if (new_size > max) { - upb_MdDecoder_ErrorJmp( - &d->base, "Message size exceeded maximum size of %zu bytes", max); - } - d->table->UPB_PRIVATE(size) = new_size; - return ret; + size_t offset = d->rep_counts_offsets[rep]; + d->rep_counts_offsets[rep] += size; + return offset; } static void upb_MtDecoder_AssignOffsets(upb_MtDecoder* d) { - upb_LayoutItem* end = UPB_PTRADD(d->vec.data, d->vec.size); - - // Compute offsets. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - item->offset = upb_MtDecoder_Place(d, item->rep); + upb_MiniTableField* field_end = + UPB_PTRADD(d->fields, d->table->UPB_PRIVATE(field_count)); + for (upb_MiniTableField* field = d->fields; field < field_end; field++) { + if (field->UPB_PRIVATE(offset) >= kOneofBase) continue; + field->UPB_PRIVATE(offset) = + upb_MtDecoder_Place(d, field->UPB_PRIVATE(mode) >> kUpb_FieldRep_Shift); } - // Assign oneof case offsets. We must do these first, since assigning - // actual offsets will overwrite the links of the linked list. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - if (item->type != kUpb_LayoutItemType_OneofCase) continue; + upb_OneOfLayoutItem* oneof_end = UPB_PTRADD(d->oneofs.data, d->oneofs.size); + + for (upb_OneOfLayoutItem* item = d->oneofs.data; item < oneof_end; item++) { upb_MiniTableField* f = &d->fields[item->field_index]; + uint16_t case_offset = upb_MtDecoder_Place(d, kUpb_OneOf_CaseFieldRep); + uint16_t data_offset = upb_MtDecoder_Place(d, item->rep); while (true) { - f->presence = ~item->offset; - if (f->UPB_PRIVATE(offset) == kUpb_LayoutItem_IndexSentinel) break; - UPB_ASSERT(f->UPB_PRIVATE(offset) - kOneofBase < - d->table->UPB_PRIVATE(field_count)); - f = &d->fields[f->UPB_PRIVATE(offset) - kOneofBase]; - } - } - - // Assign offsets. - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - upb_MiniTableField* f = &d->fields[item->field_index]; - switch (item->type) { - case kUpb_LayoutItemType_OneofField: - while (true) { - uint16_t next_offset = f->UPB_PRIVATE(offset); - f->UPB_PRIVATE(offset) = item->offset; - if (next_offset == kUpb_LayoutItem_IndexSentinel) break; - f = &d->fields[next_offset - kOneofBase]; - } - break; - case kUpb_LayoutItemType_Field: - f->UPB_PRIVATE(offset) = item->offset; - break; - default: - break; + f->presence = ~case_offset; + uint16_t next_offset = f->UPB_PRIVATE(offset); + f->UPB_PRIVATE(offset) = data_offset; + if (next_offset == kUpb_OneOfLayoutItem_IndexSentinel) break; + UPB_ASSERT(next_offset - kOneofBase < d->table->UPB_PRIVATE(field_count)); + f = &d->fields[next_offset - kOneofBase]; } } @@ -696,11 +660,8 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data, UPB_UNREACHABLE(); } - upb_LayoutItem* end = UPB_PTRADD(d->vec.data, d->vec.size); - for (upb_LayoutItem* item = d->vec.data; item < end; item++) { - if (item->type == kUpb_LayoutItemType_OneofCase) { - upb_MdDecoder_ErrorJmp(&d->base, "Map entry cannot have oneof"); - } + if (d->oneofs.size != 0) { + upb_MdDecoder_ErrorJmp(&d->base, "Map entry cannot have oneof"); } upb_MtDecoder_ValidateEntryField(d, &d->table->UPB_PRIVATE(fields)[0], 1); @@ -742,7 +703,7 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( decoder->table->UPB_PRIVATE(dense_below) = 0; decoder->table->UPB_PRIVATE(table_mask) = -1; decoder->table->UPB_PRIVATE(required_count) = 0; -#if UPB_TRACING_ENABLED +#ifdef UPB_TRACING_ENABLED // MiniTables built from MiniDescriptors will not be able to vend the message // name unless it is explicitly set with upb_MiniTable_SetFullName(). decoder->table->UPB_PRIVATE(full_name) = 0; @@ -760,7 +721,7 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( case kUpb_EncodedVersion_MessageV1: upb_MtDecoder_ParseMessage(decoder, data, len); upb_MtDecoder_AssignHasbits(decoder); - upb_MtDecoder_SortLayoutItems(decoder); + upb_MtDecoder_CalculateAlignments(decoder); upb_MtDecoder_AssignOffsets(decoder); break; @@ -774,8 +735,8 @@ static upb_MiniTable* upb_MtDecoder_DoBuildMiniTableWithBuf( } done: - *buf = decoder->vec.data; - *buf_size = decoder->vec.capacity * sizeof(*decoder->vec.data); + *buf = decoder->oneofs.data; + *buf_size = decoder->oneofs.buf_capacity_bytes; return decoder->table; } @@ -783,8 +744,8 @@ static upb_MiniTable* upb_MtDecoder_BuildMiniTableWithBuf( upb_MtDecoder* const decoder, const char* const data, const size_t len, void** const buf, size_t* const buf_size) { if (UPB_SETJMP(decoder->base.err) != 0) { - *buf = decoder->vec.data; - *buf_size = decoder->vec.capacity * sizeof(*decoder->vec.data); + *buf = decoder->oneofs.data; + *buf_size = decoder->oneofs.buf_capacity_bytes; return NULL; } @@ -800,10 +761,10 @@ upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, upb_MtDecoder decoder = { .base = {.status = status}, .platform = platform, - .vec = + .oneofs = { .data = *buf, - .capacity = *buf_size / sizeof(*decoder.vec.data), + .buf_capacity_bytes = *buf_size, .size = 0, }, .arena = arena, @@ -901,6 +862,6 @@ upb_MiniTable* _upb_MiniTable_Build(const char* data, size_t len, size_t size = 0; upb_MiniTable* ret = upb_MiniTable_BuildWithBuf(data, len, platform, arena, &buf, &size, status); - free(buf); + upb_gfree(buf); return ret; } diff --git a/third_party/protobuf/upb/mini_descriptor/decode.h b/third_party/protobuf/upb/mini_descriptor/decode.h index ca0afc04d0171..b5ea16858ac00 100644 --- a/third_party/protobuf/upb/mini_descriptor/decode.h +++ b/third_party/protobuf/upb/mini_descriptor/decode.h @@ -96,10 +96,11 @@ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum( } // Like upb_MiniTable_Build(), but the user provides a buffer of layout data so -// it can be reused from call to call, avoiding repeated realloc()/free(). +// it can be reused from call to call, avoiding repeated +// upb_grealloc()/upb_gfree(). // -// The caller owns `*buf` both before and after the call, and must free() it -// when it is no longer in use. The function will realloc() `*buf` as +// The caller owns `*buf` both before and after the call, and must upb_gfree() +// it when it is no longer in use. The function will upb_grealloc() `*buf` as // necessary, updating `*size` accordingly. upb_MiniTable* upb_MiniTable_BuildWithBuf(const char* data, size_t len, upb_MiniTablePlatform platform, diff --git a/third_party/protobuf/upb/mini_descriptor/internal/encode.hpp b/third_party/protobuf/upb/mini_descriptor/internal/encode.hpp index cfa3bed6cc00b..8f81edae4b337 100644 --- a/third_party/protobuf/upb/mini_descriptor/internal/encode.hpp +++ b/third_party/protobuf/upb/mini_descriptor/internal/encode.hpp @@ -97,7 +97,7 @@ class MtDataEncoder { if (!end) return false; // C++ does not guarantee that string has doubling growth behavior, but // we need it to avoid O(n^2). - str_.reserve(upb_Log2CeilingSize(str_.size() + (end - buf_))); + str_.reserve(upb_RoundUpToPowerOfTwo(str_.size() + (end - buf_))); str_.append(buf_, end - buf_); return true; } diff --git a/third_party/protobuf/upb/mini_table/BUILD b/third_party/protobuf/upb/mini_table/BUILD index 06332a71b1711..91bd31736a87b 100644 --- a/third_party/protobuf/upb/mini_table/BUILD +++ b/third_party/protobuf/upb/mini_table/BUILD @@ -5,6 +5,11 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("//bazel:proto_library.bzl", "proto_library") +load( + "//bazel:upb_minitable_proto_library.bzl", + "upb_minitable_proto_library", +) load( "//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS", @@ -90,8 +95,35 @@ cc_test( "//upb/test:test_messages_proto2_upb_minitable", "//upb/test:test_messages_proto3_upb_minitable", "//upb/test:test_upb_proto", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", + ], +) + +proto_library( + name = "message_benchmark_proto", + testonly = 1, + srcs = ["message_benchmark.proto"], +) + +upb_minitable_proto_library( + name = "message_benchmark_upb_minitable_proto", + testonly = 1, + deps = [":message_benchmark_proto"], +) + +cc_test( + name = "message_benchmark", + srcs = ["message_benchmark.cc"], + deps = [ + ":message_benchmark_upb_minitable_proto", + ":mini_table", + "//upb:mini_table_compat", + "//upb:port", + "@abseil-cpp//absl/random", + "@com_github_google_benchmark//:benchmark_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/mini_table/extension_registry.c b/third_party/protobuf/upb/mini_table/extension_registry.c index 65ac7873256f1..32b07b8599972 100644 --- a/third_party/protobuf/upb/mini_table/extension_registry.c +++ b/third_party/protobuf/upb/mini_table/extension_registry.c @@ -11,6 +11,7 @@ #include <stdint.h> #include <string.h> +#include "upb/hash/common.h" #include "upb/hash/str_table.h" #include "upb/mem/arena.h" #include "upb/mini_table/extension.h" @@ -39,24 +40,32 @@ upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena) { return r; } -UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, - const upb_MiniTableExtension* e) { +UPB_API upb_ExtensionRegistryStatus upb_ExtensionRegistry_Add( + upb_ExtensionRegistry* r, const upb_MiniTableExtension* e) { char buf[EXTREG_KEY_SIZE]; extreg_key(buf, e->UPB_PRIVATE(extendee), upb_MiniTableExtension_Number(e)); - if (upb_strtable_lookup2(&r->exts, buf, EXTREG_KEY_SIZE, NULL)) return false; - return upb_strtable_insert(&r->exts, buf, EXTREG_KEY_SIZE, - upb_value_constptr(e), r->arena); + + if (upb_strtable_lookup2(&r->exts, buf, EXTREG_KEY_SIZE, NULL)) { + return kUpb_ExtensionRegistryStatus_DuplicateEntry; + } + + if (!upb_strtable_insert(&r->exts, buf, EXTREG_KEY_SIZE, + upb_value_constptr(e), r->arena)) { + return kUpb_ExtensionRegistryStatus_OutOfMemory; + } + return kUpb_ExtensionRegistryStatus_Ok; } -bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, - const upb_MiniTableExtension** e, - size_t count) { +upb_ExtensionRegistryStatus upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistry* r, const upb_MiniTableExtension** e, size_t count) { const upb_MiniTableExtension** start = e; const upb_MiniTableExtension** end = UPB_PTRADD(e, count); + upb_ExtensionRegistryStatus status = kUpb_ExtensionRegistryStatus_Ok; for (; e < end; e++) { - if (!upb_ExtensionRegistry_Add(r, *e)) goto failure; + status = upb_ExtensionRegistry_Add(r, *e); + if (status != kUpb_ExtensionRegistryStatus_Ok) goto failure; } - return true; + return kUpb_ExtensionRegistryStatus_Ok; failure: // Back out the entries previously added. @@ -67,7 +76,8 @@ failure: upb_MiniTableExtension_Number(ext)); upb_strtable_remove2(&r->exts, buf, EXTREG_KEY_SIZE, NULL); } - return false; + UPB_ASSERT(status != kUpb_ExtensionRegistryStatus_Ok); + return status; } #ifdef UPB_LINKARR_DECLARE @@ -80,7 +90,9 @@ bool upb_ExtensionRegistry_AddAllLinkedExtensions(upb_ExtensionRegistry* r) { for (const upb_MiniTableExtension* p = start; p < stop; p++) { // Windows can introduce zero padding, so we have to skip zeroes. if (upb_MiniTableExtension_Number(p) != 0) { - if (!upb_ExtensionRegistry_Add(r, p)) return false; + if (upb_ExtensionRegistry_Add(r, p) != kUpb_ExtensionRegistryStatus_Ok) { + return false; + } } } return true; diff --git a/third_party/protobuf/upb/mini_table/extension_registry.h b/third_party/protobuf/upb/mini_table/extension_registry.h index 9f5f81a33c563..6d294a8a6fbca 100644 --- a/third_party/protobuf/upb/mini_table/extension_registry.h +++ b/third_party/protobuf/upb/mini_table/extension_registry.h @@ -8,6 +8,9 @@ #ifndef UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ #define UPB_MINI_TABLE_EXTENSION_REGISTRY_H_ +#include <stddef.h> +#include <stdint.h> + #include "upb/mem/arena.h" #include "upb/mini_table/extension.h" #include "upb/mini_table/message.h" @@ -55,21 +58,25 @@ extern "C" { typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; +typedef enum { + kUpb_ExtensionRegistryStatus_Ok = 0, + kUpb_ExtensionRegistryStatus_DuplicateEntry = 1, + kUpb_ExtensionRegistryStatus_OutOfMemory = 2, +} upb_ExtensionRegistryStatus; + // Creates a upb_ExtensionRegistry in the given arena. // The arena must outlive any use of the extreg. UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); -UPB_API bool upb_ExtensionRegistry_Add(upb_ExtensionRegistry* r, - const upb_MiniTableExtension* e); +UPB_API upb_ExtensionRegistryStatus upb_ExtensionRegistry_Add( + upb_ExtensionRegistry* r, const upb_MiniTableExtension* e); // Adds the given extension info for the array |e| of size |count| into the // registry. If there are any errors, the entire array is backed out. // The extensions must outlive the registry. // Possible errors include OOM or an extension number that already exists. -// TODO: There is currently no way to know the exact reason for failure. -bool upb_ExtensionRegistry_AddArray(upb_ExtensionRegistry* r, - const upb_MiniTableExtension** e, - size_t count); +upb_ExtensionRegistryStatus upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistry* r, const upb_MiniTableExtension** e, size_t count); #ifdef UPB_LINKARR_DECLARE diff --git a/third_party/protobuf/upb/mini_table/message.c b/third_party/protobuf/upb/mini_table/message.c index 5984a6c45de01..964b8c744d0a4 100644 --- a/third_party/protobuf/upb/mini_table/message.c +++ b/third_party/protobuf/upb/mini_table/message.c @@ -7,7 +7,6 @@ #include "upb/mini_table/message.h" -#include <inttypes.h> #include <stddef.h> #include <stdint.h> @@ -27,21 +26,30 @@ const upb_MiniTableField* upb_MiniTable_FindFieldByNumber( } // Slow case: binary search - int lo = m->UPB_PRIVATE(dense_below); - int hi = m->UPB_PRIVATE(field_count) - 1; - while (lo <= hi) { - int mid = (lo + hi) / 2; - uint32_t num = m->UPB_PRIVATE(fields)[mid].UPB_PRIVATE(number); - if (num < number) { - lo = mid + 1; - continue; + uint32_t lo = m->UPB_PRIVATE(dense_below); + int32_t hi = m->UPB_PRIVATE(field_count) - 1; + const upb_MiniTableField* base = m->UPB_PRIVATE(fields); + while (hi >= (int32_t)lo) { + uint32_t mid = (hi + lo) / 2; + uint32_t num = base[mid].UPB_ONLYBITS(number); + // These comparison operations allow, on ARM machines, to fuse all these + // branches into one comparison followed by two CSELs to set the lo/hi + // values, followed by a BNE to continue or terminate the loop. Since binary + // search branches are generally unpredictable (50/50 in each direction), + // this is a good deal. We use signed for the high, as this decrement may + // underflow if mid is 0. + int32_t hi_mid = mid - 1; + uint32_t lo_mid = mid + 1; + if (num == number) { + return &base[mid]; } - if (num > number) { - hi = mid - 1; - continue; + if (UPB_UNPREDICTABLE(num < number)) { + lo = lo_mid; + } else { + hi = hi_mid; } - return &m->UPB_PRIVATE(fields)[mid]; } + return NULL; } diff --git a/third_party/protobuf/upb/mini_table/message_benchmark.cc b/third_party/protobuf/upb/mini_table/message_benchmark.cc new file mode 100644 index 0000000000000..040b1c027b0ca --- /dev/null +++ b/third_party/protobuf/upb/mini_table/message_benchmark.cc @@ -0,0 +1,35 @@ +#include <cstdint> + +#include <benchmark/benchmark.h> +#include "absl/random/random.h" +#include "upb/mini_table/message.h" +#include "upb/mini_table/message_benchmark.upb_minitable.h" +#include "upb/port/def.inc" + +namespace { +static void BM_FindFieldByNumber(benchmark::State& state) { + uint32_t min, max; + if (state.range(0)) { + min = 1; + max = 169; + } else { + min = 171; + max = 552; + } + const upb_MiniTable* ptr = + third_0party_0upb_0upb_0mini_0table__TestManyFields_msg_init_ptr; + absl::BitGen bitgen; + uint32_t search[1024]; + for (auto& s : search) { + s = absl::Uniform(bitgen, min, max); + } + uint32_t i = 0; + for (auto _ : state) { + uint16_t offset = upb_MiniTable_FindFieldByNumber(ptr, search[(i++ % 1024)]) + ->UPB_PRIVATE(offset); + benchmark::DoNotOptimize(offset); + } +} +BENCHMARK(BM_FindFieldByNumber)->Arg(true)->Arg(false); + +} // namespace diff --git a/third_party/protobuf/upb/mini_table/message_benchmark.proto b/third_party/protobuf/upb/mini_table/message_benchmark.proto new file mode 100644 index 0000000000000..a09ef1577ad4d --- /dev/null +++ b/third_party/protobuf/upb/mini_table/message_benchmark.proto @@ -0,0 +1,562 @@ +edition = "2023"; + +package third_party_upb_upb_mini_table; + +option java_multiple_files = true; + +message TestManyFields { + // Densely packed fields + repeated int32 repeated_int32 = 1; + repeated int32 repeated_int32_2 = 2; + repeated int32 repeated_int32_3 = 3; + repeated int32 repeated_int32_4 = 4; + repeated int32 repeated_int32_5 = 5; + repeated int32 repeated_int32_6 = 6; + repeated int32 repeated_int32_7 = 7; + repeated int32 repeated_int32_8 = 8; + repeated int32 repeated_int32_9 = 9; + repeated int32 repeated_int32_10 = 10; + repeated int32 repeated_int32_11 = 11; + repeated int32 repeated_int32_12 = 12; + repeated int32 repeated_int32_13 = 13; + repeated int32 repeated_int32_14 = 14; + repeated int32 repeated_int32_15 = 15; + repeated int32 repeated_int32_16 = 16; + repeated int32 repeated_int32_17 = 17; + repeated int32 repeated_int32_18 = 18; + repeated int32 repeated_int32_19 = 19; + repeated int32 repeated_int32_20 = 20; + repeated int32 repeated_int32_21 = 21; + repeated int32 repeated_int32_22 = 22; + repeated int32 repeated_int32_23 = 23; + repeated int32 repeated_int32_24 = 24; + repeated int32 repeated_int32_25 = 25; + repeated int32 repeated_int32_26 = 26; + repeated int32 repeated_int32_27 = 27; + repeated int32 repeated_int32_28 = 28; + repeated int32 repeated_int32_29 = 29; + repeated int32 repeated_int32_30 = 30; + repeated int32 repeated_int32_31 = 31; + repeated int32 repeated_int32_32 = 32; + repeated int32 repeated_int32_33 = 33; + repeated int32 repeated_int32_34 = 34; + repeated int32 repeated_int32_35 = 35; + repeated int32 repeated_int32_36 = 36; + repeated int32 repeated_int32_37 = 37; + repeated int32 repeated_int32_38 = 38; + repeated int32 repeated_int32_39 = 39; + repeated int32 repeated_int32_40 = 40; + repeated int32 repeated_int32_41 = 41; + repeated int32 repeated_int32_42 = 42; + repeated int32 repeated_int32_43 = 43; + repeated int32 repeated_int32_44 = 44; + repeated int32 repeated_int32_45 = 45; + repeated int32 repeated_int32_46 = 46; + repeated int32 repeated_int32_47 = 47; + repeated int32 repeated_int32_48 = 48; + repeated int32 repeated_int32_49 = 49; + repeated int32 repeated_int32_50 = 50; + repeated int32 repeated_int32_51 = 51; + repeated int32 repeated_int32_52 = 52; + repeated int32 repeated_int32_53 = 53; + repeated int32 repeated_int32_54 = 54; + repeated int32 repeated_int32_55 = 55; + repeated int32 repeated_int32_56 = 56; + repeated int32 repeated_int32_57 = 57; + repeated int32 repeated_int32_58 = 58; + repeated int32 repeated_int32_59 = 59; + repeated int32 repeated_int32_60 = 60; + repeated int32 repeated_int32_61 = 61; + repeated int32 repeated_int32_62 = 62; + repeated int32 repeated_int32_63 = 63; + repeated int32 repeated_int32_64 = 64; + repeated int32 repeated_int32_65 = 65; + repeated int32 repeated_int32_66 = 66; + repeated int32 repeated_int32_67 = 67; + repeated int32 repeated_int32_68 = 68; + repeated int32 repeated_int32_69 = 69; + repeated int32 repeated_int32_70 = 70; + repeated int32 repeated_int32_71 = 71; + repeated int32 repeated_int32_72 = 72; + repeated int32 repeated_int32_73 = 73; + repeated int32 repeated_int32_74 = 74; + repeated int32 repeated_int32_75 = 75; + repeated int32 repeated_int32_76 = 76; + repeated int32 repeated_int32_77 = 77; + repeated int32 repeated_int32_78 = 78; + repeated int32 repeated_int32_79 = 79; + repeated int32 repeated_int32_80 = 80; + repeated int32 repeated_int32_81 = 81; + repeated int32 repeated_int32_82 = 82; + repeated int32 repeated_int32_83 = 83; + repeated int32 repeated_int32_84 = 84; + repeated int32 repeated_int32_85 = 85; + repeated int32 repeated_int32_86 = 86; + repeated int32 repeated_int32_87 = 87; + repeated int32 repeated_int32_88 = 88; + repeated int32 repeated_int32_89 = 89; + repeated int32 repeated_int32_90 = 90; + repeated int32 repeated_int32_91 = 91; + repeated int32 repeated_int32_92 = 92; + repeated int32 repeated_int32_93 = 93; + repeated int32 repeated_int32_94 = 94; + repeated int32 repeated_int32_95 = 95; + repeated int32 repeated_int32_96 = 96; + repeated int32 repeated_int32_97 = 97; + repeated int32 repeated_int32_98 = 98; + repeated int32 repeated_int32_99 = 99; + repeated int32 repeated_int32_100 = 100; + repeated int32 repeated_int32_101 = 101; + repeated int32 repeated_int32_102 = 102; + repeated int32 repeated_int32_103 = 103; + repeated int32 repeated_int32_104 = 104; + repeated int32 repeated_int32_105 = 105; + repeated int32 repeated_int32_106 = 106; + repeated int32 repeated_int32_107 = 107; + repeated int32 repeated_int32_108 = 108; + repeated int32 repeated_int32_109 = 109; + repeated int32 repeated_int32_110 = 110; + repeated int32 repeated_int32_111 = 111; + repeated int32 repeated_int32_112 = 112; + repeated int32 repeated_int32_113 = 113; + repeated int32 repeated_int32_114 = 114; + repeated int32 repeated_int32_115 = 115; + repeated int32 repeated_int32_116 = 116; + repeated int32 repeated_int32_117 = 117; + repeated int32 repeated_int32_118 = 118; + repeated int32 repeated_int32_119 = 119; + repeated int32 repeated_int32_120 = 120; + repeated int32 repeated_int32_121 = 121; + repeated int32 repeated_int32_122 = 122; + repeated int32 repeated_int32_123 = 123; + repeated int32 repeated_int32_124 = 124; + repeated int32 repeated_int32_125 = 125; + repeated int32 repeated_int32_126 = 126; + repeated int32 repeated_int32_127 = 127; + repeated int32 repeated_int32_128 = 128; + repeated int32 repeated_int32_129 = 129; + repeated int32 repeated_int32_130 = 130; + repeated int32 repeated_int32_131 = 131; + repeated int32 repeated_int32_132 = 132; + repeated int32 repeated_int32_133 = 133; + repeated int32 repeated_int32_134 = 134; + repeated int32 repeated_int32_135 = 135; + repeated int32 repeated_int32_136 = 136; + repeated int32 repeated_int32_137 = 137; + repeated int32 repeated_int32_138 = 138; + repeated int32 repeated_int32_139 = 139; + repeated int32 repeated_int32_140 = 140; + repeated int32 repeated_int32_141 = 141; + repeated int32 repeated_int32_142 = 142; + repeated int32 repeated_int32_143 = 143; + repeated int32 repeated_int32_144 = 144; + repeated int32 repeated_int32_145 = 145; + repeated int32 repeated_int32_146 = 146; + repeated int32 repeated_int32_147 = 147; + repeated int32 repeated_int32_148 = 148; + repeated int32 repeated_int32_149 = 149; + repeated int32 repeated_int32_150 = 150; + repeated int32 repeated_int32_151 = 151; + repeated int32 repeated_int32_152 = 152; + repeated int32 repeated_int32_153 = 153; + repeated int32 repeated_int32_154 = 154; + repeated int32 repeated_int32_155 = 155; + repeated int32 repeated_int32_156 = 156; + repeated int32 repeated_int32_157 = 157; + repeated int32 repeated_int32_158 = 158; + repeated int32 repeated_int32_159 = 159; + repeated int32 repeated_int32_160 = 160; + repeated int32 repeated_int32_161 = 161; + repeated int32 repeated_int32_162 = 162; + repeated int32 repeated_int32_163 = 163; + repeated int32 repeated_int32_164 = 164; + repeated int32 repeated_int32_165 = 165; + repeated int32 repeated_int32_166 = 166; + repeated int32 repeated_int32_167 = 167; + repeated int32 repeated_int32_168 = 168; + repeated int32 repeated_int32_169 = 169; + // Break dense packing of fields + reserved 170; + int32 int32_field_171 = 171; + int32 int32_field_172 = 172; + int32 int32_field_173 = 173; + int32 int32_field_174 = 174; + int32 int32_field_175 = 175; + int32 int32_field_176 = 176; + int32 int32_field_177 = 177; + int32 int32_field_178 = 178; + int32 int32_field_179 = 179; + int32 int32_field_180 = 180; + int32 int32_field_181 = 181; + int32 int32_field_182 = 182; + int32 int32_field_183 = 183; + int32 int32_field_184 = 184; + int32 int32_field_185 = 185; + int32 int32_field_186 = 186; + int32 int32_field_187 = 187; + int32 int32_field_188 = 188; + int32 int32_field_189 = 189; + int32 int32_field_190 = 190; + int32 int32_field_191 = 191; + int32 int32_field_192 = 192; + int32 int32_field_193 = 193; + int32 int32_field_194 = 194; + int32 int32_field_195 = 195; + int32 int32_field_196 = 196; + int32 int32_field_197 = 197; + int32 int32_field_198 = 198; + int32 int32_field_199 = 199; + int32 int32_field_200 = 200; + int32 int32_field_201 = 201; + int32 int32_field_202 = 202; + int32 int32_field_203 = 203; + int32 int32_field_204 = 204; + int32 int32_field_205 = 205; + int32 int32_field_206 = 206; + int32 int32_field_207 = 207; + int32 int32_field_208 = 208; + int32 int32_field_209 = 209; + int32 int32_field_210 = 210; + int32 int32_field_211 = 211; + int32 int32_field_212 = 212; + int32 int32_field_213 = 213; + int32 int32_field_214 = 214; + int32 int32_field_215 = 215; + int32 int32_field_216 = 216; + int32 int32_field_217 = 217; + int32 int32_field_218 = 218; + int32 int32_field_219 = 219; + int32 int32_field_220 = 220; + int32 int32_field_221 = 221; + int32 int32_field_222 = 222; + int32 int32_field_223 = 223; + int32 int32_field_224 = 224; + int32 int32_field_225 = 225; + int32 int32_field_226 = 226; + int32 int32_field_227 = 227; + int32 int32_field_228 = 228; + int32 int32_field_229 = 229; + int32 int32_field_230 = 230; + int32 int32_field_231 = 231; + int32 int32_field_232 = 232; + int32 int32_field_233 = 233; + int32 int32_field_234 = 234; + int32 int32_field_235 = 235; + int32 int32_field_236 = 236; + int32 int32_field_237 = 237; + int32 int32_field_238 = 238; + int32 int32_field_239 = 239; + int32 int32_field_240 = 240; + int32 int32_field_241 = 241; + int32 int32_field_242 = 242; + int32 int32_field_243 = 243; + int32 int32_field_244 = 244; + int32 int32_field_245 = 245; + int32 int32_field_246 = 246; + int32 int32_field_247 = 247; + int32 int32_field_248 = 248; + int32 int32_field_249 = 249; + int32 int32_field_250 = 250; + int32 int32_field_251 = 251; + int32 int32_field_252 = 252; + int32 int32_field_253 = 253; + int32 int32_field_254 = 254; + int32 int32_field_255 = 255; + int32 int32_field_256 = 256; + int32 int32_field_257 = 257; + int32 int32_field_258 = 258; + int32 int32_field_259 = 259; + int32 int32_field_260 = 260; + int32 int32_field_261 = 261; + int32 int32_field_262 = 262; + int32 int32_field_263 = 263; + int32 int32_field_264 = 264; + int32 int32_field_265 = 265; + int32 int32_field_266 = 266; + int32 int32_field_267 = 267; + int32 int32_field_268 = 268; + int32 int32_field_269 = 269; + int32 int32_field_270 = 270; + int32 int32_field_271 = 271; + int32 int32_field_272 = 272; + int32 int32_field_273 = 273; + int32 int32_field_274 = 274; + int32 int32_field_275 = 275; + int32 int32_field_276 = 276; + int32 int32_field_277 = 277; + int32 int32_field_278 = 278; + int32 int32_field_279 = 279; + int32 int32_field_280 = 280; + int32 int32_field_281 = 281; + int32 int32_field_282 = 282; + int32 int32_field_283 = 283; + int32 int32_field_284 = 284; + int32 int32_field_285 = 285; + int32 int32_field_286 = 286; + int32 int32_field_287 = 287; + int32 int32_field_288 = 288; + int32 int32_field_289 = 289; + int32 int32_field_290 = 290; + int32 int32_field_291 = 291; + int32 int32_field_292 = 292; + int32 int32_field_293 = 293; + int32 int32_field_294 = 294; + int32 int32_field_295 = 295; + int32 int32_field_296 = 296; + int32 int32_field_297 = 297; + int32 int32_field_298 = 298; + int32 int32_field_299 = 299; + int32 int32_field_300 = 300; + int32 int32_field_301 = 301; + int32 int32_field_302 = 302; + int32 int32_field_303 = 303; + int32 int32_field_304 = 304; + int32 int32_field_305 = 305; + int32 int32_field_306 = 306; + int32 int32_field_307 = 307; + int32 int32_field_308 = 308; + int32 int32_field_309 = 309; + int32 int32_field_310 = 310; + int32 int32_field_311 = 311; + int32 int32_field_312 = 312; + int32 int32_field_313 = 313; + int32 int32_field_314 = 314; + int32 int32_field_315 = 315; + int32 int32_field_316 = 316; + int32 int32_field_317 = 317; + int32 int32_field_318 = 318; + int32 int32_field_319 = 319; + int32 int32_field_320 = 320; + int32 int32_field_321 = 321; + int32 int32_field_322 = 322; + int32 int32_field_323 = 323; + int32 int32_field_324 = 324; + int32 int32_field_325 = 325; + int32 int32_field_326 = 326; + int32 int32_field_327 = 327; + int32 int32_field_328 = 328; + int32 int32_field_329 = 329; + int32 int32_field_330 = 330; + int32 int32_field_331 = 331; + int32 int32_field_332 = 332; + int32 int32_field_333 = 333; + int32 int32_field_334 = 334; + int32 int32_field_335 = 335; + int32 int32_field_336 = 336; + int32 int32_field_337 = 337; + int32 int32_field_338 = 338; + int32 int32_field_339 = 339; + int32 int32_field_340 = 340; + int32 int32_field_341 = 341; + int32 int32_field_342 = 342; + int32 int32_field_343 = 343; + int32 int32_field_344 = 344; + int32 int32_field_345 = 345; + int32 int32_field_346 = 346; + int32 int32_field_347 = 347; + int32 int32_field_348 = 348; + int32 int32_field_349 = 349; + int32 int32_field_350 = 350; + int32 int32_field_351 = 351; + int32 int32_field_352 = 352; + int32 int32_field_353 = 353; + int32 int32_field_354 = 354; + int32 int32_field_355 = 355; + int32 int32_field_356 = 356; + int32 int32_field_357 = 357; + int32 int32_field_358 = 358; + int32 int32_field_359 = 359; + int32 int32_field_360 = 360; + int32 int32_field_361 = 361; + int32 int32_field_362 = 362; + int32 int32_field_363 = 363; + int32 int32_field_364 = 364; + int32 int32_field_365 = 365; + int32 int32_field_366 = 366; + int32 int32_field_367 = 367; + int32 int32_field_368 = 368; + int32 int32_field_369 = 369; + int32 int32_field_370 = 370; + int32 int32_field_371 = 371; + int32 int32_field_372 = 372; + int32 int32_field_373 = 373; + int32 int32_field_374 = 374; + int32 int32_field_375 = 375; + int32 int32_field_376 = 376; + int32 int32_field_377 = 377; + int32 int32_field_378 = 378; + int32 int32_field_379 = 379; + int32 int32_field_380 = 380; + int32 int32_field_381 = 381; + int32 int32_field_382 = 382; + int32 int32_field_383 = 383; + int32 int32_field_384 = 384; + int32 int32_field_385 = 385; + int32 int32_field_386 = 386; + int32 int32_field_387 = 387; + int32 int32_field_388 = 388; + int32 int32_field_389 = 389; + int32 int32_field_390 = 390; + int32 int32_field_391 = 391; + int32 int32_field_392 = 392; + int32 int32_field_393 = 393; + int32 int32_field_394 = 394; + int32 int32_field_395 = 395; + int32 int32_field_396 = 396; + int32 int32_field_397 = 397; + int32 int32_field_398 = 398; + int32 int32_field_399 = 399; + int32 int32_field_400 = 400; + int32 int32_field_401 = 401; + int32 int32_field_402 = 402; + int32 int32_field_403 = 403; + int32 int32_field_404 = 404; + int32 int32_field_405 = 405; + int32 int32_field_406 = 406; + int32 int32_field_407 = 407; + int32 int32_field_408 = 408; + int32 int32_field_409 = 409; + int32 int32_field_410 = 410; + int32 int32_field_411 = 411; + int32 int32_field_412 = 412; + int32 int32_field_413 = 413; + int32 int32_field_414 = 414; + int32 int32_field_415 = 415; + int32 int32_field_416 = 416; + int32 int32_field_417 = 417; + int32 int32_field_418 = 418; + int32 int32_field_419 = 419; + int32 int32_field_420 = 420; + int32 int32_field_421 = 421; + int32 int32_field_422 = 422; + int32 int32_field_423 = 423; + int32 int32_field_424 = 424; + int32 int32_field_425 = 425; + int32 int32_field_426 = 426; + int32 int32_field_427 = 427; + int32 int32_field_428 = 428; + int32 int32_field_429 = 429; + int32 int32_field_430 = 430; + int32 int32_field_431 = 431; + int32 int32_field_432 = 432; + int32 int32_field_433 = 433; + int32 int32_field_434 = 434; + int32 int32_field_435 = 435; + int32 int32_field_436 = 436; + int32 int32_field_437 = 437; + int32 int32_field_438 = 438; + int32 int32_field_439 = 439; + int32 int32_field_440 = 440; + int32 int32_field_441 = 441; + int32 int32_field_442 = 442; + int32 int32_field_443 = 443; + int32 int32_field_444 = 444; + int32 int32_field_445 = 445; + int32 int32_field_446 = 446; + int32 int32_field_447 = 447; + int32 int32_field_448 = 448; + int32 int32_field_449 = 449; + int32 int32_field_450 = 450; + int32 int32_field_451 = 451; + int32 int32_field_452 = 452; + int32 int32_field_453 = 453; + int32 int32_field_454 = 454; + int32 int32_field_455 = 455; + int32 int32_field_456 = 456; + int32 int32_field_457 = 457; + int32 int32_field_458 = 458; + int32 int32_field_459 = 459; + int32 int32_field_460 = 460; + int32 int32_field_461 = 461; + int32 int32_field_462 = 462; + int32 int32_field_463 = 463; + int32 int32_field_464 = 464; + int32 int32_field_465 = 465; + int32 int32_field_466 = 466; + int32 int32_field_467 = 467; + int32 int32_field_468 = 468; + int32 int32_field_469 = 469; + int32 int32_field_470 = 470; + int32 int32_field_471 = 471; + int32 int32_field_472 = 472; + int32 int32_field_473 = 473; + int32 int32_field_474 = 474; + int32 int32_field_475 = 475; + int32 int32_field_476 = 476; + int32 int32_field_477 = 477; + int32 int32_field_478 = 478; + int32 int32_field_479 = 479; + int32 int32_field_480 = 480; + int32 int32_field_481 = 481; + int32 int32_field_482 = 482; + int32 int32_field_483 = 483; + int32 int32_field_484 = 484; + int32 int32_field_485 = 485; + int32 int32_field_486 = 486; + int32 int32_field_487 = 487; + int32 int32_field_488 = 488; + int32 int32_field_489 = 489; + int32 int32_field_490 = 490; + int32 int32_field_491 = 491; + int32 int32_field_492 = 492; + int32 int32_field_493 = 493; + int32 int32_field_494 = 494; + int32 int32_field_495 = 495; + int32 int32_field_496 = 496; + int32 int32_field_497 = 497; + int32 int32_field_498 = 498; + int32 int32_field_499 = 499; + int32 int32_field_500 = 500; + int32 int32_field_501 = 501; + int32 int32_field_502 = 502; + int32 int32_field_503 = 503; + int32 int32_field_504 = 504; + int32 int32_field_505 = 505; + int32 int32_field_506 = 506; + int32 int32_field_507 = 507; + int32 int32_field_508 = 508; + int32 int32_field_509 = 509; + int32 int32_field_510 = 510; + int32 int32_field_511 = 511; + int32 int32_field_512 = 512; + int32 int32_field_513 = 513; + int32 int32_field_514 = 514; + int32 int32_field_515 = 515; + int32 int32_field_516 = 516; + int32 int32_field_517 = 517; + int32 int32_field_518 = 518; + int32 int32_field_519 = 519; + int32 int32_field_520 = 520; + int32 int32_field_521 = 521; + int32 int32_field_522 = 522; + int32 int32_field_523 = 523; + int32 int32_field_524 = 524; + int32 int32_field_525 = 525; + int32 int32_field_526 = 526; + int32 int32_field_527 = 527; + int32 int32_field_528 = 528; + int32 int32_field_529 = 529; + int32 int32_field_530 = 530; + int32 int32_field_531 = 531; + int32 int32_field_532 = 532; + int32 int32_field_533 = 533; + int32 int32_field_534 = 534; + int32 int32_field_535 = 535; + int32 int32_field_536 = 536; + int32 int32_field_537 = 537; + int32 int32_field_538 = 538; + int32 int32_field_539 = 539; + int32 int32_field_540 = 540; + int32 int32_field_541 = 541; + int32 int32_field_542 = 542; + int32 int32_field_543 = 543; + int32 int32_field_544 = 544; + int32 int32_field_545 = 545; + int32 int32_field_546 = 546; + int32 int32_field_547 = 547; + int32 int32_field_548 = 548; + int32 int32_field_549 = 549; + int32 int32_field_550 = 550; + int32 int32_field_551 = 551; + int32 int32_field_552 = 552; +} \ No newline at end of file diff --git a/third_party/protobuf/upb/port/atomic.h b/third_party/protobuf/upb/port/atomic.h index f13caa86cc333..567893e0b7322 100644 --- a/third_party/protobuf/upb/port/atomic.h +++ b/third_party/protobuf/upb/port/atomic.h @@ -21,10 +21,6 @@ #define upb_Atomic_Load(addr, order) atomic_load_explicit(addr, order) #define upb_Atomic_Store(addr, val, order) \ atomic_store_explicit(addr, val, order) -#define upb_Atomic_Add(addr, val, order) \ - atomic_fetch_add_explicit(addr, val, order) -#define upb_Atomic_Sub(addr, val, order) \ - atomic_fetch_sub_explicit(addr, val, order) #define upb_Atomic_Exchange(addr, val, order) \ atomic_exchange_explicit(addr, val, order) #define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ @@ -36,15 +32,146 @@ atomic_compare_exchange_weak_explicit(addr, expected, desired, \ success_order, failure_order) -#else // !UPB_USE_C11_ATOMICS +#elif defined(UPB_USE_MSC_ATOMICS) +#include <intrin.h> +#include <stdbool.h> +#include <stdint.h> + +#define upb_Atomic_Init(addr, val) (*(addr) = val) + +#if defined(_WIN64) +// MSVC, without C11 atomics, does not have any way in pure C to force +// load-acquire store-release behavior, so we hack it with exchanges. +#pragma intrinsic(_InterlockedExchange64) +#define upb_Atomic_Store(addr, val, order) \ + (void)_InterlockedExchange64((uint64_t volatile *)addr, (uint64_t)val) + +#pragma intrinsic(_InterlockedCompareExchange64) +static uintptr_t upb_Atomic_LoadMsc(uint64_t volatile *addr) { + // Compare exchange with an unlikely value reduces the risk of a spurious + // (but harmless) store + return _InterlockedCompareExchange64(addr, 0xDEADC0DEBAADF00D, + 0xDEADC0DEBAADF00D); +} +// If _Generic is available, use it to avoid emitting a "'uintptr_t' differs in +// levels of indirection from 'void *'" or -Wint-conversion compiler warning. +#if __STDC_VERSION__ >= 201112L +#define upb_Atomic_Load(addr, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: upb_Atomic_LoadMsc( \ + (uint64_t volatile *)(addr)), \ + default: (void *)upb_Atomic_LoadMsc((uint64_t volatile *)(addr))) + +#define upb_Atomic_Exchange(addr, val, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: _InterlockedExchange64( \ + (uint64_t volatile *)(addr), (uint64_t)val), \ + default: (void *)_InterlockedExchange64((uint64_t volatile *)addr, \ + (uint64_t)val)) +#else +// Compare exchange with an unlikely value reduces the risk of a spurious +// (but harmless) store +#define upb_Atomic_Load(addr, order) \ + (void *)upb_Atomic_LoadMsc((uint64_t volatile *)(addr)) + +#define upb_Atomic_Exchange(addr, val, order) \ + (void *)_InterlockedExchange64((uint64_t volatile *)addr, (uint64_t)val) +#endif + +#pragma intrinsic(_InterlockedCompareExchange64) +static bool upb_Atomic_CompareExchangeMscP(uint64_t volatile *addr, + uint64_t *expected, + uint64_t desired) { + uint64_t expect_val = *expected; + uint64_t actual_val = + _InterlockedCompareExchange64(addr, desired, expect_val); + if (expect_val != actual_val) { + *expected = actual_val; + return false; + } + return true; +} + +#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ + success_order, failure_order) \ + upb_Atomic_CompareExchangeMscP((uint64_t volatile *)addr, \ + (uint64_t *)expected, (uint64_t)desired) + +#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ + failure_order) \ + upb_Atomic_CompareExchangeMscP((uint64_t volatile *)addr, \ + (uint64_t *)expected, (uint64_t)desired) + +#else // 32 bit pointers +#pragma intrinsic(_InterlockedExchange) +#define upb_Atomic_Store(addr, val, order) \ + (void)_InterlockedExchange((uint32_t volatile *)addr, (uint32_t)val) + +#pragma intrinsic(_InterlockedCompareExchange) +static uintptr_t upb_Atomic_LoadMsc(uint32_t volatile *addr) { + // Compare exchange with an unlikely value reduces the risk of a spurious + // (but harmless) store + return _InterlockedCompareExchange(addr, 0xDEADC0DE, 0xDEADC0DE); +} +// If _Generic is available, use it to avoid emitting 'uintptr_t' differs in +// levels of indirection from 'void *' +#if __STDC_VERSION__ >= 201112L +#define upb_Atomic_Load(addr, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: upb_Atomic_LoadMsc( \ + (uint32_t volatile *)(addr)), \ + default: (void *)upb_Atomic_LoadMsc((uint32_t volatile *)(addr))) + +#define upb_Atomic_Exchange(addr, val, order) \ + _Generic(addr, \ + UPB_ATOMIC(uintptr_t) *: _InterlockedExchange( \ + (uint32_t volatile *)(addr), (uint32_t)val), \ + default: (void *)_InterlockedExchange64((uint32_t volatile *)addr, \ + (uint32_t)val)) +#else +#define upb_Atomic_Load(addr, order) \ + (void *)upb_Atomic_LoadMsc((uint32_t volatile *)(addr)) + +#define upb_Atomic_Exchange(addr, val, order) \ + (void *)_InterlockedExchange((uint32_t volatile *)addr, (uint32_t)val) +#endif + +#pragma intrinsic(_InterlockedCompareExchange) +static bool upb_Atomic_CompareExchangeMscP(uint32_t volatile *addr, + uint32_t *expected, + uint32_t desired) { + uint32_t expect_val = *expected; + uint32_t actual_val = _InterlockedCompareExchange(addr, desired, expect_val); + if (expect_val != actual_val) { + *expected = actual_val; + return false; + } + return true; +} + +#define upb_Atomic_CompareExchangeStrong(addr, expected, desired, \ + success_order, failure_order) \ + upb_Atomic_CompareExchangeMscP((uint32_t volatile *)addr, \ + (uint32_t *)expected, (uint32_t)desired) + +#define upb_Atomic_CompareExchangeWeak(addr, expected, desired, success_order, \ + failure_order) \ + upb_Atomic_CompareExchangeMscP((uint32_t volatile *)addr, \ + (uint32_t *)expected, (uint32_t)desired) +#endif + +#else // No atomics + +#if !defined(UPB_SUPPRESS_MISSING_ATOMICS) +// NOLINTNEXTLINE +#error Your compiler does not support atomic instructions, which UPB uses. If you do not use UPB on multiple threads, you can suppress this error by defining UPB_SUPPRESS_MISSING_ATOMICS. +#endif #include <string.h> #define upb_Atomic_Init(addr, val) (*addr = val) #define upb_Atomic_Load(addr, order) (*addr) #define upb_Atomic_Store(addr, val, order) (*(addr) = val) -#define upb_Atomic_Add(addr, val, order) (*(addr) += val) -#define upb_Atomic_Sub(addr, val, order) (*(addr) -= val) UPB_INLINE void* _upb_NonAtomic_Exchange(void* addr, void* value) { void* old; diff --git a/third_party/protobuf/upb/port/def.inc b/third_party/protobuf/upb/port/def.inc index 4c073b32ffb02..693c06727e839 100644 --- a/third_party/protobuf/upb/port/def.inc +++ b/third_party/protobuf/upb/port/def.inc @@ -28,9 +28,9 @@ */ #if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(__cplusplus) && __cplusplus >= 201703L) || \ (defined(_MSC_VER) && _MSC_VER >= 1900)) -#error upb requires C99 or C++14 or MSVC >= 2015. +#error upb requires C99 or C++17 or MSVC >= 2015. #endif // Portable check for GCC minimum version: @@ -62,7 +62,14 @@ Error, UINTPTR_MAX is undefined /* If we always read/write as a consistent type to each address, this shouldn't * violate aliasing. */ -#define UPB_PTR_AT(msg, ofs, type) ((type*)((char*)(msg) + (ofs))) +#define UPB_PTR_AT(msg, ofs, type) ((type *)((char *)(msg) + (ofs))) + +// A flexible array member may have lower alignment requirements than the struct +// overall - in that case, it can overlap with the trailing padding of the rest +// of the struct, and a naive sizeof(base) + sizeof(flex) * count calculation +// will not take into account that overlap, and allocate more than is required. +#define UPB_SIZEOF_FLEX(type, member, count) \ + UPB_MAX(sizeof(type), offsetof(type, member[count])) #define UPB_MAPTYPE_STRING 0 @@ -76,12 +83,19 @@ Error, UINTPTR_MAX is undefined // UPB_INLINE: inline if possible, emit standalone code if required. #ifdef __cplusplus #define UPB_INLINE inline -#elif defined (__GNUC__) || defined(__clang__) +#elif defined(__GNUC__) || defined(__clang__) #define UPB_INLINE static __inline__ #else #define UPB_INLINE static #endif +// UPB_INLINE_IF_NOT_GCC: because gcc can be very noisy at times. +#if defined(__GNUC__) && !defined(__clang__) +#define UPB_INLINE_IF_NOT_GCC static +#else +#define UPB_INLINE_IF_NOT_GCC UPB_INLINE +#endif + #ifdef UPB_BUILD_API #define UPB_API UPB_EXPORT #define UPB_API_INLINE UPB_EXPORT @@ -103,7 +117,13 @@ Error, UINTPTR_MAX is undefined #ifdef __clang__ #define UPB_ALIGN_OF(type) _Alignof(type) #else -#define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member) +#define UPB_ALIGN_OF(type) \ + offsetof( \ + struct { \ + char c; \ + type member; \ + }, \ + member) #endif #ifdef _MSC_VER @@ -114,7 +134,7 @@ Error, UINTPTR_MAX is undefined #endif // Hints to the compiler about likely/unlikely branches. -#if defined (__GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) #define UPB_LIKELY(x) __builtin_expect((bool)(x), 1) #define UPB_UNLIKELY(x) __builtin_expect((bool)(x), 0) #else @@ -122,18 +142,30 @@ Error, UINTPTR_MAX is undefined #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static #define UPB_NOINLINE __attribute__((noinline)) #define UPB_NORETURN __attribute__((__noreturn__)) -#define UPB_PRINTF(str, first_vararg) __attribute__((format (printf, str, first_vararg))) +#define UPB_PRINTF(str, first_vararg) \ + __attribute__((format(printf, str, first_vararg))) #elif defined(_MSC_VER) #define UPB_NOINLINE #define UPB_FORCEINLINE static #define UPB_NORETURN __declspec(noreturn) #define UPB_PRINTF(str, first_vararg) -#else /* !defined(__GNUC__) */ +#else /* !defined(__GNUC__) */ #define UPB_FORCEINLINE static #define UPB_NOINLINE #define UPB_NORETURN @@ -148,11 +180,15 @@ Error, UINTPTR_MAX is undefined // UPB_ASSUME(): in release mode, we tell the compiler to assume this is true. #ifdef NDEBUG #ifdef __GNUC__ -#define UPB_ASSUME(expr) if (!(expr)) __builtin_unreachable() +#define UPB_ASSUME(expr) \ + if (!(expr)) __builtin_unreachable() #elif defined _MSC_VER -#define UPB_ASSUME(expr) if (!(expr)) __assume(0) +#define UPB_ASSUME(expr) \ + if (!(expr)) __assume(0) #else -#define UPB_ASSUME(expr) do {} while (false && (expr)) +#define UPB_ASSUME(expr) \ + do { \ + } while (false && (expr)) #endif #else #define UPB_ASSUME(expr) assert(expr) @@ -161,13 +197,19 @@ Error, UINTPTR_MAX is undefined /* UPB_ASSERT(): in release mode, we use the expression without letting it be * evaluated. This prevents "unused variable" warnings. */ #ifdef NDEBUG -#define UPB_ASSERT(expr) do {} while (false && (expr)) +#define UPB_ASSERT(expr) \ + do { \ + } while (false && (expr)) #else #define UPB_ASSERT(expr) assert(expr) #endif #if defined(__GNUC__) || defined(__clang__) -#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __builtin_unreachable(); \ + } while (0) #elif defined(_MSC_VER) #define UPB_UNREACHABLE() \ do { \ @@ -175,13 +217,26 @@ Error, UINTPTR_MAX is undefined __assume(0); \ } while (0) #else -#define UPB_UNREACHABLE() do { assert(0); } while(0) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + } while (0) #endif -/* UPB_SETJMP() / UPB_LONGJMP(): avoid setting/restoring signal mask. */ -#ifdef __APPLE__ -#define UPB_SETJMP(buf) _setjmp(buf) -#define UPB_LONGJMP(buf, val) _longjmp(buf, val) +#ifdef __ANDROID__ +#define UPB_DEFAULT_MAX_BLOCK_SIZE 8192 +#else +#define UPB_DEFAULT_MAX_BLOCK_SIZE 32768 +#endif + +/* UPB_SETJMP() / UPB_LONGJMP() */ +// Android uses a custom libc that does not implement all of posix, but it has +// had sigsetjmp/siglongjmp forever on arm and since API 12 on x86. Apple has +// sigsetjmp, but does not define the posix feature test macro. +#if defined(__APPLE__) || defined(_POSIX_C_SOURCE) || defined(__ANDROID__) +// avoid setting/restoring signal mask, which involves costly syscalls +#define UPB_SETJMP(buf) sigsetjmp(buf, 0) +#define UPB_LONGJMP(buf, val) siglongjmp(buf, val) #elif defined(WASM_WAMR) #define UPB_SETJMP(buf) 0 #define UPB_LONGJMP(buf, val) abort() @@ -190,9 +245,23 @@ Error, UINTPTR_MAX is undefined #define UPB_LONGJMP(buf, val) longjmp(buf, val) #endif -#ifdef __GNUC__ +#if ((__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)) #define UPB_USE_C11_ATOMICS +#elif defined(__has_extension) +#if __has_extension(c_atomic) +#define UPB_USE_C11_ATOMICS +#endif +#elif defined(__GNUC__) +// GCC supported atomics as an extension before it supported __has_extension +#define UPB_USE_C11_ATOMICS +#elif defined(_MSC_VER) +#define UPB_USE_MSC_ATOMICS +#endif + +#if defined(UPB_USE_C11_ATOMICS) #define UPB_ATOMIC(T) _Atomic(T) +#elif defined(UPB_USE_MSC_ATOMICS) +#define UPB_ATOMIC(T) volatile T #else #define UPB_ATOMIC(T) T #endif @@ -280,7 +349,7 @@ Error, UINTPTR_MAX is undefined */ /* Due to preprocessor limitations, the conditional logic for setting - * UPN_CLANG_ASAN below cannot be consolidated into a portable one-liner. + * UPB_CLANG_ASAN below cannot be consolidated into a portable one-liner. * See https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html. */ #if defined(__has_feature) @@ -289,8 +358,14 @@ Error, UINTPTR_MAX is undefined #else #define UPB_CLANG_ASAN 0 #endif +#if __has_feature(thread_sanitizer) +#define UPB_CLANG_TSAN 1 +#else +#define UPB_CLANG_TSAN 0 +#endif #else #define UPB_CLANG_ASAN 0 +#define UPB_CLANG_TSAN 0 #endif #if defined(__SANITIZE_ADDRESS__) || UPB_CLANG_ASAN @@ -299,10 +374,10 @@ Error, UINTPTR_MAX is undefined #ifdef __cplusplus extern "C" { #endif -void __asan_poison_memory_region(void const volatile *addr, size_t size); -void __asan_unpoison_memory_region(void const volatile *addr, size_t size); + void __asan_poison_memory_region(void const volatile *addr, size_t size); + void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #ifdef __cplusplus -} /* extern "C" */ +} /* extern "C" */ #endif #define UPB_POISON_MEMORY_REGION(addr, size) \ __asan_poison_memory_region((addr), (size)) @@ -311,10 +386,38 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #else #define UPB_ASAN 0 #define UPB_ASAN_GUARD_SIZE 0 -#define UPB_POISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) -#define UPB_UNPOISON_MEMORY_REGION(addr, size) \ - ((void)(addr), (void)(size)) +#define UPB_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#define UPB_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#endif + +#if defined(__SANITIZE_THREAD__) || UPB_CLANG_TSAN +#define UPB_TSAN_PUBLISHED_MEMBER uintptr_t upb_tsan_safely_published; +#define UPB_TSAN_INIT_PUBLISHED(ptr) (ptr)->upb_tsan_safely_published = 0x5AFE +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + UPB_ASSERT((ptr)->upb_tsan_safely_published == 0x5AFE) +#define UPB_TSAN_PUBLISH 1 +#define UPB_TSAN_CHECK_READ(member) \ + __asm__ volatile("" ::"r"(*(char *)&(member))) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + char *write_upb_tsan_detect_race_ptr = (char *)&(member); \ + char write_upb_tsan_detect_race = *write_upb_tsan_detect_race_ptr; \ + __asm__ volatile("" : "+r"(write_upb_tsan_detect_race)); \ + *write_upb_tsan_detect_race_ptr = write_upb_tsan_detect_race; \ + } while (false) +#else +#define UPB_TSAN_PUBLISHED_MEMBER +#define UPB_TSAN_INIT_PUBLISHED(ptr) +#define UPB_TSAN_CHECK_PUBLISHED(ptr) \ + do { \ + } while (false && (ptr)) +#define UPB_TSAN_PUBLISH 0 +#define UPB_TSAN_CHECK_READ(member) \ + do { \ + } while (false && (member)) +#define UPB_TSAN_CHECK_WRITE(member) \ + do { \ + } while (false && (member)) #endif /* Disable proto2 arena behavior (TEMPORARY) **********************************/ @@ -380,8 +483,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #if defined(__ELF__) || defined(__wasm__) -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("linkarr_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("linkarr_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name; \ extern type const __stop_linkarr_##name; \ @@ -392,8 +496,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); #elif defined(__MACH__) /* As described in: https://stackoverflow.com/a/22366882 */ -#define UPB_LINKARR_APPEND(name) \ - __attribute__((retain, used, section("__DATA,__la_" #name))) +#define UPB_LINKARR_APPEND(name) \ + __attribute__((retain, used, section("__DATA,__la_" #name), \ + no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ extern type const __start_linkarr_##name __asm( \ "section$start$__DATA$__la_" #name); \ @@ -413,8 +518,9 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // Usage of __attribute__ here probably means this is Clang-specific, and would // not work on MSVC. -#define UPB_LINKARR_APPEND(name) \ - __declspec(allocate("la_" #name "$j")) __attribute__((retain, used)) +#define UPB_LINKARR_APPEND(name) \ + __declspec(allocate("la_" #name "$j")) \ + __attribute__((retain, used, no_sanitize("address"))) #define UPB_LINKARR_DECLARE(name, type) \ __declspec(allocate("la_" #name "$a")) type __start_linkarr_##name; \ __declspec(allocate("la_" #name "$z")) type __stop_linkarr_##name; \ @@ -435,8 +541,4 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size); // user code can be updated before upgrading versions of protobuf. #ifdef UPB_FUTURE_BREAKING_CHANGES -// Properly enforce closed enums in python. -// Owner: mkruskal@ -#define UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT 1 - #endif diff --git a/third_party/protobuf/upb/port/undef.inc b/third_party/protobuf/upb/port/undef.inc index f94e2764e8c64..546aca4ced9f0 100644 --- a/third_party/protobuf/upb/port/undef.inc +++ b/third_party/protobuf/upb/port/undef.inc @@ -9,12 +9,14 @@ #undef UPB_SIZE #undef UPB_PTR_AT +#undef UPB_SIZEOF_FLEX #undef UPB_MAPTYPE_STRING #undef UPB_EXPORT #undef UPB_INLINE #undef UPB_API #undef UPBC_API #undef UPB_API_INLINE +#undef UPB_API_INLINE_IF_NOT_GCC #undef UPB_ALIGN_UP #undef UPB_ALIGN_DOWN #undef UPB_ALIGN_MALLOC @@ -23,6 +25,7 @@ #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN @@ -33,6 +36,7 @@ #undef UPB_ASSUME #undef UPB_ASSERT #undef UPB_UNREACHABLE +#undef UPB_DEFAULT_MAX_BLOCK_SIZE #undef UPB_SETJMP #undef UPB_LONGJMP #undef UPB_PTRADD @@ -46,6 +50,12 @@ #undef UPB_ASAN #undef UPB_ASAN_GUARD_SIZE #undef UPB_CLANG_ASAN +#undef UPB_TSAN_PUBLISHED_MEMBER +#undef UPB_TSAN_INIT_PUBLISHED +#undef UPB_TSAN_CHECK_PUBLISHED +#undef UPB_TSAN_PUBLISH +#undef UPB_TSAN_CHECK_READ +#undef UPB_TSAN_CHECK_WRITE #undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN #undef UPB_DEPRECATED #undef UPB_GNUC_MIN @@ -55,6 +65,7 @@ #undef UPB_IS_GOOGLE3 #undef UPB_ATOMIC #undef UPB_USE_C11_ATOMICS +#undef UPB_USE_MSC_ATOMICS #undef UPB_PRIVATE #undef UPB_ONLYBITS #undef UPB_LINKARR_DECLARE @@ -62,4 +73,3 @@ #undef UPB_LINKARR_START #undef UPB_LINKARR_STOP #undef UPB_FUTURE_BREAKING_CHANGES -#undef UPB_FUTURE_PYTHON_CLOSED_ENUM_ENFORCEMENT diff --git a/third_party/protobuf/upb/reflection/BUILD b/third_party/protobuf/upb/reflection/BUILD index 40fd8e54f1603..a052b8ac9216b 100644 --- a/third_party/protobuf/upb/reflection/BUILD +++ b/third_party/protobuf/upb/reflection/BUILD @@ -181,9 +181,9 @@ cc_test( "//upb:port", "//upb:reflection", "//upb/hash", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb.h b/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb.h index 736f42fe5a9d1..141417f5aa3ed 100644 --- a/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb.h +++ b/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb.h @@ -75,6 +75,12 @@ typedef enum { google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 } google_protobuf_ExtensionRangeOptions_VerificationState; +typedef enum { + google_protobuf_FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + google_protobuf_FeatureSet_STYLE2024 = 1, + google_protobuf_FeatureSet_STYLE_LEGACY = 2 +} google_protobuf_FeatureSet_EnforceNamingStyle; + typedef enum { google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, google_protobuf_FeatureSet_OPEN = 1, @@ -364,11 +370,11 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_pro return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -379,7 +385,7 @@ UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -387,7 +393,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_dependency_upb_ return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -396,11 +402,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_dependency_mutable_up return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -412,7 +418,7 @@ UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDes } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -421,7 +427,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_message_type_up return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -431,11 +437,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_message_type_mutable_ return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -447,7 +453,7 @@ UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_Fil } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -456,7 +462,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_enum_type_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -466,11 +472,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_enum_type_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -482,7 +488,7 @@ UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_ } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -491,7 +497,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_service_upb_arr return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -501,11 +507,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_service_mutable_upb_a return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -517,7 +523,7 @@ UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_Fi } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -526,7 +532,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_extension_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -536,45 +542,45 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_extension_mutable_upb return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_FileOptions* default_val = NULL; const google_protobuf_FileOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_SourceCodeInfo* default_val = NULL; const google_protobuf_SourceCodeInfo* ret; - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -585,7 +591,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency( } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -593,7 +599,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_public_dependen return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -602,11 +608,11 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_public_dependency_mut return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -617,7 +623,7 @@ UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(co } } UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_upb_array(const google_protobuf_FileDescriptorProto* msg, size_t* size) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -625,7 +631,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency return arr; } UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutable_upb_array(google_protobuf_FileDescriptorProto* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -634,19 +640,19 @@ UPB_INLINE upb_Array* _google_protobuf_FileDescriptorProto_weak_dependency_mutab return arr; } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { @@ -675,7 +681,7 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_ upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -686,12 +692,12 @@ UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependenc } } UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto* msg, upb_StringView val, upb_Arena* arena) { - upb_MiniTableField field = {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -703,7 +709,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protob return true; } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -715,12 +721,12 @@ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto } } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_DescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__DescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -735,7 +741,7 @@ UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescripto return sub; } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_mutable_enum_type(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -747,12 +753,12 @@ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorP } } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_EnumDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__EnumDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -767,7 +773,7 @@ UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescr return sub; } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_mutable_service(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -779,12 +785,12 @@ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescript } } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_ServiceDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__ServiceDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -799,7 +805,7 @@ UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDe return sub; } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_mutable_extension(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -811,12 +817,12 @@ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptor } } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldDescriptorProto**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { - upb_MiniTableField field = {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldDescriptorProto_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -831,7 +837,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FileOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -844,7 +850,7 @@ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorPro return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { - const upb_MiniTableField field = {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__SourceCodeInfo_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -857,7 +863,7 @@ UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptor return sub; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -868,12 +874,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependenc } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -885,7 +891,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google return true; } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t* size) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -896,12 +902,12 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency( } } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -913,7 +919,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p return true; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, int32_t value) { @@ -1999,67 +2005,67 @@ UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_number(con return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_full_name(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_full_name(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_type(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_ExtensionRangeOptions_Declaration_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_type(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_reserved(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_reserved(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_clear_repeated(google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ExtensionRangeOptions_Declaration_has_repeated(const google_protobuf_ExtensionRangeOptions_Declaration* msg) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } @@ -2068,19 +2074,19 @@ UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_number(goo upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_full_name(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_type(google_protobuf_ExtensionRangeOptions_Declaration *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_reserved(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_ExtensionRangeOptions_Declaration_set_repeated(google_protobuf_ExtensionRangeOptions_Declaration *msg, bool value) { - const upb_MiniTableField field = {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -2121,35 +2127,35 @@ UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_ return ptr; } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { @@ -2201,52 +2207,52 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) { const google_protobuf_FieldOptions* default_val = NULL; const google_protobuf_FieldOptions* ret; - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) { @@ -2266,44 +2272,44 @@ UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { @@ -2319,15 +2325,15 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_Fi upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { - const upb_MiniTableField field = {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -2344,11 +2350,11 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -3100,51 +3106,51 @@ UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google return ptr; } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { @@ -3165,48 +3171,48 @@ UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_p return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { @@ -3223,11 +3229,11 @@ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescripto return sub; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - const upb_MiniTableField field = {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -3300,35 +3306,35 @@ UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const googl return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) { int32_t default_val = 1; int32_t ret; - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) { @@ -3348,115 +3354,115 @@ UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) { bool default_val = true; bool ret; - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) { @@ -3633,11 +3639,11 @@ UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_prot upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { - const upb_MiniTableField field = {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -3645,31 +3651,31 @@ UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileO upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { - const upb_MiniTableField field = {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { @@ -4018,67 +4024,67 @@ UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf return ptr; } UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { @@ -4098,75 +4104,75 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_Fi return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_debug_redact(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_FieldOptions_debug_redact(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_targets(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -4177,7 +4183,7 @@ UPB_INLINE int32_t const* google_protobuf_FieldOptions_targets(const google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -4185,7 +4191,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_targets_upb_array(cons return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -4194,11 +4200,11 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_targets_mutable_upb_array(go return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_edition_defaults(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_protobuf_FieldOptions_edition_defaults(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4210,7 +4216,7 @@ UPB_INLINE const google_protobuf_FieldOptions_EditionDefault* const* google_prot } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -4219,7 +4225,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_edition_defaults_upb_a return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -4229,45 +4235,45 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_edition_defaults_mutable_upb return arr; } UPB_INLINE void google_protobuf_FieldOptions_clear_features(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FieldOptions_features(const google_protobuf_FieldOptions* msg) { const google_protobuf_FeatureSet* default_val = NULL; const google_protobuf_FeatureSet* ret; - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_features(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_feature_support(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_FieldOptions_feature_support(const google_protobuf_FieldOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_feature_support(const google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4279,7 +4285,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Fie } } UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_upb_array(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -4288,7 +4294,7 @@ UPB_INLINE const upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_u return arr; } UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable_upb_array(google_protobuf_FieldOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -4299,19 +4305,19 @@ UPB_INLINE upb_Array* _google_protobuf_FieldOptions_uninterpreted_option_mutable } UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { @@ -4319,23 +4325,23 @@ UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOpt upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_FieldOptions *msg, bool value) { - const upb_MiniTableField field = {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) { - const upb_MiniTableField field = {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -4346,12 +4352,12 @@ UPB_INLINE int32_t* google_protobuf_FieldOptions_mutable_targets(google_protobuf } } UPB_INLINE int32_t* google_protobuf_FieldOptions_resize_targets(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOptions* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -4363,7 +4369,7 @@ UPB_INLINE bool google_protobuf_FieldOptions_add_targets(google_protobuf_FieldOp return true; } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_mutable_edition_defaults(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4375,12 +4381,12 @@ UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOp } } UPB_INLINE google_protobuf_FieldOptions_EditionDefault** google_protobuf_FieldOptions_resize_edition_defaults(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_FieldOptions_EditionDefault**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_FieldOptions_add_edition_defaults(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__EditionDefault_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -4395,7 +4401,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_EditionDefault* google_protobuf_F return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_features(google_protobuf_FieldOptions *msg, google_protobuf_FeatureSet* value) { - const upb_MiniTableField field = {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FeatureSet_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -4408,7 +4414,7 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FieldOptions_mutab return sub; } UPB_INLINE void google_protobuf_FieldOptions_set_feature_support(google_protobuf_FieldOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -4421,7 +4427,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_F return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -4433,12 +4439,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -5049,44 +5055,44 @@ UPB_INLINE bool google_protobuf_EnumValueOptions_has_features(const google_proto return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_debug_redact(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE bool google_protobuf_EnumValueOptions_debug_redact(const google_protobuf_EnumValueOptions* msg) { bool default_val = false; bool ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_debug_redact(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_feature_support(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_FieldOptions_FeatureSupport* google_protobuf_EnumValueOptions_feature_support(const google_protobuf_EnumValueOptions* msg) { const google_protobuf_FieldOptions_FeatureSupport* default_val = NULL; const google_protobuf_FieldOptions_FeatureSupport* ret; - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_feature_support(const google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5098,7 +5104,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_Enu } } UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_upb_array(const google_protobuf_EnumValueOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5107,7 +5113,7 @@ UPB_INLINE const upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_opti return arr; } UPB_INLINE upb_Array* _google_protobuf_EnumValueOptions_uninterpreted_option_mutable_upb_array(google_protobuf_EnumValueOptions* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5135,11 +5141,11 @@ UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_EnumValueOptions_m return sub; } UPB_INLINE void google_protobuf_EnumValueOptions_set_debug_redact(google_protobuf_EnumValueOptions *msg, bool value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_EnumValueOptions_set_feature_support(google_protobuf_EnumValueOptions *msg, google_protobuf_FieldOptions_FeatureSupport* value) { - const upb_MiniTableField field = {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__FieldOptions__FeatureSupport_msg_init); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -5152,7 +5158,7 @@ UPB_INLINE struct google_protobuf_FieldOptions_FeatureSupport* google_protobuf_E return sub; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5164,12 +5170,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOption } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -5551,11 +5557,11 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_p return ptr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5567,7 +5573,7 @@ UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_pro } } UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array(const google_protobuf_UninterpretedOption* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { @@ -5576,7 +5582,7 @@ UPB_INLINE const upb_Array* _google_protobuf_UninterpretedOption_name_upb_array( return arr; } UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_array(google_protobuf_UninterpretedOption* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); @@ -5586,104 +5592,104 @@ UPB_INLINE upb_Array* _google_protobuf_UninterpretedOption_name_mutable_upb_arra return arr; } UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) { uint64_t default_val = (uint64_t)0ull; uint64_t ret; - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) { int64_t default_val = (int64_t)0ll; int64_t ret; - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) { double default_val = 0; double ret; - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { @@ -5695,12 +5701,12 @@ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_Uninte } } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption_NamePart**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption* msg, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; UPB_PRIVATE(_upb_MiniTable_StrongReference)(&google__protobuf__UninterpretedOption__NamePart_msg_init); upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); @@ -5715,27 +5721,27 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_ return sub; } UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { - const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { - const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { - const upb_MiniTableField field = {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { - const upb_MiniTableField field = {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } @@ -5949,6 +5955,22 @@ UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } +UPB_INLINE void google_protobuf_FeatureSet_clear_enforce_naming_style(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); +} +UPB_INLINE int32_t google_protobuf_FeatureSet_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, + &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); +} UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { const upb_MiniTableField field = {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; @@ -5974,6 +5996,10 @@ UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_Featu const upb_MiniTableField field = {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } +UPB_INLINE void google_protobuf_FeatureSet_set_enforce_naming_style(google_protobuf_FeatureSet *msg, int32_t value) { + const upb_MiniTableField field = {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + upb_Message_SetBaseField((upb_Message *)msg, &field, &value); +} /* google.protobuf.FeatureSetDefaults */ @@ -6380,11 +6406,11 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const goog return ptr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6395,7 +6421,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6403,7 +6429,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_path_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6412,11 +6438,11 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_path_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6427,7 +6453,7 @@ UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const goo } } UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_array(const google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6435,7 +6461,7 @@ UPB_INLINE const upb_Array* _google_protobuf_SourceCodeInfo_Location_span_upb_ar return arr; } UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_array(google_protobuf_SourceCodeInfo_Location* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6444,35 +6470,35 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_span_mutable_upb_ return arr; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) { @@ -6509,7 +6535,7 @@ UPB_INLINE upb_Array* _google_protobuf_SourceCodeInfo_Location_leading_detached_ } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6520,12 +6546,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6537,7 +6563,7 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf return true; } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6548,12 +6574,12 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_ } } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6565,11 +6591,11 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf return true; } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { - const upb_MiniTableField field = {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* size) { @@ -6743,11 +6769,11 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const return ptr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6758,7 +6784,7 @@ UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(cons } } UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_upb_array(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -6766,7 +6792,7 @@ UPB_INLINE const upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_u return arr; } UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable_upb_array(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -6775,19 +6801,19 @@ UPB_INLINE upb_Array* _google_protobuf_GeneratedCodeInfo_Annotation_path_mutable return arr; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) { @@ -6840,7 +6866,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -6851,12 +6877,12 @@ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(go } } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (int32_t*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, int32_t val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -6868,7 +6894,7 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro return true; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { diff --git a/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c b/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c index f641f657d63f4..cdd579f9819fc 100644 --- a/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c +++ b/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c @@ -49,16 +49,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileDescriptorProto__subms static const upb_MiniTableField google_protobuf_FileDescriptorProto__fields[13] = { {1, UPB_SIZE(52, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(60, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(12, 48), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(16, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(20, 64), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(24, 72), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(28, 80), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(32, 88), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {9, UPB_SIZE(36, 96), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(40, 104), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {11, UPB_SIZE(44, 112), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {12, UPB_SIZE(68, 120), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(12, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(20, 80), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(24, 88), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(28, 96), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 104), 66, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {9, UPB_SIZE(36, 112), 67, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(40, 120), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {11, UPB_SIZE(44, 128), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {12, UPB_SIZE(68, 48), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {14, UPB_SIZE(48, 12), 69, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; @@ -73,15 +73,15 @@ const upb_MiniTable google__protobuf__FileDescriptorProto_msg_init = { {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x003000003f00001a, &upb_prs_1bt}, - {0x003800003f000022, &upb_prm_1bt_max128b}, - {0x004000003f01002a, &upb_prm_1bt_max128b}, - {0x004800003f020032, &upb_prm_1bt_max64b}, - {0x005000003f03003a, &upb_prm_1bt_max128b}, + {0x004000003f00001a, &upb_prs_1bt}, + {0x004800003f000022, &upb_prm_1bt_max128b}, + {0x005000003f01002a, &upb_prm_1bt_max128b}, + {0x005800003f020032, &upb_prm_1bt_max64b}, + {0x006000003f03003a, &upb_prm_1bt_max128b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x006800003f000050, &upb_prv4_1bt}, - {0x007000003f000058, &upb_prv4_1bt}, + {0x007800003f000050, &upb_prv4_1bt}, + {0x008000003f000058, &upb_prv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -237,16 +237,16 @@ const upb_MiniTable google__protobuf__ExtensionRangeOptions_msg_init = { const upb_MiniTable* google__protobuf__ExtensionRangeOptions_msg_init_ptr = &google__protobuf__ExtensionRangeOptions_msg_init; static const upb_MiniTableField google_protobuf_ExtensionRangeOptions_Declaration__fields[5] = { {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(20, 24), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(28, 40), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {5, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, 17, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {2, 16, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 32), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {5, 9, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__ExtensionRangeOptions__Declaration_msg_init = { NULL, &google_protobuf_ExtensionRangeOptions_Declaration__fields[0], - UPB_SIZE(40, 56), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(32, 48), 5, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.ExtensionRangeOptions.Declaration", #endif @@ -260,23 +260,23 @@ static const upb_MiniTableSubInternal google_protobuf_FieldDescriptorProto__subm }; static const upb_MiniTableField google_protobuf_FieldDescriptorProto__fields[11] = { - {1, UPB_SIZE(36, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(44, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 32, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(40, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, 12, 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 16, 67, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 20, 68, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(52, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(60, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(24, 96), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(48, 64), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(56, 80), 70, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(24, 112), 71, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, {9, UPB_SIZE(28, 24), 72, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, UPB_SIZE(68, 104), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {17, UPB_SIZE(32, 28), 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {10, UPB_SIZE(64, 96), 73, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {17, 10, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldDescriptorProto_msg_init = { &google_protobuf_FieldDescriptorProto__submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], - UPB_SIZE(80, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(72, 120), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldDescriptorProto", #endif @@ -403,18 +403,18 @@ static const upb_MiniTableSubInternal google_protobuf_MethodDescriptorProto__sub }; static const upb_MiniTableField google_protobuf_MethodDescriptorProto__fields[6] = { - {1, UPB_SIZE(20, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(36, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(24, 32), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(32, 48), 66, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(12, 64), 67, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(16, 9), 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(17, 10), 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 9, 68, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 10, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__MethodDescriptorProto_msg_init = { &google_protobuf_MethodDescriptorProto__submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], - UPB_SIZE(48, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(40, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.MethodDescriptorProto", #endif @@ -430,16 +430,16 @@ static const upb_MiniTableSubInternal google_protobuf_FileOptions__submsgs[3] = static const upb_MiniTableField google_protobuf_FileOptions__fields[21] = { {1, UPB_SIZE(32, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {8, 40, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {9, 12, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 16, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {9, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {10, 11, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {11, UPB_SIZE(48, 56), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {16, 17, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 18, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {18, 19, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {20, 20, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {23, 21, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {27, 22, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {31, 23, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 12, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 13, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {18, 14, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {20, 15, 72, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {23, 16, 73, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {27, 17, 74, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {31, 18, 75, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {36, UPB_SIZE(56, 72), 76, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {37, UPB_SIZE(64, 88), 77, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {39, UPB_SIZE(72, 104), 78, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, @@ -566,26 +566,26 @@ static const upb_MiniTableSubInternal google_protobuf_FieldOptions__submsgs[8] = }; static const upb_MiniTableField google_protobuf_FieldOptions__fields[14] = { - {1, 12, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, 16, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {3, 17, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {5, 18, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {1, 16, 64, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {2, 10, 65, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {3, 11, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {5, 12, 67, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {6, 20, 68, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {10, 24, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {15, 25, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {16, 26, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {17, 28, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {19, 32, 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {20, UPB_SIZE(36, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {21, UPB_SIZE(40, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {22, UPB_SIZE(44, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(48, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {10, 13, 69, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {15, 14, 70, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {16, 15, 71, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {17, 24, 72, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {19, UPB_SIZE(28, 32), 0, 7, 14, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {20, UPB_SIZE(32, 40), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {21, UPB_SIZE(36, 48), 73, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {22, UPB_SIZE(40, 56), 74, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(44, 64), 0, 3, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FieldOptions_msg_init = { &google_protobuf_FieldOptions__submsgs[0], &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(56, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(48, 72), 14, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FieldOptions", #endif @@ -788,15 +788,15 @@ static const upb_MiniTableSubInternal google_protobuf_EnumValueOptions__submsgs[ static const upb_MiniTableField google_protobuf_EnumValueOptions__fields[5] = { {1, 9, 64, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {2, UPB_SIZE(12, 16), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 10), 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(20, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(24, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 10, 66, kUpb_NoSub, 8, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(16, 24), 67, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(20, 32), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__EnumValueOptions_msg_init = { &google_protobuf_EnumValueOptions__submsgs[0], &google_protobuf_EnumValueOptions__fields[0], - UPB_SIZE(32, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(24, 40), 5, kUpb_ExtMode_Extendable, 4, UPB_FASTTABLE_MASK(248), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.EnumValueOptions", #endif @@ -954,13 +954,13 @@ static const upb_MiniTableSubInternal google_protobuf_UninterpretedOption__subms }; static const upb_MiniTableField google_protobuf_UninterpretedOption__fields[7] = { - {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(16, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(24, 40), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {5, UPB_SIZE(32, 48), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {6, UPB_SIZE(40, 56), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, - {7, UPB_SIZE(48, 64), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {8, UPB_SIZE(56, 80), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(12, 64), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, 16, 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, UPB_SIZE(40, 72), 65, kUpb_NoSub, 4, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {5, UPB_SIZE(48, 80), 66, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {6, UPB_SIZE(56, 88), 67, kUpb_NoSub, 1, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}, + {7, UPB_SIZE(24, 32), 68, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {8, UPB_SIZE(32, 48), 69, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { @@ -973,7 +973,7 @@ const upb_MiniTable google__protobuf__UninterpretedOption_msg_init = { UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f000012, &upb_prm_1bt_max64b}, + {0x004000003f000012, &upb_prm_1bt_max64b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, }) }; @@ -994,28 +994,30 @@ const upb_MiniTable google__protobuf__UninterpretedOption__NamePart_msg_init = { }; const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init_ptr = &google__protobuf__UninterpretedOption__NamePart_msg_init; -static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[6] = { +static const upb_MiniTableSubInternal google_protobuf_FeatureSet__submsgs[7] = { {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__FieldPresence_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnumType_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__RepeatedFieldEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__Utf8Validation_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__MessageEncoding_enum_init}, {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__JsonFormat_enum_init}, + {.UPB_PRIVATE(subenum) = &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init}, }; -static const upb_MiniTableField google_protobuf_FeatureSet__fields[6] = { +static const upb_MiniTableField google_protobuf_FeatureSet__fields[7] = { {1, 12, 64, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {2, 16, 65, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {3, 20, 66, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, 24, 67, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, 28, 68, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {6, 32, 69, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {7, 36, 70, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google__protobuf__FeatureSet_msg_init = { &google_protobuf_FeatureSet__submsgs[0], &google_protobuf_FeatureSet__fields[0], - 40, 6, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(255), 0, + 40, 7, kUpb_ExtMode_Extendable, 7, UPB_FASTTABLE_MASK(255), 0, #ifdef UPB_TRACING_ENABLED "google.protobuf.FeatureSet", #endif @@ -1093,10 +1095,10 @@ const upb_MiniTable google__protobuf__SourceCodeInfo_msg_init = { const upb_MiniTable* google__protobuf__SourceCodeInfo_msg_init_ptr = &google__protobuf__SourceCodeInfo_msg_init; static const upb_MiniTableField google_protobuf_SourceCodeInfo_Location__fields[5] = { - {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {3, UPB_SIZE(24, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, - {4, UPB_SIZE(32, 48), 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 48), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {3, UPB_SIZE(24, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {4, 32, 65, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {6, UPB_SIZE(20, 64), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; @@ -1109,8 +1111,8 @@ const upb_MiniTable google__protobuf__SourceCodeInfo__Location_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f00000a, &upb_ppv4_1bt}, - {0x001800003f000012, &upb_ppv4_1bt}, + {0x003000003f00000a, &upb_ppv4_1bt}, + {0x003800003f000012, &upb_ppv4_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -1147,8 +1149,8 @@ static const upb_MiniTableSubInternal google_protobuf_GeneratedCodeInfo_Annotati }; static const upb_MiniTableField google_protobuf_GeneratedCodeInfo_Annotation__fields[5] = { - {1, UPB_SIZE(12, 24), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 32), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 40), 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsPacked | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, UPB_SIZE(16, 12), 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {4, UPB_SIZE(20, 16), 66, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {5, UPB_SIZE(24, 20), 67, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, @@ -1163,7 +1165,7 @@ const upb_MiniTable google__protobuf__GeneratedCodeInfo__Annotation_msg_init = { #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001800003f00000a, &upb_ppv4_1bt}, + {0x002800003f00000a, &upb_ppv4_1bt}, }) }; @@ -1195,6 +1197,15 @@ const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationSta }, }; +const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init = { + 64, + 0, + { + 0x7, + 0x0, + }, +}; + const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init = { 64, 0, @@ -1366,9 +1377,10 @@ static const upb_MiniTable *messages_layout[33] = { &google__protobuf__GeneratedCodeInfo__Annotation_msg_init, }; -static const upb_MiniTableEnum *enums_layout[17] = { +static const upb_MiniTableEnum *enums_layout[18] = { &google__protobuf__Edition_enum_init, &google__protobuf__ExtensionRangeOptions__VerificationState_enum_init, + &google__protobuf__FeatureSet__EnforceNamingStyle_enum_init, &google__protobuf__FeatureSet__EnumType_enum_init, &google__protobuf__FeatureSet__FieldPresence_enum_init, &google__protobuf__FeatureSet__JsonFormat_enum_init, @@ -1391,7 +1403,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = { enums_layout, NULL, 33, - 17, + 18, 0, }; diff --git a/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.h b/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.h index 1dea594faf25a..a891a69038998 100644 --- a/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.h +++ b/third_party/protobuf/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.h @@ -87,6 +87,7 @@ extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_ extern const upb_MiniTableEnum google__protobuf__Edition_enum_init; extern const upb_MiniTableEnum google__protobuf__ExtensionRangeOptions__VerificationState_enum_init; +extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnforceNamingStyle_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__EnumType_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__FieldPresence_enum_init; extern const upb_MiniTableEnum google__protobuf__FeatureSet__JsonFormat_enum_init; diff --git a/third_party/protobuf/upb/reflection/def.hpp b/third_party/protobuf/upb/reflection/def.hpp index 452ddc6e32674..9475c98fcb6c5 100644 --- a/third_party/protobuf/upb/reflection/def.hpp +++ b/third_party/protobuf/upb/reflection/def.hpp @@ -93,9 +93,13 @@ class FieldDefPtr { // whatever message this field belongs to. Guaranteed to be less than // f->containing_type()->field_count(). May only be accessed once the def has // been finalized. + // The index ordering here is *dependent* on the order of the fields in the + // .proto file. uint32_t index() const { return upb_FieldDef_Index(ptr_); } - // Index into msgdef->layout->fields or file->exts + // Index into msgdef->layout->fields or file->exts. + // This is the index that the MiniTable uses, and is independent of the order + // of the fields in the .proto file. uint32_t layout_index() const { return upb_FieldDef_LayoutIndex(ptr_); } // The MessageDef to which this field belongs (for extensions, the extended diff --git a/third_party/protobuf/upb/reflection/def_pool.c b/third_party/protobuf/upb/reflection/def_pool.c index 0250d1b0d27af..eac97d005345d 100644 --- a/third_party/protobuf/upb/reflection/def_pool.c +++ b/third_party/protobuf/upb/reflection/def_pool.c @@ -12,6 +12,7 @@ #include "upb/hash/str_table.h" #include "upb/mem/alloc.h" #include "upb/mem/arena.h" +#include "upb/reflection/def.h" #include "upb/reflection/def_type.h" #include "upb/reflection/file_def.h" #include "upb/reflection/internal/def_builder.h" @@ -236,9 +237,15 @@ const upb_FieldDef* upb_DefPool_FindExtensionByNameWithSize( return _upb_DefType_Unpack(v, UPB_DEFTYPE_FIELD); case UPB_DEFTYPE_MSG: { const upb_MessageDef* m = _upb_DefType_Unpack(v, UPB_DEFTYPE_MSG); - return _upb_MessageDef_InMessageSet(m) - ? upb_MessageDef_NestedExtension(m, 0) - : NULL; + if (_upb_MessageDef_InMessageSet(m)) { + for (int i = 0; i < upb_MessageDef_NestedExtensionCount(m); i++) { + const upb_FieldDef* ext = upb_MessageDef_NestedExtension(m, i); + if (upb_FieldDef_MessageSubDef(ext) == m) { + return ext; + } + } + } + return NULL; } default: break; diff --git a/third_party/protobuf/upb/reflection/descriptor_bootstrap.h b/third_party/protobuf/upb/reflection/descriptor_bootstrap.h index c0b760cfa1fba..0a7961d2afa03 100644 --- a/third_party/protobuf/upb/reflection/descriptor_bootstrap.h +++ b/third_party/protobuf/upb/reflection/descriptor_bootstrap.h @@ -6,7 +6,7 @@ #if defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 0 // This header is checked in. #include "upb/reflection/stage0/google/protobuf/descriptor.upb.h" -#elif UPB_BOOTSTRAP_STAGE == 1 +#elif defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 1 // This header is generated at build time by the bootstrapping process. #include "upb/reflection/stage1/google/protobuf/descriptor.upb.h" #else diff --git a/third_party/protobuf/upb/reflection/file_def.c b/third_party/protobuf/upb/reflection/file_def.c index 5a51deecf947e..906b81d05a7f3 100644 --- a/third_party/protobuf/upb/reflection/file_def.c +++ b/third_party/protobuf/upb/reflection/file_def.c @@ -181,7 +181,7 @@ bool upb_FileDef_Resolves(const upb_FileDef* f, const char* path) { return false; } -static char* strviewdup(upb_DefBuilder* ctx, upb_StringView view) { +static char* _strviewdup(upb_DefBuilder* ctx, upb_StringView view) { char* ret = upb_strdup2(view.data, view.size, _upb_DefBuilder_Arena(ctx)); if (!ret) _upb_DefBuilder_OomErr(ctx); return ret; @@ -310,7 +310,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, } upb_StringView name = UPB_DESC(FileDescriptorProto_name)(file_proto); - file->name = strviewdup(ctx, name); + file->name = _strviewdup(ctx, name); if (strlen(file->name) != name.size) { _upb_DefBuilder_Errf(ctx, "File name contained embedded NULL"); } @@ -319,7 +319,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, if (package.size) { _upb_DefBuilder_CheckIdentFull(ctx, package); - file->package = strviewdup(ctx, package); + file->package = _strviewdup(ctx, package); } else { file->package = NULL; } @@ -453,8 +453,15 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, } if (file->ext_count) { - bool ok = upb_ExtensionRegistry_AddArray( + upb_ExtensionRegistryStatus status = upb_ExtensionRegistry_AddArray( _upb_DefPool_ExtReg(ctx->symtab), file->ext_layouts, file->ext_count); - if (!ok) _upb_DefBuilder_OomErr(ctx); + if (status != kUpb_ExtensionRegistryStatus_Ok) { + if (status == kUpb_ExtensionRegistryStatus_OutOfMemory) { + _upb_DefBuilder_OomErr(ctx); + } + + UPB_ASSERT(status == kUpb_ExtensionRegistryStatus_DuplicateEntry); + _upb_DefBuilder_Errf(ctx, "duplicate extension entry"); + } } } diff --git a/third_party/protobuf/upb/reflection/internal/def_builder.c b/third_party/protobuf/upb/reflection/internal/def_builder.c index 7e560177253b8..f8e1deb6c0898 100644 --- a/third_party/protobuf/upb/reflection/internal/def_builder.c +++ b/third_party/protobuf/upb/reflection/internal/def_builder.c @@ -350,7 +350,7 @@ upb_StringView _upb_DefBuilder_MakeKey(upb_DefBuilder* ctx, upb_StringView key) { size_t need = key.size + sizeof(void*); if (ctx->tmp_buf_size < need) { - ctx->tmp_buf_size = UPB_MAX(64, upb_Log2Ceiling(need)); + ctx->tmp_buf_size = UPB_MAX(64, upb_RoundUpToPowerOfTwo(need)); ctx->tmp_buf = upb_Arena_Malloc(ctx->tmp_arena, ctx->tmp_buf_size); if (!ctx->tmp_buf) _upb_DefBuilder_OomErr(ctx); } diff --git a/third_party/protobuf/upb/reflection/internal/upb_edition_defaults.h b/third_party/protobuf/upb/reflection/internal/upb_edition_defaults.h index 2ccfb533862ab..2f7652df19612 100644 --- a/third_party/protobuf/upb/reflection/internal/upb_edition_defaults.h +++ b/third_party/protobuf/upb/reflection/internal/upb_edition_defaults.h @@ -13,7 +13,7 @@ // features. This is used for feature resolution under Editions. // NOLINTBEGIN // clang-format off -#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\023\030\204\007\"\000*\014\010\001\020\002\030\002 \003(\0010\002\n\023\030\347\007\"\000*\014\010\002\020\001\030\001 \002(\0010\001\n\023\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\000 \346\007(\350\007" +#define UPB_INTERNAL_UPB_EDITION_DEFAULTS "\n\025\030\204\007\"\000*\016\010\001\020\002\030\002 \003(\0010\0028\002\n\025\030\347\007\"\000*\016\010\002\020\001\030\001 \002(\0010\0018\002\n\025\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\0028\002 \346\007(\350\007" // clang-format on // NOLINTEND diff --git a/third_party/protobuf/upb/reflection/message.c b/third_party/protobuf/upb/reflection/message.c index 43c7578a87d98..5a29fabe4c249 100644 --- a/third_party/protobuf/upb/reflection/message.c +++ b/third_party/protobuf/upb/reflection/message.c @@ -172,15 +172,18 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, } if (ext_pool) { - // Return any extensions that are set. - size_t count; - const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count); - if (i - n < count) { - ext += count - 1 - (i - n); - memcpy(out_val, &ext->data, sizeof(*out_val)); - *out_f = upb_DefPool_FindExtensionByMiniTable(ext_pool, ext->ext); - *iter = i; - return true; + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return false; + + for (; (i - n) < in->size; i++) { + upb_TaggedAuxPtr tagged_ptr = in->aux_data[i - n]; + if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { + const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr); + memcpy(out_val, &ext->data, sizeof(*out_val)); + *out_f = upb_DefPool_FindExtensionByMiniTable(ext_pool, ext->ext); + *iter = i; + return true; + } } } @@ -189,7 +192,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, } bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, - int depth) { + const upb_DefPool* ext_pool, int depth) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); size_t iter = kUpb_Message_Begin; const upb_FieldDef* f; @@ -200,7 +203,7 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, _upb_Message_DiscardUnknown_shallow(msg); - while (upb_Message_Next(msg, m, NULL /*ext_pool*/, &f, &val, &iter)) { + while (upb_Message_Next(msg, m, ext_pool, &f, &val, &iter)) { const upb_MessageDef* subm = upb_FieldDef_MessageSubDef(f); if (!subm) continue; if (upb_FieldDef_IsMap(f)) { @@ -214,7 +217,7 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, upb_MessageValue map_key, map_val; while (upb_Map_Next(map, &map_key, &map_val, &iter)) { if (!_upb_Message_DiscardUnknown((upb_Message*)map_val.msg_val, val_m, - depth)) { + ext_pool, depth)) { ret = false; } } @@ -224,13 +227,13 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, for (i = 0; i < n; i++) { upb_MessageValue elem = upb_Array_Get(arr, i); if (!_upb_Message_DiscardUnknown((upb_Message*)elem.msg_val, subm, - depth)) { + ext_pool, depth)) { ret = false; } } } else { if (!_upb_Message_DiscardUnknown((upb_Message*)val.msg_val, subm, - depth)) { + ext_pool, depth)) { ret = false; } } @@ -240,6 +243,6 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, } bool upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, - int maxdepth) { - return _upb_Message_DiscardUnknown(msg, m, maxdepth); + const upb_DefPool* ext_pool, int maxdepth) { + return _upb_Message_DiscardUnknown(msg, m, ext_pool, maxdepth); } diff --git a/third_party/protobuf/upb/reflection/message.h b/third_party/protobuf/upb/reflection/message.h index fbe34f4d04217..53acc399535f9 100644 --- a/third_party/protobuf/upb/reflection/message.h +++ b/third_party/protobuf/upb/reflection/message.h @@ -78,7 +78,9 @@ UPB_API bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, // Clears all unknown field data from this message and all submessages. UPB_API bool upb_Message_DiscardUnknown(upb_Message* msg, - const upb_MessageDef* m, int maxdepth); + const upb_MessageDef* m, + const upb_DefPool* ext_pool, + int maxdepth); #ifdef __cplusplus } /* extern "C" */ diff --git a/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.c b/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.c index f252ddc3262ed..728859e0dc0fa 100644 --- a/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.c +++ b/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.c @@ -332,7 +332,7 @@ const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init() const upb_MiniTable* google__protobuf__FeatureSet_msg_init() { static upb_MiniTable* mini_table = NULL; - static const char* mini_descriptor = "$P444444"; + static const char* mini_descriptor = "$P4444444"; if (mini_table) return mini_table; mini_table = upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), @@ -343,6 +343,7 @@ const upb_MiniTable* google__protobuf__FeatureSet_msg_init() { upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google__protobuf__FeatureSet__Utf8Validation_enum_init()); upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 5), google__protobuf__FeatureSet__MessageEncoding_enum_init()); upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 6), google__protobuf__FeatureSet__JsonFormat_enum_init()); + upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 7), google__protobuf__FeatureSet__EnforceNamingStyle_enum_init()); return mini_table; } @@ -435,6 +436,16 @@ const upb_MiniTableEnum* google__protobuf__ExtensionRangeOptions__VerificationSt return mini_table; } +const upb_MiniTableEnum* google__protobuf__FeatureSet__EnforceNamingStyle_enum_init() { + static const upb_MiniTableEnum* mini_table = NULL; + static const char* mini_descriptor = "!)"; + if (mini_table) return mini_table; + mini_table = + upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), + upb_BootstrapArena(), NULL); + return mini_table; +} + const upb_MiniTableEnum* google__protobuf__FeatureSet__EnumType_enum_init() { static const upb_MiniTableEnum* mini_table = NULL; static const char* mini_descriptor = "!)"; diff --git a/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.h b/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.h index 5f5fb70150990..7edf8747507bd 100644 --- a/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.h +++ b/third_party/protobuf/upb/reflection/stage0/google/protobuf/descriptor.upb.h @@ -53,6 +53,7 @@ extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo_msg_init(void); extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_init(void); extern const upb_MiniTableEnum* google__protobuf__Edition_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__ExtensionRangeOptions__VerificationState_enum_init(void); +extern const upb_MiniTableEnum* google__protobuf__FeatureSet__EnforceNamingStyle_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__FeatureSet__EnumType_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__FeatureSet__FieldPresence_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__FeatureSet__JsonFormat_enum_init(void); @@ -123,6 +124,12 @@ typedef enum { google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 } google_protobuf_ExtensionRangeOptions_VerificationState; +typedef enum { + google_protobuf_FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + google_protobuf_FeatureSet_STYLE2024 = 1, + google_protobuf_FeatureSet_STYLE_LEGACY = 2 +} google_protobuf_FeatureSet_EnforceNamingStyle; + typedef enum { google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, google_protobuf_FeatureSet_OPEN = 1, @@ -5820,6 +5827,22 @@ UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 6); return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } +UPB_INLINE void google_protobuf_FeatureSet_clear_enforce_naming_style(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); +} +UPB_INLINE int32_t google_protobuf_FeatureSet_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, + &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); +} UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 1); @@ -5845,6 +5868,10 @@ UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_Featu const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 6); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } +UPB_INLINE void google_protobuf_FeatureSet_set_enforce_naming_style(google_protobuf_FeatureSet *msg, int32_t value) { + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + upb_Message_SetBaseField((upb_Message *)msg, &field, &value); +} /* google.protobuf.FeatureSetDefaults */ diff --git a/third_party/protobuf/upb/test/BUILD b/third_party/protobuf/upb/test/BUILD index 126df20aec9b0..8b128112e6971 100644 --- a/third_party/protobuf/upb/test/BUILD +++ b/third_party/protobuf/upb/test/BUILD @@ -5,6 +5,7 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +load("//bazel:proto_library.bzl", "proto_library") load( "//bazel:upb_minitable_proto_library.bzl", "upb_minitable_proto_library", @@ -27,8 +28,8 @@ cc_library( hdrs = ["parse_text_proto.h"], visibility = ["//upb:__subpackages__"], deps = [ - "//:protobuf", - "@com_google_googletest//:gtest", + "//src/google/protobuf", + "@googletest//:gtest", ], ) @@ -179,8 +180,8 @@ cc_test( ":proto3_test_upb_proto", ":proto3_test_upb_proto_reflection", "//upb:reflection", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -194,8 +195,8 @@ cc_test( "//upb:base", "//upb:mem", "//upb:reflection", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -213,8 +214,8 @@ cc_test( "//upb:mini_table", "//upb:wire", "//upb/mem:internal", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -231,8 +232,8 @@ cc_test( "//upb:json", "//upb:port", "//upb:reflection", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -250,8 +251,8 @@ cc_test( "//upb:mem", "//upb:message", "//upb:port", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -266,8 +267,8 @@ cc_test( ":test_messages_proto2_upb_minitable", ":test_upb_proto", "//upb:mini_table", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -319,8 +320,8 @@ cc_test( srcs = ["test_import_empty_srcs.cc"], deps = [ ":test_import_empty_srcs_upb_minitable_proto", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/test/test_cpp.cc b/third_party/protobuf/upb/test/test_cpp.cc index 6f917150d58b8..b7df32aa51f26 100644 --- a/third_party/protobuf/upb/test/test_cpp.cc +++ b/third_party/protobuf/upb/test/test_cpp.cc @@ -48,11 +48,6 @@ TEST(Cpp, Iteration) { EXPECT_EQ(oneof_count, md.oneof_count()); } -TEST(Cpp, InlinedArena2) { - upb::InlinedArena<64> arena; - upb_Arena_Malloc(arena.ptr(), sizeof(int)); -} - TEST(Cpp, Default) { upb::DefPool defpool; upb::Arena arena; diff --git a/third_party/protobuf/upb/test/test_generated_code.cc b/third_party/protobuf/upb/test/test_generated_code.cc index 2ad9cbf565672..20cde6da8ad27 100644 --- a/third_party/protobuf/upb/test/test_generated_code.cc +++ b/third_party/protobuf/upb/test/test_generated_code.cc @@ -505,15 +505,16 @@ static void check_string_map_empty( 0, protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_size( msg)); + + upb_StringView key; + upb_StringView val; EXPECT_FALSE( protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next( - msg, &iter)); + msg, &key, &val, &iter)); } static void check_string_map_one_entry( protobuf_test_messages_proto3_TestAllTypesProto3* msg) { - const protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry* - const_ent; size_t iter; upb_StringView str; @@ -532,23 +533,15 @@ static void check_string_map_one_entry( /* Test that iteration reveals a single k/v pair in the map. */ iter = kUpb_Map_Begin; - const_ent = + upb_StringView key; + upb_StringView val; + protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next( + msg, &key, &val, &iter); + EXPECT_TRUE(upb_StringView_IsEqual(test_str_view, key)); + EXPECT_TRUE(upb_StringView_IsEqual(test_str_view2, val)); + EXPECT_FALSE( protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next( - msg, &iter); - ASSERT_NE(nullptr, const_ent); - EXPECT_TRUE(upb_StringView_IsEqual( - test_str_view, - protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_key( - const_ent))); - EXPECT_TRUE(upb_StringView_IsEqual( - test_str_view2, - protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_value( - const_ent))); - - const_ent = - protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next( - msg, &iter); - EXPECT_EQ(nullptr, const_ent); + msg, &key, &val, &iter)); } TEST(GeneratedCode, StringDoubleMap) { @@ -580,8 +573,6 @@ TEST(GeneratedCode, StringMap) { upb_Arena* arena = upb_Arena_New(); protobuf_test_messages_proto3_TestAllTypesProto3* msg = protobuf_test_messages_proto3_TestAllTypesProto3_new(arena); - const protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry* - const_ent; size_t iter, count; check_string_map_empty(msg); @@ -615,18 +606,11 @@ TEST(GeneratedCode, StringMap) { /* Test iteration */ iter = kUpb_Map_Begin; count = 0; - + upb_StringView key; + upb_StringView val; while ( - (const_ent = - protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next( - msg, &iter)) != nullptr) { - upb_StringView key = - protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_key( - const_ent); - upb_StringView val = - protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_value( - const_ent); - + protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next( + msg, &key, &val, &iter)) { count++; if (upb_StringView_IsEqual(key, test_str_view)) { EXPECT_TRUE(upb_StringView_IsEqual(val, test_str_view2)); @@ -652,16 +636,18 @@ static void check_int32_map_empty( EXPECT_EQ( 0, protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_size( msg)); + + int32_t key; + int32_t val; EXPECT_FALSE( protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next( - msg, &iter)); + msg, &key, &val, &iter)); } static void check_int32_map_one_entry( protobuf_test_messages_proto3_TestAllTypesProto3* msg) { - const protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry* - const_ent; size_t iter; + int32_t key; int32_t val; EXPECT_EQ( @@ -678,31 +664,20 @@ static void check_int32_map_one_entry( /* Test that iteration reveals a single k/v pair in the map. */ iter = kUpb_Map_Begin; - const_ent = + EXPECT_TRUE( protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next( - msg, &iter); - ASSERT_NE(nullptr, const_ent); - EXPECT_EQ( - test_int32, - protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_key( - const_ent)); - EXPECT_EQ( - test_int32_2, - protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_value( - const_ent)); - - const_ent = + msg, &key, &val, &iter)); + EXPECT_EQ(test_int32, key); + EXPECT_EQ(test_int32_2, val); + EXPECT_FALSE( protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next( - msg, &iter); - EXPECT_EQ(nullptr, const_ent); + msg, &key, &val, &iter)); } TEST(GeneratedCode, Int32Map) { upb_Arena* arena = upb_Arena_New(); protobuf_test_messages_proto3_TestAllTypesProto3* msg = protobuf_test_messages_proto3_TestAllTypesProto3_new(arena); - const protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry* - const_ent; size_t iter, count; check_int32_map_empty(msg); @@ -751,18 +726,10 @@ TEST(GeneratedCode, Int32Map) { /* Test iteration */ iter = kUpb_Map_Begin; count = 0; - - while ( - (const_ent = - protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next( - msg, &iter)) != nullptr) { - int32_t key = - protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_key( - const_ent); - int32_t val = - protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_value( - const_ent); - + int32_t key; + int32_t val; + while (protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next( + msg, &key, &val, &iter)) { count++; if (key == test_int32) { EXPECT_EQ(val, test_int32_2); diff --git a/third_party/protobuf/upb/text/BUILD b/third_party/protobuf/upb/text/BUILD index 793c9a1278c00..80e51e41ce804 100644 --- a/third_party/protobuf/upb/text/BUILD +++ b/third_party/protobuf/upb/text/BUILD @@ -47,7 +47,6 @@ cc_library( deps = [ ":internal", "//upb:base", - "//upb:eps_copy_input_stream", "//upb:message", "//upb:mini_table", "//upb:port", @@ -99,9 +98,9 @@ cc_test( "//upb/message:internal", "//upb/test:test_proto_upb_minitable", "//upb/test:test_upb_proto", - "@com_google_absl//absl/log:absl_log", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/log:absl_log", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/text/debug_string.c b/third_party/protobuf/upb/text/debug_string.c index 731cd1cfe0d86..4d0d4a263f450 100644 --- a/third_party/protobuf/upb/text/debug_string.c +++ b/third_party/protobuf/upb/text/debug_string.c @@ -10,6 +10,7 @@ #include <inttypes.h> #include <stdarg.h> #include <stddef.h> +#include <stdint.h> #include <stdio.h> #include <string.h> @@ -27,7 +28,6 @@ #include "upb/mini_table/internal/message.h" #include "upb/mini_table/message.h" #include "upb/text/internal/encode.h" -#include "upb/wire/eps_copy_input_stream.h" // Must be last. #include "upb/port/def.inc" @@ -184,9 +184,8 @@ static void _upb_MessageDebugString(txtenc* e, const upb_Message* msg, const upb_MiniTableExtension* ext; upb_MessageValue val_ext; - iter = kUpb_Extension_Begin; - while ( - UPB_PRIVATE(_upb_Message_NextExtension)(msg, mt, &ext, &val_ext, &iter)) { + iter = kUpb_Message_ExtensionBegin; + while (upb_Message_NextExtension(msg, &ext, &val_ext, &iter)) { const upb_MiniTableField* f = &ext->UPB_PRIVATE(field); // It is not sufficient to only pass |f| as we lose valuable information // about sub-messages. It is required that we pass |ext|. @@ -201,19 +200,7 @@ static void _upb_MessageDebugString(txtenc* e, const upb_Message* msg, } } - if ((e->options & UPB_TXTENC_SKIPUNKNOWN) == 0) { - size_t size; - const char* ptr = upb_Message_GetUnknown(msg, &size); - if (size != 0) { - char* start = e->ptr; - upb_EpsCopyInputStream stream; - upb_EpsCopyInputStream_Init(&stream, &ptr, size, true); - if (!UPB_PRIVATE(_upb_TextEncode_Unknown)(e, ptr, &stream, -1)) { - /* Unknown failed to parse, back up and don't print it at all. */ - e->ptr = start; - } - } - } + UPB_PRIVATE(_upb_TextEncode_ParseUnknown)(e, msg); } size_t upb_DebugString(const upb_Message* msg, const upb_MiniTable* mt, diff --git a/third_party/protobuf/upb/text/debug_string.h b/third_party/protobuf/upb/text/debug_string.h index feaf6d4f84242..6abd4f093141f 100644 --- a/third_party/protobuf/upb/text/debug_string.h +++ b/third_party/protobuf/upb/text/debug_string.h @@ -27,7 +27,7 @@ extern "C" { * encode.h. |mt| should correspond to the |msg|'s minitable. * * Output is placed in the given buffer, and always NULL-terminated. The output - * size (excluding NULL) iss returned. This means that a return value >= |size| + * size (excluding NULL) is returned. This means that a return value >= |size| * implies that the output was truncated. (These are the same semantics as * snprintf()). */ UPB_API size_t upb_DebugString(const upb_Message* msg, const upb_MiniTable* mt, diff --git a/third_party/protobuf/upb/text/encode.c b/third_party/protobuf/upb/text/encode.c index 5938a16377383..7aa94a125fb17 100644 --- a/third_party/protobuf/upb/text/encode.c +++ b/third_party/protobuf/upb/text/encode.c @@ -176,19 +176,7 @@ static void _upb_TextEncode_Msg(txtenc* e, const upb_Message* msg, } } - if ((e->options & UPB_TXTENC_SKIPUNKNOWN) == 0) { - size_t size; - const char* ptr = upb_Message_GetUnknown(msg, &size); - if (size != 0) { - char* start = e->ptr; - upb_EpsCopyInputStream stream; - upb_EpsCopyInputStream_Init(&stream, &ptr, size, true); - if (!UPB_PRIVATE(_upb_TextEncode_Unknown)(e, ptr, &stream, -1)) { - /* Unknown failed to parse, back up and don't print it at all. */ - e->ptr = start; - } - } - } + UPB_PRIVATE(_upb_TextEncode_ParseUnknown)(e, msg); } size_t upb_TextEncode(const upb_Message* msg, const upb_MessageDef* m, diff --git a/third_party/protobuf/upb/text/encode_debug_test.cc b/third_party/protobuf/upb/text/encode_debug_test.cc index b8820141a49e9..740fb3ab3d2e1 100644 --- a/third_party/protobuf/upb/text/encode_debug_test.cc +++ b/third_party/protobuf/upb/text/encode_debug_test.cc @@ -10,7 +10,6 @@ #include <string> #include <gtest/gtest.h> -#include "absl/log/absl_log.h" #include "upb/base/string_view.h" #include "upb/base/upcast.h" #include "upb/mem/arena.h" @@ -20,7 +19,19 @@ #include "upb/test/test.upb_minitable.h" #include "upb/text/debug_string.h" -TEST(TextNoReflection, Extensions) { +std::string GetDebugString(const upb_Message* input, + const upb_MiniTable* mt_main) { + // Resizing/reallocation of the buffer is not necessary since we're only + // testing that we get the expected debug string. + char buf[100]; + int options = + UPB_TXTENC_NOSORT; // Does not matter, but maps will not be sorted. + size_t real_size = upb_DebugString(input, mt_main, options, buf, 100); + EXPECT_EQ(buf[real_size], '\0'); + return std::string(buf); +} + +TEST(TextNoReflection, ExtensionsString) { const upb_MiniTable* mt_main = upb_0test__ModelWithExtensions_msg_init_ptr; upb_Arena* arena = upb_Arena_New(); @@ -28,36 +39,35 @@ TEST(TextNoReflection, Extensions) { upb_test_ModelExtension1_set_str(extension1, upb_StringView_FromString("Hello")); + upb_test_ModelWithExtensions* msg = upb_test_ModelWithExtensions_new(arena); + + upb_test_ModelExtension1_set_model_ext(msg, extension1, arena); + + std::string buf = GetDebugString(UPB_UPCAST(msg), mt_main); + upb_Arena_Free(arena); + std::string golden = R"([1547] { + 25: "Hello" +} +)"; + ASSERT_EQ(buf, golden); +} + +TEST(TextNoReflection, ExtensionsInt) { + const upb_MiniTable* mt_main = upb_0test__ModelWithExtensions_msg_init_ptr; + upb_Arena* arena = upb_Arena_New(); + upb_test_ModelExtension2* extension2 = upb_test_ModelExtension2_new(arena); upb_test_ModelExtension2_set_i(extension2, 5); upb_test_ModelWithExtensions* msg = upb_test_ModelWithExtensions_new(arena); - upb_test_ModelExtension1_set_model_ext(msg, extension1, arena); upb_test_ModelExtension2_set_model_ext(msg, extension2, arena); - // Convert to a type of upb_Message* - upb_Message* input = UPB_UPCAST(msg); - // Resizing/reallocation of the buffer is not necessary since we're only - // testing that we get the expected debug string. - char* buf = new char[100]; - int options = - UPB_TXTENC_NOSORT; // Does not matter, but maps will not be sorted. - size_t size = 100; - size_t real_size = upb_DebugString(input, mt_main, options, buf, size); - ABSL_LOG(INFO) << "Buffer: \n" - << buf << "\n" - << "Size:" << real_size << "\n"; + std::string buf = GetDebugString(UPB_UPCAST(msg), mt_main); + upb_Arena_Free(arena); std::string golden = R"([4135] { 9: 5 } -[1547] { - 25: "Hello" -} )"; - ASSERT_EQ(buf[real_size], '\0'); - std::string str(buf); ASSERT_EQ(buf, golden); - delete[] buf; - upb_Arena_Free(arena); -} \ No newline at end of file +} diff --git a/third_party/protobuf/upb/text/internal/encode.c b/third_party/protobuf/upb/text/internal/encode.c index fc9cc6fd27373..dab01b01a40ed 100644 --- a/third_party/protobuf/upb/text/internal/encode.c +++ b/third_party/protobuf/upb/text/internal/encode.c @@ -15,6 +15,8 @@ #include "upb/base/string_view.h" #include "upb/lex/round_trip.h" #include "upb/message/array.h" +#include "upb/message/message.h" +#include "upb/text/options.h" #include "upb/wire/eps_copy_input_stream.h" #include "upb/wire/reader.h" #include "upb/wire/types.h" @@ -22,11 +24,11 @@ // Must be last. #include "upb/port/def.inc" -#define CHK(x) \ - do { \ - if (!(x)) { \ - return false; \ - } \ +#define CHK(x) \ + do { \ + if (!(x)) { \ + return NULL; \ + } \ } while (0) /* @@ -134,6 +136,23 @@ const char* UPB_PRIVATE(_upb_TextEncode_Unknown)(txtenc* e, const char* ptr, #undef CHK +void UPB_PRIVATE(_upb_TextEncode_ParseUnknown)(txtenc* e, + const upb_Message* msg) { + if ((e->options & UPB_TXTENC_SKIPUNKNOWN) != 0) return; + + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView view; + while (upb_Message_NextUnknown(msg, &view, &iter)) { + char* start = e->ptr; + upb_EpsCopyInputStream stream; + upb_EpsCopyInputStream_Init(&stream, &view.data, view.size, true); + if (!UPB_PRIVATE(_upb_TextEncode_Unknown)(e, view.data, &stream, -1)) { + /* Unknown failed to parse, back up and don't print it at all. */ + e->ptr = start; + } + } +} + void UPB_PRIVATE(_upb_TextEncode_Scalar)(txtenc* e, upb_MessageValue val, upb_CType ctype) { switch (ctype) { @@ -177,4 +196,4 @@ void UPB_PRIVATE(_upb_TextEncode_Scalar)(txtenc* e, upb_MessageValue val, default: UPB_UNREACHABLE(); } -} \ No newline at end of file +} diff --git a/third_party/protobuf/upb/text/internal/encode.h b/third_party/protobuf/upb/text/internal/encode.h index 598b2a0c45c09..6220398997d12 100644 --- a/third_party/protobuf/upb/text/internal/encode.h +++ b/third_party/protobuf/upb/text/internal/encode.h @@ -15,6 +15,7 @@ #include "upb/base/string_view.h" #include "upb/message/array.h" #include "upb/message/internal/map_sorter.h" +#include "upb/message/message.h" #include "upb/port/vsnprintf_compat.h" #include "upb/text/options.h" #include "upb/wire/eps_copy_input_stream.h" @@ -230,6 +231,9 @@ const char* UPB_PRIVATE(_upb_TextEncode_Unknown)(txtenc* e, const char* ptr, upb_EpsCopyInputStream* stream, int groupnum); +void UPB_PRIVATE(_upb_TextEncode_ParseUnknown)(txtenc* e, + const upb_Message* msg); + // Must not be called for ctype = kUpb_CType_Enum, as they require different // handling depending on whether or not we're doing reflection-based encoding. void UPB_PRIVATE(_upb_TextEncode_Scalar)(txtenc* e, upb_MessageValue val, diff --git a/third_party/protobuf/upb/util/BUILD b/third_party/protobuf/upb/util/BUILD index e95651f6e7bb2..a949cd5421098 100644 --- a/third_party/protobuf/upb/util/BUILD +++ b/third_party/protobuf/upb/util/BUILD @@ -1,3 +1,4 @@ +load("//bazel:proto_library.bzl", "proto_library") load( "//bazel:upb_proto_library.bzl", "upb_c_proto_library", @@ -49,13 +50,13 @@ cc_library( hdrs = ["def_to_proto_test.h"], deps = [ ":def_to_proto", - "//:protobuf", + "//src/google/protobuf", "//src/google/protobuf:descriptor_upb_c_proto", "//src/google/protobuf/util:differencer", "//upb:base", "//upb:mem", "//upb/reflection:internal", - "@com_google_googletest//:gtest", + "@googletest//:gtest", ], ) @@ -69,7 +70,7 @@ cc_test( ":def_to_proto_test_lib", ":def_to_proto_test_upb_proto", ":def_to_proto_test_upb_proto_reflection", - "//:protobuf", + "//src/google/protobuf", "//src/google/protobuf:descriptor_upb_c_proto", "//src/google/protobuf:descriptor_upb_reflection_proto", "//src/google/protobuf/util:differencer", @@ -77,9 +78,9 @@ cc_test( "//upb:mem", "//upb:reflection", "//upb/test:parse_text_proto", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -144,9 +145,9 @@ cc_test( "//upb:mem", "//upb:reflection", "//upb/reflection:internal", - "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@abseil-cpp//absl/strings", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/wire/BUILD b/third_party/protobuf/upb/wire/BUILD index 23a5239d68f1a..ae0739882cdd8 100644 --- a/third_party/protobuf/upb/wire/BUILD +++ b/third_party/protobuf/upb/wire/BUILD @@ -38,6 +38,7 @@ cc_library( "//upb/hash", "//upb/mem:internal", "//upb/message:internal", + "//upb/message:iterator", "//upb/message:types", "//upb/mini_table:internal", ], @@ -85,8 +86,8 @@ cc_test( "//upb:mini_table", "//upb/test:test_messages_proto2_upb_minitable", "//upb/test:test_messages_proto2_upb_proto", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) @@ -107,8 +108,8 @@ cc_test( deps = [ ":eps_copy_input_stream", "//upb:mem", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) diff --git a/third_party/protobuf/upb/wire/decode.c b/third_party/protobuf/upb/wire/decode.c index 2cb1a44913fa1..d76098601bdcb 100644 --- a/third_party/protobuf/upb/wire/decode.c +++ b/third_party/protobuf/upb/wire/decode.c @@ -288,11 +288,14 @@ static upb_Message* _upb_Decoder_ReuseSubMessage( upb_Message* existing = UPB_PRIVATE(_upb_TaggedMessagePtr_GetEmptyMessage)(tagged); upb_Message* promoted = _upb_Decoder_NewSubMessage(d, subs, field, target); - size_t size; - const char* unknown = upb_Message_GetUnknown(existing, &size); - upb_DecodeStatus status = upb_Decode(unknown, size, promoted, subl, d->extreg, - d->options, &d->arena); - if (status != kUpb_DecodeStatus_Ok) _upb_Decoder_ErrorJmp(d, status); + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView unknown; + while (upb_Message_NextUnknown(existing, &unknown, &iter)) { + upb_DecodeStatus status = + upb_Decode(unknown.data, unknown.size, promoted, subl, d->extreg, + d->options, &d->arena); + if (status != kUpb_DecodeStatus_Ok) _upb_Decoder_ErrorJmp(d, status); + } return promoted; } @@ -366,6 +369,7 @@ const char* _upb_Decoder_DecodeKnownGroup(upb_Decoder* d, const char* ptr, field->UPB_PRIVATE(number)); } +#define kUpb_Decoder_EncodeVarint32MaxSize 5 static char* upb_Decoder_EncodeVarint32(uint32_t val, char* ptr) { do { uint8_t byte = val & 0x7fU; @@ -376,18 +380,6 @@ static char* upb_Decoder_EncodeVarint32(uint32_t val, char* ptr) { return ptr; } -static void _upb_Decoder_AddUnknownVarints(upb_Decoder* d, upb_Message* msg, - uint32_t val1, uint32_t val2) { - char buf[20]; - char* end = buf; - end = upb_Decoder_EncodeVarint32(val1, end); - end = upb_Decoder_EncodeVarint32(val2, end); - - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, end - buf, &d->arena)) { - _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); - } -} - UPB_FORCEINLINE bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, const upb_MiniTableEnum* e, @@ -402,9 +394,17 @@ bool _upb_Decoder_CheckEnum(upb_Decoder* d, const char* ptr, upb_Message* msg, const uint32_t tag = ((uint32_t)field->UPB_PRIVATE(number) << 3) | kUpb_WireType_Varint; upb_Message* unknown_msg = - field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension ? d->unknown_msg + field->UPB_PRIVATE(mode) & kUpb_LabelFlags_IsExtension ? d->original_msg : msg; - _upb_Decoder_AddUnknownVarints(d, unknown_msg, tag, v); + char buf[2 * kUpb_Decoder_EncodeVarint32MaxSize]; + char* end = buf; + end = upb_Decoder_EncodeVarint32(tag, end); + end = upb_Decoder_EncodeVarint32(v, end); + + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(unknown_msg, buf, end - buf, + &d->arena, false)) { + _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); + } return false; } @@ -662,10 +662,7 @@ static const char* _upb_Decoder_DecodeToMap( ptr = _upb_Decoder_DecodeSubMessage(d, ptr, &ent.message, subs, field, val->size); - // check if ent had any unknown fields - size_t size; - upb_Message_GetUnknown(&ent.message, &size); - if (size != 0) { + if (upb_Message_HasUnknown(&ent.message)) { char* buf; size_t size; uint32_t tag = @@ -675,8 +672,16 @@ static const char* _upb_Decoder_DecodeToMap( if (status != kUpb_EncodeStatus_Ok) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } - _upb_Decoder_AddUnknownVarints(d, msg, tag, size); - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, size, &d->arena)) { + char delim_buf[2 * kUpb_Decoder_EncodeVarint32MaxSize]; + char* delim_end = delim_buf; + delim_end = upb_Decoder_EncodeVarint32(tag, delim_end); + delim_end = upb_Decoder_EncodeVarint32(size, delim_end); + upb_StringView unknown[] = { + {delim_buf, delim_end - delim_buf}, + {buf, size}, + }; + + if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 2)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } else { @@ -823,7 +828,7 @@ static void upb_Decoder_AddKnownMessageSetItem( } upb_Message* submsg = _upb_Decoder_NewSubMessage2( d, ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg), - &ext->ext->UPB_PRIVATE(field), (upb_TaggedMessagePtr*)&ext->data); + &ext->ext->UPB_PRIVATE(field), &ext->data.tagged_msg_val); upb_DecodeStatus status = upb_Decode( data, size, submsg, upb_MiniTableExtension_GetSubMessage(item_mt), d->extreg, d->options, &d->arena); @@ -835,7 +840,7 @@ static void upb_Decoder_AddUnknownMessageSetItem(upb_Decoder* d, uint32_t type_id, const char* message_data, uint32_t message_size) { - char buf[60]; + char buf[6 * kUpb_Decoder_EncodeVarint32MaxSize]; char* ptr = buf; ptr = upb_Decoder_EncodeVarint32(kStartItemTag, ptr); ptr = upb_Decoder_EncodeVarint32(kTypeIdTag, ptr); @@ -846,12 +851,12 @@ static void upb_Decoder_AddUnknownMessageSetItem(upb_Decoder* d, ptr = upb_Decoder_EncodeVarint32(kEndItemTag, ptr); char* end = ptr; - - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, buf, split - buf, &d->arena) || - !UPB_PRIVATE(_upb_Message_AddUnknown)(msg, message_data, message_size, - &d->arena) || - !UPB_PRIVATE(_upb_Message_AddUnknown)(msg, split, end - split, - &d->arena)) { + upb_StringView unknown[] = { + {buf, split - buf}, + {message_data, message_size}, + {split, end - split}, + }; + if (!UPB_PRIVATE(_upb_Message_AddUnknownV)(msg, &d->arena, unknown, 3)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } @@ -1176,8 +1181,8 @@ const char* _upb_Decoder_DecodeKnownField(upb_Decoder* d, const char* ptr, if (UPB_UNLIKELY(!ext)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } - d->unknown_msg = msg; - msg = (upb_Message*)&ext->data; + d->original_msg = msg; + msg = &ext->data.UPB_PRIVATE(ext_msg_val); if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) { ext_sub.UPB_PRIVATE(submsg) = &ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); @@ -1221,7 +1226,8 @@ static const char* _upb_Decoder_DecodeUnknownField(upb_Decoder* d, // Since unknown fields are the uncommon case, we do a little extra work here // to walk backwards through the buffer to find the field start. This frees // up a register in the fast paths (when the field is known), which leads to - // significant speedups in benchmarks. + // significant speedups in benchmarks. Note that ptr may point into the slop + // space, beyond the normal end of the input buffer. const char* start = ptr; if (wire_type == kUpb_WireType_Delimited) ptr += val.size; @@ -1247,15 +1253,21 @@ static const char* _upb_Decoder_DecodeUnknownField(upb_Decoder* d, start = _upb_Decoder_ReverseSkipVarint(start, tag); assert(start == d->debug_tagstart); + const char* input_start = + upb_EpsCopyInputStream_GetInputPtr(&d->input, start); if (wire_type == kUpb_WireType_StartGroup) { - d->unknown = start; - d->unknown_msg = msg; ptr = _upb_Decoder_DecodeUnknownGroup(d, ptr, field_number); - start = d->unknown; - d->unknown = NULL; } - if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, start, ptr - start, - &d->arena)) { + // Normally, bounds checks for fixed or varint fields are performed after + // the field is parsed; it's OK for the field to overrun the end of the + // buffer, because it'll just read into slop space. However, because this + // path reads bytes from the input buffer rather than the patch buffer, + // bounds checks are needed before adding the unknown field. + _upb_Decoder_IsDone(d, &ptr); + const char* input_ptr = upb_EpsCopyInputStream_GetInputPtr(&d->input, ptr); + if (!UPB_PRIVATE(_upb_Message_AddUnknown)(msg, input_start, + input_ptr - input_start, + &d->arena, d->input.aliasing)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); } } else if (wire_type == kUpb_WireType_StartGroup) { @@ -1376,20 +1388,23 @@ static upb_DecodeStatus upb_Decoder_Decode(upb_Decoder* const decoder, return decoder->status; } +uint16_t upb_DecodeOptions_GetEffectiveMaxDepth(uint32_t options) { + uint16_t max_depth = upb_DecodeOptions_GetMaxDepth(options); + return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; +} + upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, const upb_MiniTable* mt, const upb_ExtensionRegistry* extreg, int options, upb_Arena* arena) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Decoder decoder; - unsigned depth = (unsigned)options >> 16; upb_EpsCopyInputStream_Init(&decoder.input, &buf, size, options & kUpb_DecodeOption_AliasString); decoder.extreg = extreg; - decoder.unknown = NULL; - decoder.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; + decoder.depth = upb_DecodeOptions_GetEffectiveMaxDepth(options); decoder.end_group = DECODE_NOGROUP; decoder.options = (uint16_t)options; decoder.missing_required = false; diff --git a/third_party/protobuf/upb/wire/decode.h b/third_party/protobuf/upb/wire/decode.h index 47a2697f19c6d..07f989e81e55f 100644 --- a/third_party/protobuf/upb/wire/decode.h +++ b/third_party/protobuf/upb/wire/decode.h @@ -26,8 +26,8 @@ extern "C" { #endif enum { - /* If set, strings will alias the input buffer instead of copying into the - * arena. */ + /* If set, strings and unknown fields will alias the input buffer instead of + * copying into the arena. */ kUpb_DecodeOption_AliasString = 1, /* If set, the parse will return failure if any message is missing any @@ -103,6 +103,8 @@ UPB_INLINE uint16_t upb_DecodeOptions_GetMaxDepth(uint32_t options) { return options >> 16; } +uint16_t upb_DecodeOptions_GetEffectiveMaxDepth(uint32_t options); + // Enforce an upper bound on recursion depth. UPB_INLINE int upb_Decode_LimitDepth(uint32_t decode_options, uint32_t limit) { uint32_t max_depth = upb_DecodeOptions_GetMaxDepth(decode_options); diff --git a/third_party/protobuf/upb/wire/encode.c b/third_party/protobuf/upb/wire/encode.c index 5764199e44fa1..7fabb34d16217 100644 --- a/third_party/protobuf/upb/wire/encode.c +++ b/third_party/protobuf/upb/wire/encode.c @@ -12,6 +12,7 @@ #include <setjmp.h> #include <stdbool.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> #include "upb/base/descriptor_constants.h" @@ -27,6 +28,7 @@ #include "upb/message/internal/map.h" #include "upb/message/internal/map_entry.h" #include "upb/message/internal/map_sorter.h" +#include "upb/message/internal/message.h" #include "upb/message/internal/tagged_ptr.h" #include "upb/message/map.h" #include "upb/message/message.h" @@ -523,32 +525,72 @@ static void encode_field(upb_encstate* e, const upb_Message* msg, } } -static void encode_msgset_item(upb_encstate* e, const upb_Extension* ext) { +static void encode_msgset_item(upb_encstate* e, + const upb_MiniTableExtension* ext, + const upb_MessageValue ext_val) { size_t size; encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_EndGroup); - encode_message(e, ext->data.msg_val, - upb_MiniTableExtension_GetSubMessage(ext->ext), &size); + encode_message(e, ext_val.msg_val, upb_MiniTableExtension_GetSubMessage(ext), + &size); encode_varint(e, size); encode_tag(e, kUpb_MsgSet_Message, kUpb_WireType_Delimited); - encode_varint(e, upb_MiniTableExtension_Number(ext->ext)); + encode_varint(e, upb_MiniTableExtension_Number(ext)); encode_tag(e, kUpb_MsgSet_TypeId, kUpb_WireType_Varint); encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_StartGroup); } -static void encode_ext(upb_encstate* e, const upb_Extension* ext, - bool is_message_set) { +static void encode_ext(upb_encstate* e, const upb_MiniTableExtension* ext, + upb_MessageValue ext_val, bool is_message_set) { if (UPB_UNLIKELY(is_message_set)) { - encode_msgset_item(e, ext); + encode_msgset_item(e, ext, ext_val); } else { upb_MiniTableSubInternal sub; - if (upb_MiniTableField_IsSubMessage(&ext->ext->UPB_PRIVATE(field))) { - sub.UPB_PRIVATE(submsg) = &ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); + if (upb_MiniTableField_IsSubMessage(&ext->UPB_PRIVATE(field))) { + sub.UPB_PRIVATE(submsg) = &ext->UPB_PRIVATE(sub).UPB_PRIVATE(submsg); } else { - sub.UPB_PRIVATE(subenum) = - ext->ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum); + sub.UPB_PRIVATE(subenum) = ext->UPB_PRIVATE(sub).UPB_PRIVATE(subenum); } - encode_field(e, (upb_Message*)&ext->data, &sub, - &ext->ext->UPB_PRIVATE(field)); + encode_field(e, &ext_val.UPB_PRIVATE(ext_msg_val), &sub, + &ext->UPB_PRIVATE(field)); + } +} + +static void encode_exts(upb_encstate* e, const upb_MiniTable* m, + const upb_Message* msg) { + if (m->UPB_PRIVATE(ext) == kUpb_ExtMode_NonExtendable) return; + + upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); + if (!in) return; + + /* Encode all extensions together. Unlike C++, we do not attempt to keep + * these in field number order relative to normal fields or even to each + * other. */ + uintptr_t iter = kUpb_Message_ExtensionBegin; + const upb_MiniTableExtension* ext; + upb_MessageValue ext_val; + if (!UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, &ext, &ext_val, + &iter)) { + // Message has no extensions. + return; + } + + if (e->options & kUpb_EncodeOption_Deterministic) { + _upb_sortedmap sorted; + if (!_upb_mapsorter_pushexts(&e->sorter, in, &sorted)) { + // TODO: b/378744096 - handle alloc failure + } + const upb_Extension* ext; + while (_upb_sortedmap_nextext(&e->sorter, &sorted, &ext)) { + encode_ext(e, ext->ext, ext->data, + m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); + } + _upb_mapsorter_popmap(&e->sorter, &sorted); + } else { + do { + encode_ext(e, ext, ext_val, + m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); + } while (UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, &ext, &ext_val, + &iter)); } } @@ -565,38 +607,27 @@ static void encode_message(upb_encstate* e, const upb_Message* msg, } if ((e->options & kUpb_EncodeOption_SkipUnknown) == 0) { - size_t unknown_size; - const char* unknown = upb_Message_GetUnknown(msg, &unknown_size); - - if (unknown) { - encode_bytes(e, unknown, unknown_size); + size_t unknown_size = 0; + uintptr_t iter = kUpb_Message_UnknownBegin; + upb_StringView unknown; + // Need to write in reverse order, but iteration is in-order; scan to + // reserve capacity up front, then write in-order + while (upb_Message_NextUnknown(msg, &unknown, &iter)) { + unknown_size += unknown.size; } - } - - if (m->UPB_PRIVATE(ext) != kUpb_ExtMode_NonExtendable) { - /* Encode all extensions together. Unlike C++, we do not attempt to keep - * these in field number order relative to normal fields or even to each - * other. */ - size_t ext_count; - const upb_Extension* ext = - UPB_PRIVATE(_upb_Message_Getexts)(msg, &ext_count); - if (ext_count) { - if (e->options & kUpb_EncodeOption_Deterministic) { - _upb_sortedmap sorted; - _upb_mapsorter_pushexts(&e->sorter, ext, ext_count, &sorted); - while (_upb_sortedmap_nextext(&e->sorter, &sorted, &ext)) { - encode_ext(e, ext, m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); - } - _upb_mapsorter_popmap(&e->sorter, &sorted); - } else { - const upb_Extension* end = ext + ext_count; - for (; ext != end; ext++) { - encode_ext(e, ext, m->UPB_PRIVATE(ext) == kUpb_ExtMode_IsMessageSet); - } + if (unknown_size != 0) { + encode_reserve(e, unknown_size); + char* ptr = e->ptr; + iter = kUpb_Message_UnknownBegin; + while (upb_Message_NextUnknown(msg, &unknown, &iter)) { + memcpy(ptr, unknown.data, unknown.size); + ptr += unknown.size; } } } + encode_exts(e, m, msg); + if (upb_MiniTable_FieldCount(m)) { const upb_MiniTableField* f = &m->UPB_PRIVATE(fields)[m->UPB_PRIVATE(field_count)]; @@ -645,19 +676,23 @@ static upb_EncodeStatus upb_Encoder_Encode(upb_encstate* const encoder, return encoder->status; } +uint16_t upb_EncodeOptions_GetEffectiveMaxDepth(uint32_t options) { + uint16_t max_depth = upb_EncodeOptions_GetMaxDepth(options); + return max_depth ? max_depth : kUpb_WireFormat_DefaultDepthLimit; +} + static upb_EncodeStatus _upb_Encode(const upb_Message* msg, const upb_MiniTable* l, int options, upb_Arena* arena, char** buf, size_t* size, bool prepend_len) { upb_encstate e; - unsigned depth = (unsigned)options >> 16; e.status = kUpb_EncodeStatus_Ok; e.arena = arena; e.buf = NULL; e.limit = NULL; e.ptr = NULL; - e.depth = depth ? depth : kUpb_WireFormat_DefaultDepthLimit; + e.depth = upb_EncodeOptions_GetEffectiveMaxDepth(options); e.options = options; _upb_mapsorter_init(&e.sorter); diff --git a/third_party/protobuf/upb/wire/encode.h b/third_party/protobuf/upb/wire/encode.h index 77b122341e142..1693ba6590b9b 100644 --- a/third_party/protobuf/upb/wire/encode.h +++ b/third_party/protobuf/upb/wire/encode.h @@ -59,6 +59,8 @@ UPB_INLINE uint16_t upb_EncodeOptions_GetMaxDepth(uint32_t options) { return options >> 16; } +uint16_t upb_EncodeOptions_GetEffectiveMaxDepth(uint32_t options); + // Enforce an upper bound on recursion depth. UPB_INLINE int upb_Encode_LimitDepth(uint32_t encode_options, uint32_t limit) { uint32_t max_depth = upb_EncodeOptions_GetMaxDepth(encode_options); diff --git a/third_party/protobuf/upb/wire/eps_copy_input_stream.h b/third_party/protobuf/upb/wire/eps_copy_input_stream.h index 690ab496669db..2307f364a7c72 100644 --- a/third_party/protobuf/upb/wire/eps_copy_input_stream.h +++ b/third_party/protobuf/upb/wire/eps_copy_input_stream.h @@ -27,18 +27,13 @@ extern "C" { // this invariant. #define kUpb_EpsCopyInputStream_SlopBytes 16 -enum { - kUpb_EpsCopyInputStream_NoAliasing = 0, - kUpb_EpsCopyInputStream_OnPatch = 1, - kUpb_EpsCopyInputStream_NoDelta = 2 -}; - typedef struct { const char* end; // Can read up to SlopBytes bytes beyond this. const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) - uintptr_t aliasing; + uintptr_t input_delta; // Diff between the original input pointer and patch int limit; // Submessage limit relative to end bool error; // To distinguish between EOF and error. + bool aliasing; char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; } upb_EpsCopyInputStream; @@ -64,17 +59,16 @@ UPB_INLINE void upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, if (size <= kUpb_EpsCopyInputStream_SlopBytes) { memset(&e->patch, 0, 32); if (size) memcpy(&e->patch, *ptr, size); - e->aliasing = enable_aliasing ? (uintptr_t)*ptr - (uintptr_t)e->patch - : kUpb_EpsCopyInputStream_NoAliasing; + e->input_delta = (uintptr_t)*ptr - (uintptr_t)e->patch; *ptr = e->patch; e->end = *ptr + size; e->limit = 0; } else { e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; e->limit = kUpb_EpsCopyInputStream_SlopBytes; - e->aliasing = enable_aliasing ? kUpb_EpsCopyInputStream_NoDelta - : kUpb_EpsCopyInputStream_NoAliasing; + e->input_delta = 0; } + e->aliasing = enable_aliasing; e->limit_ptr = e->end; e->error = false; } @@ -217,7 +211,7 @@ UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( // upb_EpsCopyInputStream_Init() when this stream was initialized. UPB_INLINE bool upb_EpsCopyInputStream_AliasingEnabled( upb_EpsCopyInputStream* e) { - return e->aliasing != kUpb_EpsCopyInputStream_NoAliasing; + return e->aliasing; } // Returns true if aliasing_enabled=true was passed to @@ -227,8 +221,16 @@ UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( upb_EpsCopyInputStream* e, const char* ptr, size_t size) { // When EpsCopyInputStream supports streaming, this will need to become a // runtime check. - return upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size) && - e->aliasing >= kUpb_EpsCopyInputStream_NoDelta; + return e->aliasing && + upb_EpsCopyInputStream_CheckDataSizeAvailable(e, ptr, size); +} + +// Returns a pointer into an input buffer that corresponds to the parsing +// pointer `ptr`. The returned pointer may be the same as `ptr`, but also may +// be different if we are currently parsing out of the patch buffer. +UPB_INLINE const char* upb_EpsCopyInputStream_GetInputPtr( + upb_EpsCopyInputStream* e, const char* ptr) { + return (const char*)(((uintptr_t)ptr) + e->input_delta); } // Returns a pointer into an input buffer that corresponds to the parsing @@ -240,9 +242,7 @@ UPB_INLINE bool upb_EpsCopyInputStream_AliasingAvailable( UPB_INLINE const char* upb_EpsCopyInputStream_GetAliasedPtr( upb_EpsCopyInputStream* e, const char* ptr) { UPB_ASSUME(upb_EpsCopyInputStream_AliasingAvailable(e, ptr, 0)); - uintptr_t delta = - e->aliasing == kUpb_EpsCopyInputStream_NoDelta ? 0 : e->aliasing; - return (const char*)((uintptr_t)ptr + delta); + return upb_EpsCopyInputStream_GetInputPtr(e, ptr); } // Reads string data from the input, aliasing into the input buffer instead of @@ -356,9 +356,7 @@ UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( e->limit -= kUpb_EpsCopyInputStream_SlopBytes; e->limit_ptr = e->end + e->limit; UPB_ASSERT(ptr < e->limit_ptr); - if (e->aliasing != kUpb_EpsCopyInputStream_NoAliasing) { - e->aliasing = (uintptr_t)old_end - (uintptr_t)new_start; - } + e->input_delta = (uintptr_t)old_end - (uintptr_t)new_start; return callback(e, old_end, new_start); } else { UPB_ASSERT(overrun > e->limit); diff --git a/third_party/protobuf/upb/wire/internal/decoder.h b/third_party/protobuf/upb/wire/internal/decoder.h index 5ca1e1b2b2a8e..c67fbcf5eccbf 100644 --- a/third_party/protobuf/upb/wire/internal/decoder.h +++ b/third_party/protobuf/upb/wire/internal/decoder.h @@ -13,6 +13,8 @@ #ifndef UPB_WIRE_INTERNAL_DECODER_H_ #define UPB_WIRE_INTERNAL_DECODER_H_ +#include <stddef.h> + #include "upb/mem/internal/arena.h" #include "upb/message/internal/message.h" #include "upb/wire/decode.h" @@ -22,13 +24,12 @@ // Must be last. #include "upb/port/def.inc" -#define DECODE_NOGROUP (uint32_t) - 1 +#define DECODE_NOGROUP (uint32_t)-1 typedef struct upb_Decoder { upb_EpsCopyInputStream input; const upb_ExtensionRegistry* extreg; - const char* unknown; // Start of unknown data, preserve at buffer flip - upb_Message* unknown_msg; // Pointer to preserve data to + upb_Message* original_msg; // Pointer to preserve data to int depth; // Tracks recursion depth to bound stack usage. uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP. uint16_t options; @@ -88,14 +89,6 @@ UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { upb_Decoder* d = (upb_Decoder*)e; if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); - - if (d->unknown) { - if (!UPB_PRIVATE(_upb_Message_AddUnknown)( - d->unknown_msg, d->unknown, old_end - d->unknown, &d->arena)) { - _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); - } - d->unknown = new_start; - } return new_start; } diff --git a/third_party/protobuf/upb_generator/BUILD b/third_party/protobuf/upb_generator/BUILD index 80888ab1e6e64..d979f1eafd0b9 100644 --- a/third_party/protobuf/upb_generator/BUILD +++ b/third_party/protobuf/upb_generator/BUILD @@ -55,7 +55,7 @@ bootstrap_cc_library( "//src/google/protobuf:port", "//upb:mini_table", "//upb:port", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -79,13 +79,16 @@ bootstrap_cc_library( "//upb:mini_descriptor", "//upb:mini_table", "//upb:port", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/strings", ], ) bootstrap_cc_library( name = "plugin", + srcs = [ + "plugin.cc", + ], hdrs = [ "plugin.h", ], @@ -93,19 +96,21 @@ bootstrap_cc_library( ":plugin_upb_proto", "//upb/reflection:descriptor_upb_proto", "//upb/reflection:reflection", + "//upb_generator:file_layout", ], copts = UPB_DEFAULT_CPPOPTS, visibility = ["//upb:friend_generators"], deps = [ + "//src/google/protobuf", "//src/google/protobuf/compiler:code_generator_lite", "//upb:base", "//upb:mem", "//upb:port", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/strings", ], ) diff --git a/third_party/protobuf/upb_generator/c/BUILD b/third_party/protobuf/upb_generator/c/BUILD index c55c9c1435999..fcbac23d2b654 100644 --- a/third_party/protobuf/upb_generator/c/BUILD +++ b/third_party/protobuf/upb_generator/c/BUILD @@ -27,8 +27,8 @@ cc_library( visibility = ["//src/google/protobuf/compiler/hpb:__pkg__"], deps = [ ":names_internal", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/strings", ], ) @@ -38,7 +38,7 @@ cc_library( hdrs = ["names_internal.h"], deps = [ "//upb_generator/common:names", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -62,7 +62,6 @@ bootstrap_cc_library( "//upb_generator:common", "//upb_generator:file_layout", "//upb_generator:plugin", - "//upb_generator:plugin_upb_proto", "//upb/reflection:descriptor_upb_proto", "//upb/reflection:reflection", ], @@ -71,6 +70,8 @@ bootstrap_cc_library( deps = [ ":names", ":names_internal", + "//src/google/protobuf/compiler:code_generator", + "//src/google/protobuf/compiler:plugin", "//upb:base", "//upb:mem", "//upb:mini_table", @@ -79,12 +80,14 @@ bootstrap_cc_library( "//upb_generator/common:names", "//upb_generator/minitable:names", "//upb_generator/minitable:names_internal", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", ], ) diff --git a/third_party/protobuf/upb_generator/c/generator.cc b/third_party/protobuf/upb_generator/c/generator.cc index 58f71957751aa..1423eedbd8c2a 100644 --- a/third_party/protobuf/upb_generator/c/generator.cc +++ b/third_party/protobuf/upb_generator/c/generator.cc @@ -19,8 +19,11 @@ #include <vector> #include "absl/base/macros.h" +#include "absl/container/flat_hash_set.h" #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" +#include "absl/memory/memory.h" +#include "absl/strings/cord.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" #include "absl/strings/numbers.h" @@ -28,9 +31,12 @@ #include "absl/strings/str_replace.h" #include "absl/strings/string_view.h" #include "absl/strings/substitute.h" +#include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/compiler/plugin.h" #include "upb/base/descriptor_constants.h" #include "upb/base/status.hpp" #include "upb/base/string_view.h" +#include "upb/mem/arena.hpp" #include "upb/mini_table/field.h" #include "upb/reflection/def.hpp" #include "upb_generator/c/names.h" @@ -219,6 +225,10 @@ std::string MapValueCType(upb::FieldDefPtr map_field) { return CType(map_field.message_type().map_value()); } +std::string MapValueCTypeConst(upb::FieldDefPtr map_field) { + return CTypeConst(map_field.message_type().map_value()); +} + std::string MapKeyValueSize(upb_CType ctype, absl::string_view expr) { return ctype == kUpb_CType_String || ctype == kUpb_CType_Bytes ? "0" @@ -475,14 +485,20 @@ void GenerateMapGetters(upb::FieldDefPtr field, const DefPoolPair& pools, MapValueSize(field, "*val")); output( R"cc( - UPB_INLINE $0 $1_$2_next(const $1* msg, size_t* iter) { - const upb_MiniTableField field = $3; + UPB_INLINE bool $0_$1_next(const $0* msg, $2* key, $3* val, + size_t* iter) { + const upb_MiniTableField field = $4; const upb_Map* map = upb_Message_GetMap(UPB_UPCAST(msg), &field); - if (!map) return NULL; - return ($0)_upb_map_next(map, iter); + if (!map) return false; + upb_MessageValue k; + upb_MessageValue v; + if (!upb_Map_Next(map, &k, &v, iter)) return false; + memcpy(key, &k, sizeof(*key)); + memcpy(val, &v, sizeof(*val)); + return true; } )cc", - CTypeConst(field), msg_name, resolved_name, + msg_name, resolved_name, MapKeyCType(field), MapValueCTypeConst(field), FieldInitializerStrong(pools, field, options)); // Generate private getter returning a upb_Map or NULL for immutable and // a upb_Map for mutable. @@ -655,17 +671,6 @@ void GenerateMapSetters(upb::FieldDefPtr field, const DefPoolPair& pools, )cc", msg_name, resolved_name, MapKeyCType(field), FieldInitializer(pools, field, options), MapKeySize(field, "key")); - output( - R"cc( - UPB_INLINE $0 $1_$2_nextmutable($1* msg, size_t* iter) { - const upb_MiniTableField field = $3; - upb_Map* map = (upb_Map*)upb_Message_GetMap(UPB_UPCAST(msg), &field); - if (!map) return NULL; - return ($0)_upb_map_next(map, iter); - } - )cc", - CType(field), msg_name, resolved_name, - FieldInitializerStrong(pools, field, options)); } void GenerateRepeatedSetters(upb::FieldDefPtr field, const DefPoolPair& pools, @@ -1148,35 +1153,42 @@ void WriteMiniDescriptorSource(const DefPoolPair& pools, upb::FileDefPtr file, } void GenerateFile(const DefPoolPair& pools, upb::FileDefPtr file, - const Options& options, Plugin* plugin) { + const Options& options, + google::protobuf::compiler::GeneratorContext* context) { Output h_output; WriteHeader(pools, file, options, h_output); - plugin->AddOutputFile(CApiHeaderFilename(file.name(), false), - h_output.output()); + { + auto stream = + absl::WrapUnique(context->Open(CApiHeaderFilename(file.name(), false))); + ABSL_CHECK(stream->WriteCord(absl::Cord(h_output.output()))); + } if (options.bootstrap_stage == 0) { Output c_output; WriteMiniDescriptorSource(pools, file, options, c_output); - plugin->AddOutputFile(SourceFilename(file), c_output.output()); + auto stream = absl::WrapUnique(context->Open(SourceFilename(file))); + ABSL_CHECK(stream->WriteCord(absl::Cord(c_output.output()))); } else { // TODO: remove once we can figure out how to make both Blaze // and Bazel happy with header-only libraries. - plugin->AddOutputFile(SourceFilename(file), "\n"); + auto stream = absl::WrapUnique(context->Open(SourceFilename(file))); + ABSL_CHECK(stream->WriteCord(absl::Cord("\n"))); } } -bool ParseOptions(Plugin* plugin, Options* options) { - for (const auto& pair : ParseGeneratorParameter(plugin->parameter())) { +bool ParseOptions(absl::string_view parameter, Options* options, + std::string* error) { + for (const auto& pair : ParseGeneratorParameter(parameter)) { if (pair.first == "bootstrap_stage") { if (!absl::SimpleAtoi(pair.second, &options->bootstrap_stage)) { - plugin->SetError(absl::Substitute("Bad stage: $0", pair.second)); + *error = absl::Substitute("Bad stage: $0", pair.second); return false; } } else if (pair.first == "experimental_strip_nonfunctional_codegen") { options->strip_nonfunctional_codegen = true; } else { - plugin->SetError(absl::Substitute("Unknown parameter: $0", pair.first)); + *error = absl::Substitute("Unknown parameter: $0", pair.first); return false; } } @@ -1184,9 +1196,46 @@ bool ParseOptions(Plugin* plugin, Options* options) { return true; } -absl::string_view ToStringView(upb_StringView str) { - return absl::string_view(str.data, str.size); -} +class CGenerator : public google::protobuf::compiler::CodeGenerator { + bool Generate(const google::protobuf::FileDescriptor* file, + const std::string& parameter, + google::protobuf::compiler::GeneratorContext* generator_context, + std::string* error) const override { + std::vector<const google::protobuf::FileDescriptor*> files{file}; + return GenerateAll(files, parameter, generator_context, error); + } + + bool GenerateAll(const std::vector<const google::protobuf::FileDescriptor*>& files, + const std::string& parameter, + google::protobuf::compiler::GeneratorContext* generator_context, + std::string* error) const override { + Options options; + if (!ParseOptions(parameter, &options, error)) { + return false; + } + + upb::Arena arena; + DefPoolPair pools; + absl::flat_hash_set<std::string> files_seen; + for (const auto* file : files) { + PopulateDefPool(file, &arena, &pools, &files_seen); + upb::FileDefPtr upb_file = pools.GetFile(file->name()); + GenerateFile(pools, upb_file, options, generator_context); + } + + return true; + } + + uint64_t GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL | FEATURE_SUPPORTS_EDITIONS; + } + google::protobuf::Edition GetMinimumEdition() const override { + return google::protobuf::Edition::EDITION_PROTO2; + } + google::protobuf::Edition GetMaximumEdition() const override { + return google::protobuf::Edition::EDITION_2023; + } +}; } // namespace @@ -1194,21 +1243,6 @@ absl::string_view ToStringView(upb_StringView str) { } // namespace upb int main(int argc, char** argv) { - upb::generator::DefPoolPair pools; - upb::generator::Plugin plugin; - upb::generator::Options options; - if (!ParseOptions(&plugin, &options)) return 0; - plugin.GenerateFilesRaw( - [&](const UPB_DESC(FileDescriptorProto) * file_proto, bool generate) { - upb::Status status; - upb::FileDefPtr file = pools.AddFile(file_proto, &status); - if (!file) { - absl::string_view name = upb::generator::ToStringView( - UPB_DESC(FileDescriptorProto_name)(file_proto)); - ABSL_LOG(FATAL) << "Couldn't add file " << name - << " to DefPool: " << status.error_message(); - } - if (generate) GenerateFile(pools, file, options, &plugin); - }); - return 0; + upb::generator::CGenerator generator; + return google::protobuf::compiler::PluginMain(argc, argv, &generator); } diff --git a/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb.h b/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb.h index d1592052c276b..a36bdc8192420 100644 --- a/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb.h +++ b/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb.h @@ -192,11 +192,11 @@ UPB_INLINE char* google_protobuf_compiler_CodeGeneratorRequest_serialize_ex(cons return ptr; } UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_clear_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView const* google_protobuf_compiler_CodeGeneratorRequest_file_to_generate(const google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -207,7 +207,7 @@ UPB_INLINE upb_StringView const* google_protobuf_compiler_CodeGeneratorRequest_f } } UPB_INLINE const upb_Array* _google_protobuf_compiler_CodeGeneratorRequest_file_to_generate_upb_array(const google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field); if (size) { *size = arr ? arr->UPB_PRIVATE(size) : 0; @@ -215,7 +215,7 @@ UPB_INLINE const upb_Array* _google_protobuf_compiler_CodeGeneratorRequest_file_ return arr; } UPB_INLINE upb_Array* _google_protobuf_compiler_CodeGeneratorRequest_file_to_generate_mutable_upb_array(google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size, upb_Arena* arena) { - const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg), &field, arena); if (size) { @@ -224,19 +224,19 @@ UPB_INLINE upb_Array* _google_protobuf_compiler_CodeGeneratorRequest_file_to_gen return arr; } UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_clear_parameter(google_protobuf_compiler_CodeGeneratorRequest* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE upb_StringView google_protobuf_compiler_CodeGeneratorRequest_parameter(const google_protobuf_compiler_CodeGeneratorRequest* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; - const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_has_parameter(const google_protobuf_compiler_CodeGeneratorRequest* msg) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_clear_compiler_version(google_protobuf_compiler_CodeGeneratorRequest* msg) { @@ -328,7 +328,7 @@ UPB_INLINE upb_Array* _google_protobuf_compiler_CodeGeneratorRequest_source_file } UPB_INLINE upb_StringView* google_protobuf_compiler_CodeGeneratorRequest_mutable_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg, size_t* size) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field); if (arr) { if (size) *size = arr->UPB_PRIVATE(size); @@ -339,12 +339,12 @@ UPB_INLINE upb_StringView* google_protobuf_compiler_CodeGeneratorRequest_mutable } } UPB_INLINE upb_StringView* google_protobuf_compiler_CodeGeneratorRequest_resize_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg), &field, size, arena); } UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_add_file_to_generate(google_protobuf_compiler_CodeGeneratorRequest* msg, upb_StringView val, upb_Arena* arena) { - upb_MiniTableField field = {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray( UPB_UPCAST(msg), &field, arena); if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)( @@ -356,7 +356,7 @@ UPB_INLINE bool google_protobuf_compiler_CodeGeneratorRequest_add_file_to_genera return true; } UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_set_parameter(google_protobuf_compiler_CodeGeneratorRequest *msg, upb_StringView value) { - const upb_MiniTableField field = {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } UPB_INLINE void google_protobuf_compiler_CodeGeneratorRequest_set_compiler_version(google_protobuf_compiler_CodeGeneratorRequest *msg, google_protobuf_compiler_Version* value) { diff --git a/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c b/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c index 4592a65b4a9eb..2b8a841dac176 100644 --- a/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c +++ b/third_party/protobuf/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c @@ -39,8 +39,8 @@ static const upb_MiniTableSubInternal google_protobuf_compiler_CodeGeneratorRequ }; static const upb_MiniTableField google_protobuf_compiler_CodeGeneratorRequest__fields[5] = { - {1, UPB_SIZE(12, 16), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, - {2, UPB_SIZE(28, 24), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, + {1, UPB_SIZE(12, 32), 0, kUpb_NoSub, 12, (int)kUpb_FieldMode_Array | (int)kUpb_LabelFlags_IsAlternate | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {2, UPB_SIZE(28, 16), 64, kUpb_NoSub, 12, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, {3, UPB_SIZE(16, 40), 65, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, {15, UPB_SIZE(20, 48), 0, 1, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, {17, UPB_SIZE(24, 56), 0, 2, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, @@ -55,7 +55,7 @@ const upb_MiniTable google__protobuf__compiler__CodeGeneratorRequest_msg_init = #endif UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001000003f00000a, &upb_prs_1bt}, + {0x002000003f00000a, &upb_prs_1bt}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, diff --git a/third_party/protobuf/upb_generator/common/BUILD b/third_party/protobuf/upb_generator/common/BUILD index 8687b7f87e658..78bf1727d5329 100644 --- a/third_party/protobuf/upb_generator/common/BUILD +++ b/third_party/protobuf/upb_generator/common/BUILD @@ -16,7 +16,27 @@ cc_library( hdrs = ["names.h"], visibility = ["//upb_generator:__subpackages__"], deps = [ - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:string_view", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", + ], +) + +cc_library( + name = "cpp_to_upb_def", + srcs = ["cpp_to_upb_def.cc"], + hdrs = ["cpp_to_upb_def.h"], + visibility = [ + "//src/google/protobuf/compiler/hpb:__subpackages__", + "//third_party/kotlin/protobuf/generator/native:__subpackages__", + ], + deps = [ + "//src/google/protobuf", + "//src/google/protobuf:descriptor_upb_c_proto", + "//upb:base", + "//upb:mem", + "//upb:mini_table", + "//upb:reflection", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", ], ) diff --git a/third_party/protobuf/upb_generator/common/cpp_to_upb_def.cc b/third_party/protobuf/upb_generator/common/cpp_to_upb_def.cc new file mode 100644 index 0000000000000..61665b5c54eb6 --- /dev/null +++ b/third_party/protobuf/upb_generator/common/cpp_to_upb_def.cc @@ -0,0 +1,100 @@ +// Copyright (c) 2024 Google LLC +// All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include "upb_generator/common/cpp_to_upb_def.h" + +#include <string> + +#include "google/protobuf/descriptor.upb.h" +#include "absl/log/absl_check.h" +#include "google/protobuf/descriptor.h" +#include "upb/base/status.hpp" +#include "upb/mem/arena.hpp" +#include "upb/mini_table/field.h" +#include "upb/reflection/def.hpp" + +namespace upb::generator { + +using google::protobuf::Descriptor; +using google::protobuf::EnumDescriptor; +using google::protobuf::FieldDescriptor; +using google::protobuf::FileDescriptor; + +// Internal helper that takes a filedesc and emits a upb proto; +// used for defpool tracking and dependency management +google_protobuf_FileDescriptorProto* ToUpbProto(const FileDescriptor* file, + upb::Arena* arena) { + google::protobuf::FileDescriptorProto proto; + file->CopyTo(&proto); + std::string serialized_proto = proto.SerializeAsString(); + google_protobuf_FileDescriptorProto* upb_proto = google_protobuf_FileDescriptorProto_parse( + serialized_proto.data(), serialized_proto.size(), arena->ptr()); + ABSL_CHECK(upb_proto) << "Failed to parse proto"; + return upb_proto; +} + +void AddFile(const FileDescriptor* file, upb::DefPool* pool) { + // Avoid adding the same file twice. + const std::string name(file->name()); + if (pool->FindFileByName(name.c_str())) return; + + // Like a google::protobuf::DescriptorPool, a upb::DefPool requires that all + // dependencies are added first. + for (int i = 0; i < file->dependency_count(); i++) { + AddFile(file->dependency(i), pool); + } + + upb::Arena tmp_arena; + upb::Status status; + ABSL_CHECK(pool->AddFile(ToUpbProto(file, &tmp_arena), &status)) + << status.error_message(); +} + +upb::MessageDefPtr FindMessageDef(upb::DefPool& pool, + const Descriptor* descriptor) { + const std::string name(descriptor->full_name()); + upb::MessageDefPtr message_def = pool.FindMessageByName(name.c_str()); + ABSL_CHECK(message_def) << "No message named " << name; + return message_def; +} + +upb::EnumDefPtr FindEnumDef(upb::DefPool& pool, + const EnumDescriptor* enum_descriptor) { + const std::string name(enum_descriptor->full_name()); + upb::EnumDefPtr enum_def = pool.FindEnumByName(name.c_str()); + ABSL_CHECK(enum_def) << "No enum named " << name; + return enum_def; +} + +upb::FieldDefPtr FindBaseFieldDef(upb::DefPool& pool, + const FieldDescriptor* field) { + ABSL_CHECK(!field->is_extension()); + upb::MessageDefPtr message_def = + FindMessageDef(pool, field->containing_type()); + upb::FieldDefPtr field_def = message_def.FindFieldByNumber(field->number()); + ABSL_CHECK(field_def) << "No field with number " << field->number() + << " in message " << message_def.full_name(); + return field_def; +} + +upb::FieldDefPtr FindExtensionDef(upb::DefPool& pool, + const FieldDescriptor* field) { + ABSL_CHECK(field->is_extension()); + const std::string name(field->full_name()); + return pool.FindExtensionByName(name.c_str()); +} + +const FieldDescriptor* FindFieldDescriptor( + const Descriptor* message, const upb_MiniTableField* field_def) { + int field_number = upb_MiniTableField_Number(field_def); + const FieldDescriptor* field = message->FindFieldByNumber(field_number); + ABSL_CHECK(field) << "No field in message " << message->full_name() + << " with number " << field_number; + return field; +} + +} // namespace upb::generator diff --git a/third_party/protobuf/upb_generator/common/cpp_to_upb_def.h b/third_party/protobuf/upb_generator/common/cpp_to_upb_def.h new file mode 100644 index 0000000000000..8ea1882bd8583 --- /dev/null +++ b/third_party/protobuf/upb_generator/common/cpp_to_upb_def.h @@ -0,0 +1,58 @@ +// Copyright (c) 2024 Google LLC +// All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#ifndef THIRD_PARTY_UPB_UPB_GENERATOR_COMMON_DESC_HELPERS_H_ +#define THIRD_PARTY_UPB_UPB_GENERATOR_COMMON_DESC_HELPERS_H_ + +#include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/descriptor.upb.h" +#include "google/protobuf/descriptor.h" +#include "upb/mem/arena.hpp" +#include "upb/mini_table/field.h" +#include "upb/reflection/def.hpp" + +namespace upb::generator { + +using google::protobuf::Descriptor; +using google::protobuf::EnumDescriptor; +using google::protobuf::FieldDescriptor; +using google::protobuf::FileDescriptor; + +// Add a filedesc to defpool, and all its dependencies. +void AddFile(const FileDescriptor* file, upb::DefPool* pool); + +// Given a Descriptor, returns a MessageDefPtr. +// This will fail if the message is not in the defpool. +// Files can be added to the defpool using AddFile. +upb::MessageDefPtr FindMessageDef(upb::DefPool& pool, + const Descriptor* descriptor); + +// Given an EnumDescriptor, returns an EnumDefPtr. +// This will fail if the enum is not in the defpool. +upb::EnumDefPtr FindEnumDef(upb::DefPool& pool, + const EnumDescriptor* enum_descriptor); + +// Given a FieldDescriptor, returns a FieldDefPtr. +// This will fail if the field is not in the defpool. +// This is for non-extension fields. For extensions, use FindExtensionDef. +upb::FieldDefPtr FindBaseFieldDef(upb::DefPool& pool, + const FieldDescriptor* field); + +// Given a FieldDescriptor, returns a FieldDefPtr. +// This will fail if the field is not in the defpool. +// This is solely for extension fields. +upb::FieldDefPtr FindExtensionDef(upb::DefPool& pool, + const FieldDescriptor* field); + +// Looks up a FieldDescriptor from a upb_MiniTableField. +// This will fail if the field is not in the message. +const FieldDescriptor* FindFieldDescriptor(const Descriptor* message, + const upb_MiniTableField* field_def); + +} // namespace upb::generator + +#endif // THIRD_PARTY_UPB_UPB_GENERATOR_COMMON_DESC_HELPERS_H_ diff --git a/third_party/protobuf/upb_generator/file_layout.h b/third_party/protobuf/upb_generator/file_layout.h index 4bf832e12467d..1c73d03cbf4f5 100644 --- a/third_party/protobuf/upb_generator/file_layout.h +++ b/third_party/protobuf/upb_generator/file_layout.h @@ -64,6 +64,10 @@ class DefPoolPair { return file64; } + upb::FileDefPtr GetFile(absl::string_view name) const { + return pool64_.FindFileByName(name.data()); + } + const upb_MiniTable* GetMiniTable32(upb::MessageDefPtr m) const { return pool32_.FindMessageByName(m.full_name()).mini_table(); } diff --git a/third_party/protobuf/upb_generator/minitable/BUILD b/third_party/protobuf/upb_generator/minitable/BUILD index a5eadfed93449..e34ea293cffdb 100644 --- a/third_party/protobuf/upb_generator/minitable/BUILD +++ b/third_party/protobuf/upb_generator/minitable/BUILD @@ -28,8 +28,6 @@ bootstrap_cc_library( bootstrap_deps = [ "//upb_generator:common", "//upb_generator:file_layout", - "//upb_generator:plugin", - "//upb_generator:plugin_upb_proto", "//upb/reflection:descriptor_upb_proto", "//upb/reflection:reflection", ], @@ -37,6 +35,7 @@ bootstrap_cc_library( deps = [ ":names", ":names_internal", + "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/compiler:code_generator_lite", "//upb:base", "//upb:mem", @@ -45,11 +44,13 @@ bootstrap_cc_library( "//upb:wire_reader", "//upb/mini_table:internal", "//upb_generator/common:names", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", ], ) @@ -66,7 +67,7 @@ cc_library( deps = [ ":names_internal", "//upb:port", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -80,7 +81,7 @@ cc_library( ], deps = [ "//upb_generator/common:names", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -93,7 +94,7 @@ bootstrap_cc_binary( visibility = [ "//editions/codegen_tests:__pkg__", "//net/proto2/contrib/protoc_explorer:__pkg__", - "//rust:__pkg__", + "//rust:__subpackages__", "//third_party/prototiller/transformer:__pkg__", ], ) @@ -115,13 +116,19 @@ bootstrap_cc_library( deps = [ ":names", ":names_internal", + "//src/google/protobuf/compiler:code_generator", "//src/google/protobuf/compiler:code_generator_lite", + "//src/google/protobuf/compiler:plugin", "//upb:base", + "//upb:mem", "//upb:port", "//upb_generator/common:names", - "@com_google_absl//absl/log:absl_check", - "@com_google_absl//absl/log:absl_log", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", ], ) diff --git a/third_party/protobuf/upb_generator/minitable/generator.cc b/third_party/protobuf/upb_generator/minitable/generator.cc index 99c63da067cc8..089b3d6d9d9b6 100644 --- a/third_party/protobuf/upb_generator/minitable/generator.cc +++ b/third_party/protobuf/upb_generator/minitable/generator.cc @@ -15,9 +15,12 @@ #include "absl/container/flat_hash_set.h" #include "absl/log/absl_check.h" +#include "absl/memory/memory.h" +#include "absl/strings/cord.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/strings/substitute.h" +#include "google/protobuf/compiler/code_generator.h" #include "upb/mini_table/enum.h" #include "upb/mini_table/field.h" #include "upb/mini_table/internal/field.h" @@ -29,7 +32,6 @@ #include "upb_generator/minitable/fasttable.h" #include "upb_generator/minitable/names.h" #include "upb_generator/minitable/names_internal.h" -#include "upb_generator/plugin.h" // Must be last. #include "upb/port/def.inc" @@ -431,10 +433,10 @@ std::string MultipleSourceFilename(upb::FileDefPtr file, *i, ".upb.c"); } -void WriteMiniTableMultipleSources(const DefPoolPair& pools, - upb::FileDefPtr file, - const MiniTableOptions& options, - Plugin* plugin) { +void WriteMiniTableMultipleSources( + const DefPoolPair& pools, upb::FileDefPtr file, + const MiniTableOptions& options, + google::protobuf::compiler::GeneratorContext* context) { std::vector<upb::MessageDefPtr> messages = SortedMessages(file); std::vector<upb::FieldDefPtr> extensions = SortedExtensions(file); std::vector<upb::EnumDefPtr> enums = SortedEnums(file, kClosedEnums); @@ -444,22 +446,25 @@ void WriteMiniTableMultipleSources(const DefPoolPair& pools, Output output; WriteMiniTableSourceIncludes(file, options, output); WriteMessage(message, pools, options, output); - plugin->AddOutputFile(MultipleSourceFilename(file, message.full_name(), &i), - output.output()); + auto stream = absl::WrapUnique( + context->Open(MultipleSourceFilename(file, message.full_name(), &i))); + ABSL_CHECK(stream->WriteCord(absl::Cord(output.output()))); } for (const auto e : enums) { Output output; WriteMiniTableSourceIncludes(file, options, output); WriteEnum(e, output); - plugin->AddOutputFile(MultipleSourceFilename(file, e.full_name(), &i), - output.output()); + auto stream = absl::WrapUnique( + context->Open(MultipleSourceFilename(file, e.full_name(), &i))); + ABSL_CHECK(stream->WriteCord(absl::Cord(output.output()))); } for (const auto ext : extensions) { Output output; WriteMiniTableSourceIncludes(file, options, output); WriteExtension(pools, ext, output); - plugin->AddOutputFile(MultipleSourceFilename(file, ext.full_name(), &i), - output.output()); + auto stream = absl::WrapUnique( + context->Open(MultipleSourceFilename(file, ext.full_name(), &i))); + ABSL_CHECK(stream->WriteCord(absl::Cord(output.output()))); } } diff --git a/third_party/protobuf/upb_generator/minitable/generator.h b/third_party/protobuf/upb_generator/minitable/generator.h index 1422974457670..065e8fc358075 100644 --- a/third_party/protobuf/upb_generator/minitable/generator.h +++ b/third_party/protobuf/upb_generator/minitable/generator.h @@ -5,10 +5,10 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd +#include "google/protobuf/compiler/code_generator.h" #include "upb/reflection/def.hpp" #include "upb_generator/common.h" #include "upb_generator/file_layout.h" -#include "upb_generator/plugin.h" namespace upb { namespace generator { @@ -24,7 +24,7 @@ void WriteMiniTableSource(const DefPoolPair& pools, upb::FileDefPtr file, void WriteMiniTableMultipleSources(const DefPoolPair& pools, upb::FileDefPtr file, const MiniTableOptions& options, - Plugin* plugin); + google::protobuf::compiler::GeneratorContext* context); void WriteMiniTableHeader(const DefPoolPair& pools, upb::FileDefPtr file, const MiniTableOptions& options, Output& output); diff --git a/third_party/protobuf/upb_generator/minitable/main.cc b/third_party/protobuf/upb_generator/minitable/main.cc index eff0186dd3aaa..9ea5a1ea42aea 100644 --- a/third_party/protobuf/upb_generator/minitable/main.cc +++ b/third_party/protobuf/upb_generator/minitable/main.cc @@ -5,16 +5,24 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd +#include <cstdint> #include <string> #include <utility> #include <vector> +#include "absl/container/flat_hash_set.h" +#include "absl/log/absl_check.h" #include "absl/log/absl_log.h" +#include "absl/memory/memory.h" +#include "absl/strings/cord.h" #include "absl/strings/string_view.h" #include "absl/strings/substitute.h" +#include "google/protobuf/compiler/code_generator.h" #include "google/protobuf/compiler/code_generator_lite.h" +#include "google/protobuf/compiler/plugin.h" #include "upb/base/status.hpp" #include "upb/base/string_view.h" +#include "upb/mem/arena.hpp" #include "upb/reflection/def.hpp" #include "upb_generator/common.h" #include "upb_generator/common/names.h" @@ -33,28 +41,32 @@ std::string SourceFilename(upb::FileDefPtr file) { return StripExtension(file.name()) + ".upb_minitable.c"; } -absl::string_view ToStringView(upb_StringView str) { - return absl::string_view(str.data, str.size); -} - void GenerateFile(const DefPoolPair& pools, upb::FileDefPtr file, - const MiniTableOptions& options, Plugin* plugin) { + const MiniTableOptions& options, + google::protobuf::compiler::GeneratorContext* context) { Output h_output; WriteMiniTableHeader(pools, file, options, h_output); - plugin->AddOutputFile(MiniTableHeaderFilename(file.name(), false), - h_output.output()); + { + auto stream = absl::WrapUnique( + context->Open(MiniTableHeaderFilename(file.name(), false))); + ABSL_CHECK(stream->WriteCord(absl::Cord(h_output.output()))); + } Output c_output; WriteMiniTableSource(pools, file, options, c_output); - plugin->AddOutputFile(SourceFilename(file), c_output.output()); + { + auto stream = absl::WrapUnique(context->Open(SourceFilename(file))); + ABSL_CHECK(stream->WriteCord(absl::Cord(c_output.output()))); + } if (options.one_output_per_message) { - WriteMiniTableMultipleSources(pools, file, options, plugin); + WriteMiniTableMultipleSources(pools, file, options, context); } } -bool ParseOptions(MiniTableOptions* options, Plugin* plugin) { - for (const auto& pair : ParseGeneratorParameter(plugin->parameter())) { +bool ParseOptions(MiniTableOptions* options, absl::string_view parameter, + std::string* error) { + for (const auto& pair : ParseGeneratorParameter(parameter)) { if (pair.first == "bootstrap_stage") { options->bootstrap = true; } else if (pair.first == "experimental_strip_nonfunctional_codegen") { @@ -62,7 +74,7 @@ bool ParseOptions(MiniTableOptions* options, Plugin* plugin) { } else if (pair.first == "one_output_per_message") { options->one_output_per_message = true; } else { - plugin->SetError(absl::Substitute("Unknown parameter: $0", pair.first)); + *error = absl::Substitute("Unknown parameter: $0", pair.first); return false; } } @@ -70,29 +82,51 @@ bool ParseOptions(MiniTableOptions* options, Plugin* plugin) { return true; } -int PluginMain(int argc, char** argv) { - DefPoolPair pools; - MiniTableOptions options; - Plugin plugin; - if (!ParseOptions(&options, &plugin)) return 0; - plugin.GenerateFilesRaw( - [&](const UPB_DESC(FileDescriptorProto) * file_proto, bool generate) { - upb::Status status; - upb::FileDefPtr file = pools.AddFile(file_proto, &status); - if (!file) { - absl::string_view name = - ToStringView(UPB_DESC(FileDescriptorProto_name)(file_proto)); - ABSL_LOG(FATAL) << "Couldn't add file " << name - << " to DefPool: " << status.error_message(); - } - if (generate) GenerateFile(pools, file, options, &plugin); - }); - return 0; -} +class MiniTableGenerator : public google::protobuf::compiler::CodeGenerator { + bool Generate(const google::protobuf::FileDescriptor* file, + const std::string& parameter, + google::protobuf::compiler::GeneratorContext* generator_context, + std::string* error) const override { + std::vector<const google::protobuf::FileDescriptor*> files{file}; + return GenerateAll(files, parameter, generator_context, error); + } + + bool GenerateAll(const std::vector<const google::protobuf::FileDescriptor*>& files, + const std::string& parameter, + google::protobuf::compiler::GeneratorContext* generator_context, + std::string* error) const override { + MiniTableOptions options; + if (!ParseOptions(&options, parameter, error)) { + return false; + } + + upb::Arena arena; + DefPoolPair pools; + absl::flat_hash_set<std::string> files_seen; + for (const auto* file : files) { + PopulateDefPool(file, &arena, &pools, &files_seen); + upb::FileDefPtr upb_file = pools.GetFile(file->name()); + GenerateFile(pools, upb_file, options, generator_context); + } + + return true; + } + + uint64_t GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL | FEATURE_SUPPORTS_EDITIONS; + } + google::protobuf::Edition GetMinimumEdition() const override { + return google::protobuf::Edition::EDITION_PROTO2; + } + google::protobuf::Edition GetMaximumEdition() const override { + return google::protobuf::Edition::EDITION_2023; + } +}; } // namespace generator } // namespace upb int main(int argc, char** argv) { - return upb::generator::PluginMain(argc, argv); + upb::generator::MiniTableGenerator generator; + return google::protobuf::compiler::PluginMain(argc, argv, &generator); } diff --git a/third_party/protobuf/upb_generator/plugin.cc b/third_party/protobuf/upb_generator/plugin.cc new file mode 100644 index 0000000000000..dab330ccab74e --- /dev/null +++ b/third_party/protobuf/upb_generator/plugin.cc @@ -0,0 +1,58 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2025 Google LLC. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#include "upb_generator/plugin.h" + +#include <string> + +#include "google/protobuf/descriptor.pb.h" +#include "absl/container/flat_hash_set.h" +#include "absl/log/absl_log.h" +#include "absl/strings/string_view.h" +#include "google/protobuf/descriptor.h" +#include "upb/base/status.hpp" +#include "upb/base/string_view.h" +#include "upb/mem/arena.hpp" +#include "upb/reflection/def.hpp" +#include "upb_generator/file_layout.h" + +// Must be last. +#include "upb/port/def.inc" + +namespace upb { +namespace generator { + +absl::string_view ToStringView(upb_StringView str) { + return absl::string_view(str.data, str.size); +} + +void PopulateDefPool(const google::protobuf::FileDescriptor* file, upb::Arena* arena, + DefPoolPair* pools, + absl::flat_hash_set<std::string>* files_seen) { + bool new_file = files_seen->insert(std::string(file->name())).second; + if (new_file) { + for (int i = 0; i < file->dependency_count(); ++i) { + PopulateDefPool(file->dependency(i), arena, pools, files_seen); + } + google::protobuf::FileDescriptorProto raw_proto; + file->CopyTo(&raw_proto); + std::string serialized = raw_proto.SerializeAsString(); + auto* file_proto = UPB_DESC(FileDescriptorProto_parse)( + serialized.data(), serialized.size(), arena->ptr()); + upb::Status status; + upb::FileDefPtr upb_file = pools->AddFile(file_proto, &status); + if (!upb_file) { + absl::string_view name = + ToStringView(UPB_DESC(FileDescriptorProto_name)(file_proto)); + ABSL_LOG(FATAL) << "Couldn't add file " << name + << " to DefPool: " << status.error_message(); + } + } +} + +} // namespace generator +} // namespace upb diff --git a/third_party/protobuf/upb_generator/plugin.h b/third_party/protobuf/upb_generator/plugin.h index c75bd033e26a9..b3b36676b5c60 100644 --- a/third_party/protobuf/upb_generator/plugin.h +++ b/third_party/protobuf/upb_generator/plugin.h @@ -21,16 +21,13 @@ #endif #include "absl/container/flat_hash_set.h" -#include "absl/log/absl_log.h" #include "absl/strings/string_view.h" #include "google/protobuf/compiler/code_generator_lite.h" -#include "upb/base/status.hpp" -#include "upb/base/string_view.h" +#include "google/protobuf/descriptor.h" #include "upb/mem/arena.h" #include "upb/mem/arena.hpp" -#include "upb/reflection/def.hpp" #include "upb/reflection/descriptor_bootstrap.h" -#include "upb_generator/plugin_bootstrap.h" +#include "upb_generator/file_layout.h" // Must be last. #include "upb/port/def.inc" @@ -45,134 +42,10 @@ inline std::vector<std::pair<std::string, std::string>> ParseGeneratorParameter( return ret; } -class Plugin { - public: - Plugin() { ReadRequest(); } - ~Plugin() { WriteResponse(); } - - absl::string_view parameter() const { - return ToStringView( - UPB_DESC(compiler_CodeGeneratorRequest_parameter)(request_)); - } - - template <class T> - void GenerateFilesRaw(T&& func) { - absl::flat_hash_set<absl::string_view> files_to_generate; - size_t size; - const upb_StringView* file_to_generate = UPB_DESC( - compiler_CodeGeneratorRequest_file_to_generate)(request_, &size); - for (size_t i = 0; i < size; i++) { - files_to_generate.insert( - {file_to_generate[i].data, file_to_generate[i].size}); - } - - const UPB_DESC(FileDescriptorProto)* const* files = - UPB_DESC(compiler_CodeGeneratorRequest_proto_file)(request_, &size); - for (size_t i = 0; i < size; i++) { - upb::Status status; - absl::string_view name = - ToStringView(UPB_DESC(FileDescriptorProto_name)(files[i])); - func(files[i], files_to_generate.contains(name)); - } - } - - template <class T> - void GenerateFiles(T&& func) { - GenerateFilesRaw( - [this, &func](const UPB_DESC(FileDescriptorProto) * file_proto, - bool generate) { - upb::Status status; - upb::FileDefPtr file = pool_.AddFile(file_proto, &status); - if (!file) { - absl::string_view name = - ToStringView(UPB_DESC(FileDescriptorProto_name)(file_proto)); - ABSL_LOG(FATAL) << "Couldn't add file " << name - << " to DefPool: " << status.error_message(); - } - if (generate) func(file); - }); - } - - void SetError(absl::string_view error) { - char* data = - static_cast<char*>(upb_Arena_Malloc(arena_.ptr(), error.size())); - memcpy(data, error.data(), error.size()); - UPB_DESC(compiler_CodeGeneratorResponse_set_error) - (response_, upb_StringView_FromDataAndSize(data, error.size())); - } - - void AddOutputFile(absl::string_view filename, absl::string_view content) { - UPB_DESC(compiler_CodeGeneratorResponse_File)* file = UPB_DESC( - compiler_CodeGeneratorResponse_add_file)(response_, arena_.ptr()); - UPB_DESC(compiler_CodeGeneratorResponse_File_set_name) - (file, StringDup(filename)); - UPB_DESC(compiler_CodeGeneratorResponse_File_set_content) - (file, StringDup(content)); - } - - private: - upb::Arena arena_; - upb::DefPool pool_; - UPB_DESC(compiler_CodeGeneratorRequest) * request_; - UPB_DESC(compiler_CodeGeneratorResponse) * response_; - - static absl::string_view ToStringView(upb_StringView sv) { - return absl::string_view(sv.data, sv.size); - } - - upb_StringView StringDup(absl::string_view s) { - char* data = - reinterpret_cast<char*>(upb_Arena_Malloc(arena_.ptr(), s.size())); - memcpy(data, s.data(), s.size()); - return upb_StringView_FromDataAndSize(data, s.size()); - } - - std::string ReadAllStdinBinary() { - std::string data; -#ifdef _WIN32 - _setmode(_fileno(stdin), _O_BINARY); - _setmode(_fileno(stdout), _O_BINARY); -#endif - char buf[4096]; - while (size_t len = fread(buf, 1, sizeof(buf), stdin)) { - data.append(buf, len); - } - return data; - } - - void ReadRequest() { - std::string data = ReadAllStdinBinary(); - request_ = UPB_DESC(compiler_CodeGeneratorRequest_parse)( - data.data(), data.size(), arena_.ptr()); - if (!request_) { - ABSL_LOG(FATAL) << "Failed to parse CodeGeneratorRequest"; - } - response_ = UPB_DESC(compiler_CodeGeneratorResponse_new)(arena_.ptr()); - - int features = - UPB_DESC(compiler_CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | - UPB_DESC(compiler_CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS); - UPB_DESC(compiler_CodeGeneratorResponse_set_supported_features) - (response_, features); - UPB_DESC(compiler_CodeGeneratorResponse_set_minimum_edition) - (response_, UPB_DESC(EDITION_PROTO2)); - UPB_DESC(compiler_CodeGeneratorResponse_set_maximum_edition) - (response_, UPB_DESC(EDITION_2023)); - } - - void WriteResponse() { - size_t size; - char* serialized = UPB_DESC(compiler_CodeGeneratorResponse_serialize)( - response_, arena_.ptr(), &size); - if (!serialized) { - ABSL_LOG(FATAL) << "Failed to serialize CodeGeneratorResponse"; - } - - if (fwrite(serialized, 1, size, stdout) != size) { - ABSL_LOG(FATAL) << "Failed to write response to stdout"; - } - } -}; +// Recursively populates the DefPoolPair with the given FileDescriptor. +void PopulateDefPool(const google::protobuf::FileDescriptor* file, upb::Arena* arena, + DefPoolPair* pools, + absl::flat_hash_set<std::string>* files_seen); } // namespace generator } // namespace upb diff --git a/third_party/protobuf/upb_generator/plugin_bootstrap.h b/third_party/protobuf/upb_generator/plugin_bootstrap.h index 87afc06fbbd9b..da9fe6875abdd 100644 --- a/third_party/protobuf/upb_generator/plugin_bootstrap.h +++ b/third_party/protobuf/upb_generator/plugin_bootstrap.h @@ -6,7 +6,7 @@ #if defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 0 // This header is checked in. #include "upb_generator/stage0/google/protobuf/compiler/plugin.upb.h" -#elif UPB_BOOTSTRAP_STAGE == 1 +#elif defined(UPB_BOOTSTRAP_STAGE) && UPB_BOOTSTRAP_STAGE == 1 // This header is generated at build time by the bootstrapping process. #include "upb_generator/stage1/google/protobuf/compiler/plugin.upb.h" #else diff --git a/third_party/protobuf/upb_generator/reflection/BUILD b/third_party/protobuf/upb_generator/reflection/BUILD index db8bf892d6b99..fd74f1c904fb5 100644 --- a/third_party/protobuf/upb_generator/reflection/BUILD +++ b/third_party/protobuf/upb_generator/reflection/BUILD @@ -19,7 +19,7 @@ cc_library( deps = [ "//upb:port", "//upb_generator/common:names", - "@com_google_absl//absl/strings", + "@abseil-cpp//absl/strings", ], ) @@ -44,7 +44,10 @@ cc_library( deps = [ ":names", "//src/google/protobuf:descriptor_upb_c_proto", + "//src/google/protobuf/compiler:code_generator", + "//src/google/protobuf/compiler:plugin", "//upb:mem", + "//upb:port", "//upb:reflection", "//upb/util:def_to_proto", "//upb_generator:common", @@ -52,8 +55,12 @@ cc_library( "//upb_generator:plugin", "//upb_generator/common:names", "//upb_generator/minitable:names", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:string_view", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + "@abseil-cpp//absl/strings:string_view", ], ) diff --git a/third_party/protobuf/upb_generator/reflection/generator.cc b/third_party/protobuf/upb_generator/reflection/generator.cc index 3c748f9650584..a98eb0418ff53 100644 --- a/third_party/protobuf/upb_generator/reflection/generator.cc +++ b/third_party/protobuf/upb_generator/reflection/generator.cc @@ -6,12 +6,20 @@ // https://developers.google.com/open-source/licenses/bsd #include <cstddef> +#include <cstdint> #include <string> +#include <vector> #include "google/protobuf/descriptor.upb.h" +#include "absl/container/flat_hash_set.h" +#include "absl/log/absl_check.h" +#include "absl/memory/memory.h" +#include "absl/strings/cord.h" #include "absl/strings/escaping.h" #include "absl/strings/string_view.h" #include "absl/strings/substitute.h" +#include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/compiler/plugin.h" #include "upb/mem/arena.hpp" #include "upb/reflection/def.hpp" #include "upb/util/def_to_proto.h" @@ -22,6 +30,9 @@ #include "upb_generator/plugin.h" #include "upb_generator/reflection/names.h" +// Must be last. +#include "upb/port/def.inc" + namespace upb { namespace generator { namespace { @@ -141,22 +152,29 @@ void WriteDefSource(upb::FileDefPtr file, const Options& options, } void GenerateFile(upb::FileDefPtr file, const Options& options, - Plugin* plugin) { + google::protobuf::compiler::GeneratorContext* context) { Output h_def_output; WriteDefHeader(file, options, h_def_output); - plugin->AddOutputFile(DefHeaderFilename(file), h_def_output.output()); + { + auto stream = absl::WrapUnique(context->Open(DefHeaderFilename(file))); + ABSL_CHECK(stream->WriteCord(absl::Cord(h_def_output.output()))); + } Output c_def_output; WriteDefSource(file, options, c_def_output); - plugin->AddOutputFile(DefSourceFilename(file), c_def_output.output()); + { + auto stream = absl::WrapUnique(context->Open(DefSourceFilename(file))); + ABSL_CHECK(stream->WriteCord(absl::Cord(c_def_output.output()))); + } } -bool ParseOptions(Plugin* plugin, Options* options) { - for (const auto& pair : ParseGeneratorParameter(plugin->parameter())) { +bool ParseOptions(absl::string_view parameter, Options* options, + std::string* error) { + for (const auto& pair : ParseGeneratorParameter(parameter)) { if (pair.first == "dllexport_decl") { options->dllexport_decl = pair.second; } else { - plugin->SetError(absl::Substitute("Unknown parameter: $0", pair.first)); + *error = absl::Substitute("Unknown parameter: $0", pair.first); return false; } } @@ -165,15 +183,52 @@ bool ParseOptions(Plugin* plugin, Options* options) { } } // namespace + +class ReflectionGenerator : public google::protobuf::compiler::CodeGenerator { + bool Generate(const google::protobuf::FileDescriptor* file, + const std::string& parameter, + google::protobuf::compiler::GeneratorContext* generator_context, + std::string* error) const override { + std::vector<const google::protobuf::FileDescriptor*> files{file}; + return GenerateAll(files, parameter, generator_context, error); + } + + bool GenerateAll(const std::vector<const google::protobuf::FileDescriptor*>& files, + const std::string& parameter, + google::protobuf::compiler::GeneratorContext* generator_context, + std::string* error) const override { + Options options; + if (!ParseOptions(parameter, &options, error)) { + return false; + } + + upb::Arena arena; + DefPoolPair pools; + absl::flat_hash_set<std::string> files_seen; + for (const auto* file : files) { + PopulateDefPool(file, &arena, &pools, &files_seen); + upb::FileDefPtr upb_file = pools.GetFile(file->name()); + GenerateFile(upb_file, options, generator_context); + } + + return true; + } + + uint64_t GetSupportedFeatures() const override { + return FEATURE_PROTO3_OPTIONAL | FEATURE_SUPPORTS_EDITIONS; + } + google::protobuf::Edition GetMinimumEdition() const override { + return google::protobuf::Edition::EDITION_PROTO2; + } + google::protobuf::Edition GetMaximumEdition() const override { + return google::protobuf::Edition::EDITION_2023; + } +}; + } // namespace generator } // namespace upb int main(int argc, char** argv) { - upb::generator::Plugin plugin; - upb::generator::Options options; - if (!ParseOptions(&plugin, &options)) return 0; - plugin.GenerateFiles([&](upb::FileDefPtr file) { - upb::generator::GenerateFile(file, options, &plugin); - }); - return 0; + upb::generator::ReflectionGenerator generator; + return google::protobuf::compiler::PluginMain(argc, argv, &generator); } diff --git a/third_party/protobuf/version.json b/third_party/protobuf/version.json index 50d8e96541bfa..4c1c29da2f3a2 100644 --- a/third_party/protobuf/version.json +++ b/third_party/protobuf/version.json @@ -1,17 +1,18 @@ { - "29.x": { - "protoc_version": "29.3", + "30.x": { + "protoc_version": "30.1", "lts": false, - "date": "2025-01-08", + "date": "2025-03-13", "languages": { - "cpp": "5.29.3", - "csharp": "3.29.3", - "java": "4.29.3", - "javascript": "3.29.3", - "objectivec": "3.29.3", - "php": "4.29.3", - "python": "5.29.3", - "ruby": "4.29.3" + "cpp": "6.30.1", + "csharp": "3.30.1", + "java": "4.30.1", + "javascript": "3.30.1", + "objectivec": "4.30.1", + "php": "4.30.1", + "python": "6.30.1", + "ruby": "4.30.1", + "rust": "4.30.1" } } } \ No newline at end of file